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

Side by Side Diff: src/hydrogen-instructions.h

Issue 8066007: Small simplification of HChange instruction. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 24 matching lines...) Expand all
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
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
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
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
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
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
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
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
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
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 21 matching lines...) Expand all
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 void PrintDataTo(StringStream* stream); 1972 virtual void PrintDataTo(StringStream* stream);
1982 1973
1983 virtual Representation RequiredInputRepresentation(int index) const { 1974 virtual Representation RequiredInputRepresentation(int index) {
1984 return Representation::Tagged(); 1975 return Representation::Tagged();
1985 } 1976 }
1986 1977
1987 virtual HValue* Canonicalize(); 1978 virtual HValue* Canonicalize();
1988 1979
1989 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } 1980 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; }
1990 void GetCheckInterval(InstanceType* first, InstanceType* last); 1981 void GetCheckInterval(InstanceType* first, InstanceType* last);
1991 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); 1982 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag);
1992 1983
1993 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) 1984 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType)
(...skipping 28 matching lines...) Expand all
2022 }; 2013 };
2023 2014
2024 2015
2025 class HCheckNonSmi: public HUnaryOperation { 2016 class HCheckNonSmi: public HUnaryOperation {
2026 public: 2017 public:
2027 explicit HCheckNonSmi(HValue* value) : HUnaryOperation(value) { 2018 explicit HCheckNonSmi(HValue* value) : HUnaryOperation(value) {
2028 set_representation(Representation::Tagged()); 2019 set_representation(Representation::Tagged());
2029 SetFlag(kUseGVN); 2020 SetFlag(kUseGVN);
2030 } 2021 }
2031 2022
2032 virtual Representation RequiredInputRepresentation(int index) const { 2023 virtual Representation RequiredInputRepresentation(int index) {
2033 return Representation::Tagged(); 2024 return Representation::Tagged();
2034 } 2025 }
2035 2026
2036 virtual HType CalculateInferredType(); 2027 virtual HType CalculateInferredType();
2037 2028
2038 #ifdef DEBUG 2029 #ifdef DEBUG
2039 virtual void Verify(); 2030 virtual void Verify();
2040 #endif 2031 #endif
2041 2032
2042 virtual HValue* Canonicalize() { 2033 virtual HValue* Canonicalize() {
(...skipping 25 matching lines...) Expand all
2068 2059
2069 #ifdef DEBUG 2060 #ifdef DEBUG
2070 virtual void Verify(); 2061 virtual void Verify();
2071 #endif 2062 #endif
2072 2063
2073 Handle<JSObject> prototype() const { return prototype_; } 2064 Handle<JSObject> prototype() const { return prototype_; }
2074 Handle<JSObject> holder() const { return holder_; } 2065 Handle<JSObject> holder() const { return holder_; }
2075 2066
2076 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps) 2067 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps)
2077 2068
2078 virtual Representation RequiredInputRepresentation(int index) const { 2069 virtual Representation RequiredInputRepresentation(int index) {
2079 return Representation::None(); 2070 return Representation::None();
2080 } 2071 }
2081 2072
2082 virtual intptr_t Hashcode() { 2073 virtual intptr_t Hashcode() {
2083 ASSERT(!HEAP->IsAllocationAllowed()); 2074 ASSERT(!HEAP->IsAllocationAllowed());
2084 intptr_t hash = reinterpret_cast<intptr_t>(*prototype()); 2075 intptr_t hash = reinterpret_cast<intptr_t>(*prototype());
2085 hash = 17 * hash + reinterpret_cast<intptr_t>(*holder()); 2076 hash = 17 * hash + reinterpret_cast<intptr_t>(*holder());
2086 return hash; 2077 return hash;
2087 } 2078 }
2088 2079
(...skipping 10 matching lines...) Expand all
2099 }; 2090 };
2100 2091
2101 2092
2102 class HCheckSmi: public HUnaryOperation { 2093 class HCheckSmi: public HUnaryOperation {
2103 public: 2094 public:
2104 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { 2095 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) {
2105 set_representation(Representation::Tagged()); 2096 set_representation(Representation::Tagged());
2106 SetFlag(kUseGVN); 2097 SetFlag(kUseGVN);
2107 } 2098 }
2108 2099
2109 virtual Representation RequiredInputRepresentation(int index) const { 2100 virtual Representation RequiredInputRepresentation(int index) {
2110 return Representation::Tagged(); 2101 return Representation::Tagged();
2111 } 2102 }
2112 virtual HType CalculateInferredType(); 2103 virtual HType CalculateInferredType();
2113 2104
2114 #ifdef DEBUG 2105 #ifdef DEBUG
2115 virtual void Verify(); 2106 virtual void Verify();
2116 #endif 2107 #endif
2117 2108
2118 DECLARE_CONCRETE_INSTRUCTION(CheckSmi) 2109 DECLARE_CONCRETE_INSTRUCTION(CheckSmi)
2119 2110
(...skipping 28 matching lines...) Expand all
2148 if (value->representation().IsInteger32()) int32_occurred = true; 2139 if (value->representation().IsInteger32()) int32_occurred = true;
2149 if (value->representation().IsTagged()) return Representation::Tagged(); 2140 if (value->representation().IsTagged()) return Representation::Tagged();
2150 } 2141 }
2151 2142
2152 if (double_occurred) return Representation::Double(); 2143 if (double_occurred) return Representation::Double();
2153 if (int32_occurred) return Representation::Integer32(); 2144 if (int32_occurred) return Representation::Integer32();
2154 return Representation::None(); 2145 return Representation::None();
2155 } 2146 }
2156 2147
2157 virtual Range* InferRange(); 2148 virtual Range* InferRange();
2158 virtual Representation RequiredInputRepresentation(int index) const { 2149 virtual Representation RequiredInputRepresentation(int index) {
2159 return representation(); 2150 return representation();
2160 } 2151 }
2161 virtual HType CalculateInferredType(); 2152 virtual HType CalculateInferredType();
2162 virtual int OperandCount() { return inputs_.length(); } 2153 virtual int OperandCount() { return inputs_.length(); }
2163 virtual HValue* OperandAt(int index) { return inputs_[index]; } 2154 virtual HValue* OperandAt(int index) { return inputs_[index]; }
2164 HValue* GetRedundantReplacement(); 2155 HValue* GetRedundantReplacement();
2165 void AddInput(HValue* value); 2156 void AddInput(HValue* value);
2166 bool HasRealUses(); 2157 bool HasRealUses();
2167 2158
2168 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
2240 }; 2231 };
2241 2232
2242 2233
2243 class HArgumentsObject: public HTemplateInstruction<0> { 2234 class HArgumentsObject: public HTemplateInstruction<0> {
2244 public: 2235 public:
2245 HArgumentsObject() { 2236 HArgumentsObject() {
2246 set_representation(Representation::Tagged()); 2237 set_representation(Representation::Tagged());
2247 SetFlag(kIsArguments); 2238 SetFlag(kIsArguments);
2248 } 2239 }
2249 2240
2250 virtual Representation RequiredInputRepresentation(int index) const { 2241 virtual Representation RequiredInputRepresentation(int index) {
2251 return Representation::None(); 2242 return Representation::None();
2252 } 2243 }
2253 2244
2254 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) 2245 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject)
2255 }; 2246 };
2256 2247
2257 2248
2258 class HConstant: public HTemplateInstruction<0> { 2249 class HConstant: public HTemplateInstruction<0> {
2259 public: 2250 public:
2260 HConstant(Handle<Object> handle, Representation r); 2251 HConstant(Handle<Object> handle, Representation r);
2261 2252
2262 Handle<Object> handle() const { return handle_; } 2253 Handle<Object> handle() const { return handle_; }
2263 2254
2264 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } 2255 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); }
2265 2256
2266 bool ImmortalImmovable() const { 2257 bool ImmortalImmovable() const {
2267 Heap* heap = HEAP; 2258 Heap* heap = HEAP;
2268 if (*handle_ == heap->undefined_value()) return true; 2259 if (*handle_ == heap->undefined_value()) return true;
2269 if (*handle_ == heap->null_value()) return true; 2260 if (*handle_ == heap->null_value()) return true;
2270 if (*handle_ == heap->true_value()) return true; 2261 if (*handle_ == heap->true_value()) return true;
2271 if (*handle_ == heap->false_value()) return true; 2262 if (*handle_ == heap->false_value()) return true;
2272 if (*handle_ == heap->the_hole_value()) return true; 2263 if (*handle_ == heap->the_hole_value()) return true;
2273 if (*handle_ == heap->minus_zero_value()) return true; 2264 if (*handle_ == heap->minus_zero_value()) return true;
2274 if (*handle_ == heap->nan_value()) return true; 2265 if (*handle_ == heap->nan_value()) return true;
2275 if (*handle_ == heap->empty_string()) return true; 2266 if (*handle_ == heap->empty_string()) return true;
2276 return false; 2267 return false;
2277 } 2268 }
2278 2269
2279 virtual Representation RequiredInputRepresentation(int index) const { 2270 virtual Representation RequiredInputRepresentation(int index) {
2280 return Representation::None(); 2271 return Representation::None();
2281 } 2272 }
2282 2273
2283 virtual bool IsConvertibleToInteger() const { 2274 virtual bool IsConvertibleToInteger() const {
2284 if (handle_->IsSmi()) return true; 2275 if (handle_->IsSmi()) return true;
2285 if (handle_->IsHeapNumber() && 2276 if (handle_->IsHeapNumber() &&
2286 (HeapNumber::cast(*handle_)->value() == 2277 (HeapNumber::cast(*handle_)->value() ==
2287 static_cast<double>(NumberToInt32(*handle_)))) return true; 2278 static_cast<double>(NumberToInt32(*handle_)))) return true;
2288 return false; 2279 return false;
2289 } 2280 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 HValue* length, 2368 HValue* length,
2378 HValue* elements) { 2369 HValue* elements) {
2379 set_representation(Representation::Tagged()); 2370 set_representation(Representation::Tagged());
2380 SetOperandAt(0, function); 2371 SetOperandAt(0, function);
2381 SetOperandAt(1, receiver); 2372 SetOperandAt(1, receiver);
2382 SetOperandAt(2, length); 2373 SetOperandAt(2, length);
2383 SetOperandAt(3, elements); 2374 SetOperandAt(3, elements);
2384 SetAllSideEffects(); 2375 SetAllSideEffects();
2385 } 2376 }
2386 2377
2387 virtual Representation RequiredInputRepresentation(int index) const { 2378 virtual Representation RequiredInputRepresentation(int index) {
2388 // The length is untagged, all other inputs are tagged. 2379 // The length is untagged, all other inputs are tagged.
2389 return (index == 2) 2380 return (index == 2)
2390 ? Representation::Integer32() 2381 ? Representation::Integer32()
2391 : Representation::Tagged(); 2382 : Representation::Tagged();
2392 } 2383 }
2393 2384
2394 HValue* function() { return OperandAt(0); } 2385 HValue* function() { return OperandAt(0); }
2395 HValue* receiver() { return OperandAt(1); } 2386 HValue* receiver() { return OperandAt(1); }
2396 HValue* length() { return OperandAt(2); } 2387 HValue* length() { return OperandAt(2); }
2397 HValue* elements() { return OperandAt(3); } 2388 HValue* elements() { return OperandAt(3); }
2398 2389
2399 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments) 2390 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments)
2400 }; 2391 };
2401 2392
2402 2393
2403 class HArgumentsElements: public HTemplateInstruction<0> { 2394 class HArgumentsElements: public HTemplateInstruction<0> {
2404 public: 2395 public:
2405 HArgumentsElements() { 2396 HArgumentsElements() {
2406 // 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
2407 // that looks as if it was a smi because of alignment. 2398 // that looks as if it was a smi because of alignment.
2408 set_representation(Representation::Tagged()); 2399 set_representation(Representation::Tagged());
2409 SetFlag(kUseGVN); 2400 SetFlag(kUseGVN);
2410 } 2401 }
2411 2402
2412 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements) 2403 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements)
2413 2404
2414 virtual Representation RequiredInputRepresentation(int index) const { 2405 virtual Representation RequiredInputRepresentation(int index) {
2415 return Representation::None(); 2406 return Representation::None();
2416 } 2407 }
2417 2408
2418 protected: 2409 protected:
2419 virtual bool DataEquals(HValue* other) { return true; } 2410 virtual bool DataEquals(HValue* other) { return true; }
2420 }; 2411 };
2421 2412
2422 2413
2423 class HArgumentsLength: public HUnaryOperation { 2414 class HArgumentsLength: public HUnaryOperation {
2424 public: 2415 public:
2425 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { 2416 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) {
2426 set_representation(Representation::Integer32()); 2417 set_representation(Representation::Integer32());
2427 SetFlag(kUseGVN); 2418 SetFlag(kUseGVN);
2428 } 2419 }
2429 2420
2430 virtual Representation RequiredInputRepresentation(int index) const { 2421 virtual Representation RequiredInputRepresentation(int index) {
2431 return Representation::Tagged(); 2422 return Representation::Tagged();
2432 } 2423 }
2433 2424
2434 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength) 2425 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength)
2435 2426
2436 protected: 2427 protected:
2437 virtual bool DataEquals(HValue* other) { return true; } 2428 virtual bool DataEquals(HValue* other) { return true; }
2438 }; 2429 };
2439 2430
2440 2431
2441 class HAccessArgumentsAt: public HTemplateInstruction<3> { 2432 class HAccessArgumentsAt: public HTemplateInstruction<3> {
2442 public: 2433 public:
2443 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { 2434 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) {
2444 set_representation(Representation::Tagged()); 2435 set_representation(Representation::Tagged());
2445 SetFlag(kUseGVN); 2436 SetFlag(kUseGVN);
2446 SetOperandAt(0, arguments); 2437 SetOperandAt(0, arguments);
2447 SetOperandAt(1, length); 2438 SetOperandAt(1, length);
2448 SetOperandAt(2, index); 2439 SetOperandAt(2, index);
2449 } 2440 }
2450 2441
2451 virtual void PrintDataTo(StringStream* stream); 2442 virtual void PrintDataTo(StringStream* stream);
2452 2443
2453 virtual Representation RequiredInputRepresentation(int index) const { 2444 virtual Representation RequiredInputRepresentation(int index) {
2454 // The arguments elements is considered tagged. 2445 // The arguments elements is considered tagged.
2455 return index == 0 2446 return index == 0
2456 ? Representation::Tagged() 2447 ? Representation::Tagged()
2457 : Representation::Integer32(); 2448 : Representation::Integer32();
2458 } 2449 }
2459 2450
2460 HValue* arguments() { return OperandAt(0); } 2451 HValue* arguments() { return OperandAt(0); }
2461 HValue* length() { return OperandAt(1); } 2452 HValue* length() { return OperandAt(1); }
2462 HValue* index() { return OperandAt(2); } 2453 HValue* index() { return OperandAt(2); }
2463 2454
2464 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) 2455 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt)
2465 2456
2466 virtual bool DataEquals(HValue* other) { return true; } 2457 virtual bool DataEquals(HValue* other) { return true; }
2467 }; 2458 };
2468 2459
2469 2460
2470 class HBoundsCheck: public HTemplateInstruction<2> { 2461 class HBoundsCheck: public HTemplateInstruction<2> {
2471 public: 2462 public:
2472 HBoundsCheck(HValue* index, HValue* length) { 2463 HBoundsCheck(HValue* index, HValue* length) {
2473 SetOperandAt(0, index); 2464 SetOperandAt(0, index);
2474 SetOperandAt(1, length); 2465 SetOperandAt(1, length);
2475 set_representation(Representation::Integer32()); 2466 set_representation(Representation::Integer32());
2476 SetFlag(kUseGVN); 2467 SetFlag(kUseGVN);
2477 } 2468 }
2478 2469
2479 virtual Representation RequiredInputRepresentation(int index) const { 2470 virtual Representation RequiredInputRepresentation(int index) {
2480 return Representation::Integer32(); 2471 return Representation::Integer32();
2481 } 2472 }
2482 2473
2483 virtual void PrintDataTo(StringStream* stream); 2474 virtual void PrintDataTo(StringStream* stream);
2484 2475
2485 HValue* index() { return OperandAt(0); } 2476 HValue* index() { return OperandAt(0); }
2486 HValue* length() { return OperandAt(1); } 2477 HValue* length() { return OperandAt(1); }
2487 2478
2488 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) 2479 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck)
2489 2480
2490 protected: 2481 protected:
2491 virtual bool DataEquals(HValue* other) { return true; } 2482 virtual bool DataEquals(HValue* other) { return true; }
2492 }; 2483 };
2493 2484
2494 2485
2495 class HBitwiseBinaryOperation: public HBinaryOperation { 2486 class HBitwiseBinaryOperation: public HBinaryOperation {
2496 public: 2487 public:
2497 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right) 2488 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right)
2498 : HBinaryOperation(context, left, right) { 2489 : HBinaryOperation(context, left, right) {
2499 set_representation(Representation::Tagged()); 2490 set_representation(Representation::Tagged());
2500 SetFlag(kFlexibleRepresentation); 2491 SetFlag(kFlexibleRepresentation);
2501 SetAllSideEffects(); 2492 SetAllSideEffects();
2502 } 2493 }
2503 2494
2504 virtual Representation RequiredInputRepresentation(int index) const { 2495 virtual Representation RequiredInputRepresentation(int index) {
2505 return index == 0 2496 return index == 0
2506 ? Representation::Tagged() 2497 ? Representation::Tagged()
2507 : representation(); 2498 : representation();
2508 } 2499 }
2509 2500
2510 virtual void RepresentationChanged(Representation to) { 2501 virtual void RepresentationChanged(Representation to) {
2511 if (!to.IsTagged()) { 2502 if (!to.IsTagged()) {
2512 ASSERT(to.IsInteger32()); 2503 ASSERT(to.IsInteger32());
2513 ClearAllSideEffects(); 2504 ClearAllSideEffects();
2514 SetFlag(kTruncatingToInt32); 2505 SetFlag(kTruncatingToInt32);
(...skipping 17 matching lines...) Expand all
2532 } 2523 }
2533 2524
2534 virtual void RepresentationChanged(Representation to) { 2525 virtual void RepresentationChanged(Representation to) {
2535 if (!to.IsTagged()) { 2526 if (!to.IsTagged()) {
2536 ClearAllSideEffects(); 2527 ClearAllSideEffects();
2537 SetFlag(kUseGVN); 2528 SetFlag(kUseGVN);
2538 } 2529 }
2539 } 2530 }
2540 2531
2541 virtual HType CalculateInferredType(); 2532 virtual HType CalculateInferredType();
2542 virtual Representation RequiredInputRepresentation(int index) const { 2533 virtual Representation RequiredInputRepresentation(int index) {
2543 return index == 0 2534 return index == 0
2544 ? Representation::Tagged() 2535 ? Representation::Tagged()
2545 : representation(); 2536 : representation();
2546 } 2537 }
2547 2538
2548 virtual Representation InferredRepresentation() { 2539 virtual Representation InferredRepresentation() {
2549 if (left()->representation().Equals(right()->representation())) { 2540 if (left()->representation().Equals(right()->representation())) {
2550 return left()->representation(); 2541 return left()->representation();
2551 } 2542 }
2552 return HValue::InferredRepresentation(); 2543 return HValue::InferredRepresentation();
2553 } 2544 }
2554 }; 2545 };
2555 2546
2556 2547
2557 class HCompareGeneric: public HBinaryOperation { 2548 class HCompareGeneric: public HBinaryOperation {
2558 public: 2549 public:
2559 HCompareGeneric(HValue* context, 2550 HCompareGeneric(HValue* context,
2560 HValue* left, 2551 HValue* left,
2561 HValue* right, 2552 HValue* right,
2562 Token::Value token) 2553 Token::Value token)
2563 : HBinaryOperation(context, left, right), token_(token) { 2554 : HBinaryOperation(context, left, right), token_(token) {
2564 ASSERT(Token::IsCompareOp(token)); 2555 ASSERT(Token::IsCompareOp(token));
2565 set_representation(Representation::Tagged()); 2556 set_representation(Representation::Tagged());
2566 SetAllSideEffects(); 2557 SetAllSideEffects();
2567 } 2558 }
2568 2559
2569 virtual Representation RequiredInputRepresentation(int index) const { 2560 virtual Representation RequiredInputRepresentation(int index) {
2570 return Representation::Tagged(); 2561 return Representation::Tagged();
2571 } 2562 }
2572 2563
2573 Representation GetInputRepresentation() const { 2564 Representation GetInputRepresentation() const {
2574 return Representation::Tagged(); 2565 return Representation::Tagged();
2575 } 2566 }
2576 2567
2577 Token::Value token() const { return token_; } 2568 Token::Value token() const { return token_; }
2578 virtual void PrintDataTo(StringStream* stream); 2569 virtual void PrintDataTo(StringStream* stream);
2579 2570
(...skipping 17 matching lines...) Expand all
2597 2588
2598 HValue* left() { return OperandAt(0); } 2589 HValue* left() { return OperandAt(0); }
2599 HValue* right() { return OperandAt(1); } 2590 HValue* right() { return OperandAt(1); }
2600 Token::Value token() const { return token_; } 2591 Token::Value token() const { return token_; }
2601 2592
2602 void SetInputRepresentation(Representation r); 2593 void SetInputRepresentation(Representation r);
2603 Representation GetInputRepresentation() const { 2594 Representation GetInputRepresentation() const {
2604 return input_representation_; 2595 return input_representation_;
2605 } 2596 }
2606 2597
2607 virtual Representation RequiredInputRepresentation(int index) const { 2598 virtual Representation RequiredInputRepresentation(int index) {
2608 return input_representation_; 2599 return input_representation_;
2609 } 2600 }
2610 virtual void PrintDataTo(StringStream* stream); 2601 virtual void PrintDataTo(StringStream* stream);
2611 2602
2612 DECLARE_CONCRETE_INSTRUCTION(CompareIDAndBranch) 2603 DECLARE_CONCRETE_INSTRUCTION(CompareIDAndBranch)
2613 2604
2614 private: 2605 private:
2615 Representation input_representation_; 2606 Representation input_representation_;
2616 Token::Value token_; 2607 Token::Value token_;
2617 }; 2608 };
2618 2609
2619 2610
2620 class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> { 2611 class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> {
2621 public: 2612 public:
2622 HCompareObjectEqAndBranch(HValue* left, HValue* right) { 2613 HCompareObjectEqAndBranch(HValue* left, HValue* right) {
2623 SetOperandAt(0, left); 2614 SetOperandAt(0, left);
2624 SetOperandAt(1, right); 2615 SetOperandAt(1, right);
2625 } 2616 }
2626 2617
2627 HValue* left() { return OperandAt(0); } 2618 HValue* left() { return OperandAt(0); }
2628 HValue* right() { return OperandAt(1); } 2619 HValue* right() { return OperandAt(1); }
2629 2620
2630 virtual void PrintDataTo(StringStream* stream); 2621 virtual void PrintDataTo(StringStream* stream);
2631 2622
2632 virtual Representation RequiredInputRepresentation(int index) const { 2623 virtual Representation RequiredInputRepresentation(int index) {
2633 return Representation::Tagged(); 2624 return Representation::Tagged();
2634 } 2625 }
2635 2626
2636 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) 2627 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch)
2637 }; 2628 };
2638 2629
2639 2630
2640 class HCompareConstantEqAndBranch: public HUnaryControlInstruction { 2631 class HCompareConstantEqAndBranch: public HUnaryControlInstruction {
2641 public: 2632 public:
2642 HCompareConstantEqAndBranch(HValue* left, int right, Token::Value op) 2633 HCompareConstantEqAndBranch(HValue* left, int right, Token::Value op)
2643 : HUnaryControlInstruction(left, NULL, NULL), op_(op), right_(right) { 2634 : HUnaryControlInstruction(left, NULL, NULL), op_(op), right_(right) {
2644 ASSERT(op == Token::EQ_STRICT); 2635 ASSERT(op == Token::EQ_STRICT);
2645 } 2636 }
2646 2637
2647 Token::Value op() const { return op_; } 2638 Token::Value op() const { return op_; }
2648 HValue* left() { return value(); } 2639 HValue* left() { return value(); }
2649 int right() const { return right_; } 2640 int right() const { return right_; }
2650 2641
2651 virtual Representation RequiredInputRepresentation(int index) const { 2642 virtual Representation RequiredInputRepresentation(int index) {
2652 return Representation::Integer32(); 2643 return Representation::Integer32();
2653 } 2644 }
2654 2645
2655 DECLARE_CONCRETE_INSTRUCTION(CompareConstantEqAndBranch); 2646 DECLARE_CONCRETE_INSTRUCTION(CompareConstantEqAndBranch);
2656 2647
2657 private: 2648 private:
2658 const Token::Value op_; 2649 const Token::Value op_;
2659 const int right_; 2650 const int right_;
2660 }; 2651 };
2661 2652
2662 2653
2663 class HIsNilAndBranch: public HUnaryControlInstruction { 2654 class HIsNilAndBranch: public HUnaryControlInstruction {
2664 public: 2655 public:
2665 HIsNilAndBranch(HValue* value, EqualityKind kind, NilValue nil) 2656 HIsNilAndBranch(HValue* value, EqualityKind kind, NilValue nil)
2666 : HUnaryControlInstruction(value, NULL, NULL), kind_(kind), nil_(nil) { } 2657 : HUnaryControlInstruction(value, NULL, NULL), kind_(kind), nil_(nil) { }
2667 2658
2668 EqualityKind kind() const { return kind_; } 2659 EqualityKind kind() const { return kind_; }
2669 NilValue nil() const { return nil_; } 2660 NilValue nil() const { return nil_; }
2670 2661
2671 virtual void PrintDataTo(StringStream* stream); 2662 virtual void PrintDataTo(StringStream* stream);
2672 2663
2673 virtual Representation RequiredInputRepresentation(int index) const { 2664 virtual Representation RequiredInputRepresentation(int index) {
2674 return Representation::Tagged(); 2665 return Representation::Tagged();
2675 } 2666 }
2676 2667
2677 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch) 2668 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch)
2678 2669
2679 private: 2670 private:
2680 EqualityKind kind_; 2671 EqualityKind kind_;
2681 NilValue nil_; 2672 NilValue nil_;
2682 }; 2673 };
2683 2674
2684 2675
2685 class HIsObjectAndBranch: public HUnaryControlInstruction { 2676 class HIsObjectAndBranch: public HUnaryControlInstruction {
2686 public: 2677 public:
2687 explicit HIsObjectAndBranch(HValue* value) 2678 explicit HIsObjectAndBranch(HValue* value)
2688 : HUnaryControlInstruction(value, NULL, NULL) { } 2679 : HUnaryControlInstruction(value, NULL, NULL) { }
2689 2680
2690 virtual Representation RequiredInputRepresentation(int index) const { 2681 virtual Representation RequiredInputRepresentation(int index) {
2691 return Representation::Tagged(); 2682 return Representation::Tagged();
2692 } 2683 }
2693 2684
2694 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch) 2685 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch)
2695 }; 2686 };
2696 2687
2697 2688
2698 class HIsSmiAndBranch: public HUnaryControlInstruction { 2689 class HIsSmiAndBranch: public HUnaryControlInstruction {
2699 public: 2690 public:
2700 explicit HIsSmiAndBranch(HValue* value) 2691 explicit HIsSmiAndBranch(HValue* value)
2701 : HUnaryControlInstruction(value, NULL, NULL) { } 2692 : HUnaryControlInstruction(value, NULL, NULL) { }
2702 2693
2703 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch) 2694 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch)
2704 2695
2705 virtual Representation RequiredInputRepresentation(int index) const { 2696 virtual Representation RequiredInputRepresentation(int index) {
2706 return Representation::Tagged(); 2697 return Representation::Tagged();
2707 } 2698 }
2708 2699
2709 protected: 2700 protected:
2710 virtual bool DataEquals(HValue* other) { return true; } 2701 virtual bool DataEquals(HValue* other) { return true; }
2711 }; 2702 };
2712 2703
2713 2704
2714 class HIsUndetectableAndBranch: public HUnaryControlInstruction { 2705 class HIsUndetectableAndBranch: public HUnaryControlInstruction {
2715 public: 2706 public:
2716 explicit HIsUndetectableAndBranch(HValue* value) 2707 explicit HIsUndetectableAndBranch(HValue* value)
2717 : HUnaryControlInstruction(value, NULL, NULL) { } 2708 : HUnaryControlInstruction(value, NULL, NULL) { }
2718 2709
2719 virtual Representation RequiredInputRepresentation(int index) const { 2710 virtual Representation RequiredInputRepresentation(int index) {
2720 return Representation::Tagged(); 2711 return Representation::Tagged();
2721 } 2712 }
2722 2713
2723 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch) 2714 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch)
2724 }; 2715 };
2725 2716
2726 2717
2727 class HIsConstructCallAndBranch: public HTemplateControlInstruction<2, 0> { 2718 class HIsConstructCallAndBranch: public HTemplateControlInstruction<2, 0> {
2728 public: 2719 public:
2729 virtual Representation RequiredInputRepresentation(int index) const { 2720 virtual Representation RequiredInputRepresentation(int index) {
2730 return Representation::None(); 2721 return Representation::None();
2731 } 2722 }
2732 2723
2733 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch) 2724 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch)
2734 }; 2725 };
2735 2726
2736 2727
2737 class HHasInstanceTypeAndBranch: public HUnaryControlInstruction { 2728 class HHasInstanceTypeAndBranch: public HUnaryControlInstruction {
2738 public: 2729 public:
2739 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) 2730 HHasInstanceTypeAndBranch(HValue* value, InstanceType type)
2740 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } 2731 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { }
2741 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) 2732 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to)
2742 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { 2733 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) {
2743 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. 2734 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend.
2744 } 2735 }
2745 2736
2746 InstanceType from() { return from_; } 2737 InstanceType from() { return from_; }
2747 InstanceType to() { return to_; } 2738 InstanceType to() { return to_; }
2748 2739
2749 virtual void PrintDataTo(StringStream* stream); 2740 virtual void PrintDataTo(StringStream* stream);
2750 2741
2751 virtual Representation RequiredInputRepresentation(int index) const { 2742 virtual Representation RequiredInputRepresentation(int index) {
2752 return Representation::Tagged(); 2743 return Representation::Tagged();
2753 } 2744 }
2754 2745
2755 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) 2746 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch)
2756 2747
2757 private: 2748 private:
2758 InstanceType from_; 2749 InstanceType from_;
2759 InstanceType to_; // Inclusive range, not all combinations work. 2750 InstanceType to_; // Inclusive range, not all combinations work.
2760 }; 2751 };
2761 2752
2762 2753
2763 class HHasCachedArrayIndexAndBranch: public HUnaryControlInstruction { 2754 class HHasCachedArrayIndexAndBranch: public HUnaryControlInstruction {
2764 public: 2755 public:
2765 explicit HHasCachedArrayIndexAndBranch(HValue* value) 2756 explicit HHasCachedArrayIndexAndBranch(HValue* value)
2766 : HUnaryControlInstruction(value, NULL, NULL) { } 2757 : HUnaryControlInstruction(value, NULL, NULL) { }
2767 2758
2768 virtual Representation RequiredInputRepresentation(int index) const { 2759 virtual Representation RequiredInputRepresentation(int index) {
2769 return Representation::Tagged(); 2760 return Representation::Tagged();
2770 } 2761 }
2771 2762
2772 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch) 2763 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch)
2773 }; 2764 };
2774 2765
2775 2766
2776 class HGetCachedArrayIndex: public HUnaryOperation { 2767 class HGetCachedArrayIndex: public HUnaryOperation {
2777 public: 2768 public:
2778 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) { 2769 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) {
2779 set_representation(Representation::Tagged()); 2770 set_representation(Representation::Tagged());
2780 SetFlag(kUseGVN); 2771 SetFlag(kUseGVN);
2781 } 2772 }
2782 2773
2783 virtual Representation RequiredInputRepresentation(int index) const { 2774 virtual Representation RequiredInputRepresentation(int index) {
2784 return Representation::Tagged(); 2775 return Representation::Tagged();
2785 } 2776 }
2786 2777
2787 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) 2778 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex)
2788 2779
2789 protected: 2780 protected:
2790 virtual bool DataEquals(HValue* other) { return true; } 2781 virtual bool DataEquals(HValue* other) { return true; }
2791 }; 2782 };
2792 2783
2793 2784
2794 class HClassOfTestAndBranch: public HUnaryControlInstruction { 2785 class HClassOfTestAndBranch: public HUnaryControlInstruction {
2795 public: 2786 public:
2796 HClassOfTestAndBranch(HValue* value, Handle<String> class_name) 2787 HClassOfTestAndBranch(HValue* value, Handle<String> class_name)
2797 : HUnaryControlInstruction(value, NULL, NULL), 2788 : HUnaryControlInstruction(value, NULL, NULL),
2798 class_name_(class_name) { } 2789 class_name_(class_name) { }
2799 2790
2800 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch) 2791 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch)
2801 2792
2802 virtual Representation RequiredInputRepresentation(int index) const { 2793 virtual Representation RequiredInputRepresentation(int index) {
2803 return Representation::Tagged(); 2794 return Representation::Tagged();
2804 } 2795 }
2805 2796
2806 virtual void PrintDataTo(StringStream* stream); 2797 virtual void PrintDataTo(StringStream* stream);
2807 2798
2808 Handle<String> class_name() const { return class_name_; } 2799 Handle<String> class_name() const { return class_name_; }
2809 2800
2810 private: 2801 private:
2811 Handle<String> class_name_; 2802 Handle<String> class_name_;
2812 }; 2803 };
2813 2804
2814 2805
2815 class HTypeofIsAndBranch: public HUnaryControlInstruction { 2806 class HTypeofIsAndBranch: public HUnaryControlInstruction {
2816 public: 2807 public:
2817 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal) 2808 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal)
2818 : HUnaryControlInstruction(value, NULL, NULL), 2809 : HUnaryControlInstruction(value, NULL, NULL),
2819 type_literal_(type_literal) { } 2810 type_literal_(type_literal) { }
2820 2811
2821 Handle<String> type_literal() { return type_literal_; } 2812 Handle<String> type_literal() { return type_literal_; }
2822 virtual void PrintDataTo(StringStream* stream); 2813 virtual void PrintDataTo(StringStream* stream);
2823 2814
2824 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) 2815 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch)
2825 2816
2826 virtual Representation RequiredInputRepresentation(int index) const { 2817 virtual Representation RequiredInputRepresentation(int index) {
2827 return Representation::Tagged(); 2818 return Representation::Tagged();
2828 } 2819 }
2829 2820
2830 private: 2821 private:
2831 Handle<String> type_literal_; 2822 Handle<String> type_literal_;
2832 }; 2823 };
2833 2824
2834 2825
2835 class HInstanceOf: public HBinaryOperation { 2826 class HInstanceOf: public HBinaryOperation {
2836 public: 2827 public:
2837 HInstanceOf(HValue* context, HValue* left, HValue* right) 2828 HInstanceOf(HValue* context, HValue* left, HValue* right)
2838 : HBinaryOperation(context, left, right) { 2829 : HBinaryOperation(context, left, right) {
2839 set_representation(Representation::Tagged()); 2830 set_representation(Representation::Tagged());
2840 SetAllSideEffects(); 2831 SetAllSideEffects();
2841 } 2832 }
2842 2833
2843 virtual Representation RequiredInputRepresentation(int index) const { 2834 virtual Representation RequiredInputRepresentation(int index) {
2844 return Representation::Tagged(); 2835 return Representation::Tagged();
2845 } 2836 }
2846 2837
2847 virtual HType CalculateInferredType(); 2838 virtual HType CalculateInferredType();
2848 2839
2849 virtual void PrintDataTo(StringStream* stream); 2840 virtual void PrintDataTo(StringStream* stream);
2850 2841
2851 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) 2842 DECLARE_CONCRETE_INSTRUCTION(InstanceOf)
2852 }; 2843 };
2853 2844
2854 2845
2855 class HInstanceOfKnownGlobal: public HTemplateInstruction<2> { 2846 class HInstanceOfKnownGlobal: public HTemplateInstruction<2> {
2856 public: 2847 public:
2857 HInstanceOfKnownGlobal(HValue* context, 2848 HInstanceOfKnownGlobal(HValue* context,
2858 HValue* left, 2849 HValue* left,
2859 Handle<JSFunction> right) 2850 Handle<JSFunction> right)
2860 : function_(right) { 2851 : function_(right) {
2861 SetOperandAt(0, context); 2852 SetOperandAt(0, context);
2862 SetOperandAt(1, left); 2853 SetOperandAt(1, left);
2863 set_representation(Representation::Tagged()); 2854 set_representation(Representation::Tagged());
2864 SetAllSideEffects(); 2855 SetAllSideEffects();
2865 } 2856 }
2866 2857
2867 HValue* context() { return OperandAt(0); } 2858 HValue* context() { return OperandAt(0); }
2868 HValue* left() { return OperandAt(1); } 2859 HValue* left() { return OperandAt(1); }
2869 Handle<JSFunction> function() { return function_; } 2860 Handle<JSFunction> function() { return function_; }
2870 2861
2871 virtual Representation RequiredInputRepresentation(int index) const { 2862 virtual Representation RequiredInputRepresentation(int index) {
2872 return Representation::Tagged(); 2863 return Representation::Tagged();
2873 } 2864 }
2874 2865
2875 virtual HType CalculateInferredType(); 2866 virtual HType CalculateInferredType();
2876 2867
2877 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) 2868 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal)
2878 2869
2879 private: 2870 private:
2880 Handle<JSFunction> function_; 2871 Handle<JSFunction> function_;
2881 }; 2872 };
2882 2873
2883 2874
2884 class HPower: public HTemplateInstruction<2> { 2875 class HPower: public HTemplateInstruction<2> {
2885 public: 2876 public:
2886 HPower(HValue* left, HValue* right) { 2877 HPower(HValue* left, HValue* right) {
2887 SetOperandAt(0, left); 2878 SetOperandAt(0, left);
2888 SetOperandAt(1, right); 2879 SetOperandAt(1, right);
2889 set_representation(Representation::Double()); 2880 set_representation(Representation::Double());
2890 SetFlag(kUseGVN); 2881 SetFlag(kUseGVN);
2891 } 2882 }
2892 2883
2893 HValue* left() { return OperandAt(0); } 2884 HValue* left() { return OperandAt(0); }
2894 HValue* right() { return OperandAt(1); } 2885 HValue* right() { return OperandAt(1); }
2895 2886
2896 virtual Representation RequiredInputRepresentation(int index) const { 2887 virtual Representation RequiredInputRepresentation(int index) {
2897 return index == 0 2888 return index == 0
2898 ? Representation::Double() 2889 ? Representation::Double()
2899 : Representation::None(); 2890 : Representation::None();
2900 } 2891 }
2901 2892
2902 DECLARE_CONCRETE_INSTRUCTION(Power) 2893 DECLARE_CONCRETE_INSTRUCTION(Power)
2903 2894
2904 protected: 2895 protected:
2905 virtual bool DataEquals(HValue* other) { return true; } 2896 virtual bool DataEquals(HValue* other) { return true; }
2906 }; 2897 };
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
3115 3106
3116 3107
3117 class HOsrEntry: public HTemplateInstruction<0> { 3108 class HOsrEntry: public HTemplateInstruction<0> {
3118 public: 3109 public:
3119 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) { 3110 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) {
3120 SetFlag(kChangesOsrEntries); 3111 SetFlag(kChangesOsrEntries);
3121 } 3112 }
3122 3113
3123 int ast_id() const { return ast_id_; } 3114 int ast_id() const { return ast_id_; }
3124 3115
3125 virtual Representation RequiredInputRepresentation(int index) const { 3116 virtual Representation RequiredInputRepresentation(int index) {
3126 return Representation::None(); 3117 return Representation::None();
3127 } 3118 }
3128 3119
3129 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) 3120 DECLARE_CONCRETE_INSTRUCTION(OsrEntry)
3130 3121
3131 private: 3122 private:
3132 int ast_id_; 3123 int ast_id_;
3133 }; 3124 };
3134 3125
3135 3126
3136 class HParameter: public HTemplateInstruction<0> { 3127 class HParameter: public HTemplateInstruction<0> {
3137 public: 3128 public:
3138 explicit HParameter(unsigned index) : index_(index) { 3129 explicit HParameter(unsigned index) : index_(index) {
3139 set_representation(Representation::Tagged()); 3130 set_representation(Representation::Tagged());
3140 } 3131 }
3141 3132
3142 unsigned index() const { return index_; } 3133 unsigned index() const { return index_; }
3143 3134
3144 virtual void PrintDataTo(StringStream* stream); 3135 virtual void PrintDataTo(StringStream* stream);
3145 3136
3146 virtual Representation RequiredInputRepresentation(int index) const { 3137 virtual Representation RequiredInputRepresentation(int index) {
3147 return Representation::None(); 3138 return Representation::None();
3148 } 3139 }
3149 3140
3150 DECLARE_CONCRETE_INSTRUCTION(Parameter) 3141 DECLARE_CONCRETE_INSTRUCTION(Parameter)
3151 3142
3152 private: 3143 private:
3153 unsigned index_; 3144 unsigned index_;
3154 }; 3145 };
3155 3146
3156 3147
(...skipping 11 matching lines...) Expand all
3168 3159
3169 void set_transcendental_type(TranscendentalCache::Type transcendental_type) { 3160 void set_transcendental_type(TranscendentalCache::Type transcendental_type) {
3170 transcendental_type_ = transcendental_type; 3161 transcendental_type_ = transcendental_type;
3171 } 3162 }
3172 TranscendentalCache::Type transcendental_type() { 3163 TranscendentalCache::Type transcendental_type() {
3173 return transcendental_type_; 3164 return transcendental_type_;
3174 } 3165 }
3175 3166
3176 virtual void PrintDataTo(StringStream* stream); 3167 virtual void PrintDataTo(StringStream* stream);
3177 3168
3178 virtual Representation RequiredInputRepresentation(int index) const { 3169 virtual Representation RequiredInputRepresentation(int index) {
3179 return Representation::Tagged(); 3170 return Representation::Tagged();
3180 } 3171 }
3181 3172
3182 DECLARE_CONCRETE_INSTRUCTION(CallStub) 3173 DECLARE_CONCRETE_INSTRUCTION(CallStub)
3183 3174
3184 private: 3175 private:
3185 CodeStub::Major major_key_; 3176 CodeStub::Major major_key_;
3186 TranscendentalCache::Type transcendental_type_; 3177 TranscendentalCache::Type transcendental_type_;
3187 }; 3178 };
3188 3179
3189 3180
3190 class HUnknownOSRValue: public HTemplateInstruction<0> { 3181 class HUnknownOSRValue: public HTemplateInstruction<0> {
3191 public: 3182 public:
3192 HUnknownOSRValue() { set_representation(Representation::Tagged()); } 3183 HUnknownOSRValue() { set_representation(Representation::Tagged()); }
3193 3184
3194 virtual Representation RequiredInputRepresentation(int index) const { 3185 virtual Representation RequiredInputRepresentation(int index) {
3195 return Representation::None(); 3186 return Representation::None();
3196 } 3187 }
3197 3188
3198 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) 3189 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue)
3199 }; 3190 };
3200 3191
3201 3192
3202 class HLoadGlobalCell: public HTemplateInstruction<0> { 3193 class HLoadGlobalCell: public HTemplateInstruction<0> {
3203 public: 3194 public:
3204 HLoadGlobalCell(Handle<JSGlobalPropertyCell> cell, PropertyDetails details) 3195 HLoadGlobalCell(Handle<JSGlobalPropertyCell> cell, PropertyDetails details)
3205 : cell_(cell), details_(details) { 3196 : cell_(cell), details_(details) {
3206 set_representation(Representation::Tagged()); 3197 set_representation(Representation::Tagged());
3207 SetFlag(kUseGVN); 3198 SetFlag(kUseGVN);
3208 SetFlag(kDependsOnGlobalVars); 3199 SetFlag(kDependsOnGlobalVars);
3209 } 3200 }
3210 3201
3211 Handle<JSGlobalPropertyCell> cell() const { return cell_; } 3202 Handle<JSGlobalPropertyCell> cell() const { return cell_; }
3212 bool RequiresHoleCheck(); 3203 bool RequiresHoleCheck();
3213 3204
3214 virtual void PrintDataTo(StringStream* stream); 3205 virtual void PrintDataTo(StringStream* stream);
3215 3206
3216 virtual intptr_t Hashcode() { 3207 virtual intptr_t Hashcode() {
3217 ASSERT(!HEAP->allow_allocation(false)); 3208 ASSERT(!HEAP->allow_allocation(false));
3218 return reinterpret_cast<intptr_t>(*cell_); 3209 return reinterpret_cast<intptr_t>(*cell_);
3219 } 3210 }
3220 3211
3221 virtual Representation RequiredInputRepresentation(int index) const { 3212 virtual Representation RequiredInputRepresentation(int index) {
3222 return Representation::None(); 3213 return Representation::None();
3223 } 3214 }
3224 3215
3225 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) 3216 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell)
3226 3217
3227 protected: 3218 protected:
3228 virtual bool DataEquals(HValue* other) { 3219 virtual bool DataEquals(HValue* other) {
3229 HLoadGlobalCell* b = HLoadGlobalCell::cast(other); 3220 HLoadGlobalCell* b = HLoadGlobalCell::cast(other);
3230 return cell_.is_identical_to(b->cell()); 3221 return cell_.is_identical_to(b->cell());
3231 } 3222 }
(...skipping 18 matching lines...) Expand all
3250 SetAllSideEffects(); 3241 SetAllSideEffects();
3251 } 3242 }
3252 3243
3253 HValue* context() { return OperandAt(0); } 3244 HValue* context() { return OperandAt(0); }
3254 HValue* global_object() { return OperandAt(1); } 3245 HValue* global_object() { return OperandAt(1); }
3255 Handle<Object> name() const { return name_; } 3246 Handle<Object> name() const { return name_; }
3256 bool for_typeof() const { return for_typeof_; } 3247 bool for_typeof() const { return for_typeof_; }
3257 3248
3258 virtual void PrintDataTo(StringStream* stream); 3249 virtual void PrintDataTo(StringStream* stream);
3259 3250
3260 virtual Representation RequiredInputRepresentation(int index) const { 3251 virtual Representation RequiredInputRepresentation(int index) {
3261 return Representation::Tagged(); 3252 return Representation::Tagged();
3262 } 3253 }
3263 3254
3264 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) 3255 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric)
3265 3256
3266 private: 3257 private:
3267 Handle<Object> name_; 3258 Handle<Object> name_;
3268 bool for_typeof_; 3259 bool for_typeof_;
3269 }; 3260 };
3270 3261
3271 3262
3272 class HStoreGlobalCell: public HUnaryOperation { 3263 class HStoreGlobalCell: public HUnaryOperation {
3273 public: 3264 public:
3274 HStoreGlobalCell(HValue* value, 3265 HStoreGlobalCell(HValue* value,
3275 Handle<JSGlobalPropertyCell> cell, 3266 Handle<JSGlobalPropertyCell> cell,
3276 PropertyDetails details) 3267 PropertyDetails details)
3277 : HUnaryOperation(value), 3268 : HUnaryOperation(value),
3278 cell_(cell), 3269 cell_(cell),
3279 details_(details) { 3270 details_(details) {
3280 SetFlag(kChangesGlobalVars); 3271 SetFlag(kChangesGlobalVars);
3281 } 3272 }
3282 3273
3283 Handle<JSGlobalPropertyCell> cell() const { return cell_; } 3274 Handle<JSGlobalPropertyCell> cell() const { return cell_; }
3284 bool RequiresHoleCheck() { 3275 bool RequiresHoleCheck() {
3285 return !details_.IsDontDelete() || details_.IsReadOnly(); 3276 return !details_.IsDontDelete() || details_.IsReadOnly();
3286 } 3277 }
3287 3278
3288 virtual Representation RequiredInputRepresentation(int index) const { 3279 virtual Representation RequiredInputRepresentation(int index) {
3289 return Representation::Tagged(); 3280 return Representation::Tagged();
3290 } 3281 }
3291 virtual void PrintDataTo(StringStream* stream); 3282 virtual void PrintDataTo(StringStream* stream);
3292 3283
3293 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) 3284 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell)
3294 3285
3295 private: 3286 private:
3296 Handle<JSGlobalPropertyCell> cell_; 3287 Handle<JSGlobalPropertyCell> cell_;
3297 PropertyDetails details_; 3288 PropertyDetails details_;
3298 }; 3289 };
(...skipping 16 matching lines...) Expand all
3315 } 3306 }
3316 3307
3317 HValue* context() { return OperandAt(0); } 3308 HValue* context() { return OperandAt(0); }
3318 HValue* global_object() { return OperandAt(1); } 3309 HValue* global_object() { return OperandAt(1); }
3319 Handle<Object> name() const { return name_; } 3310 Handle<Object> name() const { return name_; }
3320 HValue* value() { return OperandAt(2); } 3311 HValue* value() { return OperandAt(2); }
3321 bool strict_mode() { return strict_mode_; } 3312 bool strict_mode() { return strict_mode_; }
3322 3313
3323 virtual void PrintDataTo(StringStream* stream); 3314 virtual void PrintDataTo(StringStream* stream);
3324 3315
3325 virtual Representation RequiredInputRepresentation(int index) const { 3316 virtual Representation RequiredInputRepresentation(int index) {
3326 return Representation::Tagged(); 3317 return Representation::Tagged();
3327 } 3318 }
3328 3319
3329 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric) 3320 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric)
3330 3321
3331 private: 3322 private:
3332 Handle<Object> name_; 3323 Handle<Object> name_;
3333 bool strict_mode_; 3324 bool strict_mode_;
3334 }; 3325 };
3335 3326
3336 3327
3337 class HLoadContextSlot: public HUnaryOperation { 3328 class HLoadContextSlot: public HUnaryOperation {
3338 public: 3329 public:
3339 HLoadContextSlot(HValue* context , int slot_index) 3330 HLoadContextSlot(HValue* context , int slot_index)
3340 : HUnaryOperation(context), slot_index_(slot_index) { 3331 : HUnaryOperation(context), slot_index_(slot_index) {
3341 set_representation(Representation::Tagged()); 3332 set_representation(Representation::Tagged());
3342 SetFlag(kUseGVN); 3333 SetFlag(kUseGVN);
3343 SetFlag(kDependsOnContextSlots); 3334 SetFlag(kDependsOnContextSlots);
3344 } 3335 }
3345 3336
3346 int slot_index() const { return slot_index_; } 3337 int slot_index() const { return slot_index_; }
3347 3338
3348 virtual Representation RequiredInputRepresentation(int index) const { 3339 virtual Representation RequiredInputRepresentation(int index) {
3349 return Representation::Tagged(); 3340 return Representation::Tagged();
3350 } 3341 }
3351 3342
3352 virtual void PrintDataTo(StringStream* stream); 3343 virtual void PrintDataTo(StringStream* stream);
3353 3344
3354 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) 3345 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot)
3355 3346
3356 protected: 3347 protected:
3357 virtual bool DataEquals(HValue* other) { 3348 virtual bool DataEquals(HValue* other) {
3358 HLoadContextSlot* b = HLoadContextSlot::cast(other); 3349 HLoadContextSlot* b = HLoadContextSlot::cast(other);
(...skipping 22 matching lines...) Expand all
3381 } 3372 }
3382 3373
3383 HValue* context() { return OperandAt(0); } 3374 HValue* context() { return OperandAt(0); }
3384 HValue* value() { return OperandAt(1); } 3375 HValue* value() { return OperandAt(1); }
3385 int slot_index() const { return slot_index_; } 3376 int slot_index() const { return slot_index_; }
3386 3377
3387 bool NeedsWriteBarrier() { 3378 bool NeedsWriteBarrier() {
3388 return StoringValueNeedsWriteBarrier(value()); 3379 return StoringValueNeedsWriteBarrier(value());
3389 } 3380 }
3390 3381
3391 virtual Representation RequiredInputRepresentation(int index) const { 3382 virtual Representation RequiredInputRepresentation(int index) {
3392 return Representation::Tagged(); 3383 return Representation::Tagged();
3393 } 3384 }
3394 3385
3395 virtual void PrintDataTo(StringStream* stream); 3386 virtual void PrintDataTo(StringStream* stream);
3396 3387
3397 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) 3388 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot)
3398 3389
3399 private: 3390 private:
3400 int slot_index_; 3391 int slot_index_;
3401 }; 3392 };
(...skipping 12 matching lines...) Expand all
3414 SetFlag(kDependsOnInobjectFields); 3405 SetFlag(kDependsOnInobjectFields);
3415 } else { 3406 } else {
3416 SetFlag(kDependsOnBackingStoreFields); 3407 SetFlag(kDependsOnBackingStoreFields);
3417 } 3408 }
3418 } 3409 }
3419 3410
3420 HValue* object() { return OperandAt(0); } 3411 HValue* object() { return OperandAt(0); }
3421 bool is_in_object() const { return is_in_object_; } 3412 bool is_in_object() const { return is_in_object_; }
3422 int offset() const { return offset_; } 3413 int offset() const { return offset_; }
3423 3414
3424 virtual Representation RequiredInputRepresentation(int index) const { 3415 virtual Representation RequiredInputRepresentation(int index) {
3425 return Representation::Tagged(); 3416 return Representation::Tagged();
3426 } 3417 }
3427 virtual void PrintDataTo(StringStream* stream); 3418 virtual void PrintDataTo(StringStream* stream);
3428 3419
3429 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) 3420 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField)
3430 3421
3431 protected: 3422 protected:
3432 virtual bool DataEquals(HValue* other) { 3423 virtual bool DataEquals(HValue* other) {
3433 HLoadNamedField* b = HLoadNamedField::cast(other); 3424 HLoadNamedField* b = HLoadNamedField::cast(other);
3434 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
3446 HValue* object, 3437 HValue* object,
3447 SmallMapList* types, 3438 SmallMapList* types,
3448 Handle<String> name); 3439 Handle<String> name);
3449 3440
3450 HValue* context() { return OperandAt(0); } 3441 HValue* context() { return OperandAt(0); }
3451 HValue* object() { return OperandAt(1); } 3442 HValue* object() { return OperandAt(1); }
3452 SmallMapList* types() { return &types_; } 3443 SmallMapList* types() { return &types_; }
3453 Handle<String> name() { return name_; } 3444 Handle<String> name() { return name_; }
3454 bool need_generic() { return need_generic_; } 3445 bool need_generic() { return need_generic_; }
3455 3446
3456 virtual Representation RequiredInputRepresentation(int index) const { 3447 virtual Representation RequiredInputRepresentation(int index) {
3457 return Representation::Tagged(); 3448 return Representation::Tagged();
3458 } 3449 }
3459 3450
3460 virtual void PrintDataTo(StringStream* stream); 3451 virtual void PrintDataTo(StringStream* stream);
3461 3452
3462 DECLARE_CONCRETE_INSTRUCTION(LoadNamedFieldPolymorphic) 3453 DECLARE_CONCRETE_INSTRUCTION(LoadNamedFieldPolymorphic)
3463 3454
3464 static const int kMaxLoadPolymorphism = 4; 3455 static const int kMaxLoadPolymorphism = 4;
3465 3456
3466 protected: 3457 protected:
(...skipping 14 matching lines...) Expand all
3481 SetOperandAt(0, context); 3472 SetOperandAt(0, context);
3482 SetOperandAt(1, object); 3473 SetOperandAt(1, object);
3483 set_representation(Representation::Tagged()); 3474 set_representation(Representation::Tagged());
3484 SetAllSideEffects(); 3475 SetAllSideEffects();
3485 } 3476 }
3486 3477
3487 HValue* context() { return OperandAt(0); } 3478 HValue* context() { return OperandAt(0); }
3488 HValue* object() { return OperandAt(1); } 3479 HValue* object() { return OperandAt(1); }
3489 Handle<Object> name() const { return name_; } 3480 Handle<Object> name() const { return name_; }
3490 3481
3491 virtual Representation RequiredInputRepresentation(int index) const { 3482 virtual Representation RequiredInputRepresentation(int index) {
3492 return Representation::Tagged(); 3483 return Representation::Tagged();
3493 } 3484 }
3494 3485
3495 virtual void PrintDataTo(StringStream* stream); 3486 virtual void PrintDataTo(StringStream* stream);
3496 3487
3497 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric) 3488 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric)
3498 3489
3499 private: 3490 private:
3500 Handle<Object> name_; 3491 Handle<Object> name_;
3501 }; 3492 };
3502 3493
3503 3494
3504 class HLoadFunctionPrototype: public HUnaryOperation { 3495 class HLoadFunctionPrototype: public HUnaryOperation {
3505 public: 3496 public:
3506 explicit HLoadFunctionPrototype(HValue* function) 3497 explicit HLoadFunctionPrototype(HValue* function)
3507 : HUnaryOperation(function) { 3498 : HUnaryOperation(function) {
3508 set_representation(Representation::Tagged()); 3499 set_representation(Representation::Tagged());
3509 SetFlag(kUseGVN); 3500 SetFlag(kUseGVN);
3510 SetFlag(kDependsOnCalls); 3501 SetFlag(kDependsOnCalls);
3511 } 3502 }
3512 3503
3513 HValue* function() { return OperandAt(0); } 3504 HValue* function() { return OperandAt(0); }
3514 3505
3515 virtual Representation RequiredInputRepresentation(int index) const { 3506 virtual Representation RequiredInputRepresentation(int index) {
3516 return Representation::Tagged(); 3507 return Representation::Tagged();
3517 } 3508 }
3518 3509
3519 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) 3510 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype)
3520 3511
3521 protected: 3512 protected:
3522 virtual bool DataEquals(HValue* other) { return true; } 3513 virtual bool DataEquals(HValue* other) { return true; }
3523 }; 3514 };
3524 3515
3525 3516
3526 class HLoadKeyedFastElement: public HTemplateInstruction<2> { 3517 class HLoadKeyedFastElement: public HTemplateInstruction<2> {
3527 public: 3518 public:
3528 HLoadKeyedFastElement(HValue* obj, HValue* key) { 3519 HLoadKeyedFastElement(HValue* obj, HValue* key) {
3529 SetOperandAt(0, obj); 3520 SetOperandAt(0, obj);
3530 SetOperandAt(1, key); 3521 SetOperandAt(1, key);
3531 set_representation(Representation::Tagged()); 3522 set_representation(Representation::Tagged());
3532 SetFlag(kDependsOnArrayElements); 3523 SetFlag(kDependsOnArrayElements);
3533 SetFlag(kUseGVN); 3524 SetFlag(kUseGVN);
3534 } 3525 }
3535 3526
3536 HValue* object() { return OperandAt(0); } 3527 HValue* object() { return OperandAt(0); }
3537 HValue* key() { return OperandAt(1); } 3528 HValue* key() { return OperandAt(1); }
3538 3529
3539 virtual Representation RequiredInputRepresentation(int index) const { 3530 virtual Representation RequiredInputRepresentation(int index) {
3540 // The key is supposed to be Integer32. 3531 // The key is supposed to be Integer32.
3541 return index == 0 3532 return index == 0
3542 ? Representation::Tagged() 3533 ? Representation::Tagged()
3543 : Representation::Integer32(); 3534 : Representation::Integer32();
3544 } 3535 }
3545 3536
3546 virtual void PrintDataTo(StringStream* stream); 3537 virtual void PrintDataTo(StringStream* stream);
3547 3538
3548 bool RequiresHoleCheck(); 3539 bool RequiresHoleCheck();
3549 3540
(...skipping 10 matching lines...) Expand all
3560 SetOperandAt(0, elements); 3551 SetOperandAt(0, elements);
3561 SetOperandAt(1, key); 3552 SetOperandAt(1, key);
3562 set_representation(Representation::Double()); 3553 set_representation(Representation::Double());
3563 SetFlag(kDependsOnDoubleArrayElements); 3554 SetFlag(kDependsOnDoubleArrayElements);
3564 SetFlag(kUseGVN); 3555 SetFlag(kUseGVN);
3565 } 3556 }
3566 3557
3567 HValue* elements() { return OperandAt(0); } 3558 HValue* elements() { return OperandAt(0); }
3568 HValue* key() { return OperandAt(1); } 3559 HValue* key() { return OperandAt(1); }
3569 3560
3570 virtual Representation RequiredInputRepresentation(int index) const { 3561 virtual Representation RequiredInputRepresentation(int index) {
3571 // The key is supposed to be Integer32. 3562 // The key is supposed to be Integer32.
3572 return index == 0 3563 return index == 0
3573 ? Representation::Tagged() 3564 ? Representation::Tagged()
3574 : Representation::Integer32(); 3565 : Representation::Integer32();
3575 } 3566 }
3576 3567
3577 virtual void PrintDataTo(StringStream* stream); 3568 virtual void PrintDataTo(StringStream* stream);
3578 3569
3579 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastDoubleElement) 3570 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastDoubleElement)
3580 3571
(...skipping 17 matching lines...) Expand all
3598 set_representation(Representation::Integer32()); 3589 set_representation(Representation::Integer32());
3599 } 3590 }
3600 SetFlag(kDependsOnSpecializedArrayElements); 3591 SetFlag(kDependsOnSpecializedArrayElements);
3601 // Native code could change the specialized array. 3592 // Native code could change the specialized array.
3602 SetFlag(kDependsOnCalls); 3593 SetFlag(kDependsOnCalls);
3603 SetFlag(kUseGVN); 3594 SetFlag(kUseGVN);
3604 } 3595 }
3605 3596
3606 virtual void PrintDataTo(StringStream* stream); 3597 virtual void PrintDataTo(StringStream* stream);
3607 3598
3608 virtual Representation RequiredInputRepresentation(int index) const { 3599 virtual Representation RequiredInputRepresentation(int index) {
3609 // The key is supposed to be Integer32, but the base pointer 3600 // The key is supposed to be Integer32, but the base pointer
3610 // for the element load is a naked pointer. 3601 // for the element load is a naked pointer.
3611 return index == 0 3602 return index == 0
3612 ? Representation::External() 3603 ? Representation::External()
3613 : Representation::Integer32(); 3604 : Representation::Integer32();
3614 } 3605 }
3615 3606
3616 HValue* external_pointer() { return OperandAt(0); } 3607 HValue* external_pointer() { return OperandAt(0); }
3617 HValue* key() { return OperandAt(1); } 3608 HValue* key() { return OperandAt(1); }
3618 ElementsKind elements_kind() const { return elements_kind_; } 3609 ElementsKind elements_kind() const { return elements_kind_; }
(...skipping 22 matching lines...) Expand all
3641 SetOperandAt(2, context); 3632 SetOperandAt(2, context);
3642 SetAllSideEffects(); 3633 SetAllSideEffects();
3643 } 3634 }
3644 3635
3645 HValue* object() { return OperandAt(0); } 3636 HValue* object() { return OperandAt(0); }
3646 HValue* key() { return OperandAt(1); } 3637 HValue* key() { return OperandAt(1); }
3647 HValue* context() { return OperandAt(2); } 3638 HValue* context() { return OperandAt(2); }
3648 3639
3649 virtual void PrintDataTo(StringStream* stream); 3640 virtual void PrintDataTo(StringStream* stream);
3650 3641
3651 virtual Representation RequiredInputRepresentation(int index) const { 3642 virtual Representation RequiredInputRepresentation(int index) {
3652 return Representation::Tagged(); 3643 return Representation::Tagged();
3653 } 3644 }
3654 3645
3655 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) 3646 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric)
3656 }; 3647 };
3657 3648
3658 3649
3659 class HStoreNamedField: public HTemplateInstruction<2> { 3650 class HStoreNamedField: public HTemplateInstruction<2> {
3660 public: 3651 public:
3661 HStoreNamedField(HValue* obj, 3652 HStoreNamedField(HValue* obj,
3662 Handle<String> name, 3653 Handle<String> name,
3663 HValue* val, 3654 HValue* val,
3664 bool in_object, 3655 bool in_object,
3665 int offset) 3656 int offset)
3666 : name_(name), 3657 : name_(name),
3667 is_in_object_(in_object), 3658 is_in_object_(in_object),
3668 offset_(offset) { 3659 offset_(offset) {
3669 SetOperandAt(0, obj); 3660 SetOperandAt(0, obj);
3670 SetOperandAt(1, val); 3661 SetOperandAt(1, val);
3671 if (is_in_object_) { 3662 if (is_in_object_) {
3672 SetFlag(kChangesInobjectFields); 3663 SetFlag(kChangesInobjectFields);
3673 } else { 3664 } else {
3674 SetFlag(kChangesBackingStoreFields); 3665 SetFlag(kChangesBackingStoreFields);
3675 } 3666 }
3676 } 3667 }
3677 3668
3678 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) 3669 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField)
3679 3670
3680 virtual Representation RequiredInputRepresentation(int index) const { 3671 virtual Representation RequiredInputRepresentation(int index) {
3681 return Representation::Tagged(); 3672 return Representation::Tagged();
3682 } 3673 }
3683 virtual void PrintDataTo(StringStream* stream); 3674 virtual void PrintDataTo(StringStream* stream);
3684 3675
3685 HValue* object() { return OperandAt(0); } 3676 HValue* object() { return OperandAt(0); }
3686 HValue* value() { return OperandAt(1); } 3677 HValue* value() { return OperandAt(1); }
3687 3678
3688 Handle<String> name() const { return name_; } 3679 Handle<String> name() const { return name_; }
3689 bool is_in_object() const { return is_in_object_; } 3680 bool is_in_object() const { return is_in_object_; }
3690 int offset() const { return offset_; } 3681 int offset() const { return offset_; }
(...skipping 28 matching lines...) Expand all
3719 } 3710 }
3720 3711
3721 HValue* object() { return OperandAt(0); } 3712 HValue* object() { return OperandAt(0); }
3722 HValue* value() { return OperandAt(1); } 3713 HValue* value() { return OperandAt(1); }
3723 HValue* context() { return OperandAt(2); } 3714 HValue* context() { return OperandAt(2); }
3724 Handle<String> name() { return name_; } 3715 Handle<String> name() { return name_; }
3725 bool strict_mode() { return strict_mode_; } 3716 bool strict_mode() { return strict_mode_; }
3726 3717
3727 virtual void PrintDataTo(StringStream* stream); 3718 virtual void PrintDataTo(StringStream* stream);
3728 3719
3729 virtual Representation RequiredInputRepresentation(int index) const { 3720 virtual Representation RequiredInputRepresentation(int index) {
3730 return Representation::Tagged(); 3721 return Representation::Tagged();
3731 } 3722 }
3732 3723
3733 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric) 3724 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric)
3734 3725
3735 private: 3726 private:
3736 Handle<String> name_; 3727 Handle<String> name_;
3737 bool strict_mode_; 3728 bool strict_mode_;
3738 }; 3729 };
3739 3730
3740 3731
3741 class HStoreKeyedFastElement: public HTemplateInstruction<3> { 3732 class HStoreKeyedFastElement: public HTemplateInstruction<3> {
3742 public: 3733 public:
3743 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val, 3734 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val,
3744 ElementsKind elements_kind = FAST_ELEMENTS) 3735 ElementsKind elements_kind = FAST_ELEMENTS)
3745 : elements_kind_(elements_kind) { 3736 : elements_kind_(elements_kind) {
3746 SetOperandAt(0, obj); 3737 SetOperandAt(0, obj);
3747 SetOperandAt(1, key); 3738 SetOperandAt(1, key);
3748 SetOperandAt(2, val); 3739 SetOperandAt(2, val);
3749 SetFlag(kChangesArrayElements); 3740 SetFlag(kChangesArrayElements);
3750 } 3741 }
3751 3742
3752 virtual Representation RequiredInputRepresentation(int index) const { 3743 virtual Representation RequiredInputRepresentation(int index) {
3753 // The key is supposed to be Integer32. 3744 // The key is supposed to be Integer32.
3754 return index == 1 3745 return index == 1
3755 ? Representation::Integer32() 3746 ? Representation::Integer32()
3756 : Representation::Tagged(); 3747 : Representation::Tagged();
3757 } 3748 }
3758 3749
3759 HValue* object() { return OperandAt(0); } 3750 HValue* object() { return OperandAt(0); }
3760 HValue* key() { return OperandAt(1); } 3751 HValue* key() { return OperandAt(1); }
3761 HValue* value() { return OperandAt(2); } 3752 HValue* value() { return OperandAt(2); }
3762 bool value_is_smi() { 3753 bool value_is_smi() {
(...skipping 25 matching lines...) Expand all
3788 public: 3779 public:
3789 HStoreKeyedFastDoubleElement(HValue* elements, 3780 HStoreKeyedFastDoubleElement(HValue* elements,
3790 HValue* key, 3781 HValue* key,
3791 HValue* val) { 3782 HValue* val) {
3792 SetOperandAt(0, elements); 3783 SetOperandAt(0, elements);
3793 SetOperandAt(1, key); 3784 SetOperandAt(1, key);
3794 SetOperandAt(2, val); 3785 SetOperandAt(2, val);
3795 SetFlag(kChangesDoubleArrayElements); 3786 SetFlag(kChangesDoubleArrayElements);
3796 } 3787 }
3797 3788
3798 virtual Representation RequiredInputRepresentation(int index) const { 3789 virtual Representation RequiredInputRepresentation(int index) {
3799 if (index == 1) { 3790 if (index == 1) {
3800 return Representation::Integer32(); 3791 return Representation::Integer32();
3801 } else if (index == 2) { 3792 } else if (index == 2) {
3802 return Representation::Double(); 3793 return Representation::Double();
3803 } else { 3794 } else {
3804 return Representation::Tagged(); 3795 return Representation::Tagged();
3805 } 3796 }
3806 } 3797 }
3807 3798
3808 HValue* elements() { return OperandAt(0); } 3799 HValue* elements() { return OperandAt(0); }
(...skipping 18 matching lines...) Expand all
3827 ElementsKind elements_kind) 3818 ElementsKind elements_kind)
3828 : elements_kind_(elements_kind) { 3819 : elements_kind_(elements_kind) {
3829 SetFlag(kChangesSpecializedArrayElements); 3820 SetFlag(kChangesSpecializedArrayElements);
3830 SetOperandAt(0, external_elements); 3821 SetOperandAt(0, external_elements);
3831 SetOperandAt(1, key); 3822 SetOperandAt(1, key);
3832 SetOperandAt(2, val); 3823 SetOperandAt(2, val);
3833 } 3824 }
3834 3825
3835 virtual void PrintDataTo(StringStream* stream); 3826 virtual void PrintDataTo(StringStream* stream);
3836 3827
3837 virtual Representation RequiredInputRepresentation(int index) const { 3828 virtual Representation RequiredInputRepresentation(int index) {
3838 if (index == 0) { 3829 if (index == 0) {
3839 return Representation::External(); 3830 return Representation::External();
3840 } else { 3831 } else {
3841 bool float_or_double_elements = 3832 bool float_or_double_elements =
3842 elements_kind() == EXTERNAL_FLOAT_ELEMENTS || 3833 elements_kind() == EXTERNAL_FLOAT_ELEMENTS ||
3843 elements_kind() == EXTERNAL_DOUBLE_ELEMENTS; 3834 elements_kind() == EXTERNAL_DOUBLE_ELEMENTS;
3844 if (index == 2 && float_or_double_elements) { 3835 if (index == 2 && float_or_double_elements) {
3845 return Representation::Double(); 3836 return Representation::Double();
3846 } else { 3837 } else {
3847 return Representation::Integer32(); 3838 return Representation::Integer32();
(...skipping 27 matching lines...) Expand all
3875 SetOperandAt(3, context); 3866 SetOperandAt(3, context);
3876 SetAllSideEffects(); 3867 SetAllSideEffects();
3877 } 3868 }
3878 3869
3879 HValue* object() { return OperandAt(0); } 3870 HValue* object() { return OperandAt(0); }
3880 HValue* key() { return OperandAt(1); } 3871 HValue* key() { return OperandAt(1); }
3881 HValue* value() { return OperandAt(2); } 3872 HValue* value() { return OperandAt(2); }
3882 HValue* context() { return OperandAt(3); } 3873 HValue* context() { return OperandAt(3); }
3883 bool strict_mode() { return strict_mode_; } 3874 bool strict_mode() { return strict_mode_; }
3884 3875
3885 virtual Representation RequiredInputRepresentation(int index) const { 3876 virtual Representation RequiredInputRepresentation(int index) {
3886 return Representation::Tagged(); 3877 return Representation::Tagged();
3887 } 3878 }
3888 3879
3889 virtual void PrintDataTo(StringStream* stream); 3880 virtual void PrintDataTo(StringStream* stream);
3890 3881
3891 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) 3882 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric)
3892 3883
3893 private: 3884 private:
3894 bool strict_mode_; 3885 bool strict_mode_;
3895 }; 3886 };
3896 3887
3897 3888
3898 class HStringAdd: public HBinaryOperation { 3889 class HStringAdd: public HBinaryOperation {
3899 public: 3890 public:
3900 HStringAdd(HValue* context, HValue* left, HValue* right) 3891 HStringAdd(HValue* context, HValue* left, HValue* right)
3901 : HBinaryOperation(context, left, right) { 3892 : HBinaryOperation(context, left, right) {
3902 set_representation(Representation::Tagged()); 3893 set_representation(Representation::Tagged());
3903 SetFlag(kUseGVN); 3894 SetFlag(kUseGVN);
3904 SetFlag(kDependsOnMaps); 3895 SetFlag(kDependsOnMaps);
3905 } 3896 }
3906 3897
3907 virtual Representation RequiredInputRepresentation(int index) const { 3898 virtual Representation RequiredInputRepresentation(int index) {
3908 return Representation::Tagged(); 3899 return Representation::Tagged();
3909 } 3900 }
3910 3901
3911 virtual HType CalculateInferredType() { 3902 virtual HType CalculateInferredType() {
3912 return HType::String(); 3903 return HType::String();
3913 } 3904 }
3914 3905
3915 DECLARE_CONCRETE_INSTRUCTION(StringAdd) 3906 DECLARE_CONCRETE_INSTRUCTION(StringAdd)
3916 3907
3917 protected: 3908 protected:
3918 virtual bool DataEquals(HValue* other) { return true; } 3909 virtual bool DataEquals(HValue* other) { return true; }
3919 }; 3910 };
3920 3911
3921 3912
3922 class HStringCharCodeAt: public HTemplateInstruction<3> { 3913 class HStringCharCodeAt: public HTemplateInstruction<3> {
3923 public: 3914 public:
3924 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { 3915 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) {
3925 SetOperandAt(0, context); 3916 SetOperandAt(0, context);
3926 SetOperandAt(1, string); 3917 SetOperandAt(1, string);
3927 SetOperandAt(2, index); 3918 SetOperandAt(2, index);
3928 set_representation(Representation::Integer32()); 3919 set_representation(Representation::Integer32());
3929 SetFlag(kUseGVN); 3920 SetFlag(kUseGVN);
3930 SetFlag(kDependsOnMaps); 3921 SetFlag(kDependsOnMaps);
3931 } 3922 }
3932 3923
3933 virtual Representation RequiredInputRepresentation(int index) const { 3924 virtual Representation RequiredInputRepresentation(int index) {
3934 // The index is supposed to be Integer32. 3925 // The index is supposed to be Integer32.
3935 return index == 2 3926 return index == 2
3936 ? Representation::Integer32() 3927 ? Representation::Integer32()
3937 : Representation::Tagged(); 3928 : Representation::Tagged();
3938 } 3929 }
3939 3930
3940 HValue* context() { return OperandAt(0); } 3931 HValue* context() { return OperandAt(0); }
3941 HValue* string() { return OperandAt(1); } 3932 HValue* string() { return OperandAt(1); }
3942 HValue* index() { return OperandAt(2); } 3933 HValue* index() { return OperandAt(2); }
3943 3934
(...skipping 10 matching lines...) Expand all
3954 3945
3955 class HStringCharFromCode: public HTemplateInstruction<2> { 3946 class HStringCharFromCode: public HTemplateInstruction<2> {
3956 public: 3947 public:
3957 HStringCharFromCode(HValue* context, HValue* char_code) { 3948 HStringCharFromCode(HValue* context, HValue* char_code) {
3958 SetOperandAt(0, context); 3949 SetOperandAt(0, context);
3959 SetOperandAt(1, char_code); 3950 SetOperandAt(1, char_code);
3960 set_representation(Representation::Tagged()); 3951 set_representation(Representation::Tagged());
3961 SetFlag(kUseGVN); 3952 SetFlag(kUseGVN);
3962 } 3953 }
3963 3954
3964 virtual Representation RequiredInputRepresentation(int index) const { 3955 virtual Representation RequiredInputRepresentation(int index) {
3965 return index == 0 3956 return index == 0
3966 ? Representation::Tagged() 3957 ? Representation::Tagged()
3967 : Representation::Integer32(); 3958 : Representation::Integer32();
3968 } 3959 }
3969 3960
3970 HValue* context() { return OperandAt(0); } 3961 HValue* context() { return OperandAt(0); }
3971 HValue* value() { return OperandAt(1); } 3962 HValue* value() { return OperandAt(1); }
3972 3963
3973 virtual bool DataEquals(HValue* other) { return true; } 3964 virtual bool DataEquals(HValue* other) { return true; }
3974 3965
3975 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) 3966 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode)
3976 }; 3967 };
3977 3968
3978 3969
3979 class HStringLength: public HUnaryOperation { 3970 class HStringLength: public HUnaryOperation {
3980 public: 3971 public:
3981 explicit HStringLength(HValue* string) : HUnaryOperation(string) { 3972 explicit HStringLength(HValue* string) : HUnaryOperation(string) {
3982 set_representation(Representation::Tagged()); 3973 set_representation(Representation::Tagged());
3983 SetFlag(kUseGVN); 3974 SetFlag(kUseGVN);
3984 SetFlag(kDependsOnMaps); 3975 SetFlag(kDependsOnMaps);
3985 } 3976 }
3986 3977
3987 virtual Representation RequiredInputRepresentation(int index) const { 3978 virtual Representation RequiredInputRepresentation(int index) {
3988 return Representation::Tagged(); 3979 return Representation::Tagged();
3989 } 3980 }
3990 3981
3991 virtual HType CalculateInferredType() { 3982 virtual HType CalculateInferredType() {
3992 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); 3983 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue);
3993 return HType::Smi(); 3984 return HType::Smi();
3994 } 3985 }
3995 3986
3996 DECLARE_CONCRETE_INSTRUCTION(StringLength) 3987 DECLARE_CONCRETE_INSTRUCTION(StringLength)
3997 3988
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
4033 constant_elements_(constant_elements) { 4024 constant_elements_(constant_elements) {
4034 SetOperandAt(0, context); 4025 SetOperandAt(0, context);
4035 } 4026 }
4036 4027
4037 HValue* context() { return OperandAt(0); } 4028 HValue* context() { return OperandAt(0); }
4038 Handle<FixedArray> constant_elements() const { return constant_elements_; } 4029 Handle<FixedArray> constant_elements() const { return constant_elements_; }
4039 int length() const { return length_; } 4030 int length() const { return length_; }
4040 4031
4041 bool IsCopyOnWrite() const; 4032 bool IsCopyOnWrite() const;
4042 4033
4043 virtual Representation RequiredInputRepresentation(int index) const { 4034 virtual Representation RequiredInputRepresentation(int index) {
4044 return Representation::Tagged(); 4035 return Representation::Tagged();
4045 } 4036 }
4046 4037
4047 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral) 4038 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral)
4048 4039
4049 private: 4040 private:
4050 int length_; 4041 int length_;
4051 Handle<FixedArray> constant_elements_; 4042 Handle<FixedArray> constant_elements_;
4052 }; 4043 };
4053 4044
(...skipping 13 matching lines...) Expand all
4067 SetOperandAt(0, context); 4058 SetOperandAt(0, context);
4068 } 4059 }
4069 4060
4070 HValue* context() { return OperandAt(0); } 4061 HValue* context() { return OperandAt(0); }
4071 Handle<FixedArray> constant_properties() const { 4062 Handle<FixedArray> constant_properties() const {
4072 return constant_properties_; 4063 return constant_properties_;
4073 } 4064 }
4074 bool fast_elements() const { return fast_elements_; } 4065 bool fast_elements() const { return fast_elements_; }
4075 bool has_function() const { return has_function_; } 4066 bool has_function() const { return has_function_; }
4076 4067
4077 virtual Representation RequiredInputRepresentation(int index) const { 4068 virtual Representation RequiredInputRepresentation(int index) {
4078 return Representation::Tagged(); 4069 return Representation::Tagged();
4079 } 4070 }
4080 4071
4081 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral) 4072 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral)
4082 4073
4083 private: 4074 private:
4084 Handle<FixedArray> constant_properties_; 4075 Handle<FixedArray> constant_properties_;
4085 bool fast_elements_; 4076 bool fast_elements_;
4086 bool has_function_; 4077 bool has_function_;
4087 }; 4078 };
4088 4079
4089 4080
4090 class HRegExpLiteral: public HMaterializedLiteral<1> { 4081 class HRegExpLiteral: public HMaterializedLiteral<1> {
4091 public: 4082 public:
4092 HRegExpLiteral(HValue* context, 4083 HRegExpLiteral(HValue* context,
4093 Handle<String> pattern, 4084 Handle<String> pattern,
4094 Handle<String> flags, 4085 Handle<String> flags,
4095 int literal_index) 4086 int literal_index)
4096 : HMaterializedLiteral<1>(literal_index, 0), 4087 : HMaterializedLiteral<1>(literal_index, 0),
4097 pattern_(pattern), 4088 pattern_(pattern),
4098 flags_(flags) { 4089 flags_(flags) {
4099 SetOperandAt(0, context); 4090 SetOperandAt(0, context);
4100 } 4091 }
4101 4092
4102 HValue* context() { return OperandAt(0); } 4093 HValue* context() { return OperandAt(0); }
4103 Handle<String> pattern() { return pattern_; } 4094 Handle<String> pattern() { return pattern_; }
4104 Handle<String> flags() { return flags_; } 4095 Handle<String> flags() { return flags_; }
4105 4096
4106 virtual Representation RequiredInputRepresentation(int index) const { 4097 virtual Representation RequiredInputRepresentation(int index) {
4107 return Representation::Tagged(); 4098 return Representation::Tagged();
4108 } 4099 }
4109 4100
4110 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) 4101 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral)
4111 4102
4112 private: 4103 private:
4113 Handle<String> pattern_; 4104 Handle<String> pattern_;
4114 Handle<String> flags_; 4105 Handle<String> flags_;
4115 }; 4106 };
4116 4107
4117 4108
4118 class HFunctionLiteral: public HTemplateInstruction<1> { 4109 class HFunctionLiteral: public HTemplateInstruction<1> {
4119 public: 4110 public:
4120 HFunctionLiteral(HValue* context, 4111 HFunctionLiteral(HValue* context,
4121 Handle<SharedFunctionInfo> shared, 4112 Handle<SharedFunctionInfo> shared,
4122 bool pretenure) 4113 bool pretenure)
4123 : shared_info_(shared), pretenure_(pretenure) { 4114 : shared_info_(shared), pretenure_(pretenure) {
4124 SetOperandAt(0, context); 4115 SetOperandAt(0, context);
4125 set_representation(Representation::Tagged()); 4116 set_representation(Representation::Tagged());
4126 } 4117 }
4127 4118
4128 HValue* context() { return OperandAt(0); } 4119 HValue* context() { return OperandAt(0); }
4129 4120
4130 virtual Representation RequiredInputRepresentation(int index) const { 4121 virtual Representation RequiredInputRepresentation(int index) {
4131 return Representation::Tagged(); 4122 return Representation::Tagged();
4132 } 4123 }
4133 4124
4134 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) 4125 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral)
4135 4126
4136 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } 4127 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
4137 bool pretenure() const { return pretenure_; } 4128 bool pretenure() const { return pretenure_; }
4138 4129
4139 private: 4130 private:
4140 Handle<SharedFunctionInfo> shared_info_; 4131 Handle<SharedFunctionInfo> shared_info_;
4141 bool pretenure_; 4132 bool pretenure_;
4142 }; 4133 };
4143 4134
4144 4135
4145 class HTypeof: public HTemplateInstruction<2> { 4136 class HTypeof: public HTemplateInstruction<2> {
4146 public: 4137 public:
4147 explicit HTypeof(HValue* context, HValue* value) { 4138 explicit HTypeof(HValue* context, HValue* value) {
4148 SetOperandAt(0, context); 4139 SetOperandAt(0, context);
4149 SetOperandAt(1, value); 4140 SetOperandAt(1, value);
4150 set_representation(Representation::Tagged()); 4141 set_representation(Representation::Tagged());
4151 } 4142 }
4152 4143
4153 HValue* context() { return OperandAt(0); } 4144 HValue* context() { return OperandAt(0); }
4154 HValue* value() { return OperandAt(1); } 4145 HValue* value() { return OperandAt(1); }
4155 4146
4156 virtual void PrintDataTo(StringStream* stream); 4147 virtual void PrintDataTo(StringStream* stream);
4157 4148
4158 virtual Representation RequiredInputRepresentation(int index) const { 4149 virtual Representation RequiredInputRepresentation(int index) {
4159 return Representation::Tagged(); 4150 return Representation::Tagged();
4160 } 4151 }
4161 4152
4162 DECLARE_CONCRETE_INSTRUCTION(Typeof) 4153 DECLARE_CONCRETE_INSTRUCTION(Typeof)
4163 }; 4154 };
4164 4155
4165 4156
4166 class HToFastProperties: public HUnaryOperation { 4157 class HToFastProperties: public HUnaryOperation {
4167 public: 4158 public:
4168 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { 4159 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) {
4169 // This instruction is not marked as having side effects, but 4160 // This instruction is not marked as having side effects, but
4170 // 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
4171 // object literals. 4162 // object literals.
4172 ASSERT(value->IsObjectLiteral()); 4163 ASSERT(value->IsObjectLiteral());
4173 set_representation(Representation::Tagged()); 4164 set_representation(Representation::Tagged());
4174 } 4165 }
4175 4166
4176 virtual Representation RequiredInputRepresentation(int index) const { 4167 virtual Representation RequiredInputRepresentation(int index) {
4177 return Representation::Tagged(); 4168 return Representation::Tagged();
4178 } 4169 }
4179 4170
4180 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) 4171 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties)
4181 }; 4172 };
4182 4173
4183 4174
4184 class HValueOf: public HUnaryOperation { 4175 class HValueOf: public HUnaryOperation {
4185 public: 4176 public:
4186 explicit HValueOf(HValue* value) : HUnaryOperation(value) { 4177 explicit HValueOf(HValue* value) : HUnaryOperation(value) {
4187 set_representation(Representation::Tagged()); 4178 set_representation(Representation::Tagged());
4188 } 4179 }
4189 4180
4190 virtual Representation RequiredInputRepresentation(int index) const { 4181 virtual Representation RequiredInputRepresentation(int index) {
4191 return Representation::Tagged(); 4182 return Representation::Tagged();
4192 } 4183 }
4193 4184
4194 DECLARE_CONCRETE_INSTRUCTION(ValueOf) 4185 DECLARE_CONCRETE_INSTRUCTION(ValueOf)
4195 }; 4186 };
4196 4187
4197 4188
4198 class HDeleteProperty: public HBinaryOperation { 4189 class HDeleteProperty: public HBinaryOperation {
4199 public: 4190 public:
4200 HDeleteProperty(HValue* context, HValue* obj, HValue* key) 4191 HDeleteProperty(HValue* context, HValue* obj, HValue* key)
4201 : HBinaryOperation(context, obj, key) { 4192 : HBinaryOperation(context, obj, key) {
4202 set_representation(Representation::Tagged()); 4193 set_representation(Representation::Tagged());
4203 SetAllSideEffects(); 4194 SetAllSideEffects();
4204 } 4195 }
4205 4196
4206 virtual Representation RequiredInputRepresentation(int index) const { 4197 virtual Representation RequiredInputRepresentation(int index) {
4207 return Representation::Tagged(); 4198 return Representation::Tagged();
4208 } 4199 }
4209 4200
4210 virtual HType CalculateInferredType(); 4201 virtual HType CalculateInferredType();
4211 4202
4212 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty) 4203 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty)
4213 4204
4214 HValue* object() { return left(); } 4205 HValue* object() { return left(); }
4215 HValue* key() { return right(); } 4206 HValue* key() { return right(); }
4216 }; 4207 };
4217 4208
4218 4209
4219 class HIn: public HTemplateInstruction<3> { 4210 class HIn: public HTemplateInstruction<3> {
4220 public: 4211 public:
4221 HIn(HValue* context, HValue* key, HValue* object) { 4212 HIn(HValue* context, HValue* key, HValue* object) {
4222 SetOperandAt(0, context); 4213 SetOperandAt(0, context);
4223 SetOperandAt(1, key); 4214 SetOperandAt(1, key);
4224 SetOperandAt(2, object); 4215 SetOperandAt(2, object);
4225 set_representation(Representation::Tagged()); 4216 set_representation(Representation::Tagged());
4226 SetAllSideEffects(); 4217 SetAllSideEffects();
4227 } 4218 }
4228 4219
4229 HValue* context() { return OperandAt(0); } 4220 HValue* context() { return OperandAt(0); }
4230 HValue* key() { return OperandAt(1); } 4221 HValue* key() { return OperandAt(1); }
4231 HValue* object() { return OperandAt(2); } 4222 HValue* object() { return OperandAt(2); }
4232 4223
4233 virtual Representation RequiredInputRepresentation(int index) const { 4224 virtual Representation RequiredInputRepresentation(int index) {
4234 return Representation::Tagged(); 4225 return Representation::Tagged();
4235 } 4226 }
4236 4227
4237 virtual HType CalculateInferredType() { 4228 virtual HType CalculateInferredType() {
4238 return HType::Boolean(); 4229 return HType::Boolean();
4239 } 4230 }
4240 4231
4241 virtual void PrintDataTo(StringStream* stream); 4232 virtual void PrintDataTo(StringStream* stream);
4242 4233
4243 DECLARE_CONCRETE_INSTRUCTION(In) 4234 DECLARE_CONCRETE_INSTRUCTION(In)
4244 }; 4235 };
4245 4236
4246 #undef DECLARE_INSTRUCTION 4237 #undef DECLARE_INSTRUCTION
4247 #undef DECLARE_CONCRETE_INSTRUCTION 4238 #undef DECLARE_CONCRETE_INSTRUCTION
4248 4239
4249 } } // namespace v8::internal 4240 } } // namespace v8::internal
4250 4241
4251 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 4242 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698