Changeset 187089 in webkit
- Timestamp:
- Jul 20, 2015 10:27:39 PM (9 years ago)
- Location:
- branches/safari-601.1-branch/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-601.1-branch/Source/JavaScriptCore/ChangeLog
r187080 r187089 1 2015-07-20 Matthew Hanson <matthew_hanson@apple.com> 2 3 Merge r186819. rdar://problem/21729083 4 5 2015-07-14 Matthew Mirman <mmirman@apple.com> 6 7 Repatch. Makes compileArithSub in the DFG ensure that the constant is an int32. 8 https://bugs.webkit.org/show_bug.cgi?id=146910 9 rdar://problem/21729083 10 11 Reviewed by Filip Pizlo. 12 13 Also fixes the debug build problem where all edges are assumed to 14 have UntypedUse before the fixup phase. 15 16 * dfg/DFGSpeculativeJIT.cpp: 17 (JSC::DFG::SpeculativeJIT::compileArithSub): 18 * dfg/DFGValidate.cpp: 19 (JSC::DFG::Validate::validateEdgeWithDoubleResultIfNecessary): 20 * tests/stress/arith-add-with-constants.js: Added some tests for this case. 21 (arithAdd42WrittenAsInteger): 22 (testArithAdd42WrittenAsInteger): 23 (arithSub42WrittenAsDouble): 24 (testArithSub42WrittenAsDouble): 25 (doubleConstant): 26 (testDoubleConstant): Added test for the case of +0.0 and Math.min(0.0) 27 (arithAdd42WrittenAsDouble): Deleted. 28 (testArithAdd42WrittenAsDouble): Deleted. 29 1 30 2015-07-20 Matthew Hanson <matthew_hanson@apple.com> 2 31 -
branches/safari-601.1-branch/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r186753 r187089 2990 2990 ASSERT(!shouldCheckNegativeZero(node->arithMode())); 2991 2991 2992 if (node->child2()->is NumberConstant()) {2992 if (node->child2()->isInt32Constant()) { 2993 2993 SpeculateInt32Operand op1(this, node->child1()); 2994 2994 int32_t imm2 = node->child2()->asInt32(); … … 3007 3007 } 3008 3008 3009 if (node->child1()->is NumberConstant()) {3009 if (node->child1()->isInt32Constant()) { 3010 3010 int32_t imm1 = node->child1()->asInt32(); 3011 3011 SpeculateInt32Operand op2(this, node->child2()); -
branches/safari-601.1-branch/Source/JavaScriptCore/dfg/DFGValidate.cpp
r186753 r187089 545 545 546 546 if (m_graph.m_planStage < PlanStage::AfterFixup) 547 VALIDATE((node, edge), edge.useKind() == UntypedUse);548 else549 547 return; 548 549 VALIDATE((node, edge), edge.useKind() == DoubleRepUse || edge.useKind() == DoubleRepRealUse || edge.useKind() == DoubleRepMachineIntUse); 550 550 } 551 551 -
branches/safari-601.1-branch/Source/JavaScriptCore/tests/stress/arith-add-with-constants.js
r180813 r187089 168 168 169 169 170 function arithAdd42WrittenAsDouble(x) { 171 var a = x + 42.0; 172 var b = 42. + x; 173 if (!(isNaN(x) && isNaN(a) && isNaN(b)) && a !== b) 174 throw "Internal error on arithAdd42WrittenAsDouble, a = " + a + " b = " + b; 175 return a; 176 } 177 noInline(arithAdd42WrittenAsDouble); 178 179 function testArithAdd42WrittenAsDouble() { 180 for (var i = 0; i < 1e4; ++i) { 181 var result = arithAdd42WrittenAsDouble(13); 170 171 172 // Test "value + 42". 173 function arithAdd42WrittenAsInteger(x) { 174 var a = x + 42; 175 var b = 42 + x; 176 if (!(isNaN(x) && isNaN(a) && isNaN(b)) && a !== b) 177 throw "Internal error on arithAdd42WrittenAsInteger, a = " + a + " b = " + b; 178 return a; 179 } 180 noInline(arithAdd42WrittenAsInteger); 181 182 function testArithAdd42WrittenAsInteger() { 183 for (var i = 0; i < 1e4; ++i) { 184 var result = arithAdd42WrittenAsInteger(13); 182 185 if (result !== 55) { 183 throw "arithAdd42WrittenAs Double(i) = " + result + ", expected 55";184 } 185 } 186 187 for (var i = 0; i < 1e4; ++i) { 188 var result = arithAdd42WrittenAs Double(-0);186 throw "arithAdd42WrittenAsInteger(13) = " + result + ", expected 55"; 187 } 188 } 189 190 for (var i = 0; i < 1e4; ++i) { 191 var result = arithAdd42WrittenAsInteger(-0); 189 192 if (result !== 42) { 190 throw "arithAdd42WrittenAs Double(-0) = " + result + ", expected 42";191 } 192 } 193 194 for (var i = 0; i < 1e4; ++i) { 195 var result = arithAdd42WrittenAs Double(13.3);193 throw "arithAdd42WrittenAsInteger(-0) = " + result + ", expected 42"; 194 } 195 } 196 197 for (var i = 0; i < 1e4; ++i) { 198 var result = arithAdd42WrittenAsInteger(13.3); 196 199 if (result !== 55.3) { 197 throw "arithAdd42WrittenAsDouble(13.3) = " + result + ", expected 55.3"; 198 } 199 } 200 201 for (var i = 0; i < 1e4; ++i) {; 202 var result = arithAdd42WrittenAsDouble(NaN); 203 if (!isNaN(result)) { 204 throw "arithAdd42WrittenAsDouble(NaN) = " + result + ", expected NaN"; 205 } 206 } 207 208 for (var i = 0; i < 1e4; ++i) {; 209 var result = arithAdd42WrittenAsDouble(Infinity); 210 if (isFinite(result)) { 211 throw "arithAdd42WrittenAsDouble(Infinity) = " + result + ", expected Infinity"; 212 } 213 } 214 215 for (var i = 0; i < 1e4; ++i) {; 216 var result = arithAdd42WrittenAsDouble(-Infinity); 217 if (isFinite(result) || result >= 0) { 218 throw "arithAdd42WrittenAsDouble(-Infinity) = " + result + ", expected -Infinity"; 219 } 220 } 221 } 222 testArithAdd42WrittenAsDouble(); 200 throw "arithAdd42WrittenAsInteger(13.3) = " + result + ", expected 55.3"; 201 } 202 } 203 204 for (var i = 0; i < 1e4; ++i) {; 205 var result = arithAdd42WrittenAsInteger(NaN); 206 if (!isNaN(result)) { 207 throw "arithAdd42WrittenAsInteger(NaN) = " + result + ", expected NaN"; 208 } 209 } 210 211 for (var i = 0; i < 1e4; ++i) {; 212 var result = arithAdd42WrittenAsInteger(Infinity); 213 if (isFinite(result)) { 214 throw "arithAdd42WrittenAsInteger(Infinity) = " + result + ", expected Infinity"; 215 } 216 } 217 218 for (var i = 0; i < 1e4; ++i) {; 219 var result = arithAdd42WrittenAsInteger(-Infinity); 220 if (isFinite(result) || result >= 0) { 221 throw "arithAdd42WrittenAsInteger(-Infinity) = " + result + ", expected -Infinity"; 222 } 223 } 224 } 225 testArithAdd42WrittenAsInteger(); 226 227 function arithSub42WrittenAsDouble(x) { 228 var a = (x|0) - 42.0; 229 var b = -42. + (x|0); 230 if (!(isNaN(x) && isNaN(a) && isNaN(b)) && a !== b) 231 throw "Internal error on arithSub42WrittenAsDouble, a = " + a + " b = " + b; 232 return a; 233 } 234 noInline(arithSub42WrittenAsDouble); 235 236 function testArithSub42WrittenAsDouble() { 237 for (var i = 0; i < 1e4; ++i) { 238 var result = arithSub42WrittenAsDouble(13); 239 if (result !== -29) { 240 throw "arithSub42WrittenAsDouble(13) = " + result + ", expected -29"; 241 } 242 } 243 244 for (var i = 0; i < 1e4; ++i) { 245 var result = arithSub42WrittenAsDouble(-0); 246 if (result !== -42) { 247 throw "arithSub42WrittenAsDouble(-0) = " + result + ", expected -42"; 248 } 249 } 250 251 for (var i = 0; i < 1e4; ++i) { 252 var result = arithSub42WrittenAsDouble(13.3); 253 if (result !== -29) { 254 throw "arithSub42WrittenAsDouble(13.3) = " + result + ", expected -29"; 255 } 256 } 257 } 258 testArithSub42WrittenAsDouble(); 259 260 261 function doubleConstant(){ 262 Math.min(0.0); 263 +0.0; 264 } noInline(doubleConstant); 265 266 function testDoubleConstant(){ 267 for (var i = 0; i < 1e4; ++i) { 268 doubleConstant(); 269 } 270 } 271 testDoubleConstant();
Note: See TracChangeset
for help on using the changeset viewer.