Ignore:
Timestamp:
Dec 8, 2015, 4:30:18 PM (10 years ago)
Author:
[email protected]
Message:

Factoring out common DFG code for bitwise and shift operators.
https://bugs.webkit.org/show_bug.cgi?id=152019

Reviewed by Michael Saboff.

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileBitwiseOp):
(JSC::DFG::SpeculativeJIT::compileShiftOp):

  • dfg/DFGSpeculativeJIT.h:
  • dfg/DFGSpeculativeJIT32_64.cpp:

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

  • dfg/DFGSpeculativeJIT64.cpp:

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

File:
1 edited

Legend:

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

    r193793 r193795  
    27852785
    27862786    blessedBooleanResult(scratchReg, node);
     2787}
     2788
     2789void SpeculativeJIT::compileBitwiseOp(Node* node)
     2790{
     2791    NodeType op = node->op();
     2792    Edge& leftChild = node->child1();
     2793    Edge& rightChild = node->child2();
     2794
     2795    if (leftChild->isInt32Constant()) {
     2796        SpeculateInt32Operand op2(this, rightChild);
     2797        GPRTemporary result(this, Reuse, op2);
     2798
     2799        bitOp(op, leftChild->asInt32(), op2.gpr(), result.gpr());
     2800
     2801        int32Result(result.gpr(), node);
     2802
     2803    } else if (rightChild->isInt32Constant()) {
     2804        SpeculateInt32Operand op1(this, leftChild);
     2805        GPRTemporary result(this, Reuse, op1);
     2806
     2807        bitOp(op, rightChild->asInt32(), op1.gpr(), result.gpr());
     2808
     2809        int32Result(result.gpr(), node);
     2810
     2811    } else {
     2812        SpeculateInt32Operand op1(this, leftChild);
     2813        SpeculateInt32Operand op2(this, rightChild);
     2814        GPRTemporary result(this, Reuse, op1, op2);
     2815       
     2816        GPRReg reg1 = op1.gpr();
     2817        GPRReg reg2 = op2.gpr();
     2818        bitOp(op, reg1, reg2, result.gpr());
     2819       
     2820        int32Result(result.gpr(), node);
     2821    }
     2822}
     2823
     2824void SpeculativeJIT::compileShiftOp(Node* node)
     2825{
     2826    NodeType op = node->op();
     2827    Edge& leftChild = node->child1();
     2828    Edge& rightChild = node->child2();
     2829
     2830    if (rightChild->isInt32Constant()) {
     2831        SpeculateInt32Operand op1(this, leftChild);
     2832        GPRTemporary result(this, Reuse, op1);
     2833
     2834        shiftOp(op, op1.gpr(), rightChild->asInt32() & 0x1f, result.gpr());
     2835
     2836        int32Result(result.gpr(), node);
     2837    } else {
     2838        // Do not allow shift amount to be used as the result, MacroAssembler does not permit this.
     2839        SpeculateInt32Operand op1(this, leftChild);
     2840        SpeculateInt32Operand op2(this, rightChild);
     2841        GPRTemporary result(this, Reuse, op1);
     2842
     2843        GPRReg reg1 = op1.gpr();
     2844        GPRReg reg2 = op2.gpr();
     2845        shiftOp(op, reg1, reg2, result.gpr());
     2846
     2847        int32Result(result.gpr(), node);
     2848    }
    27872849}
    27882850
Note: See TracChangeset for help on using the changeset viewer.