| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <limits> | 5 #include <limits> |
| 6 | 6 |
| 7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
| 8 #include "src/compiler/representation-change.h" | 8 #include "src/compiler/representation-change.h" |
| 9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
| 10 #include "test/cctest/cctest.h" | 10 #include "test/cctest/cctest.h" |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 CheckTwoChanges(IrOpcode::kChangeFloat32ToFloat64, | 438 CheckTwoChanges(IrOpcode::kChangeFloat32ToFloat64, |
| 439 IrOpcode::kTruncateFloat64ToWord32, | 439 IrOpcode::kTruncateFloat64ToWord32, |
| 440 MachineRepresentation::kFloat32, Type::Number(), | 440 MachineRepresentation::kFloat32, Type::Number(), |
| 441 MachineRepresentation::kWord32); | 441 MachineRepresentation::kWord32); |
| 442 } | 442 } |
| 443 | 443 |
| 444 static void TestMinusZeroCheck(IrOpcode::Value expected, Type* from_type) { | 444 static void TestMinusZeroCheck(IrOpcode::Value expected, Type* from_type) { |
| 445 RepresentationChangerTester r; | 445 RepresentationChangerTester r; |
| 446 | 446 |
| 447 CheckChange(expected, MachineRepresentation::kFloat64, from_type, | 447 CheckChange(expected, MachineRepresentation::kFloat64, from_type, |
| 448 UseInfo::CheckedSignedSmallAsWord32( | 448 UseInfo::CheckedSignedSmallAsWord32(kDistinguishZeros)); |
| 449 CheckForMinusZeroMode::kCheckForMinusZero)); | |
| 450 | 449 |
| 451 CheckChange(expected, MachineRepresentation::kFloat64, from_type, | 450 CheckChange(expected, MachineRepresentation::kFloat64, from_type, |
| 452 UseInfo::CheckedSignedSmallAsWord32( | 451 UseInfo::CheckedSignedSmallAsWord32(kIdentifyZeros)); |
| 453 CheckForMinusZeroMode::kDontCheckForMinusZero)); | |
| 454 | 452 |
| 455 CheckChange(expected, MachineRepresentation::kFloat64, from_type, | 453 CheckChange(expected, MachineRepresentation::kFloat64, from_type, |
| 456 UseInfo::CheckedSigned32AsWord32( | 454 UseInfo::CheckedSigned32AsWord32(kDistinguishZeros)); |
| 457 CheckForMinusZeroMode::kCheckForMinusZero)); | |
| 458 | 455 |
| 459 CheckChange(expected, MachineRepresentation::kFloat64, from_type, | 456 CheckChange(expected, MachineRepresentation::kFloat64, from_type, |
| 460 UseInfo::CheckedSigned32AsWord32( | 457 UseInfo::CheckedSigned32AsWord32(kDistinguishZeros)); |
| 461 CheckForMinusZeroMode::kDontCheckForMinusZero)); | |
| 462 } | 458 } |
| 463 | 459 |
| 464 TEST(MinusZeroCheck) { | 460 TEST(MinusZeroCheck) { |
| 465 TestMinusZeroCheck(IrOpcode::kCheckedFloat64ToInt32, Type::NumberOrOddball()); | 461 TestMinusZeroCheck(IrOpcode::kCheckedFloat64ToInt32, Type::NumberOrOddball()); |
| 466 // PlainNumber cannot be minus zero so the minus zero check should be | 462 // PlainNumber cannot be minus zero so the minus zero check should be |
| 467 // eliminated. | 463 // eliminated. |
| 468 TestMinusZeroCheck(IrOpcode::kCheckedFloat64ToInt32, Type::PlainNumber()); | 464 TestMinusZeroCheck(IrOpcode::kCheckedFloat64ToInt32, Type::PlainNumber()); |
| 469 } | 465 } |
| 470 | 466 |
| 471 TEST(Nops) { | 467 TEST(Nops) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 MachineRepresentation::kWord64); | 527 MachineRepresentation::kWord64); |
| 532 r.CheckTypeError(MachineRepresentation::kWord32, Type::Signed32(), | 528 r.CheckTypeError(MachineRepresentation::kWord32, Type::Signed32(), |
| 533 MachineRepresentation::kWord64); | 529 MachineRepresentation::kWord64); |
| 534 r.CheckTypeError(MachineRepresentation::kWord32, Type::Unsigned32(), | 530 r.CheckTypeError(MachineRepresentation::kWord32, Type::Unsigned32(), |
| 535 MachineRepresentation::kWord64); | 531 MachineRepresentation::kWord64); |
| 536 } | 532 } |
| 537 | 533 |
| 538 } // namespace compiler | 534 } // namespace compiler |
| 539 } // namespace internal | 535 } // namespace internal |
| 540 } // namespace v8 | 536 } // namespace v8 |
| OLD | NEW |