⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 89957 in webkit


Ignore:
Timestamp:
Jun 28, 2011, 2:06:49 PM (15 years ago)
Author:
barraclough@apple.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=63561
DFG JIT - don't always assume integer in relational compare

Reviewed by Oliver Hunt.

If neither operand is known integer, or either is in double representation,
then at least use a function call (don't bail off the speculative path).

  • dfg/DFGSpeculativeJIT.cpp:

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

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::isDataFormatDouble):
(JSC::DFG::SpeculativeJIT::compareIsInteger):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r89956 r89957  
     12011-06-28  Gavin Barraclough  <barraclough@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=63561
     6        DFG JIT - don't always assume integer in relational compare
     7
     8        If neither operand is known integer, or either is in double representation,
     9        then at least use a function call (don't bail off the speculative path).
     10
     11        * dfg/DFGSpeculativeJIT.cpp:
     12        (JSC::DFG::SpeculativeJIT::compilePeepHoleCall):
     13        (JSC::DFG::SpeculativeJIT::compile):
     14        * dfg/DFGSpeculativeJIT.h:
     15        (JSC::DFG::SpeculativeJIT::isDataFormatDouble):
     16        (JSC::DFG::SpeculativeJIT::compareIsInteger):
     17
    1182011-06-28  Oliver Hunt  <oliver@apple.com>
    219
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r89882 r89957  
    268268}
    269269
    270 void SpeculativeJIT::compilePeepHoleEq(Node& node, NodeIndex branchNodeIndex)
     270void SpeculativeJIT::compilePeepHoleCall(Node& node, NodeIndex branchNodeIndex, Z_DFGOperation_EJJ operation)
    271271{
    272272    Node& branchNode = m_jit.graph()[branchNodeIndex];
     
    291291
    292292    GPRResult result(this);
    293     callOperation(operationCompareEq, result.gpr(), op1GPR, op2GPR);
     293    callOperation(operation, result.gpr(), op1GPR, op2GPR);
    294294    addBranch(m_jit.branchTest8(condition, result.gpr()), taken);
    295295
     
    570570            ASSERT(node.adjustedRefCount() == 1);
    571571
    572             compilePeepHoleIntegerBranch(node, branchNodeIndex, JITCompiler::LessThan);
     572            if (compareIsInteger(node.child1, node.child2))
     573                compilePeepHoleIntegerBranch(node, branchNodeIndex, JITCompiler::LessThan);
     574            else
     575                compilePeepHoleCall(node, branchNodeIndex, operationCompareLess);
    573576
    574577            use(node.child1);
     
    599602            ASSERT(node.adjustedRefCount() == 1);
    600603
    601             compilePeepHoleIntegerBranch(node, branchNodeIndex, JITCompiler::LessThanOrEqual);
     604            if (compareIsInteger(node.child1, node.child2))
     605                compilePeepHoleIntegerBranch(node, branchNodeIndex, JITCompiler::LessThanOrEqual);
     606            else
     607                compilePeepHoleCall(node, branchNodeIndex, operationCompareLessEq);
    602608
    603609            use(node.child1);
     
    628634            ASSERT(node.adjustedRefCount() == 1);
    629635
    630             if (isInteger(node.child1) || isInteger(node.child2))
     636            if (compareIsInteger(node.child1, node.child2))
    631637                compilePeepHoleIntegerBranch(node, branchNodeIndex, JITCompiler::Equal);
    632638            else
    633                 compilePeepHoleEq(node, branchNodeIndex);
     639                compilePeepHoleCall(node, branchNodeIndex, operationCompareEq);
    634640
    635641            use(node.child1);
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h

    r89956 r89957  
    170170    }
    171171
     172    bool isDataFormatDouble(NodeIndex nodeIndex)
     173    {
     174        Node& node = m_jit.graph()[nodeIndex];
     175        VirtualRegister virtualRegister = node.virtualRegister();
     176        GenerationInfo& info = m_generationInfo[virtualRegister];
     177
     178        return (info.registerFormat() | DataFormatJS) == DataFormatJSDouble;
     179    }
     180
     181    bool compareIsInteger(NodeIndex op1, NodeIndex op2)
     182    {
     183        return !(isDataFormatDouble(op1) || isDataFormatDouble(op2)) && (isInteger(op1) || isInteger(op2));
     184    }
     185
    172186    void compilePeepHoleIntegerBranch(Node&, NodeIndex branchNodeIndex, JITCompiler::RelationalCondition);
    173     void compilePeepHoleEq(Node&, NodeIndex branchNodeIndex);
     187    void compilePeepHoleCall(Node&, NodeIndex branchNodeIndex, Z_DFGOperation_EJJ);
    174188
    175189    // Add a speculation check without additional recovery.
Note: See TracChangeset for help on using the changeset viewer.