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

Int32ToDouble should be predicted SpecInt48 and predictions should have nothing to do with constant folding
https://bugs.webkit.org/show_bug.cgi?id=121141

Source/JavaScriptCore:

Reviewed by Oliver Hunt.

Just changing Int32ToDouble to be predicted SpecInt48 breaks constant folding on that
node because of soooper old code that prevented constant folding on mismatched
predictions. Kill that code.

  • dfg/DFGAbstractInterpreter.h:

(JSC::DFG::AbstractInterpreter::setConstant):

  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::::executeEffects):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::injectInt32ToDoubleNode):

LayoutTests:

Reviewed by Oliver Hunt.

Fixing this means that this test no longer recompiles.

  • js/script-tests/dfg-constant-fold-misprediction.js:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreter.h

    r154290 r155567  
    160160    BooleanResult booleanResult(Node*, AbstractValue&);
    161161   
    162     bool trySetConstant(Node* node, JSValue value)
     162    void setConstant(Node* node, JSValue value)
    163163    {
    164         // Make sure we don't constant fold something that will produce values that contravene
    165         // predictions. If that happens then we know that the code will OSR exit, forcing
    166         // recompilation. But if we tried to constant fold then we'll have a very degenerate
    167         // IR: namely we'll have a JSConstant that contravenes its own prediction. There's a
    168         // lot of subtle code that assumes that
    169         // speculationFromValue(jsConstant) == jsConstant.prediction(). "Hardening" that code
    170         // is probably less sane than just pulling back on constant folding.
    171         SpeculatedType oldType = node->prediction();
    172         if (mergeSpeculations(speculationFromValue(value), oldType) != oldType)
    173             return false;
    174        
    175164        forNode(node).set(m_graph, value);
    176         return true;
     165        m_state.setFoundConstants(true);
    177166    }
    178167   
Note: See TracChangeset for help on using the changeset viewer.