OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 V(GlobalObject) \ | 111 V(GlobalObject) \ |
112 V(GlobalReceiver) \ | 112 V(GlobalReceiver) \ |
113 V(Goto) \ | 113 V(Goto) \ |
114 V(HasCachedArrayIndexAndBranch) \ | 114 V(HasCachedArrayIndexAndBranch) \ |
115 V(HasInstanceTypeAndBranch) \ | 115 V(HasInstanceTypeAndBranch) \ |
116 V(In) \ | 116 V(In) \ |
117 V(InstanceOf) \ | 117 V(InstanceOf) \ |
118 V(InstanceOfKnownGlobal) \ | 118 V(InstanceOfKnownGlobal) \ |
119 V(InvokeFunction) \ | 119 V(InvokeFunction) \ |
120 V(IsConstructCallAndBranch) \ | 120 V(IsConstructCallAndBranch) \ |
121 V(IsNullAndBranch) \ | 121 V(IsNilAndBranch) \ |
122 V(IsObjectAndBranch) \ | 122 V(IsObjectAndBranch) \ |
123 V(IsSmiAndBranch) \ | 123 V(IsSmiAndBranch) \ |
124 V(IsUndetectableAndBranch) \ | 124 V(IsUndetectableAndBranch) \ |
125 V(JSArrayLength) \ | 125 V(JSArrayLength) \ |
126 V(LeaveInlined) \ | 126 V(LeaveInlined) \ |
127 V(LoadContextSlot) \ | 127 V(LoadContextSlot) \ |
128 V(LoadElements) \ | 128 V(LoadElements) \ |
129 V(LoadExternalArrayPointer) \ | 129 V(LoadExternalArrayPointer) \ |
130 V(LoadFunctionPrototype) \ | 130 V(LoadFunctionPrototype) \ |
131 V(LoadGlobalCell) \ | 131 V(LoadGlobalCell) \ |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 | 618 |
619 int ChangesFlags() const { return flags_ & ChangesFlagsMask(); } | 619 int ChangesFlags() const { return flags_ & ChangesFlagsMask(); } |
620 | 620 |
621 Range* range() const { return range_; } | 621 Range* range() const { return range_; } |
622 bool HasRange() const { return range_ != NULL; } | 622 bool HasRange() const { return range_ != NULL; } |
623 void AddNewRange(Range* r); | 623 void AddNewRange(Range* r); |
624 void RemoveLastAddedRange(); | 624 void RemoveLastAddedRange(); |
625 void ComputeInitialRange(); | 625 void ComputeInitialRange(); |
626 | 626 |
627 // Representation helpers. | 627 // Representation helpers. |
628 virtual Representation RequiredInputRepresentation(int index) const = 0; | 628 virtual Representation RequiredInputRepresentation(int index) = 0; |
629 | 629 |
630 virtual Representation InferredRepresentation() { | 630 virtual Representation InferredRepresentation() { |
631 return representation(); | 631 return representation(); |
632 } | 632 } |
633 | 633 |
634 // This gives the instruction an opportunity to replace itself with an | 634 // This gives the instruction an opportunity to replace itself with an |
635 // instruction that does the same in some better way. To replace an | 635 // instruction that does the same in some better way. To replace an |
636 // instruction with a new one, first add the new instruction to the graph, | 636 // instruction with a new one, first add the new instruction to the graph, |
637 // then return it. Return NULL to have the instruction deleted. | 637 // then return it. Return NULL to have the instruction deleted. |
638 virtual HValue* Canonicalize() { return this; } | 638 virtual HValue* Canonicalize() { return this; } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; } | 834 void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; } |
835 | 835 |
836 private: | 836 private: |
837 EmbeddedContainer<HBasicBlock*, S> successors_; | 837 EmbeddedContainer<HBasicBlock*, S> successors_; |
838 EmbeddedContainer<HValue*, V> inputs_; | 838 EmbeddedContainer<HValue*, V> inputs_; |
839 }; | 839 }; |
840 | 840 |
841 | 841 |
842 class HBlockEntry: public HTemplateInstruction<0> { | 842 class HBlockEntry: public HTemplateInstruction<0> { |
843 public: | 843 public: |
844 virtual Representation RequiredInputRepresentation(int index) const { | 844 virtual Representation RequiredInputRepresentation(int index) { |
845 return Representation::None(); | 845 return Representation::None(); |
846 } | 846 } |
847 | 847 |
848 DECLARE_CONCRETE_INSTRUCTION(BlockEntry) | 848 DECLARE_CONCRETE_INSTRUCTION(BlockEntry) |
849 }; | 849 }; |
850 | 850 |
851 | 851 |
852 // We insert soft-deoptimize when we hit code with unknown typefeedback, | 852 // We insert soft-deoptimize when we hit code with unknown typefeedback, |
853 // so that we get a chance of re-optimizing with useful typefeedback. | 853 // so that we get a chance of re-optimizing with useful typefeedback. |
854 // HSoftDeoptimize does not end a basic block as opposed to HDeoptimize. | 854 // HSoftDeoptimize does not end a basic block as opposed to HDeoptimize. |
855 class HSoftDeoptimize: public HTemplateInstruction<0> { | 855 class HSoftDeoptimize: public HTemplateInstruction<0> { |
856 public: | 856 public: |
857 virtual Representation RequiredInputRepresentation(int index) const { | 857 virtual Representation RequiredInputRepresentation(int index) { |
858 return Representation::None(); | 858 return Representation::None(); |
859 } | 859 } |
860 | 860 |
861 DECLARE_CONCRETE_INSTRUCTION(SoftDeoptimize) | 861 DECLARE_CONCRETE_INSTRUCTION(SoftDeoptimize) |
862 }; | 862 }; |
863 | 863 |
864 | 864 |
865 class HDeoptimize: public HControlInstruction { | 865 class HDeoptimize: public HControlInstruction { |
866 public: | 866 public: |
867 explicit HDeoptimize(int environment_length) : values_(environment_length) { } | 867 explicit HDeoptimize(int environment_length) : values_(environment_length) { } |
868 | 868 |
869 virtual Representation RequiredInputRepresentation(int index) const { | 869 virtual Representation RequiredInputRepresentation(int index) { |
870 return Representation::None(); | 870 return Representation::None(); |
871 } | 871 } |
872 | 872 |
873 virtual int OperandCount() { return values_.length(); } | 873 virtual int OperandCount() { return values_.length(); } |
874 virtual HValue* OperandAt(int index) { return values_[index]; } | 874 virtual HValue* OperandAt(int index) { return values_[index]; } |
875 virtual void PrintDataTo(StringStream* stream); | 875 virtual void PrintDataTo(StringStream* stream); |
876 | 876 |
877 virtual int SuccessorCount() { return 0; } | 877 virtual int SuccessorCount() { return 0; } |
878 virtual HBasicBlock* SuccessorAt(int i) { | 878 virtual HBasicBlock* SuccessorAt(int i) { |
879 UNREACHABLE(); | 879 UNREACHABLE(); |
(...skipping 21 matching lines...) Expand all Loading... |
901 } | 901 } |
902 | 902 |
903 private: | 903 private: |
904 ZoneList<HValue*> values_; | 904 ZoneList<HValue*> values_; |
905 }; | 905 }; |
906 | 906 |
907 | 907 |
908 class HGoto: public HTemplateControlInstruction<1, 0> { | 908 class HGoto: public HTemplateControlInstruction<1, 0> { |
909 public: | 909 public: |
910 explicit HGoto(HBasicBlock* target) { | 910 explicit HGoto(HBasicBlock* target) { |
911 SetSuccessorAt(0, target); | 911 SetSuccessorAt(0, target); |
912 } | 912 } |
913 | 913 |
914 virtual Representation RequiredInputRepresentation(int index) const { | 914 virtual Representation RequiredInputRepresentation(int index) { |
915 return Representation::None(); | 915 return Representation::None(); |
916 } | 916 } |
917 | 917 |
918 virtual void PrintDataTo(StringStream* stream); | 918 virtual void PrintDataTo(StringStream* stream); |
919 | 919 |
920 DECLARE_CONCRETE_INSTRUCTION(Goto) | 920 DECLARE_CONCRETE_INSTRUCTION(Goto) |
921 }; | 921 }; |
922 | 922 |
923 | 923 |
924 class HUnaryControlInstruction: public HTemplateControlInstruction<2, 1> { | 924 class HUnaryControlInstruction: public HTemplateControlInstruction<2, 1> { |
(...skipping 19 matching lines...) Expand all Loading... |
944 HBasicBlock* false_target, | 944 HBasicBlock* false_target, |
945 ToBooleanStub::Types expected_input_types = ToBooleanStub::no_types()) | 945 ToBooleanStub::Types expected_input_types = ToBooleanStub::no_types()) |
946 : HUnaryControlInstruction(value, true_target, false_target), | 946 : HUnaryControlInstruction(value, true_target, false_target), |
947 expected_input_types_(expected_input_types) { | 947 expected_input_types_(expected_input_types) { |
948 ASSERT(true_target != NULL && false_target != NULL); | 948 ASSERT(true_target != NULL && false_target != NULL); |
949 } | 949 } |
950 explicit HBranch(HValue* value) | 950 explicit HBranch(HValue* value) |
951 : HUnaryControlInstruction(value, NULL, NULL) { } | 951 : HUnaryControlInstruction(value, NULL, NULL) { } |
952 | 952 |
953 | 953 |
954 virtual Representation RequiredInputRepresentation(int index) const { | 954 virtual Representation RequiredInputRepresentation(int index) { |
955 return Representation::None(); | 955 return Representation::None(); |
956 } | 956 } |
957 | 957 |
958 ToBooleanStub::Types expected_input_types() const { | 958 ToBooleanStub::Types expected_input_types() const { |
959 return expected_input_types_; | 959 return expected_input_types_; |
960 } | 960 } |
961 | 961 |
962 DECLARE_CONCRETE_INSTRUCTION(Branch) | 962 DECLARE_CONCRETE_INSTRUCTION(Branch) |
963 | 963 |
964 private: | 964 private: |
(...skipping 11 matching lines...) Expand all Loading... |
976 map_(map) { | 976 map_(map) { |
977 ASSERT(true_target != NULL); | 977 ASSERT(true_target != NULL); |
978 ASSERT(false_target != NULL); | 978 ASSERT(false_target != NULL); |
979 ASSERT(!map.is_null()); | 979 ASSERT(!map.is_null()); |
980 } | 980 } |
981 | 981 |
982 virtual void PrintDataTo(StringStream* stream); | 982 virtual void PrintDataTo(StringStream* stream); |
983 | 983 |
984 Handle<Map> map() const { return map_; } | 984 Handle<Map> map() const { return map_; } |
985 | 985 |
986 virtual Representation RequiredInputRepresentation(int index) const { | 986 virtual Representation RequiredInputRepresentation(int index) { |
987 return Representation::Tagged(); | 987 return Representation::Tagged(); |
988 } | 988 } |
989 | 989 |
990 DECLARE_CONCRETE_INSTRUCTION(CompareMap) | 990 DECLARE_CONCRETE_INSTRUCTION(CompareMap) |
991 | 991 |
992 private: | 992 private: |
993 Handle<Map> map_; | 993 Handle<Map> map_; |
994 }; | 994 }; |
995 | 995 |
996 | 996 |
997 class HReturn: public HTemplateControlInstruction<0, 1> { | 997 class HReturn: public HTemplateControlInstruction<0, 1> { |
998 public: | 998 public: |
999 explicit HReturn(HValue* value) { | 999 explicit HReturn(HValue* value) { |
1000 SetOperandAt(0, value); | 1000 SetOperandAt(0, value); |
1001 } | 1001 } |
1002 | 1002 |
1003 virtual Representation RequiredInputRepresentation(int index) const { | 1003 virtual Representation RequiredInputRepresentation(int index) { |
1004 return Representation::Tagged(); | 1004 return Representation::Tagged(); |
1005 } | 1005 } |
1006 | 1006 |
1007 virtual void PrintDataTo(StringStream* stream); | 1007 virtual void PrintDataTo(StringStream* stream); |
1008 | 1008 |
1009 HValue* value() { return OperandAt(0); } | 1009 HValue* value() { return OperandAt(0); } |
1010 | 1010 |
1011 DECLARE_CONCRETE_INSTRUCTION(Return) | 1011 DECLARE_CONCRETE_INSTRUCTION(Return) |
1012 }; | 1012 }; |
1013 | 1013 |
1014 | 1014 |
1015 class HAbnormalExit: public HTemplateControlInstruction<0, 0> { | 1015 class HAbnormalExit: public HTemplateControlInstruction<0, 0> { |
1016 public: | 1016 public: |
1017 virtual Representation RequiredInputRepresentation(int index) const { | 1017 virtual Representation RequiredInputRepresentation(int index) { |
1018 return Representation::None(); | 1018 return Representation::None(); |
1019 } | 1019 } |
1020 | 1020 |
1021 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit) | 1021 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit) |
1022 }; | 1022 }; |
1023 | 1023 |
1024 | 1024 |
1025 class HUnaryOperation: public HTemplateInstruction<1> { | 1025 class HUnaryOperation: public HTemplateInstruction<1> { |
1026 public: | 1026 public: |
1027 explicit HUnaryOperation(HValue* value) { | 1027 explicit HUnaryOperation(HValue* value) { |
(...skipping 14 matching lines...) Expand all Loading... |
1042 | 1042 |
1043 | 1043 |
1044 class HThrow: public HTemplateInstruction<2> { | 1044 class HThrow: public HTemplateInstruction<2> { |
1045 public: | 1045 public: |
1046 HThrow(HValue* context, HValue* value) { | 1046 HThrow(HValue* context, HValue* value) { |
1047 SetOperandAt(0, context); | 1047 SetOperandAt(0, context); |
1048 SetOperandAt(1, value); | 1048 SetOperandAt(1, value); |
1049 SetAllSideEffects(); | 1049 SetAllSideEffects(); |
1050 } | 1050 } |
1051 | 1051 |
1052 virtual Representation RequiredInputRepresentation(int index) const { | 1052 virtual Representation RequiredInputRepresentation(int index) { |
1053 return Representation::Tagged(); | 1053 return Representation::Tagged(); |
1054 } | 1054 } |
1055 | 1055 |
1056 HValue* context() { return OperandAt(0); } | 1056 HValue* context() { return OperandAt(0); } |
1057 HValue* value() { return OperandAt(1); } | 1057 HValue* value() { return OperandAt(1); } |
1058 | 1058 |
1059 DECLARE_CONCRETE_INSTRUCTION(Throw) | 1059 DECLARE_CONCRETE_INSTRUCTION(Throw) |
1060 }; | 1060 }; |
1061 | 1061 |
1062 | 1062 |
1063 class HUseConst: public HUnaryOperation { | 1063 class HUseConst: public HUnaryOperation { |
1064 public: | 1064 public: |
1065 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { } | 1065 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { } |
1066 | 1066 |
1067 virtual Representation RequiredInputRepresentation(int index) const { | 1067 virtual Representation RequiredInputRepresentation(int index) { |
1068 return Representation::None(); | 1068 return Representation::None(); |
1069 } | 1069 } |
1070 | 1070 |
1071 DECLARE_CONCRETE_INSTRUCTION(UseConst) | 1071 DECLARE_CONCRETE_INSTRUCTION(UseConst) |
1072 }; | 1072 }; |
1073 | 1073 |
1074 | 1074 |
1075 class HForceRepresentation: public HTemplateInstruction<1> { | 1075 class HForceRepresentation: public HTemplateInstruction<1> { |
1076 public: | 1076 public: |
1077 HForceRepresentation(HValue* value, Representation required_representation) { | 1077 HForceRepresentation(HValue* value, Representation required_representation) { |
1078 SetOperandAt(0, value); | 1078 SetOperandAt(0, value); |
1079 set_representation(required_representation); | 1079 set_representation(required_representation); |
1080 } | 1080 } |
1081 | 1081 |
1082 HValue* value() { return OperandAt(0); } | 1082 HValue* value() { return OperandAt(0); } |
1083 | 1083 |
1084 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 1084 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
1085 | 1085 |
1086 virtual Representation RequiredInputRepresentation(int index) const { | 1086 virtual Representation RequiredInputRepresentation(int index) { |
1087 return representation(); // Same as the output representation. | 1087 return representation(); // Same as the output representation. |
1088 } | 1088 } |
1089 | 1089 |
1090 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) | 1090 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) |
1091 }; | 1091 }; |
1092 | 1092 |
1093 | 1093 |
1094 class HChange: public HUnaryOperation { | 1094 class HChange: public HUnaryOperation { |
1095 public: | 1095 public: |
1096 HChange(HValue* value, | 1096 HChange(HValue* value, |
1097 Representation from, | |
1098 Representation to, | 1097 Representation to, |
1099 bool is_truncating, | 1098 bool is_truncating, |
1100 bool deoptimize_on_undefined) | 1099 bool deoptimize_on_undefined) |
1101 : HUnaryOperation(value), | 1100 : HUnaryOperation(value) { |
1102 from_(from), | 1101 ASSERT(!value->representation().IsNone() && !to.IsNone()); |
1103 deoptimize_on_undefined_(deoptimize_on_undefined) { | 1102 ASSERT(!value->representation().Equals(to)); |
1104 ASSERT(!from.IsNone() && !to.IsNone()); | |
1105 ASSERT(!from.Equals(to)); | |
1106 set_representation(to); | 1103 set_representation(to); |
1107 SetFlag(kUseGVN); | 1104 SetFlag(kUseGVN); |
| 1105 if (deoptimize_on_undefined) SetFlag(kDeoptimizeOnUndefined); |
1108 if (is_truncating) SetFlag(kTruncatingToInt32); | 1106 if (is_truncating) SetFlag(kTruncatingToInt32); |
1109 } | 1107 } |
1110 | 1108 |
1111 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 1109 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
1112 | 1110 |
1113 Representation from() const { return from_; } | 1111 Representation from() { return value()->representation(); } |
1114 Representation to() const { return representation(); } | 1112 Representation to() { return representation(); } |
1115 bool deoptimize_on_undefined() const { return deoptimize_on_undefined_; } | 1113 bool deoptimize_on_undefined() const { |
1116 virtual Representation RequiredInputRepresentation(int index) const { | 1114 return CheckFlag(kDeoptimizeOnUndefined); |
1117 return from_; | 1115 } |
| 1116 virtual Representation RequiredInputRepresentation(int index) { |
| 1117 return from(); |
1118 } | 1118 } |
1119 | 1119 |
1120 virtual Range* InferRange(); | 1120 virtual Range* InferRange(); |
1121 | 1121 |
1122 virtual void PrintDataTo(StringStream* stream); | 1122 virtual void PrintDataTo(StringStream* stream); |
1123 | 1123 |
1124 DECLARE_CONCRETE_INSTRUCTION(Change) | 1124 DECLARE_CONCRETE_INSTRUCTION(Change) |
1125 | 1125 |
1126 protected: | 1126 protected: |
1127 virtual bool DataEquals(HValue* other) { | 1127 virtual bool DataEquals(HValue* other) { return true; } |
1128 if (!other->IsChange()) return false; | |
1129 HChange* change = HChange::cast(other); | |
1130 return to().Equals(change->to()) | |
1131 && deoptimize_on_undefined() == change->deoptimize_on_undefined(); | |
1132 } | |
1133 | |
1134 private: | |
1135 Representation from_; | |
1136 bool deoptimize_on_undefined_; | |
1137 }; | 1128 }; |
1138 | 1129 |
1139 | 1130 |
1140 class HClampToUint8: public HUnaryOperation { | 1131 class HClampToUint8: public HUnaryOperation { |
1141 public: | 1132 public: |
1142 explicit HClampToUint8(HValue* value) | 1133 explicit HClampToUint8(HValue* value) |
1143 : HUnaryOperation(value) { | 1134 : HUnaryOperation(value) { |
1144 set_representation(Representation::Integer32()); | 1135 set_representation(Representation::Integer32()); |
1145 SetFlag(kUseGVN); | 1136 SetFlag(kUseGVN); |
1146 } | 1137 } |
1147 | 1138 |
1148 virtual Representation RequiredInputRepresentation(int index) const { | 1139 virtual Representation RequiredInputRepresentation(int index) { |
1149 return Representation::None(); | 1140 return Representation::None(); |
1150 } | 1141 } |
1151 | 1142 |
1152 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) | 1143 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) |
1153 | 1144 |
1154 protected: | 1145 protected: |
1155 virtual bool DataEquals(HValue* other) { return true; } | 1146 virtual bool DataEquals(HValue* other) { return true; } |
1156 }; | 1147 }; |
1157 | 1148 |
1158 | 1149 |
1159 class HToInt32: public HUnaryOperation { | 1150 class HToInt32: public HUnaryOperation { |
1160 public: | 1151 public: |
1161 explicit HToInt32(HValue* value) | 1152 explicit HToInt32(HValue* value) |
1162 : HUnaryOperation(value) { | 1153 : HUnaryOperation(value) { |
1163 set_representation(Representation::Integer32()); | 1154 set_representation(Representation::Integer32()); |
1164 SetFlag(kUseGVN); | 1155 SetFlag(kUseGVN); |
1165 } | 1156 } |
1166 | 1157 |
1167 virtual Representation RequiredInputRepresentation(int index) const { | 1158 virtual Representation RequiredInputRepresentation(int index) { |
1168 return Representation::None(); | 1159 return Representation::None(); |
1169 } | 1160 } |
1170 | 1161 |
1171 virtual bool CanTruncateToInt32() const { | 1162 virtual bool CanTruncateToInt32() const { |
1172 return true; | 1163 return true; |
1173 } | 1164 } |
1174 | 1165 |
1175 virtual HValue* Canonicalize() { | 1166 virtual HValue* Canonicalize() { |
1176 if (value()->representation().IsInteger32()) { | 1167 if (value()->representation().IsInteger32()) { |
1177 return value(); | 1168 return value(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 } | 1207 } |
1217 void AddAssignedValue(int index, HValue* value) { | 1208 void AddAssignedValue(int index, HValue* value) { |
1218 AddValue(index, value); | 1209 AddValue(index, value); |
1219 } | 1210 } |
1220 void AddPushedValue(HValue* value) { | 1211 void AddPushedValue(HValue* value) { |
1221 AddValue(kNoIndex, value); | 1212 AddValue(kNoIndex, value); |
1222 } | 1213 } |
1223 virtual int OperandCount() { return values_.length(); } | 1214 virtual int OperandCount() { return values_.length(); } |
1224 virtual HValue* OperandAt(int index) { return values_[index]; } | 1215 virtual HValue* OperandAt(int index) { return values_[index]; } |
1225 | 1216 |
1226 virtual Representation RequiredInputRepresentation(int index) const { | 1217 virtual Representation RequiredInputRepresentation(int index) { |
1227 return Representation::None(); | 1218 return Representation::None(); |
1228 } | 1219 } |
1229 | 1220 |
1230 DECLARE_CONCRETE_INSTRUCTION(Simulate) | 1221 DECLARE_CONCRETE_INSTRUCTION(Simulate) |
1231 | 1222 |
1232 #ifdef DEBUG | 1223 #ifdef DEBUG |
1233 virtual void Verify(); | 1224 virtual void Verify(); |
1234 #endif | 1225 #endif |
1235 | 1226 |
1236 protected: | 1227 protected: |
(...skipping 24 matching lines...) Expand all Loading... |
1261 kFunctionEntry, | 1252 kFunctionEntry, |
1262 kBackwardsBranch | 1253 kBackwardsBranch |
1263 }; | 1254 }; |
1264 | 1255 |
1265 HStackCheck(HValue* context, Type type) : type_(type) { | 1256 HStackCheck(HValue* context, Type type) : type_(type) { |
1266 SetOperandAt(0, context); | 1257 SetOperandAt(0, context); |
1267 } | 1258 } |
1268 | 1259 |
1269 HValue* context() { return OperandAt(0); } | 1260 HValue* context() { return OperandAt(0); } |
1270 | 1261 |
1271 virtual Representation RequiredInputRepresentation(int index) const { | 1262 virtual Representation RequiredInputRepresentation(int index) { |
1272 return Representation::Tagged(); | 1263 return Representation::Tagged(); |
1273 } | 1264 } |
1274 | 1265 |
1275 void Eliminate() { | 1266 void Eliminate() { |
1276 // The stack check eliminator might try to eliminate the same stack | 1267 // The stack check eliminator might try to eliminate the same stack |
1277 // check instruction multiple times. | 1268 // check instruction multiple times. |
1278 if (IsLinked()) { | 1269 if (IsLinked()) { |
1279 DeleteFromGraph(); | 1270 DeleteFromGraph(); |
1280 } | 1271 } |
1281 } | 1272 } |
(...skipping 17 matching lines...) Expand all Loading... |
1299 function_(function), | 1290 function_(function), |
1300 call_kind_(call_kind) { | 1291 call_kind_(call_kind) { |
1301 } | 1292 } |
1302 | 1293 |
1303 virtual void PrintDataTo(StringStream* stream); | 1294 virtual void PrintDataTo(StringStream* stream); |
1304 | 1295 |
1305 Handle<JSFunction> closure() const { return closure_; } | 1296 Handle<JSFunction> closure() const { return closure_; } |
1306 FunctionLiteral* function() const { return function_; } | 1297 FunctionLiteral* function() const { return function_; } |
1307 CallKind call_kind() const { return call_kind_; } | 1298 CallKind call_kind() const { return call_kind_; } |
1308 | 1299 |
1309 virtual Representation RequiredInputRepresentation(int index) const { | 1300 virtual Representation RequiredInputRepresentation(int index) { |
1310 return Representation::None(); | 1301 return Representation::None(); |
1311 } | 1302 } |
1312 | 1303 |
1313 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) | 1304 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) |
1314 | 1305 |
1315 private: | 1306 private: |
1316 Handle<JSFunction> closure_; | 1307 Handle<JSFunction> closure_; |
1317 FunctionLiteral* function_; | 1308 FunctionLiteral* function_; |
1318 CallKind call_kind_; | 1309 CallKind call_kind_; |
1319 }; | 1310 }; |
1320 | 1311 |
1321 | 1312 |
1322 class HLeaveInlined: public HTemplateInstruction<0> { | 1313 class HLeaveInlined: public HTemplateInstruction<0> { |
1323 public: | 1314 public: |
1324 HLeaveInlined() {} | 1315 HLeaveInlined() {} |
1325 | 1316 |
1326 virtual Representation RequiredInputRepresentation(int index) const { | 1317 virtual Representation RequiredInputRepresentation(int index) { |
1327 return Representation::None(); | 1318 return Representation::None(); |
1328 } | 1319 } |
1329 | 1320 |
1330 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined) | 1321 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined) |
1331 }; | 1322 }; |
1332 | 1323 |
1333 | 1324 |
1334 class HPushArgument: public HUnaryOperation { | 1325 class HPushArgument: public HUnaryOperation { |
1335 public: | 1326 public: |
1336 explicit HPushArgument(HValue* value) : HUnaryOperation(value) { | 1327 explicit HPushArgument(HValue* value) : HUnaryOperation(value) { |
1337 set_representation(Representation::Tagged()); | 1328 set_representation(Representation::Tagged()); |
1338 } | 1329 } |
1339 | 1330 |
1340 virtual Representation RequiredInputRepresentation(int index) const { | 1331 virtual Representation RequiredInputRepresentation(int index) { |
1341 return Representation::Tagged(); | 1332 return Representation::Tagged(); |
1342 } | 1333 } |
1343 | 1334 |
1344 HValue* argument() { return OperandAt(0); } | 1335 HValue* argument() { return OperandAt(0); } |
1345 | 1336 |
1346 DECLARE_CONCRETE_INSTRUCTION(PushArgument) | 1337 DECLARE_CONCRETE_INSTRUCTION(PushArgument) |
1347 }; | 1338 }; |
1348 | 1339 |
1349 | 1340 |
1350 class HThisFunction: public HTemplateInstruction<0> { | 1341 class HThisFunction: public HTemplateInstruction<0> { |
1351 public: | 1342 public: |
1352 HThisFunction() { | 1343 HThisFunction() { |
1353 set_representation(Representation::Tagged()); | 1344 set_representation(Representation::Tagged()); |
1354 SetFlag(kUseGVN); | 1345 SetFlag(kUseGVN); |
1355 } | 1346 } |
1356 | 1347 |
1357 virtual Representation RequiredInputRepresentation(int index) const { | 1348 virtual Representation RequiredInputRepresentation(int index) { |
1358 return Representation::None(); | 1349 return Representation::None(); |
1359 } | 1350 } |
1360 | 1351 |
1361 DECLARE_CONCRETE_INSTRUCTION(ThisFunction) | 1352 DECLARE_CONCRETE_INSTRUCTION(ThisFunction) |
1362 | 1353 |
1363 protected: | 1354 protected: |
1364 virtual bool DataEquals(HValue* other) { return true; } | 1355 virtual bool DataEquals(HValue* other) { return true; } |
1365 }; | 1356 }; |
1366 | 1357 |
1367 | 1358 |
1368 class HContext: public HTemplateInstruction<0> { | 1359 class HContext: public HTemplateInstruction<0> { |
1369 public: | 1360 public: |
1370 HContext() { | 1361 HContext() { |
1371 set_representation(Representation::Tagged()); | 1362 set_representation(Representation::Tagged()); |
1372 SetFlag(kUseGVN); | 1363 SetFlag(kUseGVN); |
1373 } | 1364 } |
1374 | 1365 |
1375 virtual Representation RequiredInputRepresentation(int index) const { | 1366 virtual Representation RequiredInputRepresentation(int index) { |
1376 return Representation::None(); | 1367 return Representation::None(); |
1377 } | 1368 } |
1378 | 1369 |
1379 DECLARE_CONCRETE_INSTRUCTION(Context) | 1370 DECLARE_CONCRETE_INSTRUCTION(Context) |
1380 | 1371 |
1381 protected: | 1372 protected: |
1382 virtual bool DataEquals(HValue* other) { return true; } | 1373 virtual bool DataEquals(HValue* other) { return true; } |
1383 }; | 1374 }; |
1384 | 1375 |
1385 | 1376 |
1386 class HOuterContext: public HUnaryOperation { | 1377 class HOuterContext: public HUnaryOperation { |
1387 public: | 1378 public: |
1388 explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) { | 1379 explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) { |
1389 set_representation(Representation::Tagged()); | 1380 set_representation(Representation::Tagged()); |
1390 SetFlag(kUseGVN); | 1381 SetFlag(kUseGVN); |
1391 } | 1382 } |
1392 | 1383 |
1393 DECLARE_CONCRETE_INSTRUCTION(OuterContext); | 1384 DECLARE_CONCRETE_INSTRUCTION(OuterContext); |
1394 | 1385 |
1395 virtual Representation RequiredInputRepresentation(int index) const { | 1386 virtual Representation RequiredInputRepresentation(int index) { |
1396 return Representation::Tagged(); | 1387 return Representation::Tagged(); |
1397 } | 1388 } |
1398 | 1389 |
1399 protected: | 1390 protected: |
1400 virtual bool DataEquals(HValue* other) { return true; } | 1391 virtual bool DataEquals(HValue* other) { return true; } |
1401 }; | 1392 }; |
1402 | 1393 |
1403 | 1394 |
1404 class HGlobalObject: public HUnaryOperation { | 1395 class HGlobalObject: public HUnaryOperation { |
1405 public: | 1396 public: |
1406 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) { | 1397 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) { |
1407 set_representation(Representation::Tagged()); | 1398 set_representation(Representation::Tagged()); |
1408 SetFlag(kUseGVN); | 1399 SetFlag(kUseGVN); |
1409 } | 1400 } |
1410 | 1401 |
1411 DECLARE_CONCRETE_INSTRUCTION(GlobalObject) | 1402 DECLARE_CONCRETE_INSTRUCTION(GlobalObject) |
1412 | 1403 |
1413 virtual Representation RequiredInputRepresentation(int index) const { | 1404 virtual Representation RequiredInputRepresentation(int index) { |
1414 return Representation::Tagged(); | 1405 return Representation::Tagged(); |
1415 } | 1406 } |
1416 | 1407 |
1417 protected: | 1408 protected: |
1418 virtual bool DataEquals(HValue* other) { return true; } | 1409 virtual bool DataEquals(HValue* other) { return true; } |
1419 }; | 1410 }; |
1420 | 1411 |
1421 | 1412 |
1422 class HGlobalReceiver: public HUnaryOperation { | 1413 class HGlobalReceiver: public HUnaryOperation { |
1423 public: | 1414 public: |
1424 explicit HGlobalReceiver(HValue* global_object) | 1415 explicit HGlobalReceiver(HValue* global_object) |
1425 : HUnaryOperation(global_object) { | 1416 : HUnaryOperation(global_object) { |
1426 set_representation(Representation::Tagged()); | 1417 set_representation(Representation::Tagged()); |
1427 SetFlag(kUseGVN); | 1418 SetFlag(kUseGVN); |
1428 } | 1419 } |
1429 | 1420 |
1430 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver) | 1421 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver) |
1431 | 1422 |
1432 virtual Representation RequiredInputRepresentation(int index) const { | 1423 virtual Representation RequiredInputRepresentation(int index) { |
1433 return Representation::Tagged(); | 1424 return Representation::Tagged(); |
1434 } | 1425 } |
1435 | 1426 |
1436 protected: | 1427 protected: |
1437 virtual bool DataEquals(HValue* other) { return true; } | 1428 virtual bool DataEquals(HValue* other) { return true; } |
1438 }; | 1429 }; |
1439 | 1430 |
1440 | 1431 |
1441 template <int V> | 1432 template <int V> |
1442 class HCall: public HTemplateInstruction<V> { | 1433 class HCall: public HTemplateInstruction<V> { |
(...skipping 15 matching lines...) Expand all Loading... |
1458 }; | 1449 }; |
1459 | 1450 |
1460 | 1451 |
1461 class HUnaryCall: public HCall<1> { | 1452 class HUnaryCall: public HCall<1> { |
1462 public: | 1453 public: |
1463 HUnaryCall(HValue* value, int argument_count) | 1454 HUnaryCall(HValue* value, int argument_count) |
1464 : HCall<1>(argument_count) { | 1455 : HCall<1>(argument_count) { |
1465 SetOperandAt(0, value); | 1456 SetOperandAt(0, value); |
1466 } | 1457 } |
1467 | 1458 |
1468 virtual Representation RequiredInputRepresentation(int index) const { | 1459 virtual Representation RequiredInputRepresentation(int index) { |
1469 return Representation::Tagged(); | 1460 return Representation::Tagged(); |
1470 } | 1461 } |
1471 | 1462 |
1472 virtual void PrintDataTo(StringStream* stream); | 1463 virtual void PrintDataTo(StringStream* stream); |
1473 | 1464 |
1474 HValue* value() { return OperandAt(0); } | 1465 HValue* value() { return OperandAt(0); } |
1475 }; | 1466 }; |
1476 | 1467 |
1477 | 1468 |
1478 class HBinaryCall: public HCall<2> { | 1469 class HBinaryCall: public HCall<2> { |
1479 public: | 1470 public: |
1480 HBinaryCall(HValue* first, HValue* second, int argument_count) | 1471 HBinaryCall(HValue* first, HValue* second, int argument_count) |
1481 : HCall<2>(argument_count) { | 1472 : HCall<2>(argument_count) { |
1482 SetOperandAt(0, first); | 1473 SetOperandAt(0, first); |
1483 SetOperandAt(1, second); | 1474 SetOperandAt(1, second); |
1484 } | 1475 } |
1485 | 1476 |
1486 virtual void PrintDataTo(StringStream* stream); | 1477 virtual void PrintDataTo(StringStream* stream); |
1487 | 1478 |
1488 virtual Representation RequiredInputRepresentation(int index) const { | 1479 virtual Representation RequiredInputRepresentation(int index) { |
1489 return Representation::Tagged(); | 1480 return Representation::Tagged(); |
1490 } | 1481 } |
1491 | 1482 |
1492 HValue* first() { return OperandAt(0); } | 1483 HValue* first() { return OperandAt(0); } |
1493 HValue* second() { return OperandAt(1); } | 1484 HValue* second() { return OperandAt(1); } |
1494 }; | 1485 }; |
1495 | 1486 |
1496 | 1487 |
1497 class HInvokeFunction: public HBinaryCall { | 1488 class HInvokeFunction: public HBinaryCall { |
1498 public: | 1489 public: |
1499 HInvokeFunction(HValue* context, HValue* function, int argument_count) | 1490 HInvokeFunction(HValue* context, HValue* function, int argument_count) |
1500 : HBinaryCall(context, function, argument_count) { | 1491 : HBinaryCall(context, function, argument_count) { |
1501 } | 1492 } |
1502 | 1493 |
1503 virtual Representation RequiredInputRepresentation(int index) const { | 1494 virtual Representation RequiredInputRepresentation(int index) { |
1504 return Representation::Tagged(); | 1495 return Representation::Tagged(); |
1505 } | 1496 } |
1506 | 1497 |
1507 HValue* context() { return first(); } | 1498 HValue* context() { return first(); } |
1508 HValue* function() { return second(); } | 1499 HValue* function() { return second(); } |
1509 | 1500 |
1510 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) | 1501 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) |
1511 }; | 1502 }; |
1512 | 1503 |
1513 | 1504 |
1514 class HCallConstantFunction: public HCall<0> { | 1505 class HCallConstantFunction: public HCall<0> { |
1515 public: | 1506 public: |
1516 HCallConstantFunction(Handle<JSFunction> function, int argument_count) | 1507 HCallConstantFunction(Handle<JSFunction> function, int argument_count) |
1517 : HCall<0>(argument_count), function_(function) { } | 1508 : HCall<0>(argument_count), function_(function) { } |
1518 | 1509 |
1519 Handle<JSFunction> function() const { return function_; } | 1510 Handle<JSFunction> function() const { return function_; } |
1520 | 1511 |
1521 bool IsApplyFunction() const { | 1512 bool IsApplyFunction() const { |
1522 return function_->code() == | 1513 return function_->code() == |
1523 Isolate::Current()->builtins()->builtin(Builtins::kFunctionApply); | 1514 Isolate::Current()->builtins()->builtin(Builtins::kFunctionApply); |
1524 } | 1515 } |
1525 | 1516 |
1526 virtual void PrintDataTo(StringStream* stream); | 1517 virtual void PrintDataTo(StringStream* stream); |
1527 | 1518 |
1528 virtual Representation RequiredInputRepresentation(int index) const { | 1519 virtual Representation RequiredInputRepresentation(int index) { |
1529 return Representation::None(); | 1520 return Representation::None(); |
1530 } | 1521 } |
1531 | 1522 |
1532 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction) | 1523 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction) |
1533 | 1524 |
1534 private: | 1525 private: |
1535 Handle<JSFunction> function_; | 1526 Handle<JSFunction> function_; |
1536 }; | 1527 }; |
1537 | 1528 |
1538 | 1529 |
1539 class HCallKeyed: public HBinaryCall { | 1530 class HCallKeyed: public HBinaryCall { |
1540 public: | 1531 public: |
1541 HCallKeyed(HValue* context, HValue* key, int argument_count) | 1532 HCallKeyed(HValue* context, HValue* key, int argument_count) |
1542 : HBinaryCall(context, key, argument_count) { | 1533 : HBinaryCall(context, key, argument_count) { |
1543 } | 1534 } |
1544 | 1535 |
1545 virtual Representation RequiredInputRepresentation(int index) const { | 1536 virtual Representation RequiredInputRepresentation(int index) { |
1546 return Representation::Tagged(); | 1537 return Representation::Tagged(); |
1547 } | 1538 } |
1548 | 1539 |
1549 HValue* context() { return first(); } | 1540 HValue* context() { return first(); } |
1550 HValue* key() { return second(); } | 1541 HValue* key() { return second(); } |
1551 | 1542 |
1552 DECLARE_CONCRETE_INSTRUCTION(CallKeyed) | 1543 DECLARE_CONCRETE_INSTRUCTION(CallKeyed) |
1553 }; | 1544 }; |
1554 | 1545 |
1555 | 1546 |
1556 class HCallNamed: public HUnaryCall { | 1547 class HCallNamed: public HUnaryCall { |
1557 public: | 1548 public: |
1558 HCallNamed(HValue* context, Handle<String> name, int argument_count) | 1549 HCallNamed(HValue* context, Handle<String> name, int argument_count) |
1559 : HUnaryCall(context, argument_count), name_(name) { | 1550 : HUnaryCall(context, argument_count), name_(name) { |
1560 } | 1551 } |
1561 | 1552 |
1562 virtual void PrintDataTo(StringStream* stream); | 1553 virtual void PrintDataTo(StringStream* stream); |
1563 | 1554 |
1564 HValue* context() { return value(); } | 1555 HValue* context() { return value(); } |
1565 Handle<String> name() const { return name_; } | 1556 Handle<String> name() const { return name_; } |
1566 | 1557 |
1567 DECLARE_CONCRETE_INSTRUCTION(CallNamed) | 1558 DECLARE_CONCRETE_INSTRUCTION(CallNamed) |
1568 | 1559 |
1569 virtual Representation RequiredInputRepresentation(int index) const { | 1560 virtual Representation RequiredInputRepresentation(int index) { |
1570 return Representation::Tagged(); | 1561 return Representation::Tagged(); |
1571 } | 1562 } |
1572 | 1563 |
1573 private: | 1564 private: |
1574 Handle<String> name_; | 1565 Handle<String> name_; |
1575 }; | 1566 }; |
1576 | 1567 |
1577 | 1568 |
1578 class HCallFunction: public HUnaryCall { | 1569 class HCallFunction: public HUnaryCall { |
1579 public: | 1570 public: |
1580 HCallFunction(HValue* context, int argument_count) | 1571 HCallFunction(HValue* context, int argument_count) |
1581 : HUnaryCall(context, argument_count) { | 1572 : HUnaryCall(context, argument_count) { |
1582 } | 1573 } |
1583 | 1574 |
1584 HValue* context() { return value(); } | 1575 HValue* context() { return value(); } |
1585 | 1576 |
1586 virtual Representation RequiredInputRepresentation(int index) const { | 1577 virtual Representation RequiredInputRepresentation(int index) { |
1587 return Representation::Tagged(); | 1578 return Representation::Tagged(); |
1588 } | 1579 } |
1589 | 1580 |
1590 DECLARE_CONCRETE_INSTRUCTION(CallFunction) | 1581 DECLARE_CONCRETE_INSTRUCTION(CallFunction) |
1591 }; | 1582 }; |
1592 | 1583 |
1593 | 1584 |
1594 class HCallGlobal: public HUnaryCall { | 1585 class HCallGlobal: public HUnaryCall { |
1595 public: | 1586 public: |
1596 HCallGlobal(HValue* context, Handle<String> name, int argument_count) | 1587 HCallGlobal(HValue* context, Handle<String> name, int argument_count) |
1597 : HUnaryCall(context, argument_count), name_(name) { | 1588 : HUnaryCall(context, argument_count), name_(name) { |
1598 } | 1589 } |
1599 | 1590 |
1600 virtual void PrintDataTo(StringStream* stream); | 1591 virtual void PrintDataTo(StringStream* stream); |
1601 | 1592 |
1602 HValue* context() { return value(); } | 1593 HValue* context() { return value(); } |
1603 Handle<String> name() const { return name_; } | 1594 Handle<String> name() const { return name_; } |
1604 | 1595 |
1605 virtual Representation RequiredInputRepresentation(int index) const { | 1596 virtual Representation RequiredInputRepresentation(int index) { |
1606 return Representation::Tagged(); | 1597 return Representation::Tagged(); |
1607 } | 1598 } |
1608 | 1599 |
1609 DECLARE_CONCRETE_INSTRUCTION(CallGlobal) | 1600 DECLARE_CONCRETE_INSTRUCTION(CallGlobal) |
1610 | 1601 |
1611 private: | 1602 private: |
1612 Handle<String> name_; | 1603 Handle<String> name_; |
1613 }; | 1604 }; |
1614 | 1605 |
1615 | 1606 |
1616 class HCallKnownGlobal: public HCall<0> { | 1607 class HCallKnownGlobal: public HCall<0> { |
1617 public: | 1608 public: |
1618 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) | 1609 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) |
1619 : HCall<0>(argument_count), target_(target) { } | 1610 : HCall<0>(argument_count), target_(target) { } |
1620 | 1611 |
1621 virtual void PrintDataTo(StringStream* stream); | 1612 virtual void PrintDataTo(StringStream* stream); |
1622 | 1613 |
1623 Handle<JSFunction> target() const { return target_; } | 1614 Handle<JSFunction> target() const { return target_; } |
1624 | 1615 |
1625 virtual Representation RequiredInputRepresentation(int index) const { | 1616 virtual Representation RequiredInputRepresentation(int index) { |
1626 return Representation::None(); | 1617 return Representation::None(); |
1627 } | 1618 } |
1628 | 1619 |
1629 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal) | 1620 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal) |
1630 | 1621 |
1631 private: | 1622 private: |
1632 Handle<JSFunction> target_; | 1623 Handle<JSFunction> target_; |
1633 }; | 1624 }; |
1634 | 1625 |
1635 | 1626 |
1636 class HCallNew: public HBinaryCall { | 1627 class HCallNew: public HBinaryCall { |
1637 public: | 1628 public: |
1638 HCallNew(HValue* context, HValue* constructor, int argument_count) | 1629 HCallNew(HValue* context, HValue* constructor, int argument_count) |
1639 : HBinaryCall(context, constructor, argument_count) { | 1630 : HBinaryCall(context, constructor, argument_count) { |
1640 } | 1631 } |
1641 | 1632 |
1642 virtual Representation RequiredInputRepresentation(int index) const { | 1633 virtual Representation RequiredInputRepresentation(int index) { |
1643 return Representation::Tagged(); | 1634 return Representation::Tagged(); |
1644 } | 1635 } |
1645 | 1636 |
1646 HValue* context() { return first(); } | 1637 HValue* context() { return first(); } |
1647 HValue* constructor() { return second(); } | 1638 HValue* constructor() { return second(); } |
1648 | 1639 |
1649 DECLARE_CONCRETE_INSTRUCTION(CallNew) | 1640 DECLARE_CONCRETE_INSTRUCTION(CallNew) |
1650 }; | 1641 }; |
1651 | 1642 |
1652 | 1643 |
1653 class HCallRuntime: public HCall<1> { | 1644 class HCallRuntime: public HCall<1> { |
1654 public: | 1645 public: |
1655 HCallRuntime(HValue* context, | 1646 HCallRuntime(HValue* context, |
1656 Handle<String> name, | 1647 Handle<String> name, |
1657 const Runtime::Function* c_function, | 1648 const Runtime::Function* c_function, |
1658 int argument_count) | 1649 int argument_count) |
1659 : HCall<1>(argument_count), c_function_(c_function), name_(name) { | 1650 : HCall<1>(argument_count), c_function_(c_function), name_(name) { |
1660 SetOperandAt(0, context); | 1651 SetOperandAt(0, context); |
1661 } | 1652 } |
1662 | 1653 |
1663 virtual void PrintDataTo(StringStream* stream); | 1654 virtual void PrintDataTo(StringStream* stream); |
1664 | 1655 |
1665 HValue* context() { return OperandAt(0); } | 1656 HValue* context() { return OperandAt(0); } |
1666 const Runtime::Function* function() const { return c_function_; } | 1657 const Runtime::Function* function() const { return c_function_; } |
1667 Handle<String> name() const { return name_; } | 1658 Handle<String> name() const { return name_; } |
1668 | 1659 |
1669 virtual Representation RequiredInputRepresentation(int index) const { | 1660 virtual Representation RequiredInputRepresentation(int index) { |
1670 return Representation::Tagged(); | 1661 return Representation::Tagged(); |
1671 } | 1662 } |
1672 | 1663 |
1673 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) | 1664 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) |
1674 | 1665 |
1675 private: | 1666 private: |
1676 const Runtime::Function* c_function_; | 1667 const Runtime::Function* c_function_; |
1677 Handle<String> name_; | 1668 Handle<String> name_; |
1678 }; | 1669 }; |
1679 | 1670 |
1680 | 1671 |
1681 class HJSArrayLength: public HTemplateInstruction<2> { | 1672 class HJSArrayLength: public HTemplateInstruction<2> { |
1682 public: | 1673 public: |
1683 HJSArrayLength(HValue* value, HValue* typecheck) { | 1674 HJSArrayLength(HValue* value, HValue* typecheck) { |
1684 // The length of an array is stored as a tagged value in the array | 1675 // The length of an array is stored as a tagged value in the array |
1685 // object. It is guaranteed to be 32 bit integer, but it can be | 1676 // object. It is guaranteed to be 32 bit integer, but it can be |
1686 // represented as either a smi or heap number. | 1677 // represented as either a smi or heap number. |
1687 SetOperandAt(0, value); | 1678 SetOperandAt(0, value); |
1688 SetOperandAt(1, typecheck); | 1679 SetOperandAt(1, typecheck); |
1689 set_representation(Representation::Tagged()); | 1680 set_representation(Representation::Tagged()); |
1690 SetFlag(kUseGVN); | 1681 SetFlag(kUseGVN); |
1691 SetFlag(kDependsOnArrayLengths); | 1682 SetFlag(kDependsOnArrayLengths); |
1692 SetFlag(kDependsOnMaps); | 1683 SetFlag(kDependsOnMaps); |
1693 } | 1684 } |
1694 | 1685 |
1695 virtual Representation RequiredInputRepresentation(int index) const { | 1686 virtual Representation RequiredInputRepresentation(int index) { |
1696 return Representation::Tagged(); | 1687 return Representation::Tagged(); |
1697 } | 1688 } |
1698 | 1689 |
1699 virtual void PrintDataTo(StringStream* stream); | 1690 virtual void PrintDataTo(StringStream* stream); |
1700 | 1691 |
1701 HValue* value() { return OperandAt(0); } | 1692 HValue* value() { return OperandAt(0); } |
1702 HValue* typecheck() { return OperandAt(1); } | 1693 HValue* typecheck() { return OperandAt(1); } |
1703 | 1694 |
1704 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) | 1695 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) |
1705 | 1696 |
1706 protected: | 1697 protected: |
1707 virtual bool DataEquals(HValue* other) { return true; } | 1698 virtual bool DataEquals(HValue* other) { return true; } |
1708 }; | 1699 }; |
1709 | 1700 |
1710 | 1701 |
1711 class HFixedArrayBaseLength: public HUnaryOperation { | 1702 class HFixedArrayBaseLength: public HUnaryOperation { |
1712 public: | 1703 public: |
1713 explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) { | 1704 explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) { |
1714 set_representation(Representation::Tagged()); | 1705 set_representation(Representation::Tagged()); |
1715 SetFlag(kUseGVN); | 1706 SetFlag(kUseGVN); |
1716 SetFlag(kDependsOnArrayLengths); | 1707 SetFlag(kDependsOnArrayLengths); |
1717 } | 1708 } |
1718 | 1709 |
1719 virtual Representation RequiredInputRepresentation(int index) const { | 1710 virtual Representation RequiredInputRepresentation(int index) { |
1720 return Representation::Tagged(); | 1711 return Representation::Tagged(); |
1721 } | 1712 } |
1722 | 1713 |
1723 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength) | 1714 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength) |
1724 | 1715 |
1725 protected: | 1716 protected: |
1726 virtual bool DataEquals(HValue* other) { return true; } | 1717 virtual bool DataEquals(HValue* other) { return true; } |
1727 }; | 1718 }; |
1728 | 1719 |
1729 | 1720 |
1730 class HElementsKind: public HUnaryOperation { | 1721 class HElementsKind: public HUnaryOperation { |
1731 public: | 1722 public: |
1732 explicit HElementsKind(HValue* value) : HUnaryOperation(value) { | 1723 explicit HElementsKind(HValue* value) : HUnaryOperation(value) { |
1733 set_representation(Representation::Integer32()); | 1724 set_representation(Representation::Integer32()); |
1734 SetFlag(kUseGVN); | 1725 SetFlag(kUseGVN); |
1735 SetFlag(kDependsOnMaps); | 1726 SetFlag(kDependsOnMaps); |
1736 } | 1727 } |
1737 | 1728 |
1738 virtual Representation RequiredInputRepresentation(int index) const { | 1729 virtual Representation RequiredInputRepresentation(int index) { |
1739 return Representation::Tagged(); | 1730 return Representation::Tagged(); |
1740 } | 1731 } |
1741 | 1732 |
1742 DECLARE_CONCRETE_INSTRUCTION(ElementsKind) | 1733 DECLARE_CONCRETE_INSTRUCTION(ElementsKind) |
1743 | 1734 |
1744 protected: | 1735 protected: |
1745 virtual bool DataEquals(HValue* other) { return true; } | 1736 virtual bool DataEquals(HValue* other) { return true; } |
1746 }; | 1737 }; |
1747 | 1738 |
1748 | 1739 |
1749 class HBitNot: public HUnaryOperation { | 1740 class HBitNot: public HUnaryOperation { |
1750 public: | 1741 public: |
1751 explicit HBitNot(HValue* value) : HUnaryOperation(value) { | 1742 explicit HBitNot(HValue* value) : HUnaryOperation(value) { |
1752 set_representation(Representation::Integer32()); | 1743 set_representation(Representation::Integer32()); |
1753 SetFlag(kUseGVN); | 1744 SetFlag(kUseGVN); |
1754 SetFlag(kTruncatingToInt32); | 1745 SetFlag(kTruncatingToInt32); |
1755 } | 1746 } |
1756 | 1747 |
1757 virtual Representation RequiredInputRepresentation(int index) const { | 1748 virtual Representation RequiredInputRepresentation(int index) { |
1758 return Representation::Integer32(); | 1749 return Representation::Integer32(); |
1759 } | 1750 } |
1760 virtual HType CalculateInferredType(); | 1751 virtual HType CalculateInferredType(); |
1761 | 1752 |
1762 DECLARE_CONCRETE_INSTRUCTION(BitNot) | 1753 DECLARE_CONCRETE_INSTRUCTION(BitNot) |
1763 | 1754 |
1764 protected: | 1755 protected: |
1765 virtual bool DataEquals(HValue* other) { return true; } | 1756 virtual bool DataEquals(HValue* other) { return true; } |
1766 }; | 1757 }; |
1767 | 1758 |
(...skipping 29 matching lines...) Expand all Loading... |
1797 | 1788 |
1798 HValue* context() { return OperandAt(0); } | 1789 HValue* context() { return OperandAt(0); } |
1799 HValue* value() { return OperandAt(1); } | 1790 HValue* value() { return OperandAt(1); } |
1800 | 1791 |
1801 virtual void PrintDataTo(StringStream* stream); | 1792 virtual void PrintDataTo(StringStream* stream); |
1802 | 1793 |
1803 virtual HType CalculateInferredType(); | 1794 virtual HType CalculateInferredType(); |
1804 | 1795 |
1805 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 1796 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
1806 | 1797 |
1807 virtual Representation RequiredInputRepresentation(int index) const { | 1798 virtual Representation RequiredInputRepresentation(int index) { |
1808 if (index == 0) { | 1799 if (index == 0) { |
1809 return Representation::Tagged(); | 1800 return Representation::Tagged(); |
1810 } else { | 1801 } else { |
1811 switch (op_) { | 1802 switch (op_) { |
1812 case kMathFloor: | 1803 case kMathFloor: |
1813 case kMathRound: | 1804 case kMathRound: |
1814 case kMathCeil: | 1805 case kMathCeil: |
1815 case kMathSqrt: | 1806 case kMathSqrt: |
1816 case kMathPowHalf: | 1807 case kMathPowHalf: |
1817 case kMathLog: | 1808 case kMathLog: |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1854 | 1845 |
1855 | 1846 |
1856 class HLoadElements: public HUnaryOperation { | 1847 class HLoadElements: public HUnaryOperation { |
1857 public: | 1848 public: |
1858 explicit HLoadElements(HValue* value) : HUnaryOperation(value) { | 1849 explicit HLoadElements(HValue* value) : HUnaryOperation(value) { |
1859 set_representation(Representation::Tagged()); | 1850 set_representation(Representation::Tagged()); |
1860 SetFlag(kUseGVN); | 1851 SetFlag(kUseGVN); |
1861 SetFlag(kDependsOnMaps); | 1852 SetFlag(kDependsOnMaps); |
1862 } | 1853 } |
1863 | 1854 |
1864 virtual Representation RequiredInputRepresentation(int index) const { | 1855 virtual Representation RequiredInputRepresentation(int index) { |
1865 return Representation::Tagged(); | 1856 return Representation::Tagged(); |
1866 } | 1857 } |
1867 | 1858 |
1868 DECLARE_CONCRETE_INSTRUCTION(LoadElements) | 1859 DECLARE_CONCRETE_INSTRUCTION(LoadElements) |
1869 | 1860 |
1870 protected: | 1861 protected: |
1871 virtual bool DataEquals(HValue* other) { return true; } | 1862 virtual bool DataEquals(HValue* other) { return true; } |
1872 }; | 1863 }; |
1873 | 1864 |
1874 | 1865 |
1875 class HLoadExternalArrayPointer: public HUnaryOperation { | 1866 class HLoadExternalArrayPointer: public HUnaryOperation { |
1876 public: | 1867 public: |
1877 explicit HLoadExternalArrayPointer(HValue* value) | 1868 explicit HLoadExternalArrayPointer(HValue* value) |
1878 : HUnaryOperation(value) { | 1869 : HUnaryOperation(value) { |
1879 set_representation(Representation::External()); | 1870 set_representation(Representation::External()); |
1880 // The result of this instruction is idempotent as long as its inputs don't | 1871 // The result of this instruction is idempotent as long as its inputs don't |
1881 // change. The external array of a specialized array elements object cannot | 1872 // change. The external array of a specialized array elements object cannot |
1882 // change once set, so it's no necessary to introduce any additional | 1873 // change once set, so it's no necessary to introduce any additional |
1883 // dependencies on top of the inputs. | 1874 // dependencies on top of the inputs. |
1884 SetFlag(kUseGVN); | 1875 SetFlag(kUseGVN); |
1885 } | 1876 } |
1886 | 1877 |
1887 virtual Representation RequiredInputRepresentation(int index) const { | 1878 virtual Representation RequiredInputRepresentation(int index) { |
1888 return Representation::Tagged(); | 1879 return Representation::Tagged(); |
1889 } | 1880 } |
1890 | 1881 |
1891 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer) | 1882 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer) |
1892 | 1883 |
1893 protected: | 1884 protected: |
1894 virtual bool DataEquals(HValue* other) { return true; } | 1885 virtual bool DataEquals(HValue* other) { return true; } |
1895 }; | 1886 }; |
1896 | 1887 |
1897 | 1888 |
1898 class HCheckMap: public HTemplateInstruction<2> { | 1889 class HCheckMap: public HTemplateInstruction<2> { |
1899 public: | 1890 public: |
1900 HCheckMap(HValue* value, Handle<Map> map, HValue* typecheck = NULL) | 1891 HCheckMap(HValue* value, Handle<Map> map, HValue* typecheck = NULL) |
1901 : map_(map) { | 1892 : map_(map) { |
1902 SetOperandAt(0, value); | 1893 SetOperandAt(0, value); |
1903 // If callers don't depend on a typecheck, they can pass in NULL. In that | 1894 // If callers don't depend on a typecheck, they can pass in NULL. In that |
1904 // case we use a copy of the |value| argument as a dummy value. | 1895 // case we use a copy of the |value| argument as a dummy value. |
1905 SetOperandAt(1, typecheck != NULL ? typecheck : value); | 1896 SetOperandAt(1, typecheck != NULL ? typecheck : value); |
1906 set_representation(Representation::Tagged()); | 1897 set_representation(Representation::Tagged()); |
1907 SetFlag(kUseGVN); | 1898 SetFlag(kUseGVN); |
1908 SetFlag(kDependsOnMaps); | 1899 SetFlag(kDependsOnMaps); |
1909 } | 1900 } |
1910 | 1901 |
1911 virtual Representation RequiredInputRepresentation(int index) const { | 1902 virtual Representation RequiredInputRepresentation(int index) { |
1912 return Representation::Tagged(); | 1903 return Representation::Tagged(); |
1913 } | 1904 } |
1914 virtual void PrintDataTo(StringStream* stream); | 1905 virtual void PrintDataTo(StringStream* stream); |
1915 virtual HType CalculateInferredType(); | 1906 virtual HType CalculateInferredType(); |
1916 | 1907 |
1917 HValue* value() { return OperandAt(0); } | 1908 HValue* value() { return OperandAt(0); } |
1918 Handle<Map> map() const { return map_; } | 1909 Handle<Map> map() const { return map_; } |
1919 | 1910 |
1920 DECLARE_CONCRETE_INSTRUCTION(CheckMap) | 1911 DECLARE_CONCRETE_INSTRUCTION(CheckMap) |
1921 | 1912 |
1922 protected: | 1913 protected: |
1923 virtual bool DataEquals(HValue* other) { | 1914 virtual bool DataEquals(HValue* other) { |
1924 HCheckMap* b = HCheckMap::cast(other); | 1915 HCheckMap* b = HCheckMap::cast(other); |
1925 return map_.is_identical_to(b->map()); | 1916 return map_.is_identical_to(b->map()); |
1926 } | 1917 } |
1927 | 1918 |
1928 private: | 1919 private: |
1929 Handle<Map> map_; | 1920 Handle<Map> map_; |
1930 }; | 1921 }; |
1931 | 1922 |
1932 | 1923 |
1933 class HCheckFunction: public HUnaryOperation { | 1924 class HCheckFunction: public HUnaryOperation { |
1934 public: | 1925 public: |
1935 HCheckFunction(HValue* value, Handle<JSFunction> function) | 1926 HCheckFunction(HValue* value, Handle<JSFunction> function) |
1936 : HUnaryOperation(value), target_(function) { | 1927 : HUnaryOperation(value), target_(function) { |
1937 set_representation(Representation::Tagged()); | 1928 set_representation(Representation::Tagged()); |
1938 SetFlag(kUseGVN); | 1929 SetFlag(kUseGVN); |
1939 } | 1930 } |
1940 | 1931 |
1941 virtual Representation RequiredInputRepresentation(int index) const { | 1932 virtual Representation RequiredInputRepresentation(int index) { |
1942 return Representation::Tagged(); | 1933 return Representation::Tagged(); |
1943 } | 1934 } |
1944 virtual void PrintDataTo(StringStream* stream); | 1935 virtual void PrintDataTo(StringStream* stream); |
1945 virtual HType CalculateInferredType(); | 1936 virtual HType CalculateInferredType(); |
1946 | 1937 |
1947 #ifdef DEBUG | 1938 #ifdef DEBUG |
1948 virtual void Verify(); | 1939 virtual void Verify(); |
1949 #endif | 1940 #endif |
1950 | 1941 |
1951 Handle<JSFunction> target() const { return target_; } | 1942 Handle<JSFunction> target() const { return target_; } |
(...skipping 19 matching lines...) Expand all Loading... |
1971 static HCheckInstanceType* NewIsJSArray(HValue* value) { | 1962 static HCheckInstanceType* NewIsJSArray(HValue* value) { |
1972 return new HCheckInstanceType(value, IS_JS_ARRAY); | 1963 return new HCheckInstanceType(value, IS_JS_ARRAY); |
1973 } | 1964 } |
1974 static HCheckInstanceType* NewIsString(HValue* value) { | 1965 static HCheckInstanceType* NewIsString(HValue* value) { |
1975 return new HCheckInstanceType(value, IS_STRING); | 1966 return new HCheckInstanceType(value, IS_STRING); |
1976 } | 1967 } |
1977 static HCheckInstanceType* NewIsSymbol(HValue* value) { | 1968 static HCheckInstanceType* NewIsSymbol(HValue* value) { |
1978 return new HCheckInstanceType(value, IS_SYMBOL); | 1969 return new HCheckInstanceType(value, IS_SYMBOL); |
1979 } | 1970 } |
1980 | 1971 |
1981 virtual Representation RequiredInputRepresentation(int index) const { | 1972 virtual void PrintDataTo(StringStream* stream); |
| 1973 |
| 1974 virtual Representation RequiredInputRepresentation(int index) { |
1982 return Representation::Tagged(); | 1975 return Representation::Tagged(); |
1983 } | 1976 } |
1984 | 1977 |
1985 virtual HValue* Canonicalize(); | 1978 virtual HValue* Canonicalize(); |
1986 | 1979 |
1987 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } | 1980 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } |
1988 void GetCheckInterval(InstanceType* first, InstanceType* last); | 1981 void GetCheckInterval(InstanceType* first, InstanceType* last); |
1989 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); | 1982 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); |
1990 | 1983 |
1991 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) | 1984 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) |
1992 | 1985 |
1993 protected: | 1986 protected: |
1994 // TODO(ager): It could be nice to allow the ommision of instance | 1987 // TODO(ager): It could be nice to allow the ommision of instance |
1995 // type checks if we have already performed an instance type check | 1988 // type checks if we have already performed an instance type check |
1996 // with a larger range. | 1989 // with a larger range. |
1997 virtual bool DataEquals(HValue* other) { | 1990 virtual bool DataEquals(HValue* other) { |
1998 HCheckInstanceType* b = HCheckInstanceType::cast(other); | 1991 HCheckInstanceType* b = HCheckInstanceType::cast(other); |
1999 return check_ == b->check_; | 1992 return check_ == b->check_; |
2000 } | 1993 } |
2001 | 1994 |
2002 private: | 1995 private: |
2003 enum Check { | 1996 enum Check { |
2004 IS_SPEC_OBJECT, | 1997 IS_SPEC_OBJECT, |
2005 IS_JS_ARRAY, | 1998 IS_JS_ARRAY, |
2006 IS_STRING, | 1999 IS_STRING, |
2007 IS_SYMBOL, | 2000 IS_SYMBOL, |
2008 LAST_INTERVAL_CHECK = IS_JS_ARRAY | 2001 LAST_INTERVAL_CHECK = IS_JS_ARRAY |
2009 }; | 2002 }; |
2010 | 2003 |
| 2004 const char* GetCheckName(); |
| 2005 |
2011 HCheckInstanceType(HValue* value, Check check) | 2006 HCheckInstanceType(HValue* value, Check check) |
2012 : HUnaryOperation(value), check_(check) { | 2007 : HUnaryOperation(value), check_(check) { |
2013 set_representation(Representation::Tagged()); | 2008 set_representation(Representation::Tagged()); |
2014 SetFlag(kUseGVN); | 2009 SetFlag(kUseGVN); |
2015 } | 2010 } |
2016 | 2011 |
2017 const Check check_; | 2012 const Check check_; |
2018 }; | 2013 }; |
2019 | 2014 |
2020 | 2015 |
2021 class HCheckNonSmi: public HUnaryOperation { | 2016 class HCheckNonSmi: public HUnaryOperation { |
2022 public: | 2017 public: |
2023 explicit HCheckNonSmi(HValue* value) : HUnaryOperation(value) { | 2018 explicit HCheckNonSmi(HValue* value) : HUnaryOperation(value) { |
2024 set_representation(Representation::Tagged()); | 2019 set_representation(Representation::Tagged()); |
2025 SetFlag(kUseGVN); | 2020 SetFlag(kUseGVN); |
2026 } | 2021 } |
2027 | 2022 |
2028 virtual Representation RequiredInputRepresentation(int index) const { | 2023 virtual Representation RequiredInputRepresentation(int index) { |
2029 return Representation::Tagged(); | 2024 return Representation::Tagged(); |
2030 } | 2025 } |
2031 | 2026 |
2032 virtual HType CalculateInferredType(); | 2027 virtual HType CalculateInferredType(); |
2033 | 2028 |
2034 #ifdef DEBUG | 2029 #ifdef DEBUG |
2035 virtual void Verify(); | 2030 virtual void Verify(); |
2036 #endif | 2031 #endif |
2037 | 2032 |
2038 virtual HValue* Canonicalize() { | 2033 virtual HValue* Canonicalize() { |
(...skipping 25 matching lines...) Expand all Loading... |
2064 | 2059 |
2065 #ifdef DEBUG | 2060 #ifdef DEBUG |
2066 virtual void Verify(); | 2061 virtual void Verify(); |
2067 #endif | 2062 #endif |
2068 | 2063 |
2069 Handle<JSObject> prototype() const { return prototype_; } | 2064 Handle<JSObject> prototype() const { return prototype_; } |
2070 Handle<JSObject> holder() const { return holder_; } | 2065 Handle<JSObject> holder() const { return holder_; } |
2071 | 2066 |
2072 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps) | 2067 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps) |
2073 | 2068 |
2074 virtual Representation RequiredInputRepresentation(int index) const { | 2069 virtual Representation RequiredInputRepresentation(int index) { |
2075 return Representation::None(); | 2070 return Representation::None(); |
2076 } | 2071 } |
2077 | 2072 |
2078 virtual intptr_t Hashcode() { | 2073 virtual intptr_t Hashcode() { |
2079 ASSERT(!HEAP->IsAllocationAllowed()); | 2074 ASSERT(!HEAP->IsAllocationAllowed()); |
2080 intptr_t hash = reinterpret_cast<intptr_t>(*prototype()); | 2075 intptr_t hash = reinterpret_cast<intptr_t>(*prototype()); |
2081 hash = 17 * hash + reinterpret_cast<intptr_t>(*holder()); | 2076 hash = 17 * hash + reinterpret_cast<intptr_t>(*holder()); |
2082 return hash; | 2077 return hash; |
2083 } | 2078 } |
2084 | 2079 |
(...skipping 10 matching lines...) Expand all Loading... |
2095 }; | 2090 }; |
2096 | 2091 |
2097 | 2092 |
2098 class HCheckSmi: public HUnaryOperation { | 2093 class HCheckSmi: public HUnaryOperation { |
2099 public: | 2094 public: |
2100 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { | 2095 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { |
2101 set_representation(Representation::Tagged()); | 2096 set_representation(Representation::Tagged()); |
2102 SetFlag(kUseGVN); | 2097 SetFlag(kUseGVN); |
2103 } | 2098 } |
2104 | 2099 |
2105 virtual Representation RequiredInputRepresentation(int index) const { | 2100 virtual Representation RequiredInputRepresentation(int index) { |
2106 return Representation::Tagged(); | 2101 return Representation::Tagged(); |
2107 } | 2102 } |
2108 virtual HType CalculateInferredType(); | 2103 virtual HType CalculateInferredType(); |
2109 | 2104 |
2110 #ifdef DEBUG | 2105 #ifdef DEBUG |
2111 virtual void Verify(); | 2106 virtual void Verify(); |
2112 #endif | 2107 #endif |
2113 | 2108 |
2114 DECLARE_CONCRETE_INSTRUCTION(CheckSmi) | 2109 DECLARE_CONCRETE_INSTRUCTION(CheckSmi) |
2115 | 2110 |
(...skipping 28 matching lines...) Expand all Loading... |
2144 if (value->representation().IsInteger32()) int32_occurred = true; | 2139 if (value->representation().IsInteger32()) int32_occurred = true; |
2145 if (value->representation().IsTagged()) return Representation::Tagged(); | 2140 if (value->representation().IsTagged()) return Representation::Tagged(); |
2146 } | 2141 } |
2147 | 2142 |
2148 if (double_occurred) return Representation::Double(); | 2143 if (double_occurred) return Representation::Double(); |
2149 if (int32_occurred) return Representation::Integer32(); | 2144 if (int32_occurred) return Representation::Integer32(); |
2150 return Representation::None(); | 2145 return Representation::None(); |
2151 } | 2146 } |
2152 | 2147 |
2153 virtual Range* InferRange(); | 2148 virtual Range* InferRange(); |
2154 virtual Representation RequiredInputRepresentation(int index) const { | 2149 virtual Representation RequiredInputRepresentation(int index) { |
2155 return representation(); | 2150 return representation(); |
2156 } | 2151 } |
2157 virtual HType CalculateInferredType(); | 2152 virtual HType CalculateInferredType(); |
2158 virtual int OperandCount() { return inputs_.length(); } | 2153 virtual int OperandCount() { return inputs_.length(); } |
2159 virtual HValue* OperandAt(int index) { return inputs_[index]; } | 2154 virtual HValue* OperandAt(int index) { return inputs_[index]; } |
2160 HValue* GetRedundantReplacement(); | 2155 HValue* GetRedundantReplacement(); |
2161 void AddInput(HValue* value); | 2156 void AddInput(HValue* value); |
2162 bool HasRealUses(); | 2157 bool HasRealUses(); |
2163 | 2158 |
2164 bool IsReceiver() { return merged_index_ == 0; } | 2159 bool IsReceiver() { return merged_index_ == 0; } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2236 }; | 2231 }; |
2237 | 2232 |
2238 | 2233 |
2239 class HArgumentsObject: public HTemplateInstruction<0> { | 2234 class HArgumentsObject: public HTemplateInstruction<0> { |
2240 public: | 2235 public: |
2241 HArgumentsObject() { | 2236 HArgumentsObject() { |
2242 set_representation(Representation::Tagged()); | 2237 set_representation(Representation::Tagged()); |
2243 SetFlag(kIsArguments); | 2238 SetFlag(kIsArguments); |
2244 } | 2239 } |
2245 | 2240 |
2246 virtual Representation RequiredInputRepresentation(int index) const { | 2241 virtual Representation RequiredInputRepresentation(int index) { |
2247 return Representation::None(); | 2242 return Representation::None(); |
2248 } | 2243 } |
2249 | 2244 |
2250 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) | 2245 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) |
2251 }; | 2246 }; |
2252 | 2247 |
2253 | 2248 |
2254 class HConstant: public HTemplateInstruction<0> { | 2249 class HConstant: public HTemplateInstruction<0> { |
2255 public: | 2250 public: |
2256 HConstant(Handle<Object> handle, Representation r); | 2251 HConstant(Handle<Object> handle, Representation r); |
2257 | 2252 |
2258 Handle<Object> handle() const { return handle_; } | 2253 Handle<Object> handle() const { return handle_; } |
2259 | 2254 |
2260 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } | 2255 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } |
2261 | 2256 |
2262 virtual Representation RequiredInputRepresentation(int index) const { | 2257 bool ImmortalImmovable() const { |
| 2258 Heap* heap = HEAP; |
| 2259 if (*handle_ == heap->undefined_value()) return true; |
| 2260 if (*handle_ == heap->null_value()) return true; |
| 2261 if (*handle_ == heap->true_value()) return true; |
| 2262 if (*handle_ == heap->false_value()) return true; |
| 2263 if (*handle_ == heap->the_hole_value()) return true; |
| 2264 if (*handle_ == heap->minus_zero_value()) return true; |
| 2265 if (*handle_ == heap->nan_value()) return true; |
| 2266 if (*handle_ == heap->empty_string()) return true; |
| 2267 return false; |
| 2268 } |
| 2269 |
| 2270 virtual Representation RequiredInputRepresentation(int index) { |
2263 return Representation::None(); | 2271 return Representation::None(); |
2264 } | 2272 } |
2265 | 2273 |
2266 virtual bool IsConvertibleToInteger() const { | 2274 virtual bool IsConvertibleToInteger() const { |
2267 if (handle_->IsSmi()) return true; | 2275 if (handle_->IsSmi()) return true; |
2268 if (handle_->IsHeapNumber() && | 2276 if (handle_->IsHeapNumber() && |
2269 (HeapNumber::cast(*handle_)->value() == | 2277 (HeapNumber::cast(*handle_)->value() == |
2270 static_cast<double>(NumberToInt32(*handle_)))) return true; | 2278 static_cast<double>(NumberToInt32(*handle_)))) return true; |
2271 return false; | 2279 return false; |
2272 } | 2280 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2360 HValue* length, | 2368 HValue* length, |
2361 HValue* elements) { | 2369 HValue* elements) { |
2362 set_representation(Representation::Tagged()); | 2370 set_representation(Representation::Tagged()); |
2363 SetOperandAt(0, function); | 2371 SetOperandAt(0, function); |
2364 SetOperandAt(1, receiver); | 2372 SetOperandAt(1, receiver); |
2365 SetOperandAt(2, length); | 2373 SetOperandAt(2, length); |
2366 SetOperandAt(3, elements); | 2374 SetOperandAt(3, elements); |
2367 SetAllSideEffects(); | 2375 SetAllSideEffects(); |
2368 } | 2376 } |
2369 | 2377 |
2370 virtual Representation RequiredInputRepresentation(int index) const { | 2378 virtual Representation RequiredInputRepresentation(int index) { |
2371 // The length is untagged, all other inputs are tagged. | 2379 // The length is untagged, all other inputs are tagged. |
2372 return (index == 2) | 2380 return (index == 2) |
2373 ? Representation::Integer32() | 2381 ? Representation::Integer32() |
2374 : Representation::Tagged(); | 2382 : Representation::Tagged(); |
2375 } | 2383 } |
2376 | 2384 |
2377 HValue* function() { return OperandAt(0); } | 2385 HValue* function() { return OperandAt(0); } |
2378 HValue* receiver() { return OperandAt(1); } | 2386 HValue* receiver() { return OperandAt(1); } |
2379 HValue* length() { return OperandAt(2); } | 2387 HValue* length() { return OperandAt(2); } |
2380 HValue* elements() { return OperandAt(3); } | 2388 HValue* elements() { return OperandAt(3); } |
2381 | 2389 |
2382 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments) | 2390 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments) |
2383 }; | 2391 }; |
2384 | 2392 |
2385 | 2393 |
2386 class HArgumentsElements: public HTemplateInstruction<0> { | 2394 class HArgumentsElements: public HTemplateInstruction<0> { |
2387 public: | 2395 public: |
2388 HArgumentsElements() { | 2396 HArgumentsElements() { |
2389 // The value produced by this instruction is a pointer into the stack | 2397 // The value produced by this instruction is a pointer into the stack |
2390 // that looks as if it was a smi because of alignment. | 2398 // that looks as if it was a smi because of alignment. |
2391 set_representation(Representation::Tagged()); | 2399 set_representation(Representation::Tagged()); |
2392 SetFlag(kUseGVN); | 2400 SetFlag(kUseGVN); |
2393 } | 2401 } |
2394 | 2402 |
2395 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements) | 2403 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements) |
2396 | 2404 |
2397 virtual Representation RequiredInputRepresentation(int index) const { | 2405 virtual Representation RequiredInputRepresentation(int index) { |
2398 return Representation::None(); | 2406 return Representation::None(); |
2399 } | 2407 } |
2400 | 2408 |
2401 protected: | 2409 protected: |
2402 virtual bool DataEquals(HValue* other) { return true; } | 2410 virtual bool DataEquals(HValue* other) { return true; } |
2403 }; | 2411 }; |
2404 | 2412 |
2405 | 2413 |
2406 class HArgumentsLength: public HUnaryOperation { | 2414 class HArgumentsLength: public HUnaryOperation { |
2407 public: | 2415 public: |
2408 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { | 2416 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { |
2409 set_representation(Representation::Integer32()); | 2417 set_representation(Representation::Integer32()); |
2410 SetFlag(kUseGVN); | 2418 SetFlag(kUseGVN); |
2411 } | 2419 } |
2412 | 2420 |
2413 virtual Representation RequiredInputRepresentation(int index) const { | 2421 virtual Representation RequiredInputRepresentation(int index) { |
2414 return Representation::Tagged(); | 2422 return Representation::Tagged(); |
2415 } | 2423 } |
2416 | 2424 |
2417 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength) | 2425 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength) |
2418 | 2426 |
2419 protected: | 2427 protected: |
2420 virtual bool DataEquals(HValue* other) { return true; } | 2428 virtual bool DataEquals(HValue* other) { return true; } |
2421 }; | 2429 }; |
2422 | 2430 |
2423 | 2431 |
2424 class HAccessArgumentsAt: public HTemplateInstruction<3> { | 2432 class HAccessArgumentsAt: public HTemplateInstruction<3> { |
2425 public: | 2433 public: |
2426 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { | 2434 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { |
2427 set_representation(Representation::Tagged()); | 2435 set_representation(Representation::Tagged()); |
2428 SetFlag(kUseGVN); | 2436 SetFlag(kUseGVN); |
2429 SetOperandAt(0, arguments); | 2437 SetOperandAt(0, arguments); |
2430 SetOperandAt(1, length); | 2438 SetOperandAt(1, length); |
2431 SetOperandAt(2, index); | 2439 SetOperandAt(2, index); |
2432 } | 2440 } |
2433 | 2441 |
2434 virtual void PrintDataTo(StringStream* stream); | 2442 virtual void PrintDataTo(StringStream* stream); |
2435 | 2443 |
2436 virtual Representation RequiredInputRepresentation(int index) const { | 2444 virtual Representation RequiredInputRepresentation(int index) { |
2437 // The arguments elements is considered tagged. | 2445 // The arguments elements is considered tagged. |
2438 return index == 0 | 2446 return index == 0 |
2439 ? Representation::Tagged() | 2447 ? Representation::Tagged() |
2440 : Representation::Integer32(); | 2448 : Representation::Integer32(); |
2441 } | 2449 } |
2442 | 2450 |
2443 HValue* arguments() { return OperandAt(0); } | 2451 HValue* arguments() { return OperandAt(0); } |
2444 HValue* length() { return OperandAt(1); } | 2452 HValue* length() { return OperandAt(1); } |
2445 HValue* index() { return OperandAt(2); } | 2453 HValue* index() { return OperandAt(2); } |
2446 | 2454 |
2447 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) | 2455 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) |
2448 | 2456 |
2449 virtual bool DataEquals(HValue* other) { return true; } | 2457 virtual bool DataEquals(HValue* other) { return true; } |
2450 }; | 2458 }; |
2451 | 2459 |
2452 | 2460 |
2453 class HBoundsCheck: public HTemplateInstruction<2> { | 2461 class HBoundsCheck: public HTemplateInstruction<2> { |
2454 public: | 2462 public: |
2455 HBoundsCheck(HValue* index, HValue* length) { | 2463 HBoundsCheck(HValue* index, HValue* length) { |
2456 SetOperandAt(0, index); | 2464 SetOperandAt(0, index); |
2457 SetOperandAt(1, length); | 2465 SetOperandAt(1, length); |
2458 set_representation(Representation::Integer32()); | 2466 set_representation(Representation::Integer32()); |
2459 SetFlag(kUseGVN); | 2467 SetFlag(kUseGVN); |
2460 } | 2468 } |
2461 | 2469 |
2462 virtual Representation RequiredInputRepresentation(int index) const { | 2470 virtual Representation RequiredInputRepresentation(int index) { |
2463 return Representation::Integer32(); | 2471 return Representation::Integer32(); |
2464 } | 2472 } |
2465 | 2473 |
2466 virtual void PrintDataTo(StringStream* stream); | 2474 virtual void PrintDataTo(StringStream* stream); |
2467 | 2475 |
2468 HValue* index() { return OperandAt(0); } | 2476 HValue* index() { return OperandAt(0); } |
2469 HValue* length() { return OperandAt(1); } | 2477 HValue* length() { return OperandAt(1); } |
2470 | 2478 |
2471 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) | 2479 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) |
2472 | 2480 |
2473 protected: | 2481 protected: |
2474 virtual bool DataEquals(HValue* other) { return true; } | 2482 virtual bool DataEquals(HValue* other) { return true; } |
2475 }; | 2483 }; |
2476 | 2484 |
2477 | 2485 |
2478 class HBitwiseBinaryOperation: public HBinaryOperation { | 2486 class HBitwiseBinaryOperation: public HBinaryOperation { |
2479 public: | 2487 public: |
2480 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right) | 2488 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right) |
2481 : HBinaryOperation(context, left, right) { | 2489 : HBinaryOperation(context, left, right) { |
2482 set_representation(Representation::Tagged()); | 2490 set_representation(Representation::Tagged()); |
2483 SetFlag(kFlexibleRepresentation); | 2491 SetFlag(kFlexibleRepresentation); |
2484 SetAllSideEffects(); | 2492 SetAllSideEffects(); |
2485 } | 2493 } |
2486 | 2494 |
2487 virtual Representation RequiredInputRepresentation(int index) const { | 2495 virtual Representation RequiredInputRepresentation(int index) { |
2488 return index == 0 | 2496 return index == 0 |
2489 ? Representation::Tagged() | 2497 ? Representation::Tagged() |
2490 : representation(); | 2498 : representation(); |
2491 } | 2499 } |
2492 | 2500 |
2493 virtual void RepresentationChanged(Representation to) { | 2501 virtual void RepresentationChanged(Representation to) { |
2494 if (!to.IsTagged()) { | 2502 if (!to.IsTagged()) { |
2495 ASSERT(to.IsInteger32()); | 2503 ASSERT(to.IsInteger32()); |
2496 ClearAllSideEffects(); | 2504 ClearAllSideEffects(); |
2497 SetFlag(kTruncatingToInt32); | 2505 SetFlag(kTruncatingToInt32); |
(...skipping 17 matching lines...) Expand all Loading... |
2515 } | 2523 } |
2516 | 2524 |
2517 virtual void RepresentationChanged(Representation to) { | 2525 virtual void RepresentationChanged(Representation to) { |
2518 if (!to.IsTagged()) { | 2526 if (!to.IsTagged()) { |
2519 ClearAllSideEffects(); | 2527 ClearAllSideEffects(); |
2520 SetFlag(kUseGVN); | 2528 SetFlag(kUseGVN); |
2521 } | 2529 } |
2522 } | 2530 } |
2523 | 2531 |
2524 virtual HType CalculateInferredType(); | 2532 virtual HType CalculateInferredType(); |
2525 virtual Representation RequiredInputRepresentation(int index) const { | 2533 virtual Representation RequiredInputRepresentation(int index) { |
2526 return index == 0 | 2534 return index == 0 |
2527 ? Representation::Tagged() | 2535 ? Representation::Tagged() |
2528 : representation(); | 2536 : representation(); |
2529 } | 2537 } |
2530 | 2538 |
2531 virtual Representation InferredRepresentation() { | 2539 virtual Representation InferredRepresentation() { |
2532 if (left()->representation().Equals(right()->representation())) { | 2540 if (left()->representation().Equals(right()->representation())) { |
2533 return left()->representation(); | 2541 return left()->representation(); |
2534 } | 2542 } |
2535 return HValue::InferredRepresentation(); | 2543 return HValue::InferredRepresentation(); |
2536 } | 2544 } |
2537 }; | 2545 }; |
2538 | 2546 |
2539 | 2547 |
2540 class HCompareGeneric: public HBinaryOperation { | 2548 class HCompareGeneric: public HBinaryOperation { |
2541 public: | 2549 public: |
2542 HCompareGeneric(HValue* context, | 2550 HCompareGeneric(HValue* context, |
2543 HValue* left, | 2551 HValue* left, |
2544 HValue* right, | 2552 HValue* right, |
2545 Token::Value token) | 2553 Token::Value token) |
2546 : HBinaryOperation(context, left, right), token_(token) { | 2554 : HBinaryOperation(context, left, right), token_(token) { |
2547 ASSERT(Token::IsCompareOp(token)); | 2555 ASSERT(Token::IsCompareOp(token)); |
2548 set_representation(Representation::Tagged()); | 2556 set_representation(Representation::Tagged()); |
2549 SetAllSideEffects(); | 2557 SetAllSideEffects(); |
2550 } | 2558 } |
2551 | 2559 |
2552 virtual Representation RequiredInputRepresentation(int index) const { | 2560 virtual Representation RequiredInputRepresentation(int index) { |
2553 return Representation::Tagged(); | 2561 return Representation::Tagged(); |
2554 } | 2562 } |
2555 | 2563 |
2556 Representation GetInputRepresentation() const { | 2564 Representation GetInputRepresentation() const { |
2557 return Representation::Tagged(); | 2565 return Representation::Tagged(); |
2558 } | 2566 } |
2559 | 2567 |
2560 Token::Value token() const { return token_; } | 2568 Token::Value token() const { return token_; } |
2561 virtual void PrintDataTo(StringStream* stream); | 2569 virtual void PrintDataTo(StringStream* stream); |
2562 | 2570 |
(...skipping 17 matching lines...) Expand all Loading... |
2580 | 2588 |
2581 HValue* left() { return OperandAt(0); } | 2589 HValue* left() { return OperandAt(0); } |
2582 HValue* right() { return OperandAt(1); } | 2590 HValue* right() { return OperandAt(1); } |
2583 Token::Value token() const { return token_; } | 2591 Token::Value token() const { return token_; } |
2584 | 2592 |
2585 void SetInputRepresentation(Representation r); | 2593 void SetInputRepresentation(Representation r); |
2586 Representation GetInputRepresentation() const { | 2594 Representation GetInputRepresentation() const { |
2587 return input_representation_; | 2595 return input_representation_; |
2588 } | 2596 } |
2589 | 2597 |
2590 virtual Representation RequiredInputRepresentation(int index) const { | 2598 virtual Representation RequiredInputRepresentation(int index) { |
2591 return input_representation_; | 2599 return input_representation_; |
2592 } | 2600 } |
2593 virtual void PrintDataTo(StringStream* stream); | 2601 virtual void PrintDataTo(StringStream* stream); |
2594 | 2602 |
2595 DECLARE_CONCRETE_INSTRUCTION(CompareIDAndBranch) | 2603 DECLARE_CONCRETE_INSTRUCTION(CompareIDAndBranch) |
2596 | 2604 |
2597 private: | 2605 private: |
2598 Representation input_representation_; | 2606 Representation input_representation_; |
2599 Token::Value token_; | 2607 Token::Value token_; |
2600 }; | 2608 }; |
2601 | 2609 |
2602 | 2610 |
2603 class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> { | 2611 class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> { |
2604 public: | 2612 public: |
2605 HCompareObjectEqAndBranch(HValue* left, HValue* right) { | 2613 HCompareObjectEqAndBranch(HValue* left, HValue* right) { |
2606 SetOperandAt(0, left); | 2614 SetOperandAt(0, left); |
2607 SetOperandAt(1, right); | 2615 SetOperandAt(1, right); |
2608 } | 2616 } |
2609 | 2617 |
2610 HValue* left() { return OperandAt(0); } | 2618 HValue* left() { return OperandAt(0); } |
2611 HValue* right() { return OperandAt(1); } | 2619 HValue* right() { return OperandAt(1); } |
2612 | 2620 |
2613 virtual Representation RequiredInputRepresentation(int index) const { | 2621 virtual void PrintDataTo(StringStream* stream); |
| 2622 |
| 2623 virtual Representation RequiredInputRepresentation(int index) { |
2614 return Representation::Tagged(); | 2624 return Representation::Tagged(); |
2615 } | 2625 } |
2616 | 2626 |
2617 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) | 2627 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) |
2618 }; | 2628 }; |
2619 | 2629 |
2620 | 2630 |
2621 class HCompareConstantEqAndBranch: public HUnaryControlInstruction { | 2631 class HCompareConstantEqAndBranch: public HUnaryControlInstruction { |
2622 public: | 2632 public: |
2623 HCompareConstantEqAndBranch(HValue* left, int right, Token::Value op) | 2633 HCompareConstantEqAndBranch(HValue* left, int right, Token::Value op) |
2624 : HUnaryControlInstruction(left, NULL, NULL), op_(op), right_(right) { | 2634 : HUnaryControlInstruction(left, NULL, NULL), op_(op), right_(right) { |
2625 ASSERT(op == Token::EQ_STRICT); | 2635 ASSERT(op == Token::EQ_STRICT); |
2626 } | 2636 } |
2627 | 2637 |
2628 Token::Value op() const { return op_; } | 2638 Token::Value op() const { return op_; } |
2629 HValue* left() { return value(); } | 2639 HValue* left() { return value(); } |
2630 int right() const { return right_; } | 2640 int right() const { return right_; } |
2631 | 2641 |
2632 virtual Representation RequiredInputRepresentation(int index) const { | 2642 virtual Representation RequiredInputRepresentation(int index) { |
2633 return Representation::Integer32(); | 2643 return Representation::Integer32(); |
2634 } | 2644 } |
2635 | 2645 |
2636 DECLARE_CONCRETE_INSTRUCTION(CompareConstantEqAndBranch); | 2646 DECLARE_CONCRETE_INSTRUCTION(CompareConstantEqAndBranch); |
2637 | 2647 |
2638 private: | 2648 private: |
2639 const Token::Value op_; | 2649 const Token::Value op_; |
2640 const int right_; | 2650 const int right_; |
2641 }; | 2651 }; |
2642 | 2652 |
2643 | 2653 |
2644 class HIsNullAndBranch: public HUnaryControlInstruction { | 2654 class HIsNilAndBranch: public HUnaryControlInstruction { |
2645 public: | 2655 public: |
2646 HIsNullAndBranch(HValue* value, bool is_strict) | 2656 HIsNilAndBranch(HValue* value, EqualityKind kind, NilValue nil) |
2647 : HUnaryControlInstruction(value, NULL, NULL), is_strict_(is_strict) { } | 2657 : HUnaryControlInstruction(value, NULL, NULL), kind_(kind), nil_(nil) { } |
2648 | 2658 |
2649 bool is_strict() const { return is_strict_; } | 2659 EqualityKind kind() const { return kind_; } |
| 2660 NilValue nil() const { return nil_; } |
2650 | 2661 |
2651 virtual Representation RequiredInputRepresentation(int index) const { | 2662 virtual void PrintDataTo(StringStream* stream); |
| 2663 |
| 2664 virtual Representation RequiredInputRepresentation(int index) { |
2652 return Representation::Tagged(); | 2665 return Representation::Tagged(); |
2653 } | 2666 } |
2654 | 2667 |
2655 DECLARE_CONCRETE_INSTRUCTION(IsNullAndBranch) | 2668 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch) |
2656 | 2669 |
2657 private: | 2670 private: |
2658 bool is_strict_; | 2671 EqualityKind kind_; |
| 2672 NilValue nil_; |
2659 }; | 2673 }; |
2660 | 2674 |
2661 | 2675 |
2662 class HIsObjectAndBranch: public HUnaryControlInstruction { | 2676 class HIsObjectAndBranch: public HUnaryControlInstruction { |
2663 public: | 2677 public: |
2664 explicit HIsObjectAndBranch(HValue* value) | 2678 explicit HIsObjectAndBranch(HValue* value) |
2665 : HUnaryControlInstruction(value, NULL, NULL) { } | 2679 : HUnaryControlInstruction(value, NULL, NULL) { } |
2666 | 2680 |
2667 virtual Representation RequiredInputRepresentation(int index) const { | 2681 virtual Representation RequiredInputRepresentation(int index) { |
2668 return Representation::Tagged(); | 2682 return Representation::Tagged(); |
2669 } | 2683 } |
2670 | 2684 |
2671 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch) | 2685 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch) |
2672 }; | 2686 }; |
2673 | 2687 |
2674 | 2688 |
2675 class HIsSmiAndBranch: public HUnaryControlInstruction { | 2689 class HIsSmiAndBranch: public HUnaryControlInstruction { |
2676 public: | 2690 public: |
2677 explicit HIsSmiAndBranch(HValue* value) | 2691 explicit HIsSmiAndBranch(HValue* value) |
2678 : HUnaryControlInstruction(value, NULL, NULL) { } | 2692 : HUnaryControlInstruction(value, NULL, NULL) { } |
2679 | 2693 |
2680 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch) | 2694 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch) |
2681 | 2695 |
2682 virtual Representation RequiredInputRepresentation(int index) const { | 2696 virtual Representation RequiredInputRepresentation(int index) { |
2683 return Representation::Tagged(); | 2697 return Representation::Tagged(); |
2684 } | 2698 } |
2685 | 2699 |
2686 protected: | 2700 protected: |
2687 virtual bool DataEquals(HValue* other) { return true; } | 2701 virtual bool DataEquals(HValue* other) { return true; } |
2688 }; | 2702 }; |
2689 | 2703 |
2690 | 2704 |
2691 class HIsUndetectableAndBranch: public HUnaryControlInstruction { | 2705 class HIsUndetectableAndBranch: public HUnaryControlInstruction { |
2692 public: | 2706 public: |
2693 explicit HIsUndetectableAndBranch(HValue* value) | 2707 explicit HIsUndetectableAndBranch(HValue* value) |
2694 : HUnaryControlInstruction(value, NULL, NULL) { } | 2708 : HUnaryControlInstruction(value, NULL, NULL) { } |
2695 | 2709 |
2696 virtual Representation RequiredInputRepresentation(int index) const { | 2710 virtual Representation RequiredInputRepresentation(int index) { |
2697 return Representation::Tagged(); | 2711 return Representation::Tagged(); |
2698 } | 2712 } |
2699 | 2713 |
2700 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch) | 2714 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch) |
2701 }; | 2715 }; |
2702 | 2716 |
2703 | 2717 |
2704 class HIsConstructCallAndBranch: public HTemplateControlInstruction<2, 0> { | 2718 class HIsConstructCallAndBranch: public HTemplateControlInstruction<2, 0> { |
2705 public: | 2719 public: |
2706 virtual Representation RequiredInputRepresentation(int index) const { | 2720 virtual Representation RequiredInputRepresentation(int index) { |
2707 return Representation::None(); | 2721 return Representation::None(); |
2708 } | 2722 } |
2709 | 2723 |
2710 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch) | 2724 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch) |
2711 }; | 2725 }; |
2712 | 2726 |
2713 | 2727 |
2714 class HHasInstanceTypeAndBranch: public HUnaryControlInstruction { | 2728 class HHasInstanceTypeAndBranch: public HUnaryControlInstruction { |
2715 public: | 2729 public: |
2716 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) | 2730 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) |
2717 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } | 2731 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } |
2718 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) | 2732 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) |
2719 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { | 2733 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { |
2720 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. | 2734 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. |
2721 } | 2735 } |
2722 | 2736 |
2723 InstanceType from() { return from_; } | 2737 InstanceType from() { return from_; } |
2724 InstanceType to() { return to_; } | 2738 InstanceType to() { return to_; } |
2725 | 2739 |
2726 virtual void PrintDataTo(StringStream* stream); | 2740 virtual void PrintDataTo(StringStream* stream); |
2727 | 2741 |
2728 virtual Representation RequiredInputRepresentation(int index) const { | 2742 virtual Representation RequiredInputRepresentation(int index) { |
2729 return Representation::Tagged(); | 2743 return Representation::Tagged(); |
2730 } | 2744 } |
2731 | 2745 |
2732 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) | 2746 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) |
2733 | 2747 |
2734 private: | 2748 private: |
2735 InstanceType from_; | 2749 InstanceType from_; |
2736 InstanceType to_; // Inclusive range, not all combinations work. | 2750 InstanceType to_; // Inclusive range, not all combinations work. |
2737 }; | 2751 }; |
2738 | 2752 |
2739 | 2753 |
2740 class HHasCachedArrayIndexAndBranch: public HUnaryControlInstruction { | 2754 class HHasCachedArrayIndexAndBranch: public HUnaryControlInstruction { |
2741 public: | 2755 public: |
2742 explicit HHasCachedArrayIndexAndBranch(HValue* value) | 2756 explicit HHasCachedArrayIndexAndBranch(HValue* value) |
2743 : HUnaryControlInstruction(value, NULL, NULL) { } | 2757 : HUnaryControlInstruction(value, NULL, NULL) { } |
2744 | 2758 |
2745 virtual Representation RequiredInputRepresentation(int index) const { | 2759 virtual Representation RequiredInputRepresentation(int index) { |
2746 return Representation::Tagged(); | 2760 return Representation::Tagged(); |
2747 } | 2761 } |
2748 | 2762 |
2749 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch) | 2763 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch) |
2750 }; | 2764 }; |
2751 | 2765 |
2752 | 2766 |
2753 class HGetCachedArrayIndex: public HUnaryOperation { | 2767 class HGetCachedArrayIndex: public HUnaryOperation { |
2754 public: | 2768 public: |
2755 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) { | 2769 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) { |
2756 set_representation(Representation::Tagged()); | 2770 set_representation(Representation::Tagged()); |
2757 SetFlag(kUseGVN); | 2771 SetFlag(kUseGVN); |
2758 } | 2772 } |
2759 | 2773 |
2760 virtual Representation RequiredInputRepresentation(int index) const { | 2774 virtual Representation RequiredInputRepresentation(int index) { |
2761 return Representation::Tagged(); | 2775 return Representation::Tagged(); |
2762 } | 2776 } |
2763 | 2777 |
2764 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) | 2778 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) |
2765 | 2779 |
2766 protected: | 2780 protected: |
2767 virtual bool DataEquals(HValue* other) { return true; } | 2781 virtual bool DataEquals(HValue* other) { return true; } |
2768 }; | 2782 }; |
2769 | 2783 |
2770 | 2784 |
2771 class HClassOfTestAndBranch: public HUnaryControlInstruction { | 2785 class HClassOfTestAndBranch: public HUnaryControlInstruction { |
2772 public: | 2786 public: |
2773 HClassOfTestAndBranch(HValue* value, Handle<String> class_name) | 2787 HClassOfTestAndBranch(HValue* value, Handle<String> class_name) |
2774 : HUnaryControlInstruction(value, NULL, NULL), | 2788 : HUnaryControlInstruction(value, NULL, NULL), |
2775 class_name_(class_name) { } | 2789 class_name_(class_name) { } |
2776 | 2790 |
2777 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch) | 2791 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch) |
2778 | 2792 |
2779 virtual Representation RequiredInputRepresentation(int index) const { | 2793 virtual Representation RequiredInputRepresentation(int index) { |
2780 return Representation::Tagged(); | 2794 return Representation::Tagged(); |
2781 } | 2795 } |
2782 | 2796 |
2783 virtual void PrintDataTo(StringStream* stream); | 2797 virtual void PrintDataTo(StringStream* stream); |
2784 | 2798 |
2785 Handle<String> class_name() const { return class_name_; } | 2799 Handle<String> class_name() const { return class_name_; } |
2786 | 2800 |
2787 private: | 2801 private: |
2788 Handle<String> class_name_; | 2802 Handle<String> class_name_; |
2789 }; | 2803 }; |
2790 | 2804 |
2791 | 2805 |
2792 class HTypeofIsAndBranch: public HUnaryControlInstruction { | 2806 class HTypeofIsAndBranch: public HUnaryControlInstruction { |
2793 public: | 2807 public: |
2794 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal) | 2808 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal) |
2795 : HUnaryControlInstruction(value, NULL, NULL), | 2809 : HUnaryControlInstruction(value, NULL, NULL), |
2796 type_literal_(type_literal) { } | 2810 type_literal_(type_literal) { } |
2797 | 2811 |
2798 Handle<String> type_literal() { return type_literal_; } | 2812 Handle<String> type_literal() { return type_literal_; } |
2799 virtual void PrintDataTo(StringStream* stream); | 2813 virtual void PrintDataTo(StringStream* stream); |
2800 | 2814 |
2801 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) | 2815 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) |
2802 | 2816 |
2803 virtual Representation RequiredInputRepresentation(int index) const { | 2817 virtual Representation RequiredInputRepresentation(int index) { |
2804 return Representation::Tagged(); | 2818 return Representation::Tagged(); |
2805 } | 2819 } |
2806 | 2820 |
2807 private: | 2821 private: |
2808 Handle<String> type_literal_; | 2822 Handle<String> type_literal_; |
2809 }; | 2823 }; |
2810 | 2824 |
2811 | 2825 |
2812 class HInstanceOf: public HBinaryOperation { | 2826 class HInstanceOf: public HBinaryOperation { |
2813 public: | 2827 public: |
2814 HInstanceOf(HValue* context, HValue* left, HValue* right) | 2828 HInstanceOf(HValue* context, HValue* left, HValue* right) |
2815 : HBinaryOperation(context, left, right) { | 2829 : HBinaryOperation(context, left, right) { |
2816 set_representation(Representation::Tagged()); | 2830 set_representation(Representation::Tagged()); |
2817 SetAllSideEffects(); | 2831 SetAllSideEffects(); |
2818 } | 2832 } |
2819 | 2833 |
2820 virtual Representation RequiredInputRepresentation(int index) const { | 2834 virtual Representation RequiredInputRepresentation(int index) { |
2821 return Representation::Tagged(); | 2835 return Representation::Tagged(); |
2822 } | 2836 } |
2823 | 2837 |
2824 virtual HType CalculateInferredType(); | 2838 virtual HType CalculateInferredType(); |
2825 | 2839 |
2826 virtual void PrintDataTo(StringStream* stream); | 2840 virtual void PrintDataTo(StringStream* stream); |
2827 | 2841 |
2828 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) | 2842 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) |
2829 }; | 2843 }; |
2830 | 2844 |
2831 | 2845 |
2832 class HInstanceOfKnownGlobal: public HTemplateInstruction<2> { | 2846 class HInstanceOfKnownGlobal: public HTemplateInstruction<2> { |
2833 public: | 2847 public: |
2834 HInstanceOfKnownGlobal(HValue* context, | 2848 HInstanceOfKnownGlobal(HValue* context, |
2835 HValue* left, | 2849 HValue* left, |
2836 Handle<JSFunction> right) | 2850 Handle<JSFunction> right) |
2837 : function_(right) { | 2851 : function_(right) { |
2838 SetOperandAt(0, context); | 2852 SetOperandAt(0, context); |
2839 SetOperandAt(1, left); | 2853 SetOperandAt(1, left); |
2840 set_representation(Representation::Tagged()); | 2854 set_representation(Representation::Tagged()); |
2841 SetAllSideEffects(); | 2855 SetAllSideEffects(); |
2842 } | 2856 } |
2843 | 2857 |
2844 HValue* context() { return OperandAt(0); } | 2858 HValue* context() { return OperandAt(0); } |
2845 HValue* left() { return OperandAt(1); } | 2859 HValue* left() { return OperandAt(1); } |
2846 Handle<JSFunction> function() { return function_; } | 2860 Handle<JSFunction> function() { return function_; } |
2847 | 2861 |
2848 virtual Representation RequiredInputRepresentation(int index) const { | 2862 virtual Representation RequiredInputRepresentation(int index) { |
2849 return Representation::Tagged(); | 2863 return Representation::Tagged(); |
2850 } | 2864 } |
2851 | 2865 |
2852 virtual HType CalculateInferredType(); | 2866 virtual HType CalculateInferredType(); |
2853 | 2867 |
2854 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) | 2868 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) |
2855 | 2869 |
2856 private: | 2870 private: |
2857 Handle<JSFunction> function_; | 2871 Handle<JSFunction> function_; |
2858 }; | 2872 }; |
2859 | 2873 |
2860 | 2874 |
2861 class HPower: public HTemplateInstruction<2> { | 2875 class HPower: public HTemplateInstruction<2> { |
2862 public: | 2876 public: |
2863 HPower(HValue* left, HValue* right) { | 2877 HPower(HValue* left, HValue* right) { |
2864 SetOperandAt(0, left); | 2878 SetOperandAt(0, left); |
2865 SetOperandAt(1, right); | 2879 SetOperandAt(1, right); |
2866 set_representation(Representation::Double()); | 2880 set_representation(Representation::Double()); |
2867 SetFlag(kUseGVN); | 2881 SetFlag(kUseGVN); |
2868 } | 2882 } |
2869 | 2883 |
2870 HValue* left() { return OperandAt(0); } | 2884 HValue* left() { return OperandAt(0); } |
2871 HValue* right() { return OperandAt(1); } | 2885 HValue* right() { return OperandAt(1); } |
2872 | 2886 |
2873 virtual Representation RequiredInputRepresentation(int index) const { | 2887 virtual Representation RequiredInputRepresentation(int index) { |
2874 return index == 0 | 2888 return index == 0 |
2875 ? Representation::Double() | 2889 ? Representation::Double() |
2876 : Representation::None(); | 2890 : Representation::None(); |
2877 } | 2891 } |
2878 | 2892 |
2879 DECLARE_CONCRETE_INSTRUCTION(Power) | 2893 DECLARE_CONCRETE_INSTRUCTION(Power) |
2880 | 2894 |
2881 protected: | 2895 protected: |
2882 virtual bool DataEquals(HValue* other) { return true; } | 2896 virtual bool DataEquals(HValue* other) { return true; } |
2883 }; | 2897 }; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3092 | 3106 |
3093 | 3107 |
3094 class HOsrEntry: public HTemplateInstruction<0> { | 3108 class HOsrEntry: public HTemplateInstruction<0> { |
3095 public: | 3109 public: |
3096 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) { | 3110 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) { |
3097 SetFlag(kChangesOsrEntries); | 3111 SetFlag(kChangesOsrEntries); |
3098 } | 3112 } |
3099 | 3113 |
3100 int ast_id() const { return ast_id_; } | 3114 int ast_id() const { return ast_id_; } |
3101 | 3115 |
3102 virtual Representation RequiredInputRepresentation(int index) const { | 3116 virtual Representation RequiredInputRepresentation(int index) { |
3103 return Representation::None(); | 3117 return Representation::None(); |
3104 } | 3118 } |
3105 | 3119 |
3106 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) | 3120 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) |
3107 | 3121 |
3108 private: | 3122 private: |
3109 int ast_id_; | 3123 int ast_id_; |
3110 }; | 3124 }; |
3111 | 3125 |
3112 | 3126 |
3113 class HParameter: public HTemplateInstruction<0> { | 3127 class HParameter: public HTemplateInstruction<0> { |
3114 public: | 3128 public: |
3115 explicit HParameter(unsigned index) : index_(index) { | 3129 explicit HParameter(unsigned index) : index_(index) { |
3116 set_representation(Representation::Tagged()); | 3130 set_representation(Representation::Tagged()); |
3117 } | 3131 } |
3118 | 3132 |
3119 unsigned index() const { return index_; } | 3133 unsigned index() const { return index_; } |
3120 | 3134 |
3121 virtual void PrintDataTo(StringStream* stream); | 3135 virtual void PrintDataTo(StringStream* stream); |
3122 | 3136 |
3123 virtual Representation RequiredInputRepresentation(int index) const { | 3137 virtual Representation RequiredInputRepresentation(int index) { |
3124 return Representation::None(); | 3138 return Representation::None(); |
3125 } | 3139 } |
3126 | 3140 |
3127 DECLARE_CONCRETE_INSTRUCTION(Parameter) | 3141 DECLARE_CONCRETE_INSTRUCTION(Parameter) |
3128 | 3142 |
3129 private: | 3143 private: |
3130 unsigned index_; | 3144 unsigned index_; |
3131 }; | 3145 }; |
3132 | 3146 |
3133 | 3147 |
(...skipping 11 matching lines...) Expand all Loading... |
3145 | 3159 |
3146 void set_transcendental_type(TranscendentalCache::Type transcendental_type) { | 3160 void set_transcendental_type(TranscendentalCache::Type transcendental_type) { |
3147 transcendental_type_ = transcendental_type; | 3161 transcendental_type_ = transcendental_type; |
3148 } | 3162 } |
3149 TranscendentalCache::Type transcendental_type() { | 3163 TranscendentalCache::Type transcendental_type() { |
3150 return transcendental_type_; | 3164 return transcendental_type_; |
3151 } | 3165 } |
3152 | 3166 |
3153 virtual void PrintDataTo(StringStream* stream); | 3167 virtual void PrintDataTo(StringStream* stream); |
3154 | 3168 |
3155 virtual Representation RequiredInputRepresentation(int index) const { | 3169 virtual Representation RequiredInputRepresentation(int index) { |
3156 return Representation::Tagged(); | 3170 return Representation::Tagged(); |
3157 } | 3171 } |
3158 | 3172 |
3159 DECLARE_CONCRETE_INSTRUCTION(CallStub) | 3173 DECLARE_CONCRETE_INSTRUCTION(CallStub) |
3160 | 3174 |
3161 private: | 3175 private: |
3162 CodeStub::Major major_key_; | 3176 CodeStub::Major major_key_; |
3163 TranscendentalCache::Type transcendental_type_; | 3177 TranscendentalCache::Type transcendental_type_; |
3164 }; | 3178 }; |
3165 | 3179 |
3166 | 3180 |
3167 class HUnknownOSRValue: public HTemplateInstruction<0> { | 3181 class HUnknownOSRValue: public HTemplateInstruction<0> { |
3168 public: | 3182 public: |
3169 HUnknownOSRValue() { set_representation(Representation::Tagged()); } | 3183 HUnknownOSRValue() { set_representation(Representation::Tagged()); } |
3170 | 3184 |
3171 virtual Representation RequiredInputRepresentation(int index) const { | 3185 virtual Representation RequiredInputRepresentation(int index) { |
3172 return Representation::None(); | 3186 return Representation::None(); |
3173 } | 3187 } |
3174 | 3188 |
3175 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) | 3189 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) |
3176 }; | 3190 }; |
3177 | 3191 |
3178 | 3192 |
3179 class HLoadGlobalCell: public HTemplateInstruction<0> { | 3193 class HLoadGlobalCell: public HTemplateInstruction<0> { |
3180 public: | 3194 public: |
3181 HLoadGlobalCell(Handle<JSGlobalPropertyCell> cell, bool check_hole_value) | 3195 HLoadGlobalCell(Handle<JSGlobalPropertyCell> cell, PropertyDetails details) |
3182 : cell_(cell), check_hole_value_(check_hole_value) { | 3196 : cell_(cell), details_(details) { |
3183 set_representation(Representation::Tagged()); | 3197 set_representation(Representation::Tagged()); |
3184 SetFlag(kUseGVN); | 3198 SetFlag(kUseGVN); |
3185 SetFlag(kDependsOnGlobalVars); | 3199 SetFlag(kDependsOnGlobalVars); |
3186 } | 3200 } |
3187 | 3201 |
3188 Handle<JSGlobalPropertyCell> cell() const { return cell_; } | 3202 Handle<JSGlobalPropertyCell> cell() const { return cell_; } |
3189 bool check_hole_value() const { return check_hole_value_; } | 3203 bool RequiresHoleCheck(); |
3190 | 3204 |
3191 virtual void PrintDataTo(StringStream* stream); | 3205 virtual void PrintDataTo(StringStream* stream); |
3192 | 3206 |
3193 virtual intptr_t Hashcode() { | 3207 virtual intptr_t Hashcode() { |
3194 ASSERT(!HEAP->allow_allocation(false)); | 3208 ASSERT(!HEAP->allow_allocation(false)); |
3195 return reinterpret_cast<intptr_t>(*cell_); | 3209 return reinterpret_cast<intptr_t>(*cell_); |
3196 } | 3210 } |
3197 | 3211 |
3198 virtual Representation RequiredInputRepresentation(int index) const { | 3212 virtual Representation RequiredInputRepresentation(int index) { |
3199 return Representation::None(); | 3213 return Representation::None(); |
3200 } | 3214 } |
3201 | 3215 |
3202 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) | 3216 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) |
3203 | 3217 |
3204 protected: | 3218 protected: |
3205 virtual bool DataEquals(HValue* other) { | 3219 virtual bool DataEquals(HValue* other) { |
3206 HLoadGlobalCell* b = HLoadGlobalCell::cast(other); | 3220 HLoadGlobalCell* b = HLoadGlobalCell::cast(other); |
3207 return cell_.is_identical_to(b->cell()); | 3221 return cell_.is_identical_to(b->cell()); |
3208 } | 3222 } |
3209 | 3223 |
3210 private: | 3224 private: |
3211 Handle<JSGlobalPropertyCell> cell_; | 3225 Handle<JSGlobalPropertyCell> cell_; |
3212 bool check_hole_value_; | 3226 PropertyDetails details_; |
3213 }; | 3227 }; |
3214 | 3228 |
3215 | 3229 |
3216 class HLoadGlobalGeneric: public HTemplateInstruction<2> { | 3230 class HLoadGlobalGeneric: public HTemplateInstruction<2> { |
3217 public: | 3231 public: |
3218 HLoadGlobalGeneric(HValue* context, | 3232 HLoadGlobalGeneric(HValue* context, |
3219 HValue* global_object, | 3233 HValue* global_object, |
3220 Handle<Object> name, | 3234 Handle<Object> name, |
3221 bool for_typeof) | 3235 bool for_typeof) |
3222 : name_(name), | 3236 : name_(name), |
3223 for_typeof_(for_typeof) { | 3237 for_typeof_(for_typeof) { |
3224 SetOperandAt(0, context); | 3238 SetOperandAt(0, context); |
3225 SetOperandAt(1, global_object); | 3239 SetOperandAt(1, global_object); |
3226 set_representation(Representation::Tagged()); | 3240 set_representation(Representation::Tagged()); |
3227 SetAllSideEffects(); | 3241 SetAllSideEffects(); |
3228 } | 3242 } |
3229 | 3243 |
3230 HValue* context() { return OperandAt(0); } | 3244 HValue* context() { return OperandAt(0); } |
3231 HValue* global_object() { return OperandAt(1); } | 3245 HValue* global_object() { return OperandAt(1); } |
3232 Handle<Object> name() const { return name_; } | 3246 Handle<Object> name() const { return name_; } |
3233 bool for_typeof() const { return for_typeof_; } | 3247 bool for_typeof() const { return for_typeof_; } |
3234 | 3248 |
3235 virtual void PrintDataTo(StringStream* stream); | 3249 virtual void PrintDataTo(StringStream* stream); |
3236 | 3250 |
3237 virtual Representation RequiredInputRepresentation(int index) const { | 3251 virtual Representation RequiredInputRepresentation(int index) { |
3238 return Representation::Tagged(); | 3252 return Representation::Tagged(); |
3239 } | 3253 } |
3240 | 3254 |
3241 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) | 3255 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) |
3242 | 3256 |
3243 private: | 3257 private: |
3244 Handle<Object> name_; | 3258 Handle<Object> name_; |
3245 bool for_typeof_; | 3259 bool for_typeof_; |
3246 }; | 3260 }; |
3247 | 3261 |
3248 | 3262 |
3249 class HStoreGlobalCell: public HUnaryOperation { | 3263 class HStoreGlobalCell: public HUnaryOperation { |
3250 public: | 3264 public: |
3251 HStoreGlobalCell(HValue* value, | 3265 HStoreGlobalCell(HValue* value, |
3252 Handle<JSGlobalPropertyCell> cell, | 3266 Handle<JSGlobalPropertyCell> cell, |
3253 bool check_hole_value) | 3267 PropertyDetails details) |
3254 : HUnaryOperation(value), | 3268 : HUnaryOperation(value), |
3255 cell_(cell), | 3269 cell_(cell), |
3256 check_hole_value_(check_hole_value) { | 3270 details_(details) { |
3257 SetFlag(kChangesGlobalVars); | 3271 SetFlag(kChangesGlobalVars); |
3258 } | 3272 } |
3259 | 3273 |
3260 Handle<JSGlobalPropertyCell> cell() const { return cell_; } | 3274 Handle<JSGlobalPropertyCell> cell() const { return cell_; } |
3261 bool check_hole_value() const { return check_hole_value_; } | 3275 bool RequiresHoleCheck() { |
| 3276 return !details_.IsDontDelete() || details_.IsReadOnly(); |
| 3277 } |
3262 | 3278 |
3263 virtual Representation RequiredInputRepresentation(int index) const { | 3279 virtual Representation RequiredInputRepresentation(int index) { |
3264 return Representation::Tagged(); | 3280 return Representation::Tagged(); |
3265 } | 3281 } |
3266 virtual void PrintDataTo(StringStream* stream); | 3282 virtual void PrintDataTo(StringStream* stream); |
3267 | 3283 |
3268 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) | 3284 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) |
3269 | 3285 |
3270 private: | 3286 private: |
3271 Handle<JSGlobalPropertyCell> cell_; | 3287 Handle<JSGlobalPropertyCell> cell_; |
3272 bool check_hole_value_; | 3288 PropertyDetails details_; |
3273 }; | 3289 }; |
3274 | 3290 |
3275 | 3291 |
3276 class HStoreGlobalGeneric: public HTemplateInstruction<3> { | 3292 class HStoreGlobalGeneric: public HTemplateInstruction<3> { |
3277 public: | 3293 public: |
3278 HStoreGlobalGeneric(HValue* context, | 3294 HStoreGlobalGeneric(HValue* context, |
3279 HValue* global_object, | 3295 HValue* global_object, |
3280 Handle<Object> name, | 3296 Handle<Object> name, |
3281 HValue* value, | 3297 HValue* value, |
3282 bool strict_mode) | 3298 bool strict_mode) |
3283 : name_(name), | 3299 : name_(name), |
3284 strict_mode_(strict_mode) { | 3300 strict_mode_(strict_mode) { |
3285 SetOperandAt(0, context); | 3301 SetOperandAt(0, context); |
3286 SetOperandAt(1, global_object); | 3302 SetOperandAt(1, global_object); |
3287 SetOperandAt(2, value); | 3303 SetOperandAt(2, value); |
3288 set_representation(Representation::Tagged()); | 3304 set_representation(Representation::Tagged()); |
3289 SetAllSideEffects(); | 3305 SetAllSideEffects(); |
3290 } | 3306 } |
3291 | 3307 |
3292 HValue* context() { return OperandAt(0); } | 3308 HValue* context() { return OperandAt(0); } |
3293 HValue* global_object() { return OperandAt(1); } | 3309 HValue* global_object() { return OperandAt(1); } |
3294 Handle<Object> name() const { return name_; } | 3310 Handle<Object> name() const { return name_; } |
3295 HValue* value() { return OperandAt(2); } | 3311 HValue* value() { return OperandAt(2); } |
3296 bool strict_mode() { return strict_mode_; } | 3312 bool strict_mode() { return strict_mode_; } |
3297 | 3313 |
3298 virtual void PrintDataTo(StringStream* stream); | 3314 virtual void PrintDataTo(StringStream* stream); |
3299 | 3315 |
3300 virtual Representation RequiredInputRepresentation(int index) const { | 3316 virtual Representation RequiredInputRepresentation(int index) { |
3301 return Representation::Tagged(); | 3317 return Representation::Tagged(); |
3302 } | 3318 } |
3303 | 3319 |
3304 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric) | 3320 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric) |
3305 | 3321 |
3306 private: | 3322 private: |
3307 Handle<Object> name_; | 3323 Handle<Object> name_; |
3308 bool strict_mode_; | 3324 bool strict_mode_; |
3309 }; | 3325 }; |
3310 | 3326 |
3311 | 3327 |
3312 class HLoadContextSlot: public HUnaryOperation { | 3328 class HLoadContextSlot: public HUnaryOperation { |
3313 public: | 3329 public: |
3314 HLoadContextSlot(HValue* context , int slot_index) | 3330 HLoadContextSlot(HValue* context , int slot_index) |
3315 : HUnaryOperation(context), slot_index_(slot_index) { | 3331 : HUnaryOperation(context), slot_index_(slot_index) { |
3316 set_representation(Representation::Tagged()); | 3332 set_representation(Representation::Tagged()); |
3317 SetFlag(kUseGVN); | 3333 SetFlag(kUseGVN); |
3318 SetFlag(kDependsOnContextSlots); | 3334 SetFlag(kDependsOnContextSlots); |
3319 } | 3335 } |
3320 | 3336 |
3321 int slot_index() const { return slot_index_; } | 3337 int slot_index() const { return slot_index_; } |
3322 | 3338 |
3323 virtual Representation RequiredInputRepresentation(int index) const { | 3339 virtual Representation RequiredInputRepresentation(int index) { |
3324 return Representation::Tagged(); | 3340 return Representation::Tagged(); |
3325 } | 3341 } |
3326 | 3342 |
3327 virtual void PrintDataTo(StringStream* stream); | 3343 virtual void PrintDataTo(StringStream* stream); |
3328 | 3344 |
3329 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) | 3345 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) |
3330 | 3346 |
3331 protected: | 3347 protected: |
3332 virtual bool DataEquals(HValue* other) { | 3348 virtual bool DataEquals(HValue* other) { |
3333 HLoadContextSlot* b = HLoadContextSlot::cast(other); | 3349 HLoadContextSlot* b = HLoadContextSlot::cast(other); |
3334 return (slot_index() == b->slot_index()); | 3350 return (slot_index() == b->slot_index()); |
3335 } | 3351 } |
3336 | 3352 |
3337 private: | 3353 private: |
3338 int slot_index_; | 3354 int slot_index_; |
3339 }; | 3355 }; |
3340 | 3356 |
3341 | 3357 |
3342 static inline bool StoringValueNeedsWriteBarrier(HValue* value) { | 3358 static inline bool StoringValueNeedsWriteBarrier(HValue* value) { |
3343 return !value->type().IsBoolean() | 3359 return !value->type().IsBoolean() |
3344 && !value->type().IsSmi() | 3360 && !value->type().IsSmi() |
3345 && !(value->IsConstant() && HConstant::cast(value)->InOldSpace()); | 3361 && !(value->IsConstant() && HConstant::cast(value)->ImmortalImmovable()); |
3346 } | 3362 } |
3347 | 3363 |
3348 | 3364 |
3349 class HStoreContextSlot: public HTemplateInstruction<2> { | 3365 class HStoreContextSlot: public HTemplateInstruction<2> { |
3350 public: | 3366 public: |
3351 HStoreContextSlot(HValue* context, int slot_index, HValue* value) | 3367 HStoreContextSlot(HValue* context, int slot_index, HValue* value) |
3352 : slot_index_(slot_index) { | 3368 : slot_index_(slot_index) { |
3353 SetOperandAt(0, context); | 3369 SetOperandAt(0, context); |
3354 SetOperandAt(1, value); | 3370 SetOperandAt(1, value); |
3355 SetFlag(kChangesContextSlots); | 3371 SetFlag(kChangesContextSlots); |
3356 } | 3372 } |
3357 | 3373 |
3358 HValue* context() { return OperandAt(0); } | 3374 HValue* context() { return OperandAt(0); } |
3359 HValue* value() { return OperandAt(1); } | 3375 HValue* value() { return OperandAt(1); } |
3360 int slot_index() const { return slot_index_; } | 3376 int slot_index() const { return slot_index_; } |
3361 | 3377 |
3362 bool NeedsWriteBarrier() { | 3378 bool NeedsWriteBarrier() { |
3363 return StoringValueNeedsWriteBarrier(value()); | 3379 return StoringValueNeedsWriteBarrier(value()); |
3364 } | 3380 } |
3365 | 3381 |
3366 virtual Representation RequiredInputRepresentation(int index) const { | 3382 virtual Representation RequiredInputRepresentation(int index) { |
3367 return Representation::Tagged(); | 3383 return Representation::Tagged(); |
3368 } | 3384 } |
3369 | 3385 |
3370 virtual void PrintDataTo(StringStream* stream); | 3386 virtual void PrintDataTo(StringStream* stream); |
3371 | 3387 |
3372 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) | 3388 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) |
3373 | 3389 |
3374 private: | 3390 private: |
3375 int slot_index_; | 3391 int slot_index_; |
3376 }; | 3392 }; |
(...skipping 12 matching lines...) Expand all Loading... |
3389 SetFlag(kDependsOnInobjectFields); | 3405 SetFlag(kDependsOnInobjectFields); |
3390 } else { | 3406 } else { |
3391 SetFlag(kDependsOnBackingStoreFields); | 3407 SetFlag(kDependsOnBackingStoreFields); |
3392 } | 3408 } |
3393 } | 3409 } |
3394 | 3410 |
3395 HValue* object() { return OperandAt(0); } | 3411 HValue* object() { return OperandAt(0); } |
3396 bool is_in_object() const { return is_in_object_; } | 3412 bool is_in_object() const { return is_in_object_; } |
3397 int offset() const { return offset_; } | 3413 int offset() const { return offset_; } |
3398 | 3414 |
3399 virtual Representation RequiredInputRepresentation(int index) const { | 3415 virtual Representation RequiredInputRepresentation(int index) { |
3400 return Representation::Tagged(); | 3416 return Representation::Tagged(); |
3401 } | 3417 } |
3402 virtual void PrintDataTo(StringStream* stream); | 3418 virtual void PrintDataTo(StringStream* stream); |
3403 | 3419 |
3404 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) | 3420 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) |
3405 | 3421 |
3406 protected: | 3422 protected: |
3407 virtual bool DataEquals(HValue* other) { | 3423 virtual bool DataEquals(HValue* other) { |
3408 HLoadNamedField* b = HLoadNamedField::cast(other); | 3424 HLoadNamedField* b = HLoadNamedField::cast(other); |
3409 return is_in_object_ == b->is_in_object_ && offset_ == b->offset_; | 3425 return is_in_object_ == b->is_in_object_ && offset_ == b->offset_; |
(...skipping 11 matching lines...) Expand all Loading... |
3421 HValue* object, | 3437 HValue* object, |
3422 SmallMapList* types, | 3438 SmallMapList* types, |
3423 Handle<String> name); | 3439 Handle<String> name); |
3424 | 3440 |
3425 HValue* context() { return OperandAt(0); } | 3441 HValue* context() { return OperandAt(0); } |
3426 HValue* object() { return OperandAt(1); } | 3442 HValue* object() { return OperandAt(1); } |
3427 SmallMapList* types() { return &types_; } | 3443 SmallMapList* types() { return &types_; } |
3428 Handle<String> name() { return name_; } | 3444 Handle<String> name() { return name_; } |
3429 bool need_generic() { return need_generic_; } | 3445 bool need_generic() { return need_generic_; } |
3430 | 3446 |
3431 virtual Representation RequiredInputRepresentation(int index) const { | 3447 virtual Representation RequiredInputRepresentation(int index) { |
3432 return Representation::Tagged(); | 3448 return Representation::Tagged(); |
3433 } | 3449 } |
3434 | 3450 |
3435 virtual void PrintDataTo(StringStream* stream); | 3451 virtual void PrintDataTo(StringStream* stream); |
3436 | 3452 |
3437 DECLARE_CONCRETE_INSTRUCTION(LoadNamedFieldPolymorphic) | 3453 DECLARE_CONCRETE_INSTRUCTION(LoadNamedFieldPolymorphic) |
3438 | 3454 |
3439 static const int kMaxLoadPolymorphism = 4; | 3455 static const int kMaxLoadPolymorphism = 4; |
3440 | 3456 |
3441 protected: | 3457 protected: |
(...skipping 14 matching lines...) Expand all Loading... |
3456 SetOperandAt(0, context); | 3472 SetOperandAt(0, context); |
3457 SetOperandAt(1, object); | 3473 SetOperandAt(1, object); |
3458 set_representation(Representation::Tagged()); | 3474 set_representation(Representation::Tagged()); |
3459 SetAllSideEffects(); | 3475 SetAllSideEffects(); |
3460 } | 3476 } |
3461 | 3477 |
3462 HValue* context() { return OperandAt(0); } | 3478 HValue* context() { return OperandAt(0); } |
3463 HValue* object() { return OperandAt(1); } | 3479 HValue* object() { return OperandAt(1); } |
3464 Handle<Object> name() const { return name_; } | 3480 Handle<Object> name() const { return name_; } |
3465 | 3481 |
3466 virtual Representation RequiredInputRepresentation(int index) const { | 3482 virtual Representation RequiredInputRepresentation(int index) { |
3467 return Representation::Tagged(); | 3483 return Representation::Tagged(); |
3468 } | 3484 } |
3469 | 3485 |
3470 virtual void PrintDataTo(StringStream* stream); | 3486 virtual void PrintDataTo(StringStream* stream); |
3471 | 3487 |
3472 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric) | 3488 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric) |
3473 | 3489 |
3474 private: | 3490 private: |
3475 Handle<Object> name_; | 3491 Handle<Object> name_; |
3476 }; | 3492 }; |
3477 | 3493 |
3478 | 3494 |
3479 class HLoadFunctionPrototype: public HUnaryOperation { | 3495 class HLoadFunctionPrototype: public HUnaryOperation { |
3480 public: | 3496 public: |
3481 explicit HLoadFunctionPrototype(HValue* function) | 3497 explicit HLoadFunctionPrototype(HValue* function) |
3482 : HUnaryOperation(function) { | 3498 : HUnaryOperation(function) { |
3483 set_representation(Representation::Tagged()); | 3499 set_representation(Representation::Tagged()); |
3484 SetFlag(kUseGVN); | 3500 SetFlag(kUseGVN); |
3485 SetFlag(kDependsOnCalls); | 3501 SetFlag(kDependsOnCalls); |
3486 } | 3502 } |
3487 | 3503 |
3488 HValue* function() { return OperandAt(0); } | 3504 HValue* function() { return OperandAt(0); } |
3489 | 3505 |
3490 virtual Representation RequiredInputRepresentation(int index) const { | 3506 virtual Representation RequiredInputRepresentation(int index) { |
3491 return Representation::Tagged(); | 3507 return Representation::Tagged(); |
3492 } | 3508 } |
3493 | 3509 |
3494 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) | 3510 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) |
3495 | 3511 |
3496 protected: | 3512 protected: |
3497 virtual bool DataEquals(HValue* other) { return true; } | 3513 virtual bool DataEquals(HValue* other) { return true; } |
3498 }; | 3514 }; |
3499 | 3515 |
3500 | 3516 |
3501 class HLoadKeyedFastElement: public HTemplateInstruction<2> { | 3517 class HLoadKeyedFastElement: public HTemplateInstruction<2> { |
3502 public: | 3518 public: |
3503 HLoadKeyedFastElement(HValue* obj, HValue* key) { | 3519 HLoadKeyedFastElement(HValue* obj, HValue* key) { |
3504 SetOperandAt(0, obj); | 3520 SetOperandAt(0, obj); |
3505 SetOperandAt(1, key); | 3521 SetOperandAt(1, key); |
3506 set_representation(Representation::Tagged()); | 3522 set_representation(Representation::Tagged()); |
3507 SetFlag(kDependsOnArrayElements); | 3523 SetFlag(kDependsOnArrayElements); |
3508 SetFlag(kUseGVN); | 3524 SetFlag(kUseGVN); |
3509 } | 3525 } |
3510 | 3526 |
3511 HValue* object() { return OperandAt(0); } | 3527 HValue* object() { return OperandAt(0); } |
3512 HValue* key() { return OperandAt(1); } | 3528 HValue* key() { return OperandAt(1); } |
3513 | 3529 |
3514 virtual Representation RequiredInputRepresentation(int index) const { | 3530 virtual Representation RequiredInputRepresentation(int index) { |
3515 // The key is supposed to be Integer32. | 3531 // The key is supposed to be Integer32. |
3516 return index == 0 | 3532 return index == 0 |
3517 ? Representation::Tagged() | 3533 ? Representation::Tagged() |
3518 : Representation::Integer32(); | 3534 : Representation::Integer32(); |
3519 } | 3535 } |
3520 | 3536 |
3521 virtual void PrintDataTo(StringStream* stream); | 3537 virtual void PrintDataTo(StringStream* stream); |
3522 | 3538 |
3523 bool RequiresHoleCheck() const; | 3539 bool RequiresHoleCheck(); |
3524 | 3540 |
3525 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement) | 3541 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement) |
3526 | 3542 |
3527 protected: | 3543 protected: |
3528 virtual bool DataEquals(HValue* other) { return true; } | 3544 virtual bool DataEquals(HValue* other) { return true; } |
3529 }; | 3545 }; |
3530 | 3546 |
3531 | 3547 |
3532 class HLoadKeyedFastDoubleElement: public HTemplateInstruction<2> { | 3548 class HLoadKeyedFastDoubleElement: public HTemplateInstruction<2> { |
3533 public: | 3549 public: |
3534 HLoadKeyedFastDoubleElement(HValue* elements, HValue* key) { | 3550 HLoadKeyedFastDoubleElement(HValue* elements, HValue* key) { |
3535 SetOperandAt(0, elements); | 3551 SetOperandAt(0, elements); |
3536 SetOperandAt(1, key); | 3552 SetOperandAt(1, key); |
3537 set_representation(Representation::Double()); | 3553 set_representation(Representation::Double()); |
3538 SetFlag(kDependsOnDoubleArrayElements); | 3554 SetFlag(kDependsOnDoubleArrayElements); |
3539 SetFlag(kUseGVN); | 3555 SetFlag(kUseGVN); |
3540 } | 3556 } |
3541 | 3557 |
3542 HValue* elements() { return OperandAt(0); } | 3558 HValue* elements() { return OperandAt(0); } |
3543 HValue* key() { return OperandAt(1); } | 3559 HValue* key() { return OperandAt(1); } |
3544 | 3560 |
3545 virtual Representation RequiredInputRepresentation(int index) const { | 3561 virtual Representation RequiredInputRepresentation(int index) { |
3546 // The key is supposed to be Integer32. | 3562 // The key is supposed to be Integer32. |
3547 return index == 0 | 3563 return index == 0 |
3548 ? Representation::Tagged() | 3564 ? Representation::Tagged() |
3549 : Representation::Integer32(); | 3565 : Representation::Integer32(); |
3550 } | 3566 } |
3551 | 3567 |
3552 virtual void PrintDataTo(StringStream* stream); | 3568 virtual void PrintDataTo(StringStream* stream); |
3553 | 3569 |
3554 bool RequiresHoleCheck() const; | |
3555 | |
3556 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastDoubleElement) | 3570 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastDoubleElement) |
3557 | 3571 |
3558 protected: | 3572 protected: |
3559 virtual bool DataEquals(HValue* other) { return true; } | 3573 virtual bool DataEquals(HValue* other) { return true; } |
3560 }; | 3574 }; |
3561 | 3575 |
3562 | 3576 |
3563 class HLoadKeyedSpecializedArrayElement: public HTemplateInstruction<2> { | 3577 class HLoadKeyedSpecializedArrayElement: public HTemplateInstruction<2> { |
3564 public: | 3578 public: |
3565 HLoadKeyedSpecializedArrayElement(HValue* external_elements, | 3579 HLoadKeyedSpecializedArrayElement(HValue* external_elements, |
3566 HValue* key, | 3580 HValue* key, |
3567 ElementsKind elements_kind) | 3581 ElementsKind elements_kind) |
3568 : elements_kind_(elements_kind) { | 3582 : elements_kind_(elements_kind) { |
3569 SetOperandAt(0, external_elements); | 3583 SetOperandAt(0, external_elements); |
3570 SetOperandAt(1, key); | 3584 SetOperandAt(1, key); |
3571 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || | 3585 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || |
3572 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | 3586 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { |
3573 set_representation(Representation::Double()); | 3587 set_representation(Representation::Double()); |
3574 } else { | 3588 } else { |
3575 set_representation(Representation::Integer32()); | 3589 set_representation(Representation::Integer32()); |
3576 } | 3590 } |
3577 SetFlag(kDependsOnSpecializedArrayElements); | 3591 SetFlag(kDependsOnSpecializedArrayElements); |
3578 // Native code could change the specialized array. | 3592 // Native code could change the specialized array. |
3579 SetFlag(kDependsOnCalls); | 3593 SetFlag(kDependsOnCalls); |
3580 SetFlag(kUseGVN); | 3594 SetFlag(kUseGVN); |
3581 } | 3595 } |
3582 | 3596 |
3583 virtual void PrintDataTo(StringStream* stream); | 3597 virtual void PrintDataTo(StringStream* stream); |
3584 | 3598 |
3585 virtual Representation RequiredInputRepresentation(int index) const { | 3599 virtual Representation RequiredInputRepresentation(int index) { |
3586 // The key is supposed to be Integer32, but the base pointer | 3600 // The key is supposed to be Integer32, but the base pointer |
3587 // for the element load is a naked pointer. | 3601 // for the element load is a naked pointer. |
3588 return index == 0 | 3602 return index == 0 |
3589 ? Representation::External() | 3603 ? Representation::External() |
3590 : Representation::Integer32(); | 3604 : Representation::Integer32(); |
3591 } | 3605 } |
3592 | 3606 |
3593 HValue* external_pointer() { return OperandAt(0); } | 3607 HValue* external_pointer() { return OperandAt(0); } |
3594 HValue* key() { return OperandAt(1); } | 3608 HValue* key() { return OperandAt(1); } |
3595 ElementsKind elements_kind() const { return elements_kind_; } | 3609 ElementsKind elements_kind() const { return elements_kind_; } |
(...skipping 22 matching lines...) Expand all Loading... |
3618 SetOperandAt(2, context); | 3632 SetOperandAt(2, context); |
3619 SetAllSideEffects(); | 3633 SetAllSideEffects(); |
3620 } | 3634 } |
3621 | 3635 |
3622 HValue* object() { return OperandAt(0); } | 3636 HValue* object() { return OperandAt(0); } |
3623 HValue* key() { return OperandAt(1); } | 3637 HValue* key() { return OperandAt(1); } |
3624 HValue* context() { return OperandAt(2); } | 3638 HValue* context() { return OperandAt(2); } |
3625 | 3639 |
3626 virtual void PrintDataTo(StringStream* stream); | 3640 virtual void PrintDataTo(StringStream* stream); |
3627 | 3641 |
3628 virtual Representation RequiredInputRepresentation(int index) const { | 3642 virtual Representation RequiredInputRepresentation(int index) { |
3629 return Representation::Tagged(); | 3643 return Representation::Tagged(); |
3630 } | 3644 } |
3631 | 3645 |
3632 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) | 3646 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) |
3633 }; | 3647 }; |
3634 | 3648 |
3635 | 3649 |
3636 class HStoreNamedField: public HTemplateInstruction<2> { | 3650 class HStoreNamedField: public HTemplateInstruction<2> { |
3637 public: | 3651 public: |
3638 HStoreNamedField(HValue* obj, | 3652 HStoreNamedField(HValue* obj, |
3639 Handle<String> name, | 3653 Handle<String> name, |
3640 HValue* val, | 3654 HValue* val, |
3641 bool in_object, | 3655 bool in_object, |
3642 int offset) | 3656 int offset) |
3643 : name_(name), | 3657 : name_(name), |
3644 is_in_object_(in_object), | 3658 is_in_object_(in_object), |
3645 offset_(offset) { | 3659 offset_(offset) { |
3646 SetOperandAt(0, obj); | 3660 SetOperandAt(0, obj); |
3647 SetOperandAt(1, val); | 3661 SetOperandAt(1, val); |
3648 if (is_in_object_) { | 3662 if (is_in_object_) { |
3649 SetFlag(kChangesInobjectFields); | 3663 SetFlag(kChangesInobjectFields); |
3650 } else { | 3664 } else { |
3651 SetFlag(kChangesBackingStoreFields); | 3665 SetFlag(kChangesBackingStoreFields); |
3652 } | 3666 } |
3653 } | 3667 } |
3654 | 3668 |
3655 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) | 3669 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
3656 | 3670 |
3657 virtual Representation RequiredInputRepresentation(int index) const { | 3671 virtual Representation RequiredInputRepresentation(int index) { |
3658 return Representation::Tagged(); | 3672 return Representation::Tagged(); |
3659 } | 3673 } |
3660 virtual void PrintDataTo(StringStream* stream); | 3674 virtual void PrintDataTo(StringStream* stream); |
3661 | 3675 |
3662 HValue* object() { return OperandAt(0); } | 3676 HValue* object() { return OperandAt(0); } |
3663 HValue* value() { return OperandAt(1); } | 3677 HValue* value() { return OperandAt(1); } |
3664 | 3678 |
3665 Handle<String> name() const { return name_; } | 3679 Handle<String> name() const { return name_; } |
3666 bool is_in_object() const { return is_in_object_; } | 3680 bool is_in_object() const { return is_in_object_; } |
3667 int offset() const { return offset_; } | 3681 int offset() const { return offset_; } |
(...skipping 28 matching lines...) Expand all Loading... |
3696 } | 3710 } |
3697 | 3711 |
3698 HValue* object() { return OperandAt(0); } | 3712 HValue* object() { return OperandAt(0); } |
3699 HValue* value() { return OperandAt(1); } | 3713 HValue* value() { return OperandAt(1); } |
3700 HValue* context() { return OperandAt(2); } | 3714 HValue* context() { return OperandAt(2); } |
3701 Handle<String> name() { return name_; } | 3715 Handle<String> name() { return name_; } |
3702 bool strict_mode() { return strict_mode_; } | 3716 bool strict_mode() { return strict_mode_; } |
3703 | 3717 |
3704 virtual void PrintDataTo(StringStream* stream); | 3718 virtual void PrintDataTo(StringStream* stream); |
3705 | 3719 |
3706 virtual Representation RequiredInputRepresentation(int index) const { | 3720 virtual Representation RequiredInputRepresentation(int index) { |
3707 return Representation::Tagged(); | 3721 return Representation::Tagged(); |
3708 } | 3722 } |
3709 | 3723 |
3710 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric) | 3724 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric) |
3711 | 3725 |
3712 private: | 3726 private: |
3713 Handle<String> name_; | 3727 Handle<String> name_; |
3714 bool strict_mode_; | 3728 bool strict_mode_; |
3715 }; | 3729 }; |
3716 | 3730 |
3717 | 3731 |
3718 class HStoreKeyedFastElement: public HTemplateInstruction<3> { | 3732 class HStoreKeyedFastElement: public HTemplateInstruction<3> { |
3719 public: | 3733 public: |
3720 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val) { | 3734 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val, |
| 3735 ElementsKind elements_kind = FAST_ELEMENTS) |
| 3736 : elements_kind_(elements_kind) { |
3721 SetOperandAt(0, obj); | 3737 SetOperandAt(0, obj); |
3722 SetOperandAt(1, key); | 3738 SetOperandAt(1, key); |
3723 SetOperandAt(2, val); | 3739 SetOperandAt(2, val); |
3724 SetFlag(kChangesArrayElements); | 3740 SetFlag(kChangesArrayElements); |
3725 } | 3741 } |
3726 | 3742 |
3727 virtual Representation RequiredInputRepresentation(int index) const { | 3743 virtual Representation RequiredInputRepresentation(int index) { |
3728 // The key is supposed to be Integer32. | 3744 // The key is supposed to be Integer32. |
3729 return index == 1 | 3745 return index == 1 |
3730 ? Representation::Integer32() | 3746 ? Representation::Integer32() |
3731 : Representation::Tagged(); | 3747 : Representation::Tagged(); |
3732 } | 3748 } |
3733 | 3749 |
3734 HValue* object() { return OperandAt(0); } | 3750 HValue* object() { return OperandAt(0); } |
3735 HValue* key() { return OperandAt(1); } | 3751 HValue* key() { return OperandAt(1); } |
3736 HValue* value() { return OperandAt(2); } | 3752 HValue* value() { return OperandAt(2); } |
| 3753 bool value_is_smi() { |
| 3754 return elements_kind_ == FAST_SMI_ONLY_ELEMENTS; |
| 3755 } |
3737 | 3756 |
3738 bool NeedsWriteBarrier() { | 3757 bool NeedsWriteBarrier() { |
3739 return StoringValueNeedsWriteBarrier(value()); | 3758 if (value_is_smi()) { |
| 3759 return false; |
| 3760 } else { |
| 3761 return StoringValueNeedsWriteBarrier(value()); |
| 3762 } |
| 3763 } |
| 3764 |
| 3765 bool ValueNeedsSmiCheck() { |
| 3766 return value_is_smi(); |
3740 } | 3767 } |
3741 | 3768 |
3742 virtual void PrintDataTo(StringStream* stream); | 3769 virtual void PrintDataTo(StringStream* stream); |
3743 | 3770 |
3744 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement) | 3771 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement) |
| 3772 |
| 3773 private: |
| 3774 ElementsKind elements_kind_; |
3745 }; | 3775 }; |
3746 | 3776 |
3747 | 3777 |
3748 class HStoreKeyedFastDoubleElement: public HTemplateInstruction<3> { | 3778 class HStoreKeyedFastDoubleElement: public HTemplateInstruction<3> { |
3749 public: | 3779 public: |
3750 HStoreKeyedFastDoubleElement(HValue* elements, | 3780 HStoreKeyedFastDoubleElement(HValue* elements, |
3751 HValue* key, | 3781 HValue* key, |
3752 HValue* val) { | 3782 HValue* val) { |
3753 SetOperandAt(0, elements); | 3783 SetOperandAt(0, elements); |
3754 SetOperandAt(1, key); | 3784 SetOperandAt(1, key); |
3755 SetOperandAt(2, val); | 3785 SetOperandAt(2, val); |
3756 SetFlag(kChangesDoubleArrayElements); | 3786 SetFlag(kChangesDoubleArrayElements); |
3757 } | 3787 } |
3758 | 3788 |
3759 virtual Representation RequiredInputRepresentation(int index) const { | 3789 virtual Representation RequiredInputRepresentation(int index) { |
3760 if (index == 1) { | 3790 if (index == 1) { |
3761 return Representation::Integer32(); | 3791 return Representation::Integer32(); |
3762 } else if (index == 2) { | 3792 } else if (index == 2) { |
3763 return Representation::Double(); | 3793 return Representation::Double(); |
3764 } else { | 3794 } else { |
3765 return Representation::Tagged(); | 3795 return Representation::Tagged(); |
3766 } | 3796 } |
3767 } | 3797 } |
3768 | 3798 |
3769 HValue* elements() { return OperandAt(0); } | 3799 HValue* elements() { return OperandAt(0); } |
(...skipping 18 matching lines...) Expand all Loading... |
3788 ElementsKind elements_kind) | 3818 ElementsKind elements_kind) |
3789 : elements_kind_(elements_kind) { | 3819 : elements_kind_(elements_kind) { |
3790 SetFlag(kChangesSpecializedArrayElements); | 3820 SetFlag(kChangesSpecializedArrayElements); |
3791 SetOperandAt(0, external_elements); | 3821 SetOperandAt(0, external_elements); |
3792 SetOperandAt(1, key); | 3822 SetOperandAt(1, key); |
3793 SetOperandAt(2, val); | 3823 SetOperandAt(2, val); |
3794 } | 3824 } |
3795 | 3825 |
3796 virtual void PrintDataTo(StringStream* stream); | 3826 virtual void PrintDataTo(StringStream* stream); |
3797 | 3827 |
3798 virtual Representation RequiredInputRepresentation(int index) const { | 3828 virtual Representation RequiredInputRepresentation(int index) { |
3799 if (index == 0) { | 3829 if (index == 0) { |
3800 return Representation::External(); | 3830 return Representation::External(); |
3801 } else { | 3831 } else { |
3802 bool float_or_double_elements = | 3832 bool float_or_double_elements = |
3803 elements_kind() == EXTERNAL_FLOAT_ELEMENTS || | 3833 elements_kind() == EXTERNAL_FLOAT_ELEMENTS || |
3804 elements_kind() == EXTERNAL_DOUBLE_ELEMENTS; | 3834 elements_kind() == EXTERNAL_DOUBLE_ELEMENTS; |
3805 if (index == 2 && float_or_double_elements) { | 3835 if (index == 2 && float_or_double_elements) { |
3806 return Representation::Double(); | 3836 return Representation::Double(); |
3807 } else { | 3837 } else { |
3808 return Representation::Integer32(); | 3838 return Representation::Integer32(); |
(...skipping 27 matching lines...) Expand all Loading... |
3836 SetOperandAt(3, context); | 3866 SetOperandAt(3, context); |
3837 SetAllSideEffects(); | 3867 SetAllSideEffects(); |
3838 } | 3868 } |
3839 | 3869 |
3840 HValue* object() { return OperandAt(0); } | 3870 HValue* object() { return OperandAt(0); } |
3841 HValue* key() { return OperandAt(1); } | 3871 HValue* key() { return OperandAt(1); } |
3842 HValue* value() { return OperandAt(2); } | 3872 HValue* value() { return OperandAt(2); } |
3843 HValue* context() { return OperandAt(3); } | 3873 HValue* context() { return OperandAt(3); } |
3844 bool strict_mode() { return strict_mode_; } | 3874 bool strict_mode() { return strict_mode_; } |
3845 | 3875 |
3846 virtual Representation RequiredInputRepresentation(int index) const { | 3876 virtual Representation RequiredInputRepresentation(int index) { |
3847 return Representation::Tagged(); | 3877 return Representation::Tagged(); |
3848 } | 3878 } |
3849 | 3879 |
3850 virtual void PrintDataTo(StringStream* stream); | 3880 virtual void PrintDataTo(StringStream* stream); |
3851 | 3881 |
3852 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) | 3882 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) |
3853 | 3883 |
3854 private: | 3884 private: |
3855 bool strict_mode_; | 3885 bool strict_mode_; |
3856 }; | 3886 }; |
3857 | 3887 |
3858 | 3888 |
3859 class HStringAdd: public HBinaryOperation { | 3889 class HStringAdd: public HBinaryOperation { |
3860 public: | 3890 public: |
3861 HStringAdd(HValue* context, HValue* left, HValue* right) | 3891 HStringAdd(HValue* context, HValue* left, HValue* right) |
3862 : HBinaryOperation(context, left, right) { | 3892 : HBinaryOperation(context, left, right) { |
3863 set_representation(Representation::Tagged()); | 3893 set_representation(Representation::Tagged()); |
3864 SetFlag(kUseGVN); | 3894 SetFlag(kUseGVN); |
3865 SetFlag(kDependsOnMaps); | 3895 SetFlag(kDependsOnMaps); |
3866 } | 3896 } |
3867 | 3897 |
3868 virtual Representation RequiredInputRepresentation(int index) const { | 3898 virtual Representation RequiredInputRepresentation(int index) { |
3869 return Representation::Tagged(); | 3899 return Representation::Tagged(); |
3870 } | 3900 } |
3871 | 3901 |
3872 virtual HType CalculateInferredType() { | 3902 virtual HType CalculateInferredType() { |
3873 return HType::String(); | 3903 return HType::String(); |
3874 } | 3904 } |
3875 | 3905 |
3876 DECLARE_CONCRETE_INSTRUCTION(StringAdd) | 3906 DECLARE_CONCRETE_INSTRUCTION(StringAdd) |
3877 | 3907 |
3878 protected: | 3908 protected: |
3879 virtual bool DataEquals(HValue* other) { return true; } | 3909 virtual bool DataEquals(HValue* other) { return true; } |
3880 }; | 3910 }; |
3881 | 3911 |
3882 | 3912 |
3883 class HStringCharCodeAt: public HTemplateInstruction<3> { | 3913 class HStringCharCodeAt: public HTemplateInstruction<3> { |
3884 public: | 3914 public: |
3885 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { | 3915 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { |
3886 SetOperandAt(0, context); | 3916 SetOperandAt(0, context); |
3887 SetOperandAt(1, string); | 3917 SetOperandAt(1, string); |
3888 SetOperandAt(2, index); | 3918 SetOperandAt(2, index); |
3889 set_representation(Representation::Integer32()); | 3919 set_representation(Representation::Integer32()); |
3890 SetFlag(kUseGVN); | 3920 SetFlag(kUseGVN); |
3891 SetFlag(kDependsOnMaps); | 3921 SetFlag(kDependsOnMaps); |
3892 } | 3922 } |
3893 | 3923 |
3894 virtual Representation RequiredInputRepresentation(int index) const { | 3924 virtual Representation RequiredInputRepresentation(int index) { |
3895 // The index is supposed to be Integer32. | 3925 // The index is supposed to be Integer32. |
3896 return index == 2 | 3926 return index == 2 |
3897 ? Representation::Integer32() | 3927 ? Representation::Integer32() |
3898 : Representation::Tagged(); | 3928 : Representation::Tagged(); |
3899 } | 3929 } |
3900 | 3930 |
3901 HValue* context() { return OperandAt(0); } | 3931 HValue* context() { return OperandAt(0); } |
3902 HValue* string() { return OperandAt(1); } | 3932 HValue* string() { return OperandAt(1); } |
3903 HValue* index() { return OperandAt(2); } | 3933 HValue* index() { return OperandAt(2); } |
3904 | 3934 |
(...skipping 10 matching lines...) Expand all Loading... |
3915 | 3945 |
3916 class HStringCharFromCode: public HTemplateInstruction<2> { | 3946 class HStringCharFromCode: public HTemplateInstruction<2> { |
3917 public: | 3947 public: |
3918 HStringCharFromCode(HValue* context, HValue* char_code) { | 3948 HStringCharFromCode(HValue* context, HValue* char_code) { |
3919 SetOperandAt(0, context); | 3949 SetOperandAt(0, context); |
3920 SetOperandAt(1, char_code); | 3950 SetOperandAt(1, char_code); |
3921 set_representation(Representation::Tagged()); | 3951 set_representation(Representation::Tagged()); |
3922 SetFlag(kUseGVN); | 3952 SetFlag(kUseGVN); |
3923 } | 3953 } |
3924 | 3954 |
3925 virtual Representation RequiredInputRepresentation(int index) const { | 3955 virtual Representation RequiredInputRepresentation(int index) { |
3926 return index == 0 | 3956 return index == 0 |
3927 ? Representation::Tagged() | 3957 ? Representation::Tagged() |
3928 : Representation::Integer32(); | 3958 : Representation::Integer32(); |
3929 } | 3959 } |
3930 | 3960 |
3931 HValue* context() { return OperandAt(0); } | 3961 HValue* context() { return OperandAt(0); } |
3932 HValue* value() { return OperandAt(1); } | 3962 HValue* value() { return OperandAt(1); } |
3933 | 3963 |
3934 virtual bool DataEquals(HValue* other) { return true; } | 3964 virtual bool DataEquals(HValue* other) { return true; } |
3935 | 3965 |
3936 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) | 3966 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) |
3937 }; | 3967 }; |
3938 | 3968 |
3939 | 3969 |
3940 class HStringLength: public HUnaryOperation { | 3970 class HStringLength: public HUnaryOperation { |
3941 public: | 3971 public: |
3942 explicit HStringLength(HValue* string) : HUnaryOperation(string) { | 3972 explicit HStringLength(HValue* string) : HUnaryOperation(string) { |
3943 set_representation(Representation::Tagged()); | 3973 set_representation(Representation::Tagged()); |
3944 SetFlag(kUseGVN); | 3974 SetFlag(kUseGVN); |
3945 SetFlag(kDependsOnMaps); | 3975 SetFlag(kDependsOnMaps); |
3946 } | 3976 } |
3947 | 3977 |
3948 virtual Representation RequiredInputRepresentation(int index) const { | 3978 virtual Representation RequiredInputRepresentation(int index) { |
3949 return Representation::Tagged(); | 3979 return Representation::Tagged(); |
3950 } | 3980 } |
3951 | 3981 |
3952 virtual HType CalculateInferredType() { | 3982 virtual HType CalculateInferredType() { |
3953 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); | 3983 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); |
3954 return HType::Smi(); | 3984 return HType::Smi(); |
3955 } | 3985 } |
3956 | 3986 |
3957 DECLARE_CONCRETE_INSTRUCTION(StringLength) | 3987 DECLARE_CONCRETE_INSTRUCTION(StringLength) |
3958 | 3988 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3994 constant_elements_(constant_elements) { | 4024 constant_elements_(constant_elements) { |
3995 SetOperandAt(0, context); | 4025 SetOperandAt(0, context); |
3996 } | 4026 } |
3997 | 4027 |
3998 HValue* context() { return OperandAt(0); } | 4028 HValue* context() { return OperandAt(0); } |
3999 Handle<FixedArray> constant_elements() const { return constant_elements_; } | 4029 Handle<FixedArray> constant_elements() const { return constant_elements_; } |
4000 int length() const { return length_; } | 4030 int length() const { return length_; } |
4001 | 4031 |
4002 bool IsCopyOnWrite() const; | 4032 bool IsCopyOnWrite() const; |
4003 | 4033 |
4004 virtual Representation RequiredInputRepresentation(int index) const { | 4034 virtual Representation RequiredInputRepresentation(int index) { |
4005 return Representation::Tagged(); | 4035 return Representation::Tagged(); |
4006 } | 4036 } |
4007 | 4037 |
4008 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral) | 4038 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral) |
4009 | 4039 |
4010 private: | 4040 private: |
4011 int length_; | 4041 int length_; |
4012 Handle<FixedArray> constant_elements_; | 4042 Handle<FixedArray> constant_elements_; |
4013 }; | 4043 }; |
4014 | 4044 |
(...skipping 13 matching lines...) Expand all Loading... |
4028 SetOperandAt(0, context); | 4058 SetOperandAt(0, context); |
4029 } | 4059 } |
4030 | 4060 |
4031 HValue* context() { return OperandAt(0); } | 4061 HValue* context() { return OperandAt(0); } |
4032 Handle<FixedArray> constant_properties() const { | 4062 Handle<FixedArray> constant_properties() const { |
4033 return constant_properties_; | 4063 return constant_properties_; |
4034 } | 4064 } |
4035 bool fast_elements() const { return fast_elements_; } | 4065 bool fast_elements() const { return fast_elements_; } |
4036 bool has_function() const { return has_function_; } | 4066 bool has_function() const { return has_function_; } |
4037 | 4067 |
4038 virtual Representation RequiredInputRepresentation(int index) const { | 4068 virtual Representation RequiredInputRepresentation(int index) { |
4039 return Representation::Tagged(); | 4069 return Representation::Tagged(); |
4040 } | 4070 } |
4041 | 4071 |
4042 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral) | 4072 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral) |
4043 | 4073 |
4044 private: | 4074 private: |
4045 Handle<FixedArray> constant_properties_; | 4075 Handle<FixedArray> constant_properties_; |
4046 bool fast_elements_; | 4076 bool fast_elements_; |
4047 bool has_function_; | 4077 bool has_function_; |
4048 }; | 4078 }; |
4049 | 4079 |
4050 | 4080 |
4051 class HRegExpLiteral: public HMaterializedLiteral<1> { | 4081 class HRegExpLiteral: public HMaterializedLiteral<1> { |
4052 public: | 4082 public: |
4053 HRegExpLiteral(HValue* context, | 4083 HRegExpLiteral(HValue* context, |
4054 Handle<String> pattern, | 4084 Handle<String> pattern, |
4055 Handle<String> flags, | 4085 Handle<String> flags, |
4056 int literal_index) | 4086 int literal_index) |
4057 : HMaterializedLiteral<1>(literal_index, 0), | 4087 : HMaterializedLiteral<1>(literal_index, 0), |
4058 pattern_(pattern), | 4088 pattern_(pattern), |
4059 flags_(flags) { | 4089 flags_(flags) { |
4060 SetOperandAt(0, context); | 4090 SetOperandAt(0, context); |
4061 } | 4091 } |
4062 | 4092 |
4063 HValue* context() { return OperandAt(0); } | 4093 HValue* context() { return OperandAt(0); } |
4064 Handle<String> pattern() { return pattern_; } | 4094 Handle<String> pattern() { return pattern_; } |
4065 Handle<String> flags() { return flags_; } | 4095 Handle<String> flags() { return flags_; } |
4066 | 4096 |
4067 virtual Representation RequiredInputRepresentation(int index) const { | 4097 virtual Representation RequiredInputRepresentation(int index) { |
4068 return Representation::Tagged(); | 4098 return Representation::Tagged(); |
4069 } | 4099 } |
4070 | 4100 |
4071 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) | 4101 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) |
4072 | 4102 |
4073 private: | 4103 private: |
4074 Handle<String> pattern_; | 4104 Handle<String> pattern_; |
4075 Handle<String> flags_; | 4105 Handle<String> flags_; |
4076 }; | 4106 }; |
4077 | 4107 |
4078 | 4108 |
4079 class HFunctionLiteral: public HTemplateInstruction<1> { | 4109 class HFunctionLiteral: public HTemplateInstruction<1> { |
4080 public: | 4110 public: |
4081 HFunctionLiteral(HValue* context, | 4111 HFunctionLiteral(HValue* context, |
4082 Handle<SharedFunctionInfo> shared, | 4112 Handle<SharedFunctionInfo> shared, |
4083 bool pretenure) | 4113 bool pretenure) |
4084 : shared_info_(shared), pretenure_(pretenure) { | 4114 : shared_info_(shared), pretenure_(pretenure) { |
4085 SetOperandAt(0, context); | 4115 SetOperandAt(0, context); |
4086 set_representation(Representation::Tagged()); | 4116 set_representation(Representation::Tagged()); |
4087 } | 4117 } |
4088 | 4118 |
4089 HValue* context() { return OperandAt(0); } | 4119 HValue* context() { return OperandAt(0); } |
4090 | 4120 |
4091 virtual Representation RequiredInputRepresentation(int index) const { | 4121 virtual Representation RequiredInputRepresentation(int index) { |
4092 return Representation::Tagged(); | 4122 return Representation::Tagged(); |
4093 } | 4123 } |
4094 | 4124 |
4095 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) | 4125 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) |
4096 | 4126 |
4097 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } | 4127 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } |
4098 bool pretenure() const { return pretenure_; } | 4128 bool pretenure() const { return pretenure_; } |
4099 | 4129 |
4100 private: | 4130 private: |
4101 Handle<SharedFunctionInfo> shared_info_; | 4131 Handle<SharedFunctionInfo> shared_info_; |
4102 bool pretenure_; | 4132 bool pretenure_; |
4103 }; | 4133 }; |
4104 | 4134 |
4105 | 4135 |
4106 class HTypeof: public HTemplateInstruction<2> { | 4136 class HTypeof: public HTemplateInstruction<2> { |
4107 public: | 4137 public: |
4108 explicit HTypeof(HValue* context, HValue* value) { | 4138 explicit HTypeof(HValue* context, HValue* value) { |
4109 SetOperandAt(0, context); | 4139 SetOperandAt(0, context); |
4110 SetOperandAt(1, value); | 4140 SetOperandAt(1, value); |
4111 set_representation(Representation::Tagged()); | 4141 set_representation(Representation::Tagged()); |
4112 } | 4142 } |
4113 | 4143 |
4114 HValue* context() { return OperandAt(0); } | 4144 HValue* context() { return OperandAt(0); } |
4115 HValue* value() { return OperandAt(1); } | 4145 HValue* value() { return OperandAt(1); } |
4116 | 4146 |
4117 virtual Representation RequiredInputRepresentation(int index) const { | 4147 virtual void PrintDataTo(StringStream* stream); |
| 4148 |
| 4149 virtual Representation RequiredInputRepresentation(int index) { |
4118 return Representation::Tagged(); | 4150 return Representation::Tagged(); |
4119 } | 4151 } |
4120 | 4152 |
4121 DECLARE_CONCRETE_INSTRUCTION(Typeof) | 4153 DECLARE_CONCRETE_INSTRUCTION(Typeof) |
4122 }; | 4154 }; |
4123 | 4155 |
4124 | 4156 |
4125 class HToFastProperties: public HUnaryOperation { | 4157 class HToFastProperties: public HUnaryOperation { |
4126 public: | 4158 public: |
4127 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { | 4159 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { |
4128 // This instruction is not marked as having side effects, but | 4160 // This instruction is not marked as having side effects, but |
4129 // changes the map of the input operand. Use it only when creating | 4161 // changes the map of the input operand. Use it only when creating |
4130 // object literals. | 4162 // object literals. |
4131 ASSERT(value->IsObjectLiteral()); | 4163 ASSERT(value->IsObjectLiteral()); |
4132 set_representation(Representation::Tagged()); | 4164 set_representation(Representation::Tagged()); |
4133 } | 4165 } |
4134 | 4166 |
4135 virtual Representation RequiredInputRepresentation(int index) const { | 4167 virtual Representation RequiredInputRepresentation(int index) { |
4136 return Representation::Tagged(); | 4168 return Representation::Tagged(); |
4137 } | 4169 } |
4138 | 4170 |
4139 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) | 4171 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) |
4140 }; | 4172 }; |
4141 | 4173 |
4142 | 4174 |
4143 class HValueOf: public HUnaryOperation { | 4175 class HValueOf: public HUnaryOperation { |
4144 public: | 4176 public: |
4145 explicit HValueOf(HValue* value) : HUnaryOperation(value) { | 4177 explicit HValueOf(HValue* value) : HUnaryOperation(value) { |
4146 set_representation(Representation::Tagged()); | 4178 set_representation(Representation::Tagged()); |
4147 } | 4179 } |
4148 | 4180 |
4149 virtual Representation RequiredInputRepresentation(int index) const { | 4181 virtual Representation RequiredInputRepresentation(int index) { |
4150 return Representation::Tagged(); | 4182 return Representation::Tagged(); |
4151 } | 4183 } |
4152 | 4184 |
4153 DECLARE_CONCRETE_INSTRUCTION(ValueOf) | 4185 DECLARE_CONCRETE_INSTRUCTION(ValueOf) |
4154 }; | 4186 }; |
4155 | 4187 |
4156 | 4188 |
4157 class HDeleteProperty: public HBinaryOperation { | 4189 class HDeleteProperty: public HBinaryOperation { |
4158 public: | 4190 public: |
4159 HDeleteProperty(HValue* context, HValue* obj, HValue* key) | 4191 HDeleteProperty(HValue* context, HValue* obj, HValue* key) |
4160 : HBinaryOperation(context, obj, key) { | 4192 : HBinaryOperation(context, obj, key) { |
4161 set_representation(Representation::Tagged()); | 4193 set_representation(Representation::Tagged()); |
4162 SetAllSideEffects(); | 4194 SetAllSideEffects(); |
4163 } | 4195 } |
4164 | 4196 |
4165 virtual Representation RequiredInputRepresentation(int index) const { | 4197 virtual Representation RequiredInputRepresentation(int index) { |
4166 return Representation::Tagged(); | 4198 return Representation::Tagged(); |
4167 } | 4199 } |
4168 | 4200 |
4169 virtual HType CalculateInferredType(); | 4201 virtual HType CalculateInferredType(); |
4170 | 4202 |
4171 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty) | 4203 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty) |
4172 | 4204 |
4173 HValue* object() { return left(); } | 4205 HValue* object() { return left(); } |
4174 HValue* key() { return right(); } | 4206 HValue* key() { return right(); } |
4175 }; | 4207 }; |
4176 | 4208 |
4177 | 4209 |
4178 class HIn: public HTemplateInstruction<3> { | 4210 class HIn: public HTemplateInstruction<3> { |
4179 public: | 4211 public: |
4180 HIn(HValue* context, HValue* key, HValue* object) { | 4212 HIn(HValue* context, HValue* key, HValue* object) { |
4181 SetOperandAt(0, context); | 4213 SetOperandAt(0, context); |
4182 SetOperandAt(1, key); | 4214 SetOperandAt(1, key); |
4183 SetOperandAt(2, object); | 4215 SetOperandAt(2, object); |
4184 set_representation(Representation::Tagged()); | 4216 set_representation(Representation::Tagged()); |
4185 SetAllSideEffects(); | 4217 SetAllSideEffects(); |
4186 } | 4218 } |
4187 | 4219 |
4188 HValue* context() { return OperandAt(0); } | 4220 HValue* context() { return OperandAt(0); } |
4189 HValue* key() { return OperandAt(1); } | 4221 HValue* key() { return OperandAt(1); } |
4190 HValue* object() { return OperandAt(2); } | 4222 HValue* object() { return OperandAt(2); } |
4191 | 4223 |
4192 virtual Representation RequiredInputRepresentation(int index) const { | 4224 virtual Representation RequiredInputRepresentation(int index) { |
4193 return Representation::Tagged(); | 4225 return Representation::Tagged(); |
4194 } | 4226 } |
4195 | 4227 |
4196 virtual HType CalculateInferredType() { | 4228 virtual HType CalculateInferredType() { |
4197 return HType::Boolean(); | 4229 return HType::Boolean(); |
4198 } | 4230 } |
4199 | 4231 |
4200 virtual void PrintDataTo(StringStream* stream); | 4232 virtual void PrintDataTo(StringStream* stream); |
4201 | 4233 |
4202 DECLARE_CONCRETE_INSTRUCTION(In) | 4234 DECLARE_CONCRETE_INSTRUCTION(In) |
4203 }; | 4235 }; |
4204 | 4236 |
4205 #undef DECLARE_INSTRUCTION | 4237 #undef DECLARE_INSTRUCTION |
4206 #undef DECLARE_CONCRETE_INSTRUCTION | 4238 #undef DECLARE_CONCRETE_INSTRUCTION |
4207 | 4239 |
4208 } } // namespace v8::internal | 4240 } } // namespace v8::internal |
4209 | 4241 |
4210 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4242 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |