Ignore:
Timestamp:
Aug 19, 2012, 2:59:12 PM (13 years ago)
Author:
[email protected]
Message:

The current state of the call frame should be taken into account in the DFG for both predictions and proofs
https://bugs.webkit.org/show_bug.cgi?id=94412

Reviewed by Geoffrey Garen.

This ensures that no matter how smart the DFG gets, it'll always know through
which entrypoint OSR will try to enter, and with which values it will attempt
to do so. For prologue OSR, this has no effect other than adding the current
arguments to the argument predictions. For loop OSR, this makes our treatment
of the loop slightly more conservative - just conservative enough to ensure
that OSR succeeds.

  • bytecode/CodeBlock.cpp:

(JSC::ProgramCodeBlock::compileOptimized):
(JSC::EvalCodeBlock::compileOptimized):
(JSC::FunctionCodeBlock::compileOptimized):

  • bytecode/CodeBlock.h:

(CodeBlock):
(ProgramCodeBlock):
(EvalCodeBlock):
(FunctionCodeBlock):

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::initialize):

  • dfg/DFGAbstractValue.h:

(JSC::DFG::AbstractValue::setMostSpecific):
(AbstractValue):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::fixVariableAccessPredictions):
(JSC::DFG::ByteCodeParser::parse):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):
(JSC::DFG::tryCompile):
(JSC::DFG::tryCompileFunction):

  • dfg/DFGDriver.h:

(DFG):
(JSC::DFG::tryCompile):
(JSC::DFG::tryCompileFunction):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::Graph):
(Graph):

  • jit/JITDriver.h:

(JSC::jitCompileIfAppropriate):
(JSC::jitCompileFunctionIfAppropriate):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/Executable.cpp:

(JSC::EvalExecutable::compileOptimized):
(JSC::EvalExecutable::compileInternal):
(JSC::ProgramExecutable::compileOptimized):
(JSC::ProgramExecutable::compileInternal):
(JSC::FunctionExecutable::compileOptimizedForCall):
(JSC::FunctionExecutable::compileOptimizedForConstruct):
(JSC::FunctionExecutable::compileForCallInternal):
(JSC::FunctionExecutable::compileForConstructInternal):

  • runtime/Executable.h:

(EvalExecutable):
(ProgramExecutable):
(FunctionExecutable):
(JSC::FunctionExecutable::compileOptimizedFor):

  • runtime/ExecutionHarness.h:

(JSC::prepareForExecution):
(JSC::prepareFunctionForExecution):

File:
1 edited

