Changeset 95136 in webkit
- Timestamp:
- Sep 14, 2011 4:06:04 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r95134 r95136 1 2011-09-14 Filip Pizlo <fpizlo@apple.com> 2 3 DFG JIT should not speculate integer if the value is always going to be 4 used as a double anyway 5 https://bugs.webkit.org/show_bug.cgi?id=68127 6 7 Reviewed by Oliver Hunt. 8 9 Added a ValueToDouble node, which is a variant of ValueToNumber that 10 hints that it will only be used as a double and never as an integer. 11 Thus, it turns off integer speculation even if the value profiler 12 told us that the value source is an int. The logic for converting a 13 ValueToNumber into a ValueToDouble is found in Propagator. 14 15 This appears to be a 22% speed-up in imaging-darkroom. 16 17 * dfg/DFGNode.h: 18 * dfg/DFGNonSpeculativeJIT.cpp: 19 (JSC::DFG::NonSpeculativeJIT::compile): 20 * dfg/DFGPropagator.cpp: 21 (JSC::DFG::Propagator::fixpoint): 22 (JSC::DFG::Propagator::toDouble): 23 (JSC::DFG::Propagator::fixupNode): 24 (JSC::DFG::Propagator::fixup): 25 * dfg/DFGSpeculativeJIT.cpp: 26 (JSC::DFG::SpeculativeJIT::compile): 27 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor): 28 1 29 2011-09-14 Filip Pizlo <fpizlo@apple.com> 2 30 -
trunk/Source/JavaScriptCore/dfg/DFGNode.h
r95115 r95136 159 159 macro(ValueToNumber, NodeResultNumber | NodeMustGenerate) \ 160 160 \ 161 /* A variant of ValueToNumber, which a hint that the parents will always use this as a double. */\ 162 macro(ValueToDouble, NodeResultNumber | NodeMustGenerate) \ 163 \ 161 164 /* Add of values may either be arithmetic, or result in string concatenation. */\ 162 165 macro(ValueAdd, NodeResultJS | NodeMustGenerate) \ -
trunk/Source/JavaScriptCore/dfg/DFGNonSpeculativeJIT.cpp
r95127 r95136 596 596 } 597 597 598 case ValueToNumber: { 598 case ValueToNumber: 599 case ValueToDouble: { 599 600 ASSERT(!isInt32Constant(node.child1())); 600 601 ASSERT(!isNumberConstant(node.child1())); -
trunk/Source/JavaScriptCore/dfg/DFGPropagator.cpp
r95115 r95136 86 86 propagateBackward(); 87 87 } while (m_changed); 88 89 fixup(); 88 90 } 89 91 … … 322 324 } 323 325 326 void toDouble(NodeIndex nodeIndex) 327 { 328 if (m_graph[nodeIndex].op == ValueToNumber) { 329 #if ENABLE(DFG_DEBUG_VERBOSE) 330 printf(" @%u -> ValueToDouble", nodeIndex); 331 #endif 332 m_graph[nodeIndex].op = ValueToDouble; 333 } 334 } 335 336 void fixupNode(Node& node) 337 { 338 if (!node.shouldGenerate()) 339 return; 340 341 NodeType op = node.op; 342 343 #if ENABLE(DFG_DEBUG_VERBOSE) 344 printf(" %s[%u]: ", Graph::opName(op), m_compileIndex); 345 #endif 346 347 switch (op) { 348 case ValueAdd: { 349 PredictedType left = m_predictions[node.child1()]; 350 PredictedType right = m_predictions[node.child2()]; 351 352 if (isStrongPrediction(left) && isStrongPrediction(right) && isNumberPrediction(left) && isNumberPrediction(right)) { 353 if (left & PredictDouble) 354 toDouble(node.child2()); 355 if (right & PredictDouble) 356 toDouble(node.child1()); 357 } 358 break; 359 } 360 361 case ArithAdd: 362 case ArithSub: 363 case ArithMul: { 364 PredictedType left = m_predictions[node.child1()]; 365 PredictedType right = m_predictions[node.child2()]; 366 367 if (isStrongPrediction(left) && isStrongPrediction(right)) { 368 if (left & PredictDouble) 369 toDouble(node.child2()); 370 if (right & PredictDouble) 371 toDouble(node.child1()); 372 } 373 break; 374 } 375 376 case ArithDiv: { 377 toDouble(node.child1()); 378 toDouble(node.child2()); 379 break; 380 } 381 382 default: 383 break; 384 } 385 386 #if ENABLE(DFG_DEBUG_VERBOSE) 387 printf("\n"); 388 #endif 389 } 390 391 void fixup() 392 { 393 #if ENABLE(DFG_DEBUG_VERBOSE) 394 printf("Performing Fixup\n"); 395 #endif 396 for (m_compileIndex = 0; m_compileIndex < m_graph.size(); ++m_compileIndex) 397 fixupNode(m_graph[m_compileIndex]); 398 } 399 324 400 Graph& m_graph; 325 401 JSGlobalData& m_globalData; -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r95127 r95136 864 864 break; 865 865 } 866 SpeculateDoubleOperand op1(this, node.child1()); 867 FPRTemporary result(this, op1); 868 m_jit.moveDouble(op1.fpr(), result.fpr()); 869 doubleResult(result.fpr(), m_compileIndex); 870 break; 871 } 872 873 case ValueToDouble: { 866 874 SpeculateDoubleOperand op1(this, node.child1()); 867 875 FPRTemporary result(this, op1); … … 1695 1703 switch (node.op) { 1696 1704 case ValueToNumber: 1705 case ValueToDouble: 1697 1706 valueToNumberIndex = info.nodeIndex(); 1698 1707 break;
Note: See TracChangeset
for help on using the changeset viewer.