Changeset 127479 in webkit


Ignore:
Timestamp:
Sep 4, 2012 11:46:21 AM (12 years ago)
Author:
mhahnenberg@apple.com
Message:

Remove uses of ClassInfo from SpeculativeJIT::compileObjectOrOtherLogicalNot
https://bugs.webkit.org/show_bug.cgi?id=95510

Reviewed by Oliver Hunt.

More refactoring to get rid of ClassInfo checks in the DFG.

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::execute):

  • dfg/DFGSpeculativeJIT.h:

(SpeculativeJIT):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compileNonStringCellOrOtherLogicalNot):
(JSC::DFG::SpeculativeJIT::compileLogicalNot):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compileNonStringCellOrOtherLogicalNot):
(JSC::DFG::SpeculativeJIT::compileLogicalNot):

Location:
trunk/Source/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r127408 r127479  
     12012-09-04  Mark Hahnenberg  <mhahnenberg@apple.com>
     2
     3        Remove uses of ClassInfo from SpeculativeJIT::compileObjectOrOtherLogicalNot
     4        https://bugs.webkit.org/show_bug.cgi?id=95510
     5
     6        Reviewed by Oliver Hunt.
     7
     8        More refactoring to get rid of ClassInfo checks in the DFG.
     9
     10        * dfg/DFGAbstractState.cpp:
     11        (JSC::DFG::AbstractState::execute):
     12        * dfg/DFGSpeculativeJIT.h:
     13        (SpeculativeJIT):
     14        * dfg/DFGSpeculativeJIT32_64.cpp:
     15        (JSC::DFG::SpeculativeJIT::compileNonStringCellOrOtherLogicalNot):
     16        (JSC::DFG::SpeculativeJIT::compileLogicalNot):
     17        * dfg/DFGSpeculativeJIT64.cpp:
     18        (JSC::DFG::SpeculativeJIT::compileNonStringCellOrOtherLogicalNot):
     19        (JSC::DFG::SpeculativeJIT::compileLogicalNot):
     20
    1212012-09-03  Patrick Gansterer  <paroga@webkit.org>
    222
  • trunk/Source/JavaScriptCore/dfg/DFGAbstractState.cpp

    r127345 r127479  
    609609        if (isBooleanSpeculation(child.prediction()))
    610610            speculateBooleanUnary(node);
    611         else if (child.shouldSpeculateFinalObjectOrOther()) {
    612             node.setCanExit(
    613                 !isFinalObjectOrOtherSpeculation(forNode(node.child1()).m_type));
    614             forNode(node.child1()).filter(SpecFinalObject | SpecOther);
    615         } else if (child.shouldSpeculateArrayOrOther()) {
    616             node.setCanExit(
    617                 !isArrayOrOtherSpeculation(forNode(node.child1()).m_type));
    618             forNode(node.child1()).filter(SpecArray | SpecOther);
     611        else if (child.shouldSpeculateNonStringCellOrOther()) {
     612            node.setCanExit(true);
     613            forNode(node.child1()).filter((SpecCell & ~SpecString) | SpecOther);
    619614        } else if (child.shouldSpeculateInteger())
    620615            speculateInt32Unary(node);
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h

    r127343 r127479  
    20602060    void compileObjectToObjectOrOtherEquality(Edge leftChild, Edge rightChild);
    20612061    void compileValueAdd(Node&);
    2062     void compileObjectOrOtherLogicalNot(Edge value, const ClassInfo*, bool needSpeculationCheck);
     2062    void compileNonStringCellOrOtherLogicalNot(Edge value, bool needSpeculationCheck);
    20632063    void compileLogicalNot(Node&);
    20642064    void emitNonStringCellOrOtherBranch(Edge value, BlockIndex taken, BlockIndex notTaken, bool needSpeculationCheck);
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp

    r127343 r127479  
    17921792}
    17931793
    1794 void SpeculativeJIT::compileObjectOrOtherLogicalNot(Edge nodeUse, const ClassInfo* classInfo, bool needSpeculationCheck)
     1794void SpeculativeJIT::compileNonStringCellOrOtherLogicalNot(Edge nodeUse, bool needSpeculationCheck)
    17951795{
    17961796    JSValueOperand value(this, nodeUse);
     
    18011801   
    18021802    MacroAssembler::Jump notCell = m_jit.branch32(MacroAssembler::NotEqual, valueTagGPR, TrustedImm32(JSValue::CellTag));
    1803     if (needSpeculationCheck)
    1804         speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeUse, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valuePayloadGPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo)));
     1803    if (m_jit.graph().globalObjectFor(m_jit.graph()[nodeUse.index()].codeOrigin)->masqueradesAsUndefinedWatchpoint()->isStillValid()) {
     1804        m_jit.graph().globalObjectFor(m_jit.graph()[nodeUse.index()].codeOrigin)->masqueradesAsUndefinedWatchpoint()->add(speculationWatchpoint());
     1805
     1806        if (needSpeculationCheck) {
     1807            speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeUse,
     1808                m_jit.branchPtr(
     1809                    MacroAssembler::Equal,
     1810                    MacroAssembler::Address(valuePayloadGPR, JSCell::structureOffset()),
     1811                    MacroAssembler::TrustedImmPtr(m_jit.globalData()->stringStructure.get())));
     1812        }
     1813    } else {
     1814        GPRTemporary structure(this);
     1815        GPRReg structureGPR = structure.gpr();
     1816
     1817        m_jit.loadPtr(MacroAssembler::Address(valuePayloadGPR, JSCell::structureOffset()), structureGPR);
     1818
     1819        if (needSpeculationCheck) {
     1820            speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeUse,
     1821                m_jit.branchPtr(
     1822                    MacroAssembler::Equal,
     1823                    structureGPR,
     1824                    MacroAssembler::TrustedImmPtr(m_jit.globalData()->stringStructure.get())));
     1825        }
     1826
     1827        MacroAssembler::Jump isNotMasqueradesAsUndefined =
     1828            m_jit.branchTest8(
     1829                MacroAssembler::Zero,
     1830                MacroAssembler::Address(structureGPR, Structure::typeInfoFlagsOffset()),
     1831                MacroAssembler::TrustedImm32(MasqueradesAsUndefined));
     1832
     1833        speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeUse,
     1834            m_jit.branchPtr(
     1835                MacroAssembler::Equal,
     1836                MacroAssembler::Address(structureGPR, Structure::globalObjectOffset()),
     1837                MacroAssembler::TrustedImmPtr(m_jit.graph().globalObjectFor(m_jit.graph()[nodeUse.index()].codeOrigin))));
     1838
     1839        isNotMasqueradesAsUndefined.link(&m_jit);
     1840    }
    18051841    m_jit.move(TrustedImm32(0), resultPayloadGPR);
    18061842    MacroAssembler::Jump done = m_jit.jump();
     
    18121848        m_jit.move(valueTagGPR, resultPayloadGPR);
    18131849        m_jit.or32(TrustedImm32(1), resultPayloadGPR);
    1814         speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeUse, m_jit.branch32(MacroAssembler::NotEqual, resultPayloadGPR, TrustedImm32(JSValue::NullTag)));
     1850        speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeUse,
     1851            m_jit.branch32(
     1852                MacroAssembler::NotEqual,
     1853                resultPayloadGPR,
     1854                TrustedImm32(JSValue::NullTag)));
    18151855    }
    18161856    m_jit.move(TrustedImm32(1), resultPayloadGPR);
     
    18301870        return;
    18311871    }
    1832     if (at(node.child1()).shouldSpeculateFinalObjectOrOther()) {
    1833         compileObjectOrOtherLogicalNot(node.child1(), &JSFinalObject::s_info, !isFinalObjectOrOtherSpeculation(m_state.forNode(node.child1()).m_type));
    1834         return;
    1835     }
    1836     if (at(node.child1()).shouldSpeculateArrayOrOther()) {
    1837         compileObjectOrOtherLogicalNot(node.child1(), &JSArray::s_info, !isArrayOrOtherSpeculation(m_state.forNode(node.child1()).m_type));
     1872    if (at(node.child1()).shouldSpeculateNonStringCellOrOther()) {
     1873        compileNonStringCellOrOtherLogicalNot(node.child1(),
     1874            !isNonStringCellOrOtherSpeculation(m_state.forNode(node.child1()).m_type));
    18381875        return;
    18391876    }
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp

    r127343 r127479  
    18361836}
    18371837
    1838 void SpeculativeJIT::compileObjectOrOtherLogicalNot(Edge nodeUse, const ClassInfo* classInfo, bool needSpeculationCheck)
     1838void SpeculativeJIT::compileNonStringCellOrOtherLogicalNot(Edge nodeUse, bool needSpeculationCheck)
    18391839{
    18401840    JSValueOperand value(this, nodeUse);
     
    18441844   
    18451845    MacroAssembler::Jump notCell = m_jit.branchTestPtr(MacroAssembler::NonZero, valueGPR, GPRInfo::tagMaskRegister);
    1846     if (needSpeculationCheck)
    1847         speculationCheck(BadType, JSValueRegs(valueGPR), nodeUse, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valueGPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo)));
    1848     m_jit.move(TrustedImm32(static_cast<int32_t>(ValueFalse)), resultGPR);
     1846    if (m_jit.graph().globalObjectFor(m_jit.graph()[nodeUse.index()].codeOrigin)->masqueradesAsUndefinedWatchpoint()->isStillValid()) {
     1847        m_jit.graph().globalObjectFor(m_jit.graph()[nodeUse.index()].codeOrigin)->masqueradesAsUndefinedWatchpoint()->add(speculationWatchpoint());
     1848
     1849        if (needSpeculationCheck) {
     1850            speculationCheck(BadType, JSValueRegs(valueGPR), nodeUse,
     1851                m_jit.branchPtr(
     1852                    MacroAssembler::Equal,
     1853                    MacroAssembler::Address(valueGPR, JSCell::structureOffset()),
     1854                    MacroAssembler::TrustedImmPtr(m_jit.globalData()->stringStructure.get())));
     1855        }
     1856    } else {
     1857        GPRTemporary structure(this);
     1858        GPRReg structureGPR = structure.gpr();
     1859
     1860        m_jit.loadPtr(MacroAssembler::Address(valueGPR, JSCell::structureOffset()), structureGPR);
     1861
     1862        if (needSpeculationCheck) {
     1863            speculationCheck(BadType, JSValueRegs(valueGPR), nodeUse,
     1864                m_jit.branchPtr(
     1865                    MacroAssembler::Equal,
     1866                    structureGPR,
     1867                    MacroAssembler::TrustedImmPtr(m_jit.globalData()->stringStructure.get())));
     1868        }
     1869
     1870        MacroAssembler::Jump isNotMasqueradesAsUndefined =
     1871            m_jit.branchTest8(
     1872                MacroAssembler::Zero,
     1873                MacroAssembler::Address(structureGPR, Structure::typeInfoFlagsOffset()),
     1874                MacroAssembler::TrustedImm32(MasqueradesAsUndefined));
     1875
     1876        speculationCheck(BadType, JSValueRegs(valueGPR), nodeUse,
     1877            m_jit.branchPtr(
     1878                MacroAssembler::Equal,
     1879                MacroAssembler::Address(structureGPR, Structure::globalObjectOffset()),
     1880                MacroAssembler::TrustedImmPtr(m_jit.graph().globalObjectFor(m_jit.graph()[nodeUse.index()].codeOrigin))));
     1881
     1882        isNotMasqueradesAsUndefined.link(&m_jit);
     1883    }
     1884    m_jit.move(TrustedImm32(ValueFalse), resultGPR);
    18491885    MacroAssembler::Jump done = m_jit.jump();
    18501886   
    18511887    notCell.link(&m_jit);
    1852    
     1888
    18531889    if (needSpeculationCheck) {
    18541890        m_jit.move(valueGPR, resultGPR);
    18551891        m_jit.andPtr(MacroAssembler::TrustedImm32(~TagBitUndefined), resultGPR);
    1856         speculationCheck(BadType, JSValueRegs(valueGPR), nodeUse, m_jit.branchPtr(MacroAssembler::NotEqual, resultGPR, MacroAssembler::TrustedImmPtr(reinterpret_cast<void*>(ValueNull))));
    1857     }
    1858     m_jit.move(TrustedImm32(static_cast<int32_t>(ValueTrue)), resultGPR);
     1892        speculationCheck(BadType, JSValueRegs(valueGPR), nodeUse,
     1893            m_jit.branchPtr(
     1894                MacroAssembler::NotEqual,
     1895                resultGPR,
     1896                MacroAssembler::TrustedImmPtr(reinterpret_cast<void*>(ValueNull))));
     1897    }
     1898    m_jit.move(TrustedImm32(ValueTrue), resultGPR);
    18591899   
    18601900    done.link(&m_jit);
     
    18651905void SpeculativeJIT::compileLogicalNot(Node& node)
    18661906{
    1867     if (at(node.child1()).shouldSpeculateFinalObjectOrOther()) {
    1868         compileObjectOrOtherLogicalNot(node.child1(), &JSFinalObject::s_info, !isFinalObjectOrOtherSpeculation(m_state.forNode(node.child1()).m_type));
    1869         return;
    1870     }
    1871     if (at(node.child1()).shouldSpeculateArrayOrOther()) {
    1872         compileObjectOrOtherLogicalNot(node.child1(), &JSArray::s_info, !isArrayOrOtherSpeculation(m_state.forNode(node.child1()).m_type));
     1907    if (at(node.child1()).shouldSpeculateNonStringCellOrOther()) {
     1908        compileNonStringCellOrOtherLogicalNot(node.child1(),
     1909            !isNonStringCellOrOtherSpeculation(m_state.forNode(node.child1()).m_type));
    18731910        return;
    18741911    }
Note: See TracChangeset for help on using the changeset viewer.