Ignore:
Timestamp:
Nov 17, 2015, 1:55:33 PM (10 years ago)
Author:
[email protected]
Message:

Use the JITAddGenerator snippet in the DFG.
https://bugs.webkit.org/show_bug.cgi?id=151266

Reviewed by Geoffrey Garen.

No tests added because the op_add.js stress test already tests for correctness
(using the LLINT as a reference).

Performance-wise, the difference from the pre-existing DFG implementation is
insignificant (at least as measured on x86 and x86_64). We're moving forward
with adopting this implementation because it unifies the 32-bit and 64-bit
implementations, as well as lays ground work for a repatching inline cache
implementation of op_add later.

  • dfg/DFGAbstractValue.cpp:

(JSC::DFG::AbstractValue::resultType):

  • Made an assertion less restrictive. For ValueAdd operands, the DFG thinks that the operand can also be empty (though we should never see this in practice).
  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • Add fallback to unused type operands.
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileValueAdd):

  • Introduce a common function to compile the ValueAdd node.
  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::JSValueOperand::JSValueOperand):

  • Add the forwarding constructor so that we can use Optional<JSValueOperand>.
  • dfg/DFGSpeculativeJIT32_64.cpp:

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

  • dfg/DFGSpeculativeJIT64.cpp:

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

  • Changed to use the common compileValueAdd().
  • jit/AssemblyHelpers.h:

(JSC::AssemblyHelpers::moveValue):

  • Similar to moveTrustedValue() but used for untrusted constants.
  • jit/JITAddGenerator.cpp:

(JSC::JITAddGenerator::generateFastPath):

  • jit/JITAddGenerator.h:

(JSC::JITAddGenerator::JITAddGenerator):

  • Updated to take the left or right operand as a constant. This is necessary because the client should not be making assumptions about whether the snippet will determine the operation to be commutative or not. Instead, the client should just pass in the operands and let the snippet do any operand order swapping if necessary.
  • jit/JITArithmetic.cpp:

(JSC::JIT::emit_op_add):

  • Updated to use the new JITAddGenerator interface.
  • tests/stress/op_add.js:

(stringifyIfNeeded):
(runTest):

  • Made test output more clear about when string results are expected.
File:
1 edited

Legend:

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

    r192465 r192531  
    22692269        break;
    22702270    }
    2271        
    2272     case ValueAdd: {
    2273         JSValueOperand op1(this, node->child1());
    2274         JSValueOperand op2(this, node->child2());
    2275        
    2276         GPRReg op1GPR = op1.gpr();
    2277         GPRReg op2GPR = op2.gpr();
    2278        
    2279         flushRegisters();
    2280        
    2281         GPRFlushedCallResult result(this);
    2282         if (isKnownNotNumber(node->child1().node()) || isKnownNotNumber(node->child2().node()))
    2283             callOperation(operationValueAddNotNumber, result.gpr(), op1GPR, op2GPR);
    2284         else
    2285             callOperation(operationValueAdd, result.gpr(), op1GPR, op2GPR);
    2286         m_jit.exceptionCheck();
    2287        
    2288         jsValueResult(result.gpr(), node);
    2289         break;
    2290     }
    2291        
     2271
     2272    case ValueAdd:
     2273        compileValueAdd(node);
     2274        break;
     2275
    22922276    case StrCat: {
    22932277        JSValueOperand op1(this, node->child1(), ManualOperandSpeculation);
Note: See TracChangeset for help on using the changeset viewer.