Changeset 193795 in webkit
- Timestamp:
- Dec 8, 2015, 4:30:18 PM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Source/JavaScriptCore/ChangeLog ¶
r193793 r193795 1 2015-12-08 Mark Lam <mark.lam@apple.com> 2 3 Factoring out common DFG code for bitwise and shift operators. 4 https://bugs.webkit.org/show_bug.cgi?id=152019 5 6 Reviewed by Michael Saboff. 7 8 * dfg/DFGSpeculativeJIT.cpp: 9 (JSC::DFG::SpeculativeJIT::compileBitwiseOp): 10 (JSC::DFG::SpeculativeJIT::compileShiftOp): 11 * dfg/DFGSpeculativeJIT.h: 12 * dfg/DFGSpeculativeJIT32_64.cpp: 13 (JSC::DFG::SpeculativeJIT::compile): 14 * dfg/DFGSpeculativeJIT64.cpp: 15 (JSC::DFG::SpeculativeJIT::compile): 16 1 17 2015-12-08 Mark Lam <mark.lam@apple.com> 2 18 -
TabularUnified trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp ¶
r193793 r193795 2785 2785 2786 2786 blessedBooleanResult(scratchReg, node); 2787 } 2788 2789 void 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 2824 void 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 } 2787 2849 } 2788 2850 -
TabularUnified trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h ¶
r193766 r193795 2213 2213 void compileUInt32ToNumber(Node*); 2214 2214 void compileDoubleAsInt32(Node*); 2215 void compileBitwiseOp(Node*); 2216 void compileShiftOp(Node*); 2215 2217 void compileValueAdd(Node*); 2216 2218 void compileArithAdd(Node*); -
TabularUnified trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp ¶
r193766 r193795 2060 2060 case BitOr: 2061 2061 case BitXor: 2062 if (node->child1()->isInt32Constant()) { 2063 SpeculateInt32Operand op2(this, node->child2()); 2064 GPRTemporary result(this, Reuse, op2); 2065 2066 bitOp(op, node->child1()->asInt32(), op2.gpr(), result.gpr()); 2067 2068 int32Result(result.gpr(), node); 2069 } else if (node->child2()->isInt32Constant()) { 2070 SpeculateInt32Operand op1(this, node->child1()); 2071 GPRTemporary result(this, Reuse, op1); 2072 2073 bitOp(op, node->child2()->asInt32(), op1.gpr(), result.gpr()); 2074 2075 int32Result(result.gpr(), node); 2076 } else { 2077 SpeculateInt32Operand op1(this, node->child1()); 2078 SpeculateInt32Operand op2(this, node->child2()); 2079 GPRTemporary result(this, Reuse, op1, op2); 2080 2081 GPRReg reg1 = op1.gpr(); 2082 GPRReg reg2 = op2.gpr(); 2083 bitOp(op, reg1, reg2, result.gpr()); 2084 2085 int32Result(result.gpr(), node); 2086 } 2062 compileBitwiseOp(node); 2087 2063 break; 2088 2064 … … 2090 2066 case BitLShift: 2091 2067 case BitURShift: 2092 if (node->child2()->isInt32Constant()) { 2093 SpeculateInt32Operand op1(this, node->child1()); 2094 GPRTemporary result(this, Reuse, op1); 2095 2096 shiftOp(op, op1.gpr(), node->child2()->asInt32() & 0x1f, result.gpr()); 2097 2098 int32Result(result.gpr(), node); 2099 } else { 2100 // Do not allow shift amount to be used as the result, MacroAssembler does not permit this. 2101 SpeculateInt32Operand op1(this, node->child1()); 2102 SpeculateInt32Operand op2(this, node->child2()); 2103 GPRTemporary result(this, Reuse, op1); 2104 2105 GPRReg reg1 = op1.gpr(); 2106 GPRReg reg2 = op2.gpr(); 2107 shiftOp(op, reg1, reg2, result.gpr()); 2108 2109 int32Result(result.gpr(), node); 2110 } 2068 compileShiftOp(node); 2111 2069 break; 2112 2070 -
TabularUnified trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp ¶
r193766 r193795 2145 2145 case BitOr: 2146 2146 case BitXor: 2147 if (node->child1()->isInt32Constant()) { 2148 SpeculateInt32Operand op2(this, node->child2()); 2149 GPRTemporary result(this, Reuse, op2); 2150 2151 bitOp(op, node->child1()->asInt32(), op2.gpr(), result.gpr()); 2152 2153 int32Result(result.gpr(), node); 2154 } else if (node->child2()->isInt32Constant()) { 2155 SpeculateInt32Operand op1(this, node->child1()); 2156 GPRTemporary result(this, Reuse, op1); 2157 2158 bitOp(op, node->child2()->asInt32(), op1.gpr(), result.gpr()); 2159 2160 int32Result(result.gpr(), node); 2161 } else { 2162 SpeculateInt32Operand op1(this, node->child1()); 2163 SpeculateInt32Operand op2(this, node->child2()); 2164 GPRTemporary result(this, Reuse, op1, op2); 2165 2166 GPRReg reg1 = op1.gpr(); 2167 GPRReg reg2 = op2.gpr(); 2168 bitOp(op, reg1, reg2, result.gpr()); 2169 2170 int32Result(result.gpr(), node); 2171 } 2147 compileBitwiseOp(node); 2172 2148 break; 2173 2149 … … 2175 2151 case BitLShift: 2176 2152 case BitURShift: 2177 if (node->child2()->isInt32Constant()) { 2178 SpeculateInt32Operand op1(this, node->child1()); 2179 GPRTemporary result(this, Reuse, op1); 2180 2181 shiftOp(op, op1.gpr(), node->child2()->asInt32() & 0x1f, result.gpr()); 2182 2183 int32Result(result.gpr(), node); 2184 } else { 2185 // Do not allow shift amount to be used as the result, MacroAssembler does not permit this. 2186 SpeculateInt32Operand op1(this, node->child1()); 2187 SpeculateInt32Operand op2(this, node->child2()); 2188 GPRTemporary result(this, Reuse, op1); 2189 2190 GPRReg reg1 = op1.gpr(); 2191 GPRReg reg2 = op2.gpr(); 2192 shiftOp(op, reg1, reg2, result.gpr()); 2193 2194 int32Result(result.gpr(), node); 2195 } 2153 compileShiftOp(node); 2196 2154 break; 2197 2155
Note:
See TracChangeset
for help on using the changeset viewer.