Changeset 96280 in webkit


Ignore:
Timestamp:
Sep 28, 2011 5:47:07 PM (13 years ago)
Author:
fpizlo@apple.com
Message:

DFG JIT falls back on numerical comparisons when it does not
recognize a prediction
https://bugs.webkit.org/show_bug.cgi?id=68977

Reviewed by Geoffrey Garen.

This fixes both the way comparison implementations are selected. It
also fixes a bug where comparisons other than equality (like < or >)
on objects are compiled as if the comparison was equality.

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compare):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r96259 r96280  
     12011-09-28  Filip Pizlo  <fpizlo@apple.com>
     2
     3        DFG JIT falls back on numerical comparisons when it does not
     4        recognize a prediction
     5        https://bugs.webkit.org/show_bug.cgi?id=68977
     6
     7        Reviewed by Geoffrey Garen.
     8       
     9        This fixes both the way comparison implementations are selected. It
     10        also fixes a bug where comparisons other than equality (like < or >)
     11        on objects are compiled as if the comparison was equality.
     12
     13        * dfg/DFGSpeculativeJIT.cpp:
     14        (JSC::DFG::SpeculativeJIT::compare):
     15
    1162011-09-28  Gavin Barraclough  <barraclough@apple.com>
    217
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r96247 r96280  
    651651        return true;
    652652    }
    653    
    654     if (shouldSpeculateFinalObject(node.child1(), node.child2()))
    655         compileObjectEquality(node, m_jit.globalData()->jsFinalObjectVPtr);
    656     else if (shouldSpeculateArray(node.child1(), node.child2()))
    657         compileObjectEquality(node, m_jit.globalData()->jsArrayVPtr);
    658     else if (!shouldSpeculateNumber(node.child1()) && !shouldSpeculateNumber(node.child2()))
    659         nonSpeculativeNonPeepholeCompare(node, condition, operation);
    660     else if ((shouldSpeculateNumber(node.child1()) || shouldSpeculateNumber(node.child2())) && !shouldSpeculateInteger(node.child1(), node.child2())) {
    661         // Normal case, not fused to branch.
     653
     654    if (shouldSpeculateInteger(node.child1(), node.child2())) {
     655        SpeculateIntegerOperand op1(this, node.child1());
     656        SpeculateIntegerOperand op2(this, node.child2());
     657        GPRTemporary result(this, op1, op2);
     658       
     659        m_jit.compare32(condition, op1.gpr(), op2.gpr(), result.gpr());
     660       
     661        // If we add a DataFormatBool, we should use it here.
     662        m_jit.or32(TrustedImm32(ValueFalse), result.gpr());
     663        jsValueResult(result.gpr(), m_compileIndex, DataFormatJSBoolean);
     664    } else if (shouldSpeculateNumber(node.child1(), node.child2())) {
    662665        SpeculateDoubleOperand op1(this, node.child1());
    663666        SpeculateDoubleOperand op2(this, node.child2());
     
    670673
    671674        jsValueResult(result.gpr(), m_compileIndex, DataFormatJSBoolean);
    672     } else {
    673         // Normal case, not fused to branch.
    674         SpeculateIntegerOperand op1(this, node.child1());
    675         SpeculateIntegerOperand op2(this, node.child2());
    676         GPRTemporary result(this, op1, op2);
    677        
    678         m_jit.compare32(condition, op1.gpr(), op2.gpr(), result.gpr());
    679        
    680         // If we add a DataFormatBool, we should use it here.
    681         m_jit.or32(TrustedImm32(ValueFalse), result.gpr());
    682         jsValueResult(result.gpr(), m_compileIndex, DataFormatJSBoolean);
    683     }
     675    } else if (node.op == CompareEq && shouldSpeculateFinalObject(node.child1(), node.child2()))
     676        compileObjectEquality(node, m_jit.globalData()->jsFinalObjectVPtr);
     677    else if (node.op == CompareEq && shouldSpeculateArray(node.child1(), node.child2()))
     678        compileObjectEquality(node, m_jit.globalData()->jsArrayVPtr);
     679    else
     680        nonSpeculativeNonPeepholeCompare(node, condition, operation);
    684681   
    685682    return false;
Note: See TracChangeset for help on using the changeset viewer.