Changeset 204947 in webkit
- Timestamp:
- Aug 24, 2016, 6:21:43 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 14 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/arith-fround-on-various-types.js (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp (modified) (3 diffs)
-
Source/JavaScriptCore/dfg/DFGClobberize.h (modified) (2 diffs)
-
Source/JavaScriptCore/dfg/DFGFixupPhase.cpp (modified) (2 diffs)
-
Source/JavaScriptCore/dfg/DFGNodeType.h (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGOperations.cpp (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGOperations.h (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp (modified) (1 diff)
-
Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r204912 r204947 1 2016-08-24 Benjamin Poulain <benjamin@webkit.org> 2 3 [JSC] Make FRound work with any type 4 https://bugs.webkit.org/show_bug.cgi?id=161129 5 6 Reviewed by Geoffrey Garen. 7 8 * stress/arith-fround-on-various-types.js: Added. 9 1 10 2016-08-24 Filip Pizlo <fpizlo@apple.com> 2 11 -
trunk/Source/JavaScriptCore/ChangeLog
r204942 r204947 1 2016-08-24 Benjamin Poulain <benjamin@webkit.org> 2 3 [JSC] Make FRound work with any type 4 https://bugs.webkit.org/show_bug.cgi?id=161129 5 6 Reviewed by Geoffrey Garen. 7 8 Math.fround() does nothing with arguments past the first one 9 (https://tc39.github.io/ecma262/#sec-math.fround). 10 We can unify ArithFRound with the other single-input intrinsics. 11 12 Everything else is same old: if the input type is not a number, 13 be pessimistic about everything and do a C call. 14 15 * dfg/DFGAbstractInterpreterInlines.h: 16 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): 17 * dfg/DFGByteCodeParser.cpp: 18 (JSC::DFG::ByteCodeParser::handleIntrinsicCall): 19 * dfg/DFGClobberize.h: 20 (JSC::DFG::clobberize): 21 * dfg/DFGFixupPhase.cpp: 22 (JSC::DFG::FixupPhase::fixupNode): 23 * dfg/DFGNodeType.h: 24 * dfg/DFGOperations.cpp: 25 * dfg/DFGOperations.h: 26 * dfg/DFGSpeculativeJIT.cpp: 27 (JSC::DFG::SpeculativeJIT::compileArithFRound): 28 * dfg/DFGSpeculativeJIT.h: 29 * dfg/DFGSpeculativeJIT32_64.cpp: 30 (JSC::DFG::SpeculativeJIT::compile): 31 * dfg/DFGSpeculativeJIT64.cpp: 32 (JSC::DFG::SpeculativeJIT::compile): 33 * ftl/FTLLowerDFGToB3.cpp: 34 (JSC::FTL::DFG::LowerDFGToB3::compileArithFRound): 35 1 36 2016-08-24 Andreas Kling <akling@apple.com> 2 37 -
trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r204881 r204947 975 975 break; 976 976 } 977 forNode(node).setType(typeOfDoubleRounding(forNode(node->child1()).m_type)); 977 SpeculatedType froundType = SpecFullNumber; 978 if (node->child1().useKind() == DoubleRepUse) 979 froundType = typeOfDoubleUnaryOp(forNode(node->child1()).m_type); 980 forNode(node).setType(froundType); 978 981 break; 979 982 } -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r204439 r204947 2141 2141 return handleMinMax(resultOperand, ArithMax, registerOffset, argumentCountIncludingThis, insertChecks); 2142 2142 2143 case SqrtIntrinsic:2144 2143 case CosIntrinsic: 2144 case FRoundIntrinsic: 2145 case LogIntrinsic: 2145 2146 case SinIntrinsic: 2146 case LogIntrinsic: {2147 case SqrtIntrinsic: { 2147 2148 if (argumentCountIncludingThis == 1) { 2148 2149 insertChecks(); … … 2150 2151 return true; 2151 2152 } 2152 2153 2154 NodeType nodeType = Unreachable; 2153 2155 switch (intrinsic) { 2156 case CosIntrinsic: 2157 nodeType = ArithCos; 2158 break; 2159 case FRoundIntrinsic: 2160 nodeType = ArithFRound; 2161 break; 2162 case LogIntrinsic: 2163 nodeType = ArithLog; 2164 break; 2165 case SinIntrinsic: 2166 nodeType = ArithSin; 2167 break; 2154 2168 case SqrtIntrinsic: 2155 insertChecks(); 2156 set(VirtualRegister(resultOperand), addToGraph(ArithSqrt, get(virtualRegisterForArgument(1, registerOffset)))); 2157 return true; 2158 2159 case CosIntrinsic: 2160 insertChecks(); 2161 set(VirtualRegister(resultOperand), addToGraph(ArithCos, get(virtualRegisterForArgument(1, registerOffset)))); 2162 return true; 2163 2164 case SinIntrinsic: 2165 insertChecks(); 2166 set(VirtualRegister(resultOperand), addToGraph(ArithSin, get(virtualRegisterForArgument(1, registerOffset)))); 2167 return true; 2168 2169 case LogIntrinsic: 2170 insertChecks(); 2171 set(VirtualRegister(resultOperand), addToGraph(ArithLog, get(virtualRegisterForArgument(1, registerOffset)))); 2172 return true; 2173 2169 nodeType = ArithSqrt; 2170 break; 2174 2171 default: 2175 2172 RELEASE_ASSERT_NOT_REACHED(); 2176 return false; 2177 } 2173 } 2174 insertChecks(); 2175 set(VirtualRegister(resultOperand), addToGraph(nodeType, get(virtualRegisterForArgument(1, registerOffset)))); 2176 return true; 2178 2177 } 2179 2178 … … 2474 2473 insertChecks(); 2475 2474 set(VirtualRegister(resultOperand), addToGraph(ArithRandom)); 2476 return true;2477 }2478 2479 case FRoundIntrinsic: {2480 if (argumentCountIncludingThis != 2)2481 return false;2482 insertChecks();2483 VirtualRegister operand = virtualRegisterForArgument(1, registerOffset);2484 set(VirtualRegister(resultOperand), addToGraph(ArithFRound, get(operand)));2485 2475 return true; 2486 2476 } -
trunk/Source/JavaScriptCore/dfg/DFGClobberize.h
r204881 r204947 155 155 case ArithMax: 156 156 case ArithPow: 157 case ArithFRound:158 157 case GetScope: 159 158 case SkipScope: … … 188 187 189 188 case ArithCos: 189 case ArithFRound: 190 190 case ArithLog: 191 191 case ArithSin: -
trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
r204881 r204947 388 388 389 389 case ArithCos: 390 case ArithFRound: 390 391 case ArithLog: 391 392 case ArithSin: … … 396 397 else 397 398 fixEdge<UntypedUse>(child1); 398 break;399 }400 case ArithFRound: {401 fixDoubleOrBooleanEdge(node->child1());402 node->setResult(NodeResultDouble);403 399 break; 404 400 } -
trunk/Source/JavaScriptCore/dfg/DFGNodeType.h
r204881 r204947 153 153 macro(ArithMin, NodeResultNumber) \ 154 154 macro(ArithMax, NodeResultNumber) \ 155 macro(ArithFRound, NodeResult Number) \155 macro(ArithFRound, NodeResultDouble) \ 156 156 macro(ArithPow, NodeResultDouble) \ 157 157 macro(ArithRandom, NodeResultDouble | NodeMustGenerate) \ -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r204912 r204947 335 335 } 336 336 337 double JIT_OPERATION operationArithFRound(ExecState* exec, EncodedJSValue encodedOp1) 338 { 339 VM* vm = &exec->vm(); 340 NativeCallFrameTracer tracer(vm, exec); 341 342 JSValue op1 = JSValue::decode(encodedOp1); 343 double a = op1.toNumber(exec); 344 if (UNLIKELY(vm->exception())) 345 return JSValue::encode(JSValue()); 346 return static_cast<float>(a); 347 } 348 337 349 double JIT_OPERATION operationArithLog(ExecState* exec, EncodedJSValue encodedOp1) 338 350 { -
trunk/Source/JavaScriptCore/dfg/DFGOperations.h
r204881 r204947 55 55 EncodedJSValue JIT_OPERATION operationValueDiv(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL; 56 56 double JIT_OPERATION operationArithCos(ExecState*, EncodedJSValue encodedOp1) WTF_INTERNAL; 57 double JIT_OPERATION operationArithFRound(ExecState*, EncodedJSValue encodedOp1) WTF_INTERNAL; 57 58 double JIT_OPERATION operationArithLog(ExecState*, EncodedJSValue encodedOp1) WTF_INTERNAL; 58 59 double JIT_OPERATION operationArithSin(ExecState*, EncodedJSValue encodedOp1) WTF_INTERNAL; -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r204912 r204947 4537 4537 break; 4538 4538 } 4539 } 4540 4541 void SpeculativeJIT::compileArithFRound(Node* node) 4542 { 4543 if (node->child1().useKind() == DoubleRepUse) { 4544 SpeculateDoubleOperand op1(this, node->child1()); 4545 FPRTemporary result(this, op1); 4546 m_jit.convertDoubleToFloat(op1.fpr(), result.fpr()); 4547 m_jit.convertFloatToDouble(result.fpr(), result.fpr()); 4548 doubleResult(result.fpr(), node); 4549 return; 4550 } 4551 4552 JSValueOperand op1(this, node->child1()); 4553 JSValueRegs op1Regs = op1.jsValueRegs(); 4554 flushRegisters(); 4555 FPRResult result(this); 4556 callOperation(operationArithFRound, result.fpr(), op1Regs); 4557 m_jit.exceptionCheck(); 4558 doubleResult(result.fpr(), node); 4539 4559 } 4540 4560 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
r204912 r204947 2475 2475 void compileArithMul(Node*); 2476 2476 void compileArithDiv(Node*); 2477 void compileArithFRound(Node*); 2477 2478 void compileArithMod(Node*); 2478 2479 void compileArithPow(Node*); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r204912 r204947 2368 2368 break; 2369 2369 2370 case ArithFRound: { 2371 SpeculateDoubleOperand op1(this, node->child1()); 2372 FPRTemporary result(this, op1); 2373 2374 m_jit.convertDoubleToFloat(op1.fpr(), result.fpr()); 2375 m_jit.convertFloatToDouble(result.fpr(), result.fpr()); 2376 2377 doubleResult(result.fpr(), node); 2378 break; 2379 } 2370 case ArithFRound: 2371 compileArithFRound(node); 2372 break; 2380 2373 2381 2374 case ArithRandom: -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r204912 r204947 2492 2492 break; 2493 2493 2494 case ArithFRound: { 2495 SpeculateDoubleOperand op1(this, node->child1()); 2496 FPRTemporary result(this, op1); 2497 2498 m_jit.convertDoubleToFloat(op1.fpr(), result.fpr()); 2499 m_jit.convertFloatToDouble(result.fpr(), result.fpr()); 2500 2501 doubleResult(result.fpr(), node); 2502 break; 2503 } 2494 case ArithFRound: 2495 compileArithFRound(node); 2496 break; 2504 2497 2505 2498 case ArithRandom: -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r204912 r204947 2316 2316 void compileArithFRound() 2317 2317 { 2318 setDouble(m_out.fround(lowDouble(m_node->child1()))); 2318 if (m_node->child1().useKind() == DoubleRepUse) { 2319 setDouble(m_out.fround(lowDouble(m_node->child1()))); 2320 return; 2321 } 2322 LValue argument = lowJSValue(m_node->child1()); 2323 LValue result = vmCall(Double, m_out.operation(operationArithFRound), m_callFrame, argument); 2324 setDouble(result); 2319 2325 } 2320 2326
Note:
See TracChangeset
for help on using the changeset viewer.