Ignore:
Timestamp:
Sep 10, 2011, 2:23:45 PM (14 years ago)
Author:
[email protected]
Message:

DFG JIT completely undoes speculative compilation even in the case of
a partial static speculation failure
https://bugs.webkit.org/show_bug.cgi?id=67798

Reviewed by Geoffrey Garen.

This is a regression with static speculation, so it is turned off by
default. But it is a necessary prerequisite for further work on
dynamic speculation.

  • dfg/DFGJITCodeGenerator.cpp:

(JSC::DFG::JITCodeGenerator::clearGenerationInfo):

  • dfg/DFGJITCodeGenerator.h:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r94801 r94914  
    4040    switch (info.registerFormat()) {
    4141    case DataFormatNone: {
    42         GPRReg gpr = allocate();
    43 
    44         if (node.isConstant()) {
    45             m_gprs.retain(gpr, virtualRegister, SpillOrderConstant);
    46             if (isInt32Constant(nodeIndex)) {
    47                 m_jit.move(MacroAssembler::Imm32(valueOfInt32Constant(nodeIndex)), gpr);
    48                 info.fillInteger(gpr);
    49                 returnFormat = DataFormatInteger;
    50                 return gpr;
    51             }
     42        if (node.isConstant() && !isInt32Constant(nodeIndex)) {
    5243            terminateSpeculativeExecution();
    5344            returnFormat = DataFormatInteger;
    5445            return allocate();
     46        }
     47       
     48        GPRReg gpr = allocate();
     49
     50        if (node.isConstant()) {
     51            m_gprs.retain(gpr, virtualRegister, SpillOrderConstant);
     52            ASSERT(isInt32Constant(nodeIndex));
     53            m_jit.move(MacroAssembler::Imm32(valueOfInt32Constant(nodeIndex)), gpr);
     54            info.fillInteger(gpr);
     55            returnFormat = DataFormatInteger;
     56            return gpr;
    5557        } else {
    5658            DataFormat spillFormat = info.spillFormat();
     
    13751377void SpeculativeJIT::compile(BasicBlock& block)
    13761378{
     1379    ASSERT(m_compileOkay);
    13771380    ASSERT(m_compileIndex == block.begin);
    13781381    m_blockHeads[m_block] = m_jit.label();
     
    13851388        if (!node.shouldGenerate())
    13861389            continue;
    1387 
     1390       
    13881391#if DFG_DEBUG_VERBOSE
    13891392        fprintf(stderr, "SpeculativeJIT generating Node @%d at JIT offset 0x%x   ", (int)m_compileIndex, m_jit.debugOffset());
     
    13941397        checkConsistency();
    13951398        compile(node);
    1396         if (!m_compileOkay)
     1399        if (!m_compileOkay) {
     1400#if ENABLE(DYNAMIC_TERMINATE_SPECULATION)
     1401            m_compileOkay = true;
     1402            m_compileIndex = block.end;
     1403            clearGenerationInfo();
     1404#endif
    13971405            return;
     1406        }
    13981407#if DFG_DEBUG_VERBOSE
    13991408        if (node.hasResult())
     
    14461455    for (m_block = 0; m_block < m_jit.graph().m_blocks.size(); ++m_block) {
    14471456        compile(*m_jit.graph().m_blocks[m_block]);
     1457#if !ENABLE(DYNAMIC_OPTIMIZATION)
    14481458        if (!m_compileOkay)
    14491459            return false;
     1460#endif
    14501461    }
    14511462    linkBranches();
Note: See TracChangeset for help on using the changeset viewer.