Changeset 164819 in webkit
- Timestamp:
- Feb 27, 2014 11:39:42 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r164807 r164819 1 2014-02-27 Tibor Meszaros <tmeszaros.u-szeged@partner.samsung.com> 2 3 Math.{max, min}() must not return after first NaN value 4 https://bugs.webkit.org/show_bug.cgi?id=104147 5 6 Reviewed by Oliver Hunt. 7 8 Extended the Math.{max, min}() tests, to check that these methods are return after first NaN value or not. 9 10 * js/math-expected.txt: 11 * js/script-tests/math.js: 12 1 13 2014-02-27 Chris Fleizach <cfleizach@apple.com> 2 14 -
trunk/LayoutTests/js/math-expected.txt
r158545 r164819 98 98 PASS Math.max(-0) is -0 99 99 PASS Math.max(-0, 0) is 0 100 PASS Math.max(NaN, {valueOf:function(){throw "err"}}) threw exception err. 101 PASS Math.max(NaN, NaN, {valueOf:function(){throw "err"}}) threw exception err. 102 PASS Math.max(-0, NaN, 0) is NaN 103 PASS Math.max(-0, NaN, 0, NaN) is NaN 104 PASS Math.max({valueOf:function(){throw "error1"}}, {valueOf:function(){sideEffect = 1}}) threw exception error1. 105 PASS sideEffect is 0 100 106 PASS Math.min() is Infinity 101 107 PASS Math.min(NaN) is NaN … … 104 110 PASS Math.min(-0) is -0 105 111 PASS Math.min(-0, 0) is -0 112 PASS Math.min(NaN, {valueOf:function(){throw "err"}}) threw exception err. 113 PASS Math.min(NaN, NaN, {valueOf:function(){throw "err"}}) threw exception err. 114 PASS Math.min(-0, NaN, 0) is NaN 115 PASS Math.min(-0, NaN, 0, NaN) is NaN 116 PASS Math.min({valueOf:function(){throw "error1"}}, {valueOf:function(){sideEffect = 1}}) threw exception error1. 117 PASS sideEffect is 0 106 118 PASS Math.pow(NaN, NaN) is NaN 107 119 PASS Math.pow(NaN, 0) is 1 -
trunk/LayoutTests/js/script-tests/math.js
r158545 r164819 140 140 shouldBe("Math.max(-0)", "-0"); 141 141 shouldBe("Math.max(-0, 0)", "0"); 142 shouldThrow("Math.max(NaN, {valueOf:function(){throw \"err\"}})","'err'"); 143 shouldThrow("Math.max(NaN, NaN, {valueOf:function(){throw \"err\"}})","'err'"); 144 shouldBe("Math.max(-0, NaN, 0)", "NaN"); 145 shouldBe("Math.max(-0, NaN, 0, NaN)", "NaN"); 146 sideEffect = 0; 147 shouldThrow("Math.max({valueOf:function(){throw \"error1\"}}, {valueOf:function(){sideEffect = 1}})", "'error1'") 148 shouldBe('sideEffect', '0'); 142 149 143 150 shouldBe("Math.min()", "Infinity"); … … 147 154 shouldBe("Math.min(-0)", "-0"); 148 155 shouldBe("Math.min(-0, 0)", "-0"); 156 shouldThrow("Math.min(NaN, {valueOf:function(){throw \"err\"}})","'err'"); 157 shouldThrow("Math.min(NaN, NaN, {valueOf:function(){throw \"err\"}})","'err'"); 158 shouldBe("Math.min(-0, NaN, 0)", "NaN"); 159 shouldBe("Math.min(-0, NaN, 0, NaN)", "NaN"); 160 sideEffect = 0; 161 shouldThrow("Math.min({valueOf:function(){throw \"error1\"}}, {valueOf:function(){sideEffect = 1}})", "'error1'") 162 shouldBe('sideEffect', '0'); 149 163 150 164 shouldBe("Math.pow(NaN, NaN)", "NaN"); -
trunk/Source/JavaScriptCore/ChangeLog
r164815 r164819 1 2014-02-27 Tibor Meszaros <tmeszaros.u-szeged@partner.samsung.com> 2 3 Math.{max, min}() must not return after first NaN value 4 https://bugs.webkit.org/show_bug.cgi?id=104147 5 6 Reviewed by Oliver Hunt. 7 8 According to the spec, ToNumber going to be called on each argument 9 even if a `NaN` value was already found 10 11 * runtime/MathObject.cpp: 12 (JSC::mathProtoFuncMax): 13 (JSC::mathProtoFuncMin): 14 1 15 2014-02-27 Gergo Balogh <gbalogh.u-szeged@partner.samsung.com> 2 16 -
trunk/Source/JavaScriptCore/runtime/MathObject.cpp
r163844 r164819 189 189 if (std::isnan(val)) { 190 190 result = QNaN; 191 break; 192 } 193 if (val > result || (!val && !result && !std::signbit(val))) 191 } else if (val > result || (!val && !result && !std::signbit(val))) 194 192 result = val; 195 193 } … … 205 203 if (std::isnan(val)) { 206 204 result = QNaN; 207 break; 208 } 209 if (val < result || (!val && !result && std::signbit(val))) 205 } else if (val < result || (!val && !result && std::signbit(val))) 210 206 result = val; 211 207 }
Note: See TracChangeset
for help on using the changeset viewer.