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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 r.CheckNop(MachineRepresentation::kBit, Type::Boolean(), | 637 r.CheckNop(MachineRepresentation::kBit, Type::Boolean(), |
638 MachineRepresentation::kWord32); | 638 MachineRepresentation::kWord32); |
639 r.CheckNop(MachineRepresentation::kBit, Type::Boolean(), | 639 r.CheckNop(MachineRepresentation::kBit, Type::Boolean(), |
640 MachineRepresentation::kWord64); | 640 MachineRepresentation::kWord64); |
641 } | 641 } |
642 | 642 |
643 | 643 |
644 TEST(TypeErrors) { | 644 TEST(TypeErrors) { |
645 RepresentationChangerTester r; | 645 RepresentationChangerTester r; |
646 | 646 |
| 647 // Wordish cannot be implicitly converted to/from comparison conditions. |
| 648 r.CheckTypeError(MachineRepresentation::kWord8, Type::None(), |
| 649 MachineRepresentation::kBit); |
| 650 r.CheckTypeError(MachineRepresentation::kWord16, Type::None(), |
| 651 MachineRepresentation::kBit); |
| 652 r.CheckTypeError(MachineRepresentation::kWord32, Type::None(), |
| 653 MachineRepresentation::kBit); |
| 654 r.CheckTypeError(MachineRepresentation::kWord64, Type::None(), |
| 655 MachineRepresentation::kBit); |
| 656 |
647 // Floats cannot be implicitly converted to/from comparison conditions. | 657 // Floats cannot be implicitly converted to/from comparison conditions. |
| 658 r.CheckTypeError(MachineRepresentation::kFloat64, Type::None(), |
| 659 MachineRepresentation::kBit); |
| 660 |
| 661 // Floats cannot be implicitly converted to/from comparison conditions. |
| 662 r.CheckTypeError(MachineRepresentation::kFloat32, Type::None(), |
| 663 MachineRepresentation::kBit); |
648 r.CheckTypeError(MachineRepresentation::kBit, Type::None(), | 664 r.CheckTypeError(MachineRepresentation::kBit, Type::None(), |
649 MachineRepresentation::kFloat32); | 665 MachineRepresentation::kFloat32); |
650 r.CheckTypeError(MachineRepresentation::kBit, Type::Boolean(), | 666 r.CheckTypeError(MachineRepresentation::kBit, Type::Boolean(), |
651 MachineRepresentation::kFloat32); | 667 MachineRepresentation::kFloat32); |
652 | 668 |
653 // Word64 is internal and shouldn't be implicitly converted. | 669 // Word64 is internal and shouldn't be implicitly converted. |
654 r.CheckTypeError(MachineRepresentation::kWord64, Type::None(), | 670 r.CheckTypeError(MachineRepresentation::kWord64, Type::None(), |
655 MachineRepresentation::kTagged); | 671 MachineRepresentation::kTagged); |
656 r.CheckTypeError(MachineRepresentation::kTagged, Type::None(), | 672 r.CheckTypeError(MachineRepresentation::kTagged, Type::None(), |
657 MachineRepresentation::kWord64); | 673 MachineRepresentation::kWord64); |
658 r.CheckTypeError(MachineRepresentation::kTagged, Type::Boolean(), | 674 r.CheckTypeError(MachineRepresentation::kTagged, Type::Boolean(), |
659 MachineRepresentation::kWord64); | 675 MachineRepresentation::kWord64); |
660 | 676 |
661 // Word64 / Word32 shouldn't be implicitly converted. | 677 // Word64 / Word32 shouldn't be implicitly converted. |
662 r.CheckTypeError(MachineRepresentation::kWord64, Type::None(), | 678 r.CheckTypeError(MachineRepresentation::kWord64, Type::None(), |
663 MachineRepresentation::kWord32); | 679 MachineRepresentation::kWord32); |
664 r.CheckTypeError(MachineRepresentation::kWord32, Type::None(), | 680 r.CheckTypeError(MachineRepresentation::kWord32, Type::None(), |
665 MachineRepresentation::kWord64); | 681 MachineRepresentation::kWord64); |
666 r.CheckTypeError(MachineRepresentation::kWord32, Type::Signed32(), | 682 r.CheckTypeError(MachineRepresentation::kWord32, Type::Signed32(), |
667 MachineRepresentation::kWord64); | 683 MachineRepresentation::kWord64); |
668 r.CheckTypeError(MachineRepresentation::kWord32, Type::Unsigned32(), | 684 r.CheckTypeError(MachineRepresentation::kWord32, Type::Unsigned32(), |
669 MachineRepresentation::kWord64); | 685 MachineRepresentation::kWord64); |
670 } | 686 } |
671 | 687 |
672 } // namespace compiler | 688 } // namespace compiler |
673 } // namespace internal | 689 } // namespace internal |
674 } // namespace v8 | 690 } // namespace v8 |
OLD | NEW |