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

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

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

Powered by Google App Engine
This is Rietveld 408576698