Changeset 243277 in webkit
- Timestamp:
- Mar 20, 2019, 10:41:21 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/double-add-sub-mul-can-produce-nan.js (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/bytecode/SpeculatedType.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r243265 r243277 1 2019-03-20 Saam Barati <sbarati@apple.com> 2 3 typeOfDoubleSum is wrong for when NaN can be produced 4 https://bugs.webkit.org/show_bug.cgi?id=196030 5 6 Reviewed by Filip Pizlo. 7 8 * stress/double-add-sub-mul-can-produce-nan.js: Added. 9 (assert): 10 (noInline.sub): 11 (noInline): 12 (assert.mul): 13 (assert.add): 14 1 15 2019-03-20 Yusuke Suzuki <ysuzuki@apple.com> 2 16 -
trunk/Source/JavaScriptCore/ChangeLog
r243275 r243277 1 2019-03-20 Saam Barati <sbarati@apple.com> 2 3 typeOfDoubleSum is wrong for when NaN can be produced 4 https://bugs.webkit.org/show_bug.cgi?id=196030 5 6 Reviewed by Filip Pizlo. 7 8 We were using typeOfDoubleSum(SpeculatedType, SpeculatedType) for add/sub/mul. 9 It assumed that the only way the resulting type could be NaN is if one of 10 the inputs were NaN. However, this is wrong. NaN can be produced in at least 11 these cases: 12 Infinity - Infinity 13 Infinity + (-Infinity) 14 Infinity * 0 15 16 * bytecode/SpeculatedType.cpp: 17 (JSC::typeOfDoubleSumOrDifferenceOrProduct): 18 (JSC::typeOfDoubleSum): 19 (JSC::typeOfDoubleDifference): 20 (JSC::typeOfDoubleProduct): 21 1 22 2019-03-20 Simon Fraser <simon.fraser@apple.com> 2 23 -
trunk/Source/JavaScriptCore/bytecode/SpeculatedType.cpp
r242990 r243277 613 613 } 614 614 615 SpeculatedType typeOfDoubleSum(SpeculatedType a, SpeculatedType b)615 static SpeculatedType typeOfDoubleSumOrDifferenceOrProduct(SpeculatedType a, SpeculatedType b) 616 616 { 617 617 SpeculatedType result = a | b; 618 619 if (result & SpecNonIntAsDouble) { 620 // NaN can be produced by: 621 // Infinity - Infinity 622 // Infinity + (-Infinity) 623 // Infinity * 0 624 result |= SpecDoublePureNaN; 625 } 626 618 627 // Impure NaN could become pure NaN during addition because addition may clear bits. 619 628 if (result & SpecDoubleImpureNaN) … … 625 634 } 626 635 636 SpeculatedType typeOfDoubleSum(SpeculatedType a, SpeculatedType b) 637 { 638 return typeOfDoubleSumOrDifferenceOrProduct(a, b); 639 } 640 627 641 SpeculatedType typeOfDoubleDifference(SpeculatedType a, SpeculatedType b) 628 642 { 629 return typeOfDoubleSum (a, b);643 return typeOfDoubleSumOrDifferenceOrProduct(a, b); 630 644 } 631 645 632 646 SpeculatedType typeOfDoubleProduct(SpeculatedType a, SpeculatedType b) 633 647 { 634 return typeOfDoubleSum (a, b);648 return typeOfDoubleSumOrDifferenceOrProduct(a, b); 635 649 } 636 650
Note:
See TracChangeset
for help on using the changeset viewer.