Changeset 237445 in webkit
- Timestamp:
- Oct 25, 2018, 9:51:59 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 13 edited
-
ChangeLog (modified) (1 diff)
-
bytecode/UnlinkedFunctionExecutable.cpp (modified) (2 diffs)
-
bytecode/UnlinkedFunctionExecutable.h (modified) (1 diff)
-
parser/Parser.cpp (modified) (9 diffs)
-
parser/Parser.h (modified) (10 diffs)
-
parser/ParserModes.h (modified) (1 diff)
-
parser/ParserTokens.h (modified) (2 diffs)
-
parser/SourceCodeKey.h (modified) (4 diffs)
-
runtime/CodeCache.cpp (modified) (3 diffs)
-
runtime/CodeCache.h (modified) (1 diff)
-
runtime/FunctionConstructor.cpp (modified) (1 diff)
-
runtime/FunctionExecutable.cpp (modified) (1 diff)
-
runtime/FunctionExecutable.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r237440 r237445 1 2018-10-25 Yusuke Suzuki <yusukesuzuki@slowstart.org> 2 3 Unreviewed, partial rolling in r237254 4 https://bugs.webkit.org/show_bug.cgi?id=190340 5 6 We do not use the added function right now to investigate what is the reason of the regression. 7 If it causes the regression, it seems that Parser.cpp's inlining decision seems culprit. 8 9 * bytecode/UnlinkedFunctionExecutable.cpp: 10 (JSC::UnlinkedFunctionExecutable::fromGlobalCode): 11 * bytecode/UnlinkedFunctionExecutable.h: 12 * parser/Parser.cpp: 13 (JSC::Parser<LexerType>::parseInner): 14 (JSC::Parser<LexerType>::parseSingleFunction): 15 (JSC::Parser<LexerType>::parseFunctionInfo): 16 (JSC::Parser<LexerType>::parseFunctionDeclaration): 17 (JSC::Parser<LexerType>::parseAsyncFunctionDeclaration): 18 * parser/Parser.h: 19 (JSC::Parser<LexerType>::parse): 20 (JSC::parse): 21 (JSC::parseFunctionForFunctionConstructor): 22 * parser/ParserModes.h: 23 * parser/ParserTokens.h: 24 (JSC::JSTextPosition::JSTextPosition): 25 (JSC::JSTokenLocation::JSTokenLocation): Deleted. 26 * parser/SourceCodeKey.h: 27 (JSC::SourceCodeKey::SourceCodeKey): 28 (JSC::SourceCodeKey::operator== const): 29 * runtime/CodeCache.cpp: 30 (JSC::CodeCache::getUnlinkedGlobalCodeBlock): 31 (JSC::CodeCache::getUnlinkedGlobalFunctionExecutable): 32 * runtime/CodeCache.h: 33 * runtime/FunctionConstructor.cpp: 34 (JSC::constructFunctionSkippingEvalEnabledCheck): 35 * runtime/FunctionExecutable.cpp: 36 (JSC::FunctionExecutable::fromGlobalCode): 37 * runtime/FunctionExecutable.h: 38 1 39 2018-10-25 Brent Fulgham <bfulgham@apple.com> 2 40 -
trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp
r237299 r237445 175 175 UnlinkedFunctionExecutable* UnlinkedFunctionExecutable::fromGlobalCode( 176 176 const Identifier& name, ExecState& exec, const SourceCode& source, 177 JSObject*& exception, int overrideLineNumber )177 JSObject*& exception, int overrideLineNumber, std::optional<int> functionConstructorParametersEndPosition) 178 178 { 179 179 ParserError error; … … 182 182 CodeCache* codeCache = vm.codeCache(); 183 183 DebuggerMode debuggerMode = globalObject.hasInteractiveDebugger() ? DebuggerOn : DebuggerOff; 184 UnlinkedFunctionExecutable* executable = codeCache->getUnlinkedGlobalFunctionExecutable(vm, name, source, debuggerMode, error);184 UnlinkedFunctionExecutable* executable = codeCache->getUnlinkedGlobalFunctionExecutable(vm, name, source, debuggerMode, functionConstructorParametersEndPosition, error); 185 185 186 186 if (globalObject.hasDebugger()) -
trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h
r237299 r237445 108 108 static UnlinkedFunctionExecutable* fromGlobalCode( 109 109 const Identifier&, ExecState&, const SourceCode&, JSObject*& exception, 110 int overrideLineNumber );110 int overrideLineNumber, std::optional<int> functionConstructorParametersEndPosition); 111 111 112 112 JS_EXPORT_PRIVATE FunctionExecutable* link(VM&, const SourceCode& parentSource, std::optional<int> overrideLineNumber = std::nullopt, Intrinsic = NoIntrinsic); -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r237299 r237445 195 195 196 196 template <typename LexerType> 197 String Parser<LexerType>::parseInner(const Identifier& calleeName, SourceParseMode parseMode )197 String Parser<LexerType>::parseInner(const Identifier& calleeName, SourceParseMode parseMode, ParsingContext parsingContext, std::optional<int> functionConstructorParametersEndPosition) 198 198 { 199 199 String parseError = String(); … … 239 239 else if (isAsyncGeneratorWrapperParseMode(parseMode)) 240 240 sourceElements = parseAsyncGeneratorFunctionSourceElements(context, parseMode, isArrowFunctionBodyExpression, CheckForStrictMode); 241 else if (parsingContext == ParsingContext::FunctionConstructor) 242 sourceElements = parseSingleFunction(context, functionConstructorParametersEndPosition); 241 243 else 242 244 sourceElements = parseSourceElements(context, CheckForStrictMode); … … 611 613 return sourceElements; 612 614 } 615 616 template <typename LexerType> 617 template <class TreeBuilder> TreeSourceElements Parser<LexerType>::parseSingleFunction(TreeBuilder& context, std::optional<int> functionConstructorParametersEndPosition) 618 { 619 TreeSourceElements sourceElements = context.createSourceElements(); 620 TreeStatement statement = 0; 621 switch (m_token.m_type) { 622 case FUNCTION: 623 statement = parseFunctionDeclaration(context, ExportType::NotExported, DeclarationDefaultContext::Standard, functionConstructorParametersEndPosition); 624 break; 625 case IDENT: 626 if (*m_token.m_data.ident == m_vm->propertyNames->async && !m_token.m_data.escaped) { 627 next(); 628 failIfFalse(match(FUNCTION) && !m_lexer->prevTerminator(), "Cannot parse the async function"); 629 statement = parseAsyncFunctionDeclaration(context, ExportType::NotExported, DeclarationDefaultContext::Standard, functionConstructorParametersEndPosition); 630 break; 631 } 632 FALLTHROUGH; 633 default: 634 failDueToUnexpectedToken(); 635 break; 636 } 637 638 if (statement) { 639 context.setEndOffset(statement, m_lastTokenEndPosition.offset); 640 context.appendStatement(sourceElements, statement); 641 } 642 643 propagateError(); 644 return sourceElements; 645 } 646 613 647 614 648 template <typename LexerType> … … 2264 2298 2265 2299 template <typename LexerType> 2266 template <class TreeBuilder> bool Parser<LexerType>::parseFunctionInfo(TreeBuilder& context, FunctionNameRequirements requirements, SourceParseMode mode, bool nameIsInContainingScope, ConstructorKind constructorKind, SuperBinding expectedSuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>& functionInfo, FunctionDefinitionType functionDefinitionType )2300 template <class TreeBuilder> bool Parser<LexerType>::parseFunctionInfo(TreeBuilder& context, FunctionNameRequirements requirements, SourceParseMode mode, bool nameIsInContainingScope, ConstructorKind constructorKind, SuperBinding expectedSuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>& functionInfo, FunctionDefinitionType functionDefinitionType, std::optional<int> functionConstructorParametersEndPosition) 2267 2301 { 2268 2302 RELEASE_ASSERT(isFunctionParseMode(mode)); … … 2460 2494 2461 2495 matchOrFail(OPENBRACE, "Expected an opening '{' at the start of a ", stringForFunctionMode(mode), " body"); 2496 2497 // If the code is invoked from function constructor, we need to ensure that parameters are only composed by the string offered as parameters. 2498 if (UNLIKELY(functionConstructorParametersEndPosition)) 2499 semanticFailIfFalse(lastTokenEndPosition().offset == *functionConstructorParametersEndPosition, "Parameters should match arguments offered as parameters in Function constructor"); 2462 2500 2463 2501 // BytecodeGenerator emits code to throw TypeError when a class constructor is "call"ed. … … 2594 2632 2595 2633 template <typename LexerType> 2596 template <class TreeBuilder> TreeStatement Parser<LexerType>::parseFunctionDeclaration(TreeBuilder& context, ExportType exportType, DeclarationDefaultContext declarationDefaultContext )2634 template <class TreeBuilder> TreeStatement Parser<LexerType>::parseFunctionDeclaration(TreeBuilder& context, ExportType exportType, DeclarationDefaultContext declarationDefaultContext, std::optional<int> functionConstructorParametersEndPosition) 2597 2635 { 2598 2636 ASSERT(match(FUNCTION)); … … 2631 2669 } 2632 2670 2633 failIfFalse((parseFunctionInfo(context, requirements, parseMode, true, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, functionInfo, FunctionDefinitionType::Declaration )), "Cannot parse this function");2671 failIfFalse((parseFunctionInfo(context, requirements, parseMode, true, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, functionInfo, FunctionDefinitionType::Declaration, functionConstructorParametersEndPosition)), "Cannot parse this function"); 2634 2672 ASSERT(functionInfo.name); 2635 2673 … … 2652 2690 2653 2691 template <typename LexerType> 2654 template <class TreeBuilder> TreeStatement Parser<LexerType>::parseAsyncFunctionDeclaration(TreeBuilder& context, ExportType exportType, DeclarationDefaultContext declarationDefaultContext )2692 template <class TreeBuilder> TreeStatement Parser<LexerType>::parseAsyncFunctionDeclaration(TreeBuilder& context, ExportType exportType, DeclarationDefaultContext declarationDefaultContext, std::optional<int> functionConstructorParametersEndPosition) 2655 2693 { 2656 2694 ASSERT(match(FUNCTION)); … … 2689 2727 } 2690 2728 2691 failIfFalse((parseFunctionInfo(context, requirements, parseMode, true, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, functionInfo, FunctionDefinitionType::Declaration )), "Cannot parse this async function");2729 failIfFalse((parseFunctionInfo(context, requirements, parseMode, true, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, functionInfo, FunctionDefinitionType::Declaration, functionConstructorParametersEndPosition)), "Cannot parse this async function"); 2692 2730 failIfFalse(functionInfo.name, "Async function statements must have a name"); 2693 2731 -
trunk/Source/JavaScriptCore/parser/Parser.h
r237299 r237445 860 860 }; 861 861 862 enum class ArgumentType { 863 Normal, 864 Spread 865 }; 862 enum class ArgumentType { Normal, Spread }; 863 enum class ParsingContext { Program, FunctionConstructor, Eval }; 866 864 867 865 template <typename LexerType> … … 875 873 876 874 template <class ParsedNode> 877 std::unique_ptr<ParsedNode> parse(ParserError&, const Identifier&, SourceParseMode );875 std::unique_ptr<ParsedNode> parse(ParserError&, const Identifier&, SourceParseMode, ParsingContext, std::optional<int> functionConstructorParametersEndPosition = std::nullopt); 878 876 879 877 JSTextPosition positionBeforeLastNewline() const { return m_lexer->positionBeforeLastNewline(); } … … 1313 1311 1314 1312 Parser(); 1315 String parseInner(const Identifier&, SourceParseMode); 1313 1314 String parseInner(const Identifier&, SourceParseMode, ParsingContext, std::optional<int> functionConstructorParametersEndPosition = std::nullopt); 1316 1315 1317 1316 void didFinishParsing(SourceElements*, DeclarationStacks::FunctionStack&&, VariableEnvironment&, UniquedStringImplPtrSet&&, CodeFeatures, int); … … 1525 1524 template <class TreeBuilder> TreeSourceElements parseAsyncFunctionSourceElements(TreeBuilder&, SourceParseMode, bool isArrowFunctionBodyExpression, SourceElementsMode); 1526 1525 template <class TreeBuilder> TreeSourceElements parseAsyncGeneratorFunctionSourceElements(TreeBuilder&, SourceParseMode, bool isArrowFunctionBodyExpression, SourceElementsMode); 1526 template <class TreeBuilder> TreeSourceElements parseSingleFunction(TreeBuilder&, std::optional<int> functionConstructorParametersEndPosition); 1527 1527 template <class TreeBuilder> TreeStatement parseStatementListItem(TreeBuilder&, const Identifier*& directive, unsigned* directiveLiteralLength); 1528 1528 template <class TreeBuilder> TreeStatement parseStatement(TreeBuilder&, const Identifier*& directive, unsigned* directiveLiteralLength = 0); 1529 1529 enum class ExportType { Exported, NotExported }; 1530 1530 template <class TreeBuilder> TreeStatement parseClassDeclaration(TreeBuilder&, ExportType = ExportType::NotExported, DeclarationDefaultContext = DeclarationDefaultContext::Standard); 1531 template <class TreeBuilder> TreeStatement parseFunctionDeclaration(TreeBuilder&, ExportType = ExportType::NotExported, DeclarationDefaultContext = DeclarationDefaultContext::Standard );1531 template <class TreeBuilder> TreeStatement parseFunctionDeclaration(TreeBuilder&, ExportType = ExportType::NotExported, DeclarationDefaultContext = DeclarationDefaultContext::Standard, std::optional<int> functionConstructorParametersEndPosition = std::nullopt); 1532 1532 template <class TreeBuilder> TreeStatement parseFunctionDeclarationStatement(TreeBuilder&, bool isAsync, bool parentAllowsFunctionDeclarationAsStatement); 1533 template <class TreeBuilder> TreeStatement parseAsyncFunctionDeclaration(TreeBuilder&, ExportType = ExportType::NotExported, DeclarationDefaultContext = DeclarationDefaultContext::Standard );1533 template <class TreeBuilder> TreeStatement parseAsyncFunctionDeclaration(TreeBuilder&, ExportType = ExportType::NotExported, DeclarationDefaultContext = DeclarationDefaultContext::Standard, std::optional<int> functionConstructorParametersEndPosition = std::nullopt); 1534 1534 template <class TreeBuilder> NEVER_INLINE bool maybeParseAsyncFunctionDeclarationStatement(TreeBuilder& context, TreeStatement& result, bool parentAllowsFunctionDeclarationAsStatement); 1535 1535 template <class TreeBuilder> TreeStatement parseVariableDeclaration(TreeBuilder&, DeclarationType, ExportType = ExportType::NotExported); … … 1600 1600 1601 1601 enum class FunctionDefinitionType { Expression, Declaration, Method }; 1602 template <class TreeBuilder> NEVER_INLINE bool parseFunctionInfo(TreeBuilder&, FunctionNameRequirements, SourceParseMode, bool nameIsInContainingScope, ConstructorKind, SuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>&, FunctionDefinitionType );1602 template <class TreeBuilder> NEVER_INLINE bool parseFunctionInfo(TreeBuilder&, FunctionNameRequirements, SourceParseMode, bool nameIsInContainingScope, ConstructorKind, SuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>&, FunctionDefinitionType, std::optional<int> functionConstructorParametersEndPosition = std::nullopt); 1603 1603 1604 1604 ALWAYS_INLINE bool isArrowFunctionParameters(); … … 1848 1848 template <typename LexerType> 1849 1849 template <class ParsedNode> 1850 std::unique_ptr<ParsedNode> Parser<LexerType>::parse(ParserError& error, const Identifier& calleeName, SourceParseMode parseMode )1850 std::unique_ptr<ParsedNode> Parser<LexerType>::parse(ParserError& error, const Identifier& calleeName, SourceParseMode parseMode, ParsingContext parsingContext, std::optional<int> functionConstructorParametersEndPosition) 1851 1851 { 1852 1852 int errLine; … … 1865 1865 unsigned startColumn = m_source->startColumn().zeroBasedInt(); 1866 1866 1867 String parseError = parseInner(calleeName, parseMode );1867 String parseError = parseInner(calleeName, parseMode, parsingContext, functionConstructorParametersEndPosition); 1868 1868 1869 1869 int lineNumber = m_lexer->lineNumber(); … … 1960 1960 if (source.provider()->source().is8Bit()) { 1961 1961 Parser<Lexer<LChar>> parser(vm, source, builtinMode, strictMode, scriptMode, parseMode, superBinding, defaultConstructorKind, derivedContextType, isEvalNode<ParsedNode>(), evalContextType, debuggerParseData); 1962 result = parser.parse<ParsedNode>(error, name, parseMode );1962 result = parser.parse<ParsedNode>(error, name, parseMode, isEvalNode<ParsedNode>() ? ParsingContext::Eval : ParsingContext::Program); 1963 1963 if (positionBeforeLastNewline) 1964 1964 *positionBeforeLastNewline = parser.positionBeforeLastNewline(); … … 1973 1973 ASSERT_WITH_MESSAGE(defaultConstructorKind == ConstructorKind::None, "BuiltinExecutables::createDefaultConstructor should always use a 8-bit string"); 1974 1974 Parser<Lexer<UChar>> parser(vm, source, builtinMode, strictMode, scriptMode, parseMode, superBinding, defaultConstructorKind, derivedContextType, isEvalNode<ParsedNode>(), evalContextType, debuggerParseData); 1975 result = parser.parse<ParsedNode>(error, name, parseMode );1975 result = parser.parse<ParsedNode>(error, name, parseMode, isEvalNode<ParsedNode>() ? ParsingContext::Eval : ParsingContext::Program); 1976 1976 if (positionBeforeLastNewline) 1977 1977 *positionBeforeLastNewline = parser.positionBeforeLastNewline(); … … 1987 1987 } 1988 1988 1989 inline std::unique_ptr<ProgramNode> parseFunctionForFunctionConstructor(VM& vm, const SourceCode& source, ParserError& error, JSTextPosition* positionBeforeLastNewline, std::optional<int> functionConstructorParametersEndPosition) 1990 { 1991 ASSERT(!source.provider()->source().isNull()); 1992 1993 MonotonicTime before; 1994 if (UNLIKELY(Options::reportParseTimes())) 1995 before = MonotonicTime::now(); 1996 1997 Identifier name; 1998 bool isEvalNode = false; 1999 std::unique_ptr<ProgramNode> result; 2000 if (source.provider()->source().is8Bit()) { 2001 Parser<Lexer<LChar>> parser(&vm, source, JSParserBuiltinMode::NotBuiltin, JSParserStrictMode::NotStrict, JSParserScriptMode::Classic, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, ConstructorKind::None, DerivedContextType::None, isEvalNode, EvalContextType::None, nullptr); 2002 result = parser.parse<ProgramNode>(error, name, SourceParseMode::ProgramMode, ParsingContext::FunctionConstructor, functionConstructorParametersEndPosition); 2003 if (positionBeforeLastNewline) 2004 *positionBeforeLastNewline = parser.positionBeforeLastNewline(); 2005 } else { 2006 Parser<Lexer<UChar>> parser(&vm, source, JSParserBuiltinMode::NotBuiltin, JSParserStrictMode::NotStrict, JSParserScriptMode::Classic, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, ConstructorKind::None, DerivedContextType::None, isEvalNode, EvalContextType::None, nullptr); 2007 result = parser.parse<ProgramNode>(error, name, SourceParseMode::ProgramMode, ParsingContext::FunctionConstructor, functionConstructorParametersEndPosition); 2008 if (positionBeforeLastNewline) 2009 *positionBeforeLastNewline = parser.positionBeforeLastNewline(); 2010 } 2011 2012 if (UNLIKELY(Options::reportParseTimes())) { 2013 MonotonicTime after = MonotonicTime::now(); 2014 ParseHash hash(source); 2015 dataLogLn(result ? "Parsed #" : "Failed to parse #", hash.hashForCall(), "/#", hash.hashForConstruct(), " in ", (after - before).milliseconds(), " ms."); 2016 } 2017 2018 return result; 2019 } 2020 2021 1989 2022 } // namespace -
trunk/Source/JavaScriptCore/parser/ParserModes.h
r237299 r237445 34 34 enum class JSParserBuiltinMode { NotBuiltin, Builtin }; 35 35 enum class JSParserScriptMode { Classic, Module }; 36 enum class JSParserCodeType { Program, Function, Module };37 36 38 37 enum class ConstructorKind { None, Base, Extends }; -
trunk/Source/JavaScriptCore/parser/ParserTokens.h
r237299 r237445 194 194 JSTextPosition() = default; 195 195 JSTextPosition(int _line, int _offset, int _lineStartOffset) : line(_line), offset(_offset), lineStartOffset(_lineStartOffset) { } 196 JSTextPosition(const JSTextPosition& other) : line(other.line), offset(other.offset), lineStartOffset(other.lineStartOffset) { }197 196 198 197 JSTextPosition operator+(int adjustment) const { return JSTextPosition(line, offset + adjustment, lineStartOffset); } … … 247 246 struct JSTokenLocation { 248 247 JSTokenLocation() = default; 249 JSTokenLocation(const JSTokenLocation& location)250 {251 line = location.line;252 lineStartOffset = location.lineStartOffset;253 startOffset = location.startOffset;254 endOffset = location.endOffset;255 }256 248 257 249 int line { 0 }; -
trunk/Source/JavaScriptCore/parser/SourceCodeKey.h
r237299 r237445 30 30 #include "UnlinkedSourceCode.h" 31 31 #include <wtf/HashTraits.h> 32 #include <wtf/Hasher.h> 32 33 33 34 namespace JSC { … … 72 73 class SourceCodeKey { 73 74 public: 74 SourceCodeKey() 75 { 76 } 75 SourceCodeKey() = default; 77 76 78 77 SourceCodeKey( 79 78 const UnlinkedSourceCode& sourceCode, const String& name, SourceCodeType codeType, JSParserStrictMode strictMode, 80 79 JSParserScriptMode scriptMode, DerivedContextType derivedContextType, EvalContextType evalContextType, bool isArrowFunctionContext, 81 DebuggerMode debuggerMode, TypeProfilerEnabled typeProfilerEnabled, ControlFlowProfilerEnabled controlFlowProfilerEnabled )80 DebuggerMode debuggerMode, TypeProfilerEnabled typeProfilerEnabled, ControlFlowProfilerEnabled controlFlowProfilerEnabled, std::optional<int> functionConstructorParametersEndPosition) 82 81 : m_sourceCode(sourceCode) 83 82 , m_name(name) 84 83 , m_flags(codeType, strictMode, scriptMode, derivedContextType, evalContextType, isArrowFunctionContext, debuggerMode, typeProfilerEnabled, controlFlowProfilerEnabled) 85 , m_hash(sourceCode.hash() ^ m_flags.bits()) 84 , m_functionConstructorParametersEndPosition(functionConstructorParametersEndPosition.value_or(-1)) 85 , m_hash(sourceCode.hash() ^ computeHash(m_flags.bits(), m_functionConstructorParametersEndPosition)) 86 86 { 87 87 } … … 109 109 && length() == other.length() 110 110 && m_flags == other.m_flags 111 && m_functionConstructorParametersEndPosition == other.m_functionConstructorParametersEndPosition 111 112 && m_name == other.m_name 112 113 && string() == other.string(); … … 128 129 String m_name; 129 130 SourceCodeFlags m_flags; 130 unsigned m_hash; 131 int m_functionConstructorParametersEndPosition { -1 }; 132 unsigned m_hash { 0 }; 131 133 }; 132 134 -
trunk/Source/JavaScriptCore/runtime/CodeCache.cpp
r237299 r237445 58 58 derivedContextType, evalContextType, isArrowFunctionContext, debuggerMode, 59 59 vm.typeProfiler() ? TypeProfilerEnabled::Yes : TypeProfilerEnabled::No, 60 vm.controlFlowProfiler() ? ControlFlowProfilerEnabled::Yes : ControlFlowProfilerEnabled::No); 60 vm.controlFlowProfiler() ? ControlFlowProfilerEnabled::Yes : ControlFlowProfilerEnabled::No, 61 std::nullopt); 61 62 SourceCodeValue* cache = m_sourceCode.findCacheAndUpdateAge(key); 62 63 if (cache && Options::useCodeCache()) { … … 96 97 } 97 98 98 UnlinkedFunctionExecutable* CodeCache::getUnlinkedGlobalFunctionExecutable(VM& vm, const Identifier& name, const SourceCode& source, DebuggerMode debuggerMode, ParserError& error)99 UnlinkedFunctionExecutable* CodeCache::getUnlinkedGlobalFunctionExecutable(VM& vm, const Identifier& name, const SourceCode& source, DebuggerMode debuggerMode, std::optional<int> functionConstructorParametersEndPosition, ParserError& error) 99 100 { 100 101 bool isArrowFunctionContext = false; … … 108 109 debuggerMode, 109 110 vm.typeProfiler() ? TypeProfilerEnabled::Yes : TypeProfilerEnabled::No, 110 vm.controlFlowProfiler() ? ControlFlowProfilerEnabled::Yes : ControlFlowProfilerEnabled::No); 111 vm.controlFlowProfiler() ? ControlFlowProfilerEnabled::Yes : ControlFlowProfilerEnabled::No, 112 functionConstructorParametersEndPosition); 111 113 SourceCodeValue* cache = m_sourceCode.findCacheAndUpdateAge(key); 112 114 if (cache && Options::useCodeCache()) { -
trunk/Source/JavaScriptCore/runtime/CodeCache.h
r237299 r237445 195 195 UnlinkedEvalCodeBlock* getUnlinkedEvalCodeBlock(VM&, IndirectEvalExecutable*, const SourceCode&, JSParserStrictMode, DebuggerMode, ParserError&, EvalContextType); 196 196 UnlinkedModuleProgramCodeBlock* getUnlinkedModuleProgramCodeBlock(VM&, ModuleProgramExecutable*, const SourceCode&, DebuggerMode, ParserError&); 197 UnlinkedFunctionExecutable* getUnlinkedGlobalFunctionExecutable(VM&, const Identifier&, const SourceCode&, DebuggerMode, ParserError&);197 UnlinkedFunctionExecutable* getUnlinkedGlobalFunctionExecutable(VM&, const Identifier&, const SourceCode&, DebuggerMode, std::optional<int> functionConstructorParametersEndPosition, ParserError&); 198 198 199 199 void clear() { m_sourceCode.clear(); } -
trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp
r237299 r237445 170 170 SourceCode source = makeSource(program, sourceOrigin, sourceURL, position); 171 171 JSObject* exception = nullptr; 172 FunctionExecutable* function = FunctionExecutable::fromGlobalCode(functionName, *exec, source, exception, overrideLineNumber );172 FunctionExecutable* function = FunctionExecutable::fromGlobalCode(functionName, *exec, source, exception, overrideLineNumber, std::nullopt); 173 173 if (!function) { 174 174 ASSERT(exception); -
trunk/Source/JavaScriptCore/runtime/FunctionExecutable.cpp
r237299 r237445 95 95 FunctionExecutable* FunctionExecutable::fromGlobalCode( 96 96 const Identifier& name, ExecState& exec, const SourceCode& source, 97 JSObject*& exception, int overrideLineNumber )97 JSObject*& exception, int overrideLineNumber, std::optional<int> functionConstructorParametersEndPosition) 98 98 { 99 99 UnlinkedFunctionExecutable* unlinkedExecutable = 100 100 UnlinkedFunctionExecutable::fromGlobalCode( 101 name, exec, source, exception, overrideLineNumber );101 name, exec, source, exception, overrideLineNumber, functionConstructorParametersEndPosition); 102 102 if (!unlinkedExecutable) 103 103 return nullptr; -
trunk/Source/JavaScriptCore/runtime/FunctionExecutable.h
r237299 r237445 56 56 static FunctionExecutable* fromGlobalCode( 57 57 const Identifier& name, ExecState&, const SourceCode&, 58 JSObject*& exception, int overrideLineNumber );58 JSObject*& exception, int overrideLineNumber, std::optional<int> functionConstructorParametersEndPosition); 59 59 60 60 static void destroy(JSCell*);
Note:
See TracChangeset
for help on using the changeset viewer.