-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[JSC] Do not resolve rope when constructing Function #47096
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JSC] Do not resolve rope when constructing Function #47096
Conversation
EWS run on previous version of this PR (hash 34349b0) |
void writeTo(std::span<CharacterType> destination) const | ||
{ | ||
if (auto value = m_string->tryGetValueWithoutGC(); !value->isNull()) { | ||
StringView { value }.getCharacters(destination); | ||
return; | ||
} | ||
jsCast<JSC::JSRopeString*>(m_string)->resolveToBuffer(destination); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct? Are we sure that it's definitely a rope string after the first if
check? And what happens if the value
is null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right. Let me fix it.
34349b0
to
d7f8b5d
Compare
EWS run on previous version of this PR (hash d7f8b5d) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me
d7f8b5d
to
9fd257f
Compare
EWS run on current version of this PR (hash 9fd257f) |
https://bugs.webkit.org/show_bug.cgi?id=294878 rdar://154145026 Reviewed by Yijia Huang. Let's avoid resolving string for input for Function constructor. It is not so super efficient if we resolve them. We also avoid creating SourceCode so that we do not need to allocate StringSourceProvider. * Source/JavaScriptCore/runtime/FunctionConstructor.cpp: (JSC::stringifyFunction): (JSC::constructFunction): (JSC::constructFunctionSkippingEvalEnabledCheck): * Source/JavaScriptCore/runtime/FunctionExecutable.cpp: (JSC::FunctionExecutable::fromGlobalCode): * Source/JavaScriptCore/runtime/FunctionExecutable.h: * Source/JavaScriptCore/runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::tryGetCachedFunctionExecutableForFunctionConstructor): * Source/JavaScriptCore/runtime/JSGlobalObject.h: * Source/JavaScriptCore/runtime/JSString.h: (WTF::StringTypeAdapter<JSC::JSString::StringTypeAdapter): (WTF::StringTypeAdapter<JSC::JSString::length const): (WTF::StringTypeAdapter<JSC::JSString::is8Bit const): (WTF::StringTypeAdapter<JSC::JSString::writeTo const): * Source/JavaScriptCore/runtime/JSStringInlines.h: (JSC::JSString::resolveToBuffer): Canonical link: https://commits.webkit.org/296661@main
9fd257f
to
05cdfcb
Compare
Committed 296661@main (05cdfcb): https://commits.webkit.org/296661@main Reviewed commits have been landed. Closing PR #47096 and removing active labels. |
05cdfcb
9fd257f