| 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 "test/cctest/cctest.h" | 7 #include "test/cctest/cctest.h" |
| 8 #include "test/cctest/compiler/codegen-tester.h" | 8 #include "test/cctest/compiler/codegen-tester.h" |
| 9 #include "test/cctest/compiler/graph-builder-tester.h" | 9 #include "test/cctest/compiler/graph-builder-tester.h" |
| 10 #include "test/cctest/compiler/value-helper.h" | 10 #include "test/cctest/compiler/value-helper.h" |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 r.CheckNop(MachineRepresentation::kBit, Type::Boolean(), | 644 r.CheckNop(MachineRepresentation::kBit, Type::Boolean(), |
| 645 MachineRepresentation::kWord32); | 645 MachineRepresentation::kWord32); |
| 646 r.CheckNop(MachineRepresentation::kBit, Type::Boolean(), | 646 r.CheckNop(MachineRepresentation::kBit, Type::Boolean(), |
| 647 MachineRepresentation::kWord64); | 647 MachineRepresentation::kWord64); |
| 648 } | 648 } |
| 649 | 649 |
| 650 | 650 |
| 651 TEST(TypeErrors) { | 651 TEST(TypeErrors) { |
| 652 RepresentationChangerTester r; | 652 RepresentationChangerTester r; |
| 653 | 653 |
| 654 // Wordish cannot be implicitly converted to/from comparison conditions. | |
| 655 r.CheckTypeError(MachineRepresentation::kWord8, Type::Number(), | |
| 656 MachineRepresentation::kBit); | |
| 657 r.CheckTypeError(MachineRepresentation::kWord16, Type::Number(), | |
| 658 MachineRepresentation::kBit); | |
| 659 r.CheckTypeError(MachineRepresentation::kWord32, Type::Number(), | |
| 660 MachineRepresentation::kBit); | |
| 661 r.CheckTypeError(MachineRepresentation::kWord64, Type::Number(), | |
| 662 MachineRepresentation::kBit); | |
| 663 | |
| 664 // Floats cannot be implicitly converted to/from comparison conditions. | 654 // Floats cannot be implicitly converted to/from comparison conditions. |
| 665 r.CheckTypeError(MachineRepresentation::kFloat64, Type::Number(), | |
| 666 MachineRepresentation::kBit); | |
| 667 | |
| 668 // Floats cannot be implicitly converted to/from comparison conditions. | |
| 669 r.CheckTypeError(MachineRepresentation::kFloat32, Type::Number(), | |
| 670 MachineRepresentation::kBit); | |
| 671 r.CheckTypeError(MachineRepresentation::kBit, Type::Number(), | 655 r.CheckTypeError(MachineRepresentation::kBit, Type::Number(), |
| 672 MachineRepresentation::kFloat32); | 656 MachineRepresentation::kFloat32); |
| 673 r.CheckTypeError(MachineRepresentation::kBit, Type::Boolean(), | 657 r.CheckTypeError(MachineRepresentation::kBit, Type::Boolean(), |
| 674 MachineRepresentation::kFloat32); | 658 MachineRepresentation::kFloat32); |
| 675 | 659 |
| 676 // Word64 is internal and shouldn't be implicitly converted. | 660 // Word64 is internal and shouldn't be implicitly converted. |
| 677 r.CheckTypeError(MachineRepresentation::kWord64, Type::Internal(), | 661 r.CheckTypeError(MachineRepresentation::kWord64, Type::Internal(), |
| 678 MachineRepresentation::kTagged); | 662 MachineRepresentation::kTagged); |
| 679 r.CheckTypeError(MachineRepresentation::kTagged, Type::Number(), | 663 r.CheckTypeError(MachineRepresentation::kTagged, Type::Number(), |
| 680 MachineRepresentation::kWord64); | 664 MachineRepresentation::kWord64); |
| 681 r.CheckTypeError(MachineRepresentation::kTagged, Type::Boolean(), | 665 r.CheckTypeError(MachineRepresentation::kTagged, Type::Boolean(), |
| 682 MachineRepresentation::kWord64); | 666 MachineRepresentation::kWord64); |
| 683 | 667 |
| 684 // Word64 / Word32 shouldn't be implicitly converted. | 668 // Word64 / Word32 shouldn't be implicitly converted. |
| 685 r.CheckTypeError(MachineRepresentation::kWord64, Type::Internal(), | 669 r.CheckTypeError(MachineRepresentation::kWord64, Type::Internal(), |
| 686 MachineRepresentation::kWord32); | 670 MachineRepresentation::kWord32); |
| 687 r.CheckTypeError(MachineRepresentation::kWord32, Type::Number(), | 671 r.CheckTypeError(MachineRepresentation::kWord32, Type::Number(), |
| 688 MachineRepresentation::kWord64); | 672 MachineRepresentation::kWord64); |
| 689 r.CheckTypeError(MachineRepresentation::kWord32, Type::Signed32(), | 673 r.CheckTypeError(MachineRepresentation::kWord32, Type::Signed32(), |
| 690 MachineRepresentation::kWord64); | 674 MachineRepresentation::kWord64); |
| 691 r.CheckTypeError(MachineRepresentation::kWord32, Type::Unsigned32(), | 675 r.CheckTypeError(MachineRepresentation::kWord32, Type::Unsigned32(), |
| 692 MachineRepresentation::kWord64); | 676 MachineRepresentation::kWord64); |
| 693 } | 677 } |
| 694 | 678 |
| 695 } // namespace compiler | 679 } // namespace compiler |
| 696 } // namespace internal | 680 } // namespace internal |
| 697 } // namespace v8 | 681 } // namespace v8 |
| OLD | NEW |