WebKit Bugzilla
Attachment 362029 Details for
Bug 194576
: generateUnlinkedCodeBlockForFunctions shouldn't need to create a FunctionExecutable just to get its source code
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-194576-20190214183447.patch (text/plain), 5.85 KB, created by
Tadeu Zagallo
on 2019-02-14 09:35:21 PST
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Tadeu Zagallo
Created:
2019-02-14 09:35:21 PST
Size:
5.85 KB
patch
obsolete
>Subversion Revision: 241433 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index f6cecf256239111564dd72af4b7d5a4ef8ee2059..65354346183f09997ca8aef4a3ed1afeb11d6381 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,20 @@ >+2019-02-14 Tadeu Zagallo <tzagallo@apple.com> >+ >+ generateUnlinkedCodeBlockForFunctions shouldn't need to create a FunctionExecutable just to get its source code >+ https://bugs.webkit.org/show_bug.cgi?id=194576 >+ >+ Reviewed by Saam Barati. >+ >+ Extract a new function, `linkedSourceCode` from UnlinkedFunctionExecutable::link >+ and use it in `generateUnlinkedCodeBlockForFunctions` instead. >+ >+ * bytecode/UnlinkedFunctionExecutable.cpp: >+ (JSC::UnlinkedFunctionExecutable::linkedSourceCode const): >+ (JSC::UnlinkedFunctionExecutable::link): >+ * bytecode/UnlinkedFunctionExecutable.h: >+ * runtime/CodeCache.cpp: >+ (JSC::generateUnlinkedCodeBlockForFunctions): >+ > 2019-02-13 Tadeu Zagallo <tzagallo@apple.com> > > SourceCode should be copied when generating bytecode for functions >diff --git a/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp b/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp >index ac416e4df68a67e804f3b3209ba941afa3902bba..b53f64c8d1f4a01df0e638174a23817ab747446d 100644 >--- a/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp >+++ b/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp >@@ -133,26 +133,28 @@ void UnlinkedFunctionExecutable::visitChildren(JSCell* cell, SlotVisitor& visito > visitor.append(thisObject->m_unlinkedCodeBlockForConstruct); > } > >-FunctionExecutable* UnlinkedFunctionExecutable::link(VM& vm, const SourceCode& passedParentSource, Optional<int> overrideLineNumber, Intrinsic intrinsic) >+SourceCode UnlinkedFunctionExecutable::linkedSourceCode(const SourceCode& passedParentSource) const > { > const SourceCode& parentSource = !m_isBuiltinDefaultClassConstructor ? passedParentSource : BuiltinExecutables::defaultConstructorSourceCode(constructorKind()); >- unsigned firstLine = parentSource.firstLine().oneBasedInt() + m_firstLineOffset; >- unsigned startOffset = parentSource.startOffset() + m_startOffset; >- unsigned lineCount = m_lineCount; >- > unsigned startColumn = linkedStartColumn(parentSource.startColumn().oneBasedInt()); >- unsigned endColumn = linkedEndColumn(startColumn); >+ unsigned startOffset = parentSource.startOffset() + m_startOffset; >+ unsigned firstLine = parentSource.firstLine().oneBasedInt() + m_firstLineOffset; >+ return SourceCode(parentSource.provider(), startOffset, startOffset + m_sourceLength, firstLine, startColumn); >+} > >- SourceCode source(parentSource.provider(), startOffset, startOffset + m_sourceLength, firstLine, startColumn); >+FunctionExecutable* UnlinkedFunctionExecutable::link(VM& vm, const SourceCode& passedParentSource, Optional<int> overrideLineNumber, Intrinsic intrinsic) >+{ >+ SourceCode source = linkedSourceCode(passedParentSource); >+ unsigned firstLine = source.firstLine().oneBasedInt(); >+ unsigned lineCount = m_lineCount; >+ unsigned endColumn = linkedEndColumn(source.startColumn().oneBasedInt()); > FunctionOverrides::OverrideInfo overrideInfo; > bool hasFunctionOverride = false; >- > if (UNLIKELY(Options::functionOverrides())) { > hasFunctionOverride = FunctionOverrides::initializeOverrideFor(source, overrideInfo); > if (UNLIKELY(hasFunctionOverride)) { > firstLine = overrideInfo.firstLine; > lineCount = overrideInfo.lineCount; >- startColumn = overrideInfo.startColumn; > endColumn = overrideInfo.endColumn; > source = overrideInfo.sourceCode; > } >diff --git a/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h b/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h >index c8109eee1d81000e143ea2a35c8b7fbf60e10d78..9982d341949fecd1ebb02937399c1a16dfaa295f 100644 >--- a/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h >+++ b/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h >@@ -114,6 +114,7 @@ public: > const Identifier&, ExecState&, const SourceCode&, JSObject*& exception, > int overrideLineNumber, Optional<int> functionConstructorParametersEndPosition); > >+ SourceCode linkedSourceCode(const SourceCode&) const; > JS_EXPORT_PRIVATE FunctionExecutable* link(VM&, const SourceCode& parentSource, Optional<int> overrideLineNumber = WTF::nullopt, Intrinsic = NoIntrinsic); > > void clearCode(VM& vm) >diff --git a/Source/JavaScriptCore/runtime/CodeCache.cpp b/Source/JavaScriptCore/runtime/CodeCache.cpp >index 9b6070be93f985a4f2b4f3e0db1355da7a11a3f8..3d94baea44ecbcaa2ef0f523b2f5eaacf4aa35ef 100644 >--- a/Source/JavaScriptCore/runtime/CodeCache.cpp >+++ b/Source/JavaScriptCore/runtime/CodeCache.cpp >@@ -169,10 +169,7 @@ void generateUnlinkedCodeBlockForFunctions(VM& vm, UnlinkedCodeBlock* unlinkedCo > if (constructorKind == CodeForConstruct && SourceParseModeSet(SourceParseMode::AsyncArrowFunctionMode, SourceParseMode::AsyncMethodMode, SourceParseMode::AsyncFunctionMode).contains(unlinkedExecutable->parseMode())) > return; > >- FunctionExecutable* executable = unlinkedExecutable->link(vm, parentSource); >- // FIXME: We shouldn't need to create a FunctionExecutable just to get its source code >- // https://bugs.webkit.org/show_bug.cgi?id=194576 >- SourceCode source = executable->source(); >+ SourceCode source = unlinkedExecutable->linkedSourceCode(parentSource); > UnlinkedFunctionCodeBlock* unlinkedFunctionCodeBlock = unlinkedExecutable->unlinkedCodeBlockFor(vm, source, constructorKind, debuggerMode, error, unlinkedExecutable->parseMode()); > if (unlinkedFunctionCodeBlock) > generateUnlinkedCodeBlockForFunctions(vm, unlinkedFunctionCodeBlock, source, debuggerMode, error);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194576
:
361919
|
362027
| 362029