Changeset 237054 in webkit for trunk/Source/JavaScriptCore/runtime/CodeCache.cpp
- Timestamp:
- Oct 11, 2018, 4:43:58 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/CodeCache.cpp
r231889 r237054 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()) { … … 118 120 119 121 JSTextPosition positionBeforeLastNewline; 120 std::unique_ptr<ProgramNode> program = parse<ProgramNode>( 121 &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin, 122 JSParserStrictMode::NotStrict, JSParserScriptMode::Classic, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, 123 error, &positionBeforeLastNewline); 122 std::unique_ptr<ProgramNode> program = parseFunctionForFunctionConstructor(vm, source, error, &positionBeforeLastNewline, functionConstructorParametersEndPosition); 124 123 if (!program) { 125 124 RELEASE_ASSERT(error.isValid()); … … 128 127 129 128 // This function assumes an input string that would result in a single function declaration. 130 StatementNode* statement = program->singleStatement(); 131 if (UNLIKELY(!statement)) { 132 JSToken token; 133 error = ParserError(ParserError::SyntaxError, ParserError::SyntaxErrorIrrecoverable, token, "Parser error", -1); 134 return nullptr; 135 } 136 ASSERT(statement->isBlock()); 137 138 StatementNode* funcDecl = static_cast<BlockNode*>(statement)->singleStatement(); 129 StatementNode* funcDecl = program->singleStatement(); 139 130 if (UNLIKELY(!funcDecl)) { 140 131 JSToken token;
Note:
See TracChangeset
for help on using the changeset viewer.