OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 V(DoubleArrayElements) \ | 203 V(DoubleArrayElements) \ |
204 V(DoubleFields) \ | 204 V(DoubleFields) \ |
205 V(ElementsKind) \ | 205 V(ElementsKind) \ |
206 V(ElementsPointer) \ | 206 V(ElementsPointer) \ |
207 V(GlobalVars) \ | 207 V(GlobalVars) \ |
208 V(InobjectFields) \ | 208 V(InobjectFields) \ |
209 V(OsrEntries) \ | 209 V(OsrEntries) \ |
210 V(ExternalMemory) | 210 V(ExternalMemory) |
211 | 211 |
212 | 212 |
213 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ | 213 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ |
214 virtual bool Is##type() const V8_FINAL V8_OVERRIDE { return true; } \ | 214 virtual bool Is##type() const { return true; } \ |
215 static H##type* cast(HValue* value) { \ | 215 static H##type* cast(HValue* value) { \ |
216 ASSERT(value->Is##type()); \ | 216 ASSERT(value->Is##type()); \ |
217 return reinterpret_cast<H##type*>(value); \ | 217 return reinterpret_cast<H##type*>(value); \ |
218 } | 218 } |
219 | 219 |
220 | 220 |
221 #define DECLARE_CONCRETE_INSTRUCTION(type) \ | 221 #define DECLARE_CONCRETE_INSTRUCTION(type) \ |
222 virtual LInstruction* CompileToLithium( \ | 222 virtual LInstruction* CompileToLithium(LChunkBuilder* builder); \ |
223 LChunkBuilder* builder) V8_FINAL V8_OVERRIDE; \ | 223 static H##type* cast(HValue* value) { \ |
224 static H##type* cast(HValue* value) { \ | 224 ASSERT(value->Is##type()); \ |
225 ASSERT(value->Is##type()); \ | 225 return reinterpret_cast<H##type*>(value); \ |
226 return reinterpret_cast<H##type*>(value); \ | 226 } \ |
227 } \ | 227 virtual Opcode opcode() const { return HValue::k##type; } |
228 virtual Opcode opcode() const V8_FINAL V8_OVERRIDE { \ | |
229 return HValue::k##type; \ | |
230 } | |
231 | 228 |
232 | 229 |
233 class Range V8_FINAL : public ZoneObject { | 230 class Range: public ZoneObject { |
234 public: | 231 public: |
235 Range() | 232 Range() |
236 : lower_(kMinInt), | 233 : lower_(kMinInt), |
237 upper_(kMaxInt), | 234 upper_(kMaxInt), |
238 next_(NULL), | 235 next_(NULL), |
239 can_be_minus_zero_(false) { } | 236 can_be_minus_zero_(false) { } |
240 | 237 |
241 Range(int32_t lower, int32_t upper) | 238 Range(int32_t lower, int32_t upper) |
242 : lower_(lower), | 239 : lower_(lower), |
243 upper_(upper), | 240 upper_(upper), |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 bool MulAndCheckOverflow(const Representation& r, Range* other); | 295 bool MulAndCheckOverflow(const Representation& r, Range* other); |
299 | 296 |
300 private: | 297 private: |
301 int32_t lower_; | 298 int32_t lower_; |
302 int32_t upper_; | 299 int32_t upper_; |
303 Range* next_; | 300 Range* next_; |
304 bool can_be_minus_zero_; | 301 bool can_be_minus_zero_; |
305 }; | 302 }; |
306 | 303 |
307 | 304 |
308 class UniqueValueId V8_FINAL { | 305 class UniqueValueId { |
309 public: | 306 public: |
310 UniqueValueId() : raw_address_(NULL) { } | 307 UniqueValueId() : raw_address_(NULL) { } |
311 | 308 |
312 explicit UniqueValueId(Object* object) { | 309 explicit UniqueValueId(Object* object) { |
313 raw_address_ = reinterpret_cast<Address>(object); | 310 raw_address_ = reinterpret_cast<Address>(object); |
314 ASSERT(IsInitialized()); | 311 ASSERT(IsInitialized()); |
315 } | 312 } |
316 | 313 |
317 explicit UniqueValueId(Handle<Object> handle) { | 314 explicit UniqueValueId(Handle<Object> handle) { |
318 static const Address kEmptyHandleSentinel = reinterpret_cast<Address>(1); | 315 static const Address kEmptyHandleSentinel = reinterpret_cast<Address>(1); |
(...skipping 21 matching lines...) Expand all Loading... |
340 intptr_t Hashcode() const { | 337 intptr_t Hashcode() const { |
341 ASSERT(IsInitialized()); | 338 ASSERT(IsInitialized()); |
342 return reinterpret_cast<intptr_t>(raw_address_); | 339 return reinterpret_cast<intptr_t>(raw_address_); |
343 } | 340 } |
344 | 341 |
345 private: | 342 private: |
346 Address raw_address_; | 343 Address raw_address_; |
347 }; | 344 }; |
348 | 345 |
349 | 346 |
350 class HType V8_FINAL { | 347 class HType { |
351 public: | 348 public: |
352 static HType None() { return HType(kNone); } | 349 static HType None() { return HType(kNone); } |
353 static HType Tagged() { return HType(kTagged); } | 350 static HType Tagged() { return HType(kTagged); } |
354 static HType TaggedPrimitive() { return HType(kTaggedPrimitive); } | 351 static HType TaggedPrimitive() { return HType(kTaggedPrimitive); } |
355 static HType TaggedNumber() { return HType(kTaggedNumber); } | 352 static HType TaggedNumber() { return HType(kTaggedNumber); } |
356 static HType Smi() { return HType(kSmi); } | 353 static HType Smi() { return HType(kSmi); } |
357 static HType HeapNumber() { return HType(kHeapNumber); } | 354 static HType HeapNumber() { return HType(kHeapNumber); } |
358 static HType String() { return HType(kString); } | 355 static HType String() { return HType(kString); } |
359 static HType Boolean() { return HType(kBoolean); } | 356 static HType Boolean() { return HType(kBoolean); } |
360 static HType NonPrimitive() { return HType(kNonPrimitive); } | 357 static HType NonPrimitive() { return HType(kNonPrimitive); } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 | 488 |
492 private: | 489 private: |
493 HUseListNode* tail_; | 490 HUseListNode* tail_; |
494 HValue* value_; | 491 HValue* value_; |
495 int index_; | 492 int index_; |
496 }; | 493 }; |
497 | 494 |
498 | 495 |
499 // We reuse use list nodes behind the scenes as uses are added and deleted. | 496 // We reuse use list nodes behind the scenes as uses are added and deleted. |
500 // This class is the safe way to iterate uses while deleting them. | 497 // This class is the safe way to iterate uses while deleting them. |
501 class HUseIterator V8_FINAL BASE_EMBEDDED { | 498 class HUseIterator BASE_EMBEDDED { |
502 public: | 499 public: |
503 bool Done() { return current_ == NULL; } | 500 bool Done() { return current_ == NULL; } |
504 void Advance(); | 501 void Advance(); |
505 | 502 |
506 HValue* value() { | 503 HValue* value() { |
507 ASSERT(!Done()); | 504 ASSERT(!Done()); |
508 return value_; | 505 return value_; |
509 } | 506 } |
510 | 507 |
511 int index() { | 508 int index() { |
(...skipping 23 matching lines...) Expand all Loading... |
535 GVN_UNTRACKED_FLAG_LIST(DECLARE_FLAG) | 532 GVN_UNTRACKED_FLAG_LIST(DECLARE_FLAG) |
536 #undef DECLARE_FLAG | 533 #undef DECLARE_FLAG |
537 kAfterLastFlag, | 534 kAfterLastFlag, |
538 kLastFlag = kAfterLastFlag - 1, | 535 kLastFlag = kAfterLastFlag - 1, |
539 #define COUNT_FLAG(type) + 1 | 536 #define COUNT_FLAG(type) + 1 |
540 kNumberOfTrackedSideEffects = 0 GVN_TRACKED_FLAG_LIST(COUNT_FLAG) | 537 kNumberOfTrackedSideEffects = 0 GVN_TRACKED_FLAG_LIST(COUNT_FLAG) |
541 #undef COUNT_FLAG | 538 #undef COUNT_FLAG |
542 }; | 539 }; |
543 | 540 |
544 | 541 |
545 class DecompositionResult V8_FINAL BASE_EMBEDDED { | 542 class DecompositionResult BASE_EMBEDDED { |
546 public: | 543 public: |
547 DecompositionResult() : base_(NULL), offset_(0), scale_(0) {} | 544 DecompositionResult() : base_(NULL), offset_(0), scale_(0) {} |
548 | 545 |
549 HValue* base() { return base_; } | 546 HValue* base() { return base_; } |
550 int offset() { return offset_; } | 547 int offset() { return offset_; } |
551 int scale() { return scale_; } | 548 int scale() { return scale_; } |
552 | 549 |
553 bool Apply(HValue* other_base, int other_offset, int other_scale = 0) { | 550 bool Apply(HValue* other_base, int other_offset, int other_scale = 0) { |
554 if (base_ == NULL) { | 551 if (base_ == NULL) { |
555 base_ = other_base; | 552 base_ = other_base; |
(...skipping 27 matching lines...) Expand all Loading... |
583 | 580 |
584 HValue* base_; | 581 HValue* base_; |
585 int offset_; | 582 int offset_; |
586 int scale_; | 583 int scale_; |
587 }; | 584 }; |
588 | 585 |
589 | 586 |
590 typedef EnumSet<GVNFlag> GVNFlagSet; | 587 typedef EnumSet<GVNFlag> GVNFlagSet; |
591 | 588 |
592 | 589 |
593 class HValue : public ZoneObject { | 590 class HValue: public ZoneObject { |
594 public: | 591 public: |
595 static const int kNoNumber = -1; | 592 static const int kNoNumber = -1; |
596 | 593 |
597 enum Flag { | 594 enum Flag { |
598 kFlexibleRepresentation, | 595 kFlexibleRepresentation, |
599 kCannotBeTagged, | 596 kCannotBeTagged, |
600 // Participate in Global Value Numbering, i.e. elimination of | 597 // Participate in Global Value Numbering, i.e. elimination of |
601 // unnecessary recomputations. If an instruction sets this flag, it must | 598 // unnecessary recomputations. If an instruction sets this flag, it must |
602 // implement DataEquals(), which will be used to determine if other | 599 // implement DataEquals(), which will be used to determine if other |
603 // occurrences of the instruction are indeed the same. | 600 // occurrences of the instruction are indeed the same. |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 HValue* context, \ | 1075 HValue* context, \ |
1079 P1 p1, \ | 1076 P1 p1, \ |
1080 P2 p2, \ | 1077 P2 p2, \ |
1081 P3 p3, \ | 1078 P3 p3, \ |
1082 P4 p4, \ | 1079 P4 p4, \ |
1083 P5 p5) { \ | 1080 P5 p5) { \ |
1084 return new(zone) I(p1, p2, p3, p4, p5); \ | 1081 return new(zone) I(p1, p2, p3, p4, p5); \ |
1085 } | 1082 } |
1086 | 1083 |
1087 | 1084 |
1088 class HInstruction : public HValue { | 1085 class HInstruction: public HValue { |
1089 public: | 1086 public: |
1090 HInstruction* next() const { return next_; } | 1087 HInstruction* next() const { return next_; } |
1091 HInstruction* previous() const { return previous_; } | 1088 HInstruction* previous() const { return previous_; } |
1092 | 1089 |
1093 virtual void PrintTo(StringStream* stream) V8_OVERRIDE; | 1090 virtual void PrintTo(StringStream* stream); |
1094 virtual void PrintDataTo(StringStream* stream); | 1091 virtual void PrintDataTo(StringStream* stream); |
1095 | 1092 |
1096 bool IsLinked() const { return block() != NULL; } | 1093 bool IsLinked() const { return block() != NULL; } |
1097 void Unlink(); | 1094 void Unlink(); |
1098 void InsertBefore(HInstruction* next); | 1095 void InsertBefore(HInstruction* next); |
1099 void InsertAfter(HInstruction* previous); | 1096 void InsertAfter(HInstruction* previous); |
1100 | 1097 |
1101 // The position is a write-once variable. | 1098 // The position is a write-once variable. |
1102 int position() const { return position_; } | 1099 int position() const { return position_; } |
1103 bool has_position() const { return position_ != RelocInfo::kNoPosition; } | 1100 bool has_position() const { return position_ != RelocInfo::kNoPosition; } |
1104 void set_position(int position) { | 1101 void set_position(int position) { |
1105 ASSERT(!has_position()); | 1102 ASSERT(!has_position()); |
1106 ASSERT(position != RelocInfo::kNoPosition); | 1103 ASSERT(position != RelocInfo::kNoPosition); |
1107 position_ = position; | 1104 position_ = position; |
1108 } | 1105 } |
1109 | 1106 |
1110 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } | 1107 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } |
1111 | 1108 |
1112 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; | 1109 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; |
1113 | 1110 |
1114 #ifdef DEBUG | 1111 #ifdef DEBUG |
1115 virtual void Verify() V8_OVERRIDE; | 1112 virtual void Verify(); |
1116 #endif | 1113 #endif |
1117 | 1114 |
1118 virtual bool IsCall() { return false; } | 1115 virtual bool IsCall() { return false; } |
1119 | 1116 |
1120 DECLARE_ABSTRACT_INSTRUCTION(Instruction) | 1117 DECLARE_ABSTRACT_INSTRUCTION(Instruction) |
1121 | 1118 |
1122 protected: | 1119 protected: |
1123 HInstruction(HType type = HType::Tagged()) | 1120 HInstruction(HType type = HType::Tagged()) |
1124 : HValue(type), | 1121 : HValue(type), |
1125 next_(NULL), | 1122 next_(NULL), |
1126 previous_(NULL), | 1123 previous_(NULL), |
1127 position_(RelocInfo::kNoPosition) { | 1124 position_(RelocInfo::kNoPosition) { |
1128 SetGVNFlag(kDependsOnOsrEntries); | 1125 SetGVNFlag(kDependsOnOsrEntries); |
1129 } | 1126 } |
1130 | 1127 |
1131 virtual void DeleteFromGraph() V8_OVERRIDE { Unlink(); } | 1128 virtual void DeleteFromGraph() { Unlink(); } |
1132 | 1129 |
1133 private: | 1130 private: |
1134 void InitializeAsFirst(HBasicBlock* block) { | 1131 void InitializeAsFirst(HBasicBlock* block) { |
1135 ASSERT(!IsLinked()); | 1132 ASSERT(!IsLinked()); |
1136 SetBlock(block); | 1133 SetBlock(block); |
1137 } | 1134 } |
1138 | 1135 |
1139 void PrintMnemonicTo(StringStream* stream); | 1136 void PrintMnemonicTo(StringStream* stream); |
1140 | 1137 |
1141 HInstruction* next_; | 1138 HInstruction* next_; |
1142 HInstruction* previous_; | 1139 HInstruction* previous_; |
1143 int position_; | 1140 int position_; |
1144 | 1141 |
1145 friend class HBasicBlock; | 1142 friend class HBasicBlock; |
1146 }; | 1143 }; |
1147 | 1144 |
1148 | 1145 |
1149 template<int V> | 1146 template<int V> |
1150 class HTemplateInstruction : public HInstruction { | 1147 class HTemplateInstruction : public HInstruction { |
1151 public: | 1148 public: |
1152 virtual int OperandCount() V8_FINAL V8_OVERRIDE { return V; } | 1149 int OperandCount() { return V; } |
1153 virtual HValue* OperandAt(int i) const V8_FINAL V8_OVERRIDE { | 1150 HValue* OperandAt(int i) const { return inputs_[i]; } |
1154 return inputs_[i]; | |
1155 } | |
1156 | 1151 |
1157 protected: | 1152 protected: |
1158 HTemplateInstruction(HType type = HType::Tagged()) : HInstruction(type) {} | 1153 HTemplateInstruction(HType type = HType::Tagged()) : HInstruction(type) {} |
1159 | 1154 |
1160 virtual void InternalSetOperandAt(int i, HValue* value) V8_FINAL V8_OVERRIDE { | 1155 void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; } |
1161 inputs_[i] = value; | |
1162 } | |
1163 | 1156 |
1164 private: | 1157 private: |
1165 EmbeddedContainer<HValue*, V> inputs_; | 1158 EmbeddedContainer<HValue*, V> inputs_; |
1166 }; | 1159 }; |
1167 | 1160 |
1168 | 1161 |
1169 class HControlInstruction : public HInstruction { | 1162 class HControlInstruction: public HInstruction { |
1170 public: | 1163 public: |
1171 virtual HBasicBlock* SuccessorAt(int i) = 0; | 1164 virtual HBasicBlock* SuccessorAt(int i) = 0; |
1172 virtual int SuccessorCount() = 0; | 1165 virtual int SuccessorCount() = 0; |
1173 virtual void SetSuccessorAt(int i, HBasicBlock* block) = 0; | 1166 virtual void SetSuccessorAt(int i, HBasicBlock* block) = 0; |
1174 | 1167 |
1175 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1168 virtual void PrintDataTo(StringStream* stream); |
1176 | 1169 |
1177 HBasicBlock* FirstSuccessor() { | 1170 HBasicBlock* FirstSuccessor() { |
1178 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL; | 1171 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL; |
1179 } | 1172 } |
1180 HBasicBlock* SecondSuccessor() { | 1173 HBasicBlock* SecondSuccessor() { |
1181 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL; | 1174 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL; |
1182 } | 1175 } |
1183 | 1176 |
1184 DECLARE_ABSTRACT_INSTRUCTION(ControlInstruction) | 1177 DECLARE_ABSTRACT_INSTRUCTION(ControlInstruction) |
1185 }; | 1178 }; |
1186 | 1179 |
1187 | 1180 |
1188 class HSuccessorIterator V8_FINAL BASE_EMBEDDED { | 1181 class HSuccessorIterator BASE_EMBEDDED { |
1189 public: | 1182 public: |
1190 explicit HSuccessorIterator(HControlInstruction* instr) | 1183 explicit HSuccessorIterator(HControlInstruction* instr) |
1191 : instr_(instr), current_(0) { } | 1184 : instr_(instr), current_(0) { } |
1192 | 1185 |
1193 bool Done() { return current_ >= instr_->SuccessorCount(); } | 1186 bool Done() { return current_ >= instr_->SuccessorCount(); } |
1194 HBasicBlock* Current() { return instr_->SuccessorAt(current_); } | 1187 HBasicBlock* Current() { return instr_->SuccessorAt(current_); } |
1195 void Advance() { current_++; } | 1188 void Advance() { current_++; } |
1196 | 1189 |
1197 private: | 1190 private: |
1198 HControlInstruction* instr_; | 1191 HControlInstruction* instr_; |
1199 int current_; | 1192 int current_; |
1200 }; | 1193 }; |
1201 | 1194 |
1202 | 1195 |
1203 template<int S, int V> | 1196 template<int S, int V> |
1204 class HTemplateControlInstruction : public HControlInstruction { | 1197 class HTemplateControlInstruction: public HControlInstruction { |
1205 public: | 1198 public: |
1206 int SuccessorCount() V8_OVERRIDE { return S; } | 1199 int SuccessorCount() { return S; } |
1207 HBasicBlock* SuccessorAt(int i) V8_OVERRIDE { return successors_[i]; } | 1200 HBasicBlock* SuccessorAt(int i) { return successors_[i]; } |
1208 void SetSuccessorAt(int i, HBasicBlock* block) V8_OVERRIDE { | 1201 void SetSuccessorAt(int i, HBasicBlock* block) { successors_[i] = block; } |
1209 successors_[i] = block; | |
1210 } | |
1211 | 1202 |
1212 int OperandCount() V8_OVERRIDE { return V; } | 1203 int OperandCount() { return V; } |
1213 HValue* OperandAt(int i) const V8_OVERRIDE { return inputs_[i]; } | 1204 HValue* OperandAt(int i) const { return inputs_[i]; } |
1214 | 1205 |
1215 | 1206 |
1216 protected: | 1207 protected: |
1217 void InternalSetOperandAt(int i, HValue* value) V8_OVERRIDE { | 1208 void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; } |
1218 inputs_[i] = value; | |
1219 } | |
1220 | 1209 |
1221 private: | 1210 private: |
1222 EmbeddedContainer<HBasicBlock*, S> successors_; | 1211 EmbeddedContainer<HBasicBlock*, S> successors_; |
1223 EmbeddedContainer<HValue*, V> inputs_; | 1212 EmbeddedContainer<HValue*, V> inputs_; |
1224 }; | 1213 }; |
1225 | 1214 |
1226 | 1215 |
1227 class HBlockEntry V8_FINAL : public HTemplateInstruction<0> { | 1216 class HBlockEntry: public HTemplateInstruction<0> { |
1228 public: | 1217 public: |
1229 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1218 virtual Representation RequiredInputRepresentation(int index) { |
1230 return Representation::None(); | 1219 return Representation::None(); |
1231 } | 1220 } |
1232 | 1221 |
1233 DECLARE_CONCRETE_INSTRUCTION(BlockEntry) | 1222 DECLARE_CONCRETE_INSTRUCTION(BlockEntry) |
1234 }; | 1223 }; |
1235 | 1224 |
1236 | 1225 |
1237 class HDummyUse V8_FINAL : public HTemplateInstruction<1> { | 1226 class HDummyUse: public HTemplateInstruction<1> { |
1238 public: | 1227 public: |
1239 explicit HDummyUse(HValue* value) | 1228 explicit HDummyUse(HValue* value) |
1240 : HTemplateInstruction<1>(HType::Smi()) { | 1229 : HTemplateInstruction<1>(HType::Smi()) { |
1241 SetOperandAt(0, value); | 1230 SetOperandAt(0, value); |
1242 // Pretend to be a Smi so that the HChange instructions inserted | 1231 // Pretend to be a Smi so that the HChange instructions inserted |
1243 // before any use generate as little code as possible. | 1232 // before any use generate as little code as possible. |
1244 set_representation(Representation::Tagged()); | 1233 set_representation(Representation::Tagged()); |
1245 } | 1234 } |
1246 | 1235 |
1247 HValue* value() { return OperandAt(0); } | 1236 HValue* value() { return OperandAt(0); } |
1248 | 1237 |
1249 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } | 1238 virtual bool HasEscapingOperandAt(int index) { return false; } |
1250 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1239 virtual Representation RequiredInputRepresentation(int index) { |
1251 return Representation::None(); | 1240 return Representation::None(); |
1252 } | 1241 } |
1253 | 1242 |
1254 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1243 virtual void PrintDataTo(StringStream* stream); |
1255 | 1244 |
1256 DECLARE_CONCRETE_INSTRUCTION(DummyUse); | 1245 DECLARE_CONCRETE_INSTRUCTION(DummyUse); |
1257 }; | 1246 }; |
1258 | 1247 |
1259 | 1248 |
1260 class HDeoptimize V8_FINAL : public HTemplateInstruction<0> { | 1249 class HDeoptimize: public HTemplateInstruction<0> { |
1261 public: | 1250 public: |
1262 DECLARE_INSTRUCTION_FACTORY_P2(HDeoptimize, const char*, | 1251 DECLARE_INSTRUCTION_FACTORY_P2(HDeoptimize, const char*, |
1263 Deoptimizer::BailoutType); | 1252 Deoptimizer::BailoutType); |
1264 | 1253 |
1265 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1254 virtual Representation RequiredInputRepresentation(int index) { |
1266 return Representation::None(); | 1255 return Representation::None(); |
1267 } | 1256 } |
1268 | 1257 |
1269 const char* reason() const { return reason_; } | 1258 const char* reason() const { return reason_; } |
1270 Deoptimizer::BailoutType type() { return type_; } | 1259 Deoptimizer::BailoutType type() { return type_; } |
1271 | 1260 |
1272 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) | 1261 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) |
1273 | 1262 |
1274 private: | 1263 private: |
1275 explicit HDeoptimize(const char* reason, Deoptimizer::BailoutType type) | 1264 explicit HDeoptimize(const char* reason, Deoptimizer::BailoutType type) |
1276 : reason_(reason), type_(type) {} | 1265 : reason_(reason), type_(type) {} |
1277 | 1266 |
1278 const char* reason_; | 1267 const char* reason_; |
1279 Deoptimizer::BailoutType type_; | 1268 Deoptimizer::BailoutType type_; |
1280 }; | 1269 }; |
1281 | 1270 |
1282 | 1271 |
1283 // Inserts an int3/stop break instruction for debugging purposes. | 1272 // Inserts an int3/stop break instruction for debugging purposes. |
1284 class HDebugBreak V8_FINAL : public HTemplateInstruction<0> { | 1273 class HDebugBreak: public HTemplateInstruction<0> { |
1285 public: | 1274 public: |
1286 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1275 virtual Representation RequiredInputRepresentation(int index) { |
1287 return Representation::None(); | 1276 return Representation::None(); |
1288 } | 1277 } |
1289 | 1278 |
1290 DECLARE_CONCRETE_INSTRUCTION(DebugBreak) | 1279 DECLARE_CONCRETE_INSTRUCTION(DebugBreak) |
1291 }; | 1280 }; |
1292 | 1281 |
1293 | 1282 |
1294 class HGoto V8_FINAL : public HTemplateControlInstruction<1, 0> { | 1283 class HGoto: public HTemplateControlInstruction<1, 0> { |
1295 public: | 1284 public: |
1296 explicit HGoto(HBasicBlock* target) { | 1285 explicit HGoto(HBasicBlock* target) { |
1297 SetSuccessorAt(0, target); | 1286 SetSuccessorAt(0, target); |
1298 } | 1287 } |
1299 | 1288 |
1300 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1289 virtual Representation RequiredInputRepresentation(int index) { |
1301 return Representation::None(); | 1290 return Representation::None(); |
1302 } | 1291 } |
1303 | 1292 |
1304 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1293 virtual void PrintDataTo(StringStream* stream); |
1305 | 1294 |
1306 DECLARE_CONCRETE_INSTRUCTION(Goto) | 1295 DECLARE_CONCRETE_INSTRUCTION(Goto) |
1307 }; | 1296 }; |
1308 | 1297 |
1309 | 1298 |
1310 class HUnaryControlInstruction : public HTemplateControlInstruction<2, 1> { | 1299 class HUnaryControlInstruction: public HTemplateControlInstruction<2, 1> { |
1311 public: | 1300 public: |
1312 HUnaryControlInstruction(HValue* value, | 1301 HUnaryControlInstruction(HValue* value, |
1313 HBasicBlock* true_target, | 1302 HBasicBlock* true_target, |
1314 HBasicBlock* false_target) { | 1303 HBasicBlock* false_target) { |
1315 SetOperandAt(0, value); | 1304 SetOperandAt(0, value); |
1316 SetSuccessorAt(0, true_target); | 1305 SetSuccessorAt(0, true_target); |
1317 SetSuccessorAt(1, false_target); | 1306 SetSuccessorAt(1, false_target); |
1318 } | 1307 } |
1319 | 1308 |
1320 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1309 virtual void PrintDataTo(StringStream* stream); |
1321 | 1310 |
1322 HValue* value() { return OperandAt(0); } | 1311 HValue* value() { return OperandAt(0); } |
1323 }; | 1312 }; |
1324 | 1313 |
1325 | 1314 |
1326 class HBranch V8_FINAL : public HUnaryControlInstruction { | 1315 class HBranch: public HUnaryControlInstruction { |
1327 public: | 1316 public: |
1328 HBranch(HValue* value, | 1317 HBranch(HValue* value, |
1329 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types(), | 1318 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types(), |
1330 HBasicBlock* true_target = NULL, | 1319 HBasicBlock* true_target = NULL, |
1331 HBasicBlock* false_target = NULL) | 1320 HBasicBlock* false_target = NULL) |
1332 : HUnaryControlInstruction(value, true_target, false_target), | 1321 : HUnaryControlInstruction(value, true_target, false_target), |
1333 expected_input_types_(expected_input_types) { | 1322 expected_input_types_(expected_input_types) { |
1334 SetFlag(kAllowUndefinedAsNaN); | 1323 SetFlag(kAllowUndefinedAsNaN); |
1335 } | 1324 } |
1336 | 1325 |
1337 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1326 virtual Representation RequiredInputRepresentation(int index) { |
1338 return Representation::None(); | 1327 return Representation::None(); |
1339 } | 1328 } |
1340 virtual Representation observed_input_representation(int index) V8_OVERRIDE; | 1329 virtual Representation observed_input_representation(int index); |
1341 | 1330 |
1342 ToBooleanStub::Types expected_input_types() const { | 1331 ToBooleanStub::Types expected_input_types() const { |
1343 return expected_input_types_; | 1332 return expected_input_types_; |
1344 } | 1333 } |
1345 | 1334 |
1346 DECLARE_CONCRETE_INSTRUCTION(Branch) | 1335 DECLARE_CONCRETE_INSTRUCTION(Branch) |
1347 | 1336 |
1348 private: | 1337 private: |
1349 ToBooleanStub::Types expected_input_types_; | 1338 ToBooleanStub::Types expected_input_types_; |
1350 }; | 1339 }; |
1351 | 1340 |
1352 | 1341 |
1353 class HCompareMap V8_FINAL : public HUnaryControlInstruction { | 1342 class HCompareMap: public HUnaryControlInstruction { |
1354 public: | 1343 public: |
1355 HCompareMap(HValue* value, | 1344 HCompareMap(HValue* value, |
1356 Handle<Map> map, | 1345 Handle<Map> map, |
1357 HBasicBlock* true_target = NULL, | 1346 HBasicBlock* true_target = NULL, |
1358 HBasicBlock* false_target = NULL) | 1347 HBasicBlock* false_target = NULL) |
1359 : HUnaryControlInstruction(value, true_target, false_target), | 1348 : HUnaryControlInstruction(value, true_target, false_target), |
1360 map_(map) { | 1349 map_(map) { |
1361 ASSERT(!map.is_null()); | 1350 ASSERT(!map.is_null()); |
1362 } | 1351 } |
1363 | 1352 |
1364 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1353 virtual void PrintDataTo(StringStream* stream); |
1365 | 1354 |
1366 Handle<Map> map() const { return map_; } | 1355 Handle<Map> map() const { return map_; } |
1367 | 1356 |
1368 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1357 virtual Representation RequiredInputRepresentation(int index) { |
1369 return Representation::Tagged(); | 1358 return Representation::Tagged(); |
1370 } | 1359 } |
1371 | 1360 |
1372 DECLARE_CONCRETE_INSTRUCTION(CompareMap) | 1361 DECLARE_CONCRETE_INSTRUCTION(CompareMap) |
1373 | 1362 |
1374 private: | 1363 private: |
1375 Handle<Map> map_; | 1364 Handle<Map> map_; |
1376 }; | 1365 }; |
1377 | 1366 |
1378 | 1367 |
1379 class HContext V8_FINAL : public HTemplateInstruction<0> { | 1368 class HContext: public HTemplateInstruction<0> { |
1380 public: | 1369 public: |
1381 static HContext* New(Zone* zone) { | 1370 static HContext* New(Zone* zone) { |
1382 return new(zone) HContext(); | 1371 return new(zone) HContext(); |
1383 } | 1372 } |
1384 | 1373 |
1385 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1374 virtual Representation RequiredInputRepresentation(int index) { |
1386 return Representation::None(); | 1375 return Representation::None(); |
1387 } | 1376 } |
1388 | 1377 |
1389 DECLARE_CONCRETE_INSTRUCTION(Context) | 1378 DECLARE_CONCRETE_INSTRUCTION(Context) |
1390 | 1379 |
1391 protected: | 1380 protected: |
1392 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 1381 virtual bool DataEquals(HValue* other) { return true; } |
1393 | 1382 |
1394 private: | 1383 private: |
1395 HContext() { | 1384 HContext() { |
1396 set_representation(Representation::Tagged()); | 1385 set_representation(Representation::Tagged()); |
1397 SetFlag(kUseGVN); | 1386 SetFlag(kUseGVN); |
1398 } | 1387 } |
1399 | 1388 |
1400 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 1389 virtual bool IsDeletable() const { return true; } |
1401 }; | 1390 }; |
1402 | 1391 |
1403 | 1392 |
1404 class HReturn V8_FINAL : public HTemplateControlInstruction<0, 3> { | 1393 class HReturn: public HTemplateControlInstruction<0, 3> { |
1405 public: | 1394 public: |
1406 static HInstruction* New(Zone* zone, | 1395 static HInstruction* New(Zone* zone, |
1407 HValue* context, | 1396 HValue* context, |
1408 HValue* value, | 1397 HValue* value, |
1409 HValue* parameter_count) { | 1398 HValue* parameter_count) { |
1410 return new(zone) HReturn(value, context, parameter_count); | 1399 return new(zone) HReturn(value, context, parameter_count); |
1411 } | 1400 } |
1412 | 1401 |
1413 static HInstruction* New(Zone* zone, | 1402 static HInstruction* New(Zone* zone, |
1414 HValue* context, | 1403 HValue* context, |
1415 HValue* value) { | 1404 HValue* value) { |
1416 return new(zone) HReturn(value, context, 0); | 1405 return new(zone) HReturn(value, context, 0); |
1417 } | 1406 } |
1418 | 1407 |
1419 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1408 virtual Representation RequiredInputRepresentation(int index) { |
1420 return Representation::Tagged(); | 1409 return Representation::Tagged(); |
1421 } | 1410 } |
1422 | 1411 |
1423 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1412 virtual void PrintDataTo(StringStream* stream); |
1424 | 1413 |
1425 HValue* value() { return OperandAt(0); } | 1414 HValue* value() { return OperandAt(0); } |
1426 HValue* context() { return OperandAt(1); } | 1415 HValue* context() { return OperandAt(1); } |
1427 HValue* parameter_count() { return OperandAt(2); } | 1416 HValue* parameter_count() { return OperandAt(2); } |
1428 | 1417 |
1429 DECLARE_CONCRETE_INSTRUCTION(Return) | 1418 DECLARE_CONCRETE_INSTRUCTION(Return) |
1430 | 1419 |
1431 private: | 1420 private: |
1432 HReturn(HValue* value, HValue* context, HValue* parameter_count) { | 1421 HReturn(HValue* value, HValue* context, HValue* parameter_count) { |
1433 SetOperandAt(0, value); | 1422 SetOperandAt(0, value); |
1434 SetOperandAt(1, context); | 1423 SetOperandAt(1, context); |
1435 SetOperandAt(2, parameter_count); | 1424 SetOperandAt(2, parameter_count); |
1436 } | 1425 } |
1437 }; | 1426 }; |
1438 | 1427 |
1439 | 1428 |
1440 class HAbnormalExit V8_FINAL : public HTemplateControlInstruction<0, 0> { | 1429 class HAbnormalExit: public HTemplateControlInstruction<0, 0> { |
1441 public: | 1430 public: |
1442 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1431 virtual Representation RequiredInputRepresentation(int index) { |
1443 return Representation::None(); | 1432 return Representation::None(); |
1444 } | 1433 } |
1445 | 1434 |
1446 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit) | 1435 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit) |
1447 }; | 1436 }; |
1448 | 1437 |
1449 | 1438 |
1450 class HUnaryOperation : public HTemplateInstruction<1> { | 1439 class HUnaryOperation: public HTemplateInstruction<1> { |
1451 public: | 1440 public: |
1452 HUnaryOperation(HValue* value, HType type = HType::Tagged()) | 1441 HUnaryOperation(HValue* value, HType type = HType::Tagged()) |
1453 : HTemplateInstruction<1>(type) { | 1442 : HTemplateInstruction<1>(type) { |
1454 SetOperandAt(0, value); | 1443 SetOperandAt(0, value); |
1455 } | 1444 } |
1456 | 1445 |
1457 static HUnaryOperation* cast(HValue* value) { | 1446 static HUnaryOperation* cast(HValue* value) { |
1458 return reinterpret_cast<HUnaryOperation*>(value); | 1447 return reinterpret_cast<HUnaryOperation*>(value); |
1459 } | 1448 } |
1460 | 1449 |
1461 HValue* value() const { return OperandAt(0); } | 1450 HValue* value() const { return OperandAt(0); } |
1462 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1451 virtual void PrintDataTo(StringStream* stream); |
1463 }; | 1452 }; |
1464 | 1453 |
1465 | 1454 |
1466 class HThrow V8_FINAL : public HTemplateInstruction<2> { | 1455 class HThrow: public HTemplateInstruction<2> { |
1467 public: | 1456 public: |
1468 static HThrow* New(Zone* zone, | 1457 static HThrow* New(Zone* zone, |
1469 HValue* context, | 1458 HValue* context, |
1470 HValue* value) { | 1459 HValue* value) { |
1471 return new(zone) HThrow(context, value); | 1460 return new(zone) HThrow(context, value); |
1472 } | 1461 } |
1473 | 1462 |
1474 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1463 virtual Representation RequiredInputRepresentation(int index) { |
1475 return Representation::Tagged(); | 1464 return Representation::Tagged(); |
1476 } | 1465 } |
1477 | 1466 |
1478 HValue* context() { return OperandAt(0); } | 1467 HValue* context() { return OperandAt(0); } |
1479 HValue* value() { return OperandAt(1); } | 1468 HValue* value() { return OperandAt(1); } |
1480 | 1469 |
1481 DECLARE_CONCRETE_INSTRUCTION(Throw) | 1470 DECLARE_CONCRETE_INSTRUCTION(Throw) |
1482 | 1471 |
1483 private: | 1472 private: |
1484 HThrow(HValue* context, HValue* value) { | 1473 HThrow(HValue* context, HValue* value) { |
1485 SetOperandAt(0, context); | 1474 SetOperandAt(0, context); |
1486 SetOperandAt(1, value); | 1475 SetOperandAt(1, value); |
1487 SetAllSideEffects(); | 1476 SetAllSideEffects(); |
1488 } | 1477 } |
1489 }; | 1478 }; |
1490 | 1479 |
1491 | 1480 |
1492 class HUseConst V8_FINAL : public HUnaryOperation { | 1481 class HUseConst: public HUnaryOperation { |
1493 public: | 1482 public: |
1494 DECLARE_INSTRUCTION_FACTORY_P1(HUseConst, HValue*); | 1483 DECLARE_INSTRUCTION_FACTORY_P1(HUseConst, HValue*); |
1495 | 1484 |
1496 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1485 virtual Representation RequiredInputRepresentation(int index) { |
1497 return Representation::None(); | 1486 return Representation::None(); |
1498 } | 1487 } |
1499 | 1488 |
1500 DECLARE_CONCRETE_INSTRUCTION(UseConst) | 1489 DECLARE_CONCRETE_INSTRUCTION(UseConst) |
1501 | 1490 |
1502 private: | 1491 private: |
1503 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { } | 1492 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { } |
1504 }; | 1493 }; |
1505 | 1494 |
1506 | 1495 |
1507 class HForceRepresentation V8_FINAL : public HTemplateInstruction<1> { | 1496 class HForceRepresentation: public HTemplateInstruction<1> { |
1508 public: | 1497 public: |
1509 DECLARE_INSTRUCTION_FACTORY_P2(HForceRepresentation, HValue*, Representation); | 1498 DECLARE_INSTRUCTION_FACTORY_P2(HForceRepresentation, HValue*, Representation); |
1510 | 1499 |
1511 HValue* value() { return OperandAt(0); } | 1500 HValue* value() { return OperandAt(0); } |
1512 | 1501 |
1513 virtual HValue* EnsureAndPropagateNotMinusZero( | 1502 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
1514 BitVector* visited) V8_OVERRIDE; | |
1515 | 1503 |
1516 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1504 virtual Representation RequiredInputRepresentation(int index) { |
1517 return representation(); // Same as the output representation. | 1505 return representation(); // Same as the output representation. |
1518 } | 1506 } |
1519 | 1507 |
1520 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1508 virtual void PrintDataTo(StringStream* stream); |
1521 | 1509 |
1522 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) | 1510 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) |
1523 | 1511 |
1524 private: | 1512 private: |
1525 HForceRepresentation(HValue* value, Representation required_representation) { | 1513 HForceRepresentation(HValue* value, Representation required_representation) { |
1526 SetOperandAt(0, value); | 1514 SetOperandAt(0, value); |
1527 set_representation(required_representation); | 1515 set_representation(required_representation); |
1528 } | 1516 } |
1529 }; | 1517 }; |
1530 | 1518 |
1531 | 1519 |
1532 class HChange V8_FINAL : public HUnaryOperation { | 1520 class HChange: public HUnaryOperation { |
1533 public: | 1521 public: |
1534 HChange(HValue* value, | 1522 HChange(HValue* value, |
1535 Representation to, | 1523 Representation to, |
1536 bool is_truncating_to_smi, | 1524 bool is_truncating_to_smi, |
1537 bool is_truncating_to_int32) | 1525 bool is_truncating_to_int32) |
1538 : HUnaryOperation(value) { | 1526 : HUnaryOperation(value) { |
1539 ASSERT(!value->representation().IsNone()); | 1527 ASSERT(!value->representation().IsNone()); |
1540 ASSERT(!to.IsNone()); | 1528 ASSERT(!to.IsNone()); |
1541 ASSERT(!value->representation().Equals(to)); | 1529 ASSERT(!value->representation().Equals(to)); |
1542 set_representation(to); | 1530 set_representation(to); |
1543 SetFlag(kUseGVN); | 1531 SetFlag(kUseGVN); |
1544 if (is_truncating_to_smi) SetFlag(kTruncatingToSmi); | 1532 if (is_truncating_to_smi) SetFlag(kTruncatingToSmi); |
1545 if (is_truncating_to_int32) SetFlag(kTruncatingToInt32); | 1533 if (is_truncating_to_int32) SetFlag(kTruncatingToInt32); |
1546 if (value->representation().IsSmi() || value->type().IsSmi()) { | 1534 if (value->representation().IsSmi() || value->type().IsSmi()) { |
1547 set_type(HType::Smi()); | 1535 set_type(HType::Smi()); |
1548 } else { | 1536 } else { |
1549 set_type(HType::TaggedNumber()); | 1537 set_type(HType::TaggedNumber()); |
1550 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion); | 1538 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion); |
1551 } | 1539 } |
1552 } | 1540 } |
1553 | 1541 |
1554 bool can_convert_undefined_to_nan() { | 1542 bool can_convert_undefined_to_nan() { |
1555 return CheckUsesForFlag(kAllowUndefinedAsNaN); | 1543 return CheckUsesForFlag(kAllowUndefinedAsNaN); |
1556 } | 1544 } |
1557 | 1545 |
1558 virtual HValue* EnsureAndPropagateNotMinusZero( | 1546 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
1559 BitVector* visited) V8_OVERRIDE; | 1547 virtual HType CalculateInferredType(); |
1560 virtual HType CalculateInferredType() V8_OVERRIDE; | 1548 virtual HValue* Canonicalize(); |
1561 virtual HValue* Canonicalize() V8_OVERRIDE; | |
1562 | 1549 |
1563 Representation from() const { return value()->representation(); } | 1550 Representation from() const { return value()->representation(); } |
1564 Representation to() const { return representation(); } | 1551 Representation to() const { return representation(); } |
1565 bool deoptimize_on_minus_zero() const { | 1552 bool deoptimize_on_minus_zero() const { |
1566 return CheckFlag(kBailoutOnMinusZero); | 1553 return CheckFlag(kBailoutOnMinusZero); |
1567 } | 1554 } |
1568 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1555 virtual Representation RequiredInputRepresentation(int index) { |
1569 return from(); | 1556 return from(); |
1570 } | 1557 } |
1571 | 1558 |
1572 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 1559 virtual Range* InferRange(Zone* zone); |
1573 | 1560 |
1574 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1561 virtual void PrintDataTo(StringStream* stream); |
1575 | 1562 |
1576 DECLARE_CONCRETE_INSTRUCTION(Change) | 1563 DECLARE_CONCRETE_INSTRUCTION(Change) |
1577 | 1564 |
1578 protected: | 1565 protected: |
1579 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 1566 virtual bool DataEquals(HValue* other) { return true; } |
1580 | 1567 |
1581 private: | 1568 private: |
1582 virtual bool IsDeletable() const V8_OVERRIDE { | 1569 virtual bool IsDeletable() const { |
1583 return !from().IsTagged() || value()->type().IsSmi(); | 1570 return !from().IsTagged() || value()->type().IsSmi(); |
1584 } | 1571 } |
1585 }; | 1572 }; |
1586 | 1573 |
1587 | 1574 |
1588 class HClampToUint8 V8_FINAL : public HUnaryOperation { | 1575 class HClampToUint8: public HUnaryOperation { |
1589 public: | 1576 public: |
1590 DECLARE_INSTRUCTION_FACTORY_P1(HClampToUint8, HValue*); | 1577 DECLARE_INSTRUCTION_FACTORY_P1(HClampToUint8, HValue*); |
1591 | 1578 |
1592 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1579 virtual Representation RequiredInputRepresentation(int index) { |
1593 return Representation::None(); | 1580 return Representation::None(); |
1594 } | 1581 } |
1595 | 1582 |
1596 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) | 1583 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) |
1597 | 1584 |
1598 protected: | 1585 protected: |
1599 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 1586 virtual bool DataEquals(HValue* other) { return true; } |
1600 | 1587 |
1601 private: | 1588 private: |
1602 explicit HClampToUint8(HValue* value) | 1589 explicit HClampToUint8(HValue* value) |
1603 : HUnaryOperation(value) { | 1590 : HUnaryOperation(value) { |
1604 set_representation(Representation::Integer32()); | 1591 set_representation(Representation::Integer32()); |
1605 SetFlag(kAllowUndefinedAsNaN); | 1592 SetFlag(kAllowUndefinedAsNaN); |
1606 SetFlag(kUseGVN); | 1593 SetFlag(kUseGVN); |
1607 } | 1594 } |
1608 | 1595 |
1609 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 1596 virtual bool IsDeletable() const { return true; } |
1610 }; | 1597 }; |
1611 | 1598 |
1612 | 1599 |
1613 enum RemovableSimulate { | 1600 enum RemovableSimulate { |
1614 REMOVABLE_SIMULATE, | 1601 REMOVABLE_SIMULATE, |
1615 FIXED_SIMULATE | 1602 FIXED_SIMULATE |
1616 }; | 1603 }; |
1617 | 1604 |
1618 | 1605 |
1619 class HSimulate V8_FINAL : public HInstruction { | 1606 class HSimulate: public HInstruction { |
1620 public: | 1607 public: |
1621 HSimulate(BailoutId ast_id, | 1608 HSimulate(BailoutId ast_id, |
1622 int pop_count, | 1609 int pop_count, |
1623 Zone* zone, | 1610 Zone* zone, |
1624 RemovableSimulate removable) | 1611 RemovableSimulate removable) |
1625 : ast_id_(ast_id), | 1612 : ast_id_(ast_id), |
1626 pop_count_(pop_count), | 1613 pop_count_(pop_count), |
1627 values_(2, zone), | 1614 values_(2, zone), |
1628 assigned_indexes_(2, zone), | 1615 assigned_indexes_(2, zone), |
1629 zone_(zone), | 1616 zone_(zone), |
1630 removable_(removable) {} | 1617 removable_(removable) {} |
1631 ~HSimulate() {} | 1618 virtual ~HSimulate() {} |
1632 | 1619 |
1633 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1620 virtual void PrintDataTo(StringStream* stream); |
1634 | 1621 |
1635 bool HasAstId() const { return !ast_id_.IsNone(); } | 1622 bool HasAstId() const { return !ast_id_.IsNone(); } |
1636 BailoutId ast_id() const { return ast_id_; } | 1623 BailoutId ast_id() const { return ast_id_; } |
1637 void set_ast_id(BailoutId id) { | 1624 void set_ast_id(BailoutId id) { |
1638 ASSERT(!HasAstId()); | 1625 ASSERT(!HasAstId()); |
1639 ast_id_ = id; | 1626 ast_id_ = id; |
1640 } | 1627 } |
1641 | 1628 |
1642 int pop_count() const { return pop_count_; } | 1629 int pop_count() const { return pop_count_; } |
1643 const ZoneList<HValue*>* values() const { return &values_; } | 1630 const ZoneList<HValue*>* values() const { return &values_; } |
1644 int GetAssignedIndexAt(int index) const { | 1631 int GetAssignedIndexAt(int index) const { |
1645 ASSERT(HasAssignedIndexAt(index)); | 1632 ASSERT(HasAssignedIndexAt(index)); |
1646 return assigned_indexes_[index]; | 1633 return assigned_indexes_[index]; |
1647 } | 1634 } |
1648 bool HasAssignedIndexAt(int index) const { | 1635 bool HasAssignedIndexAt(int index) const { |
1649 return assigned_indexes_[index] != kNoIndex; | 1636 return assigned_indexes_[index] != kNoIndex; |
1650 } | 1637 } |
1651 void AddAssignedValue(int index, HValue* value) { | 1638 void AddAssignedValue(int index, HValue* value) { |
1652 AddValue(index, value); | 1639 AddValue(index, value); |
1653 } | 1640 } |
1654 void AddPushedValue(HValue* value) { | 1641 void AddPushedValue(HValue* value) { |
1655 AddValue(kNoIndex, value); | 1642 AddValue(kNoIndex, value); |
1656 } | 1643 } |
1657 int ToOperandIndex(int environment_index) { | 1644 int ToOperandIndex(int environment_index) { |
1658 for (int i = 0; i < assigned_indexes_.length(); ++i) { | 1645 for (int i = 0; i < assigned_indexes_.length(); ++i) { |
1659 if (assigned_indexes_[i] == environment_index) return i; | 1646 if (assigned_indexes_[i] == environment_index) return i; |
1660 } | 1647 } |
1661 return -1; | 1648 return -1; |
1662 } | 1649 } |
1663 virtual int OperandCount() V8_OVERRIDE { return values_.length(); } | 1650 virtual int OperandCount() { return values_.length(); } |
1664 virtual HValue* OperandAt(int index) const V8_OVERRIDE { | 1651 virtual HValue* OperandAt(int index) const { return values_[index]; } |
1665 return values_[index]; | |
1666 } | |
1667 | 1652 |
1668 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } | 1653 virtual bool HasEscapingOperandAt(int index) { return false; } |
1669 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1654 virtual Representation RequiredInputRepresentation(int index) { |
1670 return Representation::None(); | 1655 return Representation::None(); |
1671 } | 1656 } |
1672 | 1657 |
1673 void MergeWith(ZoneList<HSimulate*>* list); | 1658 void MergeWith(ZoneList<HSimulate*>* list); |
1674 bool is_candidate_for_removal() { return removable_ == REMOVABLE_SIMULATE; } | 1659 bool is_candidate_for_removal() { return removable_ == REMOVABLE_SIMULATE; } |
1675 | 1660 |
1676 DECLARE_CONCRETE_INSTRUCTION(Simulate) | 1661 DECLARE_CONCRETE_INSTRUCTION(Simulate) |
1677 | 1662 |
1678 #ifdef DEBUG | 1663 #ifdef DEBUG |
1679 virtual void Verify() V8_OVERRIDE; | 1664 virtual void Verify(); |
1680 void set_closure(Handle<JSFunction> closure) { closure_ = closure; } | 1665 void set_closure(Handle<JSFunction> closure) { closure_ = closure; } |
1681 Handle<JSFunction> closure() const { return closure_; } | 1666 Handle<JSFunction> closure() const { return closure_; } |
1682 #endif | 1667 #endif |
1683 | 1668 |
1684 protected: | 1669 protected: |
1685 virtual void InternalSetOperandAt(int index, HValue* value) V8_OVERRIDE { | 1670 virtual void InternalSetOperandAt(int index, HValue* value) { |
1686 values_[index] = value; | 1671 values_[index] = value; |
1687 } | 1672 } |
1688 | 1673 |
1689 private: | 1674 private: |
1690 static const int kNoIndex = -1; | 1675 static const int kNoIndex = -1; |
1691 void AddValue(int index, HValue* value) { | 1676 void AddValue(int index, HValue* value) { |
1692 assigned_indexes_.Add(index, zone_); | 1677 assigned_indexes_.Add(index, zone_); |
1693 // Resize the list of pushed values. | 1678 // Resize the list of pushed values. |
1694 values_.Add(NULL, zone_); | 1679 values_.Add(NULL, zone_); |
1695 // Set the operand through the base method in HValue to make sure that the | 1680 // Set the operand through the base method in HValue to make sure that the |
(...skipping 12 matching lines...) Expand all Loading... |
1708 ZoneList<int> assigned_indexes_; | 1693 ZoneList<int> assigned_indexes_; |
1709 Zone* zone_; | 1694 Zone* zone_; |
1710 RemovableSimulate removable_; | 1695 RemovableSimulate removable_; |
1711 | 1696 |
1712 #ifdef DEBUG | 1697 #ifdef DEBUG |
1713 Handle<JSFunction> closure_; | 1698 Handle<JSFunction> closure_; |
1714 #endif | 1699 #endif |
1715 }; | 1700 }; |
1716 | 1701 |
1717 | 1702 |
1718 class HEnvironmentMarker V8_FINAL : public HTemplateInstruction<1> { | 1703 class HEnvironmentMarker: public HTemplateInstruction<1> { |
1719 public: | 1704 public: |
1720 enum Kind { BIND, LOOKUP }; | 1705 enum Kind { BIND, LOOKUP }; |
1721 | 1706 |
1722 HEnvironmentMarker(Kind kind, int index) | 1707 HEnvironmentMarker(Kind kind, int index) |
1723 : kind_(kind), index_(index), next_simulate_(NULL) { } | 1708 : kind_(kind), index_(index), next_simulate_(NULL) { } |
1724 | 1709 |
1725 Kind kind() { return kind_; } | 1710 Kind kind() { return kind_; } |
1726 int index() { return index_; } | 1711 int index() { return index_; } |
1727 HSimulate* next_simulate() { return next_simulate_; } | 1712 HSimulate* next_simulate() { return next_simulate_; } |
1728 void set_next_simulate(HSimulate* simulate) { | 1713 void set_next_simulate(HSimulate* simulate) { |
1729 next_simulate_ = simulate; | 1714 next_simulate_ = simulate; |
1730 } | 1715 } |
1731 | 1716 |
1732 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1717 virtual Representation RequiredInputRepresentation(int index) { |
1733 return Representation::None(); | 1718 return Representation::None(); |
1734 } | 1719 } |
1735 | 1720 |
1736 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1721 virtual void PrintDataTo(StringStream* stream); |
1737 | 1722 |
1738 #ifdef DEBUG | 1723 #ifdef DEBUG |
1739 void set_closure(Handle<JSFunction> closure) { | 1724 void set_closure(Handle<JSFunction> closure) { |
1740 ASSERT(closure_.is_null()); | 1725 ASSERT(closure_.is_null()); |
1741 ASSERT(!closure.is_null()); | 1726 ASSERT(!closure.is_null()); |
1742 closure_ = closure; | 1727 closure_ = closure; |
1743 } | 1728 } |
1744 Handle<JSFunction> closure() const { return closure_; } | 1729 Handle<JSFunction> closure() const { return closure_; } |
1745 #endif | 1730 #endif |
1746 | 1731 |
1747 DECLARE_CONCRETE_INSTRUCTION(EnvironmentMarker); | 1732 DECLARE_CONCRETE_INSTRUCTION(EnvironmentMarker); |
1748 | 1733 |
1749 private: | 1734 private: |
1750 Kind kind_; | 1735 Kind kind_; |
1751 int index_; | 1736 int index_; |
1752 HSimulate* next_simulate_; | 1737 HSimulate* next_simulate_; |
1753 | 1738 |
1754 #ifdef DEBUG | 1739 #ifdef DEBUG |
1755 Handle<JSFunction> closure_; | 1740 Handle<JSFunction> closure_; |
1756 #endif | 1741 #endif |
1757 }; | 1742 }; |
1758 | 1743 |
1759 | 1744 |
1760 class HStackCheck V8_FINAL : public HTemplateInstruction<1> { | 1745 class HStackCheck: public HTemplateInstruction<1> { |
1761 public: | 1746 public: |
1762 enum Type { | 1747 enum Type { |
1763 kFunctionEntry, | 1748 kFunctionEntry, |
1764 kBackwardsBranch | 1749 kBackwardsBranch |
1765 }; | 1750 }; |
1766 | 1751 |
1767 DECLARE_INSTRUCTION_FACTORY_P2(HStackCheck, HValue*, Type); | 1752 DECLARE_INSTRUCTION_FACTORY_P2(HStackCheck, HValue*, Type); |
1768 | 1753 |
1769 HValue* context() { return OperandAt(0); } | 1754 HValue* context() { return OperandAt(0); } |
1770 | 1755 |
1771 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1756 virtual Representation RequiredInputRepresentation(int index) { |
1772 return Representation::Tagged(); | 1757 return Representation::Tagged(); |
1773 } | 1758 } |
1774 | 1759 |
1775 void Eliminate() { | 1760 void Eliminate() { |
1776 // The stack check eliminator might try to eliminate the same stack | 1761 // The stack check eliminator might try to eliminate the same stack |
1777 // check instruction multiple times. | 1762 // check instruction multiple times. |
1778 if (IsLinked()) { | 1763 if (IsLinked()) { |
1779 DeleteAndReplaceWith(NULL); | 1764 DeleteAndReplaceWith(NULL); |
1780 } | 1765 } |
1781 } | 1766 } |
(...skipping 18 matching lines...) Expand all Loading... |
1800 DROP_EXTRA_ON_RETURN, // Drop an extra value from the environment on return. | 1785 DROP_EXTRA_ON_RETURN, // Drop an extra value from the environment on return. |
1801 CONSTRUCT_CALL_RETURN, // Either use allocated receiver or return value. | 1786 CONSTRUCT_CALL_RETURN, // Either use allocated receiver or return value. |
1802 GETTER_CALL_RETURN, // Returning from a getter, need to restore context. | 1787 GETTER_CALL_RETURN, // Returning from a getter, need to restore context. |
1803 SETTER_CALL_RETURN // Use the RHS of the assignment as the return value. | 1788 SETTER_CALL_RETURN // Use the RHS of the assignment as the return value. |
1804 }; | 1789 }; |
1805 | 1790 |
1806 | 1791 |
1807 class HArgumentsObject; | 1792 class HArgumentsObject; |
1808 | 1793 |
1809 | 1794 |
1810 class HEnterInlined V8_FINAL : public HTemplateInstruction<0> { | 1795 class HEnterInlined: public HTemplateInstruction<0> { |
1811 public: | 1796 public: |
1812 static HEnterInlined* New(Zone* zone, | 1797 static HEnterInlined* New(Zone* zone, |
1813 HValue* context, | 1798 HValue* context, |
1814 Handle<JSFunction> closure, | 1799 Handle<JSFunction> closure, |
1815 int arguments_count, | 1800 int arguments_count, |
1816 FunctionLiteral* function, | 1801 FunctionLiteral* function, |
1817 InliningKind inlining_kind, | 1802 InliningKind inlining_kind, |
1818 Variable* arguments_var, | 1803 Variable* arguments_var, |
1819 HArgumentsObject* arguments_object, | 1804 HArgumentsObject* arguments_object, |
1820 bool undefined_receiver) { | 1805 bool undefined_receiver) { |
1821 return new(zone) HEnterInlined(closure, arguments_count, function, | 1806 return new(zone) HEnterInlined(closure, arguments_count, function, |
1822 inlining_kind, arguments_var, | 1807 inlining_kind, arguments_var, |
1823 arguments_object, undefined_receiver, zone); | 1808 arguments_object, undefined_receiver, zone); |
1824 } | 1809 } |
1825 | 1810 |
1826 void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone); | 1811 void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone); |
1827 ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; } | 1812 ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; } |
1828 | 1813 |
1829 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1814 virtual void PrintDataTo(StringStream* stream); |
1830 | 1815 |
1831 Handle<JSFunction> closure() const { return closure_; } | 1816 Handle<JSFunction> closure() const { return closure_; } |
1832 int arguments_count() const { return arguments_count_; } | 1817 int arguments_count() const { return arguments_count_; } |
1833 bool arguments_pushed() const { return arguments_pushed_; } | 1818 bool arguments_pushed() const { return arguments_pushed_; } |
1834 void set_arguments_pushed() { arguments_pushed_ = true; } | 1819 void set_arguments_pushed() { arguments_pushed_ = true; } |
1835 FunctionLiteral* function() const { return function_; } | 1820 FunctionLiteral* function() const { return function_; } |
1836 InliningKind inlining_kind() const { return inlining_kind_; } | 1821 InliningKind inlining_kind() const { return inlining_kind_; } |
1837 bool undefined_receiver() const { return undefined_receiver_; } | 1822 bool undefined_receiver() const { return undefined_receiver_; } |
1838 | 1823 |
1839 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1824 virtual Representation RequiredInputRepresentation(int index) { |
1840 return Representation::None(); | 1825 return Representation::None(); |
1841 } | 1826 } |
1842 | 1827 |
1843 Variable* arguments_var() { return arguments_var_; } | 1828 Variable* arguments_var() { return arguments_var_; } |
1844 HArgumentsObject* arguments_object() { return arguments_object_; } | 1829 HArgumentsObject* arguments_object() { return arguments_object_; } |
1845 | 1830 |
1846 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) | 1831 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) |
1847 | 1832 |
1848 private: | 1833 private: |
1849 HEnterInlined(Handle<JSFunction> closure, | 1834 HEnterInlined(Handle<JSFunction> closure, |
(...skipping 20 matching lines...) Expand all Loading... |
1870 bool arguments_pushed_; | 1855 bool arguments_pushed_; |
1871 FunctionLiteral* function_; | 1856 FunctionLiteral* function_; |
1872 InliningKind inlining_kind_; | 1857 InliningKind inlining_kind_; |
1873 Variable* arguments_var_; | 1858 Variable* arguments_var_; |
1874 HArgumentsObject* arguments_object_; | 1859 HArgumentsObject* arguments_object_; |
1875 bool undefined_receiver_; | 1860 bool undefined_receiver_; |
1876 ZoneList<HBasicBlock*> return_targets_; | 1861 ZoneList<HBasicBlock*> return_targets_; |
1877 }; | 1862 }; |
1878 | 1863 |
1879 | 1864 |
1880 class HLeaveInlined V8_FINAL : public HTemplateInstruction<0> { | 1865 class HLeaveInlined: public HTemplateInstruction<0> { |
1881 public: | 1866 public: |
1882 HLeaveInlined() { } | 1867 HLeaveInlined() { } |
1883 | 1868 |
1884 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1869 virtual Representation RequiredInputRepresentation(int index) { |
1885 return Representation::None(); | 1870 return Representation::None(); |
1886 } | 1871 } |
1887 | 1872 |
1888 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined) | 1873 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined) |
1889 }; | 1874 }; |
1890 | 1875 |
1891 | 1876 |
1892 class HPushArgument V8_FINAL : public HUnaryOperation { | 1877 class HPushArgument: public HUnaryOperation { |
1893 public: | 1878 public: |
1894 DECLARE_INSTRUCTION_FACTORY_P1(HPushArgument, HValue*); | 1879 DECLARE_INSTRUCTION_FACTORY_P1(HPushArgument, HValue*); |
1895 | 1880 |
1896 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1881 virtual Representation RequiredInputRepresentation(int index) { |
1897 return Representation::Tagged(); | 1882 return Representation::Tagged(); |
1898 } | 1883 } |
1899 | 1884 |
1900 HValue* argument() { return OperandAt(0); } | 1885 HValue* argument() { return OperandAt(0); } |
1901 | 1886 |
1902 DECLARE_CONCRETE_INSTRUCTION(PushArgument) | 1887 DECLARE_CONCRETE_INSTRUCTION(PushArgument) |
1903 | 1888 |
1904 private: | 1889 private: |
1905 explicit HPushArgument(HValue* value) : HUnaryOperation(value) { | 1890 explicit HPushArgument(HValue* value) : HUnaryOperation(value) { |
1906 set_representation(Representation::Tagged()); | 1891 set_representation(Representation::Tagged()); |
1907 } | 1892 } |
1908 }; | 1893 }; |
1909 | 1894 |
1910 | 1895 |
1911 class HThisFunction V8_FINAL : public HTemplateInstruction<0> { | 1896 class HThisFunction: public HTemplateInstruction<0> { |
1912 public: | 1897 public: |
1913 HThisFunction() { | 1898 HThisFunction() { |
1914 set_representation(Representation::Tagged()); | 1899 set_representation(Representation::Tagged()); |
1915 SetFlag(kUseGVN); | 1900 SetFlag(kUseGVN); |
1916 } | 1901 } |
1917 | 1902 |
1918 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1903 virtual Representation RequiredInputRepresentation(int index) { |
1919 return Representation::None(); | 1904 return Representation::None(); |
1920 } | 1905 } |
1921 | 1906 |
1922 DECLARE_CONCRETE_INSTRUCTION(ThisFunction) | 1907 DECLARE_CONCRETE_INSTRUCTION(ThisFunction) |
1923 | 1908 |
1924 protected: | 1909 protected: |
1925 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 1910 virtual bool DataEquals(HValue* other) { return true; } |
1926 | 1911 |
1927 private: | 1912 private: |
1928 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 1913 virtual bool IsDeletable() const { return true; } |
1929 }; | 1914 }; |
1930 | 1915 |
1931 | 1916 |
1932 class HOuterContext V8_FINAL : public HUnaryOperation { | 1917 class HOuterContext: public HUnaryOperation { |
1933 public: | 1918 public: |
1934 DECLARE_INSTRUCTION_FACTORY_P1(HOuterContext, HValue*); | 1919 DECLARE_INSTRUCTION_FACTORY_P1(HOuterContext, HValue*); |
1935 | 1920 |
1936 DECLARE_CONCRETE_INSTRUCTION(OuterContext); | 1921 DECLARE_CONCRETE_INSTRUCTION(OuterContext); |
1937 | 1922 |
1938 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1923 virtual Representation RequiredInputRepresentation(int index) { |
1939 return Representation::Tagged(); | 1924 return Representation::Tagged(); |
1940 } | 1925 } |
1941 | 1926 |
1942 protected: | 1927 protected: |
1943 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 1928 virtual bool DataEquals(HValue* other) { return true; } |
1944 | 1929 |
1945 private: | 1930 private: |
1946 explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) { | 1931 explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) { |
1947 set_representation(Representation::Tagged()); | 1932 set_representation(Representation::Tagged()); |
1948 SetFlag(kUseGVN); | 1933 SetFlag(kUseGVN); |
1949 } | 1934 } |
1950 | 1935 |
1951 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 1936 virtual bool IsDeletable() const { return true; } |
1952 }; | 1937 }; |
1953 | 1938 |
1954 | 1939 |
1955 class HDeclareGlobals V8_FINAL : public HUnaryOperation { | 1940 class HDeclareGlobals: public HUnaryOperation { |
1956 public: | 1941 public: |
1957 HDeclareGlobals(HValue* context, | 1942 HDeclareGlobals(HValue* context, |
1958 Handle<FixedArray> pairs, | 1943 Handle<FixedArray> pairs, |
1959 int flags) | 1944 int flags) |
1960 : HUnaryOperation(context), | 1945 : HUnaryOperation(context), |
1961 pairs_(pairs), | 1946 pairs_(pairs), |
1962 flags_(flags) { | 1947 flags_(flags) { |
1963 set_representation(Representation::Tagged()); | 1948 set_representation(Representation::Tagged()); |
1964 SetAllSideEffects(); | 1949 SetAllSideEffects(); |
1965 } | 1950 } |
1966 | 1951 |
1967 static HDeclareGlobals* New(Zone* zone, | 1952 static HDeclareGlobals* New(Zone* zone, |
1968 HValue* context, | 1953 HValue* context, |
1969 Handle<FixedArray> pairs, | 1954 Handle<FixedArray> pairs, |
1970 int flags) { | 1955 int flags) { |
1971 return new(zone) HDeclareGlobals(context, pairs, flags); | 1956 return new(zone) HDeclareGlobals(context, pairs, flags); |
1972 } | 1957 } |
1973 | 1958 |
1974 HValue* context() { return OperandAt(0); } | 1959 HValue* context() { return OperandAt(0); } |
1975 Handle<FixedArray> pairs() const { return pairs_; } | 1960 Handle<FixedArray> pairs() const { return pairs_; } |
1976 int flags() const { return flags_; } | 1961 int flags() const { return flags_; } |
1977 | 1962 |
1978 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals) | 1963 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals) |
1979 | 1964 |
1980 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1965 virtual Representation RequiredInputRepresentation(int index) { |
1981 return Representation::Tagged(); | 1966 return Representation::Tagged(); |
1982 } | 1967 } |
1983 | 1968 |
1984 private: | 1969 private: |
1985 Handle<FixedArray> pairs_; | 1970 Handle<FixedArray> pairs_; |
1986 int flags_; | 1971 int flags_; |
1987 }; | 1972 }; |
1988 | 1973 |
1989 | 1974 |
1990 class HGlobalObject V8_FINAL : public HUnaryOperation { | 1975 class HGlobalObject: public HUnaryOperation { |
1991 public: | 1976 public: |
1992 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) { | 1977 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) { |
1993 set_representation(Representation::Tagged()); | 1978 set_representation(Representation::Tagged()); |
1994 SetFlag(kUseGVN); | 1979 SetFlag(kUseGVN); |
1995 } | 1980 } |
1996 | 1981 |
1997 static HGlobalObject* New(Zone* zone, HValue* context) { | 1982 static HGlobalObject* New(Zone* zone, HValue* context) { |
1998 return new(zone) HGlobalObject(context); | 1983 return new(zone) HGlobalObject(context); |
1999 } | 1984 } |
2000 | 1985 |
2001 DECLARE_CONCRETE_INSTRUCTION(GlobalObject) | 1986 DECLARE_CONCRETE_INSTRUCTION(GlobalObject) |
2002 | 1987 |
2003 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1988 virtual Representation RequiredInputRepresentation(int index) { |
2004 return Representation::Tagged(); | 1989 return Representation::Tagged(); |
2005 } | 1990 } |
2006 | 1991 |
2007 protected: | 1992 protected: |
2008 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 1993 virtual bool DataEquals(HValue* other) { return true; } |
2009 | 1994 |
2010 private: | 1995 private: |
2011 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 1996 virtual bool IsDeletable() const { return true; } |
2012 }; | 1997 }; |
2013 | 1998 |
2014 | 1999 |
2015 class HGlobalReceiver V8_FINAL : public HUnaryOperation { | 2000 class HGlobalReceiver: public HUnaryOperation { |
2016 public: | 2001 public: |
2017 DECLARE_INSTRUCTION_FACTORY_P1(HGlobalReceiver, HValue*); | 2002 DECLARE_INSTRUCTION_FACTORY_P1(HGlobalReceiver, HValue*); |
2018 | 2003 |
2019 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver) | 2004 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver) |
2020 | 2005 |
2021 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2006 virtual Representation RequiredInputRepresentation(int index) { |
2022 return Representation::Tagged(); | 2007 return Representation::Tagged(); |
2023 } | 2008 } |
2024 | 2009 |
2025 protected: | 2010 protected: |
2026 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 2011 virtual bool DataEquals(HValue* other) { return true; } |
2027 | 2012 |
2028 private: | 2013 private: |
2029 explicit HGlobalReceiver(HValue* global_object) | 2014 explicit HGlobalReceiver(HValue* global_object) |
2030 : HUnaryOperation(global_object) { | 2015 : HUnaryOperation(global_object) { |
2031 set_representation(Representation::Tagged()); | 2016 set_representation(Representation::Tagged()); |
2032 SetFlag(kUseGVN); | 2017 SetFlag(kUseGVN); |
2033 } | 2018 } |
2034 | 2019 |
2035 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 2020 virtual bool IsDeletable() const { return true; } |
2036 }; | 2021 }; |
2037 | 2022 |
2038 | 2023 |
2039 template <int V> | 2024 template <int V> |
2040 class HCall : public HTemplateInstruction<V> { | 2025 class HCall: public HTemplateInstruction<V> { |
2041 public: | 2026 public: |
2042 // The argument count includes the receiver. | 2027 // The argument count includes the receiver. |
2043 explicit HCall<V>(int argument_count) : argument_count_(argument_count) { | 2028 explicit HCall<V>(int argument_count) : argument_count_(argument_count) { |
2044 this->set_representation(Representation::Tagged()); | 2029 this->set_representation(Representation::Tagged()); |
2045 this->SetAllSideEffects(); | 2030 this->SetAllSideEffects(); |
2046 } | 2031 } |
2047 | 2032 |
2048 virtual HType CalculateInferredType() V8_FINAL V8_OVERRIDE { | 2033 virtual HType CalculateInferredType() { return HType::Tagged(); } |
2049 return HType::Tagged(); | |
2050 } | |
2051 | 2034 |
2052 virtual int argument_count() const { return argument_count_; } | 2035 virtual int argument_count() const { return argument_count_; } |
2053 | 2036 |
2054 virtual bool IsCall() V8_FINAL V8_OVERRIDE { return true; } | 2037 virtual bool IsCall() { return true; } |
2055 | 2038 |
2056 private: | 2039 private: |
2057 int argument_count_; | 2040 int argument_count_; |
2058 }; | 2041 }; |
2059 | 2042 |
2060 | 2043 |
2061 class HUnaryCall : public HCall<1> { | 2044 class HUnaryCall: public HCall<1> { |
2062 public: | 2045 public: |
2063 HUnaryCall(HValue* value, int argument_count) | 2046 HUnaryCall(HValue* value, int argument_count) |
2064 : HCall<1>(argument_count) { | 2047 : HCall<1>(argument_count) { |
2065 SetOperandAt(0, value); | 2048 SetOperandAt(0, value); |
2066 } | 2049 } |
2067 | 2050 |
2068 virtual Representation RequiredInputRepresentation( | 2051 virtual Representation RequiredInputRepresentation(int index) { |
2069 int index) V8_FINAL V8_OVERRIDE { | |
2070 return Representation::Tagged(); | 2052 return Representation::Tagged(); |
2071 } | 2053 } |
2072 | 2054 |
2073 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2055 virtual void PrintDataTo(StringStream* stream); |
2074 | 2056 |
2075 HValue* value() { return OperandAt(0); } | 2057 HValue* value() { return OperandAt(0); } |
2076 }; | 2058 }; |
2077 | 2059 |
2078 | 2060 |
2079 class HBinaryCall : public HCall<2> { | 2061 class HBinaryCall: public HCall<2> { |
2080 public: | 2062 public: |
2081 HBinaryCall(HValue* first, HValue* second, int argument_count) | 2063 HBinaryCall(HValue* first, HValue* second, int argument_count) |
2082 : HCall<2>(argument_count) { | 2064 : HCall<2>(argument_count) { |
2083 SetOperandAt(0, first); | 2065 SetOperandAt(0, first); |
2084 SetOperandAt(1, second); | 2066 SetOperandAt(1, second); |
2085 } | 2067 } |
2086 | 2068 |
2087 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2069 virtual void PrintDataTo(StringStream* stream); |
2088 | 2070 |
2089 virtual Representation RequiredInputRepresentation( | 2071 virtual Representation RequiredInputRepresentation(int index) { |
2090 int index) V8_FINAL V8_OVERRIDE { | |
2091 return Representation::Tagged(); | 2072 return Representation::Tagged(); |
2092 } | 2073 } |
2093 | 2074 |
2094 HValue* first() { return OperandAt(0); } | 2075 HValue* first() { return OperandAt(0); } |
2095 HValue* second() { return OperandAt(1); } | 2076 HValue* second() { return OperandAt(1); } |
2096 }; | 2077 }; |
2097 | 2078 |
2098 | 2079 |
2099 class HInvokeFunction V8_FINAL : public HBinaryCall { | 2080 class HInvokeFunction: public HBinaryCall { |
2100 public: | 2081 public: |
2101 HInvokeFunction(HValue* context, HValue* function, int argument_count) | 2082 HInvokeFunction(HValue* context, HValue* function, int argument_count) |
2102 : HBinaryCall(context, function, argument_count) { | 2083 : HBinaryCall(context, function, argument_count) { |
2103 } | 2084 } |
2104 | 2085 |
2105 static HInvokeFunction* New(Zone* zone, | 2086 static HInvokeFunction* New(Zone* zone, |
2106 HValue* context, | 2087 HValue* context, |
2107 HValue* function, | 2088 HValue* function, |
2108 int argument_count) { | 2089 int argument_count) { |
2109 return new(zone) HInvokeFunction(context, function, argument_count); | 2090 return new(zone) HInvokeFunction(context, function, argument_count); |
(...skipping 11 matching lines...) Expand all Loading... |
2121 | 2102 |
2122 static HInvokeFunction* New(Zone* zone, | 2103 static HInvokeFunction* New(Zone* zone, |
2123 HValue* context, | 2104 HValue* context, |
2124 HValue* function, | 2105 HValue* function, |
2125 Handle<JSFunction> known_function, | 2106 Handle<JSFunction> known_function, |
2126 int argument_count) { | 2107 int argument_count) { |
2127 return new(zone) HInvokeFunction(context, function, | 2108 return new(zone) HInvokeFunction(context, function, |
2128 known_function, argument_count); | 2109 known_function, argument_count); |
2129 } | 2110 } |
2130 | 2111 |
| 2112 virtual Representation RequiredInputRepresentation(int index) { |
| 2113 return Representation::Tagged(); |
| 2114 } |
| 2115 |
2131 HValue* context() { return first(); } | 2116 HValue* context() { return first(); } |
2132 HValue* function() { return second(); } | 2117 HValue* function() { return second(); } |
2133 Handle<JSFunction> known_function() { return known_function_; } | 2118 Handle<JSFunction> known_function() { return known_function_; } |
2134 int formal_parameter_count() const { return formal_parameter_count_; } | 2119 int formal_parameter_count() const { return formal_parameter_count_; } |
2135 | 2120 |
2136 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) | 2121 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) |
2137 | 2122 |
2138 private: | 2123 private: |
2139 Handle<JSFunction> known_function_; | 2124 Handle<JSFunction> known_function_; |
2140 int formal_parameter_count_; | 2125 int formal_parameter_count_; |
2141 }; | 2126 }; |
2142 | 2127 |
2143 | 2128 |
2144 class HCallConstantFunction V8_FINAL : public HCall<0> { | 2129 class HCallConstantFunction: public HCall<0> { |
2145 public: | 2130 public: |
2146 HCallConstantFunction(Handle<JSFunction> function, int argument_count) | 2131 HCallConstantFunction(Handle<JSFunction> function, int argument_count) |
2147 : HCall<0>(argument_count), | 2132 : HCall<0>(argument_count), |
2148 function_(function), | 2133 function_(function), |
2149 formal_parameter_count_(function->shared()->formal_parameter_count()) {} | 2134 formal_parameter_count_(function->shared()->formal_parameter_count()) {} |
2150 | 2135 |
2151 Handle<JSFunction> function() const { return function_; } | 2136 Handle<JSFunction> function() const { return function_; } |
2152 int formal_parameter_count() const { return formal_parameter_count_; } | 2137 int formal_parameter_count() const { return formal_parameter_count_; } |
2153 | 2138 |
2154 bool IsApplyFunction() const { | 2139 bool IsApplyFunction() const { |
2155 return function_->code() == | 2140 return function_->code() == |
2156 Isolate::Current()->builtins()->builtin(Builtins::kFunctionApply); | 2141 Isolate::Current()->builtins()->builtin(Builtins::kFunctionApply); |
2157 } | 2142 } |
2158 | 2143 |
2159 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2144 virtual void PrintDataTo(StringStream* stream); |
2160 | 2145 |
2161 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2146 virtual Representation RequiredInputRepresentation(int index) { |
2162 return Representation::None(); | 2147 return Representation::None(); |
2163 } | 2148 } |
2164 | 2149 |
2165 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction) | 2150 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction) |
2166 | 2151 |
2167 private: | 2152 private: |
2168 Handle<JSFunction> function_; | 2153 Handle<JSFunction> function_; |
2169 int formal_parameter_count_; | 2154 int formal_parameter_count_; |
2170 }; | 2155 }; |
2171 | 2156 |
2172 | 2157 |
2173 class HCallKeyed V8_FINAL : public HBinaryCall { | 2158 class HCallKeyed: public HBinaryCall { |
2174 public: | 2159 public: |
2175 HCallKeyed(HValue* context, HValue* key, int argument_count) | 2160 HCallKeyed(HValue* context, HValue* key, int argument_count) |
2176 : HBinaryCall(context, key, argument_count) { | 2161 : HBinaryCall(context, key, argument_count) { |
2177 } | 2162 } |
2178 | 2163 |
| 2164 virtual Representation RequiredInputRepresentation(int index) { |
| 2165 return Representation::Tagged(); |
| 2166 } |
| 2167 |
2179 HValue* context() { return first(); } | 2168 HValue* context() { return first(); } |
2180 HValue* key() { return second(); } | 2169 HValue* key() { return second(); } |
2181 | 2170 |
2182 DECLARE_CONCRETE_INSTRUCTION(CallKeyed) | 2171 DECLARE_CONCRETE_INSTRUCTION(CallKeyed) |
2183 }; | 2172 }; |
2184 | 2173 |
2185 | 2174 |
2186 class HCallNamed V8_FINAL : public HUnaryCall { | 2175 class HCallNamed: public HUnaryCall { |
2187 public: | 2176 public: |
2188 HCallNamed(HValue* context, Handle<String> name, int argument_count) | 2177 HCallNamed(HValue* context, Handle<String> name, int argument_count) |
2189 : HUnaryCall(context, argument_count), name_(name) { | 2178 : HUnaryCall(context, argument_count), name_(name) { |
2190 } | 2179 } |
2191 | 2180 |
2192 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2181 virtual void PrintDataTo(StringStream* stream); |
2193 | 2182 |
2194 HValue* context() { return value(); } | 2183 HValue* context() { return value(); } |
2195 Handle<String> name() const { return name_; } | 2184 Handle<String> name() const { return name_; } |
2196 | 2185 |
2197 DECLARE_CONCRETE_INSTRUCTION(CallNamed) | 2186 DECLARE_CONCRETE_INSTRUCTION(CallNamed) |
2198 | 2187 |
| 2188 virtual Representation RequiredInputRepresentation(int index) { |
| 2189 return Representation::Tagged(); |
| 2190 } |
| 2191 |
2199 private: | 2192 private: |
2200 Handle<String> name_; | 2193 Handle<String> name_; |
2201 }; | 2194 }; |
2202 | 2195 |
2203 | 2196 |
2204 class HCallFunction V8_FINAL : public HBinaryCall { | 2197 class HCallFunction: public HBinaryCall { |
2205 public: | 2198 public: |
2206 HCallFunction(HValue* context, HValue* function, int argument_count) | 2199 HCallFunction(HValue* context, HValue* function, int argument_count) |
2207 : HBinaryCall(context, function, argument_count) { | 2200 : HBinaryCall(context, function, argument_count) { |
2208 } | 2201 } |
2209 | 2202 |
2210 static HCallFunction* New(Zone* zone, | 2203 static HCallFunction* New(Zone* zone, |
2211 HValue* context, | 2204 HValue* context, |
2212 HValue* function, | 2205 HValue* function, |
2213 int argument_count) { | 2206 int argument_count) { |
2214 return new(zone) HCallFunction(context, function, argument_count); | 2207 return new(zone) HCallFunction(context, function, argument_count); |
2215 } | 2208 } |
2216 | 2209 |
2217 HValue* context() { return first(); } | 2210 HValue* context() { return first(); } |
2218 HValue* function() { return second(); } | 2211 HValue* function() { return second(); } |
2219 | 2212 |
| 2213 virtual Representation RequiredInputRepresentation(int index) { |
| 2214 return Representation::Tagged(); |
| 2215 } |
| 2216 |
2220 DECLARE_CONCRETE_INSTRUCTION(CallFunction) | 2217 DECLARE_CONCRETE_INSTRUCTION(CallFunction) |
2221 }; | 2218 }; |
2222 | 2219 |
2223 | 2220 |
2224 class HCallGlobal V8_FINAL : public HUnaryCall { | 2221 class HCallGlobal: public HUnaryCall { |
2225 public: | 2222 public: |
2226 HCallGlobal(HValue* context, Handle<String> name, int argument_count) | 2223 HCallGlobal(HValue* context, Handle<String> name, int argument_count) |
2227 : HUnaryCall(context, argument_count), name_(name) { | 2224 : HUnaryCall(context, argument_count), name_(name) { |
2228 } | 2225 } |
2229 | 2226 |
2230 static HCallGlobal* New(Zone* zone, | 2227 static HCallGlobal* New(Zone* zone, |
2231 HValue* context, | 2228 HValue* context, |
2232 Handle<String> name, | 2229 Handle<String> name, |
2233 int argument_count) { | 2230 int argument_count) { |
2234 return new(zone) HCallGlobal(context, name, argument_count); | 2231 return new(zone) HCallGlobal(context, name, argument_count); |
2235 } | 2232 } |
2236 | 2233 |
2237 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2234 virtual void PrintDataTo(StringStream* stream); |
2238 | 2235 |
2239 HValue* context() { return value(); } | 2236 HValue* context() { return value(); } |
2240 Handle<String> name() const { return name_; } | 2237 Handle<String> name() const { return name_; } |
2241 | 2238 |
| 2239 virtual Representation RequiredInputRepresentation(int index) { |
| 2240 return Representation::Tagged(); |
| 2241 } |
| 2242 |
2242 DECLARE_CONCRETE_INSTRUCTION(CallGlobal) | 2243 DECLARE_CONCRETE_INSTRUCTION(CallGlobal) |
2243 | 2244 |
2244 private: | 2245 private: |
2245 Handle<String> name_; | 2246 Handle<String> name_; |
2246 }; | 2247 }; |
2247 | 2248 |
2248 | 2249 |
2249 class HCallKnownGlobal V8_FINAL : public HCall<0> { | 2250 class HCallKnownGlobal: public HCall<0> { |
2250 public: | 2251 public: |
2251 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) | 2252 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) |
2252 : HCall<0>(argument_count), | 2253 : HCall<0>(argument_count), |
2253 target_(target), | 2254 target_(target), |
2254 formal_parameter_count_(target->shared()->formal_parameter_count()) { } | 2255 formal_parameter_count_(target->shared()->formal_parameter_count()) { } |
2255 | 2256 |
2256 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2257 virtual void PrintDataTo(StringStream* stream); |
2257 | 2258 |
2258 Handle<JSFunction> target() const { return target_; } | 2259 Handle<JSFunction> target() const { return target_; } |
2259 int formal_parameter_count() const { return formal_parameter_count_; } | 2260 int formal_parameter_count() const { return formal_parameter_count_; } |
2260 | 2261 |
2261 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2262 virtual Representation RequiredInputRepresentation(int index) { |
2262 return Representation::None(); | 2263 return Representation::None(); |
2263 } | 2264 } |
2264 | 2265 |
2265 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal) | 2266 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal) |
2266 | 2267 |
2267 private: | 2268 private: |
2268 Handle<JSFunction> target_; | 2269 Handle<JSFunction> target_; |
2269 int formal_parameter_count_; | 2270 int formal_parameter_count_; |
2270 }; | 2271 }; |
2271 | 2272 |
2272 | 2273 |
2273 class HCallNew V8_FINAL : public HBinaryCall { | 2274 class HCallNew: public HBinaryCall { |
2274 public: | 2275 public: |
2275 HCallNew(HValue* context, HValue* constructor, int argument_count) | 2276 HCallNew(HValue* context, HValue* constructor, int argument_count) |
2276 : HBinaryCall(context, constructor, argument_count) {} | 2277 : HBinaryCall(context, constructor, argument_count) { |
| 2278 } |
| 2279 |
| 2280 virtual Representation RequiredInputRepresentation(int index) { |
| 2281 return Representation::Tagged(); |
| 2282 } |
2277 | 2283 |
2278 HValue* context() { return first(); } | 2284 HValue* context() { return first(); } |
2279 HValue* constructor() { return second(); } | 2285 HValue* constructor() { return second(); } |
2280 | 2286 |
2281 DECLARE_CONCRETE_INSTRUCTION(CallNew) | 2287 DECLARE_CONCRETE_INSTRUCTION(CallNew) |
2282 }; | 2288 }; |
2283 | 2289 |
2284 | 2290 |
2285 class HCallNewArray V8_FINAL : public HBinaryCall { | 2291 class HCallNewArray: public HCallNew { |
2286 public: | 2292 public: |
2287 HCallNewArray(HValue* context, HValue* constructor, int argument_count, | 2293 HCallNewArray(HValue* context, HValue* constructor, int argument_count, |
2288 Handle<Cell> type_cell, ElementsKind elements_kind) | 2294 Handle<Cell> type_cell, ElementsKind elements_kind) |
2289 : HBinaryCall(context, constructor, argument_count), | 2295 : HCallNew(context, constructor, argument_count), |
2290 elements_kind_(elements_kind), | 2296 elements_kind_(elements_kind), |
2291 type_cell_(type_cell) {} | 2297 type_cell_(type_cell) {} |
2292 | 2298 |
2293 HValue* context() { return first(); } | 2299 virtual void PrintDataTo(StringStream* stream); |
2294 HValue* constructor() { return second(); } | |
2295 | |
2296 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
2297 | 2300 |
2298 Handle<Cell> property_cell() const { | 2301 Handle<Cell> property_cell() const { |
2299 return type_cell_; | 2302 return type_cell_; |
2300 } | 2303 } |
2301 | 2304 |
2302 ElementsKind elements_kind() const { return elements_kind_; } | 2305 ElementsKind elements_kind() const { return elements_kind_; } |
2303 | 2306 |
2304 DECLARE_CONCRETE_INSTRUCTION(CallNewArray) | 2307 DECLARE_CONCRETE_INSTRUCTION(CallNewArray) |
2305 | 2308 |
2306 private: | 2309 private: |
2307 ElementsKind elements_kind_; | 2310 ElementsKind elements_kind_; |
2308 Handle<Cell> type_cell_; | 2311 Handle<Cell> type_cell_; |
2309 }; | 2312 }; |
2310 | 2313 |
2311 | 2314 |
2312 class HCallRuntime V8_FINAL : public HCall<1> { | 2315 class HCallRuntime: public HCall<1> { |
2313 public: | 2316 public: |
2314 static HCallRuntime* New(Zone* zone, | 2317 static HCallRuntime* New(Zone* zone, |
2315 HValue* context, | 2318 HValue* context, |
2316 Handle<String> name, | 2319 Handle<String> name, |
2317 const Runtime::Function* c_function, | 2320 const Runtime::Function* c_function, |
2318 int argument_count) { | 2321 int argument_count) { |
2319 return new(zone) HCallRuntime(context, name, c_function, argument_count); | 2322 return new(zone) HCallRuntime(context, name, c_function, argument_count); |
2320 } | 2323 } |
2321 | 2324 |
2322 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2325 virtual void PrintDataTo(StringStream* stream); |
2323 | 2326 |
2324 HValue* context() { return OperandAt(0); } | 2327 HValue* context() { return OperandAt(0); } |
2325 const Runtime::Function* function() const { return c_function_; } | 2328 const Runtime::Function* function() const { return c_function_; } |
2326 Handle<String> name() const { return name_; } | 2329 Handle<String> name() const { return name_; } |
2327 | 2330 |
2328 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2331 virtual Representation RequiredInputRepresentation(int index) { |
2329 return Representation::Tagged(); | 2332 return Representation::Tagged(); |
2330 } | 2333 } |
2331 | 2334 |
2332 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) | 2335 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) |
2333 | 2336 |
2334 private: | 2337 private: |
2335 HCallRuntime(HValue* context, | 2338 HCallRuntime(HValue* context, |
2336 Handle<String> name, | 2339 Handle<String> name, |
2337 const Runtime::Function* c_function, | 2340 const Runtime::Function* c_function, |
2338 int argument_count) | 2341 int argument_count) |
2339 : HCall<1>(argument_count), c_function_(c_function), name_(name) { | 2342 : HCall<1>(argument_count), c_function_(c_function), name_(name) { |
2340 SetOperandAt(0, context); | 2343 SetOperandAt(0, context); |
2341 } | 2344 } |
2342 | 2345 |
2343 const Runtime::Function* c_function_; | 2346 const Runtime::Function* c_function_; |
2344 Handle<String> name_; | 2347 Handle<String> name_; |
2345 }; | 2348 }; |
2346 | 2349 |
2347 | 2350 |
2348 class HMapEnumLength V8_FINAL : public HUnaryOperation { | 2351 class HMapEnumLength: public HUnaryOperation { |
2349 public: | 2352 public: |
2350 DECLARE_INSTRUCTION_FACTORY_P1(HMapEnumLength, HValue*); | 2353 DECLARE_INSTRUCTION_FACTORY_P1(HMapEnumLength, HValue*); |
2351 | 2354 |
2352 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2355 virtual Representation RequiredInputRepresentation(int index) { |
2353 return Representation::Tagged(); | 2356 return Representation::Tagged(); |
2354 } | 2357 } |
2355 | 2358 |
2356 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength) | 2359 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength) |
2357 | 2360 |
2358 protected: | 2361 protected: |
2359 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 2362 virtual bool DataEquals(HValue* other) { return true; } |
2360 | 2363 |
2361 private: | 2364 private: |
2362 explicit HMapEnumLength(HValue* value) | 2365 explicit HMapEnumLength(HValue* value) |
2363 : HUnaryOperation(value, HType::Smi()) { | 2366 : HUnaryOperation(value, HType::Smi()) { |
2364 set_representation(Representation::Smi()); | 2367 set_representation(Representation::Smi()); |
2365 SetFlag(kUseGVN); | 2368 SetFlag(kUseGVN); |
2366 SetGVNFlag(kDependsOnMaps); | 2369 SetGVNFlag(kDependsOnMaps); |
2367 } | 2370 } |
2368 | 2371 |
2369 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 2372 virtual bool IsDeletable() const { return true; } |
2370 }; | 2373 }; |
2371 | 2374 |
2372 | 2375 |
2373 class HElementsKind V8_FINAL : public HUnaryOperation { | 2376 class HElementsKind: public HUnaryOperation { |
2374 public: | 2377 public: |
2375 explicit HElementsKind(HValue* value) : HUnaryOperation(value) { | 2378 explicit HElementsKind(HValue* value) : HUnaryOperation(value) { |
2376 set_representation(Representation::Integer32()); | 2379 set_representation(Representation::Integer32()); |
2377 SetFlag(kUseGVN); | 2380 SetFlag(kUseGVN); |
2378 SetGVNFlag(kDependsOnElementsKind); | 2381 SetGVNFlag(kDependsOnElementsKind); |
2379 } | 2382 } |
2380 | 2383 |
2381 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2384 virtual Representation RequiredInputRepresentation(int index) { |
2382 return Representation::Tagged(); | 2385 return Representation::Tagged(); |
2383 } | 2386 } |
2384 | 2387 |
2385 DECLARE_CONCRETE_INSTRUCTION(ElementsKind) | 2388 DECLARE_CONCRETE_INSTRUCTION(ElementsKind) |
2386 | 2389 |
2387 protected: | 2390 protected: |
2388 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 2391 virtual bool DataEquals(HValue* other) { return true; } |
2389 | 2392 |
2390 private: | 2393 private: |
2391 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 2394 virtual bool IsDeletable() const { return true; } |
2392 }; | 2395 }; |
2393 | 2396 |
2394 | 2397 |
2395 class HUnaryMathOperation V8_FINAL : public HTemplateInstruction<2> { | 2398 class HUnaryMathOperation: public HTemplateInstruction<2> { |
2396 public: | 2399 public: |
2397 static HInstruction* New(Zone* zone, | 2400 static HInstruction* New(Zone* zone, |
2398 HValue* context, | 2401 HValue* context, |
2399 HValue* value, | 2402 HValue* value, |
2400 BuiltinFunctionId op); | 2403 BuiltinFunctionId op); |
2401 | 2404 |
2402 HValue* context() { return OperandAt(0); } | 2405 HValue* context() { return OperandAt(0); } |
2403 HValue* value() { return OperandAt(1); } | 2406 HValue* value() { return OperandAt(1); } |
2404 | 2407 |
2405 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2408 virtual void PrintDataTo(StringStream* stream); |
2406 | 2409 |
2407 virtual HValue* EnsureAndPropagateNotMinusZero( | 2410 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
2408 BitVector* visited) V8_OVERRIDE; | |
2409 | 2411 |
2410 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2412 virtual Representation RequiredInputRepresentation(int index) { |
2411 if (index == 0) { | 2413 if (index == 0) { |
2412 return Representation::Tagged(); | 2414 return Representation::Tagged(); |
2413 } else { | 2415 } else { |
2414 switch (op_) { | 2416 switch (op_) { |
2415 case kMathFloor: | 2417 case kMathFloor: |
2416 case kMathRound: | 2418 case kMathRound: |
2417 case kMathSqrt: | 2419 case kMathSqrt: |
2418 case kMathPowHalf: | 2420 case kMathPowHalf: |
2419 case kMathLog: | 2421 case kMathLog: |
2420 case kMathExp: | 2422 case kMathExp: |
2421 case kMathSin: | 2423 case kMathSin: |
2422 case kMathCos: | 2424 case kMathCos: |
2423 case kMathTan: | 2425 case kMathTan: |
2424 return Representation::Double(); | 2426 return Representation::Double(); |
2425 case kMathAbs: | 2427 case kMathAbs: |
2426 return representation(); | 2428 return representation(); |
2427 default: | 2429 default: |
2428 UNREACHABLE(); | 2430 UNREACHABLE(); |
2429 return Representation::None(); | 2431 return Representation::None(); |
2430 } | 2432 } |
2431 } | 2433 } |
2432 } | 2434 } |
2433 | 2435 |
2434 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 2436 virtual Range* InferRange(Zone* zone); |
2435 | 2437 |
2436 virtual HValue* Canonicalize() V8_OVERRIDE; | 2438 virtual HValue* Canonicalize(); |
2437 virtual Representation RepresentationFromInputs() V8_OVERRIDE; | 2439 virtual Representation RepresentationFromInputs(); |
2438 | 2440 |
2439 BuiltinFunctionId op() const { return op_; } | 2441 BuiltinFunctionId op() const { return op_; } |
2440 const char* OpName() const; | 2442 const char* OpName() const; |
2441 | 2443 |
2442 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation) | 2444 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation) |
2443 | 2445 |
2444 protected: | 2446 protected: |
2445 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 2447 virtual bool DataEquals(HValue* other) { |
2446 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); | 2448 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); |
2447 return op_ == b->op(); | 2449 return op_ == b->op(); |
2448 } | 2450 } |
2449 | 2451 |
2450 private: | 2452 private: |
2451 HUnaryMathOperation(HValue* context, HValue* value, BuiltinFunctionId op) | 2453 HUnaryMathOperation(HValue* context, HValue* value, BuiltinFunctionId op) |
2452 : HTemplateInstruction<2>(HType::TaggedNumber()), op_(op) { | 2454 : HTemplateInstruction<2>(HType::TaggedNumber()), op_(op) { |
2453 SetOperandAt(0, context); | 2455 SetOperandAt(0, context); |
2454 SetOperandAt(1, value); | 2456 SetOperandAt(1, value); |
2455 switch (op) { | 2457 switch (op) { |
(...skipping 21 matching lines...) Expand all Loading... |
2477 case kMathPowHalf: | 2479 case kMathPowHalf: |
2478 set_representation(Representation::Double()); | 2480 set_representation(Representation::Double()); |
2479 break; | 2481 break; |
2480 default: | 2482 default: |
2481 UNREACHABLE(); | 2483 UNREACHABLE(); |
2482 } | 2484 } |
2483 SetFlag(kUseGVN); | 2485 SetFlag(kUseGVN); |
2484 SetFlag(kAllowUndefinedAsNaN); | 2486 SetFlag(kAllowUndefinedAsNaN); |
2485 } | 2487 } |
2486 | 2488 |
2487 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 2489 virtual bool IsDeletable() const { return true; } |
2488 | 2490 |
2489 BuiltinFunctionId op_; | 2491 BuiltinFunctionId op_; |
2490 }; | 2492 }; |
2491 | 2493 |
2492 | 2494 |
2493 class HLoadExternalArrayPointer V8_FINAL : public HUnaryOperation { | 2495 class HLoadExternalArrayPointer: public HUnaryOperation { |
2494 public: | 2496 public: |
2495 DECLARE_INSTRUCTION_FACTORY_P1(HLoadExternalArrayPointer, HValue*); | 2497 DECLARE_INSTRUCTION_FACTORY_P1(HLoadExternalArrayPointer, HValue*); |
2496 | 2498 |
2497 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2499 virtual Representation RequiredInputRepresentation(int index) { |
2498 return Representation::Tagged(); | 2500 return Representation::Tagged(); |
2499 } | 2501 } |
2500 | 2502 |
2501 virtual HType CalculateInferredType() V8_OVERRIDE { | 2503 virtual HType CalculateInferredType() { |
2502 return HType::None(); | 2504 return HType::None(); |
2503 } | 2505 } |
2504 | 2506 |
2505 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer) | 2507 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer) |
2506 | 2508 |
2507 protected: | 2509 protected: |
2508 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 2510 virtual bool DataEquals(HValue* other) { return true; } |
2509 | 2511 |
2510 private: | 2512 private: |
2511 explicit HLoadExternalArrayPointer(HValue* value) | 2513 explicit HLoadExternalArrayPointer(HValue* value) |
2512 : HUnaryOperation(value) { | 2514 : HUnaryOperation(value) { |
2513 set_representation(Representation::External()); | 2515 set_representation(Representation::External()); |
2514 // The result of this instruction is idempotent as long as its inputs don't | 2516 // The result of this instruction is idempotent as long as its inputs don't |
2515 // change. The external array of a specialized array elements object cannot | 2517 // change. The external array of a specialized array elements object cannot |
2516 // change once set, so it's no necessary to introduce any additional | 2518 // change once set, so it's no necessary to introduce any additional |
2517 // dependencies on top of the inputs. | 2519 // dependencies on top of the inputs. |
2518 SetFlag(kUseGVN); | 2520 SetFlag(kUseGVN); |
2519 } | 2521 } |
2520 | 2522 |
2521 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 2523 virtual bool IsDeletable() const { return true; } |
2522 }; | 2524 }; |
2523 | 2525 |
2524 | 2526 |
2525 class HCheckMaps V8_FINAL : public HTemplateInstruction<2> { | 2527 class HCheckMaps: public HTemplateInstruction<2> { |
2526 public: | 2528 public: |
2527 static HCheckMaps* New(Zone* zone, HValue* context, HValue* value, | 2529 static HCheckMaps* New(Zone* zone, HValue* context, HValue* value, |
2528 Handle<Map> map, CompilationInfo* info, | 2530 Handle<Map> map, CompilationInfo* info, |
2529 HValue *typecheck = NULL); | 2531 HValue *typecheck = NULL); |
2530 static HCheckMaps* New(Zone* zone, HValue* context, | 2532 static HCheckMaps* New(Zone* zone, HValue* context, |
2531 HValue* value, SmallMapList* maps, | 2533 HValue* value, SmallMapList* maps, |
2532 HValue *typecheck = NULL) { | 2534 HValue *typecheck = NULL) { |
2533 HCheckMaps* check_map = new(zone) HCheckMaps(value, zone, typecheck); | 2535 HCheckMaps* check_map = new(zone) HCheckMaps(value, zone, typecheck); |
2534 for (int i = 0; i < maps->length(); i++) { | 2536 for (int i = 0; i < maps->length(); i++) { |
2535 check_map->Add(maps->at(i), zone); | 2537 check_map->Add(maps->at(i), zone); |
2536 } | 2538 } |
2537 check_map->map_set_.Sort(); | 2539 check_map->map_set_.Sort(); |
2538 return check_map; | 2540 return check_map; |
2539 } | 2541 } |
2540 | 2542 |
2541 bool CanOmitMapChecks() { return omit_; } | 2543 bool CanOmitMapChecks() { return omit_; } |
2542 | 2544 |
2543 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } | 2545 virtual bool HasEscapingOperandAt(int index) { return false; } |
2544 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2546 virtual Representation RequiredInputRepresentation(int index) { |
2545 return Representation::Tagged(); | 2547 return Representation::Tagged(); |
2546 } | 2548 } |
2547 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 2549 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
2548 HValue* dominator) V8_OVERRIDE; | 2550 HValue* dominator); |
2549 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2551 virtual void PrintDataTo(StringStream* stream); |
2550 | 2552 |
2551 HValue* value() { return OperandAt(0); } | 2553 HValue* value() { return OperandAt(0); } |
2552 SmallMapList* map_set() { return &map_set_; } | 2554 SmallMapList* map_set() { return &map_set_; } |
2553 | 2555 |
2554 bool has_migration_target() { | 2556 bool has_migration_target() { |
2555 return has_migration_target_; | 2557 return has_migration_target_; |
2556 } | 2558 } |
2557 | 2559 |
2558 virtual void FinalizeUniqueValueId() V8_OVERRIDE; | 2560 virtual void FinalizeUniqueValueId(); |
2559 | 2561 |
2560 DECLARE_CONCRETE_INSTRUCTION(CheckMaps) | 2562 DECLARE_CONCRETE_INSTRUCTION(CheckMaps) |
2561 | 2563 |
2562 protected: | 2564 protected: |
2563 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 2565 virtual bool DataEquals(HValue* other) { |
2564 ASSERT_EQ(map_set_.length(), map_unique_ids_.length()); | 2566 ASSERT_EQ(map_set_.length(), map_unique_ids_.length()); |
2565 HCheckMaps* b = HCheckMaps::cast(other); | 2567 HCheckMaps* b = HCheckMaps::cast(other); |
2566 // Relies on the fact that map_set has been sorted before. | 2568 // Relies on the fact that map_set has been sorted before. |
2567 if (map_unique_ids_.length() != b->map_unique_ids_.length()) { | 2569 if (map_unique_ids_.length() != b->map_unique_ids_.length()) { |
2568 return false; | 2570 return false; |
2569 } | 2571 } |
2570 for (int i = 0; i < map_unique_ids_.length(); i++) { | 2572 for (int i = 0; i < map_unique_ids_.length(); i++) { |
2571 if (map_unique_ids_.at(i) != b->map_unique_ids_.at(i)) { | 2573 if (map_unique_ids_.at(i) != b->map_unique_ids_.at(i)) { |
2572 return false; | 2574 return false; |
2573 } | 2575 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2608 } | 2610 } |
2609 } | 2611 } |
2610 | 2612 |
2611 bool omit_; | 2613 bool omit_; |
2612 bool has_migration_target_; | 2614 bool has_migration_target_; |
2613 SmallMapList map_set_; | 2615 SmallMapList map_set_; |
2614 ZoneList<UniqueValueId> map_unique_ids_; | 2616 ZoneList<UniqueValueId> map_unique_ids_; |
2615 }; | 2617 }; |
2616 | 2618 |
2617 | 2619 |
2618 class HCheckFunction V8_FINAL : public HUnaryOperation { | 2620 class HCheckFunction: public HUnaryOperation { |
2619 public: | 2621 public: |
2620 DECLARE_INSTRUCTION_FACTORY_P2(HCheckFunction, HValue*, Handle<JSFunction>); | 2622 DECLARE_INSTRUCTION_FACTORY_P2(HCheckFunction, HValue*, Handle<JSFunction>); |
2621 | 2623 |
2622 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2624 virtual Representation RequiredInputRepresentation(int index) { |
2623 return Representation::Tagged(); | 2625 return Representation::Tagged(); |
2624 } | 2626 } |
2625 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2627 virtual void PrintDataTo(StringStream* stream); |
2626 | 2628 |
2627 virtual HValue* Canonicalize() V8_OVERRIDE; | 2629 virtual HValue* Canonicalize(); |
2628 | 2630 |
2629 #ifdef DEBUG | 2631 #ifdef DEBUG |
2630 virtual void Verify() V8_OVERRIDE; | 2632 virtual void Verify(); |
2631 #endif | 2633 #endif |
2632 | 2634 |
2633 virtual void FinalizeUniqueValueId() V8_OVERRIDE { | 2635 virtual void FinalizeUniqueValueId() { |
2634 target_unique_id_ = UniqueValueId(target_); | 2636 target_unique_id_ = UniqueValueId(target_); |
2635 } | 2637 } |
2636 | 2638 |
2637 Handle<JSFunction> target() const { return target_; } | 2639 Handle<JSFunction> target() const { return target_; } |
2638 bool target_in_new_space() const { return target_in_new_space_; } | 2640 bool target_in_new_space() const { return target_in_new_space_; } |
2639 | 2641 |
2640 DECLARE_CONCRETE_INSTRUCTION(CheckFunction) | 2642 DECLARE_CONCRETE_INSTRUCTION(CheckFunction) |
2641 | 2643 |
2642 protected: | 2644 protected: |
2643 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 2645 virtual bool DataEquals(HValue* other) { |
2644 HCheckFunction* b = HCheckFunction::cast(other); | 2646 HCheckFunction* b = HCheckFunction::cast(other); |
2645 return target_unique_id_ == b->target_unique_id_; | 2647 return target_unique_id_ == b->target_unique_id_; |
2646 } | 2648 } |
2647 | 2649 |
2648 private: | 2650 private: |
2649 HCheckFunction(HValue* value, Handle<JSFunction> function) | 2651 HCheckFunction(HValue* value, Handle<JSFunction> function) |
2650 : HUnaryOperation(value, value->type()), | 2652 : HUnaryOperation(value, value->type()), |
2651 target_(function), target_unique_id_() { | 2653 target_(function), target_unique_id_() { |
2652 set_representation(Representation::Tagged()); | 2654 set_representation(Representation::Tagged()); |
2653 SetFlag(kUseGVN); | 2655 SetFlag(kUseGVN); |
2654 target_in_new_space_ = Isolate::Current()->heap()->InNewSpace(*function); | 2656 target_in_new_space_ = Isolate::Current()->heap()->InNewSpace(*function); |
2655 } | 2657 } |
2656 | 2658 |
2657 Handle<JSFunction> target_; | 2659 Handle<JSFunction> target_; |
2658 UniqueValueId target_unique_id_; | 2660 UniqueValueId target_unique_id_; |
2659 bool target_in_new_space_; | 2661 bool target_in_new_space_; |
2660 }; | 2662 }; |
2661 | 2663 |
2662 | 2664 |
2663 class HCheckInstanceType V8_FINAL : public HUnaryOperation { | 2665 class HCheckInstanceType: public HUnaryOperation { |
2664 public: | 2666 public: |
2665 static HCheckInstanceType* NewIsSpecObject(HValue* value, Zone* zone) { | 2667 static HCheckInstanceType* NewIsSpecObject(HValue* value, Zone* zone) { |
2666 return new(zone) HCheckInstanceType(value, IS_SPEC_OBJECT); | 2668 return new(zone) HCheckInstanceType(value, IS_SPEC_OBJECT); |
2667 } | 2669 } |
2668 static HCheckInstanceType* NewIsJSArray(HValue* value, Zone* zone) { | 2670 static HCheckInstanceType* NewIsJSArray(HValue* value, Zone* zone) { |
2669 return new(zone) HCheckInstanceType(value, IS_JS_ARRAY); | 2671 return new(zone) HCheckInstanceType(value, IS_JS_ARRAY); |
2670 } | 2672 } |
2671 static HCheckInstanceType* NewIsString(HValue* value, Zone* zone) { | 2673 static HCheckInstanceType* NewIsString(HValue* value, Zone* zone) { |
2672 return new(zone) HCheckInstanceType(value, IS_STRING); | 2674 return new(zone) HCheckInstanceType(value, IS_STRING); |
2673 } | 2675 } |
2674 static HCheckInstanceType* NewIsInternalizedString( | 2676 static HCheckInstanceType* NewIsInternalizedString( |
2675 HValue* value, Zone* zone) { | 2677 HValue* value, Zone* zone) { |
2676 return new(zone) HCheckInstanceType(value, IS_INTERNALIZED_STRING); | 2678 return new(zone) HCheckInstanceType(value, IS_INTERNALIZED_STRING); |
2677 } | 2679 } |
2678 | 2680 |
2679 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2681 virtual void PrintDataTo(StringStream* stream); |
2680 | 2682 |
2681 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2683 virtual Representation RequiredInputRepresentation(int index) { |
2682 return Representation::Tagged(); | 2684 return Representation::Tagged(); |
2683 } | 2685 } |
2684 | 2686 |
2685 virtual HValue* Canonicalize() V8_OVERRIDE; | 2687 virtual HValue* Canonicalize(); |
2686 | 2688 |
2687 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } | 2689 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } |
2688 void GetCheckInterval(InstanceType* first, InstanceType* last); | 2690 void GetCheckInterval(InstanceType* first, InstanceType* last); |
2689 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); | 2691 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); |
2690 | 2692 |
2691 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) | 2693 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) |
2692 | 2694 |
2693 protected: | 2695 protected: |
2694 // TODO(ager): It could be nice to allow the ommision of instance | 2696 // TODO(ager): It could be nice to allow the ommision of instance |
2695 // type checks if we have already performed an instance type check | 2697 // type checks if we have already performed an instance type check |
2696 // with a larger range. | 2698 // with a larger range. |
2697 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 2699 virtual bool DataEquals(HValue* other) { |
2698 HCheckInstanceType* b = HCheckInstanceType::cast(other); | 2700 HCheckInstanceType* b = HCheckInstanceType::cast(other); |
2699 return check_ == b->check_; | 2701 return check_ == b->check_; |
2700 } | 2702 } |
2701 | 2703 |
2702 private: | 2704 private: |
2703 enum Check { | 2705 enum Check { |
2704 IS_SPEC_OBJECT, | 2706 IS_SPEC_OBJECT, |
2705 IS_JS_ARRAY, | 2707 IS_JS_ARRAY, |
2706 IS_STRING, | 2708 IS_STRING, |
2707 IS_INTERNALIZED_STRING, | 2709 IS_INTERNALIZED_STRING, |
2708 LAST_INTERVAL_CHECK = IS_JS_ARRAY | 2710 LAST_INTERVAL_CHECK = IS_JS_ARRAY |
2709 }; | 2711 }; |
2710 | 2712 |
2711 const char* GetCheckName(); | 2713 const char* GetCheckName(); |
2712 | 2714 |
2713 HCheckInstanceType(HValue* value, Check check) | 2715 HCheckInstanceType(HValue* value, Check check) |
2714 : HUnaryOperation(value), check_(check) { | 2716 : HUnaryOperation(value), check_(check) { |
2715 set_representation(Representation::Tagged()); | 2717 set_representation(Representation::Tagged()); |
2716 SetFlag(kUseGVN); | 2718 SetFlag(kUseGVN); |
2717 } | 2719 } |
2718 | 2720 |
2719 const Check check_; | 2721 const Check check_; |
2720 }; | 2722 }; |
2721 | 2723 |
2722 | 2724 |
2723 class HCheckSmi V8_FINAL : public HUnaryOperation { | 2725 class HCheckSmi: public HUnaryOperation { |
2724 public: | 2726 public: |
2725 DECLARE_INSTRUCTION_FACTORY_P1(HCheckSmi, HValue*); | 2727 DECLARE_INSTRUCTION_FACTORY_P1(HCheckSmi, HValue*); |
2726 | 2728 |
2727 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2729 virtual Representation RequiredInputRepresentation(int index) { |
2728 return Representation::Tagged(); | 2730 return Representation::Tagged(); |
2729 } | 2731 } |
2730 | 2732 |
2731 virtual HValue* Canonicalize() V8_OVERRIDE { | 2733 virtual HValue* Canonicalize() { |
2732 HType value_type = value()->type(); | 2734 HType value_type = value()->type(); |
2733 if (value_type.IsSmi()) { | 2735 if (value_type.IsSmi()) { |
2734 return NULL; | 2736 return NULL; |
2735 } | 2737 } |
2736 return this; | 2738 return this; |
2737 } | 2739 } |
2738 | 2740 |
2739 DECLARE_CONCRETE_INSTRUCTION(CheckSmi) | 2741 DECLARE_CONCRETE_INSTRUCTION(CheckSmi) |
2740 | 2742 |
2741 protected: | 2743 protected: |
2742 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 2744 virtual bool DataEquals(HValue* other) { return true; } |
2743 | 2745 |
2744 private: | 2746 private: |
2745 explicit HCheckSmi(HValue* value) : HUnaryOperation(value, HType::Smi()) { | 2747 explicit HCheckSmi(HValue* value) : HUnaryOperation(value, HType::Smi()) { |
2746 set_representation(Representation::Smi()); | 2748 set_representation(Representation::Smi()); |
2747 SetFlag(kUseGVN); | 2749 SetFlag(kUseGVN); |
2748 } | 2750 } |
2749 }; | 2751 }; |
2750 | 2752 |
2751 | 2753 |
2752 class HIsNumberAndBranch V8_FINAL : public HUnaryControlInstruction { | 2754 class HIsNumberAndBranch: public HUnaryControlInstruction { |
2753 public: | 2755 public: |
2754 explicit HIsNumberAndBranch(HValue* value) | 2756 explicit HIsNumberAndBranch(HValue* value) |
2755 : HUnaryControlInstruction(value, NULL, NULL) { | 2757 : HUnaryControlInstruction(value, NULL, NULL) { |
2756 SetFlag(kFlexibleRepresentation); | 2758 SetFlag(kFlexibleRepresentation); |
2757 } | 2759 } |
2758 | 2760 |
2759 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2761 virtual Representation RequiredInputRepresentation(int index) { |
2760 return Representation::None(); | 2762 return Representation::None(); |
2761 } | 2763 } |
2762 | 2764 |
2763 DECLARE_CONCRETE_INSTRUCTION(IsNumberAndBranch) | 2765 DECLARE_CONCRETE_INSTRUCTION(IsNumberAndBranch) |
2764 }; | 2766 }; |
2765 | 2767 |
2766 | 2768 |
2767 class HCheckHeapObject V8_FINAL : public HUnaryOperation { | 2769 class HCheckHeapObject: public HUnaryOperation { |
2768 public: | 2770 public: |
2769 DECLARE_INSTRUCTION_FACTORY_P1(HCheckHeapObject, HValue*); | 2771 DECLARE_INSTRUCTION_FACTORY_P1(HCheckHeapObject, HValue*); |
2770 | 2772 |
2771 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } | 2773 virtual bool HasEscapingOperandAt(int index) { return false; } |
2772 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2774 virtual Representation RequiredInputRepresentation(int index) { |
2773 return Representation::Tagged(); | 2775 return Representation::Tagged(); |
2774 } | 2776 } |
2775 | 2777 |
2776 #ifdef DEBUG | 2778 #ifdef DEBUG |
2777 virtual void Verify() V8_OVERRIDE; | 2779 virtual void Verify(); |
2778 #endif | 2780 #endif |
2779 | 2781 |
2780 virtual HValue* Canonicalize() V8_OVERRIDE { | 2782 virtual HValue* Canonicalize() { |
2781 return value()->type().IsHeapObject() ? NULL : this; | 2783 return value()->type().IsHeapObject() ? NULL : this; |
2782 } | 2784 } |
2783 | 2785 |
2784 DECLARE_CONCRETE_INSTRUCTION(CheckHeapObject) | 2786 DECLARE_CONCRETE_INSTRUCTION(CheckHeapObject) |
2785 | 2787 |
2786 protected: | 2788 protected: |
2787 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 2789 virtual bool DataEquals(HValue* other) { return true; } |
2788 | 2790 |
2789 private: | 2791 private: |
2790 explicit HCheckHeapObject(HValue* value) | 2792 explicit HCheckHeapObject(HValue* value) |
2791 : HUnaryOperation(value, HType::NonPrimitive()) { | 2793 : HUnaryOperation(value, HType::NonPrimitive()) { |
2792 set_representation(Representation::Tagged()); | 2794 set_representation(Representation::Tagged()); |
2793 SetFlag(kUseGVN); | 2795 SetFlag(kUseGVN); |
2794 } | 2796 } |
2795 }; | 2797 }; |
2796 | 2798 |
2797 | 2799 |
(...skipping 11 matching lines...) Expand all Loading... |
2809 limit_is_upper(false), limit_is_included(false) {} | 2811 limit_is_upper(false), limit_is_included(false) {} |
2810 }; | 2812 }; |
2811 | 2813 |
2812 | 2814 |
2813 class HBoundsCheck; | 2815 class HBoundsCheck; |
2814 class HPhi; | 2816 class HPhi; |
2815 class HConstant; | 2817 class HConstant; |
2816 class HBitwise; | 2818 class HBitwise; |
2817 | 2819 |
2818 | 2820 |
2819 class InductionVariableData V8_FINAL : public ZoneObject { | 2821 class InductionVariableData : public ZoneObject { |
2820 public: | 2822 public: |
2821 class InductionVariableCheck : public ZoneObject { | 2823 class InductionVariableCheck : public ZoneObject { |
2822 public: | 2824 public: |
2823 HBoundsCheck* check() { return check_; } | 2825 HBoundsCheck* check() { return check_; } |
2824 InductionVariableCheck* next() { return next_; } | 2826 InductionVariableCheck* next() { return next_; } |
2825 bool HasUpperLimit() { return upper_limit_ >= 0; } | 2827 bool HasUpperLimit() { return upper_limit_ >= 0; } |
2826 int32_t upper_limit() { | 2828 int32_t upper_limit() { |
2827 ASSERT(HasUpperLimit()); | 2829 ASSERT(HasUpperLimit()); |
2828 return upper_limit_; | 2830 return upper_limit_; |
2829 } | 2831 } |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3009 HBasicBlock* induction_exit_block_; | 3011 HBasicBlock* induction_exit_block_; |
3010 HBasicBlock* induction_exit_target_; | 3012 HBasicBlock* induction_exit_target_; |
3011 ChecksRelatedToLength* checks_; | 3013 ChecksRelatedToLength* checks_; |
3012 HValue* additional_upper_limit_; | 3014 HValue* additional_upper_limit_; |
3013 bool additional_upper_limit_is_included_; | 3015 bool additional_upper_limit_is_included_; |
3014 HValue* additional_lower_limit_; | 3016 HValue* additional_lower_limit_; |
3015 bool additional_lower_limit_is_included_; | 3017 bool additional_lower_limit_is_included_; |
3016 }; | 3018 }; |
3017 | 3019 |
3018 | 3020 |
3019 class HPhi V8_FINAL : public HValue { | 3021 class HPhi: public HValue { |
3020 public: | 3022 public: |
3021 HPhi(int merged_index, Zone* zone) | 3023 HPhi(int merged_index, Zone* zone) |
3022 : inputs_(2, zone), | 3024 : inputs_(2, zone), |
3023 merged_index_(merged_index), | 3025 merged_index_(merged_index), |
3024 phi_id_(-1), | 3026 phi_id_(-1), |
3025 induction_variable_data_(NULL) { | 3027 induction_variable_data_(NULL) { |
3026 for (int i = 0; i < Representation::kNumRepresentations; i++) { | 3028 for (int i = 0; i < Representation::kNumRepresentations; i++) { |
3027 non_phi_uses_[i] = 0; | 3029 non_phi_uses_[i] = 0; |
3028 indirect_uses_[i] = 0; | 3030 indirect_uses_[i] = 0; |
3029 } | 3031 } |
3030 ASSERT(merged_index >= 0 || merged_index == kInvalidMergedIndex); | 3032 ASSERT(merged_index >= 0 || merged_index == kInvalidMergedIndex); |
3031 SetFlag(kFlexibleRepresentation); | 3033 SetFlag(kFlexibleRepresentation); |
3032 SetFlag(kAllowUndefinedAsNaN); | 3034 SetFlag(kAllowUndefinedAsNaN); |
3033 } | 3035 } |
3034 | 3036 |
3035 virtual Representation RepresentationFromInputs() V8_OVERRIDE; | 3037 virtual Representation RepresentationFromInputs(); |
3036 | 3038 |
3037 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 3039 virtual Range* InferRange(Zone* zone); |
3038 virtual void InferRepresentation( | 3040 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); |
3039 HInferRepresentationPhase* h_infer) V8_OVERRIDE; | 3041 virtual Representation RequiredInputRepresentation(int index) { |
3040 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | |
3041 return representation(); | 3042 return representation(); |
3042 } | 3043 } |
3043 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE { | 3044 virtual Representation KnownOptimalRepresentation() { |
3044 return representation(); | 3045 return representation(); |
3045 } | 3046 } |
3046 virtual HType CalculateInferredType() V8_OVERRIDE; | 3047 virtual HType CalculateInferredType(); |
3047 virtual int OperandCount() V8_OVERRIDE { return inputs_.length(); } | 3048 virtual int OperandCount() { return inputs_.length(); } |
3048 virtual HValue* OperandAt(int index) const V8_OVERRIDE { | 3049 virtual HValue* OperandAt(int index) const { return inputs_[index]; } |
3049 return inputs_[index]; | |
3050 } | |
3051 HValue* GetRedundantReplacement(); | 3050 HValue* GetRedundantReplacement(); |
3052 void AddInput(HValue* value); | 3051 void AddInput(HValue* value); |
3053 bool HasRealUses(); | 3052 bool HasRealUses(); |
3054 | 3053 |
3055 bool IsReceiver() const { return merged_index_ == 0; } | 3054 bool IsReceiver() const { return merged_index_ == 0; } |
3056 bool HasMergedIndex() const { return merged_index_ != kInvalidMergedIndex; } | 3055 bool HasMergedIndex() const { return merged_index_ != kInvalidMergedIndex; } |
3057 | 3056 |
3058 int merged_index() const { return merged_index_; } | 3057 int merged_index() const { return merged_index_; } |
3059 | 3058 |
3060 InductionVariableData* induction_variable_data() { | 3059 InductionVariableData* induction_variable_data() { |
3061 return induction_variable_data_; | 3060 return induction_variable_data_; |
3062 } | 3061 } |
3063 bool IsInductionVariable() { | 3062 bool IsInductionVariable() { |
3064 return induction_variable_data_ != NULL; | 3063 return induction_variable_data_ != NULL; |
3065 } | 3064 } |
3066 bool IsLimitedInductionVariable() { | 3065 bool IsLimitedInductionVariable() { |
3067 return IsInductionVariable() && | 3066 return IsInductionVariable() && |
3068 induction_variable_data_->limit() != NULL; | 3067 induction_variable_data_->limit() != NULL; |
3069 } | 3068 } |
3070 void DetectInductionVariable() { | 3069 void DetectInductionVariable() { |
3071 ASSERT(induction_variable_data_ == NULL); | 3070 ASSERT(induction_variable_data_ == NULL); |
3072 induction_variable_data_ = InductionVariableData::ExaminePhi(this); | 3071 induction_variable_data_ = InductionVariableData::ExaminePhi(this); |
3073 } | 3072 } |
3074 | 3073 |
3075 virtual void PrintTo(StringStream* stream) V8_OVERRIDE; | 3074 virtual void PrintTo(StringStream* stream); |
3076 | 3075 |
3077 #ifdef DEBUG | 3076 #ifdef DEBUG |
3078 virtual void Verify() V8_OVERRIDE; | 3077 virtual void Verify(); |
3079 #endif | 3078 #endif |
3080 | 3079 |
3081 void InitRealUses(int id); | 3080 void InitRealUses(int id); |
3082 void AddNonPhiUsesFrom(HPhi* other); | 3081 void AddNonPhiUsesFrom(HPhi* other); |
3083 void AddIndirectUsesTo(int* use_count); | 3082 void AddIndirectUsesTo(int* use_count); |
3084 | 3083 |
3085 int tagged_non_phi_uses() const { | 3084 int tagged_non_phi_uses() const { |
3086 return non_phi_uses_[Representation::kTagged]; | 3085 return non_phi_uses_[Representation::kTagged]; |
3087 } | 3086 } |
3088 int smi_non_phi_uses() const { | 3087 int smi_non_phi_uses() const { |
(...skipping 16 matching lines...) Expand all Loading... |
3105 } | 3104 } |
3106 int double_indirect_uses() const { | 3105 int double_indirect_uses() const { |
3107 return indirect_uses_[Representation::kDouble]; | 3106 return indirect_uses_[Representation::kDouble]; |
3108 } | 3107 } |
3109 int phi_id() { return phi_id_; } | 3108 int phi_id() { return phi_id_; } |
3110 | 3109 |
3111 static HPhi* cast(HValue* value) { | 3110 static HPhi* cast(HValue* value) { |
3112 ASSERT(value->IsPhi()); | 3111 ASSERT(value->IsPhi()); |
3113 return reinterpret_cast<HPhi*>(value); | 3112 return reinterpret_cast<HPhi*>(value); |
3114 } | 3113 } |
3115 virtual Opcode opcode() const V8_OVERRIDE { return HValue::kPhi; } | 3114 virtual Opcode opcode() const { return HValue::kPhi; } |
3116 | 3115 |
3117 void SimplifyConstantInputs(); | 3116 void SimplifyConstantInputs(); |
3118 | 3117 |
3119 // Marker value representing an invalid merge index. | 3118 // Marker value representing an invalid merge index. |
3120 static const int kInvalidMergedIndex = -1; | 3119 static const int kInvalidMergedIndex = -1; |
3121 | 3120 |
3122 protected: | 3121 protected: |
3123 virtual void DeleteFromGraph() V8_OVERRIDE; | 3122 virtual void DeleteFromGraph(); |
3124 virtual void InternalSetOperandAt(int index, HValue* value) V8_OVERRIDE { | 3123 virtual void InternalSetOperandAt(int index, HValue* value) { |
3125 inputs_[index] = value; | 3124 inputs_[index] = value; |
3126 } | 3125 } |
3127 | 3126 |
3128 private: | 3127 private: |
3129 ZoneList<HValue*> inputs_; | 3128 ZoneList<HValue*> inputs_; |
3130 int merged_index_; | 3129 int merged_index_; |
3131 | 3130 |
3132 int non_phi_uses_[Representation::kNumRepresentations]; | 3131 int non_phi_uses_[Representation::kNumRepresentations]; |
3133 int indirect_uses_[Representation::kNumRepresentations]; | 3132 int indirect_uses_[Representation::kNumRepresentations]; |
3134 int phi_id_; | 3133 int phi_id_; |
3135 InductionVariableData* induction_variable_data_; | 3134 InductionVariableData* induction_variable_data_; |
3136 | 3135 |
3137 // TODO(titzer): we can't eliminate the receiver for generating backtraces | 3136 // TODO(titzer): we can't eliminate the receiver for generating backtraces |
3138 virtual bool IsDeletable() const V8_OVERRIDE { return !IsReceiver(); } | 3137 virtual bool IsDeletable() const { return !IsReceiver(); } |
3139 }; | 3138 }; |
3140 | 3139 |
3141 | 3140 |
3142 // Common base class for HArgumentsObject and HCapturedObject. | 3141 // Common base class for HArgumentsObject and HCapturedObject. |
3143 class HDematerializedObject : public HInstruction { | 3142 class HDematerializedObject: public HTemplateInstruction<0> { |
3144 public: | 3143 public: |
3145 HDematerializedObject(int count, Zone* zone) : values_(count, zone) {} | 3144 HDematerializedObject(int count, Zone* zone) : values_(count, zone) {} |
3146 | 3145 |
3147 virtual int OperandCount() V8_FINAL V8_OVERRIDE { return values_.length(); } | 3146 virtual int OperandCount() { return values_.length(); } |
3148 virtual HValue* OperandAt(int index) const V8_FINAL V8_OVERRIDE { | 3147 virtual HValue* OperandAt(int index) const { return values_[index]; } |
3149 return values_[index]; | |
3150 } | |
3151 | 3148 |
3152 virtual bool HasEscapingOperandAt(int index) V8_FINAL V8_OVERRIDE { | 3149 virtual bool HasEscapingOperandAt(int index) { return false; } |
3153 return false; | 3150 virtual Representation RequiredInputRepresentation(int index) { |
3154 } | |
3155 virtual Representation RequiredInputRepresentation( | |
3156 int index) V8_FINAL V8_OVERRIDE { | |
3157 return Representation::None(); | 3151 return Representation::None(); |
3158 } | 3152 } |
3159 | 3153 |
3160 protected: | 3154 protected: |
3161 virtual void InternalSetOperandAt(int index, | 3155 virtual void InternalSetOperandAt(int index, HValue* value) { |
3162 HValue* value) V8_FINAL V8_OVERRIDE { | |
3163 values_[index] = value; | 3156 values_[index] = value; |
3164 } | 3157 } |
3165 | 3158 |
3166 // List of values tracked by this marker. | 3159 // List of values tracked by this marker. |
3167 ZoneList<HValue*> values_; | 3160 ZoneList<HValue*> values_; |
3168 | 3161 |
3169 private: | 3162 private: |
3170 virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return true; } | 3163 virtual bool IsDeletable() const { return true; } |
3171 }; | 3164 }; |
3172 | 3165 |
3173 | 3166 |
3174 class HArgumentsObject V8_FINAL : public HDematerializedObject { | 3167 class HArgumentsObject: public HDematerializedObject { |
3175 public: | 3168 public: |
3176 static HArgumentsObject* New(Zone* zone, HValue* context, int count) { | 3169 static HArgumentsObject* New(Zone* zone, HValue* context, int count) { |
3177 return new(zone) HArgumentsObject(count, zone); | 3170 return new(zone) HArgumentsObject(count, zone); |
3178 } | 3171 } |
3179 | 3172 |
3180 // The values contain a list of all elements in the arguments object | 3173 // The values contain a list of all elements in the arguments object |
3181 // including the receiver object, which is skipped when materializing. | 3174 // including the receiver object, which is skipped when materializing. |
3182 const ZoneList<HValue*>* arguments_values() const { return &values_; } | 3175 const ZoneList<HValue*>* arguments_values() const { return &values_; } |
3183 int arguments_count() const { return values_.length(); } | 3176 int arguments_count() const { return values_.length(); } |
3184 | 3177 |
3185 void AddArgument(HValue* argument, Zone* zone) { | 3178 void AddArgument(HValue* argument, Zone* zone) { |
3186 values_.Add(NULL, zone); // Resize list. | 3179 values_.Add(NULL, zone); // Resize list. |
3187 SetOperandAt(values_.length() - 1, argument); | 3180 SetOperandAt(values_.length() - 1, argument); |
3188 } | 3181 } |
3189 | 3182 |
3190 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) | 3183 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) |
3191 | 3184 |
3192 private: | 3185 private: |
3193 HArgumentsObject(int count, Zone* zone) | 3186 HArgumentsObject(int count, Zone* zone) |
3194 : HDematerializedObject(count, zone) { | 3187 : HDematerializedObject(count, zone) { |
3195 set_representation(Representation::Tagged()); | 3188 set_representation(Representation::Tagged()); |
3196 SetFlag(kIsArguments); | 3189 SetFlag(kIsArguments); |
3197 } | 3190 } |
3198 }; | 3191 }; |
3199 | 3192 |
3200 | 3193 |
3201 class HCapturedObject V8_FINAL : public HDematerializedObject { | 3194 class HCapturedObject: public HDematerializedObject { |
3202 public: | 3195 public: |
3203 HCapturedObject(int length, Zone* zone) | 3196 HCapturedObject(int length, Zone* zone) |
3204 : HDematerializedObject(length, zone) { | 3197 : HDematerializedObject(length, zone) { |
3205 set_representation(Representation::Tagged()); | 3198 set_representation(Representation::Tagged()); |
3206 values_.AddBlock(NULL, length, zone); // Resize list. | 3199 values_.AddBlock(NULL, length, zone); // Resize list. |
3207 } | 3200 } |
3208 | 3201 |
3209 // The values contain a list of all in-object properties inside the | 3202 // The values contain a list of all in-object properties inside the |
3210 // captured object and is index by field index. Properties in the | 3203 // captured object and is index by field index. Properties in the |
3211 // properties or elements backing store are not tracked here. | 3204 // properties or elements backing store are not tracked here. |
3212 const ZoneList<HValue*>* values() const { return &values_; } | 3205 const ZoneList<HValue*>* values() const { return &values_; } |
3213 int length() const { return values_.length(); } | 3206 int length() const { return values_.length(); } |
3214 | 3207 |
3215 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) | 3208 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) |
3216 }; | 3209 }; |
3217 | 3210 |
3218 | 3211 |
3219 class HConstant V8_FINAL : public HTemplateInstruction<0> { | 3212 class HConstant: public HTemplateInstruction<0> { |
3220 public: | 3213 public: |
3221 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); | 3214 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); |
3222 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); | 3215 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); |
3223 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); | 3216 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); |
3224 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); | 3217 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); |
3225 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); | 3218 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); |
3226 | 3219 |
3227 Handle<Object> handle() { | 3220 Handle<Object> handle() { |
3228 if (handle_.is_null()) { | 3221 if (handle_.is_null()) { |
3229 Factory* factory = Isolate::Current()->factory(); | 3222 Factory* factory = Isolate::Current()->factory(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3276 unique_id_ == UniqueValueId(heap->true_value()) || | 3269 unique_id_ == UniqueValueId(heap->true_value()) || |
3277 unique_id_ == UniqueValueId(heap->false_value()) || | 3270 unique_id_ == UniqueValueId(heap->false_value()) || |
3278 unique_id_ == UniqueValueId(heap->the_hole_value()) || | 3271 unique_id_ == UniqueValueId(heap->the_hole_value()) || |
3279 unique_id_ == UniqueValueId(heap->empty_string()); | 3272 unique_id_ == UniqueValueId(heap->empty_string()); |
3280 } | 3273 } |
3281 | 3274 |
3282 bool IsCell() const { | 3275 bool IsCell() const { |
3283 return is_cell_; | 3276 return is_cell_; |
3284 } | 3277 } |
3285 | 3278 |
3286 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 3279 virtual Representation RequiredInputRepresentation(int index) { |
3287 return Representation::None(); | 3280 return Representation::None(); |
3288 } | 3281 } |
3289 | 3282 |
3290 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE { | 3283 virtual Representation KnownOptimalRepresentation() { |
3291 if (HasSmiValue() && kSmiValueSize == 31) return Representation::Smi(); | 3284 if (HasSmiValue() && kSmiValueSize == 31) return Representation::Smi(); |
3292 if (HasInteger32Value()) return Representation::Integer32(); | 3285 if (HasInteger32Value()) return Representation::Integer32(); |
3293 if (HasNumberValue()) return Representation::Double(); | 3286 if (HasNumberValue()) return Representation::Double(); |
3294 if (HasExternalReferenceValue()) return Representation::External(); | 3287 if (HasExternalReferenceValue()) return Representation::External(); |
3295 return Representation::Tagged(); | 3288 return Representation::Tagged(); |
3296 } | 3289 } |
3297 | 3290 |
3298 virtual bool EmitAtUses() V8_OVERRIDE; | 3291 virtual bool EmitAtUses(); |
3299 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 3292 virtual void PrintDataTo(StringStream* stream); |
3300 bool IsInteger() { return handle()->IsSmi(); } | 3293 bool IsInteger() { return handle()->IsSmi(); } |
3301 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; | 3294 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; |
3302 Maybe<HConstant*> CopyToTruncatedInt32(Zone* zone); | 3295 Maybe<HConstant*> CopyToTruncatedInt32(Zone* zone); |
3303 Maybe<HConstant*> CopyToTruncatedNumber(Zone* zone); | 3296 Maybe<HConstant*> CopyToTruncatedNumber(Zone* zone); |
3304 bool HasInteger32Value() const { return has_int32_value_; } | 3297 bool HasInteger32Value() const { return has_int32_value_; } |
3305 int32_t Integer32Value() const { | 3298 int32_t Integer32Value() const { |
3306 ASSERT(HasInteger32Value()); | 3299 ASSERT(HasInteger32Value()); |
3307 return int32_value_; | 3300 return int32_value_; |
3308 } | 3301 } |
3309 bool HasSmiValue() const { return has_smi_value_; } | 3302 bool HasSmiValue() const { return has_smi_value_; } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3346 bool HasExternalReferenceValue() const { | 3339 bool HasExternalReferenceValue() const { |
3347 return has_external_reference_value_; | 3340 return has_external_reference_value_; |
3348 } | 3341 } |
3349 ExternalReference ExternalReferenceValue() const { | 3342 ExternalReference ExternalReferenceValue() const { |
3350 return external_reference_value_; | 3343 return external_reference_value_; |
3351 } | 3344 } |
3352 | 3345 |
3353 bool HasBooleanValue() const { return type_.IsBoolean(); } | 3346 bool HasBooleanValue() const { return type_.IsBoolean(); } |
3354 bool BooleanValue() const { return boolean_value_; } | 3347 bool BooleanValue() const { return boolean_value_; } |
3355 | 3348 |
3356 virtual intptr_t Hashcode() V8_OVERRIDE { | 3349 virtual intptr_t Hashcode() { |
3357 if (has_int32_value_) { | 3350 if (has_int32_value_) { |
3358 return static_cast<intptr_t>(int32_value_); | 3351 return static_cast<intptr_t>(int32_value_); |
3359 } else if (has_double_value_) { | 3352 } else if (has_double_value_) { |
3360 return static_cast<intptr_t>(BitCast<int64_t>(double_value_)); | 3353 return static_cast<intptr_t>(BitCast<int64_t>(double_value_)); |
3361 } else if (has_external_reference_value_) { | 3354 } else if (has_external_reference_value_) { |
3362 return reinterpret_cast<intptr_t>(external_reference_value_.address()); | 3355 return reinterpret_cast<intptr_t>(external_reference_value_.address()); |
3363 } else { | 3356 } else { |
3364 ASSERT(!handle_.is_null()); | 3357 ASSERT(!handle_.is_null()); |
3365 return unique_id_.Hashcode(); | 3358 return unique_id_.Hashcode(); |
3366 } | 3359 } |
3367 } | 3360 } |
3368 | 3361 |
3369 virtual void FinalizeUniqueValueId() V8_OVERRIDE { | 3362 virtual void FinalizeUniqueValueId() { |
3370 if (!has_double_value_ && !has_external_reference_value_) { | 3363 if (!has_double_value_ && !has_external_reference_value_) { |
3371 ASSERT(!handle_.is_null()); | 3364 ASSERT(!handle_.is_null()); |
3372 unique_id_ = UniqueValueId(handle_); | 3365 unique_id_ = UniqueValueId(handle_); |
3373 } | 3366 } |
3374 } | 3367 } |
3375 | 3368 |
3376 bool UniqueValueIdsMatch(UniqueValueId other) { | 3369 bool UniqueValueIdsMatch(UniqueValueId other) { |
3377 return !has_double_value_ && !has_external_reference_value_ && | 3370 return !has_double_value_ && !has_external_reference_value_ && |
3378 unique_id_ == other; | 3371 unique_id_ == other; |
3379 } | 3372 } |
3380 | 3373 |
3381 #ifdef DEBUG | 3374 #ifdef DEBUG |
3382 virtual void Verify() V8_OVERRIDE { } | 3375 virtual void Verify() { } |
3383 #endif | 3376 #endif |
3384 | 3377 |
3385 DECLARE_CONCRETE_INSTRUCTION(Constant) | 3378 DECLARE_CONCRETE_INSTRUCTION(Constant) |
3386 | 3379 |
3387 protected: | 3380 protected: |
3388 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 3381 virtual Range* InferRange(Zone* zone); |
3389 | 3382 |
3390 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 3383 virtual bool DataEquals(HValue* other) { |
3391 HConstant* other_constant = HConstant::cast(other); | 3384 HConstant* other_constant = HConstant::cast(other); |
3392 if (has_int32_value_) { | 3385 if (has_int32_value_) { |
3393 return other_constant->has_int32_value_ && | 3386 return other_constant->has_int32_value_ && |
3394 int32_value_ == other_constant->int32_value_; | 3387 int32_value_ == other_constant->int32_value_; |
3395 } else if (has_double_value_) { | 3388 } else if (has_double_value_) { |
3396 return other_constant->has_double_value_ && | 3389 return other_constant->has_double_value_ && |
3397 BitCast<int64_t>(double_value_) == | 3390 BitCast<int64_t>(double_value_) == |
3398 BitCast<int64_t>(other_constant->double_value_); | 3391 BitCast<int64_t>(other_constant->double_value_); |
3399 } else if (has_external_reference_value_) { | 3392 } else if (has_external_reference_value_) { |
3400 return other_constant->has_external_reference_value_ && | 3393 return other_constant->has_external_reference_value_ && |
(...skipping 22 matching lines...) Expand all Loading... |
3423 Representation r, | 3416 Representation r, |
3424 HType type, | 3417 HType type, |
3425 bool is_internalized_string, | 3418 bool is_internalized_string, |
3426 bool is_not_in_new_space, | 3419 bool is_not_in_new_space, |
3427 bool is_cell, | 3420 bool is_cell, |
3428 bool boolean_value); | 3421 bool boolean_value); |
3429 explicit HConstant(ExternalReference reference); | 3422 explicit HConstant(ExternalReference reference); |
3430 | 3423 |
3431 void Initialize(Representation r); | 3424 void Initialize(Representation r); |
3432 | 3425 |
3433 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 3426 virtual bool IsDeletable() const { return true; } |
3434 | 3427 |
3435 // If this is a numerical constant, handle_ either points to to the | 3428 // If this is a numerical constant, handle_ either points to to the |
3436 // HeapObject the constant originated from or is null. If the | 3429 // HeapObject the constant originated from or is null. If the |
3437 // constant is non-numeric, handle_ always points to a valid | 3430 // constant is non-numeric, handle_ always points to a valid |
3438 // constant HeapObject. | 3431 // constant HeapObject. |
3439 Handle<Object> handle_; | 3432 Handle<Object> handle_; |
3440 UniqueValueId unique_id_; | 3433 UniqueValueId unique_id_; |
3441 | 3434 |
3442 // We store the HConstant in the most specific form safely possible. | 3435 // We store the HConstant in the most specific form safely possible. |
3443 // The two flags, has_int32_value_ and has_double_value_ tell us if | 3436 // The two flags, has_int32_value_ and has_double_value_ tell us if |
3444 // int32_value_ and double_value_ hold valid, safe representations | 3437 // int32_value_ and double_value_ hold valid, safe representations |
3445 // of the constant. has_int32_value_ implies has_double_value_ but | 3438 // of the constant. has_int32_value_ implies has_double_value_ but |
3446 // not the converse. | 3439 // not the converse. |
3447 bool has_smi_value_ : 1; | 3440 bool has_smi_value_ : 1; |
3448 bool has_int32_value_ : 1; | 3441 bool has_int32_value_ : 1; |
3449 bool has_double_value_ : 1; | 3442 bool has_double_value_ : 1; |
3450 bool has_external_reference_value_ : 1; | 3443 bool has_external_reference_value_ : 1; |
3451 bool is_internalized_string_ : 1; // TODO(yangguo): make this part of HType. | 3444 bool is_internalized_string_ : 1; // TODO(yangguo): make this part of HType. |
3452 bool is_not_in_new_space_ : 1; | 3445 bool is_not_in_new_space_ : 1; |
3453 bool is_cell_ : 1; | 3446 bool is_cell_ : 1; |
3454 bool boolean_value_ : 1; | 3447 bool boolean_value_ : 1; |
3455 int32_t int32_value_; | 3448 int32_t int32_value_; |
3456 double double_value_; | 3449 double double_value_; |
3457 ExternalReference external_reference_value_; | 3450 ExternalReference external_reference_value_; |
3458 }; | 3451 }; |
3459 | 3452 |
3460 | 3453 |
3461 class HBinaryOperation : public HTemplateInstruction<3> { | 3454 class HBinaryOperation: public HTemplateInstruction<3> { |
3462 public: | 3455 public: |
3463 HBinaryOperation(HValue* context, HValue* left, HValue* right, | 3456 HBinaryOperation(HValue* context, HValue* left, HValue* right, |
3464 HType type = HType::Tagged()) | 3457 HType type = HType::Tagged()) |
3465 : HTemplateInstruction<3>(type), | 3458 : HTemplateInstruction<3>(type), |
3466 observed_output_representation_(Representation::None()) { | 3459 observed_output_representation_(Representation::None()) { |
3467 ASSERT(left != NULL && right != NULL); | 3460 ASSERT(left != NULL && right != NULL); |
3468 SetOperandAt(0, context); | 3461 SetOperandAt(0, context); |
3469 SetOperandAt(1, left); | 3462 SetOperandAt(1, left); |
3470 SetOperandAt(2, right); | 3463 SetOperandAt(2, right); |
3471 observed_input_representation_[0] = Representation::None(); | 3464 observed_input_representation_[0] = Representation::None(); |
(...skipping 29 matching lines...) Expand all Loading... |
3501 | 3494 |
3502 void set_observed_input_representation(int index, Representation rep) { | 3495 void set_observed_input_representation(int index, Representation rep) { |
3503 ASSERT(index >= 1 && index <= 2); | 3496 ASSERT(index >= 1 && index <= 2); |
3504 observed_input_representation_[index - 1] = rep; | 3497 observed_input_representation_[index - 1] = rep; |
3505 } | 3498 } |
3506 | 3499 |
3507 virtual void initialize_output_representation(Representation observed) { | 3500 virtual void initialize_output_representation(Representation observed) { |
3508 observed_output_representation_ = observed; | 3501 observed_output_representation_ = observed; |
3509 } | 3502 } |
3510 | 3503 |
3511 virtual Representation observed_input_representation(int index) V8_OVERRIDE { | 3504 virtual Representation observed_input_representation(int index) { |
3512 if (index == 0) return Representation::Tagged(); | 3505 if (index == 0) return Representation::Tagged(); |
3513 return observed_input_representation_[index - 1]; | 3506 return observed_input_representation_[index - 1]; |
3514 } | 3507 } |
3515 | 3508 |
3516 virtual void UpdateRepresentation(Representation new_rep, | 3509 virtual void UpdateRepresentation(Representation new_rep, |
3517 HInferRepresentationPhase* h_infer, | 3510 HInferRepresentationPhase* h_infer, |
3518 const char* reason) V8_OVERRIDE { | 3511 const char* reason) { |
3519 Representation rep = !FLAG_smi_binop && new_rep.IsSmi() | 3512 Representation rep = !FLAG_smi_binop && new_rep.IsSmi() |
3520 ? Representation::Integer32() : new_rep; | 3513 ? Representation::Integer32() : new_rep; |
3521 HValue::UpdateRepresentation(rep, h_infer, reason); | 3514 HValue::UpdateRepresentation(rep, h_infer, reason); |
3522 } | 3515 } |
3523 | 3516 |
3524 virtual void InferRepresentation( | 3517 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); |
3525 HInferRepresentationPhase* h_infer) V8_OVERRIDE; | 3518 virtual Representation RepresentationFromInputs(); |
3526 virtual Representation RepresentationFromInputs() V8_OVERRIDE; | |
3527 Representation RepresentationFromOutput(); | 3519 Representation RepresentationFromOutput(); |
3528 virtual void AssumeRepresentation(Representation r) V8_OVERRIDE; | 3520 virtual void AssumeRepresentation(Representation r); |
3529 | 3521 |
3530 virtual bool IsCommutative() const { return false; } | 3522 virtual bool IsCommutative() const { return false; } |
3531 | 3523 |
3532 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 3524 virtual void PrintDataTo(StringStream* stream); |
3533 | 3525 |
3534 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 3526 virtual Representation RequiredInputRepresentation(int index) { |
3535 if (index == 0) return Representation::Tagged(); | 3527 if (index == 0) return Representation::Tagged(); |
3536 return representation(); | 3528 return representation(); |
3537 } | 3529 } |
3538 | 3530 |
3539 DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation) | 3531 DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation) |
3540 | 3532 |
3541 private: | 3533 private: |
3542 bool IgnoreObservedOutputRepresentation(Representation current_rep); | 3534 bool IgnoreObservedOutputRepresentation(Representation current_rep); |
3543 | 3535 |
3544 Representation observed_input_representation_[2]; | 3536 Representation observed_input_representation_[2]; |
3545 Representation observed_output_representation_; | 3537 Representation observed_output_representation_; |
3546 }; | 3538 }; |
3547 | 3539 |
3548 | 3540 |
3549 class HWrapReceiver V8_FINAL : public HTemplateInstruction<2> { | 3541 class HWrapReceiver: public HTemplateInstruction<2> { |
3550 public: | 3542 public: |
3551 DECLARE_INSTRUCTION_FACTORY_P2(HWrapReceiver, HValue*, HValue*); | 3543 DECLARE_INSTRUCTION_FACTORY_P2(HWrapReceiver, HValue*, HValue*); |
3552 | 3544 |
3553 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 3545 virtual Representation RequiredInputRepresentation(int index) { |
3554 return Representation::Tagged(); | 3546 return Representation::Tagged(); |
3555 } | 3547 } |
3556 | 3548 |
3557 HValue* receiver() { return OperandAt(0); } | 3549 HValue* receiver() { return OperandAt(0); } |
3558 HValue* function() { return OperandAt(1); } | 3550 HValue* function() { return OperandAt(1); } |
3559 | 3551 |
3560 virtual HValue* Canonicalize() V8_OVERRIDE; | 3552 virtual HValue* Canonicalize(); |
3561 | 3553 |
3562 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 3554 virtual void PrintDataTo(StringStream* stream); |
3563 | 3555 |
3564 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver) | 3556 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver) |
3565 | 3557 |
3566 private: | 3558 private: |
3567 HWrapReceiver(HValue* receiver, HValue* function) { | 3559 HWrapReceiver(HValue* receiver, HValue* function) { |
3568 set_representation(Representation::Tagged()); | 3560 set_representation(Representation::Tagged()); |
3569 SetOperandAt(0, receiver); | 3561 SetOperandAt(0, receiver); |
3570 SetOperandAt(1, function); | 3562 SetOperandAt(1, function); |
3571 } | 3563 } |
3572 }; | 3564 }; |
3573 | 3565 |
3574 | 3566 |
3575 class HApplyArguments V8_FINAL : public HTemplateInstruction<4> { | 3567 class HApplyArguments: public HTemplateInstruction<4> { |
3576 public: | 3568 public: |
3577 HApplyArguments(HValue* function, | 3569 HApplyArguments(HValue* function, |
3578 HValue* receiver, | 3570 HValue* receiver, |
3579 HValue* length, | 3571 HValue* length, |
3580 HValue* elements) { | 3572 HValue* elements) { |
3581 set_representation(Representation::Tagged()); | 3573 set_representation(Representation::Tagged()); |
3582 SetOperandAt(0, function); | 3574 SetOperandAt(0, function); |
3583 SetOperandAt(1, receiver); | 3575 SetOperandAt(1, receiver); |
3584 SetOperandAt(2, length); | 3576 SetOperandAt(2, length); |
3585 SetOperandAt(3, elements); | 3577 SetOperandAt(3, elements); |
3586 SetAllSideEffects(); | 3578 SetAllSideEffects(); |
3587 } | 3579 } |
3588 | 3580 |
3589 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 3581 virtual Representation RequiredInputRepresentation(int index) { |
3590 // The length is untagged, all other inputs are tagged. | 3582 // The length is untagged, all other inputs are tagged. |
3591 return (index == 2) | 3583 return (index == 2) |
3592 ? Representation::Integer32() | 3584 ? Representation::Integer32() |
3593 : Representation::Tagged(); | 3585 : Representation::Tagged(); |
3594 } | 3586 } |
3595 | 3587 |
3596 HValue* function() { return OperandAt(0); } | 3588 HValue* function() { return OperandAt(0); } |
3597 HValue* receiver() { return OperandAt(1); } | 3589 HValue* receiver() { return OperandAt(1); } |
3598 HValue* length() { return OperandAt(2); } | 3590 HValue* length() { return OperandAt(2); } |
3599 HValue* elements() { return OperandAt(3); } | 3591 HValue* elements() { return OperandAt(3); } |
3600 | 3592 |
3601 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments) | 3593 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments) |
3602 }; | 3594 }; |
3603 | 3595 |
3604 | 3596 |
3605 class HArgumentsElements V8_FINAL : public HTemplateInstruction<0> { | 3597 class HArgumentsElements: public HTemplateInstruction<0> { |
3606 public: | 3598 public: |
3607 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsElements, bool); | 3599 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsElements, bool); |
3608 | 3600 |
3609 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements) | 3601 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements) |
3610 | 3602 |
3611 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 3603 virtual Representation RequiredInputRepresentation(int index) { |
3612 return Representation::None(); | 3604 return Representation::None(); |
3613 } | 3605 } |
3614 | 3606 |
3615 bool from_inlined() const { return from_inlined_; } | 3607 bool from_inlined() const { return from_inlined_; } |
3616 | 3608 |
3617 protected: | 3609 protected: |
3618 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 3610 virtual bool DataEquals(HValue* other) { return true; } |
3619 | 3611 |
3620 private: | 3612 private: |
3621 explicit HArgumentsElements(bool from_inlined) : from_inlined_(from_inlined) { | 3613 explicit HArgumentsElements(bool from_inlined) : from_inlined_(from_inlined) { |
3622 // The value produced by this instruction is a pointer into the stack | 3614 // The value produced by this instruction is a pointer into the stack |
3623 // that looks as if it was a smi because of alignment. | 3615 // that looks as if it was a smi because of alignment. |
3624 set_representation(Representation::Tagged()); | 3616 set_representation(Representation::Tagged()); |
3625 SetFlag(kUseGVN); | 3617 SetFlag(kUseGVN); |
3626 } | 3618 } |
3627 | 3619 |
3628 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 3620 virtual bool IsDeletable() const { return true; } |
3629 | 3621 |
3630 bool from_inlined_; | 3622 bool from_inlined_; |
3631 }; | 3623 }; |
3632 | 3624 |
3633 | 3625 |
3634 class HArgumentsLength V8_FINAL : public HUnaryOperation { | 3626 class HArgumentsLength: public HUnaryOperation { |
3635 public: | 3627 public: |
3636 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsLength, HValue*); | 3628 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsLength, HValue*); |
3637 | 3629 |
3638 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 3630 virtual Representation RequiredInputRepresentation(int index) { |
3639 return Representation::Tagged(); | 3631 return Representation::Tagged(); |
3640 } | 3632 } |
3641 | 3633 |
3642 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength) | 3634 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength) |
3643 | 3635 |
3644 protected: | 3636 protected: |
3645 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 3637 virtual bool DataEquals(HValue* other) { return true; } |
3646 | 3638 |
3647 private: | 3639 private: |
3648 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { | 3640 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { |
3649 set_representation(Representation::Integer32()); | 3641 set_representation(Representation::Integer32()); |
3650 SetFlag(kUseGVN); | 3642 SetFlag(kUseGVN); |
3651 } | 3643 } |
3652 | 3644 |
3653 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 3645 virtual bool IsDeletable() const { return true; } |
3654 }; | 3646 }; |
3655 | 3647 |
3656 | 3648 |
3657 class HAccessArgumentsAt V8_FINAL : public HTemplateInstruction<3> { | 3649 class HAccessArgumentsAt: public HTemplateInstruction<3> { |
3658 public: | 3650 public: |
3659 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { | 3651 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { |
3660 set_representation(Representation::Tagged()); | 3652 set_representation(Representation::Tagged()); |
3661 SetFlag(kUseGVN); | 3653 SetFlag(kUseGVN); |
3662 SetOperandAt(0, arguments); | 3654 SetOperandAt(0, arguments); |
3663 SetOperandAt(1, length); | 3655 SetOperandAt(1, length); |
3664 SetOperandAt(2, index); | 3656 SetOperandAt(2, index); |
3665 } | 3657 } |
3666 | 3658 |
3667 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 3659 virtual void PrintDataTo(StringStream* stream); |
3668 | 3660 |
3669 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 3661 virtual Representation RequiredInputRepresentation(int index) { |
3670 // The arguments elements is considered tagged. | 3662 // The arguments elements is considered tagged. |
3671 return index == 0 | 3663 return index == 0 |
3672 ? Representation::Tagged() | 3664 ? Representation::Tagged() |
3673 : Representation::Integer32(); | 3665 : Representation::Integer32(); |
3674 } | 3666 } |
3675 | 3667 |
3676 HValue* arguments() { return OperandAt(0); } | 3668 HValue* arguments() { return OperandAt(0); } |
3677 HValue* length() { return OperandAt(1); } | 3669 HValue* length() { return OperandAt(1); } |
3678 HValue* index() { return OperandAt(2); } | 3670 HValue* index() { return OperandAt(2); } |
3679 | 3671 |
3680 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) | 3672 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) |
3681 | 3673 |
3682 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 3674 virtual bool DataEquals(HValue* other) { return true; } |
3683 }; | 3675 }; |
3684 | 3676 |
3685 | 3677 |
3686 class HBoundsCheckBaseIndexInformation; | 3678 class HBoundsCheckBaseIndexInformation; |
3687 | 3679 |
3688 | 3680 |
3689 class HBoundsCheck V8_FINAL : public HTemplateInstruction<2> { | 3681 class HBoundsCheck: public HTemplateInstruction<2> { |
3690 public: | 3682 public: |
3691 DECLARE_INSTRUCTION_FACTORY_P2(HBoundsCheck, HValue*, HValue*); | 3683 DECLARE_INSTRUCTION_FACTORY_P2(HBoundsCheck, HValue*, HValue*); |
3692 | 3684 |
3693 bool skip_check() const { return skip_check_; } | 3685 bool skip_check() const { return skip_check_; } |
3694 void set_skip_check() { skip_check_ = true; } | 3686 void set_skip_check() { skip_check_ = true; } |
3695 | 3687 |
3696 HValue* base() { return base_; } | 3688 HValue* base() { return base_; } |
3697 int offset() { return offset_; } | 3689 int offset() { return offset_; } |
3698 int scale() { return scale_; } | 3690 int scale() { return scale_; } |
3699 | 3691 |
3700 void ApplyIndexChange(); | 3692 void ApplyIndexChange(); |
3701 bool DetectCompoundIndex() { | 3693 bool DetectCompoundIndex() { |
3702 ASSERT(base() == NULL); | 3694 ASSERT(base() == NULL); |
3703 | 3695 |
3704 DecompositionResult decomposition; | 3696 DecompositionResult decomposition; |
3705 if (index()->TryDecompose(&decomposition)) { | 3697 if (index()->TryDecompose(&decomposition)) { |
3706 base_ = decomposition.base(); | 3698 base_ = decomposition.base(); |
3707 offset_ = decomposition.offset(); | 3699 offset_ = decomposition.offset(); |
3708 scale_ = decomposition.scale(); | 3700 scale_ = decomposition.scale(); |
3709 return true; | 3701 return true; |
3710 } else { | 3702 } else { |
3711 base_ = index(); | 3703 base_ = index(); |
3712 offset_ = 0; | 3704 offset_ = 0; |
3713 scale_ = 0; | 3705 scale_ = 0; |
3714 return false; | 3706 return false; |
3715 } | 3707 } |
3716 } | 3708 } |
3717 | 3709 |
3718 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 3710 virtual Representation RequiredInputRepresentation(int arg_index) { |
3719 return representation(); | 3711 return representation(); |
3720 } | 3712 } |
3721 | 3713 |
3722 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 3714 virtual void PrintDataTo(StringStream* stream); |
3723 virtual void InferRepresentation( | 3715 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); |
3724 HInferRepresentationPhase* h_infer) V8_OVERRIDE; | |
3725 | 3716 |
3726 HValue* index() { return OperandAt(0); } | 3717 HValue* index() { return OperandAt(0); } |
3727 HValue* length() { return OperandAt(1); } | 3718 HValue* length() { return OperandAt(1); } |
3728 bool allow_equality() { return allow_equality_; } | 3719 bool allow_equality() { return allow_equality_; } |
3729 void set_allow_equality(bool v) { allow_equality_ = v; } | 3720 void set_allow_equality(bool v) { allow_equality_ = v; } |
3730 | 3721 |
3731 virtual int RedefinedOperandIndex() V8_OVERRIDE { return 0; } | 3722 virtual int RedefinedOperandIndex() { return 0; } |
3732 virtual bool IsPurelyInformativeDefinition() V8_OVERRIDE { | 3723 virtual bool IsPurelyInformativeDefinition() { return skip_check(); } |
3733 return skip_check(); | |
3734 } | |
3735 | 3724 |
3736 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) | 3725 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) |
3737 | 3726 |
3738 protected: | 3727 protected: |
3739 friend class HBoundsCheckBaseIndexInformation; | 3728 friend class HBoundsCheckBaseIndexInformation; |
3740 | 3729 |
3741 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 3730 virtual bool DataEquals(HValue* other) { return true; } |
3742 bool skip_check_; | 3731 bool skip_check_; |
3743 HValue* base_; | 3732 HValue* base_; |
3744 int offset_; | 3733 int offset_; |
3745 int scale_; | 3734 int scale_; |
3746 bool allow_equality_; | 3735 bool allow_equality_; |
3747 | 3736 |
3748 private: | 3737 private: |
3749 // Normally HBoundsCheck should be created using the | 3738 // Normally HBoundsCheck should be created using the |
3750 // HGraphBuilder::AddBoundsCheck() helper. | 3739 // HGraphBuilder::AddBoundsCheck() helper. |
3751 // However when building stubs, where we know that the arguments are Int32, | 3740 // However when building stubs, where we know that the arguments are Int32, |
3752 // it makes sense to invoke this constructor directly. | 3741 // it makes sense to invoke this constructor directly. |
3753 HBoundsCheck(HValue* index, HValue* length) | 3742 HBoundsCheck(HValue* index, HValue* length) |
3754 : skip_check_(false), | 3743 : skip_check_(false), |
3755 base_(NULL), offset_(0), scale_(0), | 3744 base_(NULL), offset_(0), scale_(0), |
3756 allow_equality_(false) { | 3745 allow_equality_(false) { |
3757 SetOperandAt(0, index); | 3746 SetOperandAt(0, index); |
3758 SetOperandAt(1, length); | 3747 SetOperandAt(1, length); |
3759 SetFlag(kFlexibleRepresentation); | 3748 SetFlag(kFlexibleRepresentation); |
3760 SetFlag(kUseGVN); | 3749 SetFlag(kUseGVN); |
3761 } | 3750 } |
3762 | 3751 |
3763 virtual bool IsDeletable() const V8_OVERRIDE { | 3752 virtual bool IsDeletable() const { |
3764 return skip_check() && !FLAG_debug_code; | 3753 return skip_check() && !FLAG_debug_code; |
3765 } | 3754 } |
3766 }; | 3755 }; |
3767 | 3756 |
3768 | 3757 |
3769 class HBoundsCheckBaseIndexInformation V8_FINAL | 3758 class HBoundsCheckBaseIndexInformation: public HTemplateInstruction<2> { |
3770 : public HTemplateInstruction<2> { | |
3771 public: | 3759 public: |
3772 explicit HBoundsCheckBaseIndexInformation(HBoundsCheck* check) { | 3760 explicit HBoundsCheckBaseIndexInformation(HBoundsCheck* check) { |
3773 DecompositionResult decomposition; | 3761 DecompositionResult decomposition; |
3774 if (check->index()->TryDecompose(&decomposition)) { | 3762 if (check->index()->TryDecompose(&decomposition)) { |
3775 SetOperandAt(0, decomposition.base()); | 3763 SetOperandAt(0, decomposition.base()); |
3776 SetOperandAt(1, check); | 3764 SetOperandAt(1, check); |
3777 } else { | 3765 } else { |
3778 UNREACHABLE(); | 3766 UNREACHABLE(); |
3779 } | 3767 } |
3780 } | 3768 } |
3781 | 3769 |
3782 HValue* base_index() { return OperandAt(0); } | 3770 HValue* base_index() { return OperandAt(0); } |
3783 HBoundsCheck* bounds_check() { return HBoundsCheck::cast(OperandAt(1)); } | 3771 HBoundsCheck* bounds_check() { return HBoundsCheck::cast(OperandAt(1)); } |
3784 | 3772 |
3785 DECLARE_CONCRETE_INSTRUCTION(BoundsCheckBaseIndexInformation) | 3773 DECLARE_CONCRETE_INSTRUCTION(BoundsCheckBaseIndexInformation) |
3786 | 3774 |
3787 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 3775 virtual Representation RequiredInputRepresentation(int arg_index) { |
3788 return representation(); | 3776 return representation(); |
3789 } | 3777 } |
3790 | 3778 |
3791 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 3779 virtual void PrintDataTo(StringStream* stream); |
3792 | 3780 |
3793 virtual int RedefinedOperandIndex() V8_OVERRIDE { return 0; } | 3781 virtual int RedefinedOperandIndex() { return 0; } |
3794 virtual bool IsPurelyInformativeDefinition() V8_OVERRIDE { return true; } | 3782 virtual bool IsPurelyInformativeDefinition() { return true; } |
3795 }; | 3783 }; |
3796 | 3784 |
3797 | 3785 |
3798 class HBitwiseBinaryOperation : public HBinaryOperation { | 3786 class HBitwiseBinaryOperation: public HBinaryOperation { |
3799 public: | 3787 public: |
3800 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, | 3788 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, |
3801 HType type = HType::Tagged()) | 3789 HType type = HType::Tagged()) |
3802 : HBinaryOperation(context, left, right, type) { | 3790 : HBinaryOperation(context, left, right, type) { |
3803 SetFlag(kFlexibleRepresentation); | 3791 SetFlag(kFlexibleRepresentation); |
3804 SetFlag(kTruncatingToInt32); | 3792 SetFlag(kTruncatingToInt32); |
3805 SetFlag(kAllowUndefinedAsNaN); | 3793 SetFlag(kAllowUndefinedAsNaN); |
3806 SetAllSideEffects(); | 3794 SetAllSideEffects(); |
3807 } | 3795 } |
3808 | 3796 |
3809 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { | 3797 virtual void RepresentationChanged(Representation to) { |
3810 if (!to.IsTagged()) { | 3798 if (!to.IsTagged()) { |
3811 ASSERT(to.IsSmiOrInteger32()); | 3799 ASSERT(to.IsSmiOrInteger32()); |
3812 ClearAllSideEffects(); | 3800 ClearAllSideEffects(); |
3813 SetFlag(kUseGVN); | 3801 SetFlag(kUseGVN); |
3814 } else { | 3802 } else { |
3815 SetAllSideEffects(); | 3803 SetAllSideEffects(); |
3816 ClearFlag(kUseGVN); | 3804 ClearFlag(kUseGVN); |
3817 } | 3805 } |
3818 } | 3806 } |
3819 | 3807 |
3820 virtual void UpdateRepresentation(Representation new_rep, | 3808 virtual void UpdateRepresentation(Representation new_rep, |
3821 HInferRepresentationPhase* h_infer, | 3809 HInferRepresentationPhase* h_infer, |
3822 const char* reason) V8_OVERRIDE { | 3810 const char* reason) { |
3823 // We only generate either int32 or generic tagged bitwise operations. | 3811 // We only generate either int32 or generic tagged bitwise operations. |
3824 if (new_rep.IsDouble()) new_rep = Representation::Integer32(); | 3812 if (new_rep.IsDouble()) new_rep = Representation::Integer32(); |
3825 HBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 3813 HBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
3826 } | 3814 } |
3827 | 3815 |
3828 virtual Representation observed_input_representation(int index) V8_OVERRIDE { | 3816 virtual Representation observed_input_representation(int index) { |
3829 Representation r = HBinaryOperation::observed_input_representation(index); | 3817 Representation r = HBinaryOperation::observed_input_representation(index); |
3830 if (r.IsDouble()) return Representation::Integer32(); | 3818 if (r.IsDouble()) return Representation::Integer32(); |
3831 return r; | 3819 return r; |
3832 } | 3820 } |
3833 | 3821 |
3834 virtual void initialize_output_representation(Representation observed) { | 3822 virtual void initialize_output_representation(Representation observed) { |
3835 if (observed.IsDouble()) observed = Representation::Integer32(); | 3823 if (observed.IsDouble()) observed = Representation::Integer32(); |
3836 HBinaryOperation::initialize_output_representation(observed); | 3824 HBinaryOperation::initialize_output_representation(observed); |
3837 } | 3825 } |
3838 | 3826 |
3839 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) | 3827 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) |
3840 | 3828 |
3841 private: | 3829 private: |
3842 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 3830 virtual bool IsDeletable() const { return true; } |
3843 }; | 3831 }; |
3844 | 3832 |
3845 | 3833 |
3846 class HMathFloorOfDiv V8_FINAL : public HBinaryOperation { | 3834 class HMathFloorOfDiv: public HBinaryOperation { |
3847 public: | 3835 public: |
3848 static HMathFloorOfDiv* New(Zone* zone, | 3836 static HMathFloorOfDiv* New(Zone* zone, |
3849 HValue* context, | 3837 HValue* context, |
3850 HValue* left, | 3838 HValue* left, |
3851 HValue* right) { | 3839 HValue* right) { |
3852 return new(zone) HMathFloorOfDiv(context, left, right); | 3840 return new(zone) HMathFloorOfDiv(context, left, right); |
3853 } | 3841 } |
3854 | 3842 |
3855 virtual HValue* EnsureAndPropagateNotMinusZero( | 3843 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
3856 BitVector* visited) V8_OVERRIDE; | |
3857 | 3844 |
3858 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) | 3845 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) |
3859 | 3846 |
3860 protected: | 3847 protected: |
3861 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 3848 virtual bool DataEquals(HValue* other) { return true; } |
3862 | 3849 |
3863 private: | 3850 private: |
3864 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) | 3851 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) |
3865 : HBinaryOperation(context, left, right) { | 3852 : HBinaryOperation(context, left, right) { |
3866 set_representation(Representation::Integer32()); | 3853 set_representation(Representation::Integer32()); |
3867 SetFlag(kUseGVN); | 3854 SetFlag(kUseGVN); |
3868 SetFlag(kCanOverflow); | 3855 SetFlag(kCanOverflow); |
3869 if (!right->IsConstant()) { | 3856 if (!right->IsConstant()) { |
3870 SetFlag(kCanBeDivByZero); | 3857 SetFlag(kCanBeDivByZero); |
3871 } | 3858 } |
3872 SetFlag(kAllowUndefinedAsNaN); | 3859 SetFlag(kAllowUndefinedAsNaN); |
3873 } | 3860 } |
3874 | 3861 |
3875 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 3862 virtual bool IsDeletable() const { return true; } |
3876 }; | 3863 }; |
3877 | 3864 |
3878 | 3865 |
3879 class HArithmeticBinaryOperation : public HBinaryOperation { | 3866 class HArithmeticBinaryOperation: public HBinaryOperation { |
3880 public: | 3867 public: |
3881 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) | 3868 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) |
3882 : HBinaryOperation(context, left, right, HType::TaggedNumber()) { | 3869 : HBinaryOperation(context, left, right, HType::TaggedNumber()) { |
3883 SetAllSideEffects(); | 3870 SetAllSideEffects(); |
3884 SetFlag(kFlexibleRepresentation); | 3871 SetFlag(kFlexibleRepresentation); |
3885 SetFlag(kAllowUndefinedAsNaN); | 3872 SetFlag(kAllowUndefinedAsNaN); |
3886 } | 3873 } |
3887 | 3874 |
3888 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { | 3875 virtual void RepresentationChanged(Representation to) { |
3889 if (to.IsTagged()) { | 3876 if (to.IsTagged()) { |
3890 SetAllSideEffects(); | 3877 SetAllSideEffects(); |
3891 ClearFlag(kUseGVN); | 3878 ClearFlag(kUseGVN); |
3892 } else { | 3879 } else { |
3893 ClearAllSideEffects(); | 3880 ClearAllSideEffects(); |
3894 SetFlag(kUseGVN); | 3881 SetFlag(kUseGVN); |
3895 } | 3882 } |
3896 } | 3883 } |
3897 | 3884 |
3898 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) | 3885 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) |
3899 | 3886 |
3900 private: | 3887 private: |
3901 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 3888 virtual bool IsDeletable() const { return true; } |
3902 }; | 3889 }; |
3903 | 3890 |
3904 | 3891 |
3905 class HCompareGeneric V8_FINAL : public HBinaryOperation { | 3892 class HCompareGeneric: public HBinaryOperation { |
3906 public: | 3893 public: |
3907 HCompareGeneric(HValue* context, | 3894 HCompareGeneric(HValue* context, |
3908 HValue* left, | 3895 HValue* left, |
3909 HValue* right, | 3896 HValue* right, |
3910 Token::Value token) | 3897 Token::Value token) |
3911 : HBinaryOperation(context, left, right, HType::Boolean()), | 3898 : HBinaryOperation(context, left, right, HType::Boolean()), |
3912 token_(token) { | 3899 token_(token) { |
3913 ASSERT(Token::IsCompareOp(token)); | 3900 ASSERT(Token::IsCompareOp(token)); |
3914 set_representation(Representation::Tagged()); | 3901 set_representation(Representation::Tagged()); |
3915 SetAllSideEffects(); | 3902 SetAllSideEffects(); |
3916 } | 3903 } |
3917 | 3904 |
3918 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 3905 virtual Representation RequiredInputRepresentation(int index) { |
3919 return index == 0 | 3906 return index == 0 |
3920 ? Representation::Tagged() | 3907 ? Representation::Tagged() |
3921 : representation(); | 3908 : representation(); |
3922 } | 3909 } |
3923 | 3910 |
3924 Token::Value token() const { return token_; } | 3911 Token::Value token() const { return token_; } |
3925 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 3912 virtual void PrintDataTo(StringStream* stream); |
3926 | 3913 |
3927 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) | 3914 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) |
3928 | 3915 |
3929 private: | 3916 private: |
3930 Token::Value token_; | 3917 Token::Value token_; |
3931 }; | 3918 }; |
3932 | 3919 |
3933 | 3920 |
3934 class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> { | 3921 class HCompareNumericAndBranch: public HTemplateControlInstruction<2, 2> { |
3935 public: | 3922 public: |
3936 HCompareNumericAndBranch(HValue* left, HValue* right, Token::Value token) | 3923 HCompareNumericAndBranch(HValue* left, HValue* right, Token::Value token) |
3937 : token_(token) { | 3924 : token_(token) { |
3938 SetFlag(kFlexibleRepresentation); | 3925 SetFlag(kFlexibleRepresentation); |
3939 ASSERT(Token::IsCompareOp(token)); | 3926 ASSERT(Token::IsCompareOp(token)); |
3940 SetOperandAt(0, left); | 3927 SetOperandAt(0, left); |
3941 SetOperandAt(1, right); | 3928 SetOperandAt(1, right); |
3942 } | 3929 } |
3943 | 3930 |
3944 HValue* left() { return OperandAt(0); } | 3931 HValue* left() { return OperandAt(0); } |
3945 HValue* right() { return OperandAt(1); } | 3932 HValue* right() { return OperandAt(1); } |
3946 Token::Value token() const { return token_; } | 3933 Token::Value token() const { return token_; } |
3947 | 3934 |
3948 void set_observed_input_representation(Representation left, | 3935 void set_observed_input_representation(Representation left, |
3949 Representation right) { | 3936 Representation right) { |
3950 observed_input_representation_[0] = left; | 3937 observed_input_representation_[0] = left; |
3951 observed_input_representation_[1] = right; | 3938 observed_input_representation_[1] = right; |
3952 } | 3939 } |
3953 | 3940 |
3954 virtual void InferRepresentation( | 3941 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); |
3955 HInferRepresentationPhase* h_infer) V8_OVERRIDE; | |
3956 | 3942 |
3957 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 3943 virtual Representation RequiredInputRepresentation(int index) { |
3958 return representation(); | 3944 return representation(); |
3959 } | 3945 } |
3960 virtual Representation observed_input_representation(int index) V8_OVERRIDE { | 3946 virtual Representation observed_input_representation(int index) { |
3961 return observed_input_representation_[index]; | 3947 return observed_input_representation_[index]; |
3962 } | 3948 } |
3963 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 3949 virtual void PrintDataTo(StringStream* stream); |
3964 | 3950 |
3965 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch) | 3951 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch) |
3966 | 3952 |
3967 private: | 3953 private: |
3968 Representation observed_input_representation_[2]; | 3954 Representation observed_input_representation_[2]; |
3969 Token::Value token_; | 3955 Token::Value token_; |
3970 }; | 3956 }; |
3971 | 3957 |
3972 | 3958 |
3973 class HCompareHoleAndBranch V8_FINAL | 3959 class HCompareHoleAndBranch: public HTemplateControlInstruction<2, 1> { |
3974 : public HTemplateControlInstruction<2, 1> { | |
3975 public: | 3960 public: |
3976 // TODO(danno): make this private when the IfBuilder properly constructs | 3961 // TODO(danno): make this private when the IfBuilder properly constructs |
3977 // control flow instructions. | 3962 // control flow instructions. |
3978 explicit HCompareHoleAndBranch(HValue* object) { | 3963 explicit HCompareHoleAndBranch(HValue* object) { |
3979 SetFlag(kFlexibleRepresentation); | 3964 SetFlag(kFlexibleRepresentation); |
3980 SetFlag(kAllowUndefinedAsNaN); | 3965 SetFlag(kAllowUndefinedAsNaN); |
3981 SetOperandAt(0, object); | 3966 SetOperandAt(0, object); |
3982 } | 3967 } |
3983 | 3968 |
3984 DECLARE_INSTRUCTION_FACTORY_P1(HCompareHoleAndBranch, HValue*); | 3969 DECLARE_INSTRUCTION_FACTORY_P1(HCompareHoleAndBranch, HValue*); |
3985 | 3970 |
3986 HValue* object() { return OperandAt(0); } | 3971 HValue* object() { return OperandAt(0); } |
3987 | 3972 |
3988 virtual void InferRepresentation( | 3973 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); |
3989 HInferRepresentationPhase* h_infer) V8_OVERRIDE; | |
3990 | 3974 |
3991 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 3975 virtual Representation RequiredInputRepresentation(int index) { |
3992 return representation(); | 3976 return representation(); |
3993 } | 3977 } |
3994 | 3978 |
3995 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 3979 virtual void PrintDataTo(StringStream* stream); |
3996 | 3980 |
3997 DECLARE_CONCRETE_INSTRUCTION(CompareHoleAndBranch) | 3981 DECLARE_CONCRETE_INSTRUCTION(CompareHoleAndBranch) |
3998 }; | 3982 }; |
3999 | 3983 |
4000 | 3984 |
4001 class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> { | 3985 class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> { |
4002 public: | 3986 public: |
4003 // TODO(danno): make this private when the IfBuilder properly constructs | 3987 // TODO(danno): make this private when the IfBuilder properly constructs |
4004 // control flow instructions. | 3988 // control flow instructions. |
4005 HCompareObjectEqAndBranch(HValue* left, | 3989 HCompareObjectEqAndBranch(HValue* left, |
4006 HValue* right) { | 3990 HValue* right) { |
4007 SetOperandAt(0, left); | 3991 SetOperandAt(0, left); |
4008 SetOperandAt(1, right); | 3992 SetOperandAt(1, right); |
4009 } | 3993 } |
4010 | 3994 |
4011 DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*); | 3995 DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*); |
4012 | 3996 |
4013 HValue* left() { return OperandAt(0); } | 3997 HValue* left() { return OperandAt(0); } |
4014 HValue* right() { return OperandAt(1); } | 3998 HValue* right() { return OperandAt(1); } |
4015 | 3999 |
4016 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 4000 virtual void PrintDataTo(StringStream* stream); |
4017 | 4001 |
4018 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4002 virtual Representation RequiredInputRepresentation(int index) { |
4019 return Representation::Tagged(); | 4003 return Representation::Tagged(); |
4020 } | 4004 } |
4021 | 4005 |
4022 virtual Representation observed_input_representation(int index) V8_OVERRIDE { | 4006 virtual Representation observed_input_representation(int index) { |
4023 return Representation::Tagged(); | 4007 return Representation::Tagged(); |
4024 } | 4008 } |
4025 | 4009 |
4026 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) | 4010 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) |
4027 }; | 4011 }; |
4028 | 4012 |
4029 | 4013 |
4030 class HIsObjectAndBranch V8_FINAL : public HUnaryControlInstruction { | 4014 class HIsObjectAndBranch: public HUnaryControlInstruction { |
4031 public: | 4015 public: |
4032 explicit HIsObjectAndBranch(HValue* value) | 4016 explicit HIsObjectAndBranch(HValue* value) |
4033 : HUnaryControlInstruction(value, NULL, NULL) { } | 4017 : HUnaryControlInstruction(value, NULL, NULL) { } |
4034 | 4018 |
4035 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4019 virtual Representation RequiredInputRepresentation(int index) { |
4036 return Representation::Tagged(); | 4020 return Representation::Tagged(); |
4037 } | 4021 } |
4038 | 4022 |
4039 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch) | 4023 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch) |
4040 }; | 4024 }; |
4041 | 4025 |
4042 class HIsStringAndBranch V8_FINAL : public HUnaryControlInstruction { | 4026 class HIsStringAndBranch: public HUnaryControlInstruction { |
4043 public: | 4027 public: |
4044 explicit HIsStringAndBranch(HValue* value) | 4028 explicit HIsStringAndBranch(HValue* value) |
4045 : HUnaryControlInstruction(value, NULL, NULL) { } | 4029 : HUnaryControlInstruction(value, NULL, NULL) { } |
4046 | 4030 |
4047 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4031 virtual Representation RequiredInputRepresentation(int index) { |
4048 return Representation::Tagged(); | 4032 return Representation::Tagged(); |
4049 } | 4033 } |
4050 | 4034 |
4051 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch) | 4035 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch) |
4052 }; | 4036 }; |
4053 | 4037 |
4054 | 4038 |
4055 class HIsSmiAndBranch V8_FINAL : public HUnaryControlInstruction { | 4039 class HIsSmiAndBranch: public HUnaryControlInstruction { |
4056 public: | 4040 public: |
4057 explicit HIsSmiAndBranch(HValue* value) | 4041 explicit HIsSmiAndBranch(HValue* value) |
4058 : HUnaryControlInstruction(value, NULL, NULL) { } | 4042 : HUnaryControlInstruction(value, NULL, NULL) { } |
4059 | 4043 |
4060 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch) | 4044 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch) |
4061 | 4045 |
4062 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4046 virtual Representation RequiredInputRepresentation(int index) { |
4063 return Representation::Tagged(); | 4047 return Representation::Tagged(); |
4064 } | 4048 } |
4065 | 4049 |
4066 protected: | 4050 protected: |
4067 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4051 virtual bool DataEquals(HValue* other) { return true; } |
4068 }; | 4052 }; |
4069 | 4053 |
4070 | 4054 |
4071 class HIsUndetectableAndBranch V8_FINAL : public HUnaryControlInstruction { | 4055 class HIsUndetectableAndBranch: public HUnaryControlInstruction { |
4072 public: | 4056 public: |
4073 explicit HIsUndetectableAndBranch(HValue* value) | 4057 explicit HIsUndetectableAndBranch(HValue* value) |
4074 : HUnaryControlInstruction(value, NULL, NULL) { } | 4058 : HUnaryControlInstruction(value, NULL, NULL) { } |
4075 | 4059 |
4076 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4060 virtual Representation RequiredInputRepresentation(int index) { |
4077 return Representation::Tagged(); | 4061 return Representation::Tagged(); |
4078 } | 4062 } |
4079 | 4063 |
4080 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch) | 4064 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch) |
4081 }; | 4065 }; |
4082 | 4066 |
4083 | 4067 |
4084 class HStringCompareAndBranch : public HTemplateControlInstruction<2, 3> { | 4068 class HStringCompareAndBranch: public HTemplateControlInstruction<2, 3> { |
4085 public: | 4069 public: |
4086 HStringCompareAndBranch(HValue* context, | 4070 HStringCompareAndBranch(HValue* context, |
4087 HValue* left, | 4071 HValue* left, |
4088 HValue* right, | 4072 HValue* right, |
4089 Token::Value token) | 4073 Token::Value token) |
4090 : token_(token) { | 4074 : token_(token) { |
4091 ASSERT(Token::IsCompareOp(token)); | 4075 ASSERT(Token::IsCompareOp(token)); |
4092 SetOperandAt(0, context); | 4076 SetOperandAt(0, context); |
4093 SetOperandAt(1, left); | 4077 SetOperandAt(1, left); |
4094 SetOperandAt(2, right); | 4078 SetOperandAt(2, right); |
4095 set_representation(Representation::Tagged()); | 4079 set_representation(Representation::Tagged()); |
4096 SetGVNFlag(kChangesNewSpacePromotion); | 4080 SetGVNFlag(kChangesNewSpacePromotion); |
4097 } | 4081 } |
4098 | 4082 |
4099 HValue* context() { return OperandAt(0); } | 4083 HValue* context() { return OperandAt(0); } |
4100 HValue* left() { return OperandAt(1); } | 4084 HValue* left() { return OperandAt(1); } |
4101 HValue* right() { return OperandAt(2); } | 4085 HValue* right() { return OperandAt(2); } |
4102 Token::Value token() const { return token_; } | 4086 Token::Value token() const { return token_; } |
4103 | 4087 |
4104 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 4088 virtual void PrintDataTo(StringStream* stream); |
4105 | 4089 |
4106 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4090 virtual Representation RequiredInputRepresentation(int index) { |
4107 return Representation::Tagged(); | 4091 return Representation::Tagged(); |
4108 } | 4092 } |
4109 | 4093 |
4110 Representation GetInputRepresentation() const { | 4094 Representation GetInputRepresentation() const { |
4111 return Representation::Tagged(); | 4095 return Representation::Tagged(); |
4112 } | 4096 } |
4113 | 4097 |
4114 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch) | 4098 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch) |
4115 | 4099 |
4116 private: | 4100 private: |
4117 Token::Value token_; | 4101 Token::Value token_; |
4118 }; | 4102 }; |
4119 | 4103 |
4120 | 4104 |
4121 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> { | 4105 class HIsConstructCallAndBranch: public HTemplateControlInstruction<2, 0> { |
4122 public: | 4106 public: |
4123 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4107 virtual Representation RequiredInputRepresentation(int index) { |
4124 return Representation::None(); | 4108 return Representation::None(); |
4125 } | 4109 } |
4126 | 4110 |
4127 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch) | 4111 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch) |
4128 }; | 4112 }; |
4129 | 4113 |
4130 | 4114 |
4131 class HHasInstanceTypeAndBranch V8_FINAL : public HUnaryControlInstruction { | 4115 class HHasInstanceTypeAndBranch: public HUnaryControlInstruction { |
4132 public: | 4116 public: |
4133 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) | 4117 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) |
4134 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } | 4118 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } |
4135 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) | 4119 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) |
4136 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { | 4120 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { |
4137 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. | 4121 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. |
4138 } | 4122 } |
4139 | 4123 |
4140 InstanceType from() { return from_; } | 4124 InstanceType from() { return from_; } |
4141 InstanceType to() { return to_; } | 4125 InstanceType to() { return to_; } |
4142 | 4126 |
4143 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 4127 virtual void PrintDataTo(StringStream* stream); |
4144 | 4128 |
4145 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4129 virtual Representation RequiredInputRepresentation(int index) { |
4146 return Representation::Tagged(); | 4130 return Representation::Tagged(); |
4147 } | 4131 } |
4148 | 4132 |
4149 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) | 4133 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) |
4150 | 4134 |
4151 private: | 4135 private: |
4152 InstanceType from_; | 4136 InstanceType from_; |
4153 InstanceType to_; // Inclusive range, not all combinations work. | 4137 InstanceType to_; // Inclusive range, not all combinations work. |
4154 }; | 4138 }; |
4155 | 4139 |
4156 | 4140 |
4157 class HHasCachedArrayIndexAndBranch V8_FINAL : public HUnaryControlInstruction { | 4141 class HHasCachedArrayIndexAndBranch: public HUnaryControlInstruction { |
4158 public: | 4142 public: |
4159 explicit HHasCachedArrayIndexAndBranch(HValue* value) | 4143 explicit HHasCachedArrayIndexAndBranch(HValue* value) |
4160 : HUnaryControlInstruction(value, NULL, NULL) { } | 4144 : HUnaryControlInstruction(value, NULL, NULL) { } |
4161 | 4145 |
4162 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4146 virtual Representation RequiredInputRepresentation(int index) { |
4163 return Representation::Tagged(); | 4147 return Representation::Tagged(); |
4164 } | 4148 } |
4165 | 4149 |
4166 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch) | 4150 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch) |
4167 }; | 4151 }; |
4168 | 4152 |
4169 | 4153 |
4170 class HGetCachedArrayIndex V8_FINAL : public HUnaryOperation { | 4154 class HGetCachedArrayIndex: public HUnaryOperation { |
4171 public: | 4155 public: |
4172 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) { | 4156 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) { |
4173 set_representation(Representation::Tagged()); | 4157 set_representation(Representation::Tagged()); |
4174 SetFlag(kUseGVN); | 4158 SetFlag(kUseGVN); |
4175 } | 4159 } |
4176 | 4160 |
4177 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4161 virtual Representation RequiredInputRepresentation(int index) { |
4178 return Representation::Tagged(); | 4162 return Representation::Tagged(); |
4179 } | 4163 } |
4180 | 4164 |
4181 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) | 4165 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) |
4182 | 4166 |
4183 protected: | 4167 protected: |
4184 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4168 virtual bool DataEquals(HValue* other) { return true; } |
4185 | 4169 |
4186 private: | 4170 private: |
4187 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 4171 virtual bool IsDeletable() const { return true; } |
4188 }; | 4172 }; |
4189 | 4173 |
4190 | 4174 |
4191 class HClassOfTestAndBranch V8_FINAL : public HUnaryControlInstruction { | 4175 class HClassOfTestAndBranch: public HUnaryControlInstruction { |
4192 public: | 4176 public: |
4193 HClassOfTestAndBranch(HValue* value, Handle<String> class_name) | 4177 HClassOfTestAndBranch(HValue* value, Handle<String> class_name) |
4194 : HUnaryControlInstruction(value, NULL, NULL), | 4178 : HUnaryControlInstruction(value, NULL, NULL), |
4195 class_name_(class_name) { } | 4179 class_name_(class_name) { } |
4196 | 4180 |
4197 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch) | 4181 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch) |
4198 | 4182 |
4199 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4183 virtual Representation RequiredInputRepresentation(int index) { |
4200 return Representation::Tagged(); | 4184 return Representation::Tagged(); |
4201 } | 4185 } |
4202 | 4186 |
4203 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 4187 virtual void PrintDataTo(StringStream* stream); |
4204 | 4188 |
4205 Handle<String> class_name() const { return class_name_; } | 4189 Handle<String> class_name() const { return class_name_; } |
4206 | 4190 |
4207 private: | 4191 private: |
4208 Handle<String> class_name_; | 4192 Handle<String> class_name_; |
4209 }; | 4193 }; |
4210 | 4194 |
4211 | 4195 |
4212 class HTypeofIsAndBranch V8_FINAL : public HUnaryControlInstruction { | 4196 class HTypeofIsAndBranch: public HUnaryControlInstruction { |
4213 public: | 4197 public: |
4214 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal) | 4198 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal) |
4215 : HUnaryControlInstruction(value, NULL, NULL), | 4199 : HUnaryControlInstruction(value, NULL, NULL), |
4216 type_literal_(type_literal) { } | 4200 type_literal_(type_literal) { } |
4217 | 4201 |
4218 Handle<String> type_literal() { return type_literal_; } | 4202 Handle<String> type_literal() { return type_literal_; } |
4219 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 4203 virtual void PrintDataTo(StringStream* stream); |
4220 | 4204 |
4221 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) | 4205 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) |
4222 | 4206 |
4223 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4207 virtual Representation RequiredInputRepresentation(int index) { |
4224 return Representation::Tagged(); | 4208 return Representation::Tagged(); |
4225 } | 4209 } |
4226 | 4210 |
4227 private: | 4211 private: |
4228 Handle<String> type_literal_; | 4212 Handle<String> type_literal_; |
4229 }; | 4213 }; |
4230 | 4214 |
4231 | 4215 |
4232 class HInstanceOf V8_FINAL : public HBinaryOperation { | 4216 class HInstanceOf: public HBinaryOperation { |
4233 public: | 4217 public: |
4234 HInstanceOf(HValue* context, HValue* left, HValue* right) | 4218 HInstanceOf(HValue* context, HValue* left, HValue* right) |
4235 : HBinaryOperation(context, left, right, HType::Boolean()) { | 4219 : HBinaryOperation(context, left, right, HType::Boolean()) { |
4236 set_representation(Representation::Tagged()); | 4220 set_representation(Representation::Tagged()); |
4237 SetAllSideEffects(); | 4221 SetAllSideEffects(); |
4238 } | 4222 } |
4239 | 4223 |
4240 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4224 virtual Representation RequiredInputRepresentation(int index) { |
4241 return Representation::Tagged(); | 4225 return Representation::Tagged(); |
4242 } | 4226 } |
4243 | 4227 |
4244 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 4228 virtual void PrintDataTo(StringStream* stream); |
4245 | 4229 |
4246 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) | 4230 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) |
4247 }; | 4231 }; |
4248 | 4232 |
4249 | 4233 |
4250 class HInstanceOfKnownGlobal V8_FINAL : public HTemplateInstruction<2> { | 4234 class HInstanceOfKnownGlobal: public HTemplateInstruction<2> { |
4251 public: | 4235 public: |
4252 HInstanceOfKnownGlobal(HValue* context, | 4236 HInstanceOfKnownGlobal(HValue* context, |
4253 HValue* left, | 4237 HValue* left, |
4254 Handle<JSFunction> right) | 4238 Handle<JSFunction> right) |
4255 : HTemplateInstruction<2>(HType::Boolean()), function_(right) { | 4239 : HTemplateInstruction<2>(HType::Boolean()), function_(right) { |
4256 SetOperandAt(0, context); | 4240 SetOperandAt(0, context); |
4257 SetOperandAt(1, left); | 4241 SetOperandAt(1, left); |
4258 set_representation(Representation::Tagged()); | 4242 set_representation(Representation::Tagged()); |
4259 SetAllSideEffects(); | 4243 SetAllSideEffects(); |
4260 } | 4244 } |
4261 | 4245 |
4262 HValue* context() { return OperandAt(0); } | 4246 HValue* context() { return OperandAt(0); } |
4263 HValue* left() { return OperandAt(1); } | 4247 HValue* left() { return OperandAt(1); } |
4264 Handle<JSFunction> function() { return function_; } | 4248 Handle<JSFunction> function() { return function_; } |
4265 | 4249 |
4266 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4250 virtual Representation RequiredInputRepresentation(int index) { |
4267 return Representation::Tagged(); | 4251 return Representation::Tagged(); |
4268 } | 4252 } |
4269 | 4253 |
4270 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) | 4254 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) |
4271 | 4255 |
4272 private: | 4256 private: |
4273 Handle<JSFunction> function_; | 4257 Handle<JSFunction> function_; |
4274 }; | 4258 }; |
4275 | 4259 |
4276 | 4260 |
4277 // TODO(mstarzinger): This instruction should be modeled as a load of the map | 4261 // TODO(mstarzinger): This instruction should be modeled as a load of the map |
4278 // field followed by a load of the instance size field once HLoadNamedField is | 4262 // field followed by a load of the instance size field once HLoadNamedField is |
4279 // flexible enough to accommodate byte-field loads. | 4263 // flexible enough to accommodate byte-field loads. |
4280 class HInstanceSize V8_FINAL : public HTemplateInstruction<1> { | 4264 class HInstanceSize: public HTemplateInstruction<1> { |
4281 public: | 4265 public: |
4282 explicit HInstanceSize(HValue* object) { | 4266 explicit HInstanceSize(HValue* object) { |
4283 SetOperandAt(0, object); | 4267 SetOperandAt(0, object); |
4284 set_representation(Representation::Integer32()); | 4268 set_representation(Representation::Integer32()); |
4285 } | 4269 } |
4286 | 4270 |
4287 HValue* object() { return OperandAt(0); } | 4271 HValue* object() { return OperandAt(0); } |
4288 | 4272 |
4289 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4273 virtual Representation RequiredInputRepresentation(int index) { |
4290 return Representation::Tagged(); | 4274 return Representation::Tagged(); |
4291 } | 4275 } |
4292 | 4276 |
4293 DECLARE_CONCRETE_INSTRUCTION(InstanceSize) | 4277 DECLARE_CONCRETE_INSTRUCTION(InstanceSize) |
4294 }; | 4278 }; |
4295 | 4279 |
4296 | 4280 |
4297 class HPower V8_FINAL : public HTemplateInstruction<2> { | 4281 class HPower: public HTemplateInstruction<2> { |
4298 public: | 4282 public: |
4299 static HInstruction* New(Zone* zone, | 4283 static HInstruction* New(Zone* zone, |
4300 HValue* context, | 4284 HValue* context, |
4301 HValue* left, | 4285 HValue* left, |
4302 HValue* right); | 4286 HValue* right); |
4303 | 4287 |
4304 HValue* left() { return OperandAt(0); } | 4288 HValue* left() { return OperandAt(0); } |
4305 HValue* right() const { return OperandAt(1); } | 4289 HValue* right() const { return OperandAt(1); } |
4306 | 4290 |
4307 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4291 virtual Representation RequiredInputRepresentation(int index) { |
4308 return index == 0 | 4292 return index == 0 |
4309 ? Representation::Double() | 4293 ? Representation::Double() |
4310 : Representation::None(); | 4294 : Representation::None(); |
4311 } | 4295 } |
4312 virtual Representation observed_input_representation(int index) V8_OVERRIDE { | 4296 virtual Representation observed_input_representation(int index) { |
4313 return RequiredInputRepresentation(index); | 4297 return RequiredInputRepresentation(index); |
4314 } | 4298 } |
4315 | 4299 |
4316 DECLARE_CONCRETE_INSTRUCTION(Power) | 4300 DECLARE_CONCRETE_INSTRUCTION(Power) |
4317 | 4301 |
4318 protected: | 4302 protected: |
4319 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4303 virtual bool DataEquals(HValue* other) { return true; } |
4320 | 4304 |
4321 private: | 4305 private: |
4322 HPower(HValue* left, HValue* right) { | 4306 HPower(HValue* left, HValue* right) { |
4323 SetOperandAt(0, left); | 4307 SetOperandAt(0, left); |
4324 SetOperandAt(1, right); | 4308 SetOperandAt(1, right); |
4325 set_representation(Representation::Double()); | 4309 set_representation(Representation::Double()); |
4326 SetFlag(kUseGVN); | 4310 SetFlag(kUseGVN); |
4327 SetGVNFlag(kChangesNewSpacePromotion); | 4311 SetGVNFlag(kChangesNewSpacePromotion); |
4328 } | 4312 } |
4329 | 4313 |
4330 virtual bool IsDeletable() const V8_OVERRIDE { | 4314 virtual bool IsDeletable() const { |
4331 return !right()->representation().IsTagged(); | 4315 return !right()->representation().IsTagged(); |
4332 } | 4316 } |
4333 }; | 4317 }; |
4334 | 4318 |
4335 | 4319 |
4336 class HRandom V8_FINAL : public HTemplateInstruction<1> { | 4320 class HRandom: public HTemplateInstruction<1> { |
4337 public: | 4321 public: |
4338 explicit HRandom(HValue* global_object) { | 4322 explicit HRandom(HValue* global_object) { |
4339 SetOperandAt(0, global_object); | 4323 SetOperandAt(0, global_object); |
4340 set_representation(Representation::Double()); | 4324 set_representation(Representation::Double()); |
4341 } | 4325 } |
4342 | 4326 |
4343 HValue* global_object() { return OperandAt(0); } | 4327 HValue* global_object() { return OperandAt(0); } |
4344 | 4328 |
4345 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4329 virtual Representation RequiredInputRepresentation(int index) { |
4346 return Representation::Tagged(); | 4330 return Representation::Tagged(); |
4347 } | 4331 } |
4348 | 4332 |
4349 DECLARE_CONCRETE_INSTRUCTION(Random) | 4333 DECLARE_CONCRETE_INSTRUCTION(Random) |
4350 | 4334 |
4351 private: | 4335 private: |
4352 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 4336 virtual bool IsDeletable() const { return true; } |
4353 }; | 4337 }; |
4354 | 4338 |
4355 | 4339 |
4356 class HAdd V8_FINAL : public HArithmeticBinaryOperation { | 4340 class HAdd: public HArithmeticBinaryOperation { |
4357 public: | 4341 public: |
4358 static HInstruction* New(Zone* zone, | 4342 static HInstruction* New(Zone* zone, |
4359 HValue* context, | 4343 HValue* context, |
4360 HValue* left, | 4344 HValue* left, |
4361 HValue* right); | 4345 HValue* right); |
4362 | 4346 |
4363 // Add is only commutative if two integer values are added and not if two | 4347 // Add is only commutative if two integer values are added and not if two |
4364 // tagged values are added (because it might be a String concatenation). | 4348 // tagged values are added (because it might be a String concatenation). |
4365 virtual bool IsCommutative() const V8_OVERRIDE { | 4349 virtual bool IsCommutative() const { |
4366 return !representation().IsTagged(); | 4350 return !representation().IsTagged(); |
4367 } | 4351 } |
4368 | 4352 |
4369 virtual HValue* EnsureAndPropagateNotMinusZero( | 4353 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
4370 BitVector* visited) V8_OVERRIDE; | |
4371 | 4354 |
4372 virtual HValue* Canonicalize() V8_OVERRIDE; | 4355 virtual HValue* Canonicalize(); |
4373 | 4356 |
4374 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { | 4357 virtual bool TryDecompose(DecompositionResult* decomposition) { |
4375 if (left()->IsInteger32Constant()) { | 4358 if (left()->IsInteger32Constant()) { |
4376 decomposition->Apply(right(), left()->GetInteger32Constant()); | 4359 decomposition->Apply(right(), left()->GetInteger32Constant()); |
4377 return true; | 4360 return true; |
4378 } else if (right()->IsInteger32Constant()) { | 4361 } else if (right()->IsInteger32Constant()) { |
4379 decomposition->Apply(left(), right()->GetInteger32Constant()); | 4362 decomposition->Apply(left(), right()->GetInteger32Constant()); |
4380 return true; | 4363 return true; |
4381 } else { | 4364 } else { |
4382 return false; | 4365 return false; |
4383 } | 4366 } |
4384 } | 4367 } |
4385 | 4368 |
4386 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { | 4369 virtual void RepresentationChanged(Representation to) { |
4387 if (to.IsTagged()) ClearFlag(kAllowUndefinedAsNaN); | 4370 if (to.IsTagged()) ClearFlag(kAllowUndefinedAsNaN); |
4388 HArithmeticBinaryOperation::RepresentationChanged(to); | 4371 HArithmeticBinaryOperation::RepresentationChanged(to); |
4389 } | 4372 } |
4390 | 4373 |
4391 DECLARE_CONCRETE_INSTRUCTION(Add) | 4374 DECLARE_CONCRETE_INSTRUCTION(Add) |
4392 | 4375 |
4393 protected: | 4376 protected: |
4394 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4377 virtual bool DataEquals(HValue* other) { return true; } |
4395 | 4378 |
4396 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 4379 virtual Range* InferRange(Zone* zone); |
4397 | 4380 |
4398 private: | 4381 private: |
4399 HAdd(HValue* context, HValue* left, HValue* right) | 4382 HAdd(HValue* context, HValue* left, HValue* right) |
4400 : HArithmeticBinaryOperation(context, left, right) { | 4383 : HArithmeticBinaryOperation(context, left, right) { |
4401 SetFlag(kCanOverflow); | 4384 SetFlag(kCanOverflow); |
4402 } | 4385 } |
4403 }; | 4386 }; |
4404 | 4387 |
4405 | 4388 |
4406 class HSub V8_FINAL : public HArithmeticBinaryOperation { | 4389 class HSub: public HArithmeticBinaryOperation { |
4407 public: | 4390 public: |
4408 static HInstruction* New(Zone* zone, | 4391 static HInstruction* New(Zone* zone, |
4409 HValue* context, | 4392 HValue* context, |
4410 HValue* left, | 4393 HValue* left, |
4411 HValue* right); | 4394 HValue* right); |
4412 | 4395 |
4413 virtual HValue* EnsureAndPropagateNotMinusZero( | 4396 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
4414 BitVector* visited) V8_OVERRIDE; | |
4415 | 4397 |
4416 virtual HValue* Canonicalize() V8_OVERRIDE; | 4398 virtual HValue* Canonicalize(); |
4417 | 4399 |
4418 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { | 4400 virtual bool TryDecompose(DecompositionResult* decomposition) { |
4419 if (right()->IsInteger32Constant()) { | 4401 if (right()->IsInteger32Constant()) { |
4420 decomposition->Apply(left(), -right()->GetInteger32Constant()); | 4402 decomposition->Apply(left(), -right()->GetInteger32Constant()); |
4421 return true; | 4403 return true; |
4422 } else { | 4404 } else { |
4423 return false; | 4405 return false; |
4424 } | 4406 } |
4425 } | 4407 } |
4426 | 4408 |
4427 DECLARE_CONCRETE_INSTRUCTION(Sub) | 4409 DECLARE_CONCRETE_INSTRUCTION(Sub) |
4428 | 4410 |
4429 protected: | 4411 protected: |
4430 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4412 virtual bool DataEquals(HValue* other) { return true; } |
4431 | 4413 |
4432 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 4414 virtual Range* InferRange(Zone* zone); |
4433 | 4415 |
4434 private: | 4416 private: |
4435 HSub(HValue* context, HValue* left, HValue* right) | 4417 HSub(HValue* context, HValue* left, HValue* right) |
4436 : HArithmeticBinaryOperation(context, left, right) { | 4418 : HArithmeticBinaryOperation(context, left, right) { |
4437 SetFlag(kCanOverflow); | 4419 SetFlag(kCanOverflow); |
4438 } | 4420 } |
4439 }; | 4421 }; |
4440 | 4422 |
4441 | 4423 |
4442 class HMul V8_FINAL : public HArithmeticBinaryOperation { | 4424 class HMul: public HArithmeticBinaryOperation { |
4443 public: | 4425 public: |
4444 static HInstruction* New(Zone* zone, | 4426 static HInstruction* New(Zone* zone, |
4445 HValue* context, | 4427 HValue* context, |
4446 HValue* left, | 4428 HValue* left, |
4447 HValue* right); | 4429 HValue* right); |
4448 | 4430 |
4449 static HInstruction* NewImul(Zone* zone, | 4431 static HInstruction* NewImul(Zone* zone, |
4450 HValue* context, | 4432 HValue* context, |
4451 HValue* left, | 4433 HValue* left, |
4452 HValue* right) { | 4434 HValue* right) { |
4453 HMul* mul = new(zone) HMul(context, left, right); | 4435 HMul* mul = new(zone) HMul(context, left, right); |
4454 // TODO(mstarzinger): Prevent bailout on minus zero for imul. | 4436 // TODO(mstarzinger): Prevent bailout on minus zero for imul. |
4455 mul->AssumeRepresentation(Representation::Integer32()); | 4437 mul->AssumeRepresentation(Representation::Integer32()); |
4456 mul->ClearFlag(HValue::kCanOverflow); | 4438 mul->ClearFlag(HValue::kCanOverflow); |
4457 return mul; | 4439 return mul; |
4458 } | 4440 } |
4459 | 4441 |
4460 virtual HValue* EnsureAndPropagateNotMinusZero( | 4442 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
4461 BitVector* visited) V8_OVERRIDE; | |
4462 | 4443 |
4463 virtual HValue* Canonicalize() V8_OVERRIDE; | 4444 virtual HValue* Canonicalize(); |
4464 | 4445 |
4465 // Only commutative if it is certain that not two objects are multiplicated. | 4446 // Only commutative if it is certain that not two objects are multiplicated. |
4466 virtual bool IsCommutative() const V8_OVERRIDE { | 4447 virtual bool IsCommutative() const { |
4467 return !representation().IsTagged(); | 4448 return !representation().IsTagged(); |
4468 } | 4449 } |
4469 | 4450 |
4470 virtual void UpdateRepresentation(Representation new_rep, | 4451 virtual void UpdateRepresentation(Representation new_rep, |
4471 HInferRepresentationPhase* h_infer, | 4452 HInferRepresentationPhase* h_infer, |
4472 const char* reason) V8_OVERRIDE { | 4453 const char* reason) { |
4473 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 4454 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
4474 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4455 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
4475 } | 4456 } |
4476 | 4457 |
4477 DECLARE_CONCRETE_INSTRUCTION(Mul) | 4458 DECLARE_CONCRETE_INSTRUCTION(Mul) |
4478 | 4459 |
4479 protected: | 4460 protected: |
4480 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4461 virtual bool DataEquals(HValue* other) { return true; } |
4481 | 4462 |
4482 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 4463 virtual Range* InferRange(Zone* zone); |
4483 | 4464 |
4484 private: | 4465 private: |
4485 HMul(HValue* context, HValue* left, HValue* right) | 4466 HMul(HValue* context, HValue* left, HValue* right) |
4486 : HArithmeticBinaryOperation(context, left, right) { | 4467 : HArithmeticBinaryOperation(context, left, right) { |
4487 SetFlag(kCanOverflow); | 4468 SetFlag(kCanOverflow); |
4488 } | 4469 } |
4489 }; | 4470 }; |
4490 | 4471 |
4491 | 4472 |
4492 class HMod V8_FINAL : public HArithmeticBinaryOperation { | 4473 class HMod: public HArithmeticBinaryOperation { |
4493 public: | 4474 public: |
4494 static HInstruction* New(Zone* zone, | 4475 static HInstruction* New(Zone* zone, |
4495 HValue* context, | 4476 HValue* context, |
4496 HValue* left, | 4477 HValue* left, |
4497 HValue* right, | 4478 HValue* right, |
4498 Maybe<int> fixed_right_arg); | 4479 Maybe<int> fixed_right_arg); |
4499 | 4480 |
4500 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } | 4481 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } |
4501 | 4482 |
4502 bool HasPowerOf2Divisor() { | 4483 bool HasPowerOf2Divisor() { |
4503 if (right()->IsConstant() && | 4484 if (right()->IsConstant() && |
4504 HConstant::cast(right())->HasInteger32Value()) { | 4485 HConstant::cast(right())->HasInteger32Value()) { |
4505 int32_t value = HConstant::cast(right())->Integer32Value(); | 4486 int32_t value = HConstant::cast(right())->Integer32Value(); |
4506 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); | 4487 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); |
4507 } | 4488 } |
4508 | 4489 |
4509 return false; | 4490 return false; |
4510 } | 4491 } |
4511 | 4492 |
4512 virtual HValue* EnsureAndPropagateNotMinusZero( | 4493 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
4513 BitVector* visited) V8_OVERRIDE; | |
4514 | 4494 |
4515 virtual HValue* Canonicalize() V8_OVERRIDE; | 4495 virtual HValue* Canonicalize(); |
4516 | 4496 |
4517 virtual void UpdateRepresentation(Representation new_rep, | 4497 virtual void UpdateRepresentation(Representation new_rep, |
4518 HInferRepresentationPhase* h_infer, | 4498 HInferRepresentationPhase* h_infer, |
4519 const char* reason) V8_OVERRIDE { | 4499 const char* reason) { |
4520 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 4500 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
4521 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4501 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
4522 } | 4502 } |
4523 | 4503 |
4524 DECLARE_CONCRETE_INSTRUCTION(Mod) | 4504 DECLARE_CONCRETE_INSTRUCTION(Mod) |
4525 | 4505 |
4526 protected: | 4506 protected: |
4527 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4507 virtual bool DataEquals(HValue* other) { return true; } |
4528 | 4508 |
4529 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 4509 virtual Range* InferRange(Zone* zone); |
4530 | 4510 |
4531 private: | 4511 private: |
4532 HMod(HValue* context, | 4512 HMod(HValue* context, |
4533 HValue* left, | 4513 HValue* left, |
4534 HValue* right, | 4514 HValue* right, |
4535 Maybe<int> fixed_right_arg) | 4515 Maybe<int> fixed_right_arg) |
4536 : HArithmeticBinaryOperation(context, left, right), | 4516 : HArithmeticBinaryOperation(context, left, right), |
4537 fixed_right_arg_(fixed_right_arg) { | 4517 fixed_right_arg_(fixed_right_arg) { |
4538 SetFlag(kCanBeDivByZero); | 4518 SetFlag(kCanBeDivByZero); |
4539 SetFlag(kCanOverflow); | 4519 SetFlag(kCanOverflow); |
4540 } | 4520 } |
4541 | 4521 |
4542 const Maybe<int> fixed_right_arg_; | 4522 const Maybe<int> fixed_right_arg_; |
4543 }; | 4523 }; |
4544 | 4524 |
4545 | 4525 |
4546 class HDiv V8_FINAL : public HArithmeticBinaryOperation { | 4526 class HDiv: public HArithmeticBinaryOperation { |
4547 public: | 4527 public: |
4548 static HInstruction* New(Zone* zone, | 4528 static HInstruction* New(Zone* zone, |
4549 HValue* context, | 4529 HValue* context, |
4550 HValue* left, | 4530 HValue* left, |
4551 HValue* right); | 4531 HValue* right); |
4552 | 4532 |
4553 bool HasPowerOf2Divisor() { | 4533 bool HasPowerOf2Divisor() { |
4554 if (right()->IsInteger32Constant()) { | 4534 if (right()->IsInteger32Constant()) { |
4555 int32_t value = right()->GetInteger32Constant(); | 4535 int32_t value = right()->GetInteger32Constant(); |
4556 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); | 4536 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); |
4557 } | 4537 } |
4558 | 4538 |
4559 return false; | 4539 return false; |
4560 } | 4540 } |
4561 | 4541 |
4562 virtual HValue* EnsureAndPropagateNotMinusZero( | 4542 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
4563 BitVector* visited) V8_OVERRIDE; | |
4564 | 4543 |
4565 virtual HValue* Canonicalize() V8_OVERRIDE; | 4544 virtual HValue* Canonicalize(); |
4566 | 4545 |
4567 virtual void UpdateRepresentation(Representation new_rep, | 4546 virtual void UpdateRepresentation(Representation new_rep, |
4568 HInferRepresentationPhase* h_infer, | 4547 HInferRepresentationPhase* h_infer, |
4569 const char* reason) V8_OVERRIDE { | 4548 const char* reason) { |
4570 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 4549 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
4571 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4550 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
4572 } | 4551 } |
4573 | 4552 |
4574 DECLARE_CONCRETE_INSTRUCTION(Div) | 4553 DECLARE_CONCRETE_INSTRUCTION(Div) |
4575 | 4554 |
4576 protected: | 4555 protected: |
4577 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4556 virtual bool DataEquals(HValue* other) { return true; } |
4578 | 4557 |
4579 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 4558 virtual Range* InferRange(Zone* zone); |
4580 | 4559 |
4581 private: | 4560 private: |
4582 HDiv(HValue* context, HValue* left, HValue* right) | 4561 HDiv(HValue* context, HValue* left, HValue* right) |
4583 : HArithmeticBinaryOperation(context, left, right) { | 4562 : HArithmeticBinaryOperation(context, left, right) { |
4584 SetFlag(kCanBeDivByZero); | 4563 SetFlag(kCanBeDivByZero); |
4585 SetFlag(kCanOverflow); | 4564 SetFlag(kCanOverflow); |
4586 } | 4565 } |
4587 }; | 4566 }; |
4588 | 4567 |
4589 | 4568 |
4590 class HMathMinMax V8_FINAL : public HArithmeticBinaryOperation { | 4569 class HMathMinMax: public HArithmeticBinaryOperation { |
4591 public: | 4570 public: |
4592 enum Operation { kMathMin, kMathMax }; | 4571 enum Operation { kMathMin, kMathMax }; |
4593 | 4572 |
4594 static HInstruction* New(Zone* zone, | 4573 static HInstruction* New(Zone* zone, |
4595 HValue* context, | 4574 HValue* context, |
4596 HValue* left, | 4575 HValue* left, |
4597 HValue* right, | 4576 HValue* right, |
4598 Operation op); | 4577 Operation op); |
4599 | 4578 |
4600 virtual Representation observed_input_representation(int index) V8_OVERRIDE { | 4579 virtual Representation RequiredInputRepresentation(int index) { |
| 4580 return index == 0 ? Representation::Tagged() |
| 4581 : representation(); |
| 4582 } |
| 4583 |
| 4584 virtual Representation observed_input_representation(int index) { |
4601 return RequiredInputRepresentation(index); | 4585 return RequiredInputRepresentation(index); |
4602 } | 4586 } |
4603 | 4587 |
4604 virtual void InferRepresentation( | 4588 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); |
4605 HInferRepresentationPhase* h_infer) V8_OVERRIDE; | |
4606 | 4589 |
4607 virtual Representation RepresentationFromInputs() V8_OVERRIDE { | 4590 virtual Representation RepresentationFromInputs() { |
4608 Representation left_rep = left()->representation(); | 4591 Representation left_rep = left()->representation(); |
4609 Representation right_rep = right()->representation(); | 4592 Representation right_rep = right()->representation(); |
4610 Representation result = Representation::Smi(); | 4593 Representation result = Representation::Smi(); |
4611 result = result.generalize(left_rep); | 4594 result = result.generalize(left_rep); |
4612 result = result.generalize(right_rep); | 4595 result = result.generalize(right_rep); |
4613 if (result.IsTagged()) return Representation::Double(); | 4596 if (result.IsTagged()) return Representation::Double(); |
4614 return result; | 4597 return result; |
4615 } | 4598 } |
4616 | 4599 |
4617 virtual bool IsCommutative() const V8_OVERRIDE { return true; } | 4600 virtual bool IsCommutative() const { return true; } |
4618 | 4601 |
4619 Operation operation() { return operation_; } | 4602 Operation operation() { return operation_; } |
4620 | 4603 |
4621 DECLARE_CONCRETE_INSTRUCTION(MathMinMax) | 4604 DECLARE_CONCRETE_INSTRUCTION(MathMinMax) |
4622 | 4605 |
4623 protected: | 4606 protected: |
4624 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 4607 virtual bool DataEquals(HValue* other) { |
4625 return other->IsMathMinMax() && | 4608 return other->IsMathMinMax() && |
4626 HMathMinMax::cast(other)->operation_ == operation_; | 4609 HMathMinMax::cast(other)->operation_ == operation_; |
4627 } | 4610 } |
4628 | 4611 |
4629 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 4612 virtual Range* InferRange(Zone* zone); |
4630 | 4613 |
4631 private: | 4614 private: |
4632 HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op) | 4615 HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op) |
4633 : HArithmeticBinaryOperation(context, left, right), | 4616 : HArithmeticBinaryOperation(context, left, right), |
4634 operation_(op) { } | 4617 operation_(op) { } |
4635 | 4618 |
4636 Operation operation_; | 4619 Operation operation_; |
4637 }; | 4620 }; |
4638 | 4621 |
4639 | 4622 |
4640 class HBitwise V8_FINAL : public HBitwiseBinaryOperation { | 4623 class HBitwise: public HBitwiseBinaryOperation { |
4641 public: | 4624 public: |
4642 static HInstruction* New(Zone* zone, | 4625 static HInstruction* New(Zone* zone, |
4643 HValue* context, | 4626 HValue* context, |
4644 Token::Value op, | 4627 Token::Value op, |
4645 HValue* left, | 4628 HValue* left, |
4646 HValue* right); | 4629 HValue* right); |
4647 | 4630 |
4648 Token::Value op() const { return op_; } | 4631 Token::Value op() const { return op_; } |
4649 | 4632 |
4650 virtual bool IsCommutative() const V8_OVERRIDE { return true; } | 4633 virtual bool IsCommutative() const { return true; } |
4651 | 4634 |
4652 virtual HValue* Canonicalize() V8_OVERRIDE; | 4635 virtual HValue* Canonicalize(); |
4653 | 4636 |
4654 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 4637 virtual void PrintDataTo(StringStream* stream); |
4655 | 4638 |
4656 DECLARE_CONCRETE_INSTRUCTION(Bitwise) | 4639 DECLARE_CONCRETE_INSTRUCTION(Bitwise) |
4657 | 4640 |
4658 protected: | 4641 protected: |
4659 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 4642 virtual bool DataEquals(HValue* other) { |
4660 return op() == HBitwise::cast(other)->op(); | 4643 return op() == HBitwise::cast(other)->op(); |
4661 } | 4644 } |
4662 | 4645 |
4663 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 4646 virtual Range* InferRange(Zone* zone); |
4664 | 4647 |
4665 private: | 4648 private: |
4666 HBitwise(HValue* context, | 4649 HBitwise(HValue* context, |
4667 Token::Value op, | 4650 Token::Value op, |
4668 HValue* left, | 4651 HValue* left, |
4669 HValue* right) | 4652 HValue* right) |
4670 : HBitwiseBinaryOperation(context, left, right, HType::TaggedNumber()), | 4653 : HBitwiseBinaryOperation(context, left, right, HType::TaggedNumber()), |
4671 op_(op) { | 4654 op_(op) { |
4672 ASSERT(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR); | 4655 ASSERT(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR); |
4673 // BIT_AND with a smi-range positive value will always unset the | 4656 // BIT_AND with a smi-range positive value will always unset the |
(...skipping 16 matching lines...) Expand all Loading... |
4690 right->representation().IsSmi() && | 4673 right->representation().IsSmi() && |
4691 HConstant::cast(right)->Integer32Value() < 0))) { | 4674 HConstant::cast(right)->Integer32Value() < 0))) { |
4692 SetFlag(kTruncatingToSmi); | 4675 SetFlag(kTruncatingToSmi); |
4693 } | 4676 } |
4694 } | 4677 } |
4695 | 4678 |
4696 Token::Value op_; | 4679 Token::Value op_; |
4697 }; | 4680 }; |
4698 | 4681 |
4699 | 4682 |
4700 class HShl V8_FINAL : public HBitwiseBinaryOperation { | 4683 class HShl: public HBitwiseBinaryOperation { |
4701 public: | 4684 public: |
4702 static HInstruction* New(Zone* zone, | 4685 static HInstruction* New(Zone* zone, |
4703 HValue* context, | 4686 HValue* context, |
4704 HValue* left, | 4687 HValue* left, |
4705 HValue* right); | 4688 HValue* right); |
4706 | 4689 |
4707 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 4690 virtual Range* InferRange(Zone* zone); |
4708 | 4691 |
4709 virtual void UpdateRepresentation(Representation new_rep, | 4692 virtual void UpdateRepresentation(Representation new_rep, |
4710 HInferRepresentationPhase* h_infer, | 4693 HInferRepresentationPhase* h_infer, |
4711 const char* reason) V8_OVERRIDE { | 4694 const char* reason) { |
4712 if (new_rep.IsSmi() && | 4695 if (new_rep.IsSmi() && |
4713 !(right()->IsInteger32Constant() && | 4696 !(right()->IsInteger32Constant() && |
4714 right()->GetInteger32Constant() >= 0)) { | 4697 right()->GetInteger32Constant() >= 0)) { |
4715 new_rep = Representation::Integer32(); | 4698 new_rep = Representation::Integer32(); |
4716 } | 4699 } |
4717 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4700 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
4718 } | 4701 } |
4719 | 4702 |
4720 DECLARE_CONCRETE_INSTRUCTION(Shl) | 4703 DECLARE_CONCRETE_INSTRUCTION(Shl) |
4721 | 4704 |
4722 protected: | 4705 protected: |
4723 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4706 virtual bool DataEquals(HValue* other) { return true; } |
4724 | 4707 |
4725 private: | 4708 private: |
4726 HShl(HValue* context, HValue* left, HValue* right) | 4709 HShl(HValue* context, HValue* left, HValue* right) |
4727 : HBitwiseBinaryOperation(context, left, right) { } | 4710 : HBitwiseBinaryOperation(context, left, right) { } |
4728 }; | 4711 }; |
4729 | 4712 |
4730 | 4713 |
4731 class HShr V8_FINAL : public HBitwiseBinaryOperation { | 4714 class HShr: public HBitwiseBinaryOperation { |
4732 public: | 4715 public: |
4733 static HInstruction* New(Zone* zone, | 4716 static HInstruction* New(Zone* zone, |
4734 HValue* context, | 4717 HValue* context, |
4735 HValue* left, | 4718 HValue* left, |
4736 HValue* right); | 4719 HValue* right); |
4737 | 4720 |
4738 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { | 4721 virtual bool TryDecompose(DecompositionResult* decomposition) { |
4739 if (right()->IsInteger32Constant()) { | 4722 if (right()->IsInteger32Constant()) { |
4740 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { | 4723 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { |
4741 // This is intended to look for HAdd and HSub, to handle compounds | 4724 // This is intended to look for HAdd and HSub, to handle compounds |
4742 // like ((base + offset) >> scale) with one single decomposition. | 4725 // like ((base + offset) >> scale) with one single decomposition. |
4743 left()->TryDecompose(decomposition); | 4726 left()->TryDecompose(decomposition); |
4744 return true; | 4727 return true; |
4745 } | 4728 } |
4746 } | 4729 } |
4747 return false; | 4730 return false; |
4748 } | 4731 } |
4749 | 4732 |
4750 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 4733 virtual Range* InferRange(Zone* zone); |
4751 | 4734 |
4752 virtual void UpdateRepresentation(Representation new_rep, | 4735 virtual void UpdateRepresentation(Representation new_rep, |
4753 HInferRepresentationPhase* h_infer, | 4736 HInferRepresentationPhase* h_infer, |
4754 const char* reason) V8_OVERRIDE { | 4737 const char* reason) { |
4755 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 4738 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
4756 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4739 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
4757 } | 4740 } |
4758 | 4741 |
4759 DECLARE_CONCRETE_INSTRUCTION(Shr) | 4742 DECLARE_CONCRETE_INSTRUCTION(Shr) |
4760 | 4743 |
4761 protected: | 4744 protected: |
4762 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4745 virtual bool DataEquals(HValue* other) { return true; } |
4763 | 4746 |
4764 private: | 4747 private: |
4765 HShr(HValue* context, HValue* left, HValue* right) | 4748 HShr(HValue* context, HValue* left, HValue* right) |
4766 : HBitwiseBinaryOperation(context, left, right) { } | 4749 : HBitwiseBinaryOperation(context, left, right) { } |
4767 }; | 4750 }; |
4768 | 4751 |
4769 | 4752 |
4770 class HSar V8_FINAL : public HBitwiseBinaryOperation { | 4753 class HSar: public HBitwiseBinaryOperation { |
4771 public: | 4754 public: |
4772 static HInstruction* New(Zone* zone, | 4755 static HInstruction* New(Zone* zone, |
4773 HValue* context, | 4756 HValue* context, |
4774 HValue* left, | 4757 HValue* left, |
4775 HValue* right); | 4758 HValue* right); |
4776 | 4759 |
4777 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { | 4760 virtual bool TryDecompose(DecompositionResult* decomposition) { |
4778 if (right()->IsInteger32Constant()) { | 4761 if (right()->IsInteger32Constant()) { |
4779 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { | 4762 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { |
4780 // This is intended to look for HAdd and HSub, to handle compounds | 4763 // This is intended to look for HAdd and HSub, to handle compounds |
4781 // like ((base + offset) >> scale) with one single decomposition. | 4764 // like ((base + offset) >> scale) with one single decomposition. |
4782 left()->TryDecompose(decomposition); | 4765 left()->TryDecompose(decomposition); |
4783 return true; | 4766 return true; |
4784 } | 4767 } |
4785 } | 4768 } |
4786 return false; | 4769 return false; |
4787 } | 4770 } |
4788 | 4771 |
4789 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 4772 virtual Range* InferRange(Zone* zone); |
4790 | 4773 |
4791 virtual void UpdateRepresentation(Representation new_rep, | 4774 virtual void UpdateRepresentation(Representation new_rep, |
4792 HInferRepresentationPhase* h_infer, | 4775 HInferRepresentationPhase* h_infer, |
4793 const char* reason) V8_OVERRIDE { | 4776 const char* reason) { |
4794 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 4777 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
4795 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4778 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
4796 } | 4779 } |
4797 | 4780 |
4798 DECLARE_CONCRETE_INSTRUCTION(Sar) | 4781 DECLARE_CONCRETE_INSTRUCTION(Sar) |
4799 | 4782 |
4800 protected: | 4783 protected: |
4801 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4784 virtual bool DataEquals(HValue* other) { return true; } |
4802 | 4785 |
4803 private: | 4786 private: |
4804 HSar(HValue* context, HValue* left, HValue* right) | 4787 HSar(HValue* context, HValue* left, HValue* right) |
4805 : HBitwiseBinaryOperation(context, left, right) { } | 4788 : HBitwiseBinaryOperation(context, left, right) { } |
4806 }; | 4789 }; |
4807 | 4790 |
4808 | 4791 |
4809 class HRor V8_FINAL : public HBitwiseBinaryOperation { | 4792 class HRor: public HBitwiseBinaryOperation { |
4810 public: | 4793 public: |
4811 HRor(HValue* context, HValue* left, HValue* right) | 4794 HRor(HValue* context, HValue* left, HValue* right) |
4812 : HBitwiseBinaryOperation(context, left, right) { | 4795 : HBitwiseBinaryOperation(context, left, right) { |
4813 ChangeRepresentation(Representation::Integer32()); | 4796 ChangeRepresentation(Representation::Integer32()); |
4814 } | 4797 } |
4815 | 4798 |
4816 virtual void UpdateRepresentation(Representation new_rep, | 4799 virtual void UpdateRepresentation(Representation new_rep, |
4817 HInferRepresentationPhase* h_infer, | 4800 HInferRepresentationPhase* h_infer, |
4818 const char* reason) V8_OVERRIDE { | 4801 const char* reason) { |
4819 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 4802 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
4820 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4803 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
4821 } | 4804 } |
4822 | 4805 |
4823 DECLARE_CONCRETE_INSTRUCTION(Ror) | 4806 DECLARE_CONCRETE_INSTRUCTION(Ror) |
4824 | 4807 |
4825 protected: | 4808 protected: |
4826 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4809 virtual bool DataEquals(HValue* other) { return true; } |
4827 }; | 4810 }; |
4828 | 4811 |
4829 | 4812 |
4830 class HOsrEntry V8_FINAL : public HTemplateInstruction<0> { | 4813 class HOsrEntry: public HTemplateInstruction<0> { |
4831 public: | 4814 public: |
4832 DECLARE_INSTRUCTION_FACTORY_P1(HOsrEntry, BailoutId); | 4815 DECLARE_INSTRUCTION_FACTORY_P1(HOsrEntry, BailoutId); |
4833 | 4816 |
4834 BailoutId ast_id() const { return ast_id_; } | 4817 BailoutId ast_id() const { return ast_id_; } |
4835 | 4818 |
4836 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4819 virtual Representation RequiredInputRepresentation(int index) { |
4837 return Representation::None(); | 4820 return Representation::None(); |
4838 } | 4821 } |
4839 | 4822 |
4840 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) | 4823 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) |
4841 | 4824 |
4842 private: | 4825 private: |
4843 explicit HOsrEntry(BailoutId ast_id) : ast_id_(ast_id) { | 4826 explicit HOsrEntry(BailoutId ast_id) : ast_id_(ast_id) { |
4844 SetGVNFlag(kChangesOsrEntries); | 4827 SetGVNFlag(kChangesOsrEntries); |
4845 SetGVNFlag(kChangesNewSpacePromotion); | 4828 SetGVNFlag(kChangesNewSpacePromotion); |
4846 } | 4829 } |
4847 | 4830 |
4848 BailoutId ast_id_; | 4831 BailoutId ast_id_; |
4849 }; | 4832 }; |
4850 | 4833 |
4851 | 4834 |
4852 class HParameter V8_FINAL : public HTemplateInstruction<0> { | 4835 class HParameter: public HTemplateInstruction<0> { |
4853 public: | 4836 public: |
4854 enum ParameterKind { | 4837 enum ParameterKind { |
4855 STACK_PARAMETER, | 4838 STACK_PARAMETER, |
4856 REGISTER_PARAMETER | 4839 REGISTER_PARAMETER |
4857 }; | 4840 }; |
4858 | 4841 |
4859 DECLARE_INSTRUCTION_FACTORY_P1(HParameter, unsigned); | 4842 DECLARE_INSTRUCTION_FACTORY_P1(HParameter, unsigned); |
4860 DECLARE_INSTRUCTION_FACTORY_P2(HParameter, unsigned, ParameterKind); | 4843 DECLARE_INSTRUCTION_FACTORY_P2(HParameter, unsigned, ParameterKind); |
4861 DECLARE_INSTRUCTION_FACTORY_P3(HParameter, unsigned, ParameterKind, | 4844 DECLARE_INSTRUCTION_FACTORY_P3(HParameter, unsigned, ParameterKind, |
4862 Representation); | 4845 Representation); |
4863 | 4846 |
4864 unsigned index() const { return index_; } | 4847 unsigned index() const { return index_; } |
4865 ParameterKind kind() const { return kind_; } | 4848 ParameterKind kind() const { return kind_; } |
4866 | 4849 |
4867 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 4850 virtual void PrintDataTo(StringStream* stream); |
4868 | 4851 |
4869 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4852 virtual Representation RequiredInputRepresentation(int index) { |
4870 return Representation::None(); | 4853 return Representation::None(); |
4871 } | 4854 } |
4872 | 4855 |
4873 DECLARE_CONCRETE_INSTRUCTION(Parameter) | 4856 DECLARE_CONCRETE_INSTRUCTION(Parameter) |
4874 | 4857 |
4875 private: | 4858 private: |
4876 explicit HParameter(unsigned index, | 4859 explicit HParameter(unsigned index, |
4877 ParameterKind kind = STACK_PARAMETER) | 4860 ParameterKind kind = STACK_PARAMETER) |
4878 : index_(index), | 4861 : index_(index), |
4879 kind_(kind) { | 4862 kind_(kind) { |
4880 set_representation(Representation::Tagged()); | 4863 set_representation(Representation::Tagged()); |
4881 } | 4864 } |
4882 | 4865 |
4883 explicit HParameter(unsigned index, | 4866 explicit HParameter(unsigned index, |
4884 ParameterKind kind, | 4867 ParameterKind kind, |
4885 Representation r) | 4868 Representation r) |
4886 : index_(index), | 4869 : index_(index), |
4887 kind_(kind) { | 4870 kind_(kind) { |
4888 set_representation(r); | 4871 set_representation(r); |
4889 } | 4872 } |
4890 | 4873 |
4891 unsigned index_; | 4874 unsigned index_; |
4892 ParameterKind kind_; | 4875 ParameterKind kind_; |
4893 }; | 4876 }; |
4894 | 4877 |
4895 | 4878 |
4896 class HCallStub V8_FINAL : public HUnaryCall { | 4879 class HCallStub: public HUnaryCall { |
4897 public: | 4880 public: |
4898 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count) | 4881 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count) |
4899 : HUnaryCall(context, argument_count), | 4882 : HUnaryCall(context, argument_count), |
4900 major_key_(major_key), | 4883 major_key_(major_key), |
4901 transcendental_type_(TranscendentalCache::kNumberOfCaches) { | 4884 transcendental_type_(TranscendentalCache::kNumberOfCaches) { |
4902 } | 4885 } |
4903 | 4886 |
4904 CodeStub::Major major_key() { return major_key_; } | 4887 CodeStub::Major major_key() { return major_key_; } |
4905 | 4888 |
4906 HValue* context() { return value(); } | 4889 HValue* context() { return value(); } |
4907 | 4890 |
4908 void set_transcendental_type(TranscendentalCache::Type transcendental_type) { | 4891 void set_transcendental_type(TranscendentalCache::Type transcendental_type) { |
4909 transcendental_type_ = transcendental_type; | 4892 transcendental_type_ = transcendental_type; |
4910 } | 4893 } |
4911 TranscendentalCache::Type transcendental_type() { | 4894 TranscendentalCache::Type transcendental_type() { |
4912 return transcendental_type_; | 4895 return transcendental_type_; |
4913 } | 4896 } |
4914 | 4897 |
4915 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 4898 virtual void PrintDataTo(StringStream* stream); |
| 4899 |
| 4900 virtual Representation RequiredInputRepresentation(int index) { |
| 4901 return Representation::Tagged(); |
| 4902 } |
4916 | 4903 |
4917 DECLARE_CONCRETE_INSTRUCTION(CallStub) | 4904 DECLARE_CONCRETE_INSTRUCTION(CallStub) |
4918 | 4905 |
4919 private: | 4906 private: |
4920 CodeStub::Major major_key_; | 4907 CodeStub::Major major_key_; |
4921 TranscendentalCache::Type transcendental_type_; | 4908 TranscendentalCache::Type transcendental_type_; |
4922 }; | 4909 }; |
4923 | 4910 |
4924 | 4911 |
4925 class HUnknownOSRValue V8_FINAL : public HTemplateInstruction<0> { | 4912 class HUnknownOSRValue: public HTemplateInstruction<0> { |
4926 public: | 4913 public: |
4927 DECLARE_INSTRUCTION_FACTORY_P0(HUnknownOSRValue) | 4914 DECLARE_INSTRUCTION_FACTORY_P0(HUnknownOSRValue) |
4928 | 4915 |
4929 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4916 virtual Representation RequiredInputRepresentation(int index) { |
4930 return Representation::None(); | 4917 return Representation::None(); |
4931 } | 4918 } |
4932 | 4919 |
4933 void set_incoming_value(HPhi* value) { | 4920 void set_incoming_value(HPhi* value) { |
4934 incoming_value_ = value; | 4921 incoming_value_ = value; |
4935 } | 4922 } |
4936 | 4923 |
4937 HPhi* incoming_value() { | 4924 HPhi* incoming_value() { |
4938 return incoming_value_; | 4925 return incoming_value_; |
4939 } | 4926 } |
4940 | 4927 |
4941 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE { | 4928 virtual Representation KnownOptimalRepresentation() { |
4942 if (incoming_value_ == NULL) return Representation::None(); | 4929 if (incoming_value_ == NULL) return Representation::None(); |
4943 return incoming_value_->KnownOptimalRepresentation(); | 4930 return incoming_value_->KnownOptimalRepresentation(); |
4944 } | 4931 } |
4945 | 4932 |
4946 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) | 4933 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) |
4947 | 4934 |
4948 private: | 4935 private: |
4949 HUnknownOSRValue() | 4936 HUnknownOSRValue() |
4950 : incoming_value_(NULL) { | 4937 : incoming_value_(NULL) { |
4951 set_representation(Representation::Tagged()); | 4938 set_representation(Representation::Tagged()); |
4952 } | 4939 } |
4953 | 4940 |
4954 HPhi* incoming_value_; | 4941 HPhi* incoming_value_; |
4955 }; | 4942 }; |
4956 | 4943 |
4957 | 4944 |
4958 class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> { | 4945 class HLoadGlobalCell: public HTemplateInstruction<0> { |
4959 public: | 4946 public: |
4960 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details) | 4947 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details) |
4961 : cell_(cell), details_(details), unique_id_() { | 4948 : cell_(cell), details_(details), unique_id_() { |
4962 set_representation(Representation::Tagged()); | 4949 set_representation(Representation::Tagged()); |
4963 SetFlag(kUseGVN); | 4950 SetFlag(kUseGVN); |
4964 SetGVNFlag(kDependsOnGlobalVars); | 4951 SetGVNFlag(kDependsOnGlobalVars); |
4965 } | 4952 } |
4966 | 4953 |
4967 Handle<Cell> cell() const { return cell_; } | 4954 Handle<Cell> cell() const { return cell_; } |
4968 bool RequiresHoleCheck() const; | 4955 bool RequiresHoleCheck() const; |
4969 | 4956 |
4970 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 4957 virtual void PrintDataTo(StringStream* stream); |
4971 | 4958 |
4972 virtual intptr_t Hashcode() V8_OVERRIDE { | 4959 virtual intptr_t Hashcode() { |
4973 return unique_id_.Hashcode(); | 4960 return unique_id_.Hashcode(); |
4974 } | 4961 } |
4975 | 4962 |
4976 virtual void FinalizeUniqueValueId() V8_OVERRIDE { | 4963 virtual void FinalizeUniqueValueId() { |
4977 unique_id_ = UniqueValueId(cell_); | 4964 unique_id_ = UniqueValueId(cell_); |
4978 } | 4965 } |
4979 | 4966 |
4980 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4967 virtual Representation RequiredInputRepresentation(int index) { |
4981 return Representation::None(); | 4968 return Representation::None(); |
4982 } | 4969 } |
4983 | 4970 |
4984 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) | 4971 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) |
4985 | 4972 |
4986 protected: | 4973 protected: |
4987 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 4974 virtual bool DataEquals(HValue* other) { |
4988 HLoadGlobalCell* b = HLoadGlobalCell::cast(other); | 4975 HLoadGlobalCell* b = HLoadGlobalCell::cast(other); |
4989 return unique_id_ == b->unique_id_; | 4976 return unique_id_ == b->unique_id_; |
4990 } | 4977 } |
4991 | 4978 |
4992 private: | 4979 private: |
4993 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); } | 4980 virtual bool IsDeletable() const { return !RequiresHoleCheck(); } |
4994 | 4981 |
4995 Handle<Cell> cell_; | 4982 Handle<Cell> cell_; |
4996 PropertyDetails details_; | 4983 PropertyDetails details_; |
4997 UniqueValueId unique_id_; | 4984 UniqueValueId unique_id_; |
4998 }; | 4985 }; |
4999 | 4986 |
5000 | 4987 |
5001 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> { | 4988 class HLoadGlobalGeneric: public HTemplateInstruction<2> { |
5002 public: | 4989 public: |
5003 HLoadGlobalGeneric(HValue* context, | 4990 HLoadGlobalGeneric(HValue* context, |
5004 HValue* global_object, | 4991 HValue* global_object, |
5005 Handle<Object> name, | 4992 Handle<Object> name, |
5006 bool for_typeof) | 4993 bool for_typeof) |
5007 : name_(name), | 4994 : name_(name), |
5008 for_typeof_(for_typeof) { | 4995 for_typeof_(for_typeof) { |
5009 SetOperandAt(0, context); | 4996 SetOperandAt(0, context); |
5010 SetOperandAt(1, global_object); | 4997 SetOperandAt(1, global_object); |
5011 set_representation(Representation::Tagged()); | 4998 set_representation(Representation::Tagged()); |
5012 SetAllSideEffects(); | 4999 SetAllSideEffects(); |
5013 } | 5000 } |
5014 | 5001 |
5015 HValue* context() { return OperandAt(0); } | 5002 HValue* context() { return OperandAt(0); } |
5016 HValue* global_object() { return OperandAt(1); } | 5003 HValue* global_object() { return OperandAt(1); } |
5017 Handle<Object> name() const { return name_; } | 5004 Handle<Object> name() const { return name_; } |
5018 bool for_typeof() const { return for_typeof_; } | 5005 bool for_typeof() const { return for_typeof_; } |
5019 | 5006 |
5020 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 5007 virtual void PrintDataTo(StringStream* stream); |
5021 | 5008 |
5022 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5009 virtual Representation RequiredInputRepresentation(int index) { |
5023 return Representation::Tagged(); | 5010 return Representation::Tagged(); |
5024 } | 5011 } |
5025 | 5012 |
5026 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) | 5013 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) |
5027 | 5014 |
5028 private: | 5015 private: |
5029 Handle<Object> name_; | 5016 Handle<Object> name_; |
5030 bool for_typeof_; | 5017 bool for_typeof_; |
5031 }; | 5018 }; |
5032 | 5019 |
5033 | 5020 |
5034 class HAllocate V8_FINAL : public HTemplateInstruction<2> { | 5021 class HAllocate: public HTemplateInstruction<2> { |
5035 public: | 5022 public: |
5036 static HAllocate* New(Zone* zone, | 5023 static HAllocate* New(Zone* zone, |
5037 HValue* context, | 5024 HValue* context, |
5038 HValue* size, | 5025 HValue* size, |
5039 HType type, | 5026 HType type, |
5040 PretenureFlag pretenure_flag, | 5027 PretenureFlag pretenure_flag, |
5041 InstanceType instance_type) { | 5028 InstanceType instance_type) { |
5042 return new(zone) HAllocate(context, size, type, pretenure_flag, | 5029 return new(zone) HAllocate(context, size, type, pretenure_flag, |
5043 instance_type); | 5030 instance_type); |
5044 } | 5031 } |
5045 | 5032 |
5046 // Maximum instance size for which allocations will be inlined. | 5033 // Maximum instance size for which allocations will be inlined. |
5047 static const int kMaxInlineSize = 64 * kPointerSize; | 5034 static const int kMaxInlineSize = 64 * kPointerSize; |
5048 | 5035 |
5049 HValue* context() { return OperandAt(0); } | 5036 HValue* context() { return OperandAt(0); } |
5050 HValue* size() { return OperandAt(1); } | 5037 HValue* size() { return OperandAt(1); } |
5051 | 5038 |
5052 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5039 virtual Representation RequiredInputRepresentation(int index) { |
5053 if (index == 0) { | 5040 if (index == 0) { |
5054 return Representation::Tagged(); | 5041 return Representation::Tagged(); |
5055 } else { | 5042 } else { |
5056 return Representation::Integer32(); | 5043 return Representation::Integer32(); |
5057 } | 5044 } |
5058 } | 5045 } |
5059 | 5046 |
5060 virtual Handle<Map> GetMonomorphicJSObjectMap() { | 5047 virtual Handle<Map> GetMonomorphicJSObjectMap() { |
5061 return known_initial_map_; | 5048 return known_initial_map_; |
5062 } | 5049 } |
(...skipping 28 matching lines...) Expand all Loading... |
5091 | 5078 |
5092 void MakeDoubleAligned() { | 5079 void MakeDoubleAligned() { |
5093 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); | 5080 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); |
5094 } | 5081 } |
5095 | 5082 |
5096 void UpdateSize(HValue* size) { | 5083 void UpdateSize(HValue* size) { |
5097 SetOperandAt(1, size); | 5084 SetOperandAt(1, size); |
5098 } | 5085 } |
5099 | 5086 |
5100 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 5087 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
5101 HValue* dominator) V8_OVERRIDE; | 5088 HValue* dominator); |
5102 | 5089 |
5103 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 5090 virtual void PrintDataTo(StringStream* stream); |
5104 | 5091 |
5105 DECLARE_CONCRETE_INSTRUCTION(Allocate) | 5092 DECLARE_CONCRETE_INSTRUCTION(Allocate) |
5106 | 5093 |
5107 private: | 5094 private: |
5108 enum Flags { | 5095 enum Flags { |
5109 ALLOCATE_IN_NEW_SPACE = 1 << 0, | 5096 ALLOCATE_IN_NEW_SPACE = 1 << 0, |
5110 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, | 5097 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, |
5111 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, | 5098 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, |
5112 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, | 5099 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, |
5113 PREFILL_WITH_FILLER = 1 << 4 | 5100 PREFILL_WITH_FILLER = 1 << 4 |
(...skipping 19 matching lines...) Expand all Loading... |
5133 flags_ = static_cast<HAllocate::Flags>(flags_ | | 5120 flags_ = static_cast<HAllocate::Flags>(flags_ | |
5134 ALLOCATE_DOUBLE_ALIGNED); | 5121 ALLOCATE_DOUBLE_ALIGNED); |
5135 } | 5122 } |
5136 } | 5123 } |
5137 | 5124 |
5138 Flags flags_; | 5125 Flags flags_; |
5139 Handle<Map> known_initial_map_; | 5126 Handle<Map> known_initial_map_; |
5140 }; | 5127 }; |
5141 | 5128 |
5142 | 5129 |
5143 class HInnerAllocatedObject V8_FINAL : public HTemplateInstruction<1> { | 5130 class HInnerAllocatedObject: public HTemplateInstruction<1> { |
5144 public: | 5131 public: |
5145 static HInnerAllocatedObject* New(Zone* zone, | 5132 static HInnerAllocatedObject* New(Zone* zone, |
5146 HValue* context, | 5133 HValue* context, |
5147 HValue* value, | 5134 HValue* value, |
5148 int offset, | 5135 int offset, |
5149 HType type = HType::Tagged()) { | 5136 HType type = HType::Tagged()) { |
5150 return new(zone) HInnerAllocatedObject(value, offset, type); | 5137 return new(zone) HInnerAllocatedObject(value, offset, type); |
5151 } | 5138 } |
5152 | 5139 |
5153 HValue* base_object() { return OperandAt(0); } | 5140 HValue* base_object() { return OperandAt(0); } |
5154 int offset() { return offset_; } | 5141 int offset() { return offset_; } |
5155 | 5142 |
5156 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5143 virtual Representation RequiredInputRepresentation(int index) { |
5157 return Representation::Tagged(); | 5144 return Representation::Tagged(); |
5158 } | 5145 } |
5159 | 5146 |
5160 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 5147 virtual void PrintDataTo(StringStream* stream); |
5161 | 5148 |
5162 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject) | 5149 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject) |
5163 | 5150 |
5164 private: | 5151 private: |
5165 HInnerAllocatedObject(HValue* value, int offset, HType type = HType::Tagged()) | 5152 HInnerAllocatedObject(HValue* value, int offset, HType type = HType::Tagged()) |
5166 : HTemplateInstruction<1>(type), offset_(offset) { | 5153 : HTemplateInstruction<1>(type), offset_(offset) { |
5167 ASSERT(value->IsAllocate()); | 5154 ASSERT(value->IsAllocate()); |
5168 SetOperandAt(0, value); | 5155 SetOperandAt(0, value); |
5169 set_type(type); | 5156 set_type(type); |
5170 set_representation(Representation::Tagged()); | 5157 set_representation(Representation::Tagged()); |
(...skipping 26 matching lines...) Expand all Loading... |
5197 return false; | 5184 return false; |
5198 } | 5185 } |
5199 if (object != new_space_dominator) return true; | 5186 if (object != new_space_dominator) return true; |
5200 if (object->IsAllocate()) { | 5187 if (object->IsAllocate()) { |
5201 return !HAllocate::cast(object)->IsNewSpaceAllocation(); | 5188 return !HAllocate::cast(object)->IsNewSpaceAllocation(); |
5202 } | 5189 } |
5203 return true; | 5190 return true; |
5204 } | 5191 } |
5205 | 5192 |
5206 | 5193 |
5207 class HStoreGlobalCell V8_FINAL : public HUnaryOperation { | 5194 class HStoreGlobalCell: public HUnaryOperation { |
5208 public: | 5195 public: |
5209 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*, | 5196 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*, |
5210 Handle<PropertyCell>, PropertyDetails); | 5197 Handle<PropertyCell>, PropertyDetails); |
5211 | 5198 |
5212 Handle<PropertyCell> cell() const { return cell_; } | 5199 Handle<PropertyCell> cell() const { return cell_; } |
5213 bool RequiresHoleCheck() { | 5200 bool RequiresHoleCheck() { |
5214 return !details_.IsDontDelete() || details_.IsReadOnly(); | 5201 return !details_.IsDontDelete() || details_.IsReadOnly(); |
5215 } | 5202 } |
5216 bool NeedsWriteBarrier() { | 5203 bool NeedsWriteBarrier() { |
5217 return StoringValueNeedsWriteBarrier(value()); | 5204 return StoringValueNeedsWriteBarrier(value()); |
5218 } | 5205 } |
5219 | 5206 |
5220 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5207 virtual Representation RequiredInputRepresentation(int index) { |
5221 return Representation::Tagged(); | 5208 return Representation::Tagged(); |
5222 } | 5209 } |
5223 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 5210 virtual void PrintDataTo(StringStream* stream); |
5224 | 5211 |
5225 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) | 5212 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) |
5226 | 5213 |
5227 private: | 5214 private: |
5228 HStoreGlobalCell(HValue* value, | 5215 HStoreGlobalCell(HValue* value, |
5229 Handle<PropertyCell> cell, | 5216 Handle<PropertyCell> cell, |
5230 PropertyDetails details) | 5217 PropertyDetails details) |
5231 : HUnaryOperation(value), | 5218 : HUnaryOperation(value), |
5232 cell_(cell), | 5219 cell_(cell), |
5233 details_(details) { | 5220 details_(details) { |
5234 SetGVNFlag(kChangesGlobalVars); | 5221 SetGVNFlag(kChangesGlobalVars); |
5235 } | 5222 } |
5236 | 5223 |
5237 Handle<PropertyCell> cell_; | 5224 Handle<PropertyCell> cell_; |
5238 PropertyDetails details_; | 5225 PropertyDetails details_; |
5239 }; | 5226 }; |
5240 | 5227 |
5241 | 5228 |
5242 class HStoreGlobalGeneric : public HTemplateInstruction<3> { | 5229 class HStoreGlobalGeneric: public HTemplateInstruction<3> { |
5243 public: | 5230 public: |
5244 inline static HStoreGlobalGeneric* New(Zone* zone, | 5231 inline static HStoreGlobalGeneric* New(Zone* zone, |
5245 HValue* context, | 5232 HValue* context, |
5246 HValue* global_object, | 5233 HValue* global_object, |
5247 Handle<Object> name, | 5234 Handle<Object> name, |
5248 HValue* value, | 5235 HValue* value, |
5249 StrictModeFlag strict_mode_flag) { | 5236 StrictModeFlag strict_mode_flag) { |
5250 return new(zone) HStoreGlobalGeneric(context, global_object, | 5237 return new(zone) HStoreGlobalGeneric(context, global_object, |
5251 name, value, strict_mode_flag); | 5238 name, value, strict_mode_flag); |
5252 } | 5239 } |
5253 | 5240 |
5254 HValue* context() { return OperandAt(0); } | 5241 HValue* context() { return OperandAt(0); } |
5255 HValue* global_object() { return OperandAt(1); } | 5242 HValue* global_object() { return OperandAt(1); } |
5256 Handle<Object> name() const { return name_; } | 5243 Handle<Object> name() const { return name_; } |
5257 HValue* value() { return OperandAt(2); } | 5244 HValue* value() { return OperandAt(2); } |
5258 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; } | 5245 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; } |
5259 | 5246 |
5260 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 5247 virtual void PrintDataTo(StringStream* stream); |
5261 | 5248 |
5262 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5249 virtual Representation RequiredInputRepresentation(int index) { |
5263 return Representation::Tagged(); | 5250 return Representation::Tagged(); |
5264 } | 5251 } |
5265 | 5252 |
5266 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric) | 5253 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric) |
5267 | 5254 |
5268 private: | 5255 private: |
5269 HStoreGlobalGeneric(HValue* context, | 5256 HStoreGlobalGeneric(HValue* context, |
5270 HValue* global_object, | 5257 HValue* global_object, |
5271 Handle<Object> name, | 5258 Handle<Object> name, |
5272 HValue* value, | 5259 HValue* value, |
5273 StrictModeFlag strict_mode_flag) | 5260 StrictModeFlag strict_mode_flag) |
5274 : name_(name), | 5261 : name_(name), |
5275 strict_mode_flag_(strict_mode_flag) { | 5262 strict_mode_flag_(strict_mode_flag) { |
5276 SetOperandAt(0, context); | 5263 SetOperandAt(0, context); |
5277 SetOperandAt(1, global_object); | 5264 SetOperandAt(1, global_object); |
5278 SetOperandAt(2, value); | 5265 SetOperandAt(2, value); |
5279 set_representation(Representation::Tagged()); | 5266 set_representation(Representation::Tagged()); |
5280 SetAllSideEffects(); | 5267 SetAllSideEffects(); |
5281 } | 5268 } |
5282 | 5269 |
5283 Handle<Object> name_; | 5270 Handle<Object> name_; |
5284 StrictModeFlag strict_mode_flag_; | 5271 StrictModeFlag strict_mode_flag_; |
5285 }; | 5272 }; |
5286 | 5273 |
5287 | 5274 |
5288 class HLoadContextSlot V8_FINAL : public HUnaryOperation { | 5275 class HLoadContextSlot: public HUnaryOperation { |
5289 public: | 5276 public: |
5290 enum Mode { | 5277 enum Mode { |
5291 // Perform a normal load of the context slot without checking its value. | 5278 // Perform a normal load of the context slot without checking its value. |
5292 kNoCheck, | 5279 kNoCheck, |
5293 // Load and check the value of the context slot. Deoptimize if it's the | 5280 // Load and check the value of the context slot. Deoptimize if it's the |
5294 // hole value. This is used for checking for loading of uninitialized | 5281 // hole value. This is used for checking for loading of uninitialized |
5295 // harmony bindings where we deoptimize into full-codegen generated code | 5282 // harmony bindings where we deoptimize into full-codegen generated code |
5296 // which will subsequently throw a reference error. | 5283 // which will subsequently throw a reference error. |
5297 kCheckDeoptimize, | 5284 kCheckDeoptimize, |
5298 // Load and check the value of the context slot. Return undefined if it's | 5285 // Load and check the value of the context slot. Return undefined if it's |
(...skipping 24 matching lines...) Expand all Loading... |
5323 Mode mode() const { return mode_; } | 5310 Mode mode() const { return mode_; } |
5324 | 5311 |
5325 bool DeoptimizesOnHole() { | 5312 bool DeoptimizesOnHole() { |
5326 return mode_ == kCheckDeoptimize; | 5313 return mode_ == kCheckDeoptimize; |
5327 } | 5314 } |
5328 | 5315 |
5329 bool RequiresHoleCheck() const { | 5316 bool RequiresHoleCheck() const { |
5330 return mode_ != kNoCheck; | 5317 return mode_ != kNoCheck; |
5331 } | 5318 } |
5332 | 5319 |
5333 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5320 virtual Representation RequiredInputRepresentation(int index) { |
5334 return Representation::Tagged(); | 5321 return Representation::Tagged(); |
5335 } | 5322 } |
5336 | 5323 |
5337 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 5324 virtual void PrintDataTo(StringStream* stream); |
5338 | 5325 |
5339 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) | 5326 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) |
5340 | 5327 |
5341 protected: | 5328 protected: |
5342 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 5329 virtual bool DataEquals(HValue* other) { |
5343 HLoadContextSlot* b = HLoadContextSlot::cast(other); | 5330 HLoadContextSlot* b = HLoadContextSlot::cast(other); |
5344 return (slot_index() == b->slot_index()); | 5331 return (slot_index() == b->slot_index()); |
5345 } | 5332 } |
5346 | 5333 |
5347 private: | 5334 private: |
5348 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); } | 5335 virtual bool IsDeletable() const { return !RequiresHoleCheck(); } |
5349 | 5336 |
5350 int slot_index_; | 5337 int slot_index_; |
5351 Mode mode_; | 5338 Mode mode_; |
5352 }; | 5339 }; |
5353 | 5340 |
5354 | 5341 |
5355 class HStoreContextSlot V8_FINAL : public HTemplateInstruction<2> { | 5342 class HStoreContextSlot: public HTemplateInstruction<2> { |
5356 public: | 5343 public: |
5357 enum Mode { | 5344 enum Mode { |
5358 // Perform a normal store to the context slot without checking its previous | 5345 // Perform a normal store to the context slot without checking its previous |
5359 // value. | 5346 // value. |
5360 kNoCheck, | 5347 kNoCheck, |
5361 // Check the previous value of the context slot and deoptimize if it's the | 5348 // Check the previous value of the context slot and deoptimize if it's the |
5362 // hole value. This is used for checking for assignments to uninitialized | 5349 // hole value. This is used for checking for assignments to uninitialized |
5363 // harmony bindings where we deoptimize into full-codegen generated code | 5350 // harmony bindings where we deoptimize into full-codegen generated code |
5364 // which will subsequently throw a reference error. | 5351 // which will subsequently throw a reference error. |
5365 kCheckDeoptimize, | 5352 kCheckDeoptimize, |
(...skipping 14 matching lines...) Expand all Loading... |
5380 } | 5367 } |
5381 | 5368 |
5382 bool DeoptimizesOnHole() { | 5369 bool DeoptimizesOnHole() { |
5383 return mode_ == kCheckDeoptimize; | 5370 return mode_ == kCheckDeoptimize; |
5384 } | 5371 } |
5385 | 5372 |
5386 bool RequiresHoleCheck() { | 5373 bool RequiresHoleCheck() { |
5387 return mode_ != kNoCheck; | 5374 return mode_ != kNoCheck; |
5388 } | 5375 } |
5389 | 5376 |
5390 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5377 virtual Representation RequiredInputRepresentation(int index) { |
5391 return Representation::Tagged(); | 5378 return Representation::Tagged(); |
5392 } | 5379 } |
5393 | 5380 |
5394 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 5381 virtual void PrintDataTo(StringStream* stream); |
5395 | 5382 |
5396 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) | 5383 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) |
5397 | 5384 |
5398 private: | 5385 private: |
5399 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value) | 5386 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value) |
5400 : slot_index_(slot_index), mode_(mode) { | 5387 : slot_index_(slot_index), mode_(mode) { |
5401 SetOperandAt(0, context); | 5388 SetOperandAt(0, context); |
5402 SetOperandAt(1, value); | 5389 SetOperandAt(1, value); |
5403 SetGVNFlag(kChangesContextSlots); | 5390 SetGVNFlag(kChangesContextSlots); |
5404 } | 5391 } |
5405 | 5392 |
5406 int slot_index_; | 5393 int slot_index_; |
5407 Mode mode_; | 5394 Mode mode_; |
5408 }; | 5395 }; |
5409 | 5396 |
5410 | 5397 |
5411 // Represents an access to a portion of an object, such as the map pointer, | 5398 // Represents an access to a portion of an object, such as the map pointer, |
5412 // array elements pointer, etc, but not accesses to array elements themselves. | 5399 // array elements pointer, etc, but not accesses to array elements themselves. |
5413 class HObjectAccess V8_FINAL { | 5400 class HObjectAccess { |
5414 public: | 5401 public: |
5415 inline bool IsInobject() const { | 5402 inline bool IsInobject() const { |
5416 return portion() != kBackingStore && portion() != kExternalMemory; | 5403 return portion() != kBackingStore && portion() != kExternalMemory; |
5417 } | 5404 } |
5418 | 5405 |
5419 inline bool IsExternalMemory() const { | 5406 inline bool IsExternalMemory() const { |
5420 return portion() == kExternalMemory; | 5407 return portion() == kExternalMemory; |
5421 } | 5408 } |
5422 | 5409 |
5423 inline bool IsStringLength() const { | 5410 inline bool IsStringLength() const { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5578 | 5565 |
5579 friend class HLoadNamedField; | 5566 friend class HLoadNamedField; |
5580 friend class HStoreNamedField; | 5567 friend class HStoreNamedField; |
5581 | 5568 |
5582 inline Portion portion() const { | 5569 inline Portion portion() const { |
5583 return PortionField::decode(value_); | 5570 return PortionField::decode(value_); |
5584 } | 5571 } |
5585 }; | 5572 }; |
5586 | 5573 |
5587 | 5574 |
5588 class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> { | 5575 class HLoadNamedField: public HTemplateInstruction<2> { |
5589 public: | 5576 public: |
5590 DECLARE_INSTRUCTION_FACTORY_P2(HLoadNamedField, HValue*, HObjectAccess); | 5577 DECLARE_INSTRUCTION_FACTORY_P2(HLoadNamedField, HValue*, HObjectAccess); |
5591 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, HObjectAccess, | 5578 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, HObjectAccess, |
5592 HValue*); | 5579 HValue*); |
5593 | 5580 |
5594 HValue* object() { return OperandAt(0); } | 5581 HValue* object() { return OperandAt(0); } |
5595 HValue* typecheck() { | 5582 HValue* typecheck() { |
5596 ASSERT(HasTypeCheck()); | 5583 ASSERT(HasTypeCheck()); |
5597 return OperandAt(1); | 5584 return OperandAt(1); |
5598 } | 5585 } |
5599 | 5586 |
5600 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); } | 5587 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); } |
5601 void ClearTypeCheck() { SetOperandAt(1, object()); } | 5588 void ClearTypeCheck() { SetOperandAt(1, object()); } |
5602 HObjectAccess access() const { return access_; } | 5589 HObjectAccess access() const { return access_; } |
5603 Representation field_representation() const { | 5590 Representation field_representation() const { |
5604 return access_.representation(); | 5591 return access_.representation(); |
5605 } | 5592 } |
5606 | 5593 |
5607 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } | 5594 virtual bool HasEscapingOperandAt(int index) { return false; } |
5608 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5595 virtual Representation RequiredInputRepresentation(int index) { |
5609 if (index == 0 && access().IsExternalMemory()) { | 5596 if (index == 0 && access().IsExternalMemory()) { |
5610 // object must be external in case of external memory access | 5597 // object must be external in case of external memory access |
5611 return Representation::External(); | 5598 return Representation::External(); |
5612 } | 5599 } |
5613 return Representation::Tagged(); | 5600 return Representation::Tagged(); |
5614 } | 5601 } |
5615 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 5602 virtual Range* InferRange(Zone* zone); |
5616 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 5603 virtual void PrintDataTo(StringStream* stream); |
5617 | 5604 |
5618 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) | 5605 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) |
5619 | 5606 |
5620 protected: | 5607 protected: |
5621 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 5608 virtual bool DataEquals(HValue* other) { |
5622 HLoadNamedField* b = HLoadNamedField::cast(other); | 5609 HLoadNamedField* b = HLoadNamedField::cast(other); |
5623 return access_.Equals(b->access_); | 5610 return access_.Equals(b->access_); |
5624 } | 5611 } |
5625 | 5612 |
5626 private: | 5613 private: |
5627 HLoadNamedField(HValue* object, | 5614 HLoadNamedField(HValue* object, |
5628 HObjectAccess access, | 5615 HObjectAccess access, |
5629 HValue* typecheck = NULL) | 5616 HValue* typecheck = NULL) |
5630 : access_(access) { | 5617 : access_(access) { |
5631 ASSERT(object != NULL); | 5618 ASSERT(object != NULL); |
(...skipping 11 matching lines...) Expand all Loading... |
5643 } else if (FLAG_track_heap_object_fields && | 5630 } else if (FLAG_track_heap_object_fields && |
5644 representation.IsHeapObject()) { | 5631 representation.IsHeapObject()) { |
5645 set_type(HType::NonPrimitive()); | 5632 set_type(HType::NonPrimitive()); |
5646 set_representation(Representation::Tagged()); | 5633 set_representation(Representation::Tagged()); |
5647 } else { | 5634 } else { |
5648 set_representation(Representation::Tagged()); | 5635 set_representation(Representation::Tagged()); |
5649 } | 5636 } |
5650 access.SetGVNFlags(this, false); | 5637 access.SetGVNFlags(this, false); |
5651 } | 5638 } |
5652 | 5639 |
5653 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 5640 virtual bool IsDeletable() const { return true; } |
5654 | 5641 |
5655 HObjectAccess access_; | 5642 HObjectAccess access_; |
5656 }; | 5643 }; |
5657 | 5644 |
5658 | 5645 |
5659 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> { | 5646 class HLoadNamedGeneric: public HTemplateInstruction<2> { |
5660 public: | 5647 public: |
5661 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name) | 5648 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name) |
5662 : name_(name) { | 5649 : name_(name) { |
5663 SetOperandAt(0, context); | 5650 SetOperandAt(0, context); |
5664 SetOperandAt(1, object); | 5651 SetOperandAt(1, object); |
5665 set_representation(Representation::Tagged()); | 5652 set_representation(Representation::Tagged()); |
5666 SetAllSideEffects(); | 5653 SetAllSideEffects(); |
5667 } | 5654 } |
5668 | 5655 |
5669 HValue* context() { return OperandAt(0); } | 5656 HValue* context() { return OperandAt(0); } |
5670 HValue* object() { return OperandAt(1); } | 5657 HValue* object() { return OperandAt(1); } |
5671 Handle<Object> name() const { return name_; } | 5658 Handle<Object> name() const { return name_; } |
5672 | 5659 |
5673 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5660 virtual Representation RequiredInputRepresentation(int index) { |
5674 return Representation::Tagged(); | 5661 return Representation::Tagged(); |
5675 } | 5662 } |
5676 | 5663 |
5677 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 5664 virtual void PrintDataTo(StringStream* stream); |
5678 | 5665 |
5679 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric) | 5666 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric) |
5680 | 5667 |
5681 private: | 5668 private: |
5682 Handle<Object> name_; | 5669 Handle<Object> name_; |
5683 }; | 5670 }; |
5684 | 5671 |
5685 | 5672 |
5686 class HLoadFunctionPrototype V8_FINAL : public HUnaryOperation { | 5673 class HLoadFunctionPrototype: public HUnaryOperation { |
5687 public: | 5674 public: |
5688 explicit HLoadFunctionPrototype(HValue* function) | 5675 explicit HLoadFunctionPrototype(HValue* function) |
5689 : HUnaryOperation(function) { | 5676 : HUnaryOperation(function) { |
5690 set_representation(Representation::Tagged()); | 5677 set_representation(Representation::Tagged()); |
5691 SetFlag(kUseGVN); | 5678 SetFlag(kUseGVN); |
5692 SetGVNFlag(kDependsOnCalls); | 5679 SetGVNFlag(kDependsOnCalls); |
5693 } | 5680 } |
5694 | 5681 |
5695 HValue* function() { return OperandAt(0); } | 5682 HValue* function() { return OperandAt(0); } |
5696 | 5683 |
5697 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5684 virtual Representation RequiredInputRepresentation(int index) { |
5698 return Representation::Tagged(); | 5685 return Representation::Tagged(); |
5699 } | 5686 } |
5700 | 5687 |
5701 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) | 5688 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) |
5702 | 5689 |
5703 protected: | 5690 protected: |
5704 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 5691 virtual bool DataEquals(HValue* other) { return true; } |
5705 }; | 5692 }; |
5706 | 5693 |
5707 class ArrayInstructionInterface { | 5694 class ArrayInstructionInterface { |
5708 public: | 5695 public: |
5709 virtual HValue* GetKey() = 0; | 5696 virtual HValue* GetKey() = 0; |
5710 virtual void SetKey(HValue* key) = 0; | 5697 virtual void SetKey(HValue* key) = 0; |
5711 virtual void SetIndexOffset(uint32_t index_offset) = 0; | 5698 virtual void SetIndexOffset(uint32_t index_offset) = 0; |
5712 virtual bool IsDehoisted() = 0; | 5699 virtual bool IsDehoisted() = 0; |
5713 virtual void SetDehoisted(bool is_dehoisted) = 0; | 5700 virtual void SetDehoisted(bool is_dehoisted) = 0; |
5714 virtual ~ArrayInstructionInterface() { }; | 5701 virtual ~ArrayInstructionInterface() { }; |
5715 | 5702 |
5716 static Representation KeyedAccessIndexRequirement(Representation r) { | 5703 static Representation KeyedAccessIndexRequirement(Representation r) { |
5717 return r.IsInteger32() || kSmiValueSize != 31 | 5704 return r.IsInteger32() || kSmiValueSize != 31 |
5718 ? Representation::Integer32() : Representation::Smi(); | 5705 ? Representation::Integer32() : Representation::Smi(); |
5719 } | 5706 } |
5720 }; | 5707 }; |
5721 | 5708 |
5722 | 5709 |
5723 enum LoadKeyedHoleMode { | 5710 enum LoadKeyedHoleMode { |
5724 NEVER_RETURN_HOLE, | 5711 NEVER_RETURN_HOLE, |
5725 ALLOW_RETURN_HOLE | 5712 ALLOW_RETURN_HOLE |
5726 }; | 5713 }; |
5727 | 5714 |
5728 | 5715 |
5729 class HLoadKeyed V8_FINAL | 5716 class HLoadKeyed |
5730 : public HTemplateInstruction<3>, public ArrayInstructionInterface { | 5717 : public HTemplateInstruction<3>, public ArrayInstructionInterface { |
5731 public: | 5718 public: |
5732 DECLARE_INSTRUCTION_FACTORY_P4(HLoadKeyed, HValue*, HValue*, HValue*, | 5719 DECLARE_INSTRUCTION_FACTORY_P4(HLoadKeyed, HValue*, HValue*, HValue*, |
5733 ElementsKind); | 5720 ElementsKind); |
5734 DECLARE_INSTRUCTION_FACTORY_P5(HLoadKeyed, HValue*, HValue*, HValue*, | 5721 DECLARE_INSTRUCTION_FACTORY_P5(HLoadKeyed, HValue*, HValue*, HValue*, |
5735 ElementsKind, LoadKeyedHoleMode); | 5722 ElementsKind, LoadKeyedHoleMode); |
5736 | 5723 |
5737 bool is_external() const { | 5724 bool is_external() const { |
5738 return IsExternalArrayElementsKind(elements_kind()); | 5725 return IsExternalArrayElementsKind(elements_kind()); |
5739 } | 5726 } |
(...skipping 14 matching lines...) Expand all Loading... |
5754 void SetDehoisted(bool is_dehoisted) { | 5741 void SetDehoisted(bool is_dehoisted) { |
5755 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); | 5742 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); |
5756 } | 5743 } |
5757 ElementsKind elements_kind() const { | 5744 ElementsKind elements_kind() const { |
5758 return ElementsKindField::decode(bit_field_); | 5745 return ElementsKindField::decode(bit_field_); |
5759 } | 5746 } |
5760 LoadKeyedHoleMode hole_mode() const { | 5747 LoadKeyedHoleMode hole_mode() const { |
5761 return HoleModeField::decode(bit_field_); | 5748 return HoleModeField::decode(bit_field_); |
5762 } | 5749 } |
5763 | 5750 |
5764 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5751 virtual Representation RequiredInputRepresentation(int index) { |
5765 // kind_fast: tagged[int32] (none) | 5752 // kind_fast: tagged[int32] (none) |
5766 // kind_double: tagged[int32] (none) | 5753 // kind_double: tagged[int32] (none) |
5767 // kind_external: external[int32] (none) | 5754 // kind_external: external[int32] (none) |
5768 if (index == 0) { | 5755 if (index == 0) { |
5769 return is_external() ? Representation::External() | 5756 return is_external() ? Representation::External() |
5770 : Representation::Tagged(); | 5757 : Representation::Tagged(); |
5771 } | 5758 } |
5772 if (index == 1) { | 5759 if (index == 1) { |
5773 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 5760 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
5774 OperandAt(1)->representation()); | 5761 OperandAt(1)->representation()); |
5775 } | 5762 } |
5776 return Representation::None(); | 5763 return Representation::None(); |
5777 } | 5764 } |
5778 | 5765 |
5779 virtual Representation observed_input_representation(int index) V8_OVERRIDE { | 5766 virtual Representation observed_input_representation(int index) { |
5780 return RequiredInputRepresentation(index); | 5767 return RequiredInputRepresentation(index); |
5781 } | 5768 } |
5782 | 5769 |
5783 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 5770 virtual void PrintDataTo(StringStream* stream); |
5784 | 5771 |
5785 bool UsesMustHandleHole() const; | 5772 bool UsesMustHandleHole() const; |
5786 bool AllUsesCanTreatHoleAsNaN() const; | 5773 bool AllUsesCanTreatHoleAsNaN() const; |
5787 bool RequiresHoleCheck() const; | 5774 bool RequiresHoleCheck() const; |
5788 | 5775 |
5789 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 5776 virtual Range* InferRange(Zone* zone); |
5790 | 5777 |
5791 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed) | 5778 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed) |
5792 | 5779 |
5793 protected: | 5780 protected: |
5794 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 5781 virtual bool DataEquals(HValue* other) { |
5795 if (!other->IsLoadKeyed()) return false; | 5782 if (!other->IsLoadKeyed()) return false; |
5796 HLoadKeyed* other_load = HLoadKeyed::cast(other); | 5783 HLoadKeyed* other_load = HLoadKeyed::cast(other); |
5797 | 5784 |
5798 if (IsDehoisted() && index_offset() != other_load->index_offset()) | 5785 if (IsDehoisted() && index_offset() != other_load->index_offset()) |
5799 return false; | 5786 return false; |
5800 return elements_kind() == other_load->elements_kind(); | 5787 return elements_kind() == other_load->elements_kind(); |
5801 } | 5788 } |
5802 | 5789 |
5803 private: | 5790 private: |
5804 HLoadKeyed(HValue* obj, | 5791 HLoadKeyed(HValue* obj, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5844 } | 5831 } |
5845 | 5832 |
5846 SetGVNFlag(kDependsOnExternalMemory); | 5833 SetGVNFlag(kDependsOnExternalMemory); |
5847 // Native code could change the specialized array. | 5834 // Native code could change the specialized array. |
5848 SetGVNFlag(kDependsOnCalls); | 5835 SetGVNFlag(kDependsOnCalls); |
5849 } | 5836 } |
5850 | 5837 |
5851 SetFlag(kUseGVN); | 5838 SetFlag(kUseGVN); |
5852 } | 5839 } |
5853 | 5840 |
5854 virtual bool IsDeletable() const V8_OVERRIDE { | 5841 virtual bool IsDeletable() const { |
5855 return !RequiresHoleCheck(); | 5842 return !RequiresHoleCheck(); |
5856 } | 5843 } |
5857 | 5844 |
5858 // Establish some checks around our packed fields | 5845 // Establish some checks around our packed fields |
5859 enum LoadKeyedBits { | 5846 enum LoadKeyedBits { |
5860 kBitsForElementsKind = 5, | 5847 kBitsForElementsKind = 5, |
5861 kBitsForHoleMode = 1, | 5848 kBitsForHoleMode = 1, |
5862 kBitsForIndexOffset = 25, | 5849 kBitsForIndexOffset = 25, |
5863 kBitsForIsDehoisted = 1, | 5850 kBitsForIsDehoisted = 1, |
5864 | 5851 |
(...skipping 15 matching lines...) Expand all Loading... |
5880 class IndexOffsetField: | 5867 class IndexOffsetField: |
5881 public BitField<uint32_t, kStartIndexOffset, kBitsForIndexOffset> | 5868 public BitField<uint32_t, kStartIndexOffset, kBitsForIndexOffset> |
5882 {}; // NOLINT | 5869 {}; // NOLINT |
5883 class IsDehoistedField: | 5870 class IsDehoistedField: |
5884 public BitField<bool, kStartIsDehoisted, kBitsForIsDehoisted> | 5871 public BitField<bool, kStartIsDehoisted, kBitsForIsDehoisted> |
5885 {}; // NOLINT | 5872 {}; // NOLINT |
5886 uint32_t bit_field_; | 5873 uint32_t bit_field_; |
5887 }; | 5874 }; |
5888 | 5875 |
5889 | 5876 |
5890 class HLoadKeyedGeneric V8_FINAL : public HTemplateInstruction<3> { | 5877 class HLoadKeyedGeneric: public HTemplateInstruction<3> { |
5891 public: | 5878 public: |
5892 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) { | 5879 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) { |
5893 set_representation(Representation::Tagged()); | 5880 set_representation(Representation::Tagged()); |
5894 SetOperandAt(0, obj); | 5881 SetOperandAt(0, obj); |
5895 SetOperandAt(1, key); | 5882 SetOperandAt(1, key); |
5896 SetOperandAt(2, context); | 5883 SetOperandAt(2, context); |
5897 SetAllSideEffects(); | 5884 SetAllSideEffects(); |
5898 } | 5885 } |
5899 | 5886 |
5900 HValue* object() { return OperandAt(0); } | 5887 HValue* object() { return OperandAt(0); } |
5901 HValue* key() { return OperandAt(1); } | 5888 HValue* key() { return OperandAt(1); } |
5902 HValue* context() { return OperandAt(2); } | 5889 HValue* context() { return OperandAt(2); } |
5903 | 5890 |
5904 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 5891 virtual void PrintDataTo(StringStream* stream); |
5905 | 5892 |
5906 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5893 virtual Representation RequiredInputRepresentation(int index) { |
5907 // tagged[tagged] | 5894 // tagged[tagged] |
5908 return Representation::Tagged(); | 5895 return Representation::Tagged(); |
5909 } | 5896 } |
5910 | 5897 |
5911 virtual HValue* Canonicalize() V8_OVERRIDE; | 5898 virtual HValue* Canonicalize(); |
5912 | 5899 |
5913 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) | 5900 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) |
5914 }; | 5901 }; |
5915 | 5902 |
5916 | 5903 |
5917 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> { | 5904 class HStoreNamedField: public HTemplateInstruction<3> { |
5918 public: | 5905 public: |
5919 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, | 5906 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, |
5920 HObjectAccess, HValue*); | 5907 HObjectAccess, HValue*); |
5921 | 5908 |
5922 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) | 5909 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
5923 | 5910 |
5924 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { | 5911 virtual bool HasEscapingOperandAt(int index) { return index == 1; } |
5925 return index == 1; | 5912 virtual Representation RequiredInputRepresentation(int index) { |
5926 } | |
5927 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | |
5928 if (index == 0 && access().IsExternalMemory()) { | 5913 if (index == 0 && access().IsExternalMemory()) { |
5929 // object must be external in case of external memory access | 5914 // object must be external in case of external memory access |
5930 return Representation::External(); | 5915 return Representation::External(); |
5931 } else if (index == 1 && | 5916 } else if (index == 1 && |
5932 (field_representation().IsDouble() || | 5917 (field_representation().IsDouble() || |
5933 field_representation().IsSmi() || | 5918 field_representation().IsSmi() || |
5934 field_representation().IsInteger32())) { | 5919 field_representation().IsInteger32())) { |
5935 return field_representation(); | 5920 return field_representation(); |
5936 } | 5921 } |
5937 return Representation::Tagged(); | 5922 return Representation::Tagged(); |
5938 } | 5923 } |
5939 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 5924 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
5940 HValue* dominator) V8_OVERRIDE { | 5925 HValue* dominator) { |
5941 ASSERT(side_effect == kChangesNewSpacePromotion); | 5926 ASSERT(side_effect == kChangesNewSpacePromotion); |
5942 new_space_dominator_ = dominator; | 5927 new_space_dominator_ = dominator; |
5943 } | 5928 } |
5944 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 5929 virtual void PrintDataTo(StringStream* stream); |
5945 | 5930 |
5946 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; } | 5931 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; } |
5947 bool IsSkipWriteBarrier() const { | 5932 bool IsSkipWriteBarrier() const { |
5948 return write_barrier_mode_ == SKIP_WRITE_BARRIER; | 5933 return write_barrier_mode_ == SKIP_WRITE_BARRIER; |
5949 } | 5934 } |
5950 | 5935 |
5951 HValue* object() const { return OperandAt(0); } | 5936 HValue* object() const { return OperandAt(0); } |
5952 HValue* value() const { return OperandAt(1); } | 5937 HValue* value() const { return OperandAt(1); } |
5953 HValue* transition() const { return OperandAt(2); } | 5938 HValue* transition() const { return OperandAt(2); } |
5954 | 5939 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6009 access.SetGVNFlags(this, true); | 5994 access.SetGVNFlags(this, true); |
6010 } | 5995 } |
6011 | 5996 |
6012 HObjectAccess access_; | 5997 HObjectAccess access_; |
6013 HValue* new_space_dominator_; | 5998 HValue* new_space_dominator_; |
6014 WriteBarrierMode write_barrier_mode_ : 1; | 5999 WriteBarrierMode write_barrier_mode_ : 1; |
6015 bool has_transition_ : 1; | 6000 bool has_transition_ : 1; |
6016 }; | 6001 }; |
6017 | 6002 |
6018 | 6003 |
6019 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { | 6004 class HStoreNamedGeneric: public HTemplateInstruction<3> { |
6020 public: | 6005 public: |
6021 HStoreNamedGeneric(HValue* context, | 6006 HStoreNamedGeneric(HValue* context, |
6022 HValue* object, | 6007 HValue* object, |
6023 Handle<String> name, | 6008 Handle<String> name, |
6024 HValue* value, | 6009 HValue* value, |
6025 StrictModeFlag strict_mode_flag) | 6010 StrictModeFlag strict_mode_flag) |
6026 : name_(name), | 6011 : name_(name), |
6027 strict_mode_flag_(strict_mode_flag) { | 6012 strict_mode_flag_(strict_mode_flag) { |
6028 SetOperandAt(0, object); | 6013 SetOperandAt(0, object); |
6029 SetOperandAt(1, value); | 6014 SetOperandAt(1, value); |
6030 SetOperandAt(2, context); | 6015 SetOperandAt(2, context); |
6031 SetAllSideEffects(); | 6016 SetAllSideEffects(); |
6032 } | 6017 } |
6033 | 6018 |
6034 HValue* object() { return OperandAt(0); } | 6019 HValue* object() { return OperandAt(0); } |
6035 HValue* value() { return OperandAt(1); } | 6020 HValue* value() { return OperandAt(1); } |
6036 HValue* context() { return OperandAt(2); } | 6021 HValue* context() { return OperandAt(2); } |
6037 Handle<String> name() { return name_; } | 6022 Handle<String> name() { return name_; } |
6038 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; } | 6023 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; } |
6039 | 6024 |
6040 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6025 virtual void PrintDataTo(StringStream* stream); |
6041 | 6026 |
6042 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6027 virtual Representation RequiredInputRepresentation(int index) { |
6043 return Representation::Tagged(); | 6028 return Representation::Tagged(); |
6044 } | 6029 } |
6045 | 6030 |
6046 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric) | 6031 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric) |
6047 | 6032 |
6048 private: | 6033 private: |
6049 Handle<String> name_; | 6034 Handle<String> name_; |
6050 StrictModeFlag strict_mode_flag_; | 6035 StrictModeFlag strict_mode_flag_; |
6051 }; | 6036 }; |
6052 | 6037 |
6053 | 6038 |
6054 class HStoreKeyed V8_FINAL | 6039 class HStoreKeyed |
6055 : public HTemplateInstruction<3>, public ArrayInstructionInterface { | 6040 : public HTemplateInstruction<3>, public ArrayInstructionInterface { |
6056 public: | 6041 public: |
6057 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, | 6042 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, |
6058 ElementsKind); | 6043 ElementsKind); |
6059 | 6044 |
6060 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6045 virtual Representation RequiredInputRepresentation(int index) { |
6061 // kind_fast: tagged[int32] = tagged | 6046 // kind_fast: tagged[int32] = tagged |
6062 // kind_double: tagged[int32] = double | 6047 // kind_double: tagged[int32] = double |
6063 // kind_smi : tagged[int32] = smi | 6048 // kind_smi : tagged[int32] = smi |
6064 // kind_external: external[int32] = (double | int32) | 6049 // kind_external: external[int32] = (double | int32) |
6065 if (index == 0) { | 6050 if (index == 0) { |
6066 return is_external() ? Representation::External() | 6051 return is_external() ? Representation::External() |
6067 : Representation::Tagged(); | 6052 : Representation::Tagged(); |
6068 } else if (index == 1) { | 6053 } else if (index == 1) { |
6069 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 6054 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
6070 OperandAt(1)->representation()); | 6055 OperandAt(1)->representation()); |
6071 } | 6056 } |
6072 | 6057 |
6073 ASSERT_EQ(index, 2); | 6058 ASSERT_EQ(index, 2); |
6074 if (IsDoubleOrFloatElementsKind(elements_kind())) { | 6059 if (IsDoubleOrFloatElementsKind(elements_kind())) { |
6075 return Representation::Double(); | 6060 return Representation::Double(); |
6076 } | 6061 } |
6077 | 6062 |
6078 if (IsFastSmiElementsKind(elements_kind())) { | 6063 if (IsFastSmiElementsKind(elements_kind())) { |
6079 return Representation::Smi(); | 6064 return Representation::Smi(); |
6080 } | 6065 } |
6081 | 6066 |
6082 return is_external() ? Representation::Integer32() | 6067 return is_external() ? Representation::Integer32() |
6083 : Representation::Tagged(); | 6068 : Representation::Tagged(); |
6084 } | 6069 } |
6085 | 6070 |
6086 bool is_external() const { | 6071 bool is_external() const { |
6087 return IsExternalArrayElementsKind(elements_kind()); | 6072 return IsExternalArrayElementsKind(elements_kind()); |
6088 } | 6073 } |
6089 | 6074 |
6090 virtual Representation observed_input_representation(int index) V8_OVERRIDE { | 6075 virtual Representation observed_input_representation(int index) { |
6091 if (index < 2) return RequiredInputRepresentation(index); | 6076 if (index < 2) return RequiredInputRepresentation(index); |
6092 if (IsUninitialized()) { | 6077 if (IsUninitialized()) { |
6093 return Representation::None(); | 6078 return Representation::None(); |
6094 } | 6079 } |
6095 if (IsFastSmiElementsKind(elements_kind())) { | 6080 if (IsFastSmiElementsKind(elements_kind())) { |
6096 return Representation::Smi(); | 6081 return Representation::Smi(); |
6097 } | 6082 } |
6098 if (IsDoubleOrFloatElementsKind(elements_kind())) { | 6083 if (IsDoubleOrFloatElementsKind(elements_kind())) { |
6099 return Representation::Double(); | 6084 return Representation::Double(); |
6100 } | 6085 } |
(...skipping 20 matching lines...) Expand all Loading... |
6121 bool IsUninitialized() { return is_uninitialized_; } | 6106 bool IsUninitialized() { return is_uninitialized_; } |
6122 void SetUninitialized(bool is_uninitialized) { | 6107 void SetUninitialized(bool is_uninitialized) { |
6123 is_uninitialized_ = is_uninitialized; | 6108 is_uninitialized_ = is_uninitialized; |
6124 } | 6109 } |
6125 | 6110 |
6126 bool IsConstantHoleStore() { | 6111 bool IsConstantHoleStore() { |
6127 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); | 6112 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); |
6128 } | 6113 } |
6129 | 6114 |
6130 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 6115 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
6131 HValue* dominator) V8_OVERRIDE { | 6116 HValue* dominator) { |
6132 ASSERT(side_effect == kChangesNewSpacePromotion); | 6117 ASSERT(side_effect == kChangesNewSpacePromotion); |
6133 new_space_dominator_ = dominator; | 6118 new_space_dominator_ = dominator; |
6134 } | 6119 } |
6135 | 6120 |
6136 HValue* new_space_dominator() const { return new_space_dominator_; } | 6121 HValue* new_space_dominator() const { return new_space_dominator_; } |
6137 | 6122 |
6138 bool NeedsWriteBarrier() { | 6123 bool NeedsWriteBarrier() { |
6139 if (value_is_smi()) { | 6124 if (value_is_smi()) { |
6140 return false; | 6125 return false; |
6141 } else { | 6126 } else { |
6142 return StoringValueNeedsWriteBarrier(value()) && | 6127 return StoringValueNeedsWriteBarrier(value()) && |
6143 ReceiverObjectNeedsWriteBarrier(elements(), new_space_dominator()); | 6128 ReceiverObjectNeedsWriteBarrier(elements(), new_space_dominator()); |
6144 } | 6129 } |
6145 } | 6130 } |
6146 | 6131 |
6147 bool NeedsCanonicalization(); | 6132 bool NeedsCanonicalization(); |
6148 | 6133 |
6149 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6134 virtual void PrintDataTo(StringStream* stream); |
6150 | 6135 |
6151 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) | 6136 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) |
6152 | 6137 |
6153 private: | 6138 private: |
6154 HStoreKeyed(HValue* obj, HValue* key, HValue* val, | 6139 HStoreKeyed(HValue* obj, HValue* key, HValue* val, |
6155 ElementsKind elements_kind) | 6140 ElementsKind elements_kind) |
6156 : elements_kind_(elements_kind), | 6141 : elements_kind_(elements_kind), |
6157 index_offset_(0), | 6142 index_offset_(0), |
6158 is_dehoisted_(false), | 6143 is_dehoisted_(false), |
6159 is_uninitialized_(false), | 6144 is_uninitialized_(false), |
(...skipping 25 matching lines...) Expand all Loading... |
6185 } | 6170 } |
6186 | 6171 |
6187 ElementsKind elements_kind_; | 6172 ElementsKind elements_kind_; |
6188 uint32_t index_offset_; | 6173 uint32_t index_offset_; |
6189 bool is_dehoisted_ : 1; | 6174 bool is_dehoisted_ : 1; |
6190 bool is_uninitialized_ : 1; | 6175 bool is_uninitialized_ : 1; |
6191 HValue* new_space_dominator_; | 6176 HValue* new_space_dominator_; |
6192 }; | 6177 }; |
6193 | 6178 |
6194 | 6179 |
6195 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { | 6180 class HStoreKeyedGeneric: public HTemplateInstruction<4> { |
6196 public: | 6181 public: |
6197 HStoreKeyedGeneric(HValue* context, | 6182 HStoreKeyedGeneric(HValue* context, |
6198 HValue* object, | 6183 HValue* object, |
6199 HValue* key, | 6184 HValue* key, |
6200 HValue* value, | 6185 HValue* value, |
6201 StrictModeFlag strict_mode_flag) | 6186 StrictModeFlag strict_mode_flag) |
6202 : strict_mode_flag_(strict_mode_flag) { | 6187 : strict_mode_flag_(strict_mode_flag) { |
6203 SetOperandAt(0, object); | 6188 SetOperandAt(0, object); |
6204 SetOperandAt(1, key); | 6189 SetOperandAt(1, key); |
6205 SetOperandAt(2, value); | 6190 SetOperandAt(2, value); |
6206 SetOperandAt(3, context); | 6191 SetOperandAt(3, context); |
6207 SetAllSideEffects(); | 6192 SetAllSideEffects(); |
6208 } | 6193 } |
6209 | 6194 |
6210 HValue* object() { return OperandAt(0); } | 6195 HValue* object() { return OperandAt(0); } |
6211 HValue* key() { return OperandAt(1); } | 6196 HValue* key() { return OperandAt(1); } |
6212 HValue* value() { return OperandAt(2); } | 6197 HValue* value() { return OperandAt(2); } |
6213 HValue* context() { return OperandAt(3); } | 6198 HValue* context() { return OperandAt(3); } |
6214 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; } | 6199 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; } |
6215 | 6200 |
6216 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6201 virtual Representation RequiredInputRepresentation(int index) { |
6217 // tagged[tagged] = tagged | 6202 // tagged[tagged] = tagged |
6218 return Representation::Tagged(); | 6203 return Representation::Tagged(); |
6219 } | 6204 } |
6220 | 6205 |
6221 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6206 virtual void PrintDataTo(StringStream* stream); |
6222 | 6207 |
6223 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) | 6208 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) |
6224 | 6209 |
6225 private: | 6210 private: |
6226 StrictModeFlag strict_mode_flag_; | 6211 StrictModeFlag strict_mode_flag_; |
6227 }; | 6212 }; |
6228 | 6213 |
6229 | 6214 |
6230 class HTransitionElementsKind V8_FINAL : public HTemplateInstruction<2> { | 6215 class HTransitionElementsKind: public HTemplateInstruction<2> { |
6231 public: | 6216 public: |
6232 inline static HTransitionElementsKind* New(Zone* zone, | 6217 inline static HTransitionElementsKind* New(Zone* zone, |
6233 HValue* context, | 6218 HValue* context, |
6234 HValue* object, | 6219 HValue* object, |
6235 Handle<Map> original_map, | 6220 Handle<Map> original_map, |
6236 Handle<Map> transitioned_map) { | 6221 Handle<Map> transitioned_map) { |
6237 return new(zone) HTransitionElementsKind(context, object, | 6222 return new(zone) HTransitionElementsKind(context, object, |
6238 original_map, transitioned_map); | 6223 original_map, transitioned_map); |
6239 } | 6224 } |
6240 | 6225 |
6241 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6226 virtual Representation RequiredInputRepresentation(int index) { |
6242 return Representation::Tagged(); | 6227 return Representation::Tagged(); |
6243 } | 6228 } |
6244 | 6229 |
6245 HValue* object() { return OperandAt(0); } | 6230 HValue* object() { return OperandAt(0); } |
6246 HValue* context() { return OperandAt(1); } | 6231 HValue* context() { return OperandAt(1); } |
6247 Handle<Map> original_map() { return original_map_; } | 6232 Handle<Map> original_map() { return original_map_; } |
6248 Handle<Map> transitioned_map() { return transitioned_map_; } | 6233 Handle<Map> transitioned_map() { return transitioned_map_; } |
6249 ElementsKind from_kind() { return from_kind_; } | 6234 ElementsKind from_kind() { return from_kind_; } |
6250 ElementsKind to_kind() { return to_kind_; } | 6235 ElementsKind to_kind() { return to_kind_; } |
6251 | 6236 |
6252 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6237 virtual void PrintDataTo(StringStream* stream); |
6253 | 6238 |
6254 virtual void FinalizeUniqueValueId() V8_OVERRIDE { | 6239 virtual void FinalizeUniqueValueId() { |
6255 original_map_unique_id_ = UniqueValueId(original_map_); | 6240 original_map_unique_id_ = UniqueValueId(original_map_); |
6256 transitioned_map_unique_id_ = UniqueValueId(transitioned_map_); | 6241 transitioned_map_unique_id_ = UniqueValueId(transitioned_map_); |
6257 } | 6242 } |
6258 | 6243 |
6259 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) | 6244 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) |
6260 | 6245 |
6261 protected: | 6246 protected: |
6262 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 6247 virtual bool DataEquals(HValue* other) { |
6263 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); | 6248 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); |
6264 return original_map_unique_id_ == instr->original_map_unique_id_ && | 6249 return original_map_unique_id_ == instr->original_map_unique_id_ && |
6265 transitioned_map_unique_id_ == instr->transitioned_map_unique_id_; | 6250 transitioned_map_unique_id_ == instr->transitioned_map_unique_id_; |
6266 } | 6251 } |
6267 | 6252 |
6268 private: | 6253 private: |
6269 HTransitionElementsKind(HValue* context, | 6254 HTransitionElementsKind(HValue* context, |
6270 HValue* object, | 6255 HValue* object, |
6271 Handle<Map> original_map, | 6256 Handle<Map> original_map, |
6272 Handle<Map> transitioned_map) | 6257 Handle<Map> transitioned_map) |
(...skipping 16 matching lines...) Expand all Loading... |
6289 | 6274 |
6290 Handle<Map> original_map_; | 6275 Handle<Map> original_map_; |
6291 Handle<Map> transitioned_map_; | 6276 Handle<Map> transitioned_map_; |
6292 UniqueValueId original_map_unique_id_; | 6277 UniqueValueId original_map_unique_id_; |
6293 UniqueValueId transitioned_map_unique_id_; | 6278 UniqueValueId transitioned_map_unique_id_; |
6294 ElementsKind from_kind_; | 6279 ElementsKind from_kind_; |
6295 ElementsKind to_kind_; | 6280 ElementsKind to_kind_; |
6296 }; | 6281 }; |
6297 | 6282 |
6298 | 6283 |
6299 class HStringAdd V8_FINAL : public HBinaryOperation { | 6284 class HStringAdd: public HBinaryOperation { |
6300 public: | 6285 public: |
6301 static HInstruction* New(Zone* zone, | 6286 static HInstruction* New(Zone* zone, |
6302 HValue* context, | 6287 HValue* context, |
6303 HValue* left, | 6288 HValue* left, |
6304 HValue* right, | 6289 HValue* right, |
6305 StringAddFlags flags = STRING_ADD_CHECK_NONE); | 6290 StringAddFlags flags = STRING_ADD_CHECK_NONE); |
6306 | 6291 |
6307 StringAddFlags flags() const { return flags_; } | 6292 StringAddFlags flags() const { return flags_; } |
6308 | 6293 |
6309 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6294 virtual Representation RequiredInputRepresentation(int index) { |
6310 return Representation::Tagged(); | 6295 return Representation::Tagged(); |
6311 } | 6296 } |
6312 | 6297 |
6313 DECLARE_CONCRETE_INSTRUCTION(StringAdd) | 6298 DECLARE_CONCRETE_INSTRUCTION(StringAdd) |
6314 | 6299 |
6315 protected: | 6300 protected: |
6316 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 6301 virtual bool DataEquals(HValue* other) { return true; } |
6317 | 6302 |
6318 private: | 6303 private: |
6319 HStringAdd(HValue* context, HValue* left, HValue* right, StringAddFlags flags) | 6304 HStringAdd(HValue* context, HValue* left, HValue* right, StringAddFlags flags) |
6320 : HBinaryOperation(context, left, right, HType::String()), flags_(flags) { | 6305 : HBinaryOperation(context, left, right, HType::String()), flags_(flags) { |
6321 set_representation(Representation::Tagged()); | 6306 set_representation(Representation::Tagged()); |
6322 SetFlag(kUseGVN); | 6307 SetFlag(kUseGVN); |
6323 SetGVNFlag(kDependsOnMaps); | 6308 SetGVNFlag(kDependsOnMaps); |
6324 SetGVNFlag(kChangesNewSpacePromotion); | 6309 SetGVNFlag(kChangesNewSpacePromotion); |
6325 } | 6310 } |
6326 | 6311 |
6327 // No side-effects except possible allocation. | 6312 // No side-effects except possible allocation. |
6328 // NOTE: this instruction _does not_ call ToString() on its inputs. | 6313 // NOTE: this instruction _does not_ call ToString() on its inputs. |
6329 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 6314 virtual bool IsDeletable() const { return true; } |
6330 | 6315 |
6331 const StringAddFlags flags_; | 6316 const StringAddFlags flags_; |
6332 }; | 6317 }; |
6333 | 6318 |
6334 | 6319 |
6335 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> { | 6320 class HStringCharCodeAt: public HTemplateInstruction<3> { |
6336 public: | 6321 public: |
6337 static HStringCharCodeAt* New(Zone* zone, | 6322 static HStringCharCodeAt* New(Zone* zone, |
6338 HValue* context, | 6323 HValue* context, |
6339 HValue* string, | 6324 HValue* string, |
6340 HValue* index) { | 6325 HValue* index) { |
6341 return new(zone) HStringCharCodeAt(context, string, index); | 6326 return new(zone) HStringCharCodeAt(context, string, index); |
6342 } | 6327 } |
6343 | 6328 |
6344 virtual Representation RequiredInputRepresentation(int index) { | 6329 virtual Representation RequiredInputRepresentation(int index) { |
6345 // The index is supposed to be Integer32. | 6330 // The index is supposed to be Integer32. |
6346 return index == 2 | 6331 return index == 2 |
6347 ? Representation::Integer32() | 6332 ? Representation::Integer32() |
6348 : Representation::Tagged(); | 6333 : Representation::Tagged(); |
6349 } | 6334 } |
6350 | 6335 |
6351 HValue* context() const { return OperandAt(0); } | 6336 HValue* context() const { return OperandAt(0); } |
6352 HValue* string() const { return OperandAt(1); } | 6337 HValue* string() const { return OperandAt(1); } |
6353 HValue* index() const { return OperandAt(2); } | 6338 HValue* index() const { return OperandAt(2); } |
6354 | 6339 |
6355 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) | 6340 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) |
6356 | 6341 |
6357 protected: | 6342 protected: |
6358 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 6343 virtual bool DataEquals(HValue* other) { return true; } |
6359 | 6344 |
6360 virtual Range* InferRange(Zone* zone) V8_OVERRIDE { | 6345 virtual Range* InferRange(Zone* zone) { |
6361 return new(zone) Range(0, String::kMaxUtf16CodeUnit); | 6346 return new(zone) Range(0, String::kMaxUtf16CodeUnit); |
6362 } | 6347 } |
6363 | 6348 |
6364 private: | 6349 private: |
6365 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { | 6350 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { |
6366 SetOperandAt(0, context); | 6351 SetOperandAt(0, context); |
6367 SetOperandAt(1, string); | 6352 SetOperandAt(1, string); |
6368 SetOperandAt(2, index); | 6353 SetOperandAt(2, index); |
6369 set_representation(Representation::Integer32()); | 6354 set_representation(Representation::Integer32()); |
6370 SetFlag(kUseGVN); | 6355 SetFlag(kUseGVN); |
6371 SetGVNFlag(kDependsOnMaps); | 6356 SetGVNFlag(kDependsOnMaps); |
6372 SetGVNFlag(kChangesNewSpacePromotion); | 6357 SetGVNFlag(kChangesNewSpacePromotion); |
6373 } | 6358 } |
6374 | 6359 |
6375 // No side effects: runtime function assumes string + number inputs. | 6360 // No side effects: runtime function assumes string + number inputs. |
6376 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 6361 virtual bool IsDeletable() const { return true; } |
6377 }; | 6362 }; |
6378 | 6363 |
6379 | 6364 |
6380 class HStringCharFromCode V8_FINAL : public HTemplateInstruction<2> { | 6365 class HStringCharFromCode: public HTemplateInstruction<2> { |
6381 public: | 6366 public: |
6382 static HInstruction* New(Zone* zone, | 6367 static HInstruction* New(Zone* zone, |
6383 HValue* context, | 6368 HValue* context, |
6384 HValue* char_code); | 6369 HValue* char_code); |
6385 | 6370 |
6386 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6371 virtual Representation RequiredInputRepresentation(int index) { |
6387 return index == 0 | 6372 return index == 0 |
6388 ? Representation::Tagged() | 6373 ? Representation::Tagged() |
6389 : Representation::Integer32(); | 6374 : Representation::Integer32(); |
6390 } | 6375 } |
6391 | 6376 |
6392 HValue* context() const { return OperandAt(0); } | 6377 HValue* context() const { return OperandAt(0); } |
6393 HValue* value() const { return OperandAt(1); } | 6378 HValue* value() const { return OperandAt(1); } |
6394 | 6379 |
6395 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 6380 virtual bool DataEquals(HValue* other) { return true; } |
6396 | 6381 |
6397 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) | 6382 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) |
6398 | 6383 |
6399 private: | 6384 private: |
6400 HStringCharFromCode(HValue* context, HValue* char_code) | 6385 HStringCharFromCode(HValue* context, HValue* char_code) |
6401 : HTemplateInstruction<2>(HType::String()) { | 6386 : HTemplateInstruction<2>(HType::String()) { |
6402 SetOperandAt(0, context); | 6387 SetOperandAt(0, context); |
6403 SetOperandAt(1, char_code); | 6388 SetOperandAt(1, char_code); |
6404 set_representation(Representation::Tagged()); | 6389 set_representation(Representation::Tagged()); |
6405 SetFlag(kUseGVN); | 6390 SetFlag(kUseGVN); |
6406 SetGVNFlag(kChangesNewSpacePromotion); | 6391 SetGVNFlag(kChangesNewSpacePromotion); |
6407 } | 6392 } |
6408 | 6393 |
6409 virtual bool IsDeletable() const V8_OVERRIDE { | 6394 virtual bool IsDeletable() const { |
6410 return !value()->ToNumberCanBeObserved(); | 6395 return !value()->ToNumberCanBeObserved(); |
6411 } | 6396 } |
6412 }; | 6397 }; |
6413 | 6398 |
6414 | 6399 |
6415 template <int V> | 6400 template <int V> |
6416 class HMaterializedLiteral : public HTemplateInstruction<V> { | 6401 class HMaterializedLiteral: public HTemplateInstruction<V> { |
6417 public: | 6402 public: |
6418 HMaterializedLiteral<V>(int index, int depth, AllocationSiteMode mode) | 6403 HMaterializedLiteral<V>(int index, int depth, AllocationSiteMode mode) |
6419 : literal_index_(index), depth_(depth), allocation_site_mode_(mode) { | 6404 : literal_index_(index), depth_(depth), allocation_site_mode_(mode) { |
6420 this->set_representation(Representation::Tagged()); | 6405 this->set_representation(Representation::Tagged()); |
6421 } | 6406 } |
6422 | 6407 |
6423 HMaterializedLiteral<V>(int index, int depth) | 6408 HMaterializedLiteral<V>(int index, int depth) |
6424 : literal_index_(index), depth_(depth), | 6409 : literal_index_(index), depth_(depth), |
6425 allocation_site_mode_(DONT_TRACK_ALLOCATION_SITE) { | 6410 allocation_site_mode_(DONT_TRACK_ALLOCATION_SITE) { |
6426 this->set_representation(Representation::Tagged()); | 6411 this->set_representation(Representation::Tagged()); |
6427 } | 6412 } |
6428 | 6413 |
6429 int literal_index() const { return literal_index_; } | 6414 int literal_index() const { return literal_index_; } |
6430 int depth() const { return depth_; } | 6415 int depth() const { return depth_; } |
6431 AllocationSiteMode allocation_site_mode() const { | 6416 AllocationSiteMode allocation_site_mode() const { |
6432 return allocation_site_mode_; | 6417 return allocation_site_mode_; |
6433 } | 6418 } |
6434 | 6419 |
6435 private: | 6420 private: |
6436 virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return true; } | 6421 virtual bool IsDeletable() const { return true; } |
6437 | 6422 |
6438 int literal_index_; | 6423 int literal_index_; |
6439 int depth_; | 6424 int depth_; |
6440 AllocationSiteMode allocation_site_mode_; | 6425 AllocationSiteMode allocation_site_mode_; |
6441 }; | 6426 }; |
6442 | 6427 |
6443 | 6428 |
6444 class HRegExpLiteral V8_FINAL : public HMaterializedLiteral<1> { | 6429 class HRegExpLiteral: public HMaterializedLiteral<1> { |
6445 public: | 6430 public: |
6446 HRegExpLiteral(HValue* context, | 6431 HRegExpLiteral(HValue* context, |
6447 Handle<FixedArray> literals, | 6432 Handle<FixedArray> literals, |
6448 Handle<String> pattern, | 6433 Handle<String> pattern, |
6449 Handle<String> flags, | 6434 Handle<String> flags, |
6450 int literal_index) | 6435 int literal_index) |
6451 : HMaterializedLiteral<1>(literal_index, 0), | 6436 : HMaterializedLiteral<1>(literal_index, 0), |
6452 literals_(literals), | 6437 literals_(literals), |
6453 pattern_(pattern), | 6438 pattern_(pattern), |
6454 flags_(flags) { | 6439 flags_(flags) { |
6455 SetOperandAt(0, context); | 6440 SetOperandAt(0, context); |
6456 SetAllSideEffects(); | 6441 SetAllSideEffects(); |
6457 set_type(HType::JSObject()); | 6442 set_type(HType::JSObject()); |
6458 } | 6443 } |
6459 | 6444 |
6460 HValue* context() { return OperandAt(0); } | 6445 HValue* context() { return OperandAt(0); } |
6461 Handle<FixedArray> literals() { return literals_; } | 6446 Handle<FixedArray> literals() { return literals_; } |
6462 Handle<String> pattern() { return pattern_; } | 6447 Handle<String> pattern() { return pattern_; } |
6463 Handle<String> flags() { return flags_; } | 6448 Handle<String> flags() { return flags_; } |
6464 | 6449 |
6465 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6450 virtual Representation RequiredInputRepresentation(int index) { |
6466 return Representation::Tagged(); | 6451 return Representation::Tagged(); |
6467 } | 6452 } |
6468 | 6453 |
6469 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) | 6454 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) |
6470 | 6455 |
6471 private: | 6456 private: |
6472 Handle<FixedArray> literals_; | 6457 Handle<FixedArray> literals_; |
6473 Handle<String> pattern_; | 6458 Handle<String> pattern_; |
6474 Handle<String> flags_; | 6459 Handle<String> flags_; |
6475 }; | 6460 }; |
6476 | 6461 |
6477 | 6462 |
6478 class HFunctionLiteral V8_FINAL : public HTemplateInstruction<1> { | 6463 class HFunctionLiteral: public HTemplateInstruction<1> { |
6479 public: | 6464 public: |
6480 HFunctionLiteral(HValue* context, | 6465 HFunctionLiteral(HValue* context, |
6481 Handle<SharedFunctionInfo> shared, | 6466 Handle<SharedFunctionInfo> shared, |
6482 bool pretenure) | 6467 bool pretenure) |
6483 : HTemplateInstruction<1>(HType::JSObject()), | 6468 : HTemplateInstruction<1>(HType::JSObject()), |
6484 shared_info_(shared), | 6469 shared_info_(shared), |
6485 pretenure_(pretenure), | 6470 pretenure_(pretenure), |
6486 has_no_literals_(shared->num_literals() == 0), | 6471 has_no_literals_(shared->num_literals() == 0), |
6487 is_generator_(shared->is_generator()), | 6472 is_generator_(shared->is_generator()), |
6488 language_mode_(shared->language_mode()) { | 6473 language_mode_(shared->language_mode()) { |
6489 SetOperandAt(0, context); | 6474 SetOperandAt(0, context); |
6490 set_representation(Representation::Tagged()); | 6475 set_representation(Representation::Tagged()); |
6491 SetGVNFlag(kChangesNewSpacePromotion); | 6476 SetGVNFlag(kChangesNewSpacePromotion); |
6492 } | 6477 } |
6493 | 6478 |
6494 HValue* context() { return OperandAt(0); } | 6479 HValue* context() { return OperandAt(0); } |
6495 | 6480 |
6496 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6481 virtual Representation RequiredInputRepresentation(int index) { |
6497 return Representation::Tagged(); | 6482 return Representation::Tagged(); |
6498 } | 6483 } |
6499 | 6484 |
6500 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) | 6485 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) |
6501 | 6486 |
6502 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } | 6487 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } |
6503 bool pretenure() const { return pretenure_; } | 6488 bool pretenure() const { return pretenure_; } |
6504 bool has_no_literals() const { return has_no_literals_; } | 6489 bool has_no_literals() const { return has_no_literals_; } |
6505 bool is_generator() const { return is_generator_; } | 6490 bool is_generator() const { return is_generator_; } |
6506 LanguageMode language_mode() const { return language_mode_; } | 6491 LanguageMode language_mode() const { return language_mode_; } |
6507 | 6492 |
6508 private: | 6493 private: |
6509 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 6494 virtual bool IsDeletable() const { return true; } |
6510 | 6495 |
6511 Handle<SharedFunctionInfo> shared_info_; | 6496 Handle<SharedFunctionInfo> shared_info_; |
6512 bool pretenure_ : 1; | 6497 bool pretenure_ : 1; |
6513 bool has_no_literals_ : 1; | 6498 bool has_no_literals_ : 1; |
6514 bool is_generator_ : 1; | 6499 bool is_generator_ : 1; |
6515 LanguageMode language_mode_; | 6500 LanguageMode language_mode_; |
6516 }; | 6501 }; |
6517 | 6502 |
6518 | 6503 |
6519 class HTypeof V8_FINAL : public HTemplateInstruction<2> { | 6504 class HTypeof: public HTemplateInstruction<2> { |
6520 public: | 6505 public: |
6521 explicit HTypeof(HValue* context, HValue* value) { | 6506 explicit HTypeof(HValue* context, HValue* value) { |
6522 SetOperandAt(0, context); | 6507 SetOperandAt(0, context); |
6523 SetOperandAt(1, value); | 6508 SetOperandAt(1, value); |
6524 set_representation(Representation::Tagged()); | 6509 set_representation(Representation::Tagged()); |
6525 } | 6510 } |
6526 | 6511 |
6527 HValue* context() { return OperandAt(0); } | 6512 HValue* context() { return OperandAt(0); } |
6528 HValue* value() { return OperandAt(1); } | 6513 HValue* value() { return OperandAt(1); } |
6529 | 6514 |
6530 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6515 virtual void PrintDataTo(StringStream* stream); |
6531 | 6516 |
6532 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6517 virtual Representation RequiredInputRepresentation(int index) { |
6533 return Representation::Tagged(); | 6518 return Representation::Tagged(); |
6534 } | 6519 } |
6535 | 6520 |
6536 DECLARE_CONCRETE_INSTRUCTION(Typeof) | 6521 DECLARE_CONCRETE_INSTRUCTION(Typeof) |
6537 | 6522 |
6538 private: | 6523 private: |
6539 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 6524 virtual bool IsDeletable() const { return true; } |
6540 }; | 6525 }; |
6541 | 6526 |
6542 | 6527 |
6543 class HTrapAllocationMemento V8_FINAL : public HTemplateInstruction<1> { | 6528 class HTrapAllocationMemento : public HTemplateInstruction<1> { |
6544 public: | 6529 public: |
6545 DECLARE_INSTRUCTION_FACTORY_P1(HTrapAllocationMemento, HValue*); | 6530 DECLARE_INSTRUCTION_FACTORY_P1(HTrapAllocationMemento, HValue*); |
6546 | 6531 |
6547 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6532 virtual Representation RequiredInputRepresentation(int index) { |
6548 return Representation::Tagged(); | 6533 return Representation::Tagged(); |
6549 } | 6534 } |
6550 | 6535 |
6551 HValue* object() { return OperandAt(0); } | 6536 HValue* object() { return OperandAt(0); } |
6552 | 6537 |
6553 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento) | 6538 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento) |
6554 | 6539 |
6555 private: | 6540 private: |
6556 explicit HTrapAllocationMemento(HValue* obj) { | 6541 explicit HTrapAllocationMemento(HValue* obj) { |
6557 SetOperandAt(0, obj); | 6542 SetOperandAt(0, obj); |
6558 } | 6543 } |
6559 }; | 6544 }; |
6560 | 6545 |
6561 | 6546 |
6562 class HToFastProperties V8_FINAL : public HUnaryOperation { | 6547 class HToFastProperties: public HUnaryOperation { |
6563 public: | 6548 public: |
6564 DECLARE_INSTRUCTION_FACTORY_P1(HToFastProperties, HValue*); | 6549 DECLARE_INSTRUCTION_FACTORY_P1(HToFastProperties, HValue*); |
6565 | 6550 |
6566 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6551 virtual Representation RequiredInputRepresentation(int index) { |
6567 return Representation::Tagged(); | 6552 return Representation::Tagged(); |
6568 } | 6553 } |
6569 | 6554 |
6570 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) | 6555 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) |
6571 | 6556 |
6572 private: | 6557 private: |
6573 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { | 6558 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { |
6574 set_representation(Representation::Tagged()); | 6559 set_representation(Representation::Tagged()); |
6575 SetGVNFlag(kChangesNewSpacePromotion); | 6560 SetGVNFlag(kChangesNewSpacePromotion); |
6576 | 6561 |
6577 // This instruction is not marked as kChangesMaps, but does | 6562 // This instruction is not marked as kChangesMaps, but does |
6578 // change the map of the input operand. Use it only when creating | 6563 // change the map of the input operand. Use it only when creating |
6579 // object literals via a runtime call. | 6564 // object literals via a runtime call. |
6580 ASSERT(value->IsCallRuntime()); | 6565 ASSERT(value->IsCallRuntime()); |
6581 #ifdef DEBUG | 6566 #ifdef DEBUG |
6582 const Runtime::Function* function = HCallRuntime::cast(value)->function(); | 6567 const Runtime::Function* function = HCallRuntime::cast(value)->function(); |
6583 ASSERT(function->function_id == Runtime::kCreateObjectLiteral || | 6568 ASSERT(function->function_id == Runtime::kCreateObjectLiteral || |
6584 function->function_id == Runtime::kCreateObjectLiteralShallow); | 6569 function->function_id == Runtime::kCreateObjectLiteralShallow); |
6585 #endif | 6570 #endif |
6586 } | 6571 } |
6587 | 6572 |
6588 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 6573 virtual bool IsDeletable() const { return true; } |
6589 }; | 6574 }; |
6590 | 6575 |
6591 | 6576 |
6592 class HValueOf V8_FINAL : public HUnaryOperation { | 6577 class HValueOf: public HUnaryOperation { |
6593 public: | 6578 public: |
6594 explicit HValueOf(HValue* value) : HUnaryOperation(value) { | 6579 explicit HValueOf(HValue* value) : HUnaryOperation(value) { |
6595 set_representation(Representation::Tagged()); | 6580 set_representation(Representation::Tagged()); |
6596 } | 6581 } |
6597 | 6582 |
6598 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6583 virtual Representation RequiredInputRepresentation(int index) { |
6599 return Representation::Tagged(); | 6584 return Representation::Tagged(); |
6600 } | 6585 } |
6601 | 6586 |
6602 DECLARE_CONCRETE_INSTRUCTION(ValueOf) | 6587 DECLARE_CONCRETE_INSTRUCTION(ValueOf) |
6603 | 6588 |
6604 private: | 6589 private: |
6605 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 6590 virtual bool IsDeletable() const { return true; } |
6606 }; | 6591 }; |
6607 | 6592 |
6608 | 6593 |
6609 class HDateField V8_FINAL : public HUnaryOperation { | 6594 class HDateField: public HUnaryOperation { |
6610 public: | 6595 public: |
6611 HDateField(HValue* date, Smi* index) | 6596 HDateField(HValue* date, Smi* index) |
6612 : HUnaryOperation(date), index_(index) { | 6597 : HUnaryOperation(date), index_(index) { |
6613 set_representation(Representation::Tagged()); | 6598 set_representation(Representation::Tagged()); |
6614 } | 6599 } |
6615 | 6600 |
6616 Smi* index() const { return index_; } | 6601 Smi* index() const { return index_; } |
6617 | 6602 |
6618 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6603 virtual Representation RequiredInputRepresentation(int index) { |
6619 return Representation::Tagged(); | 6604 return Representation::Tagged(); |
6620 } | 6605 } |
6621 | 6606 |
6622 DECLARE_CONCRETE_INSTRUCTION(DateField) | 6607 DECLARE_CONCRETE_INSTRUCTION(DateField) |
6623 | 6608 |
6624 private: | 6609 private: |
6625 Smi* index_; | 6610 Smi* index_; |
6626 }; | 6611 }; |
6627 | 6612 |
6628 | 6613 |
6629 class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<3> { | 6614 class HSeqStringSetChar: public HTemplateInstruction<3> { |
6630 public: | 6615 public: |
6631 HSeqStringSetChar(String::Encoding encoding, | 6616 HSeqStringSetChar(String::Encoding encoding, |
6632 HValue* string, | 6617 HValue* string, |
6633 HValue* index, | 6618 HValue* index, |
6634 HValue* value) : encoding_(encoding) { | 6619 HValue* value) : encoding_(encoding) { |
6635 SetOperandAt(0, string); | 6620 SetOperandAt(0, string); |
6636 SetOperandAt(1, index); | 6621 SetOperandAt(1, index); |
6637 SetOperandAt(2, value); | 6622 SetOperandAt(2, value); |
6638 set_representation(Representation::Tagged()); | 6623 set_representation(Representation::Tagged()); |
6639 } | 6624 } |
6640 | 6625 |
6641 String::Encoding encoding() { return encoding_; } | 6626 String::Encoding encoding() { return encoding_; } |
6642 HValue* string() { return OperandAt(0); } | 6627 HValue* string() { return OperandAt(0); } |
6643 HValue* index() { return OperandAt(1); } | 6628 HValue* index() { return OperandAt(1); } |
6644 HValue* value() { return OperandAt(2); } | 6629 HValue* value() { return OperandAt(2); } |
6645 | 6630 |
6646 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6631 virtual Representation RequiredInputRepresentation(int index) { |
6647 return (index == 0) ? Representation::Tagged() | 6632 return (index == 0) ? Representation::Tagged() |
6648 : Representation::Integer32(); | 6633 : Representation::Integer32(); |
6649 } | 6634 } |
6650 | 6635 |
6651 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar) | 6636 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar) |
6652 | 6637 |
6653 private: | 6638 private: |
6654 String::Encoding encoding_; | 6639 String::Encoding encoding_; |
6655 }; | 6640 }; |
6656 | 6641 |
6657 | 6642 |
6658 class HCheckMapValue V8_FINAL : public HTemplateInstruction<2> { | 6643 class HCheckMapValue: public HTemplateInstruction<2> { |
6659 public: | 6644 public: |
6660 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*); | 6645 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*); |
6661 | 6646 |
6662 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6647 virtual Representation RequiredInputRepresentation(int index) { |
6663 return Representation::Tagged(); | 6648 return Representation::Tagged(); |
6664 } | 6649 } |
6665 | 6650 |
6666 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6651 virtual void PrintDataTo(StringStream* stream); |
6667 | 6652 |
6668 virtual HType CalculateInferredType() V8_OVERRIDE { | 6653 virtual HType CalculateInferredType() { |
6669 return HType::Tagged(); | 6654 return HType::Tagged(); |
6670 } | 6655 } |
6671 | 6656 |
6672 HValue* value() { return OperandAt(0); } | 6657 HValue* value() { return OperandAt(0); } |
6673 HValue* map() { return OperandAt(1); } | 6658 HValue* map() { return OperandAt(1); } |
6674 | 6659 |
6675 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue) | 6660 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue) |
6676 | 6661 |
6677 protected: | 6662 protected: |
6678 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 6663 virtual bool DataEquals(HValue* other) { |
6679 return true; | 6664 return true; |
6680 } | 6665 } |
6681 | 6666 |
6682 private: | 6667 private: |
6683 HCheckMapValue(HValue* value, | 6668 HCheckMapValue(HValue* value, |
6684 HValue* map) { | 6669 HValue* map) { |
6685 SetOperandAt(0, value); | 6670 SetOperandAt(0, value); |
6686 SetOperandAt(1, map); | 6671 SetOperandAt(1, map); |
6687 set_representation(Representation::Tagged()); | 6672 set_representation(Representation::Tagged()); |
6688 SetFlag(kUseGVN); | 6673 SetFlag(kUseGVN); |
6689 SetGVNFlag(kDependsOnMaps); | 6674 SetGVNFlag(kDependsOnMaps); |
6690 SetGVNFlag(kDependsOnElementsKind); | 6675 SetGVNFlag(kDependsOnElementsKind); |
6691 } | 6676 } |
6692 }; | 6677 }; |
6693 | 6678 |
6694 | 6679 |
6695 class HForInPrepareMap V8_FINAL : public HTemplateInstruction<2> { | 6680 class HForInPrepareMap : public HTemplateInstruction<2> { |
6696 public: | 6681 public: |
6697 static HForInPrepareMap* New(Zone* zone, | 6682 static HForInPrepareMap* New(Zone* zone, |
6698 HValue* context, | 6683 HValue* context, |
6699 HValue* object) { | 6684 HValue* object) { |
6700 return new(zone) HForInPrepareMap(context, object); | 6685 return new(zone) HForInPrepareMap(context, object); |
6701 } | 6686 } |
6702 | 6687 |
6703 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6688 virtual Representation RequiredInputRepresentation(int index) { |
6704 return Representation::Tagged(); | 6689 return Representation::Tagged(); |
6705 } | 6690 } |
6706 | 6691 |
6707 HValue* context() { return OperandAt(0); } | 6692 HValue* context() { return OperandAt(0); } |
6708 HValue* enumerable() { return OperandAt(1); } | 6693 HValue* enumerable() { return OperandAt(1); } |
6709 | 6694 |
6710 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6695 virtual void PrintDataTo(StringStream* stream); |
6711 | 6696 |
6712 virtual HType CalculateInferredType() V8_OVERRIDE { | 6697 virtual HType CalculateInferredType() { |
6713 return HType::Tagged(); | 6698 return HType::Tagged(); |
6714 } | 6699 } |
6715 | 6700 |
6716 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap); | 6701 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap); |
6717 | 6702 |
6718 private: | 6703 private: |
6719 HForInPrepareMap(HValue* context, | 6704 HForInPrepareMap(HValue* context, |
6720 HValue* object) { | 6705 HValue* object) { |
6721 SetOperandAt(0, context); | 6706 SetOperandAt(0, context); |
6722 SetOperandAt(1, object); | 6707 SetOperandAt(1, object); |
6723 set_representation(Representation::Tagged()); | 6708 set_representation(Representation::Tagged()); |
6724 SetAllSideEffects(); | 6709 SetAllSideEffects(); |
6725 } | 6710 } |
6726 }; | 6711 }; |
6727 | 6712 |
6728 | 6713 |
6729 class HForInCacheArray V8_FINAL : public HTemplateInstruction<2> { | 6714 class HForInCacheArray : public HTemplateInstruction<2> { |
6730 public: | 6715 public: |
6731 DECLARE_INSTRUCTION_FACTORY_P3(HForInCacheArray, HValue*, HValue*, int); | 6716 DECLARE_INSTRUCTION_FACTORY_P3(HForInCacheArray, HValue*, HValue*, int); |
6732 | 6717 |
6733 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6718 virtual Representation RequiredInputRepresentation(int index) { |
6734 return Representation::Tagged(); | 6719 return Representation::Tagged(); |
6735 } | 6720 } |
6736 | 6721 |
6737 HValue* enumerable() { return OperandAt(0); } | 6722 HValue* enumerable() { return OperandAt(0); } |
6738 HValue* map() { return OperandAt(1); } | 6723 HValue* map() { return OperandAt(1); } |
6739 int idx() { return idx_; } | 6724 int idx() { return idx_; } |
6740 | 6725 |
6741 HForInCacheArray* index_cache() { | 6726 HForInCacheArray* index_cache() { |
6742 return index_cache_; | 6727 return index_cache_; |
6743 } | 6728 } |
6744 | 6729 |
6745 void set_index_cache(HForInCacheArray* index_cache) { | 6730 void set_index_cache(HForInCacheArray* index_cache) { |
6746 index_cache_ = index_cache; | 6731 index_cache_ = index_cache; |
6747 } | 6732 } |
6748 | 6733 |
6749 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6734 virtual void PrintDataTo(StringStream* stream); |
6750 | 6735 |
6751 virtual HType CalculateInferredType() V8_OVERRIDE { | 6736 virtual HType CalculateInferredType() { |
6752 return HType::Tagged(); | 6737 return HType::Tagged(); |
6753 } | 6738 } |
6754 | 6739 |
6755 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray); | 6740 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray); |
6756 | 6741 |
6757 private: | 6742 private: |
6758 HForInCacheArray(HValue* enumerable, | 6743 HForInCacheArray(HValue* enumerable, |
6759 HValue* keys, | 6744 HValue* keys, |
6760 int idx) : idx_(idx) { | 6745 int idx) : idx_(idx) { |
6761 SetOperandAt(0, enumerable); | 6746 SetOperandAt(0, enumerable); |
6762 SetOperandAt(1, keys); | 6747 SetOperandAt(1, keys); |
6763 set_representation(Representation::Tagged()); | 6748 set_representation(Representation::Tagged()); |
6764 } | 6749 } |
6765 | 6750 |
6766 int idx_; | 6751 int idx_; |
6767 HForInCacheArray* index_cache_; | 6752 HForInCacheArray* index_cache_; |
6768 }; | 6753 }; |
6769 | 6754 |
6770 | 6755 |
6771 class HLoadFieldByIndex V8_FINAL : public HTemplateInstruction<2> { | 6756 class HLoadFieldByIndex : public HTemplateInstruction<2> { |
6772 public: | 6757 public: |
6773 HLoadFieldByIndex(HValue* object, | 6758 HLoadFieldByIndex(HValue* object, |
6774 HValue* index) { | 6759 HValue* index) { |
6775 SetOperandAt(0, object); | 6760 SetOperandAt(0, object); |
6776 SetOperandAt(1, index); | 6761 SetOperandAt(1, index); |
6777 set_representation(Representation::Tagged()); | 6762 set_representation(Representation::Tagged()); |
6778 } | 6763 } |
6779 | 6764 |
6780 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6765 virtual Representation RequiredInputRepresentation(int index) { |
6781 return Representation::Tagged(); | 6766 return Representation::Tagged(); |
6782 } | 6767 } |
6783 | 6768 |
6784 HValue* object() { return OperandAt(0); } | 6769 HValue* object() { return OperandAt(0); } |
6785 HValue* index() { return OperandAt(1); } | 6770 HValue* index() { return OperandAt(1); } |
6786 | 6771 |
6787 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6772 virtual void PrintDataTo(StringStream* stream); |
6788 | 6773 |
6789 virtual HType CalculateInferredType() V8_OVERRIDE { | 6774 virtual HType CalculateInferredType() { |
6790 return HType::Tagged(); | 6775 return HType::Tagged(); |
6791 } | 6776 } |
6792 | 6777 |
6793 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); | 6778 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); |
6794 | 6779 |
6795 private: | 6780 private: |
6796 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 6781 virtual bool IsDeletable() const { return true; } |
6797 }; | 6782 }; |
6798 | 6783 |
6799 | 6784 |
6800 #undef DECLARE_INSTRUCTION | 6785 #undef DECLARE_INSTRUCTION |
6801 #undef DECLARE_CONCRETE_INSTRUCTION | 6786 #undef DECLARE_CONCRETE_INSTRUCTION |
6802 | 6787 |
6803 } } // namespace v8::internal | 6788 } } // namespace v8::internal |
6804 | 6789 |
6805 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6790 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |