Changeset 205511 in webkit
- Timestamp:
- Sep 6, 2016 2:54:11 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r205507 r205511 1 2016-09-06 Benjamin Poulain <bpoulain@apple.com> 2 3 [JSC] Make ArithClz32 work with Cell arguments 4 https://bugs.webkit.org/show_bug.cgi?id=161369 5 6 Reviewed by Geoffrey Garen. 7 8 * stress/arith-clz32-on-various-types.js: Added. 9 1 10 2016-09-06 Commit Queue <commit-queue@webkit.org> 2 11 -
trunk/Source/JavaScriptCore/ChangeLog
r205509 r205511 1 2016-09-06 Benjamin Poulain <bpoulain@apple.com> 2 3 [JSC] Make ArithClz32 work with Cell arguments 4 https://bugs.webkit.org/show_bug.cgi?id=161369 5 6 Reviewed by Geoffrey Garen. 7 8 ArithClz32 was already working with all primitive types 9 thanks to the magic of ValueToInt32. 10 This patch adds support for cell arguments through a function 11 call. 12 13 * dfg/DFGAbstractInterpreterInlines.h: 14 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): 15 * dfg/DFGClobberize.h: 16 (JSC::DFG::clobberize): 17 * dfg/DFGFixupPhase.cpp: 18 (JSC::DFG::FixupPhase::fixupNode): 19 * dfg/DFGNodeType.h: 20 * dfg/DFGOperations.cpp: 21 * dfg/DFGOperations.h: 22 * dfg/DFGSpeculativeJIT.cpp: 23 (JSC::DFG::SpeculativeJIT::compileArithClz32): 24 * dfg/DFGSpeculativeJIT.h: 25 (JSC::DFG::SpeculativeJIT::callOperation): 26 * ftl/FTLLowerDFGToB3.cpp: 27 (JSC::FTL::DFG::LowerDFGToB3::compileArithClz32): 28 1 29 2016-09-06 Mark Lam <mark.lam@apple.com> 2 30 -
trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r205507 r205511 548 548 case ArithClz32: { 549 549 JSValue operand = forNode(node->child1()).value(); 550 if ( operand && operand.isNumber()) {551 uint32_t value = toUInt32( operand.asNumber());550 if (Optional<double> number = operand.toNumberFromPrimitive()) { 551 uint32_t value = toUInt32(*number); 552 552 setConstant(node, jsNumber(clz32(value))); 553 553 break; -
trunk/Source/JavaScriptCore/dfg/DFGClobberize.h
r205507 r205511 150 150 151 151 case ArithIMul: 152 case ArithClz32:153 152 case ArithMin: 154 153 case ArithMax: … … 200 199 case ArithAbs: 201 200 if (node->child1().useKind() == Int32Use || node->child1().useKind() == DoubleRepUse) 201 def(PureValue(node)); 202 else { 203 read(World); 204 write(Heap); 205 } 206 return; 207 208 case ArithClz32: 209 if (node->child1().useKind() == Int32Use || node->child1().useKind() == KnownInt32Use) 202 210 def(PureValue(node)); 203 211 else { -
trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
r205507 r205511 127 127 128 128 case ArithClz32: { 129 fixIntConvertingEdge(node->child1()); 130 node->setArithMode(Arith::Unchecked); 129 if (node->child1()->shouldSpeculateNotCell()) { 130 fixIntConvertingEdge(node->child1()); 131 node->clearFlags(NodeMustGenerate); 132 } else 133 fixEdge<UntypedUse>(node->child1()); 131 134 break; 132 135 } -
trunk/Source/JavaScriptCore/dfg/DFGNodeType.h
r205507 r205511 143 143 /* generally, we need to keep alive any operation whose checks cause filtration in AI. */\ 144 144 macro(ArithAdd, NodeResultNumber | NodeMustGenerate) \ 145 macro(ArithClz32, NodeResultInt32 ) \145 macro(ArithClz32, NodeResultInt32 | NodeMustGenerate) \ 146 146 macro(ArithSub, NodeResultNumber | NodeMustGenerate) \ 147 147 macro(ArithNegate, NodeResultNumber | NodeMustGenerate) \ -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r205508 r205511 333 333 double a = op1.toNumber(exec); 334 334 if (UNLIKELY(vm->exception())) 335 return JSValue::encode(JSValue());335 return PNaN; 336 336 return fabs(a); 337 } 338 339 int32_t JIT_OPERATION operationArithClz32(ExecState* exec, EncodedJSValue encodedOp1) 340 { 341 VM* vm = &exec->vm(); 342 NativeCallFrameTracer tracer(vm, exec); 343 344 JSValue op1 = JSValue::decode(encodedOp1); 345 uint32_t value = op1.toUInt32(exec); 346 if (UNLIKELY(vm->exception())) 347 return 0; 348 return clz32(value); 337 349 } 338 350 … … 357 369 double a = op1.toNumber(exec); 358 370 if (UNLIKELY(vm->exception())) 359 return JSValue::encode(JSValue());371 return PNaN; 360 372 return static_cast<float>(a); 361 373 } … … 369 381 double a = op1.toNumber(exec); 370 382 if (UNLIKELY(vm->exception())) 371 return JSValue::encode(JSValue());383 return PNaN; 372 384 return log(a); 373 385 } … … 381 393 double a = op1.toNumber(exec); 382 394 if (UNLIKELY(vm->exception())) 383 return JSValue::encode(JSValue());395 return PNaN; 384 396 return sin(a); 385 397 } … … 393 405 double a = op1.toNumber(exec); 394 406 if (UNLIKELY(vm->exception())) 395 return JSValue::encode(JSValue());407 return PNaN; 396 408 return sqrt(a); 397 409 } -
trunk/Source/JavaScriptCore/dfg/DFGOperations.h
r205508 r205511 55 55 EncodedJSValue JIT_OPERATION operationValueDiv(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL; 56 56 double JIT_OPERATION operationArithAbs(ExecState*, EncodedJSValue encodedOp1) WTF_INTERNAL; 57 int32_t JIT_OPERATION operationArithClz32(ExecState*, EncodedJSValue encodedOp1) WTF_INTERNAL; 57 58 double JIT_OPERATION operationArithCos(ExecState*, EncodedJSValue encodedOp1) WTF_INTERNAL; 58 59 double JIT_OPERATION operationArithFRound(ExecState*, EncodedJSValue encodedOp1) WTF_INTERNAL; -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r205508 r205511 3933 3933 void SpeculativeJIT::compileArithClz32(Node* node) 3934 3934 { 3935 ASSERT_WITH_MESSAGE(node->child1().useKind() == Int32Use || node->child1().useKind() == KnownInt32Use, "The Fixup phase should have enforced a Int32 operand."); 3936 SpeculateInt32Operand value(this, node->child1()); 3937 GPRTemporary result(this, Reuse, value); 3938 GPRReg valueReg = value.gpr(); 3935 if (node->child1().useKind() == Int32Use || node->child1().useKind() == KnownInt32Use) { 3936 SpeculateInt32Operand value(this, node->child1()); 3937 GPRTemporary result(this, Reuse, value); 3938 GPRReg valueReg = value.gpr(); 3939 GPRReg resultReg = result.gpr(); 3940 m_jit.countLeadingZeros32(valueReg, resultReg); 3941 int32Result(resultReg, node); 3942 return; 3943 } 3944 JSValueOperand op1(this, node->child1()); 3945 JSValueRegs op1Regs = op1.jsValueRegs(); 3946 GPRTemporary result(this); 3939 3947 GPRReg resultReg = result.gpr(); 3940 m_jit.countLeadingZeros32(valueReg, resultReg); 3948 flushRegisters(); 3949 callOperation(operationArithClz32, resultReg, op1Regs); 3950 m_jit.exceptionCheck(); 3941 3951 int32Result(resultReg, node); 3942 3952 } -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
r205508 r205511 1692 1692 } 1693 1693 1694 JITCompiler::Call callOperation(Z_JITOperation_EJ operation, GPRReg result, JSValueRegs arg1) 1695 { 1696 m_jit.setupArgumentsWithExecState(arg1.payloadGPR()); 1697 return appendCallSetResult(operation, result); 1698 } 1699 1694 1700 JITCompiler::Call callOperation(Z_JITOperation_EJZZ operation, GPRReg result, GPRReg arg1, unsigned arg2, unsigned arg3) 1695 1701 { … … 2133 2139 return appendCallSetResult(operation, result); 2134 2140 } 2135 2141 JITCompiler::Call callOperation(Z_JITOperation_EJ operation, GPRReg result, JSValueRegs arg1) 2142 { 2143 m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1.payloadGPR(), arg1.tagGPR()); 2144 return appendCallSetResult(operation, result); 2145 } 2136 2146 JITCompiler::Call callOperation(Z_JITOperation_EJZZ operation, GPRReg result, JSValueRegs arg1, unsigned arg2, unsigned arg3) 2137 2147 { -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r205508 r205511 1727 1727 void compileArithClz32() 1728 1728 { 1729 LValue operand = lowInt32(m_node->child1()); 1730 setInt32(m_out.ctlz32(operand)); 1729 if (m_node->child1().useKind() == Int32Use || m_node->child1().useKind() == KnownInt32Use) { 1730 LValue operand = lowInt32(m_node->child1()); 1731 setInt32(m_out.ctlz32(operand)); 1732 return; 1733 } 1734 DFG_ASSERT(m_graph, m_node, m_node->child1().useKind() == UntypedUse); 1735 LValue argument = lowJSValue(m_node->child1()); 1736 LValue result = vmCall(Int32, m_out.operation(operationArithClz32), m_callFrame, argument); 1737 setInt32(result); 1731 1738 } 1732 1739
Note: See TracChangeset
for help on using the changeset viewer.