Ignore:
Timestamp:
Sep 11, 2013, 2:24:34 PM (12 years ago)
Author:
[email protected]
Message:

VariableAccessData::flushFormat() should be the universal way of deciding how to speculate on stores to locals and how locals are formatted
https://bugs.webkit.org/show_bug.cgi?id=121142

Reviewed by Geoffrey Garen.

Make everyone rely on VariableAccessData::flushFormat() instead of trying to
compute that information from scratch. The FTL already used flushFormat(), now
the DFG does, too.

  • dfg/DFGArgumentPosition.h:

(JSC::DFG::ArgumentPosition::someVariable):
(JSC::DFG::ArgumentPosition::flushFormat):

  • dfg/DFGCSEPhase.cpp:

(JSC::DFG::CSEPhase::performNodeCSE):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupSetLocalsInBlock):

  • dfg/DFGGraph.cpp:

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

  • dfg/DFGInPlaceAbstractState.cpp:

(JSC::DFG::InPlaceAbstractState::mergeStateAtTail):

  • dfg/DFGJITCompiler.h:

(JSC::DFG::JITCompiler::noticeOSREntry):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileInlineStart):
(JSC::DFG::SpeculativeJIT::compileCurrentBlock):
(JSC::DFG::SpeculativeJIT::checkArgumentTypes):

  • dfg/DFGSpeculativeJIT32_64.cpp:

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

  • dfg/DFGSpeculativeJIT64.cpp:

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

  • dfg/DFGValueSource.h:

(JSC::DFG::ValueSource::forFlushFormat):

  • dfg/DFGVariableAccessDataDump.cpp:

(JSC::DFG::VariableAccessDataDump::dump):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileSetLocal):

File:
1 edited

Legend:

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

    r155497 r155564  
    15901590                m_jit.graph().m_argumentPositions[argumentPositionStart + i];
    15911591            ValueSource valueSource;
    1592             if (!argumentPosition.shouldUnboxIfPossible())
     1592            switch (argumentPosition.flushFormat()) {
     1593            case DeadFlush:
     1594            case FlushedJSValue:
    15931595                valueSource = ValueSource(ValueInJSStack);
    1594             else if (argumentPosition.shouldUseDoubleFormat())
     1596                break;
     1597            case FlushedDouble:
    15951598                valueSource = ValueSource(DoubleInJSStack);
    1596             else if (isInt32Speculation(argumentPosition.prediction()))
     1599                break;
     1600            case FlushedInt32:
    15971601                valueSource = ValueSource(Int32InJSStack);
    1598             else if (isCellSpeculation(argumentPosition.prediction()))
     1602                break;
     1603            case FlushedCell:
    15991604                valueSource = ValueSource(CellInJSStack);
    1600             else if (isBooleanSpeculation(argumentPosition.prediction()))
     1605                break;
     1606            case FlushedBoolean:
    16011607                valueSource = ValueSource(BooleanInJSStack);
    1602             else
    1603                 valueSource = ValueSource(ValueInJSStack);
     1608                break;
     1609            }
    16041610            recovery = computeValueRecoveryFor(valueSource);
    16051611        }
     
    16741680        else if (!node->refCount())
    16751681            valueSource = ValueSource(SourceIsDead);
    1676         else if (!node->variableAccessData()->shouldUnboxIfPossible())
    1677             valueSource = ValueSource(ValueInJSStack);
    1678         else if (node->variableAccessData()->shouldUseDoubleFormat())
    1679             valueSource = ValueSource(DoubleInJSStack);
    16801682        else
    1681             valueSource = ValueSource::forSpeculation(node->variableAccessData()->argumentAwarePrediction());
     1683            valueSource = ValueSource::forFlushFormat(node->variableAccessData()->flushFormat());
    16821684        m_variables[i] = valueSource;
    16831685        // FIXME: Don't emit SetLocal(Dead). https://bugs.webkit.org/show_bug.cgi?id=108019
     
    18411843       
    18421844        VariableAccessData* variableAccessData = node->variableAccessData();
    1843         if (!variableAccessData->shouldUnboxIfPossible())
     1845        FlushFormat format = variableAccessData->flushFormat();
     1846       
     1847        if (format == FlushedJSValue)
    18441848            continue;
    18451849       
    18461850        VirtualRegister virtualRegister = variableAccessData->local();
    1847         SpeculatedType predictedType = variableAccessData->argumentAwarePrediction();
    18481851
    18491852        JSValueSource valueSource = JSValueSource(JITCompiler::addressFor(virtualRegister));
    18501853       
    18511854#if USE(JSVALUE64)
    1852         if (isInt32Speculation(predictedType))
     1855        switch (format) {
     1856        case FlushedInt32: {
    18531857            speculationCheck(BadType, valueSource, node, m_jit.branch64(MacroAssembler::Below, JITCompiler::addressFor(virtualRegister), GPRInfo::tagTypeNumberRegister));
    1854         else if (isBooleanSpeculation(predictedType)) {
     1858            break;
     1859        }
     1860        case FlushedBoolean: {
    18551861            GPRTemporary temp(this);
    18561862            m_jit.load64(JITCompiler::addressFor(virtualRegister), temp.gpr());
    18571863            m_jit.xor64(TrustedImm32(static_cast<int32_t>(ValueFalse)), temp.gpr());
    18581864            speculationCheck(BadType, valueSource, node, m_jit.branchTest64(MacroAssembler::NonZero, temp.gpr(), TrustedImm32(static_cast<int32_t>(~1))));
    1859         } else if (isCellSpeculation(predictedType))
     1865            break;
     1866        }
     1867        case FlushedCell: {
    18601868            speculationCheck(BadType, valueSource, node, m_jit.branchTest64(MacroAssembler::NonZero, JITCompiler::addressFor(virtualRegister), GPRInfo::tagMaskRegister));
     1869            break;
     1870        }
     1871        default:
     1872            RELEASE_ASSERT_NOT_REACHED();
     1873            break;
     1874        }
    18611875#else
    1862         if (isInt32Speculation(predictedType))
     1876        switch (format) {
     1877        case FlushedInt32: {
    18631878            speculationCheck(BadType, valueSource, node, m_jit.branch32(MacroAssembler::NotEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::Int32Tag)));
    1864         else if (isBooleanSpeculation(predictedType))
     1879            break;
     1880        }
     1881        case FlushedBoolean: {
    18651882            speculationCheck(BadType, valueSource, node, m_jit.branch32(MacroAssembler::NotEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::BooleanTag)));
    1866         else if (isCellSpeculation(predictedType))
     1883            break;
     1884        }
     1885        case FlushedCell: {
    18671886            speculationCheck(BadType, valueSource, node, m_jit.branch32(MacroAssembler::NotEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::CellTag)));
     1887            break;
     1888        }
     1889        default:
     1890            RELEASE_ASSERT_NOT_REACHED();
     1891            break;
     1892        }
    18681893#endif
    18691894    }
Note: See TracChangeset for help on using the changeset viewer.