Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(670)

Side by Side Diff: src/compiler/verifier.cc

Issue 2064953004: [turbofan] Unify the PlainPrimitive as Number treatment. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/typer.cc ('k') | src/types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "src/compiler/verifier.h" 5 #include "src/compiler/verifier.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 #include <queue> 9 #include <queue>
10 #include <sstream> 10 #include <sstream>
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 // Boolean -> Boolean 668 // Boolean -> Boolean
669 CheckValueInputIs(node, 0, Type::Boolean()); 669 CheckValueInputIs(node, 0, Type::Boolean());
670 CheckUpperIs(node, Type::Boolean()); 670 CheckUpperIs(node, Type::Boolean());
671 break; 671 break;
672 case IrOpcode::kBooleanToNumber: 672 case IrOpcode::kBooleanToNumber:
673 // Boolean -> Number 673 // Boolean -> Number
674 CheckValueInputIs(node, 0, Type::Boolean()); 674 CheckValueInputIs(node, 0, Type::Boolean());
675 CheckUpperIs(node, Type::Number()); 675 CheckUpperIs(node, Type::Number());
676 break; 676 break;
677 case IrOpcode::kNumberEqual: 677 case IrOpcode::kNumberEqual:
678 // (NumberOrUndefined, NumberOrUndefined) -> Boolean 678 // (Number, Number) -> Boolean
679 CheckValueInputIs(node, 0, Type::NumberOrUndefined()); 679 CheckValueInputIs(node, 0, Type::Number());
680 CheckValueInputIs(node, 1, Type::NumberOrUndefined()); 680 CheckValueInputIs(node, 1, Type::Number());
681 CheckUpperIs(node, Type::Boolean()); 681 CheckUpperIs(node, Type::Boolean());
682 break; 682 break;
683 case IrOpcode::kNumberLessThan: 683 case IrOpcode::kNumberLessThan:
684 case IrOpcode::kNumberLessThanOrEqual: 684 case IrOpcode::kNumberLessThanOrEqual:
685 // (Number, Number) -> Boolean 685 // (Number, Number) -> Boolean
686 CheckValueInputIs(node, 0, Type::NumberOrUndefined()); 686 CheckValueInputIs(node, 0, Type::Number());
687 CheckValueInputIs(node, 1, Type::NumberOrUndefined()); 687 CheckValueInputIs(node, 1, Type::Number());
688 CheckUpperIs(node, Type::Boolean()); 688 CheckUpperIs(node, Type::Boolean());
689 break; 689 break;
690 case IrOpcode::kSpeculativeNumberAdd: 690 case IrOpcode::kSpeculativeNumberAdd:
691 case IrOpcode::kSpeculativeNumberSubtract: 691 case IrOpcode::kSpeculativeNumberSubtract:
692 break; 692 break;
693 case IrOpcode::kNumberAdd: 693 case IrOpcode::kNumberAdd:
694 case IrOpcode::kNumberSubtract: 694 case IrOpcode::kNumberSubtract:
695 case IrOpcode::kNumberMultiply: 695 case IrOpcode::kNumberMultiply:
696 case IrOpcode::kNumberDivide: 696 case IrOpcode::kNumberDivide:
697 // (Number, Number) -> Number 697 // (Number, Number) -> Number
698 CheckValueInputIs(node, 0, Type::NumberOrUndefined()); 698 CheckValueInputIs(node, 0, Type::Number());
699 CheckValueInputIs(node, 1, Type::NumberOrUndefined()); 699 CheckValueInputIs(node, 1, Type::Number());
700 // CheckUpperIs(node, Type::Number()); 700 CheckUpperIs(node, Type::Number());
701 break; 701 break;
702 case IrOpcode::kNumberModulus: 702 case IrOpcode::kNumberModulus:
703 // (Number, Number) -> Number 703 // (Number, Number) -> Number
704 CheckValueInputIs(node, 0, Type::Number()); 704 CheckValueInputIs(node, 0, Type::Number());
705 CheckValueInputIs(node, 1, Type::Number()); 705 CheckValueInputIs(node, 1, Type::Number());
706 // TODO(rossberg): activate once we retype after opcode changes. 706 CheckUpperIs(node, Type::Number());
707 // CheckUpperIs(node, Type::Number());
708 break; 707 break;
709 case IrOpcode::kNumberBitwiseOr: 708 case IrOpcode::kNumberBitwiseOr:
710 case IrOpcode::kNumberBitwiseXor: 709 case IrOpcode::kNumberBitwiseXor:
711 case IrOpcode::kNumberBitwiseAnd: 710 case IrOpcode::kNumberBitwiseAnd:
712 // (Signed32, Signed32) -> Signed32 711 // (Signed32, Signed32) -> Signed32
713 CheckValueInputIs(node, 0, Type::Signed32()); 712 CheckValueInputIs(node, 0, Type::Signed32());
714 CheckValueInputIs(node, 1, Type::Signed32()); 713 CheckValueInputIs(node, 1, Type::Signed32());
715 CheckUpperIs(node, Type::Signed32()); 714 CheckUpperIs(node, Type::Signed32());
716 break; 715 break;
717 case IrOpcode::kNumberShiftLeft: 716 case IrOpcode::kNumberShiftLeft:
(...skipping 21 matching lines...) Expand all
739 CheckUpperIs(node, Type::Unsigned32()); 738 CheckUpperIs(node, Type::Unsigned32());
740 break; 739 break;
741 case IrOpcode::kNumberAtan2: 740 case IrOpcode::kNumberAtan2:
742 // (Number, Number) -> Number 741 // (Number, Number) -> Number
743 CheckValueInputIs(node, 0, Type::Number()); 742 CheckValueInputIs(node, 0, Type::Number());
744 CheckValueInputIs(node, 1, Type::Number()); 743 CheckValueInputIs(node, 1, Type::Number());
745 CheckUpperIs(node, Type::Number()); 744 CheckUpperIs(node, Type::Number());
746 break; 745 break;
747 case IrOpcode::kNumberCeil: 746 case IrOpcode::kNumberCeil:
748 case IrOpcode::kNumberFloor: 747 case IrOpcode::kNumberFloor:
748 case IrOpcode::kNumberFround:
749 case IrOpcode::kNumberAtan: 749 case IrOpcode::kNumberAtan:
750 case IrOpcode::kNumberLog: 750 case IrOpcode::kNumberLog:
751 case IrOpcode::kNumberLog1p: 751 case IrOpcode::kNumberLog1p:
752 case IrOpcode::kNumberRound: 752 case IrOpcode::kNumberRound:
753 case IrOpcode::kNumberSqrt:
753 case IrOpcode::kNumberTrunc: 754 case IrOpcode::kNumberTrunc:
754 // Number -> Number 755 // Number -> Number
755 CheckValueInputIs(node, 0, Type::Number()); 756 CheckValueInputIs(node, 0, Type::Number());
756 CheckUpperIs(node, Type::Number()); 757 CheckUpperIs(node, Type::Number());
757 break; 758 break;
758 case IrOpcode::kNumberToInt32: 759 case IrOpcode::kNumberToInt32:
759 // Number -> Signed32 760 // Number -> Signed32
760 CheckValueInputIs(node, 0, Type::NumberOrUndefined()); 761 CheckValueInputIs(node, 0, Type::Number());
761 CheckUpperIs(node, Type::Signed32()); 762 CheckUpperIs(node, Type::Signed32());
762 break; 763 break;
763 case IrOpcode::kNumberToUint32: 764 case IrOpcode::kNumberToUint32:
764 // Number -> Unsigned32 765 // Number -> Unsigned32
765 CheckValueInputIs(node, 0, Type::NumberOrUndefined()); 766 CheckValueInputIs(node, 0, Type::Number());
766 CheckUpperIs(node, Type::Unsigned32()); 767 CheckUpperIs(node, Type::Unsigned32());
767 break; 768 break;
768 case IrOpcode::kNumberIsHoleNaN: 769 case IrOpcode::kNumberIsHoleNaN:
769 // Number -> Boolean 770 // Number -> Boolean
770 CheckValueInputIs(node, 0, Type::Number()); 771 CheckValueInputIs(node, 0, Type::Number());
771 CheckUpperIs(node, Type::Boolean()); 772 CheckUpperIs(node, Type::Boolean());
772 break; 773 break;
773 case IrOpcode::kNumberConvertHoleNaN: 774 case IrOpcode::kNumberConvertHoleNaN:
774 // Number -> Number \/ Undefined 775 // Number -> Number \/ Undefined
775 CheckValueInputIs(node, 0, Type::Number()); 776 CheckValueInputIs(node, 0, Type::Number());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 case IrOpcode::kChangeTaggedToUint32: { 845 case IrOpcode::kChangeTaggedToUint32: {
845 // Unsigned32 /\ Tagged -> Unsigned32 /\ UntaggedInt32 846 // Unsigned32 /\ Tagged -> Unsigned32 /\ UntaggedInt32
846 // TODO(neis): Activate once ChangeRepresentation works in typer. 847 // TODO(neis): Activate once ChangeRepresentation works in typer.
847 // Type* from = Type::Intersect(Type::Unsigned32(), Type::Tagged()); 848 // Type* from = Type::Intersect(Type::Unsigned32(), Type::Tagged());
848 // Type* to =Type::Intersect(Type::Unsigned32(), Type::UntaggedInt32()); 849 // Type* to =Type::Intersect(Type::Unsigned32(), Type::UntaggedInt32());
849 // CheckValueInputIs(node, 0, from)); 850 // CheckValueInputIs(node, 0, from));
850 // CheckUpperIs(node, to)); 851 // CheckUpperIs(node, to));
851 break; 852 break;
852 } 853 }
853 case IrOpcode::kChangeTaggedToFloat64: { 854 case IrOpcode::kChangeTaggedToFloat64: {
854 // Number /\ Tagged -> Number /\ UntaggedFloat64 855 // NumberOrUndefined /\ Tagged -> Number /\ UntaggedFloat64
855 // TODO(neis): Activate once ChangeRepresentation works in typer. 856 // TODO(neis): Activate once ChangeRepresentation works in typer.
856 // Type* from = Type::Intersect(Type::Number(), Type::Tagged()); 857 // Type* from = Type::Intersect(Type::Number(), Type::Tagged());
857 // Type* to = Type::Intersect(Type::Number(), Type::UntaggedFloat64()); 858 // Type* to = Type::Intersect(Type::Number(), Type::UntaggedFloat64());
858 // CheckValueInputIs(node, 0, from)); 859 // CheckValueInputIs(node, 0, from));
859 // CheckUpperIs(node, to)); 860 // CheckUpperIs(node, to));
860 break; 861 break;
861 } 862 }
862 case IrOpcode::kTruncateTaggedToFloat64: { 863 case IrOpcode::kTruncateTaggedToFloat64: {
863 // NumberOrUndefined /\ Tagged -> Number /\ UntaggedFloat64 864 // NumberOrUndefined /\ Tagged -> Number /\ UntaggedFloat64
864 // TODO(neis): Activate once ChangeRepresentation works in typer. 865 // TODO(neis): Activate once ChangeRepresentation works in typer.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 case IrOpcode::kStoreBuffer: 964 case IrOpcode::kStoreBuffer:
964 break; 965 break;
965 case IrOpcode::kStoreElement: 966 case IrOpcode::kStoreElement:
966 // (Object, elementtype) -> _|_ 967 // (Object, elementtype) -> _|_
967 // TODO(rossberg): activate once machine ops are typed. 968 // TODO(rossberg): activate once machine ops are typed.
968 // CheckValueInputIs(node, 0, Type::Object()); 969 // CheckValueInputIs(node, 0, Type::Object());
969 // CheckValueInputIs(node, 1, ElementAccessOf(node->op()).type)); 970 // CheckValueInputIs(node, 1, ElementAccessOf(node->op()).type));
970 CheckNotTyped(node); 971 CheckNotTyped(node);
971 break; 972 break;
972 case IrOpcode::kNumberSilenceNaN: 973 case IrOpcode::kNumberSilenceNaN:
973 CheckValueInputIs(node, 0, Type::NumberOrUndefined()); 974 CheckValueInputIs(node, 0, Type::Number());
974 CheckUpperIs(node, Type::Number()); 975 CheckUpperIs(node, Type::Number());
975 break; 976 break;
976 977
977 // Machine operators 978 // Machine operators
978 // ----------------------- 979 // -----------------------
979 case IrOpcode::kLoad: 980 case IrOpcode::kLoad:
980 case IrOpcode::kStore: 981 case IrOpcode::kStore:
981 case IrOpcode::kStackSlot: 982 case IrOpcode::kStackSlot:
982 case IrOpcode::kWord32And: 983 case IrOpcode::kWord32And:
983 case IrOpcode::kWord32Or: 984 case IrOpcode::kWord32Or:
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 replacement->op()->EffectOutputCount() > 0); 1446 replacement->op()->EffectOutputCount() > 0);
1446 DCHECK(!NodeProperties::IsFrameStateEdge(edge) || 1447 DCHECK(!NodeProperties::IsFrameStateEdge(edge) ||
1447 replacement->opcode() == IrOpcode::kFrameState); 1448 replacement->opcode() == IrOpcode::kFrameState);
1448 } 1449 }
1449 1450
1450 #endif // DEBUG 1451 #endif // DEBUG
1451 1452
1452 } // namespace compiler 1453 } // namespace compiler
1453 } // namespace internal 1454 } // namespace internal
1454 } // namespace v8 1455 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/typer.cc ('k') | src/types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698