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

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

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

Powered by Google App Engine
This is Rietveld 408576698