Ignore:
Timestamp:
Oct 15, 2018, 11:42:44 AM (7 years ago)
Author:
[email protected]
Message:

Unreviewed, rolling out r237054.
https://bugs.webkit.org/show_bug.cgi?id=190593

"this regressed JetStream 2 by 6% on iOS" (Requested by
saamyjoon on #webkit).

Reverted changeset:

"[JSC] JSC should have "parseFunction" to optimize Function
constructor"
https://bugs.webkit.org/show_bug.cgi?id=190340
https://trac.webkit.org/changeset/237054

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/CodeCache.cpp

    r237054 r237128  
    5858        derivedContextType, evalContextType, isArrowFunctionContext, debuggerMode,
    5959        vm.typeProfiler() ? TypeProfilerEnabled::Yes : TypeProfilerEnabled::No,
    60         vm.controlFlowProfiler() ? ControlFlowProfilerEnabled::Yes : ControlFlowProfilerEnabled::No,
    61         std::nullopt);
     60        vm.controlFlowProfiler() ? ControlFlowProfilerEnabled::Yes : ControlFlowProfilerEnabled::No);
    6261    SourceCodeValue* cache = m_sourceCode.findCacheAndUpdateAge(key);
    6362    if (cache && Options::useCodeCache()) {
     
    9796}
    9897
    99 UnlinkedFunctionExecutable* CodeCache::getUnlinkedGlobalFunctionExecutable(VM& vm, const Identifier& name, const SourceCode& source, DebuggerMode debuggerMode, std::optional<int> functionConstructorParametersEndPosition, ParserError& error)
     98UnlinkedFunctionExecutable* CodeCache::getUnlinkedGlobalFunctionExecutable(VM& vm, const Identifier& name, const SourceCode& source, DebuggerMode debuggerMode, ParserError& error)
    10099{
    101100    bool isArrowFunctionContext = false;
     
    109108        debuggerMode,
    110109        vm.typeProfiler() ? TypeProfilerEnabled::Yes : TypeProfilerEnabled::No,
    111         vm.controlFlowProfiler() ? ControlFlowProfilerEnabled::Yes : ControlFlowProfilerEnabled::No,
    112         functionConstructorParametersEndPosition);
     110        vm.controlFlowProfiler() ? ControlFlowProfilerEnabled::Yes : ControlFlowProfilerEnabled::No);
    113111    SourceCodeValue* cache = m_sourceCode.findCacheAndUpdateAge(key);
    114112    if (cache && Options::useCodeCache()) {
     
    120118
    121119    JSTextPosition positionBeforeLastNewline;
    122     std::unique_ptr<ProgramNode> program = parseFunctionForFunctionConstructor(vm, source, error, &positionBeforeLastNewline, functionConstructorParametersEndPosition);
     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);
    123124    if (!program) {
    124125        RELEASE_ASSERT(error.isValid());
     
    127128
    128129    // This function assumes an input string that would result in a single function declaration.
    129     StatementNode* funcDecl = program->singleStatement();
     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();
    130139    if (UNLIKELY(!funcDecl)) {
    131140        JSToken token;
Note: See TracChangeset for help on using the changeset viewer.