Legend:

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

    r119844 r125982  
    161161}
    162162
    163 JSObject* EvalExecutable::compileOptimized(ExecState* exec, ScopeChainNode* scopeChainNode)
     163JSObject* EvalExecutable::compileOptimized(ExecState* exec, ScopeChainNode* scopeChainNode, unsigned bytecodeIndex)
    164164{
    165165    ASSERT(exec->globalData().dynamicGlobalObject);
     
    167167    JSObject* error = 0;
    168168    if (m_evalCodeBlock->getJITType() != JITCode::topTierJIT())
    169         error = compileInternal(exec, scopeChainNode, JITCode::nextTierJIT(m_evalCodeBlock->getJITType()));
     169        error = compileInternal(exec, scopeChainNode, JITCode::nextTierJIT(m_evalCodeBlock->getJITType()), bytecodeIndex);
    170170    ASSERT(!!m_evalCodeBlock);
    171171    return error;
     
    175175bool EvalExecutable::jitCompile(ExecState* exec)
    176176{
    177     return jitCompileIfAppropriate(exec, m_evalCodeBlock, m_jitCodeForCall, JITCode::bottomTierJIT(), JITCompilationCanFail);
     177    return jitCompileIfAppropriate(exec, m_evalCodeBlock, m_jitCodeForCall, JITCode::bottomTierJIT(), UINT_MAX, JITCompilationCanFail);
    178178}
    179179#endif
     
    194194}
    195195
    196 JSObject* EvalExecutable::compileInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType)
     196JSObject* EvalExecutable::compileInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType, unsigned bytecodeIndex)
    197197{
    198198    SamplingRegion samplingRegion(samplingDescription(jitType));
     
    236236
    237237#if ENABLE(JIT)
    238     if (!prepareForExecution(exec, m_evalCodeBlock, m_jitCodeForCall, jitType))
     238    if (!prepareForExecution(exec, m_evalCodeBlock, m_jitCodeForCall, jitType, bytecodeIndex))
    239239        return 0;
    240240#endif
     
    302302}
    303303
    304 JSObject* ProgramExecutable::compileOptimized(ExecState* exec, ScopeChainNode* scopeChainNode)
     304JSObject* ProgramExecutable::compileOptimized(ExecState* exec, ScopeChainNode* scopeChainNode, unsigned bytecodeIndex)
    305305{
    306306    ASSERT(exec->globalData().dynamicGlobalObject);
     
    308308    JSObject* error = 0;
    309309    if (m_programCodeBlock->getJITType() != JITCode::topTierJIT())
    310         error = compileInternal(exec, scopeChainNode, JITCode::nextTierJIT(m_programCodeBlock->getJITType()));
     310        error = compileInternal(exec, scopeChainNode, JITCode::nextTierJIT(m_programCodeBlock->getJITType()), bytecodeIndex);
    311311    ASSERT(!!m_programCodeBlock);
    312312    return error;
     
    316316bool ProgramExecutable::jitCompile(ExecState* exec)
    317317{
    318     return jitCompileIfAppropriate(exec, m_programCodeBlock, m_jitCodeForCall, JITCode::bottomTierJIT(), JITCompilationCanFail);
    319 }
    320 #endif
    321 
    322 JSObject* ProgramExecutable::compileInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType)
     318    return jitCompileIfAppropriate(exec, m_programCodeBlock, m_jitCodeForCall, JITCode::bottomTierJIT(), UINT_MAX, JITCompilationCanFail);
     319}
     320#endif
     321
     322JSObject* ProgramExecutable::compileInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType, unsigned bytecodeIndex)
    323323{
    324324    SamplingRegion samplingRegion(samplingDescription(jitType));
     
    360360
    361361#if ENABLE(JIT)
    362     if (!prepareForExecution(exec, m_programCodeBlock, m_jitCodeForCall, jitType))
     362    if (!prepareForExecution(exec, m_programCodeBlock, m_jitCodeForCall, jitType, bytecodeIndex))
    363363        return 0;
    364364#endif
     
    432432}
    433433
    434 JSObject* FunctionExecutable::compileOptimizedForCall(ExecState* exec, ScopeChainNode* scopeChainNode)
     434JSObject* FunctionExecutable::compileOptimizedForCall(ExecState* exec, ScopeChainNode* scopeChainNode, unsigned bytecodeIndex)
    435435{
    436436    ASSERT(exec->globalData().dynamicGlobalObject);
     
    438438    JSObject* error = 0;
    439439    if (m_codeBlockForCall->getJITType() != JITCode::topTierJIT())
    440         error = compileForCallInternal(exec, scopeChainNode, JITCode::nextTierJIT(m_codeBlockForCall->getJITType()));
     440        error = compileForCallInternal(exec, scopeChainNode, JITCode::nextTierJIT(m_codeBlockForCall->getJITType()), bytecodeIndex);
    441441    ASSERT(!!m_codeBlockForCall);
    442442    return error;
    443443}
    444444
    445 JSObject* FunctionExecutable::compileOptimizedForConstruct(ExecState* exec, ScopeChainNode* scopeChainNode)
     445JSObject* FunctionExecutable::compileOptimizedForConstruct(ExecState* exec, ScopeChainNode* scopeChainNode, unsigned bytecodeIndex)
    446446{
    447447    ASSERT(exec->globalData().dynamicGlobalObject);
     
    449449    JSObject* error = 0;
    450450    if (m_codeBlockForConstruct->getJITType() != JITCode::topTierJIT())
    451         error = compileForConstructInternal(exec, scopeChainNode, JITCode::nextTierJIT(m_codeBlockForConstruct->getJITType()));
     451        error = compileForConstructInternal(exec, scopeChainNode, JITCode::nextTierJIT(m_codeBlockForConstruct->getJITType()), bytecodeIndex);
    452452    ASSERT(!!m_codeBlockForConstruct);
    453453    return error;
     
    457457bool FunctionExecutable::jitCompileForCall(ExecState* exec)
    458458{
    459     return jitCompileFunctionIfAppropriate(exec, m_codeBlockForCall, m_jitCodeForCall, m_jitCodeForCallWithArityCheck, m_symbolTable, JITCode::bottomTierJIT(), JITCompilationCanFail);
     459    return jitCompileFunctionIfAppropriate(exec, m_codeBlockForCall, m_jitCodeForCall, m_jitCodeForCallWithArityCheck, m_symbolTable, JITCode::bottomTierJIT(), UINT_MAX, JITCompilationCanFail);
    460460}
    461461
    462462bool FunctionExecutable::jitCompileForConstruct(ExecState* exec)
    463463{
    464     return jitCompileFunctionIfAppropriate(exec, m_codeBlockForConstruct, m_jitCodeForConstruct, m_jitCodeForConstructWithArityCheck, m_symbolTable, JITCode::bottomTierJIT(), JITCompilationCanFail);
     464    return jitCompileFunctionIfAppropriate(exec, m_codeBlockForConstruct, m_jitCodeForConstruct, m_jitCodeForConstructWithArityCheck, m_symbolTable, JITCode::bottomTierJIT(), UINT_MAX, JITCompilationCanFail);
    465465}
    466466#endif
     
    503503}
    504504
    505 JSObject* FunctionExecutable::compileForCallInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType)
     505JSObject* FunctionExecutable::compileForCallInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType, unsigned bytecodeIndex)
    506506{
    507507    SamplingRegion samplingRegion(samplingDescription(jitType));
     
    527527
    528528#if ENABLE(JIT)
    529     if (!prepareFunctionForExecution(exec, m_codeBlockForCall, m_jitCodeForCall, m_jitCodeForCallWithArityCheck, m_symbolTable, jitType, CodeForCall))
     529    if (!prepareFunctionForExecution(exec, m_codeBlockForCall, m_jitCodeForCall, m_jitCodeForCallWithArityCheck, m_symbolTable, jitType, bytecodeIndex, CodeForCall))
    530530        return 0;
    531531#endif
     
    545545}
    546546
    547 JSObject* FunctionExecutable::compileForConstructInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType)
     547JSObject* FunctionExecutable::compileForConstructInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType, unsigned bytecodeIndex)
    548548{
    549549    SamplingRegion samplingRegion(samplingDescription(jitType));
     
    569569
    570570#if ENABLE(JIT)
    571     if (!prepareFunctionForExecution(exec, m_codeBlockForConstruct, m_jitCodeForConstruct, m_jitCodeForConstructWithArityCheck, m_symbolTable, jitType, CodeForConstruct))
     571    if (!prepareFunctionForExecution(exec, m_codeBlockForConstruct, m_jitCodeForConstruct, m_jitCodeForConstructWithArityCheck, m_symbolTable, jitType, bytecodeIndex, CodeForConstruct))
    572572        return 0;
    573573#endif
Note: See TracChangeset for help on using the changeset viewer.