- Revision
- 241552
- Author
- tzaga...@apple.com
- Date
- 2019-02-14 10:12:23 -0800 (Thu, 14 Feb 2019)
Log Message
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):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (241551 => 241552)
--- trunk/Source/_javascript_Core/ChangeLog 2019-02-14 18:12:19 UTC (rev 241551)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-02-14 18:12:23 UTC (rev 241552)
@@ -1,5 +1,22 @@
2019-02-14 Tadeu Zagallo <tzaga...@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-14 Tadeu Zagallo <tzaga...@apple.com>
+
CachedBitVector's size must be converted from bits to bytes
https://bugs.webkit.org/show_bug.cgi?id=194441
Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.cpp (241551 => 241552)
--- trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.cpp 2019-02-14 18:12:19 UTC (rev 241551)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.cpp 2019-02-14 18:12:23 UTC (rev 241552)
@@ -133,26 +133,28 @@
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 startColumn = linkedStartColumn(parentSource.startColumn().oneBasedInt());
+ unsigned startOffset = parentSource.startOffset() + m_startOffset;
unsigned firstLine = parentSource.firstLine().oneBasedInt() + m_firstLineOffset;
- unsigned startOffset = parentSource.startOffset() + m_startOffset;
+ return SourceCode(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 startColumn = linkedStartColumn(parentSource.startColumn().oneBasedInt());
- unsigned endColumn = linkedEndColumn(startColumn);
-
- SourceCode source(parentSource.provider(), startOffset, startOffset + m_sourceLength, firstLine, startColumn);
+ 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;
}
Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.h (241551 => 241552)
--- trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.h 2019-02-14 18:12:19 UTC (rev 241551)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.h 2019-02-14 18:12:23 UTC (rev 241552)
@@ -114,6 +114,7 @@
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)
Modified: trunk/Source/_javascript_Core/runtime/CodeCache.cpp (241551 => 241552)
--- trunk/Source/_javascript_Core/runtime/CodeCache.cpp 2019-02-14 18:12:19 UTC (rev 241551)
+++ trunk/Source/_javascript_Core/runtime/CodeCache.cpp 2019-02-14 18:12:23 UTC (rev 241552)
@@ -173,10 +173,7 @@
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);