Changeset 199639 in webkit
- Timestamp:
- Apr 16, 2016, 9:55:02 PM (10 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 1 added
- 3 edited
-
ChangeLog (modified) (1 diff)
-
dfg/DFGAbstractInterpreterInlines.h (modified) (1 diff)
-
dfg/DFGFixupPhase.cpp (modified) (1 diff)
-
tests/stress/compare-number-and-other.js (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r199638 r199639 1 2016-04-16 Benjamin Poulain <bpoulain@webkit.org> 2 3 [JSC] DFG should support relational comparisons of Number and Other 4 https://bugs.webkit.org/show_bug.cgi?id=156669 5 6 Reviewed by Darin Adler. 7 8 In Sunspider/3d-raytrace, DFG falls back to JSValue in some important 9 relational compare because profiling sees "undefined" from time to time. 10 11 This case is fairly common outside Sunspider too because of out-of-bounds array access. 12 Unfortunately for us, our fallback for compare is really inefficient. 13 14 Fortunately, relational comparison with null/undefined/true/false are trival. 15 We can just convert both side to Double. That's what this patch adds. 16 17 I also extended constant folding for those cases because I noticed 18 a bunch of "undefined" constant going through DoubleRep at runtime. 19 20 * dfg/DFGAbstractInterpreterInlines.h: 21 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): 22 * dfg/DFGFixupPhase.cpp: 23 (JSC::DFG::FixupPhase::fixupNode): 24 * tests/stress/compare-number-and-other.js: Added. 25 (opaqueSideEffect): 26 (let.operator.of.operators.eval.testPolymorphic): 27 (let.operator.of.operators.let.left.of.typeCases.let.right.of.typeCases.eval.testMonomorphic): 28 (let.operator.of.operators.let.left.of.typeCases.let.right.of.typeCases.testMonomorphicLeftConstant): 29 (let.operator.of.operators.let.left.of.typeCases.let.right.of.typeCases.testMonomorphicRightConstant): 30 (let.operator.of.operators.let.left.of.typeCases.let.right.of.typeCases.i.testPolymorphic): 31 1 32 2016-04-16 Benjamin Poulain <bpoulain@apple.com> 2 33 -
trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r199514 r199639 393 393 case DoubleRep: { 394 394 JSValue child = forNode(node->child1()).value(); 395 if (child && child.isNumber()) { 396 setConstant(node, jsDoubleNumber(child.asNumber())); 397 break; 395 if (child) { 396 if (child.isNumber()) { 397 setConstant(node, jsDoubleNumber(child.asNumber())); 398 break; 399 } 400 if (child.isUndefined()) { 401 setConstant(node, jsDoubleNumber(PNaN)); 402 break; 403 } 404 if (child.isNull() || child.isFalse()) { 405 setConstant(node, jsDoubleNumber(0)); 406 break; 407 } 408 if (child.isTrue()) { 409 setConstant(node, jsDoubleNumber(1)); 410 break; 411 } 398 412 } 399 413 -
trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
r199514 r199639 454 454 fixDoubleOrBooleanEdge(node->child1()); 455 455 fixDoubleOrBooleanEdge(node->child2()); 456 } 457 if (node->op() != CompareEq 458 && node->child1()->shouldSpeculateNotCell() 459 && node->child2()->shouldSpeculateNotCell()) { 460 if (node->child1()->shouldSpeculateNumberOrBoolean()) 461 fixDoubleOrBooleanEdge(node->child1()); 462 else 463 fixEdge<DoubleRepUse>(node->child1()); 464 if (node->child2()->shouldSpeculateNumberOrBoolean()) 465 fixDoubleOrBooleanEdge(node->child2()); 466 else 467 fixEdge<DoubleRepUse>(node->child2()); 456 468 node->clearFlags(NodeMustGenerate); 457 469 break;
Note:
See TracChangeset
for help on using the changeset viewer.