OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 | 1450 |
1451 | 1451 |
1452 void HGoto::PrintDataTo(StringStream* stream) { | 1452 void HGoto::PrintDataTo(StringStream* stream) { |
1453 stream->Add("B%d", SuccessorAt(0)->block_id()); | 1453 stream->Add("B%d", SuccessorAt(0)->block_id()); |
1454 } | 1454 } |
1455 | 1455 |
1456 | 1456 |
1457 void HCompareIDAndBranch::SetInputRepresentation(Representation r) { | 1457 void HCompareIDAndBranch::SetInputRepresentation(Representation r) { |
1458 input_representation_ = r; | 1458 input_representation_ = r; |
1459 if (r.IsDouble()) { | 1459 if (r.IsDouble()) { |
1460 SetFlag(kDeoptimizeOnUndefined); | 1460 // According to the ES5 spec (11.9.3, 11.8.5), Equality comparisons (==, === |
| 1461 // and !=) have special handling of undefined, e.g. undefined == undefined |
| 1462 // is 'true'. Relational comparisons have a different semantic, first |
| 1463 // calling ToPrimitive() on their arguments. The standard Crankshaft |
| 1464 // tagged-to-double conversion to ensure the HCompareIDAndBranch's inputs |
| 1465 // are doubles caused 'undefined' to be converted to NaN. That's compatible |
| 1466 // out-of-the box with ordered relational comparisons (<, >, <=, |
| 1467 // >=). However, for equality comparisons (and for 'in' and 'instanceof'), |
| 1468 // it is not consistent with the spec. For example, it would cause undefined |
| 1469 // == undefined (should be true) to be evaluated as NaN == NaN |
| 1470 // (false). Therefore, any comparisons other than ordered relational |
| 1471 // comparisons must cause a deopt when one of their arguments is undefined. |
| 1472 // See also v8:1434 |
| 1473 if (!Token::IsOrderedRelationalCompareOp(token_)) { |
| 1474 SetFlag(kDeoptimizeOnUndefined); |
| 1475 } |
1461 } else { | 1476 } else { |
1462 ASSERT(r.IsInteger32()); | 1477 ASSERT(r.IsInteger32()); |
1463 } | 1478 } |
1464 } | 1479 } |
1465 | 1480 |
1466 | 1481 |
1467 void HParameter::PrintDataTo(StringStream* stream) { | 1482 void HParameter::PrintDataTo(StringStream* stream) { |
1468 stream->Add("%u", index()); | 1483 stream->Add("%u", index()); |
1469 } | 1484 } |
1470 | 1485 |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2250 | 2265 |
2251 | 2266 |
2252 void HCheckPrototypeMaps::Verify() { | 2267 void HCheckPrototypeMaps::Verify() { |
2253 HInstruction::Verify(); | 2268 HInstruction::Verify(); |
2254 ASSERT(HasNoUses()); | 2269 ASSERT(HasNoUses()); |
2255 } | 2270 } |
2256 | 2271 |
2257 #endif | 2272 #endif |
2258 | 2273 |
2259 } } // namespace v8::internal | 2274 } } // namespace v8::internal |
OLD | NEW |