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

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

Issue 526223002: Use Chrome compatible naming for compiler specifics. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: mips Created 6 years, 3 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-gvn.cc ('k') | src/hydrogen-types.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_
6 #define V8_HYDROGEN_INSTRUCTIONS_H_ 6 #define V8_HYDROGEN_INSTRUCTIONS_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 V(GlobalVars) \ 182 V(GlobalVars) \
183 V(InobjectFields) \ 183 V(InobjectFields) \
184 V(Maps) \ 184 V(Maps) \
185 V(OsrEntries) \ 185 V(OsrEntries) \
186 V(ExternalMemory) \ 186 V(ExternalMemory) \
187 V(StringChars) \ 187 V(StringChars) \
188 V(TypedArrayElements) 188 V(TypedArrayElements)
189 189
190 190
191 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ 191 #define DECLARE_ABSTRACT_INSTRUCTION(type) \
192 virtual bool Is##type() const V8_FINAL V8_OVERRIDE { return true; } \ 192 virtual bool Is##type() const FINAL OVERRIDE { return true; } \
193 static H##type* cast(HValue* value) { \ 193 static H##type* cast(HValue* value) { \
194 DCHECK(value->Is##type()); \ 194 DCHECK(value->Is##type()); \
195 return reinterpret_cast<H##type*>(value); \ 195 return reinterpret_cast<H##type*>(value); \
196 } 196 }
197 197
198 198
199 #define DECLARE_CONCRETE_INSTRUCTION(type) \ 199 #define DECLARE_CONCRETE_INSTRUCTION(type) \
200 virtual LInstruction* CompileToLithium( \ 200 virtual LInstruction* CompileToLithium( \
201 LChunkBuilder* builder) V8_FINAL V8_OVERRIDE; \ 201 LChunkBuilder* builder) FINAL OVERRIDE; \
202 static H##type* cast(HValue* value) { \ 202 static H##type* cast(HValue* value) { \
203 DCHECK(value->Is##type()); \ 203 DCHECK(value->Is##type()); \
204 return reinterpret_cast<H##type*>(value); \ 204 return reinterpret_cast<H##type*>(value); \
205 } \ 205 } \
206 virtual Opcode opcode() const V8_FINAL V8_OVERRIDE { \ 206 virtual Opcode opcode() const FINAL OVERRIDE { \
207 return HValue::k##type; \ 207 return HValue::k##type; \
208 } 208 }
209 209
210 210
211 enum PropertyAccessType { LOAD, STORE }; 211 enum PropertyAccessType { LOAD, STORE };
212 212
213 213
214 class Range V8_FINAL : public ZoneObject { 214 class Range FINAL : public ZoneObject {
215 public: 215 public:
216 Range() 216 Range()
217 : lower_(kMinInt), 217 : lower_(kMinInt),
218 upper_(kMaxInt), 218 upper_(kMaxInt),
219 next_(NULL), 219 next_(NULL),
220 can_be_minus_zero_(false) { } 220 can_be_minus_zero_(false) { }
221 221
222 Range(int32_t lower, int32_t upper) 222 Range(int32_t lower, int32_t upper)
223 : lower_(lower), 223 : lower_(lower),
224 upper_(upper), 224 upper_(upper),
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 308
309 private: 309 private:
310 HUseListNode* tail_; 310 HUseListNode* tail_;
311 HValue* value_; 311 HValue* value_;
312 int index_; 312 int index_;
313 }; 313 };
314 314
315 315
316 // We reuse use list nodes behind the scenes as uses are added and deleted. 316 // We reuse use list nodes behind the scenes as uses are added and deleted.
317 // This class is the safe way to iterate uses while deleting them. 317 // This class is the safe way to iterate uses while deleting them.
318 class HUseIterator V8_FINAL BASE_EMBEDDED { 318 class HUseIterator FINAL BASE_EMBEDDED {
319 public: 319 public:
320 bool Done() { return current_ == NULL; } 320 bool Done() { return current_ == NULL; }
321 void Advance(); 321 void Advance();
322 322
323 HValue* value() { 323 HValue* value() {
324 DCHECK(!Done()); 324 DCHECK(!Done());
325 return value_; 325 return value_;
326 } 326 }
327 327
328 int index() { 328 int index() {
(...skipping 28 matching lines...) Expand all
357 }; 357 };
358 358
359 359
360 static inline GVNFlag GVNFlagFromInt(int i) { 360 static inline GVNFlag GVNFlagFromInt(int i) {
361 DCHECK(i >= 0); 361 DCHECK(i >= 0);
362 DCHECK(i < kNumberOfFlags); 362 DCHECK(i < kNumberOfFlags);
363 return static_cast<GVNFlag>(i); 363 return static_cast<GVNFlag>(i);
364 } 364 }
365 365
366 366
367 class DecompositionResult V8_FINAL BASE_EMBEDDED { 367 class DecompositionResult FINAL BASE_EMBEDDED {
368 public: 368 public:
369 DecompositionResult() : base_(NULL), offset_(0), scale_(0) {} 369 DecompositionResult() : base_(NULL), offset_(0), scale_(0) {}
370 370
371 HValue* base() { return base_; } 371 HValue* base() { return base_; }
372 int offset() { return offset_; } 372 int offset() { return offset_; }
373 int scale() { return scale_; } 373 int scale() { return scale_; }
374 374
375 bool Apply(HValue* other_base, int other_offset, int other_scale = 0) { 375 bool Apply(HValue* other_base, int other_offset, int other_scale = 0) {
376 if (base_ == NULL) { 376 if (base_ == NULL) {
377 base_ = other_base; 377 base_ = other_base;
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 1138
1139 intptr_t data_; 1139 intptr_t data_;
1140 }; 1140 };
1141 1141
1142 1142
1143 class HInstruction : public HValue { 1143 class HInstruction : public HValue {
1144 public: 1144 public:
1145 HInstruction* next() const { return next_; } 1145 HInstruction* next() const { return next_; }
1146 HInstruction* previous() const { return previous_; } 1146 HInstruction* previous() const { return previous_; }
1147 1147
1148 virtual OStream& PrintTo(OStream& os) const V8_OVERRIDE; // NOLINT 1148 virtual OStream& PrintTo(OStream& os) const OVERRIDE; // NOLINT
1149 virtual OStream& PrintDataTo(OStream& os) const; // NOLINT 1149 virtual OStream& PrintDataTo(OStream& os) const; // NOLINT
1150 1150
1151 bool IsLinked() const { return block() != NULL; } 1151 bool IsLinked() const { return block() != NULL; }
1152 void Unlink(); 1152 void Unlink();
1153 1153
1154 void InsertBefore(HInstruction* next); 1154 void InsertBefore(HInstruction* next);
1155 1155
1156 template<class T> T* Prepend(T* instr) { 1156 template<class T> T* Prepend(T* instr) {
1157 instr->InsertBefore(this); 1157 instr->InsertBefore(this);
1158 return instr; 1158 return instr;
1159 } 1159 }
1160 1160
1161 void InsertAfter(HInstruction* previous); 1161 void InsertAfter(HInstruction* previous);
1162 1162
1163 template<class T> T* Append(T* instr) { 1163 template<class T> T* Append(T* instr) {
1164 instr->InsertAfter(this); 1164 instr->InsertAfter(this);
1165 return instr; 1165 return instr;
1166 } 1166 }
1167 1167
1168 // The position is a write-once variable. 1168 // The position is a write-once variable.
1169 virtual HSourcePosition position() const V8_OVERRIDE { 1169 virtual HSourcePosition position() const OVERRIDE {
1170 return HSourcePosition(position_.position()); 1170 return HSourcePosition(position_.position());
1171 } 1171 }
1172 bool has_position() const { 1172 bool has_position() const {
1173 return !position().IsUnknown(); 1173 return !position().IsUnknown();
1174 } 1174 }
1175 void set_position(HSourcePosition position) { 1175 void set_position(HSourcePosition position) {
1176 DCHECK(!has_position()); 1176 DCHECK(!has_position());
1177 DCHECK(!position.IsUnknown()); 1177 DCHECK(!position.IsUnknown());
1178 position_.set_position(position); 1178 position_.set_position(position);
1179 } 1179 }
1180 1180
1181 virtual HSourcePosition operand_position(int index) const V8_OVERRIDE { 1181 virtual HSourcePosition operand_position(int index) const OVERRIDE {
1182 const HSourcePosition pos = position_.operand_position(index); 1182 const HSourcePosition pos = position_.operand_position(index);
1183 return pos.IsUnknown() ? position() : pos; 1183 return pos.IsUnknown() ? position() : pos;
1184 } 1184 }
1185 void set_operand_position(Zone* zone, int index, HSourcePosition pos) { 1185 void set_operand_position(Zone* zone, int index, HSourcePosition pos) {
1186 DCHECK(0 <= index && index < OperandCount()); 1186 DCHECK(0 <= index && index < OperandCount());
1187 position_.ensure_storage_for_operand_positions(zone, OperandCount()); 1187 position_.ensure_storage_for_operand_positions(zone, OperandCount());
1188 position_.set_operand_position(index, pos); 1188 position_.set_operand_position(index, pos);
1189 } 1189 }
1190 1190
1191 bool Dominates(HInstruction* other); 1191 bool Dominates(HInstruction* other);
1192 bool CanTruncateToSmi() const { return CheckFlag(kTruncatingToSmi); } 1192 bool CanTruncateToSmi() const { return CheckFlag(kTruncatingToSmi); }
1193 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } 1193 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); }
1194 1194
1195 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; 1195 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0;
1196 1196
1197 #ifdef DEBUG 1197 #ifdef DEBUG
1198 virtual void Verify() V8_OVERRIDE; 1198 virtual void Verify() OVERRIDE;
1199 #endif 1199 #endif
1200 1200
1201 bool CanDeoptimize(); 1201 bool CanDeoptimize();
1202 1202
1203 virtual bool HasStackCheck() { return false; } 1203 virtual bool HasStackCheck() { return false; }
1204 1204
1205 DECLARE_ABSTRACT_INSTRUCTION(Instruction) 1205 DECLARE_ABSTRACT_INSTRUCTION(Instruction)
1206 1206
1207 protected: 1207 protected:
1208 explicit HInstruction(HType type = HType::Tagged()) 1208 explicit HInstruction(HType type = HType::Tagged())
1209 : HValue(type), 1209 : HValue(type),
1210 next_(NULL), 1210 next_(NULL),
1211 previous_(NULL), 1211 previous_(NULL),
1212 position_(RelocInfo::kNoPosition) { 1212 position_(RelocInfo::kNoPosition) {
1213 SetDependsOnFlag(kOsrEntries); 1213 SetDependsOnFlag(kOsrEntries);
1214 } 1214 }
1215 1215
1216 virtual void DeleteFromGraph() V8_OVERRIDE { Unlink(); } 1216 virtual void DeleteFromGraph() OVERRIDE { Unlink(); }
1217 1217
1218 private: 1218 private:
1219 void InitializeAsFirst(HBasicBlock* block) { 1219 void InitializeAsFirst(HBasicBlock* block) {
1220 DCHECK(!IsLinked()); 1220 DCHECK(!IsLinked());
1221 SetBlock(block); 1221 SetBlock(block);
1222 } 1222 }
1223 1223
1224 HInstruction* next_; 1224 HInstruction* next_;
1225 HInstruction* previous_; 1225 HInstruction* previous_;
1226 HPositionInfo position_; 1226 HPositionInfo position_;
1227 1227
1228 friend class HBasicBlock; 1228 friend class HBasicBlock;
1229 }; 1229 };
1230 1230
1231 1231
1232 template<int V> 1232 template<int V>
1233 class HTemplateInstruction : public HInstruction { 1233 class HTemplateInstruction : public HInstruction {
1234 public: 1234 public:
1235 virtual int OperandCount() const V8_FINAL V8_OVERRIDE { return V; } 1235 virtual int OperandCount() const FINAL OVERRIDE { return V; }
1236 virtual HValue* OperandAt(int i) const V8_FINAL V8_OVERRIDE { 1236 virtual HValue* OperandAt(int i) const FINAL OVERRIDE {
1237 return inputs_[i]; 1237 return inputs_[i];
1238 } 1238 }
1239 1239
1240 protected: 1240 protected:
1241 explicit HTemplateInstruction(HType type = HType::Tagged()) 1241 explicit HTemplateInstruction(HType type = HType::Tagged())
1242 : HInstruction(type) {} 1242 : HInstruction(type) {}
1243 1243
1244 virtual void InternalSetOperandAt(int i, HValue* value) V8_FINAL V8_OVERRIDE { 1244 virtual void InternalSetOperandAt(int i, HValue* value) FINAL OVERRIDE {
1245 inputs_[i] = value; 1245 inputs_[i] = value;
1246 } 1246 }
1247 1247
1248 private: 1248 private:
1249 EmbeddedContainer<HValue*, V> inputs_; 1249 EmbeddedContainer<HValue*, V> inputs_;
1250 }; 1250 };
1251 1251
1252 1252
1253 class HControlInstruction : public HInstruction { 1253 class HControlInstruction : public HInstruction {
1254 public: 1254 public:
1255 virtual HBasicBlock* SuccessorAt(int i) const = 0; 1255 virtual HBasicBlock* SuccessorAt(int i) const = 0;
1256 virtual int SuccessorCount() const = 0; 1256 virtual int SuccessorCount() const = 0;
1257 virtual void SetSuccessorAt(int i, HBasicBlock* block) = 0; 1257 virtual void SetSuccessorAt(int i, HBasicBlock* block) = 0;
1258 1258
1259 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 1259 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
1260 1260
1261 virtual bool KnownSuccessorBlock(HBasicBlock** block) { 1261 virtual bool KnownSuccessorBlock(HBasicBlock** block) {
1262 *block = NULL; 1262 *block = NULL;
1263 return false; 1263 return false;
1264 } 1264 }
1265 1265
1266 HBasicBlock* FirstSuccessor() { 1266 HBasicBlock* FirstSuccessor() {
1267 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL; 1267 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL;
1268 } 1268 }
1269 HBasicBlock* SecondSuccessor() { 1269 HBasicBlock* SecondSuccessor() {
1270 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL; 1270 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL;
1271 } 1271 }
1272 1272
1273 void Not() { 1273 void Not() {
1274 HBasicBlock* swap = SuccessorAt(0); 1274 HBasicBlock* swap = SuccessorAt(0);
1275 SetSuccessorAt(0, SuccessorAt(1)); 1275 SetSuccessorAt(0, SuccessorAt(1));
1276 SetSuccessorAt(1, swap); 1276 SetSuccessorAt(1, swap);
1277 } 1277 }
1278 1278
1279 DECLARE_ABSTRACT_INSTRUCTION(ControlInstruction) 1279 DECLARE_ABSTRACT_INSTRUCTION(ControlInstruction)
1280 }; 1280 };
1281 1281
1282 1282
1283 class HSuccessorIterator V8_FINAL BASE_EMBEDDED { 1283 class HSuccessorIterator FINAL BASE_EMBEDDED {
1284 public: 1284 public:
1285 explicit HSuccessorIterator(const HControlInstruction* instr) 1285 explicit HSuccessorIterator(const HControlInstruction* instr)
1286 : instr_(instr), current_(0) {} 1286 : instr_(instr), current_(0) {}
1287 1287
1288 bool Done() { return current_ >= instr_->SuccessorCount(); } 1288 bool Done() { return current_ >= instr_->SuccessorCount(); }
1289 HBasicBlock* Current() { return instr_->SuccessorAt(current_); } 1289 HBasicBlock* Current() { return instr_->SuccessorAt(current_); }
1290 void Advance() { current_++; } 1290 void Advance() { current_++; }
1291 1291
1292 private: 1292 private:
1293 const HControlInstruction* instr_; 1293 const HControlInstruction* instr_;
1294 int current_; 1294 int current_;
1295 }; 1295 };
1296 1296
1297 1297
1298 template<int S, int V> 1298 template<int S, int V>
1299 class HTemplateControlInstruction : public HControlInstruction { 1299 class HTemplateControlInstruction : public HControlInstruction {
1300 public: 1300 public:
1301 int SuccessorCount() const V8_OVERRIDE { return S; } 1301 int SuccessorCount() const OVERRIDE { return S; }
1302 HBasicBlock* SuccessorAt(int i) const V8_OVERRIDE { return successors_[i]; } 1302 HBasicBlock* SuccessorAt(int i) const OVERRIDE { return successors_[i]; }
1303 void SetSuccessorAt(int i, HBasicBlock* block) V8_OVERRIDE { 1303 void SetSuccessorAt(int i, HBasicBlock* block) OVERRIDE {
1304 successors_[i] = block; 1304 successors_[i] = block;
1305 } 1305 }
1306 1306
1307 int OperandCount() const V8_OVERRIDE { return V; } 1307 int OperandCount() const OVERRIDE { return V; }
1308 HValue* OperandAt(int i) const V8_OVERRIDE { return inputs_[i]; } 1308 HValue* OperandAt(int i) const OVERRIDE { return inputs_[i]; }
1309 1309
1310 1310
1311 protected: 1311 protected:
1312 void InternalSetOperandAt(int i, HValue* value) V8_OVERRIDE { 1312 void InternalSetOperandAt(int i, HValue* value) OVERRIDE {
1313 inputs_[i] = value; 1313 inputs_[i] = value;
1314 } 1314 }
1315 1315
1316 private: 1316 private:
1317 EmbeddedContainer<HBasicBlock*, S> successors_; 1317 EmbeddedContainer<HBasicBlock*, S> successors_;
1318 EmbeddedContainer<HValue*, V> inputs_; 1318 EmbeddedContainer<HValue*, V> inputs_;
1319 }; 1319 };
1320 1320
1321 1321
1322 class HBlockEntry V8_FINAL : public HTemplateInstruction<0> { 1322 class HBlockEntry FINAL : public HTemplateInstruction<0> {
1323 public: 1323 public:
1324 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1324 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1325 return Representation::None(); 1325 return Representation::None();
1326 } 1326 }
1327 1327
1328 DECLARE_CONCRETE_INSTRUCTION(BlockEntry) 1328 DECLARE_CONCRETE_INSTRUCTION(BlockEntry)
1329 }; 1329 };
1330 1330
1331 1331
1332 class HDummyUse V8_FINAL : public HTemplateInstruction<1> { 1332 class HDummyUse FINAL : public HTemplateInstruction<1> {
1333 public: 1333 public:
1334 explicit HDummyUse(HValue* value) 1334 explicit HDummyUse(HValue* value)
1335 : HTemplateInstruction<1>(HType::Smi()) { 1335 : HTemplateInstruction<1>(HType::Smi()) {
1336 SetOperandAt(0, value); 1336 SetOperandAt(0, value);
1337 // Pretend to be a Smi so that the HChange instructions inserted 1337 // Pretend to be a Smi so that the HChange instructions inserted
1338 // before any use generate as little code as possible. 1338 // before any use generate as little code as possible.
1339 set_representation(Representation::Tagged()); 1339 set_representation(Representation::Tagged());
1340 } 1340 }
1341 1341
1342 HValue* value() const { return OperandAt(0); } 1342 HValue* value() const { return OperandAt(0); }
1343 1343
1344 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } 1344 virtual bool HasEscapingOperandAt(int index) OVERRIDE { return false; }
1345 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1345 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1346 return Representation::None(); 1346 return Representation::None();
1347 } 1347 }
1348 1348
1349 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 1349 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
1350 1350
1351 DECLARE_CONCRETE_INSTRUCTION(DummyUse); 1351 DECLARE_CONCRETE_INSTRUCTION(DummyUse);
1352 }; 1352 };
1353 1353
1354 1354
1355 // Inserts an int3/stop break instruction for debugging purposes. 1355 // Inserts an int3/stop break instruction for debugging purposes.
1356 class HDebugBreak V8_FINAL : public HTemplateInstruction<0> { 1356 class HDebugBreak FINAL : public HTemplateInstruction<0> {
1357 public: 1357 public:
1358 DECLARE_INSTRUCTION_FACTORY_P0(HDebugBreak); 1358 DECLARE_INSTRUCTION_FACTORY_P0(HDebugBreak);
1359 1359
1360 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1360 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1361 return Representation::None(); 1361 return Representation::None();
1362 } 1362 }
1363 1363
1364 DECLARE_CONCRETE_INSTRUCTION(DebugBreak) 1364 DECLARE_CONCRETE_INSTRUCTION(DebugBreak)
1365 }; 1365 };
1366 1366
1367 1367
1368 class HGoto V8_FINAL : public HTemplateControlInstruction<1, 0> { 1368 class HGoto FINAL : public HTemplateControlInstruction<1, 0> {
1369 public: 1369 public:
1370 explicit HGoto(HBasicBlock* target) { 1370 explicit HGoto(HBasicBlock* target) {
1371 SetSuccessorAt(0, target); 1371 SetSuccessorAt(0, target);
1372 } 1372 }
1373 1373
1374 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE { 1374 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE {
1375 *block = FirstSuccessor(); 1375 *block = FirstSuccessor();
1376 return true; 1376 return true;
1377 } 1377 }
1378 1378
1379 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1379 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1380 return Representation::None(); 1380 return Representation::None();
1381 } 1381 }
1382 1382
1383 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 1383 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
1384 1384
1385 DECLARE_CONCRETE_INSTRUCTION(Goto) 1385 DECLARE_CONCRETE_INSTRUCTION(Goto)
1386 }; 1386 };
1387 1387
1388 1388
1389 class HDeoptimize V8_FINAL : public HTemplateControlInstruction<1, 0> { 1389 class HDeoptimize FINAL : public HTemplateControlInstruction<1, 0> {
1390 public: 1390 public:
1391 static HDeoptimize* New(Zone* zone, 1391 static HDeoptimize* New(Zone* zone,
1392 HValue* context, 1392 HValue* context,
1393 const char* reason, 1393 const char* reason,
1394 Deoptimizer::BailoutType type, 1394 Deoptimizer::BailoutType type,
1395 HBasicBlock* unreachable_continuation) { 1395 HBasicBlock* unreachable_continuation) {
1396 return new(zone) HDeoptimize(reason, type, unreachable_continuation); 1396 return new(zone) HDeoptimize(reason, type, unreachable_continuation);
1397 } 1397 }
1398 1398
1399 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE { 1399 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE {
1400 *block = NULL; 1400 *block = NULL;
1401 return true; 1401 return true;
1402 } 1402 }
1403 1403
1404 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1404 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1405 return Representation::None(); 1405 return Representation::None();
1406 } 1406 }
1407 1407
1408 const char* reason() const { return reason_; } 1408 const char* reason() const { return reason_; }
1409 Deoptimizer::BailoutType type() { return type_; } 1409 Deoptimizer::BailoutType type() { return type_; }
1410 1410
1411 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) 1411 DECLARE_CONCRETE_INSTRUCTION(Deoptimize)
1412 1412
1413 private: 1413 private:
1414 explicit HDeoptimize(const char* reason, 1414 explicit HDeoptimize(const char* reason,
(...skipping 11 matching lines...) Expand all
1426 class HUnaryControlInstruction : public HTemplateControlInstruction<2, 1> { 1426 class HUnaryControlInstruction : public HTemplateControlInstruction<2, 1> {
1427 public: 1427 public:
1428 HUnaryControlInstruction(HValue* value, 1428 HUnaryControlInstruction(HValue* value,
1429 HBasicBlock* true_target, 1429 HBasicBlock* true_target,
1430 HBasicBlock* false_target) { 1430 HBasicBlock* false_target) {
1431 SetOperandAt(0, value); 1431 SetOperandAt(0, value);
1432 SetSuccessorAt(0, true_target); 1432 SetSuccessorAt(0, true_target);
1433 SetSuccessorAt(1, false_target); 1433 SetSuccessorAt(1, false_target);
1434 } 1434 }
1435 1435
1436 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 1436 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
1437 1437
1438 HValue* value() const { return OperandAt(0); } 1438 HValue* value() const { return OperandAt(0); }
1439 }; 1439 };
1440 1440
1441 1441
1442 class HBranch V8_FINAL : public HUnaryControlInstruction { 1442 class HBranch FINAL : public HUnaryControlInstruction {
1443 public: 1443 public:
1444 DECLARE_INSTRUCTION_FACTORY_P1(HBranch, HValue*); 1444 DECLARE_INSTRUCTION_FACTORY_P1(HBranch, HValue*);
1445 DECLARE_INSTRUCTION_FACTORY_P2(HBranch, HValue*, 1445 DECLARE_INSTRUCTION_FACTORY_P2(HBranch, HValue*,
1446 ToBooleanStub::Types); 1446 ToBooleanStub::Types);
1447 DECLARE_INSTRUCTION_FACTORY_P4(HBranch, HValue*, 1447 DECLARE_INSTRUCTION_FACTORY_P4(HBranch, HValue*,
1448 ToBooleanStub::Types, 1448 ToBooleanStub::Types,
1449 HBasicBlock*, HBasicBlock*); 1449 HBasicBlock*, HBasicBlock*);
1450 1450
1451 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1451 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1452 return Representation::None(); 1452 return Representation::None();
1453 } 1453 }
1454 virtual Representation observed_input_representation(int index) V8_OVERRIDE; 1454 virtual Representation observed_input_representation(int index) OVERRIDE;
1455 1455
1456 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; 1456 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE;
1457 1457
1458 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 1458 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
1459 1459
1460 ToBooleanStub::Types expected_input_types() const { 1460 ToBooleanStub::Types expected_input_types() const {
1461 return expected_input_types_; 1461 return expected_input_types_;
1462 } 1462 }
1463 1463
1464 DECLARE_CONCRETE_INSTRUCTION(Branch) 1464 DECLARE_CONCRETE_INSTRUCTION(Branch)
1465 1465
1466 private: 1466 private:
1467 HBranch(HValue* value, 1467 HBranch(HValue* value,
1468 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types(), 1468 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types(),
1469 HBasicBlock* true_target = NULL, 1469 HBasicBlock* true_target = NULL,
1470 HBasicBlock* false_target = NULL) 1470 HBasicBlock* false_target = NULL)
1471 : HUnaryControlInstruction(value, true_target, false_target), 1471 : HUnaryControlInstruction(value, true_target, false_target),
1472 expected_input_types_(expected_input_types) { 1472 expected_input_types_(expected_input_types) {
1473 SetFlag(kAllowUndefinedAsNaN); 1473 SetFlag(kAllowUndefinedAsNaN);
1474 } 1474 }
1475 1475
1476 ToBooleanStub::Types expected_input_types_; 1476 ToBooleanStub::Types expected_input_types_;
1477 }; 1477 };
1478 1478
1479 1479
1480 class HCompareMap V8_FINAL : public HUnaryControlInstruction { 1480 class HCompareMap FINAL : public HUnaryControlInstruction {
1481 public: 1481 public:
1482 DECLARE_INSTRUCTION_FACTORY_P2(HCompareMap, HValue*, Handle<Map>); 1482 DECLARE_INSTRUCTION_FACTORY_P2(HCompareMap, HValue*, Handle<Map>);
1483 DECLARE_INSTRUCTION_FACTORY_P4(HCompareMap, HValue*, Handle<Map>, 1483 DECLARE_INSTRUCTION_FACTORY_P4(HCompareMap, HValue*, Handle<Map>,
1484 HBasicBlock*, HBasicBlock*); 1484 HBasicBlock*, HBasicBlock*);
1485 1485
1486 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE { 1486 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE {
1487 if (known_successor_index() != kNoKnownSuccessorIndex) { 1487 if (known_successor_index() != kNoKnownSuccessorIndex) {
1488 *block = SuccessorAt(known_successor_index()); 1488 *block = SuccessorAt(known_successor_index());
1489 return true; 1489 return true;
1490 } 1490 }
1491 *block = NULL; 1491 *block = NULL;
1492 return false; 1492 return false;
1493 } 1493 }
1494 1494
1495 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 1495 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
1496 1496
1497 static const int kNoKnownSuccessorIndex = -1; 1497 static const int kNoKnownSuccessorIndex = -1;
1498 int known_successor_index() const { return known_successor_index_; } 1498 int known_successor_index() const { return known_successor_index_; }
1499 void set_known_successor_index(int known_successor_index) { 1499 void set_known_successor_index(int known_successor_index) {
1500 known_successor_index_ = known_successor_index; 1500 known_successor_index_ = known_successor_index;
1501 } 1501 }
1502 1502
1503 Unique<Map> map() const { return map_; } 1503 Unique<Map> map() const { return map_; }
1504 bool map_is_stable() const { return map_is_stable_; } 1504 bool map_is_stable() const { return map_is_stable_; }
1505 1505
1506 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1506 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1507 return Representation::Tagged(); 1507 return Representation::Tagged();
1508 } 1508 }
1509 1509
1510 DECLARE_CONCRETE_INSTRUCTION(CompareMap) 1510 DECLARE_CONCRETE_INSTRUCTION(CompareMap)
1511 1511
1512 protected: 1512 protected:
1513 virtual int RedefinedOperandIndex() { return 0; } 1513 virtual int RedefinedOperandIndex() { return 0; }
1514 1514
1515 private: 1515 private:
1516 HCompareMap(HValue* value, 1516 HCompareMap(HValue* value,
1517 Handle<Map> map, 1517 Handle<Map> map,
1518 HBasicBlock* true_target = NULL, 1518 HBasicBlock* true_target = NULL,
1519 HBasicBlock* false_target = NULL) 1519 HBasicBlock* false_target = NULL)
1520 : HUnaryControlInstruction(value, true_target, false_target), 1520 : HUnaryControlInstruction(value, true_target, false_target),
1521 known_successor_index_(kNoKnownSuccessorIndex), 1521 known_successor_index_(kNoKnownSuccessorIndex),
1522 map_is_stable_(map->is_stable()), 1522 map_is_stable_(map->is_stable()),
1523 map_(Unique<Map>::CreateImmovable(map)) { 1523 map_(Unique<Map>::CreateImmovable(map)) {
1524 set_representation(Representation::Tagged()); 1524 set_representation(Representation::Tagged());
1525 } 1525 }
1526 1526
1527 int known_successor_index_ : 31; 1527 int known_successor_index_ : 31;
1528 bool map_is_stable_ : 1; 1528 bool map_is_stable_ : 1;
1529 Unique<Map> map_; 1529 Unique<Map> map_;
1530 }; 1530 };
1531 1531
1532 1532
1533 class HContext V8_FINAL : public HTemplateInstruction<0> { 1533 class HContext FINAL : public HTemplateInstruction<0> {
1534 public: 1534 public:
1535 static HContext* New(Zone* zone) { 1535 static HContext* New(Zone* zone) {
1536 return new(zone) HContext(); 1536 return new(zone) HContext();
1537 } 1537 }
1538 1538
1539 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1539 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1540 return Representation::None(); 1540 return Representation::None();
1541 } 1541 }
1542 1542
1543 DECLARE_CONCRETE_INSTRUCTION(Context) 1543 DECLARE_CONCRETE_INSTRUCTION(Context)
1544 1544
1545 protected: 1545 protected:
1546 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 1546 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
1547 1547
1548 private: 1548 private:
1549 HContext() { 1549 HContext() {
1550 set_representation(Representation::Tagged()); 1550 set_representation(Representation::Tagged());
1551 SetFlag(kUseGVN); 1551 SetFlag(kUseGVN);
1552 } 1552 }
1553 1553
1554 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 1554 virtual bool IsDeletable() const OVERRIDE { return true; }
1555 }; 1555 };
1556 1556
1557 1557
1558 class HReturn V8_FINAL : public HTemplateControlInstruction<0, 3> { 1558 class HReturn FINAL : public HTemplateControlInstruction<0, 3> {
1559 public: 1559 public:
1560 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HReturn, HValue*, HValue*); 1560 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HReturn, HValue*, HValue*);
1561 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HReturn, HValue*); 1561 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HReturn, HValue*);
1562 1562
1563 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1563 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1564 // TODO(titzer): require an Int32 input for faster returns. 1564 // TODO(titzer): require an Int32 input for faster returns.
1565 if (index == 2) return Representation::Smi(); 1565 if (index == 2) return Representation::Smi();
1566 return Representation::Tagged(); 1566 return Representation::Tagged();
1567 } 1567 }
1568 1568
1569 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 1569 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
1570 1570
1571 HValue* value() const { return OperandAt(0); } 1571 HValue* value() const { return OperandAt(0); }
1572 HValue* context() const { return OperandAt(1); } 1572 HValue* context() const { return OperandAt(1); }
1573 HValue* parameter_count() const { return OperandAt(2); } 1573 HValue* parameter_count() const { return OperandAt(2); }
1574 1574
1575 DECLARE_CONCRETE_INSTRUCTION(Return) 1575 DECLARE_CONCRETE_INSTRUCTION(Return)
1576 1576
1577 private: 1577 private:
1578 HReturn(HValue* context, HValue* value, HValue* parameter_count = 0) { 1578 HReturn(HValue* context, HValue* value, HValue* parameter_count = 0) {
1579 SetOperandAt(0, value); 1579 SetOperandAt(0, value);
1580 SetOperandAt(1, context); 1580 SetOperandAt(1, context);
1581 SetOperandAt(2, parameter_count); 1581 SetOperandAt(2, parameter_count);
1582 } 1582 }
1583 }; 1583 };
1584 1584
1585 1585
1586 class HAbnormalExit V8_FINAL : public HTemplateControlInstruction<0, 0> { 1586 class HAbnormalExit FINAL : public HTemplateControlInstruction<0, 0> {
1587 public: 1587 public:
1588 DECLARE_INSTRUCTION_FACTORY_P0(HAbnormalExit); 1588 DECLARE_INSTRUCTION_FACTORY_P0(HAbnormalExit);
1589 1589
1590 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1590 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1591 return Representation::None(); 1591 return Representation::None();
1592 } 1592 }
1593 1593
1594 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit) 1594 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit)
1595 private: 1595 private:
1596 HAbnormalExit() {} 1596 HAbnormalExit() {}
1597 }; 1597 };
1598 1598
1599 1599
1600 class HUnaryOperation : public HTemplateInstruction<1> { 1600 class HUnaryOperation : public HTemplateInstruction<1> {
1601 public: 1601 public:
1602 explicit HUnaryOperation(HValue* value, HType type = HType::Tagged()) 1602 explicit HUnaryOperation(HValue* value, HType type = HType::Tagged())
1603 : HTemplateInstruction<1>(type) { 1603 : HTemplateInstruction<1>(type) {
1604 SetOperandAt(0, value); 1604 SetOperandAt(0, value);
1605 } 1605 }
1606 1606
1607 static HUnaryOperation* cast(HValue* value) { 1607 static HUnaryOperation* cast(HValue* value) {
1608 return reinterpret_cast<HUnaryOperation*>(value); 1608 return reinterpret_cast<HUnaryOperation*>(value);
1609 } 1609 }
1610 1610
1611 HValue* value() const { return OperandAt(0); } 1611 HValue* value() const { return OperandAt(0); }
1612 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 1612 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
1613 }; 1613 };
1614 1614
1615 1615
1616 class HUseConst V8_FINAL : public HUnaryOperation { 1616 class HUseConst FINAL : public HUnaryOperation {
1617 public: 1617 public:
1618 DECLARE_INSTRUCTION_FACTORY_P1(HUseConst, HValue*); 1618 DECLARE_INSTRUCTION_FACTORY_P1(HUseConst, HValue*);
1619 1619
1620 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1620 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1621 return Representation::None(); 1621 return Representation::None();
1622 } 1622 }
1623 1623
1624 DECLARE_CONCRETE_INSTRUCTION(UseConst) 1624 DECLARE_CONCRETE_INSTRUCTION(UseConst)
1625 1625
1626 private: 1626 private:
1627 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { } 1627 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { }
1628 }; 1628 };
1629 1629
1630 1630
1631 class HForceRepresentation V8_FINAL : public HTemplateInstruction<1> { 1631 class HForceRepresentation FINAL : public HTemplateInstruction<1> {
1632 public: 1632 public:
1633 static HInstruction* New(Zone* zone, HValue* context, HValue* value, 1633 static HInstruction* New(Zone* zone, HValue* context, HValue* value,
1634 Representation required_representation); 1634 Representation required_representation);
1635 1635
1636 HValue* value() const { return OperandAt(0); } 1636 HValue* value() const { return OperandAt(0); }
1637 1637
1638 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1638 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1639 return representation(); // Same as the output representation. 1639 return representation(); // Same as the output representation.
1640 } 1640 }
1641 1641
1642 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 1642 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
1643 1643
1644 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) 1644 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation)
1645 1645
1646 private: 1646 private:
1647 HForceRepresentation(HValue* value, Representation required_representation) { 1647 HForceRepresentation(HValue* value, Representation required_representation) {
1648 SetOperandAt(0, value); 1648 SetOperandAt(0, value);
1649 set_representation(required_representation); 1649 set_representation(required_representation);
1650 } 1650 }
1651 }; 1651 };
1652 1652
1653 1653
1654 class HChange V8_FINAL : public HUnaryOperation { 1654 class HChange FINAL : public HUnaryOperation {
1655 public: 1655 public:
1656 HChange(HValue* value, 1656 HChange(HValue* value,
1657 Representation to, 1657 Representation to,
1658 bool is_truncating_to_smi, 1658 bool is_truncating_to_smi,
1659 bool is_truncating_to_int32) 1659 bool is_truncating_to_int32)
1660 : HUnaryOperation(value) { 1660 : HUnaryOperation(value) {
1661 DCHECK(!value->representation().IsNone()); 1661 DCHECK(!value->representation().IsNone());
1662 DCHECK(!to.IsNone()); 1662 DCHECK(!to.IsNone());
1663 DCHECK(!value->representation().Equals(to)); 1663 DCHECK(!value->representation().Equals(to));
1664 set_representation(to); 1664 set_representation(to);
1665 SetFlag(kUseGVN); 1665 SetFlag(kUseGVN);
1666 SetFlag(kCanOverflow); 1666 SetFlag(kCanOverflow);
1667 if (is_truncating_to_smi && to.IsSmi()) { 1667 if (is_truncating_to_smi && to.IsSmi()) {
1668 SetFlag(kTruncatingToSmi); 1668 SetFlag(kTruncatingToSmi);
1669 SetFlag(kTruncatingToInt32); 1669 SetFlag(kTruncatingToInt32);
1670 } 1670 }
1671 if (is_truncating_to_int32) SetFlag(kTruncatingToInt32); 1671 if (is_truncating_to_int32) SetFlag(kTruncatingToInt32);
1672 if (value->representation().IsSmi() || value->type().IsSmi()) { 1672 if (value->representation().IsSmi() || value->type().IsSmi()) {
1673 set_type(HType::Smi()); 1673 set_type(HType::Smi());
1674 } else { 1674 } else {
1675 set_type(HType::TaggedNumber()); 1675 set_type(HType::TaggedNumber());
1676 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); 1676 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion);
1677 } 1677 }
1678 } 1678 }
1679 1679
1680 bool can_convert_undefined_to_nan() { 1680 bool can_convert_undefined_to_nan() {
1681 return CheckUsesForFlag(kAllowUndefinedAsNaN); 1681 return CheckUsesForFlag(kAllowUndefinedAsNaN);
1682 } 1682 }
1683 1683
1684 virtual HType CalculateInferredType() V8_OVERRIDE; 1684 virtual HType CalculateInferredType() OVERRIDE;
1685 virtual HValue* Canonicalize() V8_OVERRIDE; 1685 virtual HValue* Canonicalize() OVERRIDE;
1686 1686
1687 Representation from() const { return value()->representation(); } 1687 Representation from() const { return value()->representation(); }
1688 Representation to() const { return representation(); } 1688 Representation to() const { return representation(); }
1689 bool deoptimize_on_minus_zero() const { 1689 bool deoptimize_on_minus_zero() const {
1690 return CheckFlag(kBailoutOnMinusZero); 1690 return CheckFlag(kBailoutOnMinusZero);
1691 } 1691 }
1692 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1692 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1693 return from(); 1693 return from();
1694 } 1694 }
1695 1695
1696 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 1696 virtual Range* InferRange(Zone* zone) OVERRIDE;
1697 1697
1698 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 1698 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
1699 1699
1700 DECLARE_CONCRETE_INSTRUCTION(Change) 1700 DECLARE_CONCRETE_INSTRUCTION(Change)
1701 1701
1702 protected: 1702 protected:
1703 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 1703 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
1704 1704
1705 private: 1705 private:
1706 virtual bool IsDeletable() const V8_OVERRIDE { 1706 virtual bool IsDeletable() const OVERRIDE {
1707 return !from().IsTagged() || value()->type().IsSmi(); 1707 return !from().IsTagged() || value()->type().IsSmi();
1708 } 1708 }
1709 }; 1709 };
1710 1710
1711 1711
1712 class HClampToUint8 V8_FINAL : public HUnaryOperation { 1712 class HClampToUint8 FINAL : public HUnaryOperation {
1713 public: 1713 public:
1714 DECLARE_INSTRUCTION_FACTORY_P1(HClampToUint8, HValue*); 1714 DECLARE_INSTRUCTION_FACTORY_P1(HClampToUint8, HValue*);
1715 1715
1716 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1716 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1717 return Representation::None(); 1717 return Representation::None();
1718 } 1718 }
1719 1719
1720 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) 1720 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8)
1721 1721
1722 protected: 1722 protected:
1723 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 1723 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
1724 1724
1725 private: 1725 private:
1726 explicit HClampToUint8(HValue* value) 1726 explicit HClampToUint8(HValue* value)
1727 : HUnaryOperation(value) { 1727 : HUnaryOperation(value) {
1728 set_representation(Representation::Integer32()); 1728 set_representation(Representation::Integer32());
1729 SetFlag(kAllowUndefinedAsNaN); 1729 SetFlag(kAllowUndefinedAsNaN);
1730 SetFlag(kUseGVN); 1730 SetFlag(kUseGVN);
1731 } 1731 }
1732 1732
1733 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 1733 virtual bool IsDeletable() const OVERRIDE { return true; }
1734 }; 1734 };
1735 1735
1736 1736
1737 class HDoubleBits V8_FINAL : public HUnaryOperation { 1737 class HDoubleBits FINAL : public HUnaryOperation {
1738 public: 1738 public:
1739 enum Bits { HIGH, LOW }; 1739 enum Bits { HIGH, LOW };
1740 DECLARE_INSTRUCTION_FACTORY_P2(HDoubleBits, HValue*, Bits); 1740 DECLARE_INSTRUCTION_FACTORY_P2(HDoubleBits, HValue*, Bits);
1741 1741
1742 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1742 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1743 return Representation::Double(); 1743 return Representation::Double();
1744 } 1744 }
1745 1745
1746 DECLARE_CONCRETE_INSTRUCTION(DoubleBits) 1746 DECLARE_CONCRETE_INSTRUCTION(DoubleBits)
1747 1747
1748 Bits bits() { return bits_; } 1748 Bits bits() { return bits_; }
1749 1749
1750 protected: 1750 protected:
1751 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 1751 virtual bool DataEquals(HValue* other) OVERRIDE {
1752 return other->IsDoubleBits() && HDoubleBits::cast(other)->bits() == bits(); 1752 return other->IsDoubleBits() && HDoubleBits::cast(other)->bits() == bits();
1753 } 1753 }
1754 1754
1755 private: 1755 private:
1756 HDoubleBits(HValue* value, Bits bits) 1756 HDoubleBits(HValue* value, Bits bits)
1757 : HUnaryOperation(value), bits_(bits) { 1757 : HUnaryOperation(value), bits_(bits) {
1758 set_representation(Representation::Integer32()); 1758 set_representation(Representation::Integer32());
1759 SetFlag(kUseGVN); 1759 SetFlag(kUseGVN);
1760 } 1760 }
1761 1761
1762 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 1762 virtual bool IsDeletable() const OVERRIDE { return true; }
1763 1763
1764 Bits bits_; 1764 Bits bits_;
1765 }; 1765 };
1766 1766
1767 1767
1768 class HConstructDouble V8_FINAL : public HTemplateInstruction<2> { 1768 class HConstructDouble FINAL : public HTemplateInstruction<2> {
1769 public: 1769 public:
1770 DECLARE_INSTRUCTION_FACTORY_P2(HConstructDouble, HValue*, HValue*); 1770 DECLARE_INSTRUCTION_FACTORY_P2(HConstructDouble, HValue*, HValue*);
1771 1771
1772 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1772 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1773 return Representation::Integer32(); 1773 return Representation::Integer32();
1774 } 1774 }
1775 1775
1776 DECLARE_CONCRETE_INSTRUCTION(ConstructDouble) 1776 DECLARE_CONCRETE_INSTRUCTION(ConstructDouble)
1777 1777
1778 HValue* hi() { return OperandAt(0); } 1778 HValue* hi() { return OperandAt(0); }
1779 HValue* lo() { return OperandAt(1); } 1779 HValue* lo() { return OperandAt(1); }
1780 1780
1781 protected: 1781 protected:
1782 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 1782 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
1783 1783
1784 private: 1784 private:
1785 explicit HConstructDouble(HValue* hi, HValue* lo) { 1785 explicit HConstructDouble(HValue* hi, HValue* lo) {
1786 set_representation(Representation::Double()); 1786 set_representation(Representation::Double());
1787 SetFlag(kUseGVN); 1787 SetFlag(kUseGVN);
1788 SetOperandAt(0, hi); 1788 SetOperandAt(0, hi);
1789 SetOperandAt(1, lo); 1789 SetOperandAt(1, lo);
1790 } 1790 }
1791 1791
1792 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 1792 virtual bool IsDeletable() const OVERRIDE { return true; }
1793 }; 1793 };
1794 1794
1795 1795
1796 enum RemovableSimulate { 1796 enum RemovableSimulate {
1797 REMOVABLE_SIMULATE, 1797 REMOVABLE_SIMULATE,
1798 FIXED_SIMULATE 1798 FIXED_SIMULATE
1799 }; 1799 };
1800 1800
1801 1801
1802 class HSimulate V8_FINAL : public HInstruction { 1802 class HSimulate FINAL : public HInstruction {
1803 public: 1803 public:
1804 HSimulate(BailoutId ast_id, 1804 HSimulate(BailoutId ast_id,
1805 int pop_count, 1805 int pop_count,
1806 Zone* zone, 1806 Zone* zone,
1807 RemovableSimulate removable) 1807 RemovableSimulate removable)
1808 : ast_id_(ast_id), 1808 : ast_id_(ast_id),
1809 pop_count_(pop_count), 1809 pop_count_(pop_count),
1810 values_(2, zone), 1810 values_(2, zone),
1811 assigned_indexes_(2, zone), 1811 assigned_indexes_(2, zone),
1812 zone_(zone), 1812 zone_(zone),
1813 removable_(removable), 1813 removable_(removable),
1814 done_with_replay_(false) {} 1814 done_with_replay_(false) {}
1815 ~HSimulate() {} 1815 ~HSimulate() {}
1816 1816
1817 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 1817 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
1818 1818
1819 bool HasAstId() const { return !ast_id_.IsNone(); } 1819 bool HasAstId() const { return !ast_id_.IsNone(); }
1820 BailoutId ast_id() const { return ast_id_; } 1820 BailoutId ast_id() const { return ast_id_; }
1821 void set_ast_id(BailoutId id) { 1821 void set_ast_id(BailoutId id) {
1822 DCHECK(!HasAstId()); 1822 DCHECK(!HasAstId());
1823 ast_id_ = id; 1823 ast_id_ = id;
1824 } 1824 }
1825 1825
1826 int pop_count() const { return pop_count_; } 1826 int pop_count() const { return pop_count_; }
1827 const ZoneList<HValue*>* values() const { return &values_; } 1827 const ZoneList<HValue*>* values() const { return &values_; }
1828 int GetAssignedIndexAt(int index) const { 1828 int GetAssignedIndexAt(int index) const {
1829 DCHECK(HasAssignedIndexAt(index)); 1829 DCHECK(HasAssignedIndexAt(index));
1830 return assigned_indexes_[index]; 1830 return assigned_indexes_[index];
1831 } 1831 }
1832 bool HasAssignedIndexAt(int index) const { 1832 bool HasAssignedIndexAt(int index) const {
1833 return assigned_indexes_[index] != kNoIndex; 1833 return assigned_indexes_[index] != kNoIndex;
1834 } 1834 }
1835 void AddAssignedValue(int index, HValue* value) { 1835 void AddAssignedValue(int index, HValue* value) {
1836 AddValue(index, value); 1836 AddValue(index, value);
1837 } 1837 }
1838 void AddPushedValue(HValue* value) { 1838 void AddPushedValue(HValue* value) {
1839 AddValue(kNoIndex, value); 1839 AddValue(kNoIndex, value);
1840 } 1840 }
1841 int ToOperandIndex(int environment_index) { 1841 int ToOperandIndex(int environment_index) {
1842 for (int i = 0; i < assigned_indexes_.length(); ++i) { 1842 for (int i = 0; i < assigned_indexes_.length(); ++i) {
1843 if (assigned_indexes_[i] == environment_index) return i; 1843 if (assigned_indexes_[i] == environment_index) return i;
1844 } 1844 }
1845 return -1; 1845 return -1;
1846 } 1846 }
1847 virtual int OperandCount() const V8_OVERRIDE { return values_.length(); } 1847 virtual int OperandCount() const OVERRIDE { return values_.length(); }
1848 virtual HValue* OperandAt(int index) const V8_OVERRIDE { 1848 virtual HValue* OperandAt(int index) const OVERRIDE {
1849 return values_[index]; 1849 return values_[index];
1850 } 1850 }
1851 1851
1852 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } 1852 virtual bool HasEscapingOperandAt(int index) OVERRIDE { return false; }
1853 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1853 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1854 return Representation::None(); 1854 return Representation::None();
1855 } 1855 }
1856 1856
1857 void MergeWith(ZoneList<HSimulate*>* list); 1857 void MergeWith(ZoneList<HSimulate*>* list);
1858 bool is_candidate_for_removal() { return removable_ == REMOVABLE_SIMULATE; } 1858 bool is_candidate_for_removal() { return removable_ == REMOVABLE_SIMULATE; }
1859 1859
1860 // Replay effects of this instruction on the given environment. 1860 // Replay effects of this instruction on the given environment.
1861 void ReplayEnvironment(HEnvironment* env); 1861 void ReplayEnvironment(HEnvironment* env);
1862 1862
1863 DECLARE_CONCRETE_INSTRUCTION(Simulate) 1863 DECLARE_CONCRETE_INSTRUCTION(Simulate)
1864 1864
1865 #ifdef DEBUG 1865 #ifdef DEBUG
1866 virtual void Verify() V8_OVERRIDE; 1866 virtual void Verify() OVERRIDE;
1867 void set_closure(Handle<JSFunction> closure) { closure_ = closure; } 1867 void set_closure(Handle<JSFunction> closure) { closure_ = closure; }
1868 Handle<JSFunction> closure() const { return closure_; } 1868 Handle<JSFunction> closure() const { return closure_; }
1869 #endif 1869 #endif
1870 1870
1871 protected: 1871 protected:
1872 virtual void InternalSetOperandAt(int index, HValue* value) V8_OVERRIDE { 1872 virtual void InternalSetOperandAt(int index, HValue* value) OVERRIDE {
1873 values_[index] = value; 1873 values_[index] = value;
1874 } 1874 }
1875 1875
1876 private: 1876 private:
1877 static const int kNoIndex = -1; 1877 static const int kNoIndex = -1;
1878 void AddValue(int index, HValue* value) { 1878 void AddValue(int index, HValue* value) {
1879 assigned_indexes_.Add(index, zone_); 1879 assigned_indexes_.Add(index, zone_);
1880 // Resize the list of pushed values. 1880 // Resize the list of pushed values.
1881 values_.Add(NULL, zone_); 1881 values_.Add(NULL, zone_);
1882 // Set the operand through the base method in HValue to make sure that the 1882 // Set the operand through the base method in HValue to make sure that the
(...skipping 13 matching lines...) Expand all
1896 Zone* zone_; 1896 Zone* zone_;
1897 RemovableSimulate removable_ : 2; 1897 RemovableSimulate removable_ : 2;
1898 bool done_with_replay_ : 1; 1898 bool done_with_replay_ : 1;
1899 1899
1900 #ifdef DEBUG 1900 #ifdef DEBUG
1901 Handle<JSFunction> closure_; 1901 Handle<JSFunction> closure_;
1902 #endif 1902 #endif
1903 }; 1903 };
1904 1904
1905 1905
1906 class HEnvironmentMarker V8_FINAL : public HTemplateInstruction<1> { 1906 class HEnvironmentMarker FINAL : public HTemplateInstruction<1> {
1907 public: 1907 public:
1908 enum Kind { BIND, LOOKUP }; 1908 enum Kind { BIND, LOOKUP };
1909 1909
1910 DECLARE_INSTRUCTION_FACTORY_P2(HEnvironmentMarker, Kind, int); 1910 DECLARE_INSTRUCTION_FACTORY_P2(HEnvironmentMarker, Kind, int);
1911 1911
1912 Kind kind() const { return kind_; } 1912 Kind kind() const { return kind_; }
1913 int index() const { return index_; } 1913 int index() const { return index_; }
1914 HSimulate* next_simulate() { return next_simulate_; } 1914 HSimulate* next_simulate() { return next_simulate_; }
1915 void set_next_simulate(HSimulate* simulate) { 1915 void set_next_simulate(HSimulate* simulate) {
1916 next_simulate_ = simulate; 1916 next_simulate_ = simulate;
1917 } 1917 }
1918 1918
1919 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1919 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1920 return Representation::None(); 1920 return Representation::None();
1921 } 1921 }
1922 1922
1923 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 1923 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
1924 1924
1925 #ifdef DEBUG 1925 #ifdef DEBUG
1926 void set_closure(Handle<JSFunction> closure) { 1926 void set_closure(Handle<JSFunction> closure) {
1927 DCHECK(closure_.is_null()); 1927 DCHECK(closure_.is_null());
1928 DCHECK(!closure.is_null()); 1928 DCHECK(!closure.is_null());
1929 closure_ = closure; 1929 closure_ = closure;
1930 } 1930 }
1931 Handle<JSFunction> closure() const { return closure_; } 1931 Handle<JSFunction> closure() const { return closure_; }
1932 #endif 1932 #endif
1933 1933
1934 DECLARE_CONCRETE_INSTRUCTION(EnvironmentMarker); 1934 DECLARE_CONCRETE_INSTRUCTION(EnvironmentMarker);
1935 1935
1936 private: 1936 private:
1937 HEnvironmentMarker(Kind kind, int index) 1937 HEnvironmentMarker(Kind kind, int index)
1938 : kind_(kind), index_(index), next_simulate_(NULL) { } 1938 : kind_(kind), index_(index), next_simulate_(NULL) { }
1939 1939
1940 Kind kind_; 1940 Kind kind_;
1941 int index_; 1941 int index_;
1942 HSimulate* next_simulate_; 1942 HSimulate* next_simulate_;
1943 1943
1944 #ifdef DEBUG 1944 #ifdef DEBUG
1945 Handle<JSFunction> closure_; 1945 Handle<JSFunction> closure_;
1946 #endif 1946 #endif
1947 }; 1947 };
1948 1948
1949 1949
1950 class HStackCheck V8_FINAL : public HTemplateInstruction<1> { 1950 class HStackCheck FINAL : public HTemplateInstruction<1> {
1951 public: 1951 public:
1952 enum Type { 1952 enum Type {
1953 kFunctionEntry, 1953 kFunctionEntry,
1954 kBackwardsBranch 1954 kBackwardsBranch
1955 }; 1955 };
1956 1956
1957 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HStackCheck, Type); 1957 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HStackCheck, Type);
1958 1958
1959 HValue* context() { return OperandAt(0); } 1959 HValue* context() { return OperandAt(0); }
1960 1960
1961 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1961 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
1962 return Representation::Tagged(); 1962 return Representation::Tagged();
1963 } 1963 }
1964 1964
1965 void Eliminate() { 1965 void Eliminate() {
1966 // The stack check eliminator might try to eliminate the same stack 1966 // The stack check eliminator might try to eliminate the same stack
1967 // check instruction multiple times. 1967 // check instruction multiple times.
1968 if (IsLinked()) { 1968 if (IsLinked()) {
1969 DeleteAndReplaceWith(NULL); 1969 DeleteAndReplaceWith(NULL);
1970 } 1970 }
1971 } 1971 }
(...skipping 18 matching lines...) Expand all
1990 CONSTRUCT_CALL_RETURN, // Either use allocated receiver or return value. 1990 CONSTRUCT_CALL_RETURN, // Either use allocated receiver or return value.
1991 GETTER_CALL_RETURN, // Returning from a getter, need to restore context. 1991 GETTER_CALL_RETURN, // Returning from a getter, need to restore context.
1992 SETTER_CALL_RETURN // Use the RHS of the assignment as the return value. 1992 SETTER_CALL_RETURN // Use the RHS of the assignment as the return value.
1993 }; 1993 };
1994 1994
1995 1995
1996 class HArgumentsObject; 1996 class HArgumentsObject;
1997 class HConstant; 1997 class HConstant;
1998 1998
1999 1999
2000 class HEnterInlined V8_FINAL : public HTemplateInstruction<0> { 2000 class HEnterInlined FINAL : public HTemplateInstruction<0> {
2001 public: 2001 public:
2002 static HEnterInlined* New(Zone* zone, HValue* context, BailoutId return_id, 2002 static HEnterInlined* New(Zone* zone, HValue* context, BailoutId return_id,
2003 Handle<JSFunction> closure, 2003 Handle<JSFunction> closure,
2004 HConstant* closure_context, int arguments_count, 2004 HConstant* closure_context, int arguments_count,
2005 FunctionLiteral* function, 2005 FunctionLiteral* function,
2006 InliningKind inlining_kind, Variable* arguments_var, 2006 InliningKind inlining_kind, Variable* arguments_var,
2007 HArgumentsObject* arguments_object) { 2007 HArgumentsObject* arguments_object) {
2008 return new (zone) HEnterInlined(return_id, closure, closure_context, 2008 return new (zone) HEnterInlined(return_id, closure, closure_context,
2009 arguments_count, function, inlining_kind, 2009 arguments_count, function, inlining_kind,
2010 arguments_var, arguments_object, zone); 2010 arguments_var, arguments_object, zone);
2011 } 2011 }
2012 2012
2013 void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone); 2013 void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone);
2014 ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; } 2014 ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; }
2015 2015
2016 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 2016 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
2017 2017
2018 Handle<JSFunction> closure() const { return closure_; } 2018 Handle<JSFunction> closure() const { return closure_; }
2019 HConstant* closure_context() const { return closure_context_; } 2019 HConstant* closure_context() const { return closure_context_; }
2020 int arguments_count() const { return arguments_count_; } 2020 int arguments_count() const { return arguments_count_; }
2021 bool arguments_pushed() const { return arguments_pushed_; } 2021 bool arguments_pushed() const { return arguments_pushed_; }
2022 void set_arguments_pushed() { arguments_pushed_ = true; } 2022 void set_arguments_pushed() { arguments_pushed_ = true; }
2023 FunctionLiteral* function() const { return function_; } 2023 FunctionLiteral* function() const { return function_; }
2024 InliningKind inlining_kind() const { return inlining_kind_; } 2024 InliningKind inlining_kind() const { return inlining_kind_; }
2025 BailoutId ReturnId() const { return return_id_; } 2025 BailoutId ReturnId() const { return return_id_; }
2026 2026
2027 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2027 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
2028 return Representation::None(); 2028 return Representation::None();
2029 } 2029 }
2030 2030
2031 Variable* arguments_var() { return arguments_var_; } 2031 Variable* arguments_var() { return arguments_var_; }
2032 HArgumentsObject* arguments_object() { return arguments_object_; } 2032 HArgumentsObject* arguments_object() { return arguments_object_; }
2033 2033
2034 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) 2034 DECLARE_CONCRETE_INSTRUCTION(EnterInlined)
2035 2035
2036 private: 2036 private:
2037 HEnterInlined(BailoutId return_id, Handle<JSFunction> closure, 2037 HEnterInlined(BailoutId return_id, Handle<JSFunction> closure,
(...skipping 18 matching lines...) Expand all
2056 int arguments_count_; 2056 int arguments_count_;
2057 bool arguments_pushed_; 2057 bool arguments_pushed_;
2058 FunctionLiteral* function_; 2058 FunctionLiteral* function_;
2059 InliningKind inlining_kind_; 2059 InliningKind inlining_kind_;
2060 Variable* arguments_var_; 2060 Variable* arguments_var_;
2061 HArgumentsObject* arguments_object_; 2061 HArgumentsObject* arguments_object_;
2062 ZoneList<HBasicBlock*> return_targets_; 2062 ZoneList<HBasicBlock*> return_targets_;
2063 }; 2063 };
2064 2064
2065 2065
2066 class HLeaveInlined V8_FINAL : public HTemplateInstruction<0> { 2066 class HLeaveInlined FINAL : public HTemplateInstruction<0> {
2067 public: 2067 public:
2068 HLeaveInlined(HEnterInlined* entry, 2068 HLeaveInlined(HEnterInlined* entry,
2069 int drop_count) 2069 int drop_count)
2070 : entry_(entry), 2070 : entry_(entry),
2071 drop_count_(drop_count) { } 2071 drop_count_(drop_count) { }
2072 2072
2073 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2073 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
2074 return Representation::None(); 2074 return Representation::None();
2075 } 2075 }
2076 2076
2077 virtual int argument_delta() const V8_OVERRIDE { 2077 virtual int argument_delta() const OVERRIDE {
2078 return entry_->arguments_pushed() ? -drop_count_ : 0; 2078 return entry_->arguments_pushed() ? -drop_count_ : 0;
2079 } 2079 }
2080 2080
2081 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined) 2081 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined)
2082 2082
2083 private: 2083 private:
2084 HEnterInlined* entry_; 2084 HEnterInlined* entry_;
2085 int drop_count_; 2085 int drop_count_;
2086 }; 2086 };
2087 2087
2088 2088
2089 class HPushArguments V8_FINAL : public HInstruction { 2089 class HPushArguments FINAL : public HInstruction {
2090 public: 2090 public:
2091 static HPushArguments* New(Zone* zone, HValue* context) { 2091 static HPushArguments* New(Zone* zone, HValue* context) {
2092 return new(zone) HPushArguments(zone); 2092 return new(zone) HPushArguments(zone);
2093 } 2093 }
2094 static HPushArguments* New(Zone* zone, HValue* context, HValue* arg1) { 2094 static HPushArguments* New(Zone* zone, HValue* context, HValue* arg1) {
2095 HPushArguments* instr = new(zone) HPushArguments(zone); 2095 HPushArguments* instr = new(zone) HPushArguments(zone);
2096 instr->AddInput(arg1); 2096 instr->AddInput(arg1);
2097 return instr; 2097 return instr;
2098 } 2098 }
2099 static HPushArguments* New(Zone* zone, HValue* context, HValue* arg1, 2099 static HPushArguments* New(Zone* zone, HValue* context, HValue* arg1,
(...skipping 14 matching lines...) Expand all
2114 static HPushArguments* New(Zone* zone, HValue* context, HValue* arg1, 2114 static HPushArguments* New(Zone* zone, HValue* context, HValue* arg1,
2115 HValue* arg2, HValue* arg3, HValue* arg4) { 2115 HValue* arg2, HValue* arg3, HValue* arg4) {
2116 HPushArguments* instr = new(zone) HPushArguments(zone); 2116 HPushArguments* instr = new(zone) HPushArguments(zone);
2117 instr->AddInput(arg1); 2117 instr->AddInput(arg1);
2118 instr->AddInput(arg2); 2118 instr->AddInput(arg2);
2119 instr->AddInput(arg3); 2119 instr->AddInput(arg3);
2120 instr->AddInput(arg4); 2120 instr->AddInput(arg4);
2121 return instr; 2121 return instr;
2122 } 2122 }
2123 2123
2124 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2124 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
2125 return Representation::Tagged(); 2125 return Representation::Tagged();
2126 } 2126 }
2127 2127
2128 virtual int argument_delta() const V8_OVERRIDE { return inputs_.length(); } 2128 virtual int argument_delta() const OVERRIDE { return inputs_.length(); }
2129 HValue* argument(int i) { return OperandAt(i); } 2129 HValue* argument(int i) { return OperandAt(i); }
2130 2130
2131 virtual int OperandCount() const V8_FINAL V8_OVERRIDE { 2131 virtual int OperandCount() const FINAL OVERRIDE {
2132 return inputs_.length(); 2132 return inputs_.length();
2133 } 2133 }
2134 virtual HValue* OperandAt(int i) const V8_FINAL V8_OVERRIDE { 2134 virtual HValue* OperandAt(int i) const FINAL OVERRIDE {
2135 return inputs_[i]; 2135 return inputs_[i];
2136 } 2136 }
2137 2137
2138 void AddInput(HValue* value); 2138 void AddInput(HValue* value);
2139 2139
2140 DECLARE_CONCRETE_INSTRUCTION(PushArguments) 2140 DECLARE_CONCRETE_INSTRUCTION(PushArguments)
2141 2141
2142 protected: 2142 protected:
2143 virtual void InternalSetOperandAt(int i, HValue* value) V8_FINAL V8_OVERRIDE { 2143 virtual void InternalSetOperandAt(int i, HValue* value) FINAL OVERRIDE {
2144 inputs_[i] = value; 2144 inputs_[i] = value;
2145 } 2145 }
2146 2146
2147 private: 2147 private:
2148 explicit HPushArguments(Zone* zone) 2148 explicit HPushArguments(Zone* zone)
2149 : HInstruction(HType::Tagged()), inputs_(4, zone) { 2149 : HInstruction(HType::Tagged()), inputs_(4, zone) {
2150 set_representation(Representation::Tagged()); 2150 set_representation(Representation::Tagged());
2151 } 2151 }
2152 2152
2153 ZoneList<HValue*> inputs_; 2153 ZoneList<HValue*> inputs_;
2154 }; 2154 };
2155 2155
2156 2156
2157 class HThisFunction V8_FINAL : public HTemplateInstruction<0> { 2157 class HThisFunction FINAL : public HTemplateInstruction<0> {
2158 public: 2158 public:
2159 DECLARE_INSTRUCTION_FACTORY_P0(HThisFunction); 2159 DECLARE_INSTRUCTION_FACTORY_P0(HThisFunction);
2160 2160
2161 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2161 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
2162 return Representation::None(); 2162 return Representation::None();
2163 } 2163 }
2164 2164
2165 DECLARE_CONCRETE_INSTRUCTION(ThisFunction) 2165 DECLARE_CONCRETE_INSTRUCTION(ThisFunction)
2166 2166
2167 protected: 2167 protected:
2168 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 2168 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
2169 2169
2170 private: 2170 private:
2171 HThisFunction() { 2171 HThisFunction() {
2172 set_representation(Representation::Tagged()); 2172 set_representation(Representation::Tagged());
2173 SetFlag(kUseGVN); 2173 SetFlag(kUseGVN);
2174 } 2174 }
2175 2175
2176 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 2176 virtual bool IsDeletable() const OVERRIDE { return true; }
2177 }; 2177 };
2178 2178
2179 2179
2180 class HDeclareGlobals V8_FINAL : public HUnaryOperation { 2180 class HDeclareGlobals FINAL : public HUnaryOperation {
2181 public: 2181 public:
2182 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HDeclareGlobals, 2182 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HDeclareGlobals,
2183 Handle<FixedArray>, 2183 Handle<FixedArray>,
2184 int); 2184 int);
2185 2185
2186 HValue* context() { return OperandAt(0); } 2186 HValue* context() { return OperandAt(0); }
2187 Handle<FixedArray> pairs() const { return pairs_; } 2187 Handle<FixedArray> pairs() const { return pairs_; }
2188 int flags() const { return flags_; } 2188 int flags() const { return flags_; }
2189 2189
2190 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals) 2190 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals)
2191 2191
2192 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2192 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
2193 return Representation::Tagged(); 2193 return Representation::Tagged();
2194 } 2194 }
2195 2195
2196 private: 2196 private:
2197 HDeclareGlobals(HValue* context, 2197 HDeclareGlobals(HValue* context,
2198 Handle<FixedArray> pairs, 2198 Handle<FixedArray> pairs,
2199 int flags) 2199 int flags)
2200 : HUnaryOperation(context), 2200 : HUnaryOperation(context),
2201 pairs_(pairs), 2201 pairs_(pairs),
2202 flags_(flags) { 2202 flags_(flags) {
2203 set_representation(Representation::Tagged()); 2203 set_representation(Representation::Tagged());
2204 SetAllSideEffects(); 2204 SetAllSideEffects();
2205 } 2205 }
2206 2206
2207 Handle<FixedArray> pairs_; 2207 Handle<FixedArray> pairs_;
2208 int flags_; 2208 int flags_;
2209 }; 2209 };
2210 2210
2211 2211
2212 template <int V> 2212 template <int V>
2213 class HCall : public HTemplateInstruction<V> { 2213 class HCall : public HTemplateInstruction<V> {
2214 public: 2214 public:
2215 // The argument count includes the receiver. 2215 // The argument count includes the receiver.
2216 explicit HCall<V>(int argument_count) : argument_count_(argument_count) { 2216 explicit HCall<V>(int argument_count) : argument_count_(argument_count) {
2217 this->set_representation(Representation::Tagged()); 2217 this->set_representation(Representation::Tagged());
2218 this->SetAllSideEffects(); 2218 this->SetAllSideEffects();
2219 } 2219 }
2220 2220
2221 virtual HType CalculateInferredType() V8_FINAL V8_OVERRIDE { 2221 virtual HType CalculateInferredType() FINAL OVERRIDE {
2222 return HType::Tagged(); 2222 return HType::Tagged();
2223 } 2223 }
2224 2224
2225 virtual int argument_count() const { 2225 virtual int argument_count() const {
2226 return argument_count_; 2226 return argument_count_;
2227 } 2227 }
2228 2228
2229 virtual int argument_delta() const V8_OVERRIDE { 2229 virtual int argument_delta() const OVERRIDE {
2230 return -argument_count(); 2230 return -argument_count();
2231 } 2231 }
2232 2232
2233 private: 2233 private:
2234 int argument_count_; 2234 int argument_count_;
2235 }; 2235 };
2236 2236
2237 2237
2238 class HUnaryCall : public HCall<1> { 2238 class HUnaryCall : public HCall<1> {
2239 public: 2239 public:
2240 HUnaryCall(HValue* value, int argument_count) 2240 HUnaryCall(HValue* value, int argument_count)
2241 : HCall<1>(argument_count) { 2241 : HCall<1>(argument_count) {
2242 SetOperandAt(0, value); 2242 SetOperandAt(0, value);
2243 } 2243 }
2244 2244
2245 virtual Representation RequiredInputRepresentation( 2245 virtual Representation RequiredInputRepresentation(
2246 int index) V8_FINAL V8_OVERRIDE { 2246 int index) FINAL OVERRIDE {
2247 return Representation::Tagged(); 2247 return Representation::Tagged();
2248 } 2248 }
2249 2249
2250 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 2250 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
2251 2251
2252 HValue* value() const { return OperandAt(0); } 2252 HValue* value() const { return OperandAt(0); }
2253 }; 2253 };
2254 2254
2255 2255
2256 class HBinaryCall : public HCall<2> { 2256 class HBinaryCall : public HCall<2> {
2257 public: 2257 public:
2258 HBinaryCall(HValue* first, HValue* second, int argument_count) 2258 HBinaryCall(HValue* first, HValue* second, int argument_count)
2259 : HCall<2>(argument_count) { 2259 : HCall<2>(argument_count) {
2260 SetOperandAt(0, first); 2260 SetOperandAt(0, first);
2261 SetOperandAt(1, second); 2261 SetOperandAt(1, second);
2262 } 2262 }
2263 2263
2264 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 2264 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
2265 2265
2266 virtual Representation RequiredInputRepresentation( 2266 virtual Representation RequiredInputRepresentation(
2267 int index) V8_FINAL V8_OVERRIDE { 2267 int index) FINAL OVERRIDE {
2268 return Representation::Tagged(); 2268 return Representation::Tagged();
2269 } 2269 }
2270 2270
2271 HValue* first() const { return OperandAt(0); } 2271 HValue* first() const { return OperandAt(0); }
2272 HValue* second() const { return OperandAt(1); } 2272 HValue* second() const { return OperandAt(1); }
2273 }; 2273 };
2274 2274
2275 2275
2276 class HCallJSFunction V8_FINAL : public HCall<1> { 2276 class HCallJSFunction FINAL : public HCall<1> {
2277 public: 2277 public:
2278 static HCallJSFunction* New(Zone* zone, 2278 static HCallJSFunction* New(Zone* zone,
2279 HValue* context, 2279 HValue* context,
2280 HValue* function, 2280 HValue* function,
2281 int argument_count, 2281 int argument_count,
2282 bool pass_argument_count); 2282 bool pass_argument_count);
2283 2283
2284 HValue* function() const { return OperandAt(0); } 2284 HValue* function() const { return OperandAt(0); }
2285 2285
2286 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 2286 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
2287 2287
2288 virtual Representation RequiredInputRepresentation( 2288 virtual Representation RequiredInputRepresentation(
2289 int index) V8_FINAL V8_OVERRIDE { 2289 int index) FINAL OVERRIDE {
2290 DCHECK(index == 0); 2290 DCHECK(index == 0);
2291 return Representation::Tagged(); 2291 return Representation::Tagged();
2292 } 2292 }
2293 2293
2294 bool pass_argument_count() const { return pass_argument_count_; } 2294 bool pass_argument_count() const { return pass_argument_count_; }
2295 2295
2296 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE { 2296 virtual bool HasStackCheck() FINAL OVERRIDE {
2297 return has_stack_check_; 2297 return has_stack_check_;
2298 } 2298 }
2299 2299
2300 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction) 2300 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction)
2301 2301
2302 private: 2302 private:
2303 // The argument count includes the receiver. 2303 // The argument count includes the receiver.
2304 HCallJSFunction(HValue* function, 2304 HCallJSFunction(HValue* function,
2305 int argument_count, 2305 int argument_count,
2306 bool pass_argument_count, 2306 bool pass_argument_count,
2307 bool has_stack_check) 2307 bool has_stack_check)
2308 : HCall<1>(argument_count), 2308 : HCall<1>(argument_count),
2309 pass_argument_count_(pass_argument_count), 2309 pass_argument_count_(pass_argument_count),
2310 has_stack_check_(has_stack_check) { 2310 has_stack_check_(has_stack_check) {
2311 SetOperandAt(0, function); 2311 SetOperandAt(0, function);
2312 } 2312 }
2313 2313
2314 bool pass_argument_count_; 2314 bool pass_argument_count_;
2315 bool has_stack_check_; 2315 bool has_stack_check_;
2316 }; 2316 };
2317 2317
2318 2318
2319 class HCallWithDescriptor V8_FINAL : public HInstruction { 2319 class HCallWithDescriptor FINAL : public HInstruction {
2320 public: 2320 public:
2321 static HCallWithDescriptor* New(Zone* zone, HValue* context, HValue* target, 2321 static HCallWithDescriptor* New(Zone* zone, HValue* context, HValue* target,
2322 int argument_count, 2322 int argument_count,
2323 const CallInterfaceDescriptor* descriptor, 2323 const CallInterfaceDescriptor* descriptor,
2324 const Vector<HValue*>& operands) { 2324 const Vector<HValue*>& operands) {
2325 DCHECK(operands.length() == descriptor->GetEnvironmentLength()); 2325 DCHECK(operands.length() == descriptor->GetEnvironmentLength());
2326 HCallWithDescriptor* res = 2326 HCallWithDescriptor* res =
2327 new(zone) HCallWithDescriptor(target, argument_count, 2327 new(zone) HCallWithDescriptor(target, argument_count,
2328 descriptor, operands, zone); 2328 descriptor, operands, zone);
2329 return res; 2329 return res;
2330 } 2330 }
2331 2331
2332 virtual int OperandCount() const V8_FINAL V8_OVERRIDE { 2332 virtual int OperandCount() const FINAL OVERRIDE {
2333 return values_.length(); 2333 return values_.length();
2334 } 2334 }
2335 virtual HValue* OperandAt(int index) const V8_FINAL V8_OVERRIDE { 2335 virtual HValue* OperandAt(int index) const FINAL OVERRIDE {
2336 return values_[index]; 2336 return values_[index];
2337 } 2337 }
2338 2338
2339 virtual Representation RequiredInputRepresentation( 2339 virtual Representation RequiredInputRepresentation(
2340 int index) V8_FINAL V8_OVERRIDE { 2340 int index) FINAL OVERRIDE {
2341 if (index == 0) { 2341 if (index == 0) {
2342 return Representation::Tagged(); 2342 return Representation::Tagged();
2343 } else { 2343 } else {
2344 int par_index = index - 1; 2344 int par_index = index - 1;
2345 DCHECK(par_index < descriptor_->GetEnvironmentLength()); 2345 DCHECK(par_index < descriptor_->GetEnvironmentLength());
2346 return descriptor_->GetParameterRepresentation(par_index); 2346 return descriptor_->GetParameterRepresentation(par_index);
2347 } 2347 }
2348 } 2348 }
2349 2349
2350 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor) 2350 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor)
2351 2351
2352 virtual HType CalculateInferredType() V8_FINAL V8_OVERRIDE { 2352 virtual HType CalculateInferredType() FINAL OVERRIDE {
2353 return HType::Tagged(); 2353 return HType::Tagged();
2354 } 2354 }
2355 2355
2356 virtual int argument_count() const { 2356 virtual int argument_count() const {
2357 return argument_count_; 2357 return argument_count_;
2358 } 2358 }
2359 2359
2360 virtual int argument_delta() const V8_OVERRIDE { 2360 virtual int argument_delta() const OVERRIDE {
2361 return -argument_count_; 2361 return -argument_count_;
2362 } 2362 }
2363 2363
2364 const CallInterfaceDescriptor* descriptor() const { return descriptor_; } 2364 const CallInterfaceDescriptor* descriptor() const { return descriptor_; }
2365 2365
2366 HValue* target() { 2366 HValue* target() {
2367 return OperandAt(0); 2367 return OperandAt(0);
2368 } 2368 }
2369 2369
2370 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 2370 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
2371 2371
2372 private: 2372 private:
2373 // The argument count includes the receiver. 2373 // The argument count includes the receiver.
2374 HCallWithDescriptor(HValue* target, int argument_count, 2374 HCallWithDescriptor(HValue* target, int argument_count,
2375 const CallInterfaceDescriptor* descriptor, 2375 const CallInterfaceDescriptor* descriptor,
2376 const Vector<HValue*>& operands, Zone* zone) 2376 const Vector<HValue*>& operands, Zone* zone)
2377 : descriptor_(descriptor), 2377 : descriptor_(descriptor),
2378 values_(descriptor->GetEnvironmentLength() + 1, zone) { 2378 values_(descriptor->GetEnvironmentLength() + 1, zone) {
2379 argument_count_ = argument_count; 2379 argument_count_ = argument_count;
2380 AddOperand(target, zone); 2380 AddOperand(target, zone);
2381 for (int i = 0; i < operands.length(); i++) { 2381 for (int i = 0; i < operands.length(); i++) {
2382 AddOperand(operands[i], zone); 2382 AddOperand(operands[i], zone);
2383 } 2383 }
2384 this->set_representation(Representation::Tagged()); 2384 this->set_representation(Representation::Tagged());
2385 this->SetAllSideEffects(); 2385 this->SetAllSideEffects();
2386 } 2386 }
2387 2387
2388 void AddOperand(HValue* v, Zone* zone) { 2388 void AddOperand(HValue* v, Zone* zone) {
2389 values_.Add(NULL, zone); 2389 values_.Add(NULL, zone);
2390 SetOperandAt(values_.length() - 1, v); 2390 SetOperandAt(values_.length() - 1, v);
2391 } 2391 }
2392 2392
2393 void InternalSetOperandAt(int index, 2393 void InternalSetOperandAt(int index,
2394 HValue* value) V8_FINAL V8_OVERRIDE { 2394 HValue* value) FINAL OVERRIDE {
2395 values_[index] = value; 2395 values_[index] = value;
2396 } 2396 }
2397 2397
2398 const CallInterfaceDescriptor* descriptor_; 2398 const CallInterfaceDescriptor* descriptor_;
2399 ZoneList<HValue*> values_; 2399 ZoneList<HValue*> values_;
2400 int argument_count_; 2400 int argument_count_;
2401 }; 2401 };
2402 2402
2403 2403
2404 class HInvokeFunction V8_FINAL : public HBinaryCall { 2404 class HInvokeFunction FINAL : public HBinaryCall {
2405 public: 2405 public:
2406 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); 2406 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int);
2407 2407
2408 HInvokeFunction(HValue* context, 2408 HInvokeFunction(HValue* context,
2409 HValue* function, 2409 HValue* function,
2410 Handle<JSFunction> known_function, 2410 Handle<JSFunction> known_function,
2411 int argument_count) 2411 int argument_count)
2412 : HBinaryCall(context, function, argument_count), 2412 : HBinaryCall(context, function, argument_count),
2413 known_function_(known_function) { 2413 known_function_(known_function) {
2414 formal_parameter_count_ = known_function.is_null() 2414 formal_parameter_count_ = known_function.is_null()
(...skipping 10 matching lines...) Expand all
2425 int argument_count) { 2425 int argument_count) {
2426 return new(zone) HInvokeFunction(context, function, 2426 return new(zone) HInvokeFunction(context, function,
2427 known_function, argument_count); 2427 known_function, argument_count);
2428 } 2428 }
2429 2429
2430 HValue* context() { return first(); } 2430 HValue* context() { return first(); }
2431 HValue* function() { return second(); } 2431 HValue* function() { return second(); }
2432 Handle<JSFunction> known_function() { return known_function_; } 2432 Handle<JSFunction> known_function() { return known_function_; }
2433 int formal_parameter_count() const { return formal_parameter_count_; } 2433 int formal_parameter_count() const { return formal_parameter_count_; }
2434 2434
2435 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE { 2435 virtual bool HasStackCheck() FINAL OVERRIDE {
2436 return has_stack_check_; 2436 return has_stack_check_;
2437 } 2437 }
2438 2438
2439 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) 2439 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction)
2440 2440
2441 private: 2441 private:
2442 HInvokeFunction(HValue* context, HValue* function, int argument_count) 2442 HInvokeFunction(HValue* context, HValue* function, int argument_count)
2443 : HBinaryCall(context, function, argument_count), 2443 : HBinaryCall(context, function, argument_count),
2444 has_stack_check_(false) { 2444 has_stack_check_(false) {
2445 } 2445 }
2446 2446
2447 Handle<JSFunction> known_function_; 2447 Handle<JSFunction> known_function_;
2448 int formal_parameter_count_; 2448 int formal_parameter_count_;
2449 bool has_stack_check_; 2449 bool has_stack_check_;
2450 }; 2450 };
2451 2451
2452 2452
2453 class HCallFunction V8_FINAL : public HBinaryCall { 2453 class HCallFunction FINAL : public HBinaryCall {
2454 public: 2454 public:
2455 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallFunction, HValue*, int); 2455 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallFunction, HValue*, int);
2456 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3( 2456 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(
2457 HCallFunction, HValue*, int, CallFunctionFlags); 2457 HCallFunction, HValue*, int, CallFunctionFlags);
2458 2458
2459 HValue* context() { return first(); } 2459 HValue* context() { return first(); }
2460 HValue* function() { return second(); } 2460 HValue* function() { return second(); }
2461 CallFunctionFlags function_flags() const { return function_flags_; } 2461 CallFunctionFlags function_flags() const { return function_flags_; }
2462 2462
2463 DECLARE_CONCRETE_INSTRUCTION(CallFunction) 2463 DECLARE_CONCRETE_INSTRUCTION(CallFunction)
2464 2464
2465 virtual int argument_delta() const V8_OVERRIDE { return -argument_count(); } 2465 virtual int argument_delta() const OVERRIDE { return -argument_count(); }
2466 2466
2467 private: 2467 private:
2468 HCallFunction(HValue* context, 2468 HCallFunction(HValue* context,
2469 HValue* function, 2469 HValue* function,
2470 int argument_count, 2470 int argument_count,
2471 CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS) 2471 CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS)
2472 : HBinaryCall(context, function, argument_count), function_flags_(flags) { 2472 : HBinaryCall(context, function, argument_count), function_flags_(flags) {
2473 } 2473 }
2474 CallFunctionFlags function_flags_; 2474 CallFunctionFlags function_flags_;
2475 }; 2475 };
2476 2476
2477 2477
2478 class HCallNew V8_FINAL : public HBinaryCall { 2478 class HCallNew FINAL : public HBinaryCall {
2479 public: 2479 public:
2480 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int); 2480 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int);
2481 2481
2482 HValue* context() { return first(); } 2482 HValue* context() { return first(); }
2483 HValue* constructor() { return second(); } 2483 HValue* constructor() { return second(); }
2484 2484
2485 DECLARE_CONCRETE_INSTRUCTION(CallNew) 2485 DECLARE_CONCRETE_INSTRUCTION(CallNew)
2486 2486
2487 private: 2487 private:
2488 HCallNew(HValue* context, HValue* constructor, int argument_count) 2488 HCallNew(HValue* context, HValue* constructor, int argument_count)
2489 : HBinaryCall(context, constructor, argument_count) {} 2489 : HBinaryCall(context, constructor, argument_count) {}
2490 }; 2490 };
2491 2491
2492 2492
2493 class HCallNewArray V8_FINAL : public HBinaryCall { 2493 class HCallNewArray FINAL : public HBinaryCall {
2494 public: 2494 public:
2495 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallNewArray, 2495 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallNewArray,
2496 HValue*, 2496 HValue*,
2497 int, 2497 int,
2498 ElementsKind); 2498 ElementsKind);
2499 2499
2500 HValue* context() { return first(); } 2500 HValue* context() { return first(); }
2501 HValue* constructor() { return second(); } 2501 HValue* constructor() { return second(); }
2502 2502
2503 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 2503 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
2504 2504
2505 ElementsKind elements_kind() const { return elements_kind_; } 2505 ElementsKind elements_kind() const { return elements_kind_; }
2506 2506
2507 DECLARE_CONCRETE_INSTRUCTION(CallNewArray) 2507 DECLARE_CONCRETE_INSTRUCTION(CallNewArray)
2508 2508
2509 private: 2509 private:
2510 HCallNewArray(HValue* context, HValue* constructor, int argument_count, 2510 HCallNewArray(HValue* context, HValue* constructor, int argument_count,
2511 ElementsKind elements_kind) 2511 ElementsKind elements_kind)
2512 : HBinaryCall(context, constructor, argument_count), 2512 : HBinaryCall(context, constructor, argument_count),
2513 elements_kind_(elements_kind) {} 2513 elements_kind_(elements_kind) {}
2514 2514
2515 ElementsKind elements_kind_; 2515 ElementsKind elements_kind_;
2516 }; 2516 };
2517 2517
2518 2518
2519 class HCallRuntime V8_FINAL : public HCall<1> { 2519 class HCallRuntime FINAL : public HCall<1> {
2520 public: 2520 public:
2521 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallRuntime, 2521 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallRuntime,
2522 Handle<String>, 2522 Handle<String>,
2523 const Runtime::Function*, 2523 const Runtime::Function*,
2524 int); 2524 int);
2525 2525
2526 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 2526 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
2527 2527
2528 HValue* context() { return OperandAt(0); } 2528 HValue* context() { return OperandAt(0); }
2529 const Runtime::Function* function() const { return c_function_; } 2529 const Runtime::Function* function() const { return c_function_; }
2530 Handle<String> name() const { return name_; } 2530 Handle<String> name() const { return name_; }
2531 SaveFPRegsMode save_doubles() const { return save_doubles_; } 2531 SaveFPRegsMode save_doubles() const { return save_doubles_; }
2532 void set_save_doubles(SaveFPRegsMode save_doubles) { 2532 void set_save_doubles(SaveFPRegsMode save_doubles) {
2533 save_doubles_ = save_doubles; 2533 save_doubles_ = save_doubles;
2534 } 2534 }
2535 2535
2536 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2536 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
2537 return Representation::Tagged(); 2537 return Representation::Tagged();
2538 } 2538 }
2539 2539
2540 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) 2540 DECLARE_CONCRETE_INSTRUCTION(CallRuntime)
2541 2541
2542 private: 2542 private:
2543 HCallRuntime(HValue* context, 2543 HCallRuntime(HValue* context,
2544 Handle<String> name, 2544 Handle<String> name,
2545 const Runtime::Function* c_function, 2545 const Runtime::Function* c_function,
2546 int argument_count) 2546 int argument_count)
2547 : HCall<1>(argument_count), c_function_(c_function), name_(name), 2547 : HCall<1>(argument_count), c_function_(c_function), name_(name),
2548 save_doubles_(kDontSaveFPRegs) { 2548 save_doubles_(kDontSaveFPRegs) {
2549 SetOperandAt(0, context); 2549 SetOperandAt(0, context);
2550 } 2550 }
2551 2551
2552 const Runtime::Function* c_function_; 2552 const Runtime::Function* c_function_;
2553 Handle<String> name_; 2553 Handle<String> name_;
2554 SaveFPRegsMode save_doubles_; 2554 SaveFPRegsMode save_doubles_;
2555 }; 2555 };
2556 2556
2557 2557
2558 class HMapEnumLength V8_FINAL : public HUnaryOperation { 2558 class HMapEnumLength FINAL : public HUnaryOperation {
2559 public: 2559 public:
2560 DECLARE_INSTRUCTION_FACTORY_P1(HMapEnumLength, HValue*); 2560 DECLARE_INSTRUCTION_FACTORY_P1(HMapEnumLength, HValue*);
2561 2561
2562 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2562 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
2563 return Representation::Tagged(); 2563 return Representation::Tagged();
2564 } 2564 }
2565 2565
2566 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength) 2566 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength)
2567 2567
2568 protected: 2568 protected:
2569 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 2569 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
2570 2570
2571 private: 2571 private:
2572 explicit HMapEnumLength(HValue* value) 2572 explicit HMapEnumLength(HValue* value)
2573 : HUnaryOperation(value, HType::Smi()) { 2573 : HUnaryOperation(value, HType::Smi()) {
2574 set_representation(Representation::Smi()); 2574 set_representation(Representation::Smi());
2575 SetFlag(kUseGVN); 2575 SetFlag(kUseGVN);
2576 SetDependsOnFlag(kMaps); 2576 SetDependsOnFlag(kMaps);
2577 } 2577 }
2578 2578
2579 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 2579 virtual bool IsDeletable() const OVERRIDE { return true; }
2580 }; 2580 };
2581 2581
2582 2582
2583 class HUnaryMathOperation V8_FINAL : public HTemplateInstruction<2> { 2583 class HUnaryMathOperation FINAL : public HTemplateInstruction<2> {
2584 public: 2584 public:
2585 static HInstruction* New(Zone* zone, 2585 static HInstruction* New(Zone* zone,
2586 HValue* context, 2586 HValue* context,
2587 HValue* value, 2587 HValue* value,
2588 BuiltinFunctionId op); 2588 BuiltinFunctionId op);
2589 2589
2590 HValue* context() const { return OperandAt(0); } 2590 HValue* context() const { return OperandAt(0); }
2591 HValue* value() const { return OperandAt(1); } 2591 HValue* value() const { return OperandAt(1); }
2592 2592
2593 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 2593 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
2594 2594
2595 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2595 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
2596 if (index == 0) { 2596 if (index == 0) {
2597 return Representation::Tagged(); 2597 return Representation::Tagged();
2598 } else { 2598 } else {
2599 switch (op_) { 2599 switch (op_) {
2600 case kMathFloor: 2600 case kMathFloor:
2601 case kMathRound: 2601 case kMathRound:
2602 case kMathFround: 2602 case kMathFround:
2603 case kMathSqrt: 2603 case kMathSqrt:
2604 case kMathPowHalf: 2604 case kMathPowHalf:
2605 case kMathLog: 2605 case kMathLog:
2606 case kMathExp: 2606 case kMathExp:
2607 return Representation::Double(); 2607 return Representation::Double();
2608 case kMathAbs: 2608 case kMathAbs:
2609 return representation(); 2609 return representation();
2610 case kMathClz32: 2610 case kMathClz32:
2611 return Representation::Integer32(); 2611 return Representation::Integer32();
2612 default: 2612 default:
2613 UNREACHABLE(); 2613 UNREACHABLE();
2614 return Representation::None(); 2614 return Representation::None();
2615 } 2615 }
2616 } 2616 }
2617 } 2617 }
2618 2618
2619 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 2619 virtual Range* InferRange(Zone* zone) OVERRIDE;
2620 2620
2621 virtual HValue* Canonicalize() V8_OVERRIDE; 2621 virtual HValue* Canonicalize() OVERRIDE;
2622 virtual Representation RepresentationFromUses() V8_OVERRIDE; 2622 virtual Representation RepresentationFromUses() OVERRIDE;
2623 virtual Representation RepresentationFromInputs() V8_OVERRIDE; 2623 virtual Representation RepresentationFromInputs() OVERRIDE;
2624 2624
2625 BuiltinFunctionId op() const { return op_; } 2625 BuiltinFunctionId op() const { return op_; }
2626 const char* OpName() const; 2626 const char* OpName() const;
2627 2627
2628 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation) 2628 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation)
2629 2629
2630 protected: 2630 protected:
2631 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 2631 virtual bool DataEquals(HValue* other) OVERRIDE {
2632 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); 2632 HUnaryMathOperation* b = HUnaryMathOperation::cast(other);
2633 return op_ == b->op(); 2633 return op_ == b->op();
2634 } 2634 }
2635 2635
2636 private: 2636 private:
2637 // Indicates if we support a double (and int32) output for Math.floor and 2637 // Indicates if we support a double (and int32) output for Math.floor and
2638 // Math.round. 2638 // Math.round.
2639 bool SupportsFlexibleFloorAndRound() const { 2639 bool SupportsFlexibleFloorAndRound() const {
2640 #ifdef V8_TARGET_ARCH_ARM64 2640 #ifdef V8_TARGET_ARCH_ARM64
2641 return true; 2641 return true;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2673 case kMathPowHalf: 2673 case kMathPowHalf:
2674 set_representation(Representation::Double()); 2674 set_representation(Representation::Double());
2675 break; 2675 break;
2676 default: 2676 default:
2677 UNREACHABLE(); 2677 UNREACHABLE();
2678 } 2678 }
2679 SetFlag(kUseGVN); 2679 SetFlag(kUseGVN);
2680 SetFlag(kAllowUndefinedAsNaN); 2680 SetFlag(kAllowUndefinedAsNaN);
2681 } 2681 }
2682 2682
2683 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 2683 virtual bool IsDeletable() const OVERRIDE { return true; }
2684 2684
2685 HValue* SimplifiedDividendForMathFloorOfDiv(HDiv* hdiv); 2685 HValue* SimplifiedDividendForMathFloorOfDiv(HDiv* hdiv);
2686 HValue* SimplifiedDivisorForMathFloorOfDiv(HDiv* hdiv); 2686 HValue* SimplifiedDivisorForMathFloorOfDiv(HDiv* hdiv);
2687 2687
2688 BuiltinFunctionId op_; 2688 BuiltinFunctionId op_;
2689 }; 2689 };
2690 2690
2691 2691
2692 class HLoadRoot V8_FINAL : public HTemplateInstruction<0> { 2692 class HLoadRoot FINAL : public HTemplateInstruction<0> {
2693 public: 2693 public:
2694 DECLARE_INSTRUCTION_FACTORY_P1(HLoadRoot, Heap::RootListIndex); 2694 DECLARE_INSTRUCTION_FACTORY_P1(HLoadRoot, Heap::RootListIndex);
2695 DECLARE_INSTRUCTION_FACTORY_P2(HLoadRoot, Heap::RootListIndex, HType); 2695 DECLARE_INSTRUCTION_FACTORY_P2(HLoadRoot, Heap::RootListIndex, HType);
2696 2696
2697 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2697 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
2698 return Representation::None(); 2698 return Representation::None();
2699 } 2699 }
2700 2700
2701 Heap::RootListIndex index() const { return index_; } 2701 Heap::RootListIndex index() const { return index_; }
2702 2702
2703 DECLARE_CONCRETE_INSTRUCTION(LoadRoot) 2703 DECLARE_CONCRETE_INSTRUCTION(LoadRoot)
2704 2704
2705 protected: 2705 protected:
2706 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 2706 virtual bool DataEquals(HValue* other) OVERRIDE {
2707 HLoadRoot* b = HLoadRoot::cast(other); 2707 HLoadRoot* b = HLoadRoot::cast(other);
2708 return index_ == b->index_; 2708 return index_ == b->index_;
2709 } 2709 }
2710 2710
2711 private: 2711 private:
2712 explicit HLoadRoot(Heap::RootListIndex index, HType type = HType::Tagged()) 2712 explicit HLoadRoot(Heap::RootListIndex index, HType type = HType::Tagged())
2713 : HTemplateInstruction<0>(type), index_(index) { 2713 : HTemplateInstruction<0>(type), index_(index) {
2714 SetFlag(kUseGVN); 2714 SetFlag(kUseGVN);
2715 // TODO(bmeurer): We'll need kDependsOnRoots once we add the 2715 // TODO(bmeurer): We'll need kDependsOnRoots once we add the
2716 // corresponding HStoreRoot instruction. 2716 // corresponding HStoreRoot instruction.
2717 SetDependsOnFlag(kCalls); 2717 SetDependsOnFlag(kCalls);
2718 } 2718 }
2719 2719
2720 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 2720 virtual bool IsDeletable() const OVERRIDE { return true; }
2721 2721
2722 const Heap::RootListIndex index_; 2722 const Heap::RootListIndex index_;
2723 }; 2723 };
2724 2724
2725 2725
2726 class HCheckMaps V8_FINAL : public HTemplateInstruction<2> { 2726 class HCheckMaps FINAL : public HTemplateInstruction<2> {
2727 public: 2727 public:
2728 static HCheckMaps* New(Zone* zone, HValue* context, HValue* value, 2728 static HCheckMaps* New(Zone* zone, HValue* context, HValue* value,
2729 Handle<Map> map, HValue* typecheck = NULL) { 2729 Handle<Map> map, HValue* typecheck = NULL) {
2730 return new(zone) HCheckMaps(value, new(zone) UniqueSet<Map>( 2730 return new(zone) HCheckMaps(value, new(zone) UniqueSet<Map>(
2731 Unique<Map>::CreateImmovable(map), zone), typecheck); 2731 Unique<Map>::CreateImmovable(map), zone), typecheck);
2732 } 2732 }
2733 static HCheckMaps* New(Zone* zone, HValue* context, 2733 static HCheckMaps* New(Zone* zone, HValue* context,
2734 HValue* value, SmallMapList* map_list, 2734 HValue* value, SmallMapList* map_list,
2735 HValue* typecheck = NULL) { 2735 HValue* typecheck = NULL) {
2736 UniqueSet<Map>* maps = new(zone) UniqueSet<Map>(map_list->length(), zone); 2736 UniqueSet<Map>* maps = new(zone) UniqueSet<Map>(map_list->length(), zone);
2737 for (int i = 0; i < map_list->length(); ++i) { 2737 for (int i = 0; i < map_list->length(); ++i) {
2738 maps->Add(Unique<Map>::CreateImmovable(map_list->at(i)), zone); 2738 maps->Add(Unique<Map>::CreateImmovable(map_list->at(i)), zone);
2739 } 2739 }
2740 return new(zone) HCheckMaps(value, maps, typecheck); 2740 return new(zone) HCheckMaps(value, maps, typecheck);
2741 } 2741 }
2742 2742
2743 bool IsStabilityCheck() const { return is_stability_check_; } 2743 bool IsStabilityCheck() const { return is_stability_check_; }
2744 void MarkAsStabilityCheck() { 2744 void MarkAsStabilityCheck() {
2745 maps_are_stable_ = true; 2745 maps_are_stable_ = true;
2746 has_migration_target_ = false; 2746 has_migration_target_ = false;
2747 is_stability_check_ = true; 2747 is_stability_check_ = true;
2748 ClearChangesFlag(kNewSpacePromotion); 2748 ClearChangesFlag(kNewSpacePromotion);
2749 ClearDependsOnFlag(kElementsKind); 2749 ClearDependsOnFlag(kElementsKind);
2750 ClearDependsOnFlag(kMaps); 2750 ClearDependsOnFlag(kMaps);
2751 } 2751 }
2752 2752
2753 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } 2753 virtual bool HasEscapingOperandAt(int index) OVERRIDE { return false; }
2754 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2754 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
2755 return Representation::Tagged(); 2755 return Representation::Tagged();
2756 } 2756 }
2757 2757
2758 virtual HType CalculateInferredType() V8_OVERRIDE { 2758 virtual HType CalculateInferredType() OVERRIDE {
2759 if (value()->type().IsHeapObject()) return value()->type(); 2759 if (value()->type().IsHeapObject()) return value()->type();
2760 return HType::HeapObject(); 2760 return HType::HeapObject();
2761 } 2761 }
2762 2762
2763 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 2763 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
2764 2764
2765 HValue* value() const { return OperandAt(0); } 2765 HValue* value() const { return OperandAt(0); }
2766 HValue* typecheck() const { return OperandAt(1); } 2766 HValue* typecheck() const { return OperandAt(1); }
2767 2767
2768 const UniqueSet<Map>* maps() const { return maps_; } 2768 const UniqueSet<Map>* maps() const { return maps_; }
2769 void set_maps(const UniqueSet<Map>* maps) { maps_ = maps; } 2769 void set_maps(const UniqueSet<Map>* maps) { maps_ = maps; }
2770 2770
2771 bool maps_are_stable() const { return maps_are_stable_; } 2771 bool maps_are_stable() const { return maps_are_stable_; }
2772 2772
2773 bool HasMigrationTarget() const { return has_migration_target_; } 2773 bool HasMigrationTarget() const { return has_migration_target_; }
2774 2774
2775 virtual HValue* Canonicalize() V8_OVERRIDE; 2775 virtual HValue* Canonicalize() OVERRIDE;
2776 2776
2777 static HCheckMaps* CreateAndInsertAfter(Zone* zone, 2777 static HCheckMaps* CreateAndInsertAfter(Zone* zone,
2778 HValue* value, 2778 HValue* value,
2779 Unique<Map> map, 2779 Unique<Map> map,
2780 bool map_is_stable, 2780 bool map_is_stable,
2781 HInstruction* instr) { 2781 HInstruction* instr) {
2782 return instr->Append(new(zone) HCheckMaps( 2782 return instr->Append(new(zone) HCheckMaps(
2783 value, new(zone) UniqueSet<Map>(map, zone), map_is_stable)); 2783 value, new(zone) UniqueSet<Map>(map, zone), map_is_stable));
2784 } 2784 }
2785 2785
2786 static HCheckMaps* CreateAndInsertBefore(Zone* zone, 2786 static HCheckMaps* CreateAndInsertBefore(Zone* zone,
2787 HValue* value, 2787 HValue* value,
2788 const UniqueSet<Map>* maps, 2788 const UniqueSet<Map>* maps,
2789 bool maps_are_stable, 2789 bool maps_are_stable,
2790 HInstruction* instr) { 2790 HInstruction* instr) {
2791 return instr->Prepend(new(zone) HCheckMaps(value, maps, maps_are_stable)); 2791 return instr->Prepend(new(zone) HCheckMaps(value, maps, maps_are_stable));
2792 } 2792 }
2793 2793
2794 DECLARE_CONCRETE_INSTRUCTION(CheckMaps) 2794 DECLARE_CONCRETE_INSTRUCTION(CheckMaps)
2795 2795
2796 protected: 2796 protected:
2797 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 2797 virtual bool DataEquals(HValue* other) OVERRIDE {
2798 return this->maps()->Equals(HCheckMaps::cast(other)->maps()); 2798 return this->maps()->Equals(HCheckMaps::cast(other)->maps());
2799 } 2799 }
2800 2800
2801 virtual int RedefinedOperandIndex() { return 0; } 2801 virtual int RedefinedOperandIndex() { return 0; }
2802 2802
2803 private: 2803 private:
2804 HCheckMaps(HValue* value, const UniqueSet<Map>* maps, bool maps_are_stable) 2804 HCheckMaps(HValue* value, const UniqueSet<Map>* maps, bool maps_are_stable)
2805 : HTemplateInstruction<2>(HType::HeapObject()), maps_(maps), 2805 : HTemplateInstruction<2>(HType::HeapObject()), maps_(maps),
2806 has_migration_target_(false), is_stability_check_(false), 2806 has_migration_target_(false), is_stability_check_(false),
2807 maps_are_stable_(maps_are_stable) { 2807 maps_are_stable_(maps_are_stable) {
(...skipping 27 matching lines...) Expand all
2835 if (has_migration_target_) SetChangesFlag(kNewSpacePromotion); 2835 if (has_migration_target_) SetChangesFlag(kNewSpacePromotion);
2836 } 2836 }
2837 2837
2838 const UniqueSet<Map>* maps_; 2838 const UniqueSet<Map>* maps_;
2839 bool has_migration_target_ : 1; 2839 bool has_migration_target_ : 1;
2840 bool is_stability_check_ : 1; 2840 bool is_stability_check_ : 1;
2841 bool maps_are_stable_ : 1; 2841 bool maps_are_stable_ : 1;
2842 }; 2842 };
2843 2843
2844 2844
2845 class HCheckValue V8_FINAL : public HUnaryOperation { 2845 class HCheckValue FINAL : public HUnaryOperation {
2846 public: 2846 public:
2847 static HCheckValue* New(Zone* zone, HValue* context, 2847 static HCheckValue* New(Zone* zone, HValue* context,
2848 HValue* value, Handle<JSFunction> func) { 2848 HValue* value, Handle<JSFunction> func) {
2849 bool in_new_space = zone->isolate()->heap()->InNewSpace(*func); 2849 bool in_new_space = zone->isolate()->heap()->InNewSpace(*func);
2850 // NOTE: We create an uninitialized Unique and initialize it later. 2850 // NOTE: We create an uninitialized Unique and initialize it later.
2851 // This is because a JSFunction can move due to GC during graph creation. 2851 // This is because a JSFunction can move due to GC during graph creation.
2852 // TODO(titzer): This is a migration crutch. Replace with some kind of 2852 // TODO(titzer): This is a migration crutch. Replace with some kind of
2853 // Uniqueness scope later. 2853 // Uniqueness scope later.
2854 Unique<JSFunction> target = Unique<JSFunction>::CreateUninitialized(func); 2854 Unique<JSFunction> target = Unique<JSFunction>::CreateUninitialized(func);
2855 HCheckValue* check = new(zone) HCheckValue(value, target, in_new_space); 2855 HCheckValue* check = new(zone) HCheckValue(value, target, in_new_space);
2856 return check; 2856 return check;
2857 } 2857 }
2858 static HCheckValue* New(Zone* zone, HValue* context, 2858 static HCheckValue* New(Zone* zone, HValue* context,
2859 HValue* value, Unique<HeapObject> target, 2859 HValue* value, Unique<HeapObject> target,
2860 bool object_in_new_space) { 2860 bool object_in_new_space) {
2861 return new(zone) HCheckValue(value, target, object_in_new_space); 2861 return new(zone) HCheckValue(value, target, object_in_new_space);
2862 } 2862 }
2863 2863
2864 virtual void FinalizeUniqueness() V8_OVERRIDE { 2864 virtual void FinalizeUniqueness() OVERRIDE {
2865 object_ = Unique<HeapObject>(object_.handle()); 2865 object_ = Unique<HeapObject>(object_.handle());
2866 } 2866 }
2867 2867
2868 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2868 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
2869 return Representation::Tagged(); 2869 return Representation::Tagged();
2870 } 2870 }
2871 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 2871 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
2872 2872
2873 virtual HValue* Canonicalize() V8_OVERRIDE; 2873 virtual HValue* Canonicalize() OVERRIDE;
2874 2874
2875 #ifdef DEBUG 2875 #ifdef DEBUG
2876 virtual void Verify() V8_OVERRIDE; 2876 virtual void Verify() OVERRIDE;
2877 #endif 2877 #endif
2878 2878
2879 Unique<HeapObject> object() const { return object_; } 2879 Unique<HeapObject> object() const { return object_; }
2880 bool object_in_new_space() const { return object_in_new_space_; } 2880 bool object_in_new_space() const { return object_in_new_space_; }
2881 2881
2882 DECLARE_CONCRETE_INSTRUCTION(CheckValue) 2882 DECLARE_CONCRETE_INSTRUCTION(CheckValue)
2883 2883
2884 protected: 2884 protected:
2885 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 2885 virtual bool DataEquals(HValue* other) OVERRIDE {
2886 HCheckValue* b = HCheckValue::cast(other); 2886 HCheckValue* b = HCheckValue::cast(other);
2887 return object_ == b->object_; 2887 return object_ == b->object_;
2888 } 2888 }
2889 2889
2890 private: 2890 private:
2891 HCheckValue(HValue* value, Unique<HeapObject> object, 2891 HCheckValue(HValue* value, Unique<HeapObject> object,
2892 bool object_in_new_space) 2892 bool object_in_new_space)
2893 : HUnaryOperation(value, value->type()), 2893 : HUnaryOperation(value, value->type()),
2894 object_(object), 2894 object_(object),
2895 object_in_new_space_(object_in_new_space) { 2895 object_in_new_space_(object_in_new_space) {
2896 set_representation(Representation::Tagged()); 2896 set_representation(Representation::Tagged());
2897 SetFlag(kUseGVN); 2897 SetFlag(kUseGVN);
2898 } 2898 }
2899 2899
2900 Unique<HeapObject> object_; 2900 Unique<HeapObject> object_;
2901 bool object_in_new_space_; 2901 bool object_in_new_space_;
2902 }; 2902 };
2903 2903
2904 2904
2905 class HCheckInstanceType V8_FINAL : public HUnaryOperation { 2905 class HCheckInstanceType FINAL : public HUnaryOperation {
2906 public: 2906 public:
2907 enum Check { 2907 enum Check {
2908 IS_SPEC_OBJECT, 2908 IS_SPEC_OBJECT,
2909 IS_JS_ARRAY, 2909 IS_JS_ARRAY,
2910 IS_STRING, 2910 IS_STRING,
2911 IS_INTERNALIZED_STRING, 2911 IS_INTERNALIZED_STRING,
2912 LAST_INTERVAL_CHECK = IS_JS_ARRAY 2912 LAST_INTERVAL_CHECK = IS_JS_ARRAY
2913 }; 2913 };
2914 2914
2915 DECLARE_INSTRUCTION_FACTORY_P2(HCheckInstanceType, HValue*, Check); 2915 DECLARE_INSTRUCTION_FACTORY_P2(HCheckInstanceType, HValue*, Check);
2916 2916
2917 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 2917 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
2918 2918
2919 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2919 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
2920 return Representation::Tagged(); 2920 return Representation::Tagged();
2921 } 2921 }
2922 2922
2923 virtual HType CalculateInferredType() V8_OVERRIDE { 2923 virtual HType CalculateInferredType() OVERRIDE {
2924 switch (check_) { 2924 switch (check_) {
2925 case IS_SPEC_OBJECT: return HType::JSObject(); 2925 case IS_SPEC_OBJECT: return HType::JSObject();
2926 case IS_JS_ARRAY: return HType::JSArray(); 2926 case IS_JS_ARRAY: return HType::JSArray();
2927 case IS_STRING: return HType::String(); 2927 case IS_STRING: return HType::String();
2928 case IS_INTERNALIZED_STRING: return HType::String(); 2928 case IS_INTERNALIZED_STRING: return HType::String();
2929 } 2929 }
2930 UNREACHABLE(); 2930 UNREACHABLE();
2931 return HType::Tagged(); 2931 return HType::Tagged();
2932 } 2932 }
2933 2933
2934 virtual HValue* Canonicalize() V8_OVERRIDE; 2934 virtual HValue* Canonicalize() OVERRIDE;
2935 2935
2936 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } 2936 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; }
2937 void GetCheckInterval(InstanceType* first, InstanceType* last); 2937 void GetCheckInterval(InstanceType* first, InstanceType* last);
2938 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); 2938 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag);
2939 2939
2940 Check check() const { return check_; } 2940 Check check() const { return check_; }
2941 2941
2942 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) 2942 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType)
2943 2943
2944 protected: 2944 protected:
2945 // TODO(ager): It could be nice to allow the ommision of instance 2945 // TODO(ager): It could be nice to allow the ommision of instance
2946 // type checks if we have already performed an instance type check 2946 // type checks if we have already performed an instance type check
2947 // with a larger range. 2947 // with a larger range.
2948 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 2948 virtual bool DataEquals(HValue* other) OVERRIDE {
2949 HCheckInstanceType* b = HCheckInstanceType::cast(other); 2949 HCheckInstanceType* b = HCheckInstanceType::cast(other);
2950 return check_ == b->check_; 2950 return check_ == b->check_;
2951 } 2951 }
2952 2952
2953 virtual int RedefinedOperandIndex() { return 0; } 2953 virtual int RedefinedOperandIndex() { return 0; }
2954 2954
2955 private: 2955 private:
2956 const char* GetCheckName() const; 2956 const char* GetCheckName() const;
2957 2957
2958 HCheckInstanceType(HValue* value, Check check) 2958 HCheckInstanceType(HValue* value, Check check)
2959 : HUnaryOperation(value, HType::HeapObject()), check_(check) { 2959 : HUnaryOperation(value, HType::HeapObject()), check_(check) {
2960 set_representation(Representation::Tagged()); 2960 set_representation(Representation::Tagged());
2961 SetFlag(kUseGVN); 2961 SetFlag(kUseGVN);
2962 } 2962 }
2963 2963
2964 const Check check_; 2964 const Check check_;
2965 }; 2965 };
2966 2966
2967 2967
2968 class HCheckSmi V8_FINAL : public HUnaryOperation { 2968 class HCheckSmi FINAL : public HUnaryOperation {
2969 public: 2969 public:
2970 DECLARE_INSTRUCTION_FACTORY_P1(HCheckSmi, HValue*); 2970 DECLARE_INSTRUCTION_FACTORY_P1(HCheckSmi, HValue*);
2971 2971
2972 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2972 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
2973 return Representation::Tagged(); 2973 return Representation::Tagged();
2974 } 2974 }
2975 2975
2976 virtual HValue* Canonicalize() V8_OVERRIDE { 2976 virtual HValue* Canonicalize() OVERRIDE {
2977 HType value_type = value()->type(); 2977 HType value_type = value()->type();
2978 if (value_type.IsSmi()) { 2978 if (value_type.IsSmi()) {
2979 return NULL; 2979 return NULL;
2980 } 2980 }
2981 return this; 2981 return this;
2982 } 2982 }
2983 2983
2984 DECLARE_CONCRETE_INSTRUCTION(CheckSmi) 2984 DECLARE_CONCRETE_INSTRUCTION(CheckSmi)
2985 2985
2986 protected: 2986 protected:
2987 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 2987 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
2988 2988
2989 private: 2989 private:
2990 explicit HCheckSmi(HValue* value) : HUnaryOperation(value, HType::Smi()) { 2990 explicit HCheckSmi(HValue* value) : HUnaryOperation(value, HType::Smi()) {
2991 set_representation(Representation::Smi()); 2991 set_representation(Representation::Smi());
2992 SetFlag(kUseGVN); 2992 SetFlag(kUseGVN);
2993 } 2993 }
2994 }; 2994 };
2995 2995
2996 2996
2997 class HCheckHeapObject V8_FINAL : public HUnaryOperation { 2997 class HCheckHeapObject FINAL : public HUnaryOperation {
2998 public: 2998 public:
2999 DECLARE_INSTRUCTION_FACTORY_P1(HCheckHeapObject, HValue*); 2999 DECLARE_INSTRUCTION_FACTORY_P1(HCheckHeapObject, HValue*);
3000 3000
3001 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } 3001 virtual bool HasEscapingOperandAt(int index) OVERRIDE { return false; }
3002 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3002 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
3003 return Representation::Tagged(); 3003 return Representation::Tagged();
3004 } 3004 }
3005 3005
3006 virtual HType CalculateInferredType() V8_OVERRIDE { 3006 virtual HType CalculateInferredType() OVERRIDE {
3007 if (value()->type().IsHeapObject()) return value()->type(); 3007 if (value()->type().IsHeapObject()) return value()->type();
3008 return HType::HeapObject(); 3008 return HType::HeapObject();
3009 } 3009 }
3010 3010
3011 #ifdef DEBUG 3011 #ifdef DEBUG
3012 virtual void Verify() V8_OVERRIDE; 3012 virtual void Verify() OVERRIDE;
3013 #endif 3013 #endif
3014 3014
3015 virtual HValue* Canonicalize() V8_OVERRIDE { 3015 virtual HValue* Canonicalize() OVERRIDE {
3016 return value()->type().IsHeapObject() ? NULL : this; 3016 return value()->type().IsHeapObject() ? NULL : this;
3017 } 3017 }
3018 3018
3019 DECLARE_CONCRETE_INSTRUCTION(CheckHeapObject) 3019 DECLARE_CONCRETE_INSTRUCTION(CheckHeapObject)
3020 3020
3021 protected: 3021 protected:
3022 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 3022 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
3023 3023
3024 private: 3024 private:
3025 explicit HCheckHeapObject(HValue* value) : HUnaryOperation(value) { 3025 explicit HCheckHeapObject(HValue* value) : HUnaryOperation(value) {
3026 set_representation(Representation::Tagged()); 3026 set_representation(Representation::Tagged());
3027 SetFlag(kUseGVN); 3027 SetFlag(kUseGVN);
3028 } 3028 }
3029 }; 3029 };
3030 3030
3031 3031
3032 class InductionVariableData; 3032 class InductionVariableData;
3033 3033
3034 3034
3035 struct InductionVariableLimitUpdate { 3035 struct InductionVariableLimitUpdate {
3036 InductionVariableData* updated_variable; 3036 InductionVariableData* updated_variable;
3037 HValue* limit; 3037 HValue* limit;
3038 bool limit_is_upper; 3038 bool limit_is_upper;
3039 bool limit_is_included; 3039 bool limit_is_included;
3040 3040
3041 InductionVariableLimitUpdate() 3041 InductionVariableLimitUpdate()
3042 : updated_variable(NULL), limit(NULL), 3042 : updated_variable(NULL), limit(NULL),
3043 limit_is_upper(false), limit_is_included(false) {} 3043 limit_is_upper(false), limit_is_included(false) {}
3044 }; 3044 };
3045 3045
3046 3046
3047 class HBoundsCheck; 3047 class HBoundsCheck;
3048 class HPhi; 3048 class HPhi;
3049 class HBitwise; 3049 class HBitwise;
3050 3050
3051 3051
3052 class InductionVariableData V8_FINAL : public ZoneObject { 3052 class InductionVariableData FINAL : public ZoneObject {
3053 public: 3053 public:
3054 class InductionVariableCheck : public ZoneObject { 3054 class InductionVariableCheck : public ZoneObject {
3055 public: 3055 public:
3056 HBoundsCheck* check() { return check_; } 3056 HBoundsCheck* check() { return check_; }
3057 InductionVariableCheck* next() { return next_; } 3057 InductionVariableCheck* next() { return next_; }
3058 bool HasUpperLimit() { return upper_limit_ >= 0; } 3058 bool HasUpperLimit() { return upper_limit_ >= 0; }
3059 int32_t upper_limit() { 3059 int32_t upper_limit() {
3060 DCHECK(HasUpperLimit()); 3060 DCHECK(HasUpperLimit());
3061 return upper_limit_; 3061 return upper_limit_;
3062 } 3062 }
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
3242 HBasicBlock* induction_exit_block_; 3242 HBasicBlock* induction_exit_block_;
3243 HBasicBlock* induction_exit_target_; 3243 HBasicBlock* induction_exit_target_;
3244 ChecksRelatedToLength* checks_; 3244 ChecksRelatedToLength* checks_;
3245 HValue* additional_upper_limit_; 3245 HValue* additional_upper_limit_;
3246 bool additional_upper_limit_is_included_; 3246 bool additional_upper_limit_is_included_;
3247 HValue* additional_lower_limit_; 3247 HValue* additional_lower_limit_;
3248 bool additional_lower_limit_is_included_; 3248 bool additional_lower_limit_is_included_;
3249 }; 3249 };
3250 3250
3251 3251
3252 class HPhi V8_FINAL : public HValue { 3252 class HPhi FINAL : public HValue {
3253 public: 3253 public:
3254 HPhi(int merged_index, Zone* zone) 3254 HPhi(int merged_index, Zone* zone)
3255 : inputs_(2, zone), 3255 : inputs_(2, zone),
3256 merged_index_(merged_index), 3256 merged_index_(merged_index),
3257 phi_id_(-1), 3257 phi_id_(-1),
3258 induction_variable_data_(NULL) { 3258 induction_variable_data_(NULL) {
3259 for (int i = 0; i < Representation::kNumRepresentations; i++) { 3259 for (int i = 0; i < Representation::kNumRepresentations; i++) {
3260 non_phi_uses_[i] = 0; 3260 non_phi_uses_[i] = 0;
3261 indirect_uses_[i] = 0; 3261 indirect_uses_[i] = 0;
3262 } 3262 }
3263 DCHECK(merged_index >= 0 || merged_index == kInvalidMergedIndex); 3263 DCHECK(merged_index >= 0 || merged_index == kInvalidMergedIndex);
3264 SetFlag(kFlexibleRepresentation); 3264 SetFlag(kFlexibleRepresentation);
3265 SetFlag(kAllowUndefinedAsNaN); 3265 SetFlag(kAllowUndefinedAsNaN);
3266 } 3266 }
3267 3267
3268 virtual Representation RepresentationFromInputs() V8_OVERRIDE; 3268 virtual Representation RepresentationFromInputs() OVERRIDE;
3269 3269
3270 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 3270 virtual Range* InferRange(Zone* zone) OVERRIDE;
3271 virtual void InferRepresentation( 3271 virtual void InferRepresentation(
3272 HInferRepresentationPhase* h_infer) V8_OVERRIDE; 3272 HInferRepresentationPhase* h_infer) OVERRIDE;
3273 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3273 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
3274 return representation(); 3274 return representation();
3275 } 3275 }
3276 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE { 3276 virtual Representation KnownOptimalRepresentation() OVERRIDE {
3277 return representation(); 3277 return representation();
3278 } 3278 }
3279 virtual HType CalculateInferredType() V8_OVERRIDE; 3279 virtual HType CalculateInferredType() OVERRIDE;
3280 virtual int OperandCount() const V8_OVERRIDE { return inputs_.length(); } 3280 virtual int OperandCount() const OVERRIDE { return inputs_.length(); }
3281 virtual HValue* OperandAt(int index) const V8_OVERRIDE { 3281 virtual HValue* OperandAt(int index) const OVERRIDE {
3282 return inputs_[index]; 3282 return inputs_[index];
3283 } 3283 }
3284 HValue* GetRedundantReplacement(); 3284 HValue* GetRedundantReplacement();
3285 void AddInput(HValue* value); 3285 void AddInput(HValue* value);
3286 bool HasRealUses(); 3286 bool HasRealUses();
3287 3287
3288 bool IsReceiver() const { return merged_index_ == 0; } 3288 bool IsReceiver() const { return merged_index_ == 0; }
3289 bool HasMergedIndex() const { return merged_index_ != kInvalidMergedIndex; } 3289 bool HasMergedIndex() const { return merged_index_ != kInvalidMergedIndex; }
3290 3290
3291 virtual HSourcePosition position() const V8_OVERRIDE; 3291 virtual HSourcePosition position() const OVERRIDE;
3292 3292
3293 int merged_index() const { return merged_index_; } 3293 int merged_index() const { return merged_index_; }
3294 3294
3295 InductionVariableData* induction_variable_data() { 3295 InductionVariableData* induction_variable_data() {
3296 return induction_variable_data_; 3296 return induction_variable_data_;
3297 } 3297 }
3298 bool IsInductionVariable() { 3298 bool IsInductionVariable() {
3299 return induction_variable_data_ != NULL; 3299 return induction_variable_data_ != NULL;
3300 } 3300 }
3301 bool IsLimitedInductionVariable() { 3301 bool IsLimitedInductionVariable() {
3302 return IsInductionVariable() && 3302 return IsInductionVariable() &&
3303 induction_variable_data_->limit() != NULL; 3303 induction_variable_data_->limit() != NULL;
3304 } 3304 }
3305 void DetectInductionVariable() { 3305 void DetectInductionVariable() {
3306 DCHECK(induction_variable_data_ == NULL); 3306 DCHECK(induction_variable_data_ == NULL);
3307 induction_variable_data_ = InductionVariableData::ExaminePhi(this); 3307 induction_variable_data_ = InductionVariableData::ExaminePhi(this);
3308 } 3308 }
3309 3309
3310 virtual OStream& PrintTo(OStream& os) const V8_OVERRIDE; // NOLINT 3310 virtual OStream& PrintTo(OStream& os) const OVERRIDE; // NOLINT
3311 3311
3312 #ifdef DEBUG 3312 #ifdef DEBUG
3313 virtual void Verify() V8_OVERRIDE; 3313 virtual void Verify() OVERRIDE;
3314 #endif 3314 #endif
3315 3315
3316 void InitRealUses(int id); 3316 void InitRealUses(int id);
3317 void AddNonPhiUsesFrom(HPhi* other); 3317 void AddNonPhiUsesFrom(HPhi* other);
3318 void AddIndirectUsesTo(int* use_count); 3318 void AddIndirectUsesTo(int* use_count);
3319 3319
3320 int tagged_non_phi_uses() const { 3320 int tagged_non_phi_uses() const {
3321 return non_phi_uses_[Representation::kTagged]; 3321 return non_phi_uses_[Representation::kTagged];
3322 } 3322 }
3323 int smi_non_phi_uses() const { 3323 int smi_non_phi_uses() const {
(...skipping 16 matching lines...) Expand all
3340 } 3340 }
3341 int double_indirect_uses() const { 3341 int double_indirect_uses() const {
3342 return indirect_uses_[Representation::kDouble]; 3342 return indirect_uses_[Representation::kDouble];
3343 } 3343 }
3344 int phi_id() { return phi_id_; } 3344 int phi_id() { return phi_id_; }
3345 3345
3346 static HPhi* cast(HValue* value) { 3346 static HPhi* cast(HValue* value) {
3347 DCHECK(value->IsPhi()); 3347 DCHECK(value->IsPhi());
3348 return reinterpret_cast<HPhi*>(value); 3348 return reinterpret_cast<HPhi*>(value);
3349 } 3349 }
3350 virtual Opcode opcode() const V8_OVERRIDE { return HValue::kPhi; } 3350 virtual Opcode opcode() const OVERRIDE { return HValue::kPhi; }
3351 3351
3352 void SimplifyConstantInputs(); 3352 void SimplifyConstantInputs();
3353 3353
3354 // Marker value representing an invalid merge index. 3354 // Marker value representing an invalid merge index.
3355 static const int kInvalidMergedIndex = -1; 3355 static const int kInvalidMergedIndex = -1;
3356 3356
3357 protected: 3357 protected:
3358 virtual void DeleteFromGraph() V8_OVERRIDE; 3358 virtual void DeleteFromGraph() OVERRIDE;
3359 virtual void InternalSetOperandAt(int index, HValue* value) V8_OVERRIDE { 3359 virtual void InternalSetOperandAt(int index, HValue* value) OVERRIDE {
3360 inputs_[index] = value; 3360 inputs_[index] = value;
3361 } 3361 }
3362 3362
3363 private: 3363 private:
3364 ZoneList<HValue*> inputs_; 3364 ZoneList<HValue*> inputs_;
3365 int merged_index_; 3365 int merged_index_;
3366 3366
3367 int non_phi_uses_[Representation::kNumRepresentations]; 3367 int non_phi_uses_[Representation::kNumRepresentations];
3368 int indirect_uses_[Representation::kNumRepresentations]; 3368 int indirect_uses_[Representation::kNumRepresentations];
3369 int phi_id_; 3369 int phi_id_;
3370 InductionVariableData* induction_variable_data_; 3370 InductionVariableData* induction_variable_data_;
3371 3371
3372 // TODO(titzer): we can't eliminate the receiver for generating backtraces 3372 // TODO(titzer): we can't eliminate the receiver for generating backtraces
3373 virtual bool IsDeletable() const V8_OVERRIDE { return !IsReceiver(); } 3373 virtual bool IsDeletable() const OVERRIDE { return !IsReceiver(); }
3374 }; 3374 };
3375 3375
3376 3376
3377 // Common base class for HArgumentsObject and HCapturedObject. 3377 // Common base class for HArgumentsObject and HCapturedObject.
3378 class HDematerializedObject : public HInstruction { 3378 class HDematerializedObject : public HInstruction {
3379 public: 3379 public:
3380 HDematerializedObject(int count, Zone* zone) : values_(count, zone) {} 3380 HDematerializedObject(int count, Zone* zone) : values_(count, zone) {}
3381 3381
3382 virtual int OperandCount() const V8_FINAL V8_OVERRIDE { 3382 virtual int OperandCount() const FINAL OVERRIDE {
3383 return values_.length(); 3383 return values_.length();
3384 } 3384 }
3385 virtual HValue* OperandAt(int index) const V8_FINAL V8_OVERRIDE { 3385 virtual HValue* OperandAt(int index) const FINAL OVERRIDE {
3386 return values_[index]; 3386 return values_[index];
3387 } 3387 }
3388 3388
3389 virtual bool HasEscapingOperandAt(int index) V8_FINAL V8_OVERRIDE { 3389 virtual bool HasEscapingOperandAt(int index) FINAL OVERRIDE {
3390 return false; 3390 return false;
3391 } 3391 }
3392 virtual Representation RequiredInputRepresentation( 3392 virtual Representation RequiredInputRepresentation(
3393 int index) V8_FINAL V8_OVERRIDE { 3393 int index) FINAL OVERRIDE {
3394 return Representation::None(); 3394 return Representation::None();
3395 } 3395 }
3396 3396
3397 protected: 3397 protected:
3398 virtual void InternalSetOperandAt(int index, 3398 virtual void InternalSetOperandAt(int index,
3399 HValue* value) V8_FINAL V8_OVERRIDE { 3399 HValue* value) FINAL OVERRIDE {
3400 values_[index] = value; 3400 values_[index] = value;
3401 } 3401 }
3402 3402
3403 // List of values tracked by this marker. 3403 // List of values tracked by this marker.
3404 ZoneList<HValue*> values_; 3404 ZoneList<HValue*> values_;
3405 }; 3405 };
3406 3406
3407 3407
3408 class HArgumentsObject V8_FINAL : public HDematerializedObject { 3408 class HArgumentsObject FINAL : public HDematerializedObject {
3409 public: 3409 public:
3410 static HArgumentsObject* New(Zone* zone, HValue* context, int count) { 3410 static HArgumentsObject* New(Zone* zone, HValue* context, int count) {
3411 return new(zone) HArgumentsObject(count, zone); 3411 return new(zone) HArgumentsObject(count, zone);
3412 } 3412 }
3413 3413
3414 // The values contain a list of all elements in the arguments object 3414 // The values contain a list of all elements in the arguments object
3415 // including the receiver object, which is skipped when materializing. 3415 // including the receiver object, which is skipped when materializing.
3416 const ZoneList<HValue*>* arguments_values() const { return &values_; } 3416 const ZoneList<HValue*>* arguments_values() const { return &values_; }
3417 int arguments_count() const { return values_.length(); } 3417 int arguments_count() const { return values_.length(); }
3418 3418
3419 void AddArgument(HValue* argument, Zone* zone) { 3419 void AddArgument(HValue* argument, Zone* zone) {
3420 values_.Add(NULL, zone); // Resize list. 3420 values_.Add(NULL, zone); // Resize list.
3421 SetOperandAt(values_.length() - 1, argument); 3421 SetOperandAt(values_.length() - 1, argument);
3422 } 3422 }
3423 3423
3424 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) 3424 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject)
3425 3425
3426 private: 3426 private:
3427 HArgumentsObject(int count, Zone* zone) 3427 HArgumentsObject(int count, Zone* zone)
3428 : HDematerializedObject(count, zone) { 3428 : HDematerializedObject(count, zone) {
3429 set_representation(Representation::Tagged()); 3429 set_representation(Representation::Tagged());
3430 SetFlag(kIsArguments); 3430 SetFlag(kIsArguments);
3431 } 3431 }
3432 }; 3432 };
3433 3433
3434 3434
3435 class HCapturedObject V8_FINAL : public HDematerializedObject { 3435 class HCapturedObject FINAL : public HDematerializedObject {
3436 public: 3436 public:
3437 HCapturedObject(int length, int id, Zone* zone) 3437 HCapturedObject(int length, int id, Zone* zone)
3438 : HDematerializedObject(length, zone), capture_id_(id) { 3438 : HDematerializedObject(length, zone), capture_id_(id) {
3439 set_representation(Representation::Tagged()); 3439 set_representation(Representation::Tagged());
3440 values_.AddBlock(NULL, length, zone); // Resize list. 3440 values_.AddBlock(NULL, length, zone); // Resize list.
3441 } 3441 }
3442 3442
3443 // The values contain a list of all in-object properties inside the 3443 // The values contain a list of all in-object properties inside the
3444 // captured object and is index by field index. Properties in the 3444 // captured object and is index by field index. Properties in the
3445 // properties or elements backing store are not tracked here. 3445 // properties or elements backing store are not tracked here.
3446 const ZoneList<HValue*>* values() const { return &values_; } 3446 const ZoneList<HValue*>* values() const { return &values_; }
3447 int length() const { return values_.length(); } 3447 int length() const { return values_.length(); }
3448 int capture_id() const { return capture_id_; } 3448 int capture_id() const { return capture_id_; }
3449 3449
3450 // Shortcut for the map value of this captured object. 3450 // Shortcut for the map value of this captured object.
3451 HValue* map_value() const { return values()->first(); } 3451 HValue* map_value() const { return values()->first(); }
3452 3452
3453 void ReuseSideEffectsFromStore(HInstruction* store) { 3453 void ReuseSideEffectsFromStore(HInstruction* store) {
3454 DCHECK(store->HasObservableSideEffects()); 3454 DCHECK(store->HasObservableSideEffects());
3455 DCHECK(store->IsStoreNamedField()); 3455 DCHECK(store->IsStoreNamedField());
3456 changes_flags_.Add(store->ChangesFlags()); 3456 changes_flags_.Add(store->ChangesFlags());
3457 } 3457 }
3458 3458
3459 // Replay effects of this instruction on the given environment. 3459 // Replay effects of this instruction on the given environment.
3460 void ReplayEnvironment(HEnvironment* env); 3460 void ReplayEnvironment(HEnvironment* env);
3461 3461
3462 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 3462 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
3463 3463
3464 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) 3464 DECLARE_CONCRETE_INSTRUCTION(CapturedObject)
3465 3465
3466 private: 3466 private:
3467 int capture_id_; 3467 int capture_id_;
3468 3468
3469 // Note that we cannot DCE captured objects as they are used to replay 3469 // Note that we cannot DCE captured objects as they are used to replay
3470 // the environment. This method is here as an explicit reminder. 3470 // the environment. This method is here as an explicit reminder.
3471 // TODO(mstarzinger): Turn HSimulates into full snapshots maybe? 3471 // TODO(mstarzinger): Turn HSimulates into full snapshots maybe?
3472 virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return false; } 3472 virtual bool IsDeletable() const FINAL OVERRIDE { return false; }
3473 }; 3473 };
3474 3474
3475 3475
3476 class HConstant V8_FINAL : public HTemplateInstruction<0> { 3476 class HConstant FINAL : public HTemplateInstruction<0> {
3477 public: 3477 public:
3478 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); 3478 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t);
3479 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); 3479 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation);
3480 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); 3480 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double);
3481 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); 3481 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>);
3482 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); 3482 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference);
3483 3483
3484 static HConstant* CreateAndInsertAfter(Zone* zone, 3484 static HConstant* CreateAndInsertAfter(Zone* zone,
3485 HValue* context, 3485 HValue* context,
3486 int32_t value, 3486 int32_t value,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
3545 bool ImmortalImmovable() const; 3545 bool ImmortalImmovable() const;
3546 3546
3547 bool IsCell() const { 3547 bool IsCell() const {
3548 return instance_type_ == CELL_TYPE || instance_type_ == PROPERTY_CELL_TYPE; 3548 return instance_type_ == CELL_TYPE || instance_type_ == PROPERTY_CELL_TYPE;
3549 } 3549 }
3550 3550
3551 bool IsMap() const { 3551 bool IsMap() const {
3552 return instance_type_ == MAP_TYPE; 3552 return instance_type_ == MAP_TYPE;
3553 } 3553 }
3554 3554
3555 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3555 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
3556 return Representation::None(); 3556 return Representation::None();
3557 } 3557 }
3558 3558
3559 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE { 3559 virtual Representation KnownOptimalRepresentation() OVERRIDE {
3560 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi(); 3560 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi();
3561 if (HasInteger32Value()) return Representation::Integer32(); 3561 if (HasInteger32Value()) return Representation::Integer32();
3562 if (HasNumberValue()) return Representation::Double(); 3562 if (HasNumberValue()) return Representation::Double();
3563 if (HasExternalReferenceValue()) return Representation::External(); 3563 if (HasExternalReferenceValue()) return Representation::External();
3564 return Representation::Tagged(); 3564 return Representation::Tagged();
3565 } 3565 }
3566 3566
3567 virtual bool EmitAtUses() V8_OVERRIDE; 3567 virtual bool EmitAtUses() OVERRIDE;
3568 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 3568 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
3569 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; 3569 HConstant* CopyToRepresentation(Representation r, Zone* zone) const;
3570 Maybe<HConstant*> CopyToTruncatedInt32(Zone* zone); 3570 Maybe<HConstant*> CopyToTruncatedInt32(Zone* zone);
3571 Maybe<HConstant*> CopyToTruncatedNumber(Zone* zone); 3571 Maybe<HConstant*> CopyToTruncatedNumber(Zone* zone);
3572 bool HasInteger32Value() const { return has_int32_value_; } 3572 bool HasInteger32Value() const { return has_int32_value_; }
3573 int32_t Integer32Value() const { 3573 int32_t Integer32Value() const {
3574 DCHECK(HasInteger32Value()); 3574 DCHECK(HasInteger32Value());
3575 return int32_value_; 3575 return int32_value_;
3576 } 3576 }
3577 bool HasSmiValue() const { return has_smi_value_; } 3577 bool HasSmiValue() const { return has_smi_value_; }
3578 bool HasDoubleValue() const { return has_double_value_; } 3578 bool HasDoubleValue() const { return has_double_value_; }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3628 DCHECK(HasMapValue() || !has_stable_map_value_); 3628 DCHECK(HasMapValue() || !has_stable_map_value_);
3629 return has_stable_map_value_; 3629 return has_stable_map_value_;
3630 } 3630 }
3631 3631
3632 bool HasObjectMap() const { return !object_map_.IsNull(); } 3632 bool HasObjectMap() const { return !object_map_.IsNull(); }
3633 Unique<Map> ObjectMap() const { 3633 Unique<Map> ObjectMap() const {
3634 DCHECK(HasObjectMap()); 3634 DCHECK(HasObjectMap());
3635 return object_map_; 3635 return object_map_;
3636 } 3636 }
3637 3637
3638 virtual intptr_t Hashcode() V8_OVERRIDE { 3638 virtual intptr_t Hashcode() OVERRIDE {
3639 if (has_int32_value_) { 3639 if (has_int32_value_) {
3640 return static_cast<intptr_t>(int32_value_); 3640 return static_cast<intptr_t>(int32_value_);
3641 } else if (has_double_value_) { 3641 } else if (has_double_value_) {
3642 return static_cast<intptr_t>(BitCast<int64_t>(double_value_)); 3642 return static_cast<intptr_t>(BitCast<int64_t>(double_value_));
3643 } else if (has_external_reference_value_) { 3643 } else if (has_external_reference_value_) {
3644 return reinterpret_cast<intptr_t>(external_reference_value_.address()); 3644 return reinterpret_cast<intptr_t>(external_reference_value_.address());
3645 } else { 3645 } else {
3646 DCHECK(!object_.handle().is_null()); 3646 DCHECK(!object_.handle().is_null());
3647 return object_.Hashcode(); 3647 return object_.Hashcode();
3648 } 3648 }
3649 } 3649 }
3650 3650
3651 virtual void FinalizeUniqueness() V8_OVERRIDE { 3651 virtual void FinalizeUniqueness() OVERRIDE {
3652 if (!has_double_value_ && !has_external_reference_value_) { 3652 if (!has_double_value_ && !has_external_reference_value_) {
3653 DCHECK(!object_.handle().is_null()); 3653 DCHECK(!object_.handle().is_null());
3654 object_ = Unique<Object>(object_.handle()); 3654 object_ = Unique<Object>(object_.handle());
3655 } 3655 }
3656 } 3656 }
3657 3657
3658 Unique<Object> GetUnique() const { 3658 Unique<Object> GetUnique() const {
3659 return object_; 3659 return object_;
3660 } 3660 }
3661 3661
3662 bool EqualsUnique(Unique<Object> other) const { 3662 bool EqualsUnique(Unique<Object> other) const {
3663 return object_.IsInitialized() && object_ == other; 3663 return object_.IsInitialized() && object_ == other;
3664 } 3664 }
3665 3665
3666 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 3666 virtual bool DataEquals(HValue* other) OVERRIDE {
3667 HConstant* other_constant = HConstant::cast(other); 3667 HConstant* other_constant = HConstant::cast(other);
3668 if (has_int32_value_) { 3668 if (has_int32_value_) {
3669 return other_constant->has_int32_value_ && 3669 return other_constant->has_int32_value_ &&
3670 int32_value_ == other_constant->int32_value_; 3670 int32_value_ == other_constant->int32_value_;
3671 } else if (has_double_value_) { 3671 } else if (has_double_value_) {
3672 return other_constant->has_double_value_ && 3672 return other_constant->has_double_value_ &&
3673 BitCast<int64_t>(double_value_) == 3673 BitCast<int64_t>(double_value_) ==
3674 BitCast<int64_t>(other_constant->double_value_); 3674 BitCast<int64_t>(other_constant->double_value_);
3675 } else if (has_external_reference_value_) { 3675 } else if (has_external_reference_value_) {
3676 return other_constant->has_external_reference_value_ && 3676 return other_constant->has_external_reference_value_ &&
3677 external_reference_value_ == 3677 external_reference_value_ ==
3678 other_constant->external_reference_value_; 3678 other_constant->external_reference_value_;
3679 } else { 3679 } else {
3680 if (other_constant->has_int32_value_ || 3680 if (other_constant->has_int32_value_ ||
3681 other_constant->has_double_value_ || 3681 other_constant->has_double_value_ ||
3682 other_constant->has_external_reference_value_) { 3682 other_constant->has_external_reference_value_) {
3683 return false; 3683 return false;
3684 } 3684 }
3685 DCHECK(!object_.handle().is_null()); 3685 DCHECK(!object_.handle().is_null());
3686 return other_constant->object_ == object_; 3686 return other_constant->object_ == object_;
3687 } 3687 }
3688 } 3688 }
3689 3689
3690 #ifdef DEBUG 3690 #ifdef DEBUG
3691 virtual void Verify() V8_OVERRIDE { } 3691 virtual void Verify() OVERRIDE { }
3692 #endif 3692 #endif
3693 3693
3694 DECLARE_CONCRETE_INSTRUCTION(Constant) 3694 DECLARE_CONCRETE_INSTRUCTION(Constant)
3695 3695
3696 protected: 3696 protected:
3697 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 3697 virtual Range* InferRange(Zone* zone) OVERRIDE;
3698 3698
3699 private: 3699 private:
3700 friend class HGraph; 3700 friend class HGraph;
3701 explicit HConstant(Handle<Object> handle, 3701 explicit HConstant(Handle<Object> handle,
3702 Representation r = Representation::None()); 3702 Representation r = Representation::None());
3703 HConstant(int32_t value, 3703 HConstant(int32_t value,
3704 Representation r = Representation::None(), 3704 Representation r = Representation::None(),
3705 bool is_not_in_new_space = true, 3705 bool is_not_in_new_space = true,
3706 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); 3706 Unique<Object> optional = Unique<Object>(Handle<Object>::null()));
3707 HConstant(double value, 3707 HConstant(double value,
3708 Representation r = Representation::None(), 3708 Representation r = Representation::None(),
3709 bool is_not_in_new_space = true, 3709 bool is_not_in_new_space = true,
3710 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); 3710 Unique<Object> optional = Unique<Object>(Handle<Object>::null()));
3711 HConstant(Unique<Object> object, 3711 HConstant(Unique<Object> object,
3712 Unique<Map> object_map, 3712 Unique<Map> object_map,
3713 bool has_stable_map_value, 3713 bool has_stable_map_value,
3714 Representation r, 3714 Representation r,
3715 HType type, 3715 HType type,
3716 bool is_not_in_new_space, 3716 bool is_not_in_new_space,
3717 bool boolean_value, 3717 bool boolean_value,
3718 bool is_undetectable, 3718 bool is_undetectable,
3719 InstanceType instance_type); 3719 InstanceType instance_type);
3720 3720
3721 explicit HConstant(ExternalReference reference); 3721 explicit HConstant(ExternalReference reference);
3722 3722
3723 void Initialize(Representation r); 3723 void Initialize(Representation r);
3724 3724
3725 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 3725 virtual bool IsDeletable() const OVERRIDE { return true; }
3726 3726
3727 // If this is a numerical constant, object_ either points to the 3727 // If this is a numerical constant, object_ either points to the
3728 // HeapObject the constant originated from or is null. If the 3728 // HeapObject the constant originated from or is null. If the
3729 // constant is non-numeric, object_ always points to a valid 3729 // constant is non-numeric, object_ always points to a valid
3730 // constant HeapObject. 3730 // constant HeapObject.
3731 Unique<Object> object_; 3731 Unique<Object> object_;
3732 3732
3733 // If object_ is a heap object, this points to the stable map of the object. 3733 // If object_ is a heap object, this points to the stable map of the object.
3734 Unique<Map> object_map_; 3734 Unique<Map> object_map_;
3735 3735
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
3800 3800
3801 void set_observed_input_representation(int index, Representation rep) { 3801 void set_observed_input_representation(int index, Representation rep) {
3802 DCHECK(index >= 1 && index <= 2); 3802 DCHECK(index >= 1 && index <= 2);
3803 observed_input_representation_[index - 1] = rep; 3803 observed_input_representation_[index - 1] = rep;
3804 } 3804 }
3805 3805
3806 virtual void initialize_output_representation(Representation observed) { 3806 virtual void initialize_output_representation(Representation observed) {
3807 observed_output_representation_ = observed; 3807 observed_output_representation_ = observed;
3808 } 3808 }
3809 3809
3810 virtual Representation observed_input_representation(int index) V8_OVERRIDE { 3810 virtual Representation observed_input_representation(int index) OVERRIDE {
3811 if (index == 0) return Representation::Tagged(); 3811 if (index == 0) return Representation::Tagged();
3812 return observed_input_representation_[index - 1]; 3812 return observed_input_representation_[index - 1];
3813 } 3813 }
3814 3814
3815 virtual void UpdateRepresentation(Representation new_rep, 3815 virtual void UpdateRepresentation(Representation new_rep,
3816 HInferRepresentationPhase* h_infer, 3816 HInferRepresentationPhase* h_infer,
3817 const char* reason) V8_OVERRIDE { 3817 const char* reason) OVERRIDE {
3818 Representation rep = !FLAG_smi_binop && new_rep.IsSmi() 3818 Representation rep = !FLAG_smi_binop && new_rep.IsSmi()
3819 ? Representation::Integer32() : new_rep; 3819 ? Representation::Integer32() : new_rep;
3820 HValue::UpdateRepresentation(rep, h_infer, reason); 3820 HValue::UpdateRepresentation(rep, h_infer, reason);
3821 } 3821 }
3822 3822
3823 virtual void InferRepresentation( 3823 virtual void InferRepresentation(
3824 HInferRepresentationPhase* h_infer) V8_OVERRIDE; 3824 HInferRepresentationPhase* h_infer) OVERRIDE;
3825 virtual Representation RepresentationFromInputs() V8_OVERRIDE; 3825 virtual Representation RepresentationFromInputs() OVERRIDE;
3826 Representation RepresentationFromOutput(); 3826 Representation RepresentationFromOutput();
3827 virtual void AssumeRepresentation(Representation r) V8_OVERRIDE; 3827 virtual void AssumeRepresentation(Representation r) OVERRIDE;
3828 3828
3829 virtual bool IsCommutative() const { return false; } 3829 virtual bool IsCommutative() const { return false; }
3830 3830
3831 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 3831 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
3832 3832
3833 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3833 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
3834 if (index == 0) return Representation::Tagged(); 3834 if (index == 0) return Representation::Tagged();
3835 return representation(); 3835 return representation();
3836 } 3836 }
3837 3837
3838 void SetOperandPositions(Zone* zone, 3838 void SetOperandPositions(Zone* zone,
3839 HSourcePosition left_pos, 3839 HSourcePosition left_pos,
3840 HSourcePosition right_pos) { 3840 HSourcePosition right_pos) {
3841 set_operand_position(zone, 1, left_pos); 3841 set_operand_position(zone, 1, left_pos);
3842 set_operand_position(zone, 2, right_pos); 3842 set_operand_position(zone, 2, right_pos);
3843 } 3843 }
3844 3844
3845 bool RightIsPowerOf2() { 3845 bool RightIsPowerOf2() {
3846 if (!right()->IsInteger32Constant()) return false; 3846 if (!right()->IsInteger32Constant()) return false;
3847 int32_t value = right()->GetInteger32Constant(); 3847 int32_t value = right()->GetInteger32Constant();
3848 return IsPowerOf2(value) || IsPowerOf2(-value); 3848 return IsPowerOf2(value) || IsPowerOf2(-value);
3849 } 3849 }
3850 3850
3851 DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation) 3851 DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation)
3852 3852
3853 private: 3853 private:
3854 bool IgnoreObservedOutputRepresentation(Representation current_rep); 3854 bool IgnoreObservedOutputRepresentation(Representation current_rep);
3855 3855
3856 Representation observed_input_representation_[2]; 3856 Representation observed_input_representation_[2];
3857 Representation observed_output_representation_; 3857 Representation observed_output_representation_;
3858 }; 3858 };
3859 3859
3860 3860
3861 class HWrapReceiver V8_FINAL : public HTemplateInstruction<2> { 3861 class HWrapReceiver FINAL : public HTemplateInstruction<2> {
3862 public: 3862 public:
3863 DECLARE_INSTRUCTION_FACTORY_P2(HWrapReceiver, HValue*, HValue*); 3863 DECLARE_INSTRUCTION_FACTORY_P2(HWrapReceiver, HValue*, HValue*);
3864 3864
3865 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 3865 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
3866 3866
3867 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3867 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
3868 return Representation::Tagged(); 3868 return Representation::Tagged();
3869 } 3869 }
3870 3870
3871 HValue* receiver() const { return OperandAt(0); } 3871 HValue* receiver() const { return OperandAt(0); }
3872 HValue* function() const { return OperandAt(1); } 3872 HValue* function() const { return OperandAt(1); }
3873 3873
3874 virtual HValue* Canonicalize() V8_OVERRIDE; 3874 virtual HValue* Canonicalize() OVERRIDE;
3875 3875
3876 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 3876 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
3877 bool known_function() const { return known_function_; } 3877 bool known_function() const { return known_function_; }
3878 3878
3879 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver) 3879 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver)
3880 3880
3881 private: 3881 private:
3882 HWrapReceiver(HValue* receiver, HValue* function) { 3882 HWrapReceiver(HValue* receiver, HValue* function) {
3883 known_function_ = function->IsConstant() && 3883 known_function_ = function->IsConstant() &&
3884 HConstant::cast(function)->handle(function->isolate())->IsJSFunction(); 3884 HConstant::cast(function)->handle(function->isolate())->IsJSFunction();
3885 set_representation(Representation::Tagged()); 3885 set_representation(Representation::Tagged());
3886 SetOperandAt(0, receiver); 3886 SetOperandAt(0, receiver);
3887 SetOperandAt(1, function); 3887 SetOperandAt(1, function);
3888 SetFlag(kUseGVN); 3888 SetFlag(kUseGVN);
3889 } 3889 }
3890 3890
3891 bool known_function_; 3891 bool known_function_;
3892 }; 3892 };
3893 3893
3894 3894
3895 class HApplyArguments V8_FINAL : public HTemplateInstruction<4> { 3895 class HApplyArguments FINAL : public HTemplateInstruction<4> {
3896 public: 3896 public:
3897 DECLARE_INSTRUCTION_FACTORY_P4(HApplyArguments, HValue*, HValue*, HValue*, 3897 DECLARE_INSTRUCTION_FACTORY_P4(HApplyArguments, HValue*, HValue*, HValue*,
3898 HValue*); 3898 HValue*);
3899 3899
3900 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3900 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
3901 // The length is untagged, all other inputs are tagged. 3901 // The length is untagged, all other inputs are tagged.
3902 return (index == 2) 3902 return (index == 2)
3903 ? Representation::Integer32() 3903 ? Representation::Integer32()
3904 : Representation::Tagged(); 3904 : Representation::Tagged();
3905 } 3905 }
3906 3906
3907 HValue* function() { return OperandAt(0); } 3907 HValue* function() { return OperandAt(0); }
3908 HValue* receiver() { return OperandAt(1); } 3908 HValue* receiver() { return OperandAt(1); }
3909 HValue* length() { return OperandAt(2); } 3909 HValue* length() { return OperandAt(2); }
3910 HValue* elements() { return OperandAt(3); } 3910 HValue* elements() { return OperandAt(3); }
3911 3911
3912 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments) 3912 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments)
3913 3913
3914 private: 3914 private:
3915 HApplyArguments(HValue* function, 3915 HApplyArguments(HValue* function,
3916 HValue* receiver, 3916 HValue* receiver,
3917 HValue* length, 3917 HValue* length,
3918 HValue* elements) { 3918 HValue* elements) {
3919 set_representation(Representation::Tagged()); 3919 set_representation(Representation::Tagged());
3920 SetOperandAt(0, function); 3920 SetOperandAt(0, function);
3921 SetOperandAt(1, receiver); 3921 SetOperandAt(1, receiver);
3922 SetOperandAt(2, length); 3922 SetOperandAt(2, length);
3923 SetOperandAt(3, elements); 3923 SetOperandAt(3, elements);
3924 SetAllSideEffects(); 3924 SetAllSideEffects();
3925 } 3925 }
3926 }; 3926 };
3927 3927
3928 3928
3929 class HArgumentsElements V8_FINAL : public HTemplateInstruction<0> { 3929 class HArgumentsElements FINAL : public HTemplateInstruction<0> {
3930 public: 3930 public:
3931 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsElements, bool); 3931 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsElements, bool);
3932 3932
3933 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements) 3933 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements)
3934 3934
3935 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3935 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
3936 return Representation::None(); 3936 return Representation::None();
3937 } 3937 }
3938 3938
3939 bool from_inlined() const { return from_inlined_; } 3939 bool from_inlined() const { return from_inlined_; }
3940 3940
3941 protected: 3941 protected:
3942 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 3942 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
3943 3943
3944 private: 3944 private:
3945 explicit HArgumentsElements(bool from_inlined) : from_inlined_(from_inlined) { 3945 explicit HArgumentsElements(bool from_inlined) : from_inlined_(from_inlined) {
3946 // The value produced by this instruction is a pointer into the stack 3946 // The value produced by this instruction is a pointer into the stack
3947 // that looks as if it was a smi because of alignment. 3947 // that looks as if it was a smi because of alignment.
3948 set_representation(Representation::Tagged()); 3948 set_representation(Representation::Tagged());
3949 SetFlag(kUseGVN); 3949 SetFlag(kUseGVN);
3950 } 3950 }
3951 3951
3952 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 3952 virtual bool IsDeletable() const OVERRIDE { return true; }
3953 3953
3954 bool from_inlined_; 3954 bool from_inlined_;
3955 }; 3955 };
3956 3956
3957 3957
3958 class HArgumentsLength V8_FINAL : public HUnaryOperation { 3958 class HArgumentsLength FINAL : public HUnaryOperation {
3959 public: 3959 public:
3960 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsLength, HValue*); 3960 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsLength, HValue*);
3961 3961
3962 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3962 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
3963 return Representation::Tagged(); 3963 return Representation::Tagged();
3964 } 3964 }
3965 3965
3966 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength) 3966 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength)
3967 3967
3968 protected: 3968 protected:
3969 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 3969 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
3970 3970
3971 private: 3971 private:
3972 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { 3972 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) {
3973 set_representation(Representation::Integer32()); 3973 set_representation(Representation::Integer32());
3974 SetFlag(kUseGVN); 3974 SetFlag(kUseGVN);
3975 } 3975 }
3976 3976
3977 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 3977 virtual bool IsDeletable() const OVERRIDE { return true; }
3978 }; 3978 };
3979 3979
3980 3980
3981 class HAccessArgumentsAt V8_FINAL : public HTemplateInstruction<3> { 3981 class HAccessArgumentsAt FINAL : public HTemplateInstruction<3> {
3982 public: 3982 public:
3983 DECLARE_INSTRUCTION_FACTORY_P3(HAccessArgumentsAt, HValue*, HValue*, HValue*); 3983 DECLARE_INSTRUCTION_FACTORY_P3(HAccessArgumentsAt, HValue*, HValue*, HValue*);
3984 3984
3985 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 3985 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
3986 3986
3987 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3987 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
3988 // The arguments elements is considered tagged. 3988 // The arguments elements is considered tagged.
3989 return index == 0 3989 return index == 0
3990 ? Representation::Tagged() 3990 ? Representation::Tagged()
3991 : Representation::Integer32(); 3991 : Representation::Integer32();
3992 } 3992 }
3993 3993
3994 HValue* arguments() const { return OperandAt(0); } 3994 HValue* arguments() const { return OperandAt(0); }
3995 HValue* length() const { return OperandAt(1); } 3995 HValue* length() const { return OperandAt(1); }
3996 HValue* index() const { return OperandAt(2); } 3996 HValue* index() const { return OperandAt(2); }
3997 3997
3998 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) 3998 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt)
3999 3999
4000 private: 4000 private:
4001 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { 4001 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) {
4002 set_representation(Representation::Tagged()); 4002 set_representation(Representation::Tagged());
4003 SetFlag(kUseGVN); 4003 SetFlag(kUseGVN);
4004 SetOperandAt(0, arguments); 4004 SetOperandAt(0, arguments);
4005 SetOperandAt(1, length); 4005 SetOperandAt(1, length);
4006 SetOperandAt(2, index); 4006 SetOperandAt(2, index);
4007 } 4007 }
4008 4008
4009 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4009 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
4010 }; 4010 };
4011 4011
4012 4012
4013 class HBoundsCheckBaseIndexInformation; 4013 class HBoundsCheckBaseIndexInformation;
4014 4014
4015 4015
4016 class HBoundsCheck V8_FINAL : public HTemplateInstruction<2> { 4016 class HBoundsCheck FINAL : public HTemplateInstruction<2> {
4017 public: 4017 public:
4018 DECLARE_INSTRUCTION_FACTORY_P2(HBoundsCheck, HValue*, HValue*); 4018 DECLARE_INSTRUCTION_FACTORY_P2(HBoundsCheck, HValue*, HValue*);
4019 4019
4020 bool skip_check() const { return skip_check_; } 4020 bool skip_check() const { return skip_check_; }
4021 void set_skip_check() { skip_check_ = true; } 4021 void set_skip_check() { skip_check_ = true; }
4022 4022
4023 HValue* base() const { return base_; } 4023 HValue* base() const { return base_; }
4024 int offset() const { return offset_; } 4024 int offset() const { return offset_; }
4025 int scale() const { return scale_; } 4025 int scale() const { return scale_; }
4026 4026
4027 void ApplyIndexChange(); 4027 void ApplyIndexChange();
4028 bool DetectCompoundIndex() { 4028 bool DetectCompoundIndex() {
4029 DCHECK(base() == NULL); 4029 DCHECK(base() == NULL);
4030 4030
4031 DecompositionResult decomposition; 4031 DecompositionResult decomposition;
4032 if (index()->TryDecompose(&decomposition)) { 4032 if (index()->TryDecompose(&decomposition)) {
4033 base_ = decomposition.base(); 4033 base_ = decomposition.base();
4034 offset_ = decomposition.offset(); 4034 offset_ = decomposition.offset();
4035 scale_ = decomposition.scale(); 4035 scale_ = decomposition.scale();
4036 return true; 4036 return true;
4037 } else { 4037 } else {
4038 base_ = index(); 4038 base_ = index();
4039 offset_ = 0; 4039 offset_ = 0;
4040 scale_ = 0; 4040 scale_ = 0;
4041 return false; 4041 return false;
4042 } 4042 }
4043 } 4043 }
4044 4044
4045 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4045 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4046 return representation(); 4046 return representation();
4047 } 4047 }
4048 4048
4049 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 4049 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
4050 virtual void InferRepresentation( 4050 virtual void InferRepresentation(
4051 HInferRepresentationPhase* h_infer) V8_OVERRIDE; 4051 HInferRepresentationPhase* h_infer) OVERRIDE;
4052 4052
4053 HValue* index() const { return OperandAt(0); } 4053 HValue* index() const { return OperandAt(0); }
4054 HValue* length() const { return OperandAt(1); } 4054 HValue* length() const { return OperandAt(1); }
4055 bool allow_equality() const { return allow_equality_; } 4055 bool allow_equality() const { return allow_equality_; }
4056 void set_allow_equality(bool v) { allow_equality_ = v; } 4056 void set_allow_equality(bool v) { allow_equality_ = v; }
4057 4057
4058 virtual int RedefinedOperandIndex() V8_OVERRIDE { return 0; } 4058 virtual int RedefinedOperandIndex() OVERRIDE { return 0; }
4059 virtual bool IsPurelyInformativeDefinition() V8_OVERRIDE { 4059 virtual bool IsPurelyInformativeDefinition() OVERRIDE {
4060 return skip_check(); 4060 return skip_check();
4061 } 4061 }
4062 4062
4063 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) 4063 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck)
4064 4064
4065 protected: 4065 protected:
4066 friend class HBoundsCheckBaseIndexInformation; 4066 friend class HBoundsCheckBaseIndexInformation;
4067 4067
4068 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 4068 virtual Range* InferRange(Zone* zone) OVERRIDE;
4069 4069
4070 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4070 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
4071 bool skip_check_; 4071 bool skip_check_;
4072 HValue* base_; 4072 HValue* base_;
4073 int offset_; 4073 int offset_;
4074 int scale_; 4074 int scale_;
4075 bool allow_equality_; 4075 bool allow_equality_;
4076 4076
4077 private: 4077 private:
4078 // Normally HBoundsCheck should be created using the 4078 // Normally HBoundsCheck should be created using the
4079 // HGraphBuilder::AddBoundsCheck() helper. 4079 // HGraphBuilder::AddBoundsCheck() helper.
4080 // However when building stubs, where we know that the arguments are Int32, 4080 // However when building stubs, where we know that the arguments are Int32,
4081 // it makes sense to invoke this constructor directly. 4081 // it makes sense to invoke this constructor directly.
4082 HBoundsCheck(HValue* index, HValue* length) 4082 HBoundsCheck(HValue* index, HValue* length)
4083 : skip_check_(false), 4083 : skip_check_(false),
4084 base_(NULL), offset_(0), scale_(0), 4084 base_(NULL), offset_(0), scale_(0),
4085 allow_equality_(false) { 4085 allow_equality_(false) {
4086 SetOperandAt(0, index); 4086 SetOperandAt(0, index);
4087 SetOperandAt(1, length); 4087 SetOperandAt(1, length);
4088 SetFlag(kFlexibleRepresentation); 4088 SetFlag(kFlexibleRepresentation);
4089 SetFlag(kUseGVN); 4089 SetFlag(kUseGVN);
4090 } 4090 }
4091 4091
4092 virtual bool IsDeletable() const V8_OVERRIDE { 4092 virtual bool IsDeletable() const OVERRIDE {
4093 return skip_check() && !FLAG_debug_code; 4093 return skip_check() && !FLAG_debug_code;
4094 } 4094 }
4095 }; 4095 };
4096 4096
4097 4097
4098 class HBoundsCheckBaseIndexInformation V8_FINAL 4098 class HBoundsCheckBaseIndexInformation FINAL
4099 : public HTemplateInstruction<2> { 4099 : public HTemplateInstruction<2> {
4100 public: 4100 public:
4101 explicit HBoundsCheckBaseIndexInformation(HBoundsCheck* check) { 4101 explicit HBoundsCheckBaseIndexInformation(HBoundsCheck* check) {
4102 DecompositionResult decomposition; 4102 DecompositionResult decomposition;
4103 if (check->index()->TryDecompose(&decomposition)) { 4103 if (check->index()->TryDecompose(&decomposition)) {
4104 SetOperandAt(0, decomposition.base()); 4104 SetOperandAt(0, decomposition.base());
4105 SetOperandAt(1, check); 4105 SetOperandAt(1, check);
4106 } else { 4106 } else {
4107 UNREACHABLE(); 4107 UNREACHABLE();
4108 } 4108 }
4109 } 4109 }
4110 4110
4111 HValue* base_index() const { return OperandAt(0); } 4111 HValue* base_index() const { return OperandAt(0); }
4112 HBoundsCheck* bounds_check() { return HBoundsCheck::cast(OperandAt(1)); } 4112 HBoundsCheck* bounds_check() { return HBoundsCheck::cast(OperandAt(1)); }
4113 4113
4114 DECLARE_CONCRETE_INSTRUCTION(BoundsCheckBaseIndexInformation) 4114 DECLARE_CONCRETE_INSTRUCTION(BoundsCheckBaseIndexInformation)
4115 4115
4116 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4116 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4117 return representation(); 4117 return representation();
4118 } 4118 }
4119 4119
4120 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 4120 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
4121 4121
4122 virtual int RedefinedOperandIndex() V8_OVERRIDE { return 0; } 4122 virtual int RedefinedOperandIndex() OVERRIDE { return 0; }
4123 virtual bool IsPurelyInformativeDefinition() V8_OVERRIDE { return true; } 4123 virtual bool IsPurelyInformativeDefinition() OVERRIDE { return true; }
4124 }; 4124 };
4125 4125
4126 4126
4127 class HBitwiseBinaryOperation : public HBinaryOperation { 4127 class HBitwiseBinaryOperation : public HBinaryOperation {
4128 public: 4128 public:
4129 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, 4129 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right,
4130 HType type = HType::TaggedNumber()) 4130 HType type = HType::TaggedNumber())
4131 : HBinaryOperation(context, left, right, type) { 4131 : HBinaryOperation(context, left, right, type) {
4132 SetFlag(kFlexibleRepresentation); 4132 SetFlag(kFlexibleRepresentation);
4133 SetFlag(kTruncatingToInt32); 4133 SetFlag(kTruncatingToInt32);
4134 SetFlag(kAllowUndefinedAsNaN); 4134 SetFlag(kAllowUndefinedAsNaN);
4135 SetAllSideEffects(); 4135 SetAllSideEffects();
4136 } 4136 }
4137 4137
4138 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { 4138 virtual void RepresentationChanged(Representation to) OVERRIDE {
4139 if (to.IsTagged() && 4139 if (to.IsTagged() &&
4140 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { 4140 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) {
4141 SetAllSideEffects(); 4141 SetAllSideEffects();
4142 ClearFlag(kUseGVN); 4142 ClearFlag(kUseGVN);
4143 } else { 4143 } else {
4144 ClearAllSideEffects(); 4144 ClearAllSideEffects();
4145 SetFlag(kUseGVN); 4145 SetFlag(kUseGVN);
4146 } 4146 }
4147 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); 4147 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion);
4148 } 4148 }
4149 4149
4150 virtual void UpdateRepresentation(Representation new_rep, 4150 virtual void UpdateRepresentation(Representation new_rep,
4151 HInferRepresentationPhase* h_infer, 4151 HInferRepresentationPhase* h_infer,
4152 const char* reason) V8_OVERRIDE { 4152 const char* reason) OVERRIDE {
4153 // We only generate either int32 or generic tagged bitwise operations. 4153 // We only generate either int32 or generic tagged bitwise operations.
4154 if (new_rep.IsDouble()) new_rep = Representation::Integer32(); 4154 if (new_rep.IsDouble()) new_rep = Representation::Integer32();
4155 HBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); 4155 HBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason);
4156 } 4156 }
4157 4157
4158 virtual Representation observed_input_representation(int index) V8_OVERRIDE { 4158 virtual Representation observed_input_representation(int index) OVERRIDE {
4159 Representation r = HBinaryOperation::observed_input_representation(index); 4159 Representation r = HBinaryOperation::observed_input_representation(index);
4160 if (r.IsDouble()) return Representation::Integer32(); 4160 if (r.IsDouble()) return Representation::Integer32();
4161 return r; 4161 return r;
4162 } 4162 }
4163 4163
4164 virtual void initialize_output_representation(Representation observed) { 4164 virtual void initialize_output_representation(Representation observed) {
4165 if (observed.IsDouble()) observed = Representation::Integer32(); 4165 if (observed.IsDouble()) observed = Representation::Integer32();
4166 HBinaryOperation::initialize_output_representation(observed); 4166 HBinaryOperation::initialize_output_representation(observed);
4167 } 4167 }
4168 4168
4169 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) 4169 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation)
4170 4170
4171 private: 4171 private:
4172 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 4172 virtual bool IsDeletable() const OVERRIDE { return true; }
4173 }; 4173 };
4174 4174
4175 4175
4176 class HMathFloorOfDiv V8_FINAL : public HBinaryOperation { 4176 class HMathFloorOfDiv FINAL : public HBinaryOperation {
4177 public: 4177 public:
4178 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HMathFloorOfDiv, 4178 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HMathFloorOfDiv,
4179 HValue*, 4179 HValue*,
4180 HValue*); 4180 HValue*);
4181 4181
4182 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) 4182 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv)
4183 4183
4184 protected: 4184 protected:
4185 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4185 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
4186 4186
4187 private: 4187 private:
4188 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) 4188 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right)
4189 : HBinaryOperation(context, left, right) { 4189 : HBinaryOperation(context, left, right) {
4190 set_representation(Representation::Integer32()); 4190 set_representation(Representation::Integer32());
4191 SetFlag(kUseGVN); 4191 SetFlag(kUseGVN);
4192 SetFlag(kCanOverflow); 4192 SetFlag(kCanOverflow);
4193 SetFlag(kCanBeDivByZero); 4193 SetFlag(kCanBeDivByZero);
4194 SetFlag(kLeftCanBeMinInt); 4194 SetFlag(kLeftCanBeMinInt);
4195 SetFlag(kLeftCanBeNegative); 4195 SetFlag(kLeftCanBeNegative);
4196 SetFlag(kLeftCanBePositive); 4196 SetFlag(kLeftCanBePositive);
4197 SetFlag(kAllowUndefinedAsNaN); 4197 SetFlag(kAllowUndefinedAsNaN);
4198 } 4198 }
4199 4199
4200 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 4200 virtual Range* InferRange(Zone* zone) OVERRIDE;
4201 4201
4202 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 4202 virtual bool IsDeletable() const OVERRIDE { return true; }
4203 }; 4203 };
4204 4204
4205 4205
4206 class HArithmeticBinaryOperation : public HBinaryOperation { 4206 class HArithmeticBinaryOperation : public HBinaryOperation {
4207 public: 4207 public:
4208 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) 4208 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right)
4209 : HBinaryOperation(context, left, right, HType::TaggedNumber()) { 4209 : HBinaryOperation(context, left, right, HType::TaggedNumber()) {
4210 SetAllSideEffects(); 4210 SetAllSideEffects();
4211 SetFlag(kFlexibleRepresentation); 4211 SetFlag(kFlexibleRepresentation);
4212 SetFlag(kAllowUndefinedAsNaN); 4212 SetFlag(kAllowUndefinedAsNaN);
4213 } 4213 }
4214 4214
4215 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { 4215 virtual void RepresentationChanged(Representation to) OVERRIDE {
4216 if (to.IsTagged() && 4216 if (to.IsTagged() &&
4217 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { 4217 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) {
4218 SetAllSideEffects(); 4218 SetAllSideEffects();
4219 ClearFlag(kUseGVN); 4219 ClearFlag(kUseGVN);
4220 } else { 4220 } else {
4221 ClearAllSideEffects(); 4221 ClearAllSideEffects();
4222 SetFlag(kUseGVN); 4222 SetFlag(kUseGVN);
4223 } 4223 }
4224 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); 4224 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion);
4225 } 4225 }
4226 4226
4227 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) 4227 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation)
4228 4228
4229 private: 4229 private:
4230 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 4230 virtual bool IsDeletable() const OVERRIDE { return true; }
4231 }; 4231 };
4232 4232
4233 4233
4234 class HCompareGeneric V8_FINAL : public HBinaryOperation { 4234 class HCompareGeneric FINAL : public HBinaryOperation {
4235 public: 4235 public:
4236 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCompareGeneric, HValue*, 4236 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCompareGeneric, HValue*,
4237 HValue*, Token::Value); 4237 HValue*, Token::Value);
4238 4238
4239 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4239 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4240 return index == 0 4240 return index == 0
4241 ? Representation::Tagged() 4241 ? Representation::Tagged()
4242 : representation(); 4242 : representation();
4243 } 4243 }
4244 4244
4245 Token::Value token() const { return token_; } 4245 Token::Value token() const { return token_; }
4246 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 4246 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
4247 4247
4248 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) 4248 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric)
4249 4249
4250 private: 4250 private:
4251 HCompareGeneric(HValue* context, 4251 HCompareGeneric(HValue* context,
4252 HValue* left, 4252 HValue* left,
4253 HValue* right, 4253 HValue* right,
4254 Token::Value token) 4254 Token::Value token)
4255 : HBinaryOperation(context, left, right, HType::Boolean()), 4255 : HBinaryOperation(context, left, right, HType::Boolean()),
4256 token_(token) { 4256 token_(token) {
(...skipping 18 matching lines...) Expand all
4275 HValue* right() const { return OperandAt(1); } 4275 HValue* right() const { return OperandAt(1); }
4276 Token::Value token() const { return token_; } 4276 Token::Value token() const { return token_; }
4277 4277
4278 void set_observed_input_representation(Representation left, 4278 void set_observed_input_representation(Representation left,
4279 Representation right) { 4279 Representation right) {
4280 observed_input_representation_[0] = left; 4280 observed_input_representation_[0] = left;
4281 observed_input_representation_[1] = right; 4281 observed_input_representation_[1] = right;
4282 } 4282 }
4283 4283
4284 virtual void InferRepresentation( 4284 virtual void InferRepresentation(
4285 HInferRepresentationPhase* h_infer) V8_OVERRIDE; 4285 HInferRepresentationPhase* h_infer) OVERRIDE;
4286 4286
4287 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4287 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4288 return representation(); 4288 return representation();
4289 } 4289 }
4290 virtual Representation observed_input_representation(int index) V8_OVERRIDE { 4290 virtual Representation observed_input_representation(int index) OVERRIDE {
4291 return observed_input_representation_[index]; 4291 return observed_input_representation_[index];
4292 } 4292 }
4293 4293
4294 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; 4294 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE;
4295 4295
4296 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 4296 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
4297 4297
4298 void SetOperandPositions(Zone* zone, 4298 void SetOperandPositions(Zone* zone,
4299 HSourcePosition left_pos, 4299 HSourcePosition left_pos,
4300 HSourcePosition right_pos) { 4300 HSourcePosition right_pos) {
4301 set_operand_position(zone, 0, left_pos); 4301 set_operand_position(zone, 0, left_pos);
4302 set_operand_position(zone, 1, right_pos); 4302 set_operand_position(zone, 1, right_pos);
4303 } 4303 }
4304 4304
4305 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch) 4305 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch)
4306 4306
(...skipping 10 matching lines...) Expand all
4317 SetOperandAt(1, right); 4317 SetOperandAt(1, right);
4318 SetSuccessorAt(0, true_target); 4318 SetSuccessorAt(0, true_target);
4319 SetSuccessorAt(1, false_target); 4319 SetSuccessorAt(1, false_target);
4320 } 4320 }
4321 4321
4322 Representation observed_input_representation_[2]; 4322 Representation observed_input_representation_[2];
4323 Token::Value token_; 4323 Token::Value token_;
4324 }; 4324 };
4325 4325
4326 4326
4327 class HCompareHoleAndBranch V8_FINAL : public HUnaryControlInstruction { 4327 class HCompareHoleAndBranch FINAL : public HUnaryControlInstruction {
4328 public: 4328 public:
4329 DECLARE_INSTRUCTION_FACTORY_P1(HCompareHoleAndBranch, HValue*); 4329 DECLARE_INSTRUCTION_FACTORY_P1(HCompareHoleAndBranch, HValue*);
4330 DECLARE_INSTRUCTION_FACTORY_P3(HCompareHoleAndBranch, HValue*, 4330 DECLARE_INSTRUCTION_FACTORY_P3(HCompareHoleAndBranch, HValue*,
4331 HBasicBlock*, HBasicBlock*); 4331 HBasicBlock*, HBasicBlock*);
4332 4332
4333 virtual void InferRepresentation( 4333 virtual void InferRepresentation(
4334 HInferRepresentationPhase* h_infer) V8_OVERRIDE; 4334 HInferRepresentationPhase* h_infer) OVERRIDE;
4335 4335
4336 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4336 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4337 return representation(); 4337 return representation();
4338 } 4338 }
4339 4339
4340 DECLARE_CONCRETE_INSTRUCTION(CompareHoleAndBranch) 4340 DECLARE_CONCRETE_INSTRUCTION(CompareHoleAndBranch)
4341 4341
4342 private: 4342 private:
4343 HCompareHoleAndBranch(HValue* value, 4343 HCompareHoleAndBranch(HValue* value,
4344 HBasicBlock* true_target = NULL, 4344 HBasicBlock* true_target = NULL,
4345 HBasicBlock* false_target = NULL) 4345 HBasicBlock* false_target = NULL)
4346 : HUnaryControlInstruction(value, true_target, false_target) { 4346 : HUnaryControlInstruction(value, true_target, false_target) {
4347 SetFlag(kFlexibleRepresentation); 4347 SetFlag(kFlexibleRepresentation);
4348 SetFlag(kAllowUndefinedAsNaN); 4348 SetFlag(kAllowUndefinedAsNaN);
4349 } 4349 }
4350 }; 4350 };
4351 4351
4352 4352
4353 class HCompareMinusZeroAndBranch V8_FINAL : public HUnaryControlInstruction { 4353 class HCompareMinusZeroAndBranch FINAL : public HUnaryControlInstruction {
4354 public: 4354 public:
4355 DECLARE_INSTRUCTION_FACTORY_P1(HCompareMinusZeroAndBranch, HValue*); 4355 DECLARE_INSTRUCTION_FACTORY_P1(HCompareMinusZeroAndBranch, HValue*);
4356 4356
4357 virtual void InferRepresentation( 4357 virtual void InferRepresentation(
4358 HInferRepresentationPhase* h_infer) V8_OVERRIDE; 4358 HInferRepresentationPhase* h_infer) OVERRIDE;
4359 4359
4360 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4360 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4361 return representation(); 4361 return representation();
4362 } 4362 }
4363 4363
4364 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; 4364 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE;
4365 4365
4366 DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch) 4366 DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch)
4367 4367
4368 private: 4368 private:
4369 explicit HCompareMinusZeroAndBranch(HValue* value) 4369 explicit HCompareMinusZeroAndBranch(HValue* value)
4370 : HUnaryControlInstruction(value, NULL, NULL) { 4370 : HUnaryControlInstruction(value, NULL, NULL) {
4371 } 4371 }
4372 }; 4372 };
4373 4373
4374 4374
4375 class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> { 4375 class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> {
4376 public: 4376 public:
4377 DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*); 4377 DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*);
4378 DECLARE_INSTRUCTION_FACTORY_P4(HCompareObjectEqAndBranch, HValue*, HValue*, 4378 DECLARE_INSTRUCTION_FACTORY_P4(HCompareObjectEqAndBranch, HValue*, HValue*,
4379 HBasicBlock*, HBasicBlock*); 4379 HBasicBlock*, HBasicBlock*);
4380 4380
4381 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; 4381 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE;
4382 4382
4383 static const int kNoKnownSuccessorIndex = -1; 4383 static const int kNoKnownSuccessorIndex = -1;
4384 int known_successor_index() const { return known_successor_index_; } 4384 int known_successor_index() const { return known_successor_index_; }
4385 void set_known_successor_index(int known_successor_index) { 4385 void set_known_successor_index(int known_successor_index) {
4386 known_successor_index_ = known_successor_index; 4386 known_successor_index_ = known_successor_index;
4387 } 4387 }
4388 4388
4389 HValue* left() const { return OperandAt(0); } 4389 HValue* left() const { return OperandAt(0); }
4390 HValue* right() const { return OperandAt(1); } 4390 HValue* right() const { return OperandAt(1); }
4391 4391
4392 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 4392 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
4393 4393
4394 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4394 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4395 return Representation::Tagged(); 4395 return Representation::Tagged();
4396 } 4396 }
4397 4397
4398 virtual Representation observed_input_representation(int index) V8_OVERRIDE { 4398 virtual Representation observed_input_representation(int index) OVERRIDE {
4399 return Representation::Tagged(); 4399 return Representation::Tagged();
4400 } 4400 }
4401 4401
4402 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) 4402 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch)
4403 4403
4404 private: 4404 private:
4405 HCompareObjectEqAndBranch(HValue* left, 4405 HCompareObjectEqAndBranch(HValue* left,
4406 HValue* right, 4406 HValue* right,
4407 HBasicBlock* true_target = NULL, 4407 HBasicBlock* true_target = NULL,
4408 HBasicBlock* false_target = NULL) 4408 HBasicBlock* false_target = NULL)
4409 : known_successor_index_(kNoKnownSuccessorIndex) { 4409 : known_successor_index_(kNoKnownSuccessorIndex) {
4410 SetOperandAt(0, left); 4410 SetOperandAt(0, left);
4411 SetOperandAt(1, right); 4411 SetOperandAt(1, right);
4412 SetSuccessorAt(0, true_target); 4412 SetSuccessorAt(0, true_target);
4413 SetSuccessorAt(1, false_target); 4413 SetSuccessorAt(1, false_target);
4414 } 4414 }
4415 4415
4416 int known_successor_index_; 4416 int known_successor_index_;
4417 }; 4417 };
4418 4418
4419 4419
4420 class HIsObjectAndBranch V8_FINAL : public HUnaryControlInstruction { 4420 class HIsObjectAndBranch FINAL : public HUnaryControlInstruction {
4421 public: 4421 public:
4422 DECLARE_INSTRUCTION_FACTORY_P1(HIsObjectAndBranch, HValue*); 4422 DECLARE_INSTRUCTION_FACTORY_P1(HIsObjectAndBranch, HValue*);
4423 DECLARE_INSTRUCTION_FACTORY_P3(HIsObjectAndBranch, HValue*, 4423 DECLARE_INSTRUCTION_FACTORY_P3(HIsObjectAndBranch, HValue*,
4424 HBasicBlock*, HBasicBlock*); 4424 HBasicBlock*, HBasicBlock*);
4425 4425
4426 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4426 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4427 return Representation::Tagged(); 4427 return Representation::Tagged();
4428 } 4428 }
4429 4429
4430 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; 4430 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE;
4431 4431
4432 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch) 4432 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch)
4433 4433
4434 private: 4434 private:
4435 HIsObjectAndBranch(HValue* value, 4435 HIsObjectAndBranch(HValue* value,
4436 HBasicBlock* true_target = NULL, 4436 HBasicBlock* true_target = NULL,
4437 HBasicBlock* false_target = NULL) 4437 HBasicBlock* false_target = NULL)
4438 : HUnaryControlInstruction(value, true_target, false_target) {} 4438 : HUnaryControlInstruction(value, true_target, false_target) {}
4439 }; 4439 };
4440 4440
4441 4441
4442 class HIsStringAndBranch V8_FINAL : public HUnaryControlInstruction { 4442 class HIsStringAndBranch FINAL : public HUnaryControlInstruction {
4443 public: 4443 public:
4444 DECLARE_INSTRUCTION_FACTORY_P1(HIsStringAndBranch, HValue*); 4444 DECLARE_INSTRUCTION_FACTORY_P1(HIsStringAndBranch, HValue*);
4445 DECLARE_INSTRUCTION_FACTORY_P3(HIsStringAndBranch, HValue*, 4445 DECLARE_INSTRUCTION_FACTORY_P3(HIsStringAndBranch, HValue*,
4446 HBasicBlock*, HBasicBlock*); 4446 HBasicBlock*, HBasicBlock*);
4447 4447
4448 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4448 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4449 return Representation::Tagged(); 4449 return Representation::Tagged();
4450 } 4450 }
4451 4451
4452 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; 4452 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE;
4453 4453
4454 static const int kNoKnownSuccessorIndex = -1; 4454 static const int kNoKnownSuccessorIndex = -1;
4455 int known_successor_index() const { return known_successor_index_; } 4455 int known_successor_index() const { return known_successor_index_; }
4456 void set_known_successor_index(int known_successor_index) { 4456 void set_known_successor_index(int known_successor_index) {
4457 known_successor_index_ = known_successor_index; 4457 known_successor_index_ = known_successor_index;
4458 } 4458 }
4459 4459
4460 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch) 4460 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch)
4461 4461
4462 protected: 4462 protected:
4463 virtual int RedefinedOperandIndex() { return 0; } 4463 virtual int RedefinedOperandIndex() { return 0; }
4464 4464
4465 private: 4465 private:
4466 HIsStringAndBranch(HValue* value, 4466 HIsStringAndBranch(HValue* value,
4467 HBasicBlock* true_target = NULL, 4467 HBasicBlock* true_target = NULL,
4468 HBasicBlock* false_target = NULL) 4468 HBasicBlock* false_target = NULL)
4469 : HUnaryControlInstruction(value, true_target, false_target), 4469 : HUnaryControlInstruction(value, true_target, false_target),
4470 known_successor_index_(kNoKnownSuccessorIndex) { } 4470 known_successor_index_(kNoKnownSuccessorIndex) { }
4471 4471
4472 int known_successor_index_; 4472 int known_successor_index_;
4473 }; 4473 };
4474 4474
4475 4475
4476 class HIsSmiAndBranch V8_FINAL : public HUnaryControlInstruction { 4476 class HIsSmiAndBranch FINAL : public HUnaryControlInstruction {
4477 public: 4477 public:
4478 DECLARE_INSTRUCTION_FACTORY_P1(HIsSmiAndBranch, HValue*); 4478 DECLARE_INSTRUCTION_FACTORY_P1(HIsSmiAndBranch, HValue*);
4479 DECLARE_INSTRUCTION_FACTORY_P3(HIsSmiAndBranch, HValue*, 4479 DECLARE_INSTRUCTION_FACTORY_P3(HIsSmiAndBranch, HValue*,
4480 HBasicBlock*, HBasicBlock*); 4480 HBasicBlock*, HBasicBlock*);
4481 4481
4482 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch) 4482 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch)
4483 4483
4484 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4484 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4485 return Representation::Tagged(); 4485 return Representation::Tagged();
4486 } 4486 }
4487 4487
4488 protected: 4488 protected:
4489 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4489 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
4490 virtual int RedefinedOperandIndex() { return 0; } 4490 virtual int RedefinedOperandIndex() { return 0; }
4491 4491
4492 private: 4492 private:
4493 HIsSmiAndBranch(HValue* value, 4493 HIsSmiAndBranch(HValue* value,
4494 HBasicBlock* true_target = NULL, 4494 HBasicBlock* true_target = NULL,
4495 HBasicBlock* false_target = NULL) 4495 HBasicBlock* false_target = NULL)
4496 : HUnaryControlInstruction(value, true_target, false_target) { 4496 : HUnaryControlInstruction(value, true_target, false_target) {
4497 set_representation(Representation::Tagged()); 4497 set_representation(Representation::Tagged());
4498 } 4498 }
4499 }; 4499 };
4500 4500
4501 4501
4502 class HIsUndetectableAndBranch V8_FINAL : public HUnaryControlInstruction { 4502 class HIsUndetectableAndBranch FINAL : public HUnaryControlInstruction {
4503 public: 4503 public:
4504 DECLARE_INSTRUCTION_FACTORY_P1(HIsUndetectableAndBranch, HValue*); 4504 DECLARE_INSTRUCTION_FACTORY_P1(HIsUndetectableAndBranch, HValue*);
4505 DECLARE_INSTRUCTION_FACTORY_P3(HIsUndetectableAndBranch, HValue*, 4505 DECLARE_INSTRUCTION_FACTORY_P3(HIsUndetectableAndBranch, HValue*,
4506 HBasicBlock*, HBasicBlock*); 4506 HBasicBlock*, HBasicBlock*);
4507 4507
4508 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4508 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4509 return Representation::Tagged(); 4509 return Representation::Tagged();
4510 } 4510 }
4511 4511
4512 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; 4512 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE;
4513 4513
4514 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch) 4514 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch)
4515 4515
4516 private: 4516 private:
4517 HIsUndetectableAndBranch(HValue* value, 4517 HIsUndetectableAndBranch(HValue* value,
4518 HBasicBlock* true_target = NULL, 4518 HBasicBlock* true_target = NULL,
4519 HBasicBlock* false_target = NULL) 4519 HBasicBlock* false_target = NULL)
4520 : HUnaryControlInstruction(value, true_target, false_target) {} 4520 : HUnaryControlInstruction(value, true_target, false_target) {}
4521 }; 4521 };
4522 4522
4523 4523
4524 class HStringCompareAndBranch : public HTemplateControlInstruction<2, 3> { 4524 class HStringCompareAndBranch : public HTemplateControlInstruction<2, 3> {
4525 public: 4525 public:
4526 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HStringCompareAndBranch, 4526 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HStringCompareAndBranch,
4527 HValue*, 4527 HValue*,
4528 HValue*, 4528 HValue*,
4529 Token::Value); 4529 Token::Value);
4530 4530
4531 HValue* context() { return OperandAt(0); } 4531 HValue* context() { return OperandAt(0); }
4532 HValue* left() { return OperandAt(1); } 4532 HValue* left() { return OperandAt(1); }
4533 HValue* right() { return OperandAt(2); } 4533 HValue* right() { return OperandAt(2); }
4534 Token::Value token() const { return token_; } 4534 Token::Value token() const { return token_; }
4535 4535
4536 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 4536 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
4537 4537
4538 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4538 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4539 return Representation::Tagged(); 4539 return Representation::Tagged();
4540 } 4540 }
4541 4541
4542 Representation GetInputRepresentation() const { 4542 Representation GetInputRepresentation() const {
4543 return Representation::Tagged(); 4543 return Representation::Tagged();
4544 } 4544 }
4545 4545
4546 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch) 4546 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch)
4547 4547
4548 private: 4548 private:
(...skipping 11 matching lines...) Expand all
4560 } 4560 }
4561 4561
4562 Token::Value token_; 4562 Token::Value token_;
4563 }; 4563 };
4564 4564
4565 4565
4566 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> { 4566 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> {
4567 public: 4567 public:
4568 DECLARE_INSTRUCTION_FACTORY_P0(HIsConstructCallAndBranch); 4568 DECLARE_INSTRUCTION_FACTORY_P0(HIsConstructCallAndBranch);
4569 4569
4570 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4570 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4571 return Representation::None(); 4571 return Representation::None();
4572 } 4572 }
4573 4573
4574 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch) 4574 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch)
4575 private: 4575 private:
4576 HIsConstructCallAndBranch() {} 4576 HIsConstructCallAndBranch() {}
4577 }; 4577 };
4578 4578
4579 4579
4580 class HHasInstanceTypeAndBranch V8_FINAL : public HUnaryControlInstruction { 4580 class HHasInstanceTypeAndBranch FINAL : public HUnaryControlInstruction {
4581 public: 4581 public:
4582 DECLARE_INSTRUCTION_FACTORY_P2( 4582 DECLARE_INSTRUCTION_FACTORY_P2(
4583 HHasInstanceTypeAndBranch, HValue*, InstanceType); 4583 HHasInstanceTypeAndBranch, HValue*, InstanceType);
4584 DECLARE_INSTRUCTION_FACTORY_P3( 4584 DECLARE_INSTRUCTION_FACTORY_P3(
4585 HHasInstanceTypeAndBranch, HValue*, InstanceType, InstanceType); 4585 HHasInstanceTypeAndBranch, HValue*, InstanceType, InstanceType);
4586 4586
4587 InstanceType from() { return from_; } 4587 InstanceType from() { return from_; }
4588 InstanceType to() { return to_; } 4588 InstanceType to() { return to_; }
4589 4589
4590 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 4590 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
4591 4591
4592 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4592 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4593 return Representation::Tagged(); 4593 return Representation::Tagged();
4594 } 4594 }
4595 4595
4596 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; 4596 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE;
4597 4597
4598 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) 4598 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch)
4599 4599
4600 private: 4600 private:
4601 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) 4601 HHasInstanceTypeAndBranch(HValue* value, InstanceType type)
4602 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } 4602 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { }
4603 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) 4603 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to)
4604 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { 4604 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) {
4605 DCHECK(to == LAST_TYPE); // Others not implemented yet in backend. 4605 DCHECK(to == LAST_TYPE); // Others not implemented yet in backend.
4606 } 4606 }
4607 4607
4608 InstanceType from_; 4608 InstanceType from_;
4609 InstanceType to_; // Inclusive range, not all combinations work. 4609 InstanceType to_; // Inclusive range, not all combinations work.
4610 }; 4610 };
4611 4611
4612 4612
4613 class HHasCachedArrayIndexAndBranch V8_FINAL : public HUnaryControlInstruction { 4613 class HHasCachedArrayIndexAndBranch FINAL : public HUnaryControlInstruction {
4614 public: 4614 public:
4615 DECLARE_INSTRUCTION_FACTORY_P1(HHasCachedArrayIndexAndBranch, HValue*); 4615 DECLARE_INSTRUCTION_FACTORY_P1(HHasCachedArrayIndexAndBranch, HValue*);
4616 4616
4617 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4617 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4618 return Representation::Tagged(); 4618 return Representation::Tagged();
4619 } 4619 }
4620 4620
4621 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch) 4621 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch)
4622 private: 4622 private:
4623 explicit HHasCachedArrayIndexAndBranch(HValue* value) 4623 explicit HHasCachedArrayIndexAndBranch(HValue* value)
4624 : HUnaryControlInstruction(value, NULL, NULL) { } 4624 : HUnaryControlInstruction(value, NULL, NULL) { }
4625 }; 4625 };
4626 4626
4627 4627
4628 class HGetCachedArrayIndex V8_FINAL : public HUnaryOperation { 4628 class HGetCachedArrayIndex FINAL : public HUnaryOperation {
4629 public: 4629 public:
4630 DECLARE_INSTRUCTION_FACTORY_P1(HGetCachedArrayIndex, HValue*); 4630 DECLARE_INSTRUCTION_FACTORY_P1(HGetCachedArrayIndex, HValue*);
4631 4631
4632 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4632 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4633 return Representation::Tagged(); 4633 return Representation::Tagged();
4634 } 4634 }
4635 4635
4636 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) 4636 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex)
4637 4637
4638 protected: 4638 protected:
4639 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4639 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
4640 4640
4641 private: 4641 private:
4642 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) { 4642 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) {
4643 set_representation(Representation::Tagged()); 4643 set_representation(Representation::Tagged());
4644 SetFlag(kUseGVN); 4644 SetFlag(kUseGVN);
4645 } 4645 }
4646 4646
4647 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 4647 virtual bool IsDeletable() const OVERRIDE { return true; }
4648 }; 4648 };
4649 4649
4650 4650
4651 class HClassOfTestAndBranch V8_FINAL : public HUnaryControlInstruction { 4651 class HClassOfTestAndBranch FINAL : public HUnaryControlInstruction {
4652 public: 4652 public:
4653 DECLARE_INSTRUCTION_FACTORY_P2(HClassOfTestAndBranch, HValue*, 4653 DECLARE_INSTRUCTION_FACTORY_P2(HClassOfTestAndBranch, HValue*,
4654 Handle<String>); 4654 Handle<String>);
4655 4655
4656 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch) 4656 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch)
4657 4657
4658 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4658 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4659 return Representation::Tagged(); 4659 return Representation::Tagged();
4660 } 4660 }
4661 4661
4662 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 4662 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
4663 4663
4664 Handle<String> class_name() const { return class_name_; } 4664 Handle<String> class_name() const { return class_name_; }
4665 4665
4666 private: 4666 private:
4667 HClassOfTestAndBranch(HValue* value, Handle<String> class_name) 4667 HClassOfTestAndBranch(HValue* value, Handle<String> class_name)
4668 : HUnaryControlInstruction(value, NULL, NULL), 4668 : HUnaryControlInstruction(value, NULL, NULL),
4669 class_name_(class_name) { } 4669 class_name_(class_name) { }
4670 4670
4671 Handle<String> class_name_; 4671 Handle<String> class_name_;
4672 }; 4672 };
4673 4673
4674 4674
4675 class HTypeofIsAndBranch V8_FINAL : public HUnaryControlInstruction { 4675 class HTypeofIsAndBranch FINAL : public HUnaryControlInstruction {
4676 public: 4676 public:
4677 DECLARE_INSTRUCTION_FACTORY_P2(HTypeofIsAndBranch, HValue*, Handle<String>); 4677 DECLARE_INSTRUCTION_FACTORY_P2(HTypeofIsAndBranch, HValue*, Handle<String>);
4678 4678
4679 Handle<String> type_literal() const { return type_literal_.handle(); } 4679 Handle<String> type_literal() const { return type_literal_.handle(); }
4680 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 4680 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
4681 4681
4682 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) 4682 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch)
4683 4683
4684 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4684 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4685 return Representation::None(); 4685 return Representation::None();
4686 } 4686 }
4687 4687
4688 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; 4688 virtual bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE;
4689 4689
4690 virtual void FinalizeUniqueness() V8_OVERRIDE { 4690 virtual void FinalizeUniqueness() OVERRIDE {
4691 type_literal_ = Unique<String>(type_literal_.handle()); 4691 type_literal_ = Unique<String>(type_literal_.handle());
4692 } 4692 }
4693 4693
4694 private: 4694 private:
4695 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal) 4695 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal)
4696 : HUnaryControlInstruction(value, NULL, NULL), 4696 : HUnaryControlInstruction(value, NULL, NULL),
4697 type_literal_(Unique<String>::CreateUninitialized(type_literal)) { } 4697 type_literal_(Unique<String>::CreateUninitialized(type_literal)) { }
4698 4698
4699 Unique<String> type_literal_; 4699 Unique<String> type_literal_;
4700 }; 4700 };
4701 4701
4702 4702
4703 class HInstanceOf V8_FINAL : public HBinaryOperation { 4703 class HInstanceOf FINAL : public HBinaryOperation {
4704 public: 4704 public:
4705 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOf, HValue*, HValue*); 4705 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOf, HValue*, HValue*);
4706 4706
4707 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4707 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4708 return Representation::Tagged(); 4708 return Representation::Tagged();
4709 } 4709 }
4710 4710
4711 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 4711 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
4712 4712
4713 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) 4713 DECLARE_CONCRETE_INSTRUCTION(InstanceOf)
4714 4714
4715 private: 4715 private:
4716 HInstanceOf(HValue* context, HValue* left, HValue* right) 4716 HInstanceOf(HValue* context, HValue* left, HValue* right)
4717 : HBinaryOperation(context, left, right, HType::Boolean()) { 4717 : HBinaryOperation(context, left, right, HType::Boolean()) {
4718 set_representation(Representation::Tagged()); 4718 set_representation(Representation::Tagged());
4719 SetAllSideEffects(); 4719 SetAllSideEffects();
4720 } 4720 }
4721 }; 4721 };
4722 4722
4723 4723
4724 class HInstanceOfKnownGlobal V8_FINAL : public HTemplateInstruction<2> { 4724 class HInstanceOfKnownGlobal FINAL : public HTemplateInstruction<2> {
4725 public: 4725 public:
4726 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOfKnownGlobal, 4726 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOfKnownGlobal,
4727 HValue*, 4727 HValue*,
4728 Handle<JSFunction>); 4728 Handle<JSFunction>);
4729 4729
4730 HValue* context() { return OperandAt(0); } 4730 HValue* context() { return OperandAt(0); }
4731 HValue* left() { return OperandAt(1); } 4731 HValue* left() { return OperandAt(1); }
4732 Handle<JSFunction> function() { return function_; } 4732 Handle<JSFunction> function() { return function_; }
4733 4733
4734 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4734 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4735 return Representation::Tagged(); 4735 return Representation::Tagged();
4736 } 4736 }
4737 4737
4738 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) 4738 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal)
4739 4739
4740 private: 4740 private:
4741 HInstanceOfKnownGlobal(HValue* context, 4741 HInstanceOfKnownGlobal(HValue* context,
4742 HValue* left, 4742 HValue* left,
4743 Handle<JSFunction> right) 4743 Handle<JSFunction> right)
4744 : HTemplateInstruction<2>(HType::Boolean()), function_(right) { 4744 : HTemplateInstruction<2>(HType::Boolean()), function_(right) {
4745 SetOperandAt(0, context); 4745 SetOperandAt(0, context);
4746 SetOperandAt(1, left); 4746 SetOperandAt(1, left);
4747 set_representation(Representation::Tagged()); 4747 set_representation(Representation::Tagged());
4748 SetAllSideEffects(); 4748 SetAllSideEffects();
4749 } 4749 }
4750 4750
4751 Handle<JSFunction> function_; 4751 Handle<JSFunction> function_;
4752 }; 4752 };
4753 4753
4754 4754
4755 class HPower V8_FINAL : public HTemplateInstruction<2> { 4755 class HPower FINAL : public HTemplateInstruction<2> {
4756 public: 4756 public:
4757 static HInstruction* New(Zone* zone, 4757 static HInstruction* New(Zone* zone,
4758 HValue* context, 4758 HValue* context,
4759 HValue* left, 4759 HValue* left,
4760 HValue* right); 4760 HValue* right);
4761 4761
4762 HValue* left() { return OperandAt(0); } 4762 HValue* left() { return OperandAt(0); }
4763 HValue* right() const { return OperandAt(1); } 4763 HValue* right() const { return OperandAt(1); }
4764 4764
4765 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4765 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
4766 return index == 0 4766 return index == 0
4767 ? Representation::Double() 4767 ? Representation::Double()
4768 : Representation::None(); 4768 : Representation::None();
4769 } 4769 }
4770 virtual Representation observed_input_representation(int index) V8_OVERRIDE { 4770 virtual Representation observed_input_representation(int index) OVERRIDE {
4771 return RequiredInputRepresentation(index); 4771 return RequiredInputRepresentation(index);
4772 } 4772 }
4773 4773
4774 DECLARE_CONCRETE_INSTRUCTION(Power) 4774 DECLARE_CONCRETE_INSTRUCTION(Power)
4775 4775
4776 protected: 4776 protected:
4777 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4777 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
4778 4778
4779 private: 4779 private:
4780 HPower(HValue* left, HValue* right) { 4780 HPower(HValue* left, HValue* right) {
4781 SetOperandAt(0, left); 4781 SetOperandAt(0, left);
4782 SetOperandAt(1, right); 4782 SetOperandAt(1, right);
4783 set_representation(Representation::Double()); 4783 set_representation(Representation::Double());
4784 SetFlag(kUseGVN); 4784 SetFlag(kUseGVN);
4785 SetChangesFlag(kNewSpacePromotion); 4785 SetChangesFlag(kNewSpacePromotion);
4786 } 4786 }
4787 4787
4788 virtual bool IsDeletable() const V8_OVERRIDE { 4788 virtual bool IsDeletable() const OVERRIDE {
4789 return !right()->representation().IsTagged(); 4789 return !right()->representation().IsTagged();
4790 } 4790 }
4791 }; 4791 };
4792 4792
4793 4793
4794 class HAdd V8_FINAL : public HArithmeticBinaryOperation { 4794 class HAdd FINAL : public HArithmeticBinaryOperation {
4795 public: 4795 public:
4796 static HInstruction* New(Zone* zone, 4796 static HInstruction* New(Zone* zone,
4797 HValue* context, 4797 HValue* context,
4798 HValue* left, 4798 HValue* left,
4799 HValue* right); 4799 HValue* right);
4800 4800
4801 // Add is only commutative if two integer values are added and not if two 4801 // Add is only commutative if two integer values are added and not if two
4802 // tagged values are added (because it might be a String concatenation). 4802 // tagged values are added (because it might be a String concatenation).
4803 // We also do not commute (pointer + offset). 4803 // We also do not commute (pointer + offset).
4804 virtual bool IsCommutative() const V8_OVERRIDE { 4804 virtual bool IsCommutative() const OVERRIDE {
4805 return !representation().IsTagged() && !representation().IsExternal(); 4805 return !representation().IsTagged() && !representation().IsExternal();
4806 } 4806 }
4807 4807
4808 virtual HValue* Canonicalize() V8_OVERRIDE; 4808 virtual HValue* Canonicalize() OVERRIDE;
4809 4809
4810 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { 4810 virtual bool TryDecompose(DecompositionResult* decomposition) OVERRIDE {
4811 if (left()->IsInteger32Constant()) { 4811 if (left()->IsInteger32Constant()) {
4812 decomposition->Apply(right(), left()->GetInteger32Constant()); 4812 decomposition->Apply(right(), left()->GetInteger32Constant());
4813 return true; 4813 return true;
4814 } else if (right()->IsInteger32Constant()) { 4814 } else if (right()->IsInteger32Constant()) {
4815 decomposition->Apply(left(), right()->GetInteger32Constant()); 4815 decomposition->Apply(left(), right()->GetInteger32Constant());
4816 return true; 4816 return true;
4817 } else { 4817 } else {
4818 return false; 4818 return false;
4819 } 4819 }
4820 } 4820 }
4821 4821
4822 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { 4822 virtual void RepresentationChanged(Representation to) OVERRIDE {
4823 if (to.IsTagged() && 4823 if (to.IsTagged() &&
4824 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || 4824 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() ||
4825 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { 4825 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) {
4826 SetAllSideEffects(); 4826 SetAllSideEffects();
4827 ClearFlag(kUseGVN); 4827 ClearFlag(kUseGVN);
4828 } else { 4828 } else {
4829 ClearAllSideEffects(); 4829 ClearAllSideEffects();
4830 SetFlag(kUseGVN); 4830 SetFlag(kUseGVN);
4831 } 4831 }
4832 if (to.IsTagged()) { 4832 if (to.IsTagged()) {
4833 SetChangesFlag(kNewSpacePromotion); 4833 SetChangesFlag(kNewSpacePromotion);
4834 ClearFlag(kAllowUndefinedAsNaN); 4834 ClearFlag(kAllowUndefinedAsNaN);
4835 } 4835 }
4836 } 4836 }
4837 4837
4838 virtual Representation RepresentationFromInputs() V8_OVERRIDE; 4838 virtual Representation RepresentationFromInputs() OVERRIDE;
4839 4839
4840 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE; 4840 virtual Representation RequiredInputRepresentation(int index) OVERRIDE;
4841 4841
4842 DECLARE_CONCRETE_INSTRUCTION(Add) 4842 DECLARE_CONCRETE_INSTRUCTION(Add)
4843 4843
4844 protected: 4844 protected:
4845 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4845 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
4846 4846
4847 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 4847 virtual Range* InferRange(Zone* zone) OVERRIDE;
4848 4848
4849 private: 4849 private:
4850 HAdd(HValue* context, HValue* left, HValue* right) 4850 HAdd(HValue* context, HValue* left, HValue* right)
4851 : HArithmeticBinaryOperation(context, left, right) { 4851 : HArithmeticBinaryOperation(context, left, right) {
4852 SetFlag(kCanOverflow); 4852 SetFlag(kCanOverflow);
4853 } 4853 }
4854 }; 4854 };
4855 4855
4856 4856
4857 class HSub V8_FINAL : public HArithmeticBinaryOperation { 4857 class HSub FINAL : public HArithmeticBinaryOperation {
4858 public: 4858 public:
4859 static HInstruction* New(Zone* zone, 4859 static HInstruction* New(Zone* zone,
4860 HValue* context, 4860 HValue* context,
4861 HValue* left, 4861 HValue* left,
4862 HValue* right); 4862 HValue* right);
4863 4863
4864 virtual HValue* Canonicalize() V8_OVERRIDE; 4864 virtual HValue* Canonicalize() OVERRIDE;
4865 4865
4866 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { 4866 virtual bool TryDecompose(DecompositionResult* decomposition) OVERRIDE {
4867 if (right()->IsInteger32Constant()) { 4867 if (right()->IsInteger32Constant()) {
4868 decomposition->Apply(left(), -right()->GetInteger32Constant()); 4868 decomposition->Apply(left(), -right()->GetInteger32Constant());
4869 return true; 4869 return true;
4870 } else { 4870 } else {
4871 return false; 4871 return false;
4872 } 4872 }
4873 } 4873 }
4874 4874
4875 DECLARE_CONCRETE_INSTRUCTION(Sub) 4875 DECLARE_CONCRETE_INSTRUCTION(Sub)
4876 4876
4877 protected: 4877 protected:
4878 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4878 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
4879 4879
4880 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 4880 virtual Range* InferRange(Zone* zone) OVERRIDE;
4881 4881
4882 private: 4882 private:
4883 HSub(HValue* context, HValue* left, HValue* right) 4883 HSub(HValue* context, HValue* left, HValue* right)
4884 : HArithmeticBinaryOperation(context, left, right) { 4884 : HArithmeticBinaryOperation(context, left, right) {
4885 SetFlag(kCanOverflow); 4885 SetFlag(kCanOverflow);
4886 } 4886 }
4887 }; 4887 };
4888 4888
4889 4889
4890 class HMul V8_FINAL : public HArithmeticBinaryOperation { 4890 class HMul FINAL : public HArithmeticBinaryOperation {
4891 public: 4891 public:
4892 static HInstruction* New(Zone* zone, 4892 static HInstruction* New(Zone* zone,
4893 HValue* context, 4893 HValue* context,
4894 HValue* left, 4894 HValue* left,
4895 HValue* right); 4895 HValue* right);
4896 4896
4897 static HInstruction* NewImul(Zone* zone, 4897 static HInstruction* NewImul(Zone* zone,
4898 HValue* context, 4898 HValue* context,
4899 HValue* left, 4899 HValue* left,
4900 HValue* right) { 4900 HValue* right) {
4901 HInstruction* instr = HMul::New(zone, context, left, right); 4901 HInstruction* instr = HMul::New(zone, context, left, right);
4902 if (!instr->IsMul()) return instr; 4902 if (!instr->IsMul()) return instr;
4903 HMul* mul = HMul::cast(instr); 4903 HMul* mul = HMul::cast(instr);
4904 // TODO(mstarzinger): Prevent bailout on minus zero for imul. 4904 // TODO(mstarzinger): Prevent bailout on minus zero for imul.
4905 mul->AssumeRepresentation(Representation::Integer32()); 4905 mul->AssumeRepresentation(Representation::Integer32());
4906 mul->ClearFlag(HValue::kCanOverflow); 4906 mul->ClearFlag(HValue::kCanOverflow);
4907 return mul; 4907 return mul;
4908 } 4908 }
4909 4909
4910 virtual HValue* Canonicalize() V8_OVERRIDE; 4910 virtual HValue* Canonicalize() OVERRIDE;
4911 4911
4912 // Only commutative if it is certain that not two objects are multiplicated. 4912 // Only commutative if it is certain that not two objects are multiplicated.
4913 virtual bool IsCommutative() const V8_OVERRIDE { 4913 virtual bool IsCommutative() const OVERRIDE {
4914 return !representation().IsTagged(); 4914 return !representation().IsTagged();
4915 } 4915 }
4916 4916
4917 virtual void UpdateRepresentation(Representation new_rep, 4917 virtual void UpdateRepresentation(Representation new_rep,
4918 HInferRepresentationPhase* h_infer, 4918 HInferRepresentationPhase* h_infer,
4919 const char* reason) V8_OVERRIDE { 4919 const char* reason) OVERRIDE {
4920 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); 4920 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason);
4921 } 4921 }
4922 4922
4923 bool MulMinusOne(); 4923 bool MulMinusOne();
4924 4924
4925 DECLARE_CONCRETE_INSTRUCTION(Mul) 4925 DECLARE_CONCRETE_INSTRUCTION(Mul)
4926 4926
4927 protected: 4927 protected:
4928 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4928 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
4929 4929
4930 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 4930 virtual Range* InferRange(Zone* zone) OVERRIDE;
4931 4931
4932 private: 4932 private:
4933 HMul(HValue* context, HValue* left, HValue* right) 4933 HMul(HValue* context, HValue* left, HValue* right)
4934 : HArithmeticBinaryOperation(context, left, right) { 4934 : HArithmeticBinaryOperation(context, left, right) {
4935 SetFlag(kCanOverflow); 4935 SetFlag(kCanOverflow);
4936 } 4936 }
4937 }; 4937 };
4938 4938
4939 4939
4940 class HMod V8_FINAL : public HArithmeticBinaryOperation { 4940 class HMod FINAL : public HArithmeticBinaryOperation {
4941 public: 4941 public:
4942 static HInstruction* New(Zone* zone, 4942 static HInstruction* New(Zone* zone,
4943 HValue* context, 4943 HValue* context,
4944 HValue* left, 4944 HValue* left,
4945 HValue* right); 4945 HValue* right);
4946 4946
4947 virtual HValue* Canonicalize() V8_OVERRIDE; 4947 virtual HValue* Canonicalize() OVERRIDE;
4948 4948
4949 virtual void UpdateRepresentation(Representation new_rep, 4949 virtual void UpdateRepresentation(Representation new_rep,
4950 HInferRepresentationPhase* h_infer, 4950 HInferRepresentationPhase* h_infer,
4951 const char* reason) V8_OVERRIDE { 4951 const char* reason) OVERRIDE {
4952 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); 4952 if (new_rep.IsSmi()) new_rep = Representation::Integer32();
4953 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); 4953 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason);
4954 } 4954 }
4955 4955
4956 DECLARE_CONCRETE_INSTRUCTION(Mod) 4956 DECLARE_CONCRETE_INSTRUCTION(Mod)
4957 4957
4958 protected: 4958 protected:
4959 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4959 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
4960 4960
4961 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 4961 virtual Range* InferRange(Zone* zone) OVERRIDE;
4962 4962
4963 private: 4963 private:
4964 HMod(HValue* context, 4964 HMod(HValue* context,
4965 HValue* left, 4965 HValue* left,
4966 HValue* right) : HArithmeticBinaryOperation(context, left, right) { 4966 HValue* right) : HArithmeticBinaryOperation(context, left, right) {
4967 SetFlag(kCanBeDivByZero); 4967 SetFlag(kCanBeDivByZero);
4968 SetFlag(kCanOverflow); 4968 SetFlag(kCanOverflow);
4969 SetFlag(kLeftCanBeNegative); 4969 SetFlag(kLeftCanBeNegative);
4970 } 4970 }
4971 }; 4971 };
4972 4972
4973 4973
4974 class HDiv V8_FINAL : public HArithmeticBinaryOperation { 4974 class HDiv FINAL : public HArithmeticBinaryOperation {
4975 public: 4975 public:
4976 static HInstruction* New(Zone* zone, 4976 static HInstruction* New(Zone* zone,
4977 HValue* context, 4977 HValue* context,
4978 HValue* left, 4978 HValue* left,
4979 HValue* right); 4979 HValue* right);
4980 4980
4981 virtual HValue* Canonicalize() V8_OVERRIDE; 4981 virtual HValue* Canonicalize() OVERRIDE;
4982 4982
4983 virtual void UpdateRepresentation(Representation new_rep, 4983 virtual void UpdateRepresentation(Representation new_rep,
4984 HInferRepresentationPhase* h_infer, 4984 HInferRepresentationPhase* h_infer,
4985 const char* reason) V8_OVERRIDE { 4985 const char* reason) OVERRIDE {
4986 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); 4986 if (new_rep.IsSmi()) new_rep = Representation::Integer32();
4987 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); 4987 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason);
4988 } 4988 }
4989 4989
4990 DECLARE_CONCRETE_INSTRUCTION(Div) 4990 DECLARE_CONCRETE_INSTRUCTION(Div)
4991 4991
4992 protected: 4992 protected:
4993 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4993 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
4994 4994
4995 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 4995 virtual Range* InferRange(Zone* zone) OVERRIDE;
4996 4996
4997 private: 4997 private:
4998 HDiv(HValue* context, HValue* left, HValue* right) 4998 HDiv(HValue* context, HValue* left, HValue* right)
4999 : HArithmeticBinaryOperation(context, left, right) { 4999 : HArithmeticBinaryOperation(context, left, right) {
5000 SetFlag(kCanBeDivByZero); 5000 SetFlag(kCanBeDivByZero);
5001 SetFlag(kCanOverflow); 5001 SetFlag(kCanOverflow);
5002 } 5002 }
5003 }; 5003 };
5004 5004
5005 5005
5006 class HMathMinMax V8_FINAL : public HArithmeticBinaryOperation { 5006 class HMathMinMax FINAL : public HArithmeticBinaryOperation {
5007 public: 5007 public:
5008 enum Operation { kMathMin, kMathMax }; 5008 enum Operation { kMathMin, kMathMax };
5009 5009
5010 static HInstruction* New(Zone* zone, 5010 static HInstruction* New(Zone* zone,
5011 HValue* context, 5011 HValue* context,
5012 HValue* left, 5012 HValue* left,
5013 HValue* right, 5013 HValue* right,
5014 Operation op); 5014 Operation op);
5015 5015
5016 virtual Representation observed_input_representation(int index) V8_OVERRIDE { 5016 virtual Representation observed_input_representation(int index) OVERRIDE {
5017 return RequiredInputRepresentation(index); 5017 return RequiredInputRepresentation(index);
5018 } 5018 }
5019 5019
5020 virtual void InferRepresentation( 5020 virtual void InferRepresentation(
5021 HInferRepresentationPhase* h_infer) V8_OVERRIDE; 5021 HInferRepresentationPhase* h_infer) OVERRIDE;
5022 5022
5023 virtual Representation RepresentationFromInputs() V8_OVERRIDE { 5023 virtual Representation RepresentationFromInputs() OVERRIDE {
5024 Representation left_rep = left()->representation(); 5024 Representation left_rep = left()->representation();
5025 Representation right_rep = right()->representation(); 5025 Representation right_rep = right()->representation();
5026 Representation result = Representation::Smi(); 5026 Representation result = Representation::Smi();
5027 result = result.generalize(left_rep); 5027 result = result.generalize(left_rep);
5028 result = result.generalize(right_rep); 5028 result = result.generalize(right_rep);
5029 if (result.IsTagged()) return Representation::Double(); 5029 if (result.IsTagged()) return Representation::Double();
5030 return result; 5030 return result;
5031 } 5031 }
5032 5032
5033 virtual bool IsCommutative() const V8_OVERRIDE { return true; } 5033 virtual bool IsCommutative() const OVERRIDE { return true; }
5034 5034
5035 Operation operation() { return operation_; } 5035 Operation operation() { return operation_; }
5036 5036
5037 DECLARE_CONCRETE_INSTRUCTION(MathMinMax) 5037 DECLARE_CONCRETE_INSTRUCTION(MathMinMax)
5038 5038
5039 protected: 5039 protected:
5040 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 5040 virtual bool DataEquals(HValue* other) OVERRIDE {
5041 return other->IsMathMinMax() && 5041 return other->IsMathMinMax() &&
5042 HMathMinMax::cast(other)->operation_ == operation_; 5042 HMathMinMax::cast(other)->operation_ == operation_;
5043 } 5043 }
5044 5044
5045 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 5045 virtual Range* InferRange(Zone* zone) OVERRIDE;
5046 5046
5047 private: 5047 private:
5048 HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op) 5048 HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op)
5049 : HArithmeticBinaryOperation(context, left, right), 5049 : HArithmeticBinaryOperation(context, left, right),
5050 operation_(op) { } 5050 operation_(op) { }
5051 5051
5052 Operation operation_; 5052 Operation operation_;
5053 }; 5053 };
5054 5054
5055 5055
5056 class HBitwise V8_FINAL : public HBitwiseBinaryOperation { 5056 class HBitwise FINAL : public HBitwiseBinaryOperation {
5057 public: 5057 public:
5058 static HInstruction* New(Zone* zone, 5058 static HInstruction* New(Zone* zone,
5059 HValue* context, 5059 HValue* context,
5060 Token::Value op, 5060 Token::Value op,
5061 HValue* left, 5061 HValue* left,
5062 HValue* right); 5062 HValue* right);
5063 5063
5064 Token::Value op() const { return op_; } 5064 Token::Value op() const { return op_; }
5065 5065
5066 virtual bool IsCommutative() const V8_OVERRIDE { return true; } 5066 virtual bool IsCommutative() const OVERRIDE { return true; }
5067 5067
5068 virtual HValue* Canonicalize() V8_OVERRIDE; 5068 virtual HValue* Canonicalize() OVERRIDE;
5069 5069
5070 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 5070 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
5071 5071
5072 DECLARE_CONCRETE_INSTRUCTION(Bitwise) 5072 DECLARE_CONCRETE_INSTRUCTION(Bitwise)
5073 5073
5074 protected: 5074 protected:
5075 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 5075 virtual bool DataEquals(HValue* other) OVERRIDE {
5076 return op() == HBitwise::cast(other)->op(); 5076 return op() == HBitwise::cast(other)->op();
5077 } 5077 }
5078 5078
5079 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 5079 virtual Range* InferRange(Zone* zone) OVERRIDE;
5080 5080
5081 private: 5081 private:
5082 HBitwise(HValue* context, 5082 HBitwise(HValue* context,
5083 Token::Value op, 5083 Token::Value op,
5084 HValue* left, 5084 HValue* left,
5085 HValue* right) 5085 HValue* right)
5086 : HBitwiseBinaryOperation(context, left, right), 5086 : HBitwiseBinaryOperation(context, left, right),
5087 op_(op) { 5087 op_(op) {
5088 DCHECK(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR); 5088 DCHECK(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR);
5089 // BIT_AND with a smi-range positive value will always unset the 5089 // BIT_AND with a smi-range positive value will always unset the
(...skipping 18 matching lines...) Expand all
5108 HConstant::cast(right)->Integer32Value() < 0))) { 5108 HConstant::cast(right)->Integer32Value() < 0))) {
5109 SetFlag(kTruncatingToSmi); 5109 SetFlag(kTruncatingToSmi);
5110 SetFlag(kTruncatingToInt32); 5110 SetFlag(kTruncatingToInt32);
5111 } 5111 }
5112 } 5112 }
5113 5113
5114 Token::Value op_; 5114 Token::Value op_;
5115 }; 5115 };
5116 5116
5117 5117
5118 class HShl V8_FINAL : public HBitwiseBinaryOperation { 5118 class HShl FINAL : public HBitwiseBinaryOperation {
5119 public: 5119 public:
5120 static HInstruction* New(Zone* zone, 5120 static HInstruction* New(Zone* zone,
5121 HValue* context, 5121 HValue* context,
5122 HValue* left, 5122 HValue* left,
5123 HValue* right); 5123 HValue* right);
5124 5124
5125 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 5125 virtual Range* InferRange(Zone* zone) OVERRIDE;
5126 5126
5127 virtual void UpdateRepresentation(Representation new_rep, 5127 virtual void UpdateRepresentation(Representation new_rep,
5128 HInferRepresentationPhase* h_infer, 5128 HInferRepresentationPhase* h_infer,
5129 const char* reason) V8_OVERRIDE { 5129 const char* reason) OVERRIDE {
5130 if (new_rep.IsSmi() && 5130 if (new_rep.IsSmi() &&
5131 !(right()->IsInteger32Constant() && 5131 !(right()->IsInteger32Constant() &&
5132 right()->GetInteger32Constant() >= 0)) { 5132 right()->GetInteger32Constant() >= 0)) {
5133 new_rep = Representation::Integer32(); 5133 new_rep = Representation::Integer32();
5134 } 5134 }
5135 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); 5135 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason);
5136 } 5136 }
5137 5137
5138 DECLARE_CONCRETE_INSTRUCTION(Shl) 5138 DECLARE_CONCRETE_INSTRUCTION(Shl)
5139 5139
5140 protected: 5140 protected:
5141 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 5141 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
5142 5142
5143 private: 5143 private:
5144 HShl(HValue* context, HValue* left, HValue* right) 5144 HShl(HValue* context, HValue* left, HValue* right)
5145 : HBitwiseBinaryOperation(context, left, right) { } 5145 : HBitwiseBinaryOperation(context, left, right) { }
5146 }; 5146 };
5147 5147
5148 5148
5149 class HShr V8_FINAL : public HBitwiseBinaryOperation { 5149 class HShr FINAL : public HBitwiseBinaryOperation {
5150 public: 5150 public:
5151 static HInstruction* New(Zone* zone, 5151 static HInstruction* New(Zone* zone,
5152 HValue* context, 5152 HValue* context,
5153 HValue* left, 5153 HValue* left,
5154 HValue* right); 5154 HValue* right);
5155 5155
5156 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { 5156 virtual bool TryDecompose(DecompositionResult* decomposition) OVERRIDE {
5157 if (right()->IsInteger32Constant()) { 5157 if (right()->IsInteger32Constant()) {
5158 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { 5158 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) {
5159 // This is intended to look for HAdd and HSub, to handle compounds 5159 // This is intended to look for HAdd and HSub, to handle compounds
5160 // like ((base + offset) >> scale) with one single decomposition. 5160 // like ((base + offset) >> scale) with one single decomposition.
5161 left()->TryDecompose(decomposition); 5161 left()->TryDecompose(decomposition);
5162 return true; 5162 return true;
5163 } 5163 }
5164 } 5164 }
5165 return false; 5165 return false;
5166 } 5166 }
5167 5167
5168 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 5168 virtual Range* InferRange(Zone* zone) OVERRIDE;
5169 5169
5170 virtual void UpdateRepresentation(Representation new_rep, 5170 virtual void UpdateRepresentation(Representation new_rep,
5171 HInferRepresentationPhase* h_infer, 5171 HInferRepresentationPhase* h_infer,
5172 const char* reason) V8_OVERRIDE { 5172 const char* reason) OVERRIDE {
5173 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); 5173 if (new_rep.IsSmi()) new_rep = Representation::Integer32();
5174 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); 5174 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason);
5175 } 5175 }
5176 5176
5177 DECLARE_CONCRETE_INSTRUCTION(Shr) 5177 DECLARE_CONCRETE_INSTRUCTION(Shr)
5178 5178
5179 protected: 5179 protected:
5180 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 5180 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
5181 5181
5182 private: 5182 private:
5183 HShr(HValue* context, HValue* left, HValue* right) 5183 HShr(HValue* context, HValue* left, HValue* right)
5184 : HBitwiseBinaryOperation(context, left, right) { } 5184 : HBitwiseBinaryOperation(context, left, right) { }
5185 }; 5185 };
5186 5186
5187 5187
5188 class HSar V8_FINAL : public HBitwiseBinaryOperation { 5188 class HSar FINAL : public HBitwiseBinaryOperation {
5189 public: 5189 public:
5190 static HInstruction* New(Zone* zone, 5190 static HInstruction* New(Zone* zone,
5191 HValue* context, 5191 HValue* context,
5192 HValue* left, 5192 HValue* left,
5193 HValue* right); 5193 HValue* right);
5194 5194
5195 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { 5195 virtual bool TryDecompose(DecompositionResult* decomposition) OVERRIDE {
5196 if (right()->IsInteger32Constant()) { 5196 if (right()->IsInteger32Constant()) {
5197 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { 5197 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) {
5198 // This is intended to look for HAdd and HSub, to handle compounds 5198 // This is intended to look for HAdd and HSub, to handle compounds
5199 // like ((base + offset) >> scale) with one single decomposition. 5199 // like ((base + offset) >> scale) with one single decomposition.
5200 left()->TryDecompose(decomposition); 5200 left()->TryDecompose(decomposition);
5201 return true; 5201 return true;
5202 } 5202 }
5203 } 5203 }
5204 return false; 5204 return false;
5205 } 5205 }
5206 5206
5207 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 5207 virtual Range* InferRange(Zone* zone) OVERRIDE;
5208 5208
5209 virtual void UpdateRepresentation(Representation new_rep, 5209 virtual void UpdateRepresentation(Representation new_rep,
5210 HInferRepresentationPhase* h_infer, 5210 HInferRepresentationPhase* h_infer,
5211 const char* reason) V8_OVERRIDE { 5211 const char* reason) OVERRIDE {
5212 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); 5212 if (new_rep.IsSmi()) new_rep = Representation::Integer32();
5213 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); 5213 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason);
5214 } 5214 }
5215 5215
5216 DECLARE_CONCRETE_INSTRUCTION(Sar) 5216 DECLARE_CONCRETE_INSTRUCTION(Sar)
5217 5217
5218 protected: 5218 protected:
5219 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 5219 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
5220 5220
5221 private: 5221 private:
5222 HSar(HValue* context, HValue* left, HValue* right) 5222 HSar(HValue* context, HValue* left, HValue* right)
5223 : HBitwiseBinaryOperation(context, left, right) { } 5223 : HBitwiseBinaryOperation(context, left, right) { }
5224 }; 5224 };
5225 5225
5226 5226
5227 class HRor V8_FINAL : public HBitwiseBinaryOperation { 5227 class HRor FINAL : public HBitwiseBinaryOperation {
5228 public: 5228 public:
5229 static HInstruction* New(Zone* zone, 5229 static HInstruction* New(Zone* zone,
5230 HValue* context, 5230 HValue* context,
5231 HValue* left, 5231 HValue* left,
5232 HValue* right) { 5232 HValue* right) {
5233 return new(zone) HRor(context, left, right); 5233 return new(zone) HRor(context, left, right);
5234 } 5234 }
5235 5235
5236 virtual void UpdateRepresentation(Representation new_rep, 5236 virtual void UpdateRepresentation(Representation new_rep,
5237 HInferRepresentationPhase* h_infer, 5237 HInferRepresentationPhase* h_infer,
5238 const char* reason) V8_OVERRIDE { 5238 const char* reason) OVERRIDE {
5239 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); 5239 if (new_rep.IsSmi()) new_rep = Representation::Integer32();
5240 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); 5240 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason);
5241 } 5241 }
5242 5242
5243 DECLARE_CONCRETE_INSTRUCTION(Ror) 5243 DECLARE_CONCRETE_INSTRUCTION(Ror)
5244 5244
5245 protected: 5245 protected:
5246 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 5246 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
5247 5247
5248 private: 5248 private:
5249 HRor(HValue* context, HValue* left, HValue* right) 5249 HRor(HValue* context, HValue* left, HValue* right)
5250 : HBitwiseBinaryOperation(context, left, right) { 5250 : HBitwiseBinaryOperation(context, left, right) {
5251 ChangeRepresentation(Representation::Integer32()); 5251 ChangeRepresentation(Representation::Integer32());
5252 } 5252 }
5253 }; 5253 };
5254 5254
5255 5255
5256 class HOsrEntry V8_FINAL : public HTemplateInstruction<0> { 5256 class HOsrEntry FINAL : public HTemplateInstruction<0> {
5257 public: 5257 public:
5258 DECLARE_INSTRUCTION_FACTORY_P1(HOsrEntry, BailoutId); 5258 DECLARE_INSTRUCTION_FACTORY_P1(HOsrEntry, BailoutId);
5259 5259
5260 BailoutId ast_id() const { return ast_id_; } 5260 BailoutId ast_id() const { return ast_id_; }
5261 5261
5262 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5262 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
5263 return Representation::None(); 5263 return Representation::None();
5264 } 5264 }
5265 5265
5266 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) 5266 DECLARE_CONCRETE_INSTRUCTION(OsrEntry)
5267 5267
5268 private: 5268 private:
5269 explicit HOsrEntry(BailoutId ast_id) : ast_id_(ast_id) { 5269 explicit HOsrEntry(BailoutId ast_id) : ast_id_(ast_id) {
5270 SetChangesFlag(kOsrEntries); 5270 SetChangesFlag(kOsrEntries);
5271 SetChangesFlag(kNewSpacePromotion); 5271 SetChangesFlag(kNewSpacePromotion);
5272 } 5272 }
5273 5273
5274 BailoutId ast_id_; 5274 BailoutId ast_id_;
5275 }; 5275 };
5276 5276
5277 5277
5278 class HParameter V8_FINAL : public HTemplateInstruction<0> { 5278 class HParameter FINAL : public HTemplateInstruction<0> {
5279 public: 5279 public:
5280 enum ParameterKind { 5280 enum ParameterKind {
5281 STACK_PARAMETER, 5281 STACK_PARAMETER,
5282 REGISTER_PARAMETER 5282 REGISTER_PARAMETER
5283 }; 5283 };
5284 5284
5285 DECLARE_INSTRUCTION_FACTORY_P1(HParameter, unsigned); 5285 DECLARE_INSTRUCTION_FACTORY_P1(HParameter, unsigned);
5286 DECLARE_INSTRUCTION_FACTORY_P2(HParameter, unsigned, ParameterKind); 5286 DECLARE_INSTRUCTION_FACTORY_P2(HParameter, unsigned, ParameterKind);
5287 DECLARE_INSTRUCTION_FACTORY_P3(HParameter, unsigned, ParameterKind, 5287 DECLARE_INSTRUCTION_FACTORY_P3(HParameter, unsigned, ParameterKind,
5288 Representation); 5288 Representation);
5289 5289
5290 unsigned index() const { return index_; } 5290 unsigned index() const { return index_; }
5291 ParameterKind kind() const { return kind_; } 5291 ParameterKind kind() const { return kind_; }
5292 5292
5293 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 5293 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
5294 5294
5295 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5295 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
5296 return Representation::None(); 5296 return Representation::None();
5297 } 5297 }
5298 5298
5299 DECLARE_CONCRETE_INSTRUCTION(Parameter) 5299 DECLARE_CONCRETE_INSTRUCTION(Parameter)
5300 5300
5301 private: 5301 private:
5302 explicit HParameter(unsigned index, 5302 explicit HParameter(unsigned index,
5303 ParameterKind kind = STACK_PARAMETER) 5303 ParameterKind kind = STACK_PARAMETER)
5304 : index_(index), 5304 : index_(index),
5305 kind_(kind) { 5305 kind_(kind) {
5306 set_representation(Representation::Tagged()); 5306 set_representation(Representation::Tagged());
5307 } 5307 }
5308 5308
5309 explicit HParameter(unsigned index, 5309 explicit HParameter(unsigned index,
5310 ParameterKind kind, 5310 ParameterKind kind,
5311 Representation r) 5311 Representation r)
5312 : index_(index), 5312 : index_(index),
5313 kind_(kind) { 5313 kind_(kind) {
5314 set_representation(r); 5314 set_representation(r);
5315 } 5315 }
5316 5316
5317 unsigned index_; 5317 unsigned index_;
5318 ParameterKind kind_; 5318 ParameterKind kind_;
5319 }; 5319 };
5320 5320
5321 5321
5322 class HCallStub V8_FINAL : public HUnaryCall { 5322 class HCallStub FINAL : public HUnaryCall {
5323 public: 5323 public:
5324 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallStub, CodeStub::Major, int); 5324 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallStub, CodeStub::Major, int);
5325 CodeStub::Major major_key() { return major_key_; } 5325 CodeStub::Major major_key() { return major_key_; }
5326 5326
5327 HValue* context() { return value(); } 5327 HValue* context() { return value(); }
5328 5328
5329 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 5329 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
5330 5330
5331 DECLARE_CONCRETE_INSTRUCTION(CallStub) 5331 DECLARE_CONCRETE_INSTRUCTION(CallStub)
5332 5332
5333 private: 5333 private:
5334 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count) 5334 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count)
5335 : HUnaryCall(context, argument_count), 5335 : HUnaryCall(context, argument_count),
5336 major_key_(major_key) { 5336 major_key_(major_key) {
5337 } 5337 }
5338 5338
5339 CodeStub::Major major_key_; 5339 CodeStub::Major major_key_;
5340 }; 5340 };
5341 5341
5342 5342
5343 class HUnknownOSRValue V8_FINAL : public HTemplateInstruction<0> { 5343 class HUnknownOSRValue FINAL : public HTemplateInstruction<0> {
5344 public: 5344 public:
5345 DECLARE_INSTRUCTION_FACTORY_P2(HUnknownOSRValue, HEnvironment*, int); 5345 DECLARE_INSTRUCTION_FACTORY_P2(HUnknownOSRValue, HEnvironment*, int);
5346 5346
5347 virtual OStream& PrintDataTo(OStream& os) const; // NOLINT 5347 virtual OStream& PrintDataTo(OStream& os) const; // NOLINT
5348 5348
5349 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5349 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
5350 return Representation::None(); 5350 return Representation::None();
5351 } 5351 }
5352 5352
5353 void set_incoming_value(HPhi* value) { incoming_value_ = value; } 5353 void set_incoming_value(HPhi* value) { incoming_value_ = value; }
5354 HPhi* incoming_value() { return incoming_value_; } 5354 HPhi* incoming_value() { return incoming_value_; }
5355 HEnvironment *environment() { return environment_; } 5355 HEnvironment *environment() { return environment_; }
5356 int index() { return index_; } 5356 int index() { return index_; }
5357 5357
5358 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE { 5358 virtual Representation KnownOptimalRepresentation() OVERRIDE {
5359 if (incoming_value_ == NULL) return Representation::None(); 5359 if (incoming_value_ == NULL) return Representation::None();
5360 return incoming_value_->KnownOptimalRepresentation(); 5360 return incoming_value_->KnownOptimalRepresentation();
5361 } 5361 }
5362 5362
5363 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) 5363 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue)
5364 5364
5365 private: 5365 private:
5366 HUnknownOSRValue(HEnvironment* environment, int index) 5366 HUnknownOSRValue(HEnvironment* environment, int index)
5367 : environment_(environment), 5367 : environment_(environment),
5368 index_(index), 5368 index_(index),
5369 incoming_value_(NULL) { 5369 incoming_value_(NULL) {
5370 set_representation(Representation::Tagged()); 5370 set_representation(Representation::Tagged());
5371 } 5371 }
5372 5372
5373 HEnvironment* environment_; 5373 HEnvironment* environment_;
5374 int index_; 5374 int index_;
5375 HPhi* incoming_value_; 5375 HPhi* incoming_value_;
5376 }; 5376 };
5377 5377
5378 5378
5379 class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> { 5379 class HLoadGlobalCell FINAL : public HTemplateInstruction<0> {
5380 public: 5380 public:
5381 DECLARE_INSTRUCTION_FACTORY_P2(HLoadGlobalCell, Handle<Cell>, 5381 DECLARE_INSTRUCTION_FACTORY_P2(HLoadGlobalCell, Handle<Cell>,
5382 PropertyDetails); 5382 PropertyDetails);
5383 5383
5384 Unique<Cell> cell() const { return cell_; } 5384 Unique<Cell> cell() const { return cell_; }
5385 bool RequiresHoleCheck() const; 5385 bool RequiresHoleCheck() const;
5386 5386
5387 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 5387 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
5388 5388
5389 virtual intptr_t Hashcode() V8_OVERRIDE { 5389 virtual intptr_t Hashcode() OVERRIDE {
5390 return cell_.Hashcode(); 5390 return cell_.Hashcode();
5391 } 5391 }
5392 5392
5393 virtual void FinalizeUniqueness() V8_OVERRIDE { 5393 virtual void FinalizeUniqueness() OVERRIDE {
5394 cell_ = Unique<Cell>(cell_.handle()); 5394 cell_ = Unique<Cell>(cell_.handle());
5395 } 5395 }
5396 5396
5397 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5397 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
5398 return Representation::None(); 5398 return Representation::None();
5399 } 5399 }
5400 5400
5401 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) 5401 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell)
5402 5402
5403 protected: 5403 protected:
5404 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 5404 virtual bool DataEquals(HValue* other) OVERRIDE {
5405 return cell_ == HLoadGlobalCell::cast(other)->cell_; 5405 return cell_ == HLoadGlobalCell::cast(other)->cell_;
5406 } 5406 }
5407 5407
5408 private: 5408 private:
5409 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details) 5409 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details)
5410 : cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) { 5410 : cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) {
5411 set_representation(Representation::Tagged()); 5411 set_representation(Representation::Tagged());
5412 SetFlag(kUseGVN); 5412 SetFlag(kUseGVN);
5413 SetDependsOnFlag(kGlobalVars); 5413 SetDependsOnFlag(kGlobalVars);
5414 } 5414 }
5415 5415
5416 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); } 5416 virtual bool IsDeletable() const OVERRIDE { return !RequiresHoleCheck(); }
5417 5417
5418 Unique<Cell> cell_; 5418 Unique<Cell> cell_;
5419 PropertyDetails details_; 5419 PropertyDetails details_;
5420 }; 5420 };
5421 5421
5422 5422
5423 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> { 5423 class HLoadGlobalGeneric FINAL : public HTemplateInstruction<2> {
5424 public: 5424 public:
5425 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalGeneric, HValue*, 5425 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalGeneric, HValue*,
5426 Handle<String>, bool); 5426 Handle<String>, bool);
5427 5427
5428 HValue* context() { return OperandAt(0); } 5428 HValue* context() { return OperandAt(0); }
5429 HValue* global_object() { return OperandAt(1); } 5429 HValue* global_object() { return OperandAt(1); }
5430 Handle<String> name() const { return name_; } 5430 Handle<String> name() const { return name_; }
5431 bool for_typeof() const { return for_typeof_; } 5431 bool for_typeof() const { return for_typeof_; }
5432 int slot() const { 5432 int slot() const {
5433 DCHECK(FLAG_vector_ics && 5433 DCHECK(FLAG_vector_ics &&
5434 slot_ != FeedbackSlotInterface::kInvalidFeedbackSlot); 5434 slot_ != FeedbackSlotInterface::kInvalidFeedbackSlot);
5435 return slot_; 5435 return slot_;
5436 } 5436 }
5437 Handle<FixedArray> feedback_vector() const { return feedback_vector_; } 5437 Handle<FixedArray> feedback_vector() const { return feedback_vector_; }
5438 void SetVectorAndSlot(Handle<FixedArray> vector, int slot) { 5438 void SetVectorAndSlot(Handle<FixedArray> vector, int slot) {
5439 DCHECK(FLAG_vector_ics); 5439 DCHECK(FLAG_vector_ics);
5440 feedback_vector_ = vector; 5440 feedback_vector_ = vector;
5441 slot_ = slot; 5441 slot_ = slot;
5442 } 5442 }
5443 5443
5444 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 5444 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
5445 5445
5446 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5446 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
5447 return Representation::Tagged(); 5447 return Representation::Tagged();
5448 } 5448 }
5449 5449
5450 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) 5450 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric)
5451 5451
5452 private: 5452 private:
5453 HLoadGlobalGeneric(HValue* context, HValue* global_object, 5453 HLoadGlobalGeneric(HValue* context, HValue* global_object,
5454 Handle<String> name, bool for_typeof) 5454 Handle<String> name, bool for_typeof)
5455 : name_(name), for_typeof_(for_typeof), 5455 : name_(name), for_typeof_(for_typeof),
5456 slot_(FeedbackSlotInterface::kInvalidFeedbackSlot) { 5456 slot_(FeedbackSlotInterface::kInvalidFeedbackSlot) {
5457 SetOperandAt(0, context); 5457 SetOperandAt(0, context);
5458 SetOperandAt(1, global_object); 5458 SetOperandAt(1, global_object);
5459 set_representation(Representation::Tagged()); 5459 set_representation(Representation::Tagged());
5460 SetAllSideEffects(); 5460 SetAllSideEffects();
5461 } 5461 }
5462 5462
5463 Handle<String> name_; 5463 Handle<String> name_;
5464 bool for_typeof_; 5464 bool for_typeof_;
5465 Handle<FixedArray> feedback_vector_; 5465 Handle<FixedArray> feedback_vector_;
5466 int slot_; 5466 int slot_;
5467 }; 5467 };
5468 5468
5469 5469
5470 class HAllocate V8_FINAL : public HTemplateInstruction<2> { 5470 class HAllocate FINAL : public HTemplateInstruction<2> {
5471 public: 5471 public:
5472 static bool CompatibleInstanceTypes(InstanceType type1, 5472 static bool CompatibleInstanceTypes(InstanceType type1,
5473 InstanceType type2) { 5473 InstanceType type2) {
5474 return ComputeFlags(TENURED, type1) == ComputeFlags(TENURED, type2) && 5474 return ComputeFlags(TENURED, type1) == ComputeFlags(TENURED, type2) &&
5475 ComputeFlags(NOT_TENURED, type1) == ComputeFlags(NOT_TENURED, type2); 5475 ComputeFlags(NOT_TENURED, type1) == ComputeFlags(NOT_TENURED, type2);
5476 } 5476 }
5477 5477
5478 static HAllocate* New(Zone* zone, 5478 static HAllocate* New(Zone* zone,
5479 HValue* context, 5479 HValue* context,
5480 HValue* size, 5480 HValue* size,
(...skipping 12 matching lines...) Expand all
5493 HValue* context() const { return OperandAt(0); } 5493 HValue* context() const { return OperandAt(0); }
5494 HValue* size() const { return OperandAt(1); } 5494 HValue* size() const { return OperandAt(1); }
5495 5495
5496 bool has_size_upper_bound() { return size_upper_bound_ != NULL; } 5496 bool has_size_upper_bound() { return size_upper_bound_ != NULL; }
5497 HConstant* size_upper_bound() { return size_upper_bound_; } 5497 HConstant* size_upper_bound() { return size_upper_bound_; }
5498 void set_size_upper_bound(HConstant* value) { 5498 void set_size_upper_bound(HConstant* value) {
5499 DCHECK(size_upper_bound_ == NULL); 5499 DCHECK(size_upper_bound_ == NULL);
5500 size_upper_bound_ = value; 5500 size_upper_bound_ = value;
5501 } 5501 }
5502 5502
5503 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5503 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
5504 if (index == 0) { 5504 if (index == 0) {
5505 return Representation::Tagged(); 5505 return Representation::Tagged();
5506 } else { 5506 } else {
5507 return Representation::Integer32(); 5507 return Representation::Integer32();
5508 } 5508 }
5509 } 5509 }
5510 5510
5511 virtual Handle<Map> GetMonomorphicJSObjectMap() { 5511 virtual Handle<Map> GetMonomorphicJSObjectMap() {
5512 return known_initial_map_; 5512 return known_initial_map_;
5513 } 5513 }
(...skipping 28 matching lines...) Expand all
5542 5542
5543 bool MustClearNextMapWord() const { 5543 bool MustClearNextMapWord() const {
5544 return (flags_ & CLEAR_NEXT_MAP_WORD) != 0; 5544 return (flags_ & CLEAR_NEXT_MAP_WORD) != 0;
5545 } 5545 }
5546 5546
5547 void MakeDoubleAligned() { 5547 void MakeDoubleAligned() {
5548 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); 5548 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED);
5549 } 5549 }
5550 5550
5551 virtual bool HandleSideEffectDominator(GVNFlag side_effect, 5551 virtual bool HandleSideEffectDominator(GVNFlag side_effect,
5552 HValue* dominator) V8_OVERRIDE; 5552 HValue* dominator) OVERRIDE;
5553 5553
5554 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 5554 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
5555 5555
5556 DECLARE_CONCRETE_INSTRUCTION(Allocate) 5556 DECLARE_CONCRETE_INSTRUCTION(Allocate)
5557 5557
5558 private: 5558 private:
5559 enum Flags { 5559 enum Flags {
5560 ALLOCATE_IN_NEW_SPACE = 1 << 0, 5560 ALLOCATE_IN_NEW_SPACE = 1 << 0,
5561 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, 5561 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1,
5562 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, 5562 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2,
5563 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, 5563 ALLOCATE_DOUBLE_ALIGNED = 1 << 3,
5564 PREFILL_WITH_FILLER = 1 << 4, 5564 PREFILL_WITH_FILLER = 1 << 4,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
5648 void ClearNextMapWord(int offset); 5648 void ClearNextMapWord(int offset);
5649 5649
5650 Flags flags_; 5650 Flags flags_;
5651 Handle<Map> known_initial_map_; 5651 Handle<Map> known_initial_map_;
5652 HAllocate* dominating_allocate_; 5652 HAllocate* dominating_allocate_;
5653 HStoreNamedField* filler_free_space_size_; 5653 HStoreNamedField* filler_free_space_size_;
5654 HConstant* size_upper_bound_; 5654 HConstant* size_upper_bound_;
5655 }; 5655 };
5656 5656
5657 5657
5658 class HStoreCodeEntry V8_FINAL: public HTemplateInstruction<2> { 5658 class HStoreCodeEntry FINAL: public HTemplateInstruction<2> {
5659 public: 5659 public:
5660 static HStoreCodeEntry* New(Zone* zone, 5660 static HStoreCodeEntry* New(Zone* zone,
5661 HValue* context, 5661 HValue* context,
5662 HValue* function, 5662 HValue* function,
5663 HValue* code) { 5663 HValue* code) {
5664 return new(zone) HStoreCodeEntry(function, code); 5664 return new(zone) HStoreCodeEntry(function, code);
5665 } 5665 }
5666 5666
5667 virtual Representation RequiredInputRepresentation(int index) { 5667 virtual Representation RequiredInputRepresentation(int index) {
5668 return Representation::Tagged(); 5668 return Representation::Tagged();
5669 } 5669 }
5670 5670
5671 HValue* function() { return OperandAt(0); } 5671 HValue* function() { return OperandAt(0); }
5672 HValue* code_object() { return OperandAt(1); } 5672 HValue* code_object() { return OperandAt(1); }
5673 5673
5674 DECLARE_CONCRETE_INSTRUCTION(StoreCodeEntry) 5674 DECLARE_CONCRETE_INSTRUCTION(StoreCodeEntry)
5675 5675
5676 private: 5676 private:
5677 HStoreCodeEntry(HValue* function, HValue* code) { 5677 HStoreCodeEntry(HValue* function, HValue* code) {
5678 SetOperandAt(0, function); 5678 SetOperandAt(0, function);
5679 SetOperandAt(1, code); 5679 SetOperandAt(1, code);
5680 } 5680 }
5681 }; 5681 };
5682 5682
5683 5683
5684 class HInnerAllocatedObject V8_FINAL : public HTemplateInstruction<2> { 5684 class HInnerAllocatedObject FINAL : public HTemplateInstruction<2> {
5685 public: 5685 public:
5686 static HInnerAllocatedObject* New(Zone* zone, 5686 static HInnerAllocatedObject* New(Zone* zone,
5687 HValue* context, 5687 HValue* context,
5688 HValue* value, 5688 HValue* value,
5689 HValue* offset, 5689 HValue* offset,
5690 HType type) { 5690 HType type) {
5691 return new(zone) HInnerAllocatedObject(value, offset, type); 5691 return new(zone) HInnerAllocatedObject(value, offset, type);
5692 } 5692 }
5693 5693
5694 HValue* base_object() const { return OperandAt(0); } 5694 HValue* base_object() const { return OperandAt(0); }
5695 HValue* offset() const { return OperandAt(1); } 5695 HValue* offset() const { return OperandAt(1); }
5696 5696
5697 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5697 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
5698 return index == 0 ? Representation::Tagged() : Representation::Integer32(); 5698 return index == 0 ? Representation::Tagged() : Representation::Integer32();
5699 } 5699 }
5700 5700
5701 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 5701 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
5702 5702
5703 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject) 5703 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject)
5704 5704
5705 private: 5705 private:
5706 HInnerAllocatedObject(HValue* value, 5706 HInnerAllocatedObject(HValue* value,
5707 HValue* offset, 5707 HValue* offset,
5708 HType type) : HTemplateInstruction<2>(type) { 5708 HType type) : HTemplateInstruction<2>(type) {
5709 DCHECK(value->IsAllocate()); 5709 DCHECK(value->IsAllocate());
5710 DCHECK(type.IsHeapObject()); 5710 DCHECK(type.IsHeapObject());
5711 SetOperandAt(0, value); 5711 SetOperandAt(0, value);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
5771 } 5771 }
5772 if (object == dominator && 5772 if (object == dominator &&
5773 object->IsAllocate() && 5773 object->IsAllocate() &&
5774 HAllocate::cast(object)->IsNewSpaceAllocation()) { 5774 HAllocate::cast(object)->IsNewSpaceAllocation()) {
5775 return kPointersToHereAreAlwaysInteresting; 5775 return kPointersToHereAreAlwaysInteresting;
5776 } 5776 }
5777 return kPointersToHereMaybeInteresting; 5777 return kPointersToHereMaybeInteresting;
5778 } 5778 }
5779 5779
5780 5780
5781 class HStoreGlobalCell V8_FINAL : public HUnaryOperation { 5781 class HStoreGlobalCell FINAL : public HUnaryOperation {
5782 public: 5782 public:
5783 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*, 5783 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*,
5784 Handle<PropertyCell>, PropertyDetails); 5784 Handle<PropertyCell>, PropertyDetails);
5785 5785
5786 Unique<PropertyCell> cell() const { return cell_; } 5786 Unique<PropertyCell> cell() const { return cell_; }
5787 bool RequiresHoleCheck() { return details_.IsConfigurable(); } 5787 bool RequiresHoleCheck() { return details_.IsConfigurable(); }
5788 bool NeedsWriteBarrier() { 5788 bool NeedsWriteBarrier() {
5789 return StoringValueNeedsWriteBarrier(value()); 5789 return StoringValueNeedsWriteBarrier(value());
5790 } 5790 }
5791 5791
5792 virtual void FinalizeUniqueness() V8_OVERRIDE { 5792 virtual void FinalizeUniqueness() OVERRIDE {
5793 cell_ = Unique<PropertyCell>(cell_.handle()); 5793 cell_ = Unique<PropertyCell>(cell_.handle());
5794 } 5794 }
5795 5795
5796 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5796 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
5797 return Representation::Tagged(); 5797 return Representation::Tagged();
5798 } 5798 }
5799 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 5799 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
5800 5800
5801 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) 5801 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell)
5802 5802
5803 private: 5803 private:
5804 HStoreGlobalCell(HValue* value, 5804 HStoreGlobalCell(HValue* value,
5805 Handle<PropertyCell> cell, 5805 Handle<PropertyCell> cell,
5806 PropertyDetails details) 5806 PropertyDetails details)
5807 : HUnaryOperation(value), 5807 : HUnaryOperation(value),
5808 cell_(Unique<PropertyCell>::CreateUninitialized(cell)), 5808 cell_(Unique<PropertyCell>::CreateUninitialized(cell)),
5809 details_(details) { 5809 details_(details) {
5810 SetChangesFlag(kGlobalVars); 5810 SetChangesFlag(kGlobalVars);
5811 } 5811 }
5812 5812
5813 Unique<PropertyCell> cell_; 5813 Unique<PropertyCell> cell_;
5814 PropertyDetails details_; 5814 PropertyDetails details_;
5815 }; 5815 };
5816 5816
5817 5817
5818 class HLoadContextSlot V8_FINAL : public HUnaryOperation { 5818 class HLoadContextSlot FINAL : public HUnaryOperation {
5819 public: 5819 public:
5820 enum Mode { 5820 enum Mode {
5821 // Perform a normal load of the context slot without checking its value. 5821 // Perform a normal load of the context slot without checking its value.
5822 kNoCheck, 5822 kNoCheck,
5823 // Load and check the value of the context slot. Deoptimize if it's the 5823 // Load and check the value of the context slot. Deoptimize if it's the
5824 // hole value. This is used for checking for loading of uninitialized 5824 // hole value. This is used for checking for loading of uninitialized
5825 // harmony bindings where we deoptimize into full-codegen generated code 5825 // harmony bindings where we deoptimize into full-codegen generated code
5826 // which will subsequently throw a reference error. 5826 // which will subsequently throw a reference error.
5827 kCheckDeoptimize, 5827 kCheckDeoptimize,
5828 // Load and check the value of the context slot. Return undefined if it's 5828 // Load and check the value of the context slot. Return undefined if it's
(...skipping 12 matching lines...) Expand all
5841 Mode mode() const { return mode_; } 5841 Mode mode() const { return mode_; }
5842 5842
5843 bool DeoptimizesOnHole() { 5843 bool DeoptimizesOnHole() {
5844 return mode_ == kCheckDeoptimize; 5844 return mode_ == kCheckDeoptimize;
5845 } 5845 }
5846 5846
5847 bool RequiresHoleCheck() const { 5847 bool RequiresHoleCheck() const {
5848 return mode_ != kNoCheck; 5848 return mode_ != kNoCheck;
5849 } 5849 }
5850 5850
5851 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5851 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
5852 return Representation::Tagged(); 5852 return Representation::Tagged();
5853 } 5853 }
5854 5854
5855 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 5855 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
5856 5856
5857 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) 5857 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot)
5858 5858
5859 protected: 5859 protected:
5860 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 5860 virtual bool DataEquals(HValue* other) OVERRIDE {
5861 HLoadContextSlot* b = HLoadContextSlot::cast(other); 5861 HLoadContextSlot* b = HLoadContextSlot::cast(other);
5862 return (slot_index() == b->slot_index()); 5862 return (slot_index() == b->slot_index());
5863 } 5863 }
5864 5864
5865 private: 5865 private:
5866 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); } 5866 virtual bool IsDeletable() const OVERRIDE { return !RequiresHoleCheck(); }
5867 5867
5868 int slot_index_; 5868 int slot_index_;
5869 Mode mode_; 5869 Mode mode_;
5870 }; 5870 };
5871 5871
5872 5872
5873 class HStoreContextSlot V8_FINAL : public HTemplateInstruction<2> { 5873 class HStoreContextSlot FINAL : public HTemplateInstruction<2> {
5874 public: 5874 public:
5875 enum Mode { 5875 enum Mode {
5876 // Perform a normal store to the context slot without checking its previous 5876 // Perform a normal store to the context slot without checking its previous
5877 // value. 5877 // value.
5878 kNoCheck, 5878 kNoCheck,
5879 // Check the previous value of the context slot and deoptimize if it's the 5879 // Check the previous value of the context slot and deoptimize if it's the
5880 // hole value. This is used for checking for assignments to uninitialized 5880 // hole value. This is used for checking for assignments to uninitialized
5881 // harmony bindings where we deoptimize into full-codegen generated code 5881 // harmony bindings where we deoptimize into full-codegen generated code
5882 // which will subsequently throw a reference error. 5882 // which will subsequently throw a reference error.
5883 kCheckDeoptimize, 5883 kCheckDeoptimize,
(...skipping 14 matching lines...) Expand all
5898 } 5898 }
5899 5899
5900 bool DeoptimizesOnHole() { 5900 bool DeoptimizesOnHole() {
5901 return mode_ == kCheckDeoptimize; 5901 return mode_ == kCheckDeoptimize;
5902 } 5902 }
5903 5903
5904 bool RequiresHoleCheck() { 5904 bool RequiresHoleCheck() {
5905 return mode_ != kNoCheck; 5905 return mode_ != kNoCheck;
5906 } 5906 }
5907 5907
5908 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5908 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
5909 return Representation::Tagged(); 5909 return Representation::Tagged();
5910 } 5910 }
5911 5911
5912 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 5912 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
5913 5913
5914 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) 5914 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot)
5915 5915
5916 private: 5916 private:
5917 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value) 5917 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value)
5918 : slot_index_(slot_index), mode_(mode) { 5918 : slot_index_(slot_index), mode_(mode) {
5919 SetOperandAt(0, context); 5919 SetOperandAt(0, context);
5920 SetOperandAt(1, value); 5920 SetOperandAt(1, value);
5921 SetChangesFlag(kContextSlots); 5921 SetChangesFlag(kContextSlots);
5922 } 5922 }
5923 5923
5924 int slot_index_; 5924 int slot_index_;
5925 Mode mode_; 5925 Mode mode_;
5926 }; 5926 };
5927 5927
5928 5928
5929 // Represents an access to a portion of an object, such as the map pointer, 5929 // Represents an access to a portion of an object, such as the map pointer,
5930 // array elements pointer, etc, but not accesses to array elements themselves. 5930 // array elements pointer, etc, but not accesses to array elements themselves.
5931 class HObjectAccess V8_FINAL { 5931 class HObjectAccess FINAL {
5932 public: 5932 public:
5933 inline bool IsInobject() const { 5933 inline bool IsInobject() const {
5934 return portion() != kBackingStore && portion() != kExternalMemory; 5934 return portion() != kBackingStore && portion() != kExternalMemory;
5935 } 5935 }
5936 5936
5937 inline bool IsExternalMemory() const { 5937 inline bool IsExternalMemory() const {
5938 return portion() == kExternalMemory; 5938 return portion() == kExternalMemory;
5939 } 5939 }
5940 5940
5941 inline bool IsStringLength() const { 5941 inline bool IsStringLength() const {
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
6296 6296
6297 inline Portion portion() const { 6297 inline Portion portion() const {
6298 return PortionField::decode(value_); 6298 return PortionField::decode(value_);
6299 } 6299 }
6300 }; 6300 };
6301 6301
6302 6302
6303 OStream& operator<<(OStream& os, const HObjectAccess& access); 6303 OStream& operator<<(OStream& os, const HObjectAccess& access);
6304 6304
6305 6305
6306 class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> { 6306 class HLoadNamedField FINAL : public HTemplateInstruction<2> {
6307 public: 6307 public:
6308 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, 6308 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*,
6309 HValue*, HObjectAccess); 6309 HValue*, HObjectAccess);
6310 DECLARE_INSTRUCTION_FACTORY_P5(HLoadNamedField, HValue*, HValue*, 6310 DECLARE_INSTRUCTION_FACTORY_P5(HLoadNamedField, HValue*, HValue*,
6311 HObjectAccess, const UniqueSet<Map>*, HType); 6311 HObjectAccess, const UniqueSet<Map>*, HType);
6312 6312
6313 HValue* object() const { return OperandAt(0); } 6313 HValue* object() const { return OperandAt(0); }
6314 HValue* dependency() const { 6314 HValue* dependency() const {
6315 DCHECK(HasDependency()); 6315 DCHECK(HasDependency());
6316 return OperandAt(1); 6316 return OperandAt(1);
6317 } 6317 }
6318 bool HasDependency() const { return OperandAt(0) != OperandAt(1); } 6318 bool HasDependency() const { return OperandAt(0) != OperandAt(1); }
6319 HObjectAccess access() const { return access_; } 6319 HObjectAccess access() const { return access_; }
6320 Representation field_representation() const { 6320 Representation field_representation() const {
6321 return access_.representation(); 6321 return access_.representation();
6322 } 6322 }
6323 6323
6324 const UniqueSet<Map>* maps() const { return maps_; } 6324 const UniqueSet<Map>* maps() const { return maps_; }
6325 6325
6326 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } 6326 virtual bool HasEscapingOperandAt(int index) OVERRIDE { return false; }
6327 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { 6327 virtual bool HasOutOfBoundsAccess(int size) OVERRIDE {
6328 return !access().IsInobject() || access().offset() >= size; 6328 return !access().IsInobject() || access().offset() >= size;
6329 } 6329 }
6330 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6330 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
6331 if (index == 0 && access().IsExternalMemory()) { 6331 if (index == 0 && access().IsExternalMemory()) {
6332 // object must be external in case of external memory access 6332 // object must be external in case of external memory access
6333 return Representation::External(); 6333 return Representation::External();
6334 } 6334 }
6335 return Representation::Tagged(); 6335 return Representation::Tagged();
6336 } 6336 }
6337 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 6337 virtual Range* InferRange(Zone* zone) OVERRIDE;
6338 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 6338 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
6339 6339
6340 bool CanBeReplacedWith(HValue* other) const { 6340 bool CanBeReplacedWith(HValue* other) const {
6341 if (!CheckFlag(HValue::kCantBeReplaced)) return false; 6341 if (!CheckFlag(HValue::kCantBeReplaced)) return false;
6342 if (!type().Equals(other->type())) return false; 6342 if (!type().Equals(other->type())) return false;
6343 if (!representation().Equals(other->representation())) return false; 6343 if (!representation().Equals(other->representation())) return false;
6344 if (!other->IsLoadNamedField()) return true; 6344 if (!other->IsLoadNamedField()) return true;
6345 HLoadNamedField* that = HLoadNamedField::cast(other); 6345 HLoadNamedField* that = HLoadNamedField::cast(other);
6346 if (this->maps_ == that->maps_) return true; 6346 if (this->maps_ == that->maps_) return true;
6347 if (this->maps_ == NULL || that->maps_ == NULL) return false; 6347 if (this->maps_ == NULL || that->maps_ == NULL) return false;
6348 return this->maps_->IsSubset(that->maps_); 6348 return this->maps_->IsSubset(that->maps_);
6349 } 6349 }
6350 6350
6351 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) 6351 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField)
6352 6352
6353 protected: 6353 protected:
6354 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 6354 virtual bool DataEquals(HValue* other) OVERRIDE {
6355 HLoadNamedField* that = HLoadNamedField::cast(other); 6355 HLoadNamedField* that = HLoadNamedField::cast(other);
6356 if (!this->access_.Equals(that->access_)) return false; 6356 if (!this->access_.Equals(that->access_)) return false;
6357 if (this->maps_ == that->maps_) return true; 6357 if (this->maps_ == that->maps_) return true;
6358 return (this->maps_ != NULL && 6358 return (this->maps_ != NULL &&
6359 that->maps_ != NULL && 6359 that->maps_ != NULL &&
6360 this->maps_->Equals(that->maps_)); 6360 this->maps_->Equals(that->maps_));
6361 } 6361 }
6362 6362
6363 private: 6363 private:
6364 HLoadNamedField(HValue* object, 6364 HLoadNamedField(HValue* object,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
6408 SetOperandAt(0, object); 6408 SetOperandAt(0, object);
6409 SetOperandAt(1, dependency ? dependency : object); 6409 SetOperandAt(1, dependency ? dependency : object);
6410 6410
6411 DCHECK(access.representation().IsHeapObject()); 6411 DCHECK(access.representation().IsHeapObject());
6412 DCHECK(type.IsHeapObject()); 6412 DCHECK(type.IsHeapObject());
6413 set_representation(Representation::Tagged()); 6413 set_representation(Representation::Tagged());
6414 6414
6415 access.SetGVNFlags(this, LOAD); 6415 access.SetGVNFlags(this, LOAD);
6416 } 6416 }
6417 6417
6418 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6418 virtual bool IsDeletable() const OVERRIDE { return true; }
6419 6419
6420 HObjectAccess access_; 6420 HObjectAccess access_;
6421 const UniqueSet<Map>* maps_; 6421 const UniqueSet<Map>* maps_;
6422 }; 6422 };
6423 6423
6424 6424
6425 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> { 6425 class HLoadNamedGeneric FINAL : public HTemplateInstruction<2> {
6426 public: 6426 public:
6427 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*, 6427 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*,
6428 Handle<Object>); 6428 Handle<Object>);
6429 6429
6430 HValue* context() const { return OperandAt(0); } 6430 HValue* context() const { return OperandAt(0); }
6431 HValue* object() const { return OperandAt(1); } 6431 HValue* object() const { return OperandAt(1); }
6432 Handle<Object> name() const { return name_; } 6432 Handle<Object> name() const { return name_; }
6433 6433
6434 int slot() const { 6434 int slot() const {
6435 DCHECK(FLAG_vector_ics && 6435 DCHECK(FLAG_vector_ics &&
6436 slot_ != FeedbackSlotInterface::kInvalidFeedbackSlot); 6436 slot_ != FeedbackSlotInterface::kInvalidFeedbackSlot);
6437 return slot_; 6437 return slot_;
6438 } 6438 }
6439 Handle<FixedArray> feedback_vector() const { return feedback_vector_; } 6439 Handle<FixedArray> feedback_vector() const { return feedback_vector_; }
6440 void SetVectorAndSlot(Handle<FixedArray> vector, int slot) { 6440 void SetVectorAndSlot(Handle<FixedArray> vector, int slot) {
6441 DCHECK(FLAG_vector_ics); 6441 DCHECK(FLAG_vector_ics);
6442 feedback_vector_ = vector; 6442 feedback_vector_ = vector;
6443 slot_ = slot; 6443 slot_ = slot;
6444 } 6444 }
6445 6445
6446 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6446 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
6447 return Representation::Tagged(); 6447 return Representation::Tagged();
6448 } 6448 }
6449 6449
6450 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 6450 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
6451 6451
6452 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric) 6452 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric)
6453 6453
6454 private: 6454 private:
6455 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name) 6455 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name)
6456 : name_(name), 6456 : name_(name),
6457 slot_(FeedbackSlotInterface::kInvalidFeedbackSlot) { 6457 slot_(FeedbackSlotInterface::kInvalidFeedbackSlot) {
6458 SetOperandAt(0, context); 6458 SetOperandAt(0, context);
6459 SetOperandAt(1, object); 6459 SetOperandAt(1, object);
6460 set_representation(Representation::Tagged()); 6460 set_representation(Representation::Tagged());
6461 SetAllSideEffects(); 6461 SetAllSideEffects();
6462 } 6462 }
6463 6463
6464 Handle<Object> name_; 6464 Handle<Object> name_;
6465 Handle<FixedArray> feedback_vector_; 6465 Handle<FixedArray> feedback_vector_;
6466 int slot_; 6466 int slot_;
6467 }; 6467 };
6468 6468
6469 6469
6470 class HLoadFunctionPrototype V8_FINAL : public HUnaryOperation { 6470 class HLoadFunctionPrototype FINAL : public HUnaryOperation {
6471 public: 6471 public:
6472 DECLARE_INSTRUCTION_FACTORY_P1(HLoadFunctionPrototype, HValue*); 6472 DECLARE_INSTRUCTION_FACTORY_P1(HLoadFunctionPrototype, HValue*);
6473 6473
6474 HValue* function() { return OperandAt(0); } 6474 HValue* function() { return OperandAt(0); }
6475 6475
6476 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6476 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
6477 return Representation::Tagged(); 6477 return Representation::Tagged();
6478 } 6478 }
6479 6479
6480 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) 6480 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype)
6481 6481
6482 protected: 6482 protected:
6483 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 6483 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
6484 6484
6485 private: 6485 private:
6486 explicit HLoadFunctionPrototype(HValue* function) 6486 explicit HLoadFunctionPrototype(HValue* function)
6487 : HUnaryOperation(function) { 6487 : HUnaryOperation(function) {
6488 set_representation(Representation::Tagged()); 6488 set_representation(Representation::Tagged());
6489 SetFlag(kUseGVN); 6489 SetFlag(kUseGVN);
6490 SetDependsOnFlag(kCalls); 6490 SetDependsOnFlag(kCalls);
6491 } 6491 }
6492 }; 6492 };
6493 6493
(...skipping 16 matching lines...) Expand all
6510 6510
6511 6511
6512 static const int kDefaultKeyedHeaderOffsetSentinel = -1; 6512 static const int kDefaultKeyedHeaderOffsetSentinel = -1;
6513 6513
6514 enum LoadKeyedHoleMode { 6514 enum LoadKeyedHoleMode {
6515 NEVER_RETURN_HOLE, 6515 NEVER_RETURN_HOLE,
6516 ALLOW_RETURN_HOLE 6516 ALLOW_RETURN_HOLE
6517 }; 6517 };
6518 6518
6519 6519
6520 class HLoadKeyed V8_FINAL 6520 class HLoadKeyed FINAL
6521 : public HTemplateInstruction<3>, public ArrayInstructionInterface { 6521 : public HTemplateInstruction<3>, public ArrayInstructionInterface {
6522 public: 6522 public:
6523 DECLARE_INSTRUCTION_FACTORY_P4(HLoadKeyed, HValue*, HValue*, HValue*, 6523 DECLARE_INSTRUCTION_FACTORY_P4(HLoadKeyed, HValue*, HValue*, HValue*,
6524 ElementsKind); 6524 ElementsKind);
6525 DECLARE_INSTRUCTION_FACTORY_P5(HLoadKeyed, HValue*, HValue*, HValue*, 6525 DECLARE_INSTRUCTION_FACTORY_P5(HLoadKeyed, HValue*, HValue*, HValue*,
6526 ElementsKind, LoadKeyedHoleMode); 6526 ElementsKind, LoadKeyedHoleMode);
6527 DECLARE_INSTRUCTION_FACTORY_P6(HLoadKeyed, HValue*, HValue*, HValue*, 6527 DECLARE_INSTRUCTION_FACTORY_P6(HLoadKeyed, HValue*, HValue*, HValue*,
6528 ElementsKind, LoadKeyedHoleMode, int); 6528 ElementsKind, LoadKeyedHoleMode, int);
6529 6529
6530 bool is_external() const { 6530 bool is_external() const {
(...skipping 13 matching lines...) Expand all
6544 } 6544 }
6545 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } 6545 bool HasDependency() const { return OperandAt(0) != OperandAt(2); }
6546 uint32_t base_offset() const { return BaseOffsetField::decode(bit_field_); } 6546 uint32_t base_offset() const { return BaseOffsetField::decode(bit_field_); }
6547 bool TryIncreaseBaseOffset(uint32_t increase_by_value); 6547 bool TryIncreaseBaseOffset(uint32_t increase_by_value);
6548 HValue* GetKey() { return key(); } 6548 HValue* GetKey() { return key(); }
6549 void SetKey(HValue* key) { SetOperandAt(1, key); } 6549 void SetKey(HValue* key) { SetOperandAt(1, key); }
6550 bool IsDehoisted() const { return IsDehoistedField::decode(bit_field_); } 6550 bool IsDehoisted() const { return IsDehoistedField::decode(bit_field_); }
6551 void SetDehoisted(bool is_dehoisted) { 6551 void SetDehoisted(bool is_dehoisted) {
6552 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); 6552 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted);
6553 } 6553 }
6554 virtual ElementsKind elements_kind() const V8_OVERRIDE { 6554 virtual ElementsKind elements_kind() const OVERRIDE {
6555 return ElementsKindField::decode(bit_field_); 6555 return ElementsKindField::decode(bit_field_);
6556 } 6556 }
6557 LoadKeyedHoleMode hole_mode() const { 6557 LoadKeyedHoleMode hole_mode() const {
6558 return HoleModeField::decode(bit_field_); 6558 return HoleModeField::decode(bit_field_);
6559 } 6559 }
6560 6560
6561 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6561 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
6562 // kind_fast: tagged[int32] (none) 6562 // kind_fast: tagged[int32] (none)
6563 // kind_double: tagged[int32] (none) 6563 // kind_double: tagged[int32] (none)
6564 // kind_fixed_typed_array: tagged[int32] (none) 6564 // kind_fixed_typed_array: tagged[int32] (none)
6565 // kind_external: external[int32] (none) 6565 // kind_external: external[int32] (none)
6566 if (index == 0) { 6566 if (index == 0) {
6567 return is_external() ? Representation::External() 6567 return is_external() ? Representation::External()
6568 : Representation::Tagged(); 6568 : Representation::Tagged();
6569 } 6569 }
6570 if (index == 1) { 6570 if (index == 1) {
6571 return ArrayInstructionInterface::KeyedAccessIndexRequirement( 6571 return ArrayInstructionInterface::KeyedAccessIndexRequirement(
6572 OperandAt(1)->representation()); 6572 OperandAt(1)->representation());
6573 } 6573 }
6574 return Representation::None(); 6574 return Representation::None();
6575 } 6575 }
6576 6576
6577 virtual Representation observed_input_representation(int index) V8_OVERRIDE { 6577 virtual Representation observed_input_representation(int index) OVERRIDE {
6578 return RequiredInputRepresentation(index); 6578 return RequiredInputRepresentation(index);
6579 } 6579 }
6580 6580
6581 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 6581 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
6582 6582
6583 bool UsesMustHandleHole() const; 6583 bool UsesMustHandleHole() const;
6584 bool AllUsesCanTreatHoleAsNaN() const; 6584 bool AllUsesCanTreatHoleAsNaN() const;
6585 bool RequiresHoleCheck() const; 6585 bool RequiresHoleCheck() const;
6586 6586
6587 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 6587 virtual Range* InferRange(Zone* zone) OVERRIDE;
6588 6588
6589 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed) 6589 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed)
6590 6590
6591 protected: 6591 protected:
6592 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 6592 virtual bool DataEquals(HValue* other) OVERRIDE {
6593 if (!other->IsLoadKeyed()) return false; 6593 if (!other->IsLoadKeyed()) return false;
6594 HLoadKeyed* other_load = HLoadKeyed::cast(other); 6594 HLoadKeyed* other_load = HLoadKeyed::cast(other);
6595 6595
6596 if (IsDehoisted() && base_offset() != other_load->base_offset()) 6596 if (IsDehoisted() && base_offset() != other_load->base_offset())
6597 return false; 6597 return false;
6598 return elements_kind() == other_load->elements_kind(); 6598 return elements_kind() == other_load->elements_kind();
6599 } 6599 }
6600 6600
6601 private: 6601 private:
6602 HLoadKeyed(HValue* obj, 6602 HLoadKeyed(HValue* obj,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
6659 } else { 6659 } else {
6660 UNREACHABLE(); 6660 UNREACHABLE();
6661 } 6661 }
6662 // Native code could change the specialized array. 6662 // Native code could change the specialized array.
6663 SetDependsOnFlag(kCalls); 6663 SetDependsOnFlag(kCalls);
6664 } 6664 }
6665 6665
6666 SetFlag(kUseGVN); 6666 SetFlag(kUseGVN);
6667 } 6667 }
6668 6668
6669 virtual bool IsDeletable() const V8_OVERRIDE { 6669 virtual bool IsDeletable() const OVERRIDE {
6670 return !RequiresHoleCheck(); 6670 return !RequiresHoleCheck();
6671 } 6671 }
6672 6672
6673 // Establish some checks around our packed fields 6673 // Establish some checks around our packed fields
6674 enum LoadKeyedBits { 6674 enum LoadKeyedBits {
6675 kBitsForElementsKind = 5, 6675 kBitsForElementsKind = 5,
6676 kBitsForHoleMode = 1, 6676 kBitsForHoleMode = 1,
6677 kBitsForBaseOffset = 25, 6677 kBitsForBaseOffset = 25,
6678 kBitsForIsDehoisted = 1, 6678 kBitsForIsDehoisted = 1,
6679 6679
(...skipping 15 matching lines...) Expand all
6695 class BaseOffsetField: 6695 class BaseOffsetField:
6696 public BitField<uint32_t, kStartBaseOffset, kBitsForBaseOffset> 6696 public BitField<uint32_t, kStartBaseOffset, kBitsForBaseOffset>
6697 {}; // NOLINT 6697 {}; // NOLINT
6698 class IsDehoistedField: 6698 class IsDehoistedField:
6699 public BitField<bool, kStartIsDehoisted, kBitsForIsDehoisted> 6699 public BitField<bool, kStartIsDehoisted, kBitsForIsDehoisted>
6700 {}; // NOLINT 6700 {}; // NOLINT
6701 uint32_t bit_field_; 6701 uint32_t bit_field_;
6702 }; 6702 };
6703 6703
6704 6704
6705 class HLoadKeyedGeneric V8_FINAL : public HTemplateInstruction<3> { 6705 class HLoadKeyedGeneric FINAL : public HTemplateInstruction<3> {
6706 public: 6706 public:
6707 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadKeyedGeneric, HValue*, 6707 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadKeyedGeneric, HValue*,
6708 HValue*); 6708 HValue*);
6709 HValue* object() const { return OperandAt(0); } 6709 HValue* object() const { return OperandAt(0); }
6710 HValue* key() const { return OperandAt(1); } 6710 HValue* key() const { return OperandAt(1); }
6711 HValue* context() const { return OperandAt(2); } 6711 HValue* context() const { return OperandAt(2); }
6712 int slot() const { 6712 int slot() const {
6713 DCHECK(FLAG_vector_ics && 6713 DCHECK(FLAG_vector_ics &&
6714 slot_ != FeedbackSlotInterface::kInvalidFeedbackSlot); 6714 slot_ != FeedbackSlotInterface::kInvalidFeedbackSlot);
6715 return slot_; 6715 return slot_;
6716 } 6716 }
6717 Handle<FixedArray> feedback_vector() const { return feedback_vector_; } 6717 Handle<FixedArray> feedback_vector() const { return feedback_vector_; }
6718 void SetVectorAndSlot(Handle<FixedArray> vector, int slot) { 6718 void SetVectorAndSlot(Handle<FixedArray> vector, int slot) {
6719 DCHECK(FLAG_vector_ics); 6719 DCHECK(FLAG_vector_ics);
6720 feedback_vector_ = vector; 6720 feedback_vector_ = vector;
6721 slot_ = slot; 6721 slot_ = slot;
6722 } 6722 }
6723 6723
6724 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 6724 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
6725 6725
6726 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6726 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
6727 // tagged[tagged] 6727 // tagged[tagged]
6728 return Representation::Tagged(); 6728 return Representation::Tagged();
6729 } 6729 }
6730 6730
6731 virtual HValue* Canonicalize() V8_OVERRIDE; 6731 virtual HValue* Canonicalize() OVERRIDE;
6732 6732
6733 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) 6733 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric)
6734 6734
6735 private: 6735 private:
6736 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) 6736 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key)
6737 : slot_(FeedbackSlotInterface::kInvalidFeedbackSlot) { 6737 : slot_(FeedbackSlotInterface::kInvalidFeedbackSlot) {
6738 set_representation(Representation::Tagged()); 6738 set_representation(Representation::Tagged());
6739 SetOperandAt(0, obj); 6739 SetOperandAt(0, obj);
6740 SetOperandAt(1, key); 6740 SetOperandAt(1, key);
6741 SetOperandAt(2, context); 6741 SetOperandAt(2, context);
6742 SetAllSideEffects(); 6742 SetAllSideEffects();
6743 } 6743 }
6744 6744
6745 Handle<FixedArray> feedback_vector_; 6745 Handle<FixedArray> feedback_vector_;
6746 int slot_; 6746 int slot_;
6747 }; 6747 };
6748 6748
6749 6749
6750 // Indicates whether the store is a store to an entry that was previously 6750 // Indicates whether the store is a store to an entry that was previously
6751 // initialized or not. 6751 // initialized or not.
6752 enum StoreFieldOrKeyedMode { 6752 enum StoreFieldOrKeyedMode {
6753 // The entry could be either previously initialized or not. 6753 // The entry could be either previously initialized or not.
6754 INITIALIZING_STORE, 6754 INITIALIZING_STORE,
6755 // At the time of this store it is guaranteed that the entry is already 6755 // At the time of this store it is guaranteed that the entry is already
6756 // initialized. 6756 // initialized.
6757 STORE_TO_INITIALIZED_ENTRY 6757 STORE_TO_INITIALIZED_ENTRY
6758 }; 6758 };
6759 6759
6760 6760
6761 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> { 6761 class HStoreNamedField FINAL : public HTemplateInstruction<3> {
6762 public: 6762 public:
6763 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, 6763 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*,
6764 HObjectAccess, HValue*); 6764 HObjectAccess, HValue*);
6765 DECLARE_INSTRUCTION_FACTORY_P4(HStoreNamedField, HValue*, 6765 DECLARE_INSTRUCTION_FACTORY_P4(HStoreNamedField, HValue*,
6766 HObjectAccess, HValue*, StoreFieldOrKeyedMode); 6766 HObjectAccess, HValue*, StoreFieldOrKeyedMode);
6767 6767
6768 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) 6768 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField)
6769 6769
6770 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { 6770 virtual bool HasEscapingOperandAt(int index) OVERRIDE {
6771 return index == 1; 6771 return index == 1;
6772 } 6772 }
6773 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { 6773 virtual bool HasOutOfBoundsAccess(int size) OVERRIDE {
6774 return !access().IsInobject() || access().offset() >= size; 6774 return !access().IsInobject() || access().offset() >= size;
6775 } 6775 }
6776 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6776 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
6777 if (index == 0 && access().IsExternalMemory()) { 6777 if (index == 0 && access().IsExternalMemory()) {
6778 // object must be external in case of external memory access 6778 // object must be external in case of external memory access
6779 return Representation::External(); 6779 return Representation::External();
6780 } else if (index == 1) { 6780 } else if (index == 1) {
6781 if (field_representation().IsInteger8() || 6781 if (field_representation().IsInteger8() ||
6782 field_representation().IsUInteger8() || 6782 field_representation().IsUInteger8() ||
6783 field_representation().IsInteger16() || 6783 field_representation().IsInteger16() ||
6784 field_representation().IsUInteger16() || 6784 field_representation().IsUInteger16() ||
6785 field_representation().IsInteger32()) { 6785 field_representation().IsInteger32()) {
6786 return Representation::Integer32(); 6786 return Representation::Integer32();
6787 } else if (field_representation().IsDouble()) { 6787 } else if (field_representation().IsDouble()) {
6788 return field_representation(); 6788 return field_representation();
6789 } else if (field_representation().IsSmi()) { 6789 } else if (field_representation().IsSmi()) {
6790 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) { 6790 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) {
6791 return Representation::Integer32(); 6791 return Representation::Integer32();
6792 } 6792 }
6793 return field_representation(); 6793 return field_representation();
6794 } else if (field_representation().IsExternal()) { 6794 } else if (field_representation().IsExternal()) {
6795 return Representation::External(); 6795 return Representation::External();
6796 } 6796 }
6797 } 6797 }
6798 return Representation::Tagged(); 6798 return Representation::Tagged();
6799 } 6799 }
6800 virtual bool HandleSideEffectDominator(GVNFlag side_effect, 6800 virtual bool HandleSideEffectDominator(GVNFlag side_effect,
6801 HValue* dominator) V8_OVERRIDE { 6801 HValue* dominator) OVERRIDE {
6802 DCHECK(side_effect == kNewSpacePromotion); 6802 DCHECK(side_effect == kNewSpacePromotion);
6803 if (!FLAG_use_write_barrier_elimination) return false; 6803 if (!FLAG_use_write_barrier_elimination) return false;
6804 dominator_ = dominator; 6804 dominator_ = dominator;
6805 return false; 6805 return false;
6806 } 6806 }
6807 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 6807 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
6808 6808
6809 HValue* object() const { return OperandAt(0); } 6809 HValue* object() const { return OperandAt(0); }
6810 HValue* value() const { return OperandAt(1); } 6810 HValue* value() const { return OperandAt(1); }
6811 HValue* transition() const { return OperandAt(2); } 6811 HValue* transition() const { return OperandAt(2); }
6812 6812
6813 HObjectAccess access() const { return access_; } 6813 HObjectAccess access() const { return access_; }
6814 HValue* dominator() const { return dominator_; } 6814 HValue* dominator() const { return dominator_; }
6815 bool has_transition() const { return has_transition_; } 6815 bool has_transition() const { return has_transition_; }
6816 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } 6816 StoreFieldOrKeyedMode store_mode() const { return store_mode_; }
6817 6817
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
6896 access.SetGVNFlags(this, STORE); 6896 access.SetGVNFlags(this, STORE);
6897 } 6897 }
6898 6898
6899 HObjectAccess access_; 6899 HObjectAccess access_;
6900 HValue* dominator_; 6900 HValue* dominator_;
6901 bool has_transition_ : 1; 6901 bool has_transition_ : 1;
6902 StoreFieldOrKeyedMode store_mode_ : 1; 6902 StoreFieldOrKeyedMode store_mode_ : 1;
6903 }; 6903 };
6904 6904
6905 6905
6906 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { 6906 class HStoreNamedGeneric FINAL : public HTemplateInstruction<3> {
6907 public: 6907 public:
6908 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, 6908 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*,
6909 Handle<String>, HValue*, 6909 Handle<String>, HValue*,
6910 StrictMode); 6910 StrictMode);
6911 HValue* object() const { return OperandAt(0); } 6911 HValue* object() const { return OperandAt(0); }
6912 HValue* value() const { return OperandAt(1); } 6912 HValue* value() const { return OperandAt(1); }
6913 HValue* context() const { return OperandAt(2); } 6913 HValue* context() const { return OperandAt(2); }
6914 Handle<String> name() const { return name_; } 6914 Handle<String> name() const { return name_; }
6915 StrictMode strict_mode() const { return strict_mode_; } 6915 StrictMode strict_mode() const { return strict_mode_; }
6916 6916
6917 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 6917 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
6918 6918
6919 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6919 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
6920 return Representation::Tagged(); 6920 return Representation::Tagged();
6921 } 6921 }
6922 6922
6923 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric) 6923 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric)
6924 6924
6925 private: 6925 private:
6926 HStoreNamedGeneric(HValue* context, 6926 HStoreNamedGeneric(HValue* context,
6927 HValue* object, 6927 HValue* object,
6928 Handle<String> name, 6928 Handle<String> name,
6929 HValue* value, 6929 HValue* value,
6930 StrictMode strict_mode) 6930 StrictMode strict_mode)
6931 : name_(name), 6931 : name_(name),
6932 strict_mode_(strict_mode) { 6932 strict_mode_(strict_mode) {
6933 SetOperandAt(0, object); 6933 SetOperandAt(0, object);
6934 SetOperandAt(1, value); 6934 SetOperandAt(1, value);
6935 SetOperandAt(2, context); 6935 SetOperandAt(2, context);
6936 SetAllSideEffects(); 6936 SetAllSideEffects();
6937 } 6937 }
6938 6938
6939 Handle<String> name_; 6939 Handle<String> name_;
6940 StrictMode strict_mode_; 6940 StrictMode strict_mode_;
6941 }; 6941 };
6942 6942
6943 6943
6944 class HStoreKeyed V8_FINAL 6944 class HStoreKeyed FINAL
6945 : public HTemplateInstruction<3>, public ArrayInstructionInterface { 6945 : public HTemplateInstruction<3>, public ArrayInstructionInterface {
6946 public: 6946 public:
6947 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, 6947 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*,
6948 ElementsKind); 6948 ElementsKind);
6949 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, 6949 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*,
6950 ElementsKind, StoreFieldOrKeyedMode); 6950 ElementsKind, StoreFieldOrKeyedMode);
6951 DECLARE_INSTRUCTION_FACTORY_P6(HStoreKeyed, HValue*, HValue*, HValue*, 6951 DECLARE_INSTRUCTION_FACTORY_P6(HStoreKeyed, HValue*, HValue*, HValue*,
6952 ElementsKind, StoreFieldOrKeyedMode, int); 6952 ElementsKind, StoreFieldOrKeyedMode, int);
6953 6953
6954 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6954 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
6955 // kind_fast: tagged[int32] = tagged 6955 // kind_fast: tagged[int32] = tagged
6956 // kind_double: tagged[int32] = double 6956 // kind_double: tagged[int32] = double
6957 // kind_smi : tagged[int32] = smi 6957 // kind_smi : tagged[int32] = smi
6958 // kind_fixed_typed_array: tagged[int32] = (double | int32) 6958 // kind_fixed_typed_array: tagged[int32] = (double | int32)
6959 // kind_external: external[int32] = (double | int32) 6959 // kind_external: external[int32] = (double | int32)
6960 if (index == 0) { 6960 if (index == 0) {
6961 return is_external() ? Representation::External() 6961 return is_external() ? Representation::External()
6962 : Representation::Tagged(); 6962 : Representation::Tagged();
6963 } else if (index == 1) { 6963 } else if (index == 1) {
6964 return ArrayInstructionInterface::KeyedAccessIndexRequirement( 6964 return ArrayInstructionInterface::KeyedAccessIndexRequirement(
(...skipping 30 matching lines...) Expand all
6995 } 6995 }
6996 6996
6997 bool is_fixed_typed_array() const { 6997 bool is_fixed_typed_array() const {
6998 return IsFixedTypedArrayElementsKind(elements_kind()); 6998 return IsFixedTypedArrayElementsKind(elements_kind());
6999 } 6999 }
7000 7000
7001 bool is_typed_elements() const { 7001 bool is_typed_elements() const {
7002 return is_external() || is_fixed_typed_array(); 7002 return is_external() || is_fixed_typed_array();
7003 } 7003 }
7004 7004
7005 virtual Representation observed_input_representation(int index) V8_OVERRIDE { 7005 virtual Representation observed_input_representation(int index) OVERRIDE {
7006 if (index < 2) return RequiredInputRepresentation(index); 7006 if (index < 2) return RequiredInputRepresentation(index);
7007 if (IsUninitialized()) { 7007 if (IsUninitialized()) {
7008 return Representation::None(); 7008 return Representation::None();
7009 } 7009 }
7010 Representation r = RequiredValueRepresentation(elements_kind_, store_mode_); 7010 Representation r = RequiredValueRepresentation(elements_kind_, store_mode_);
7011 // For fast object elements kinds, don't assume anything. 7011 // For fast object elements kinds, don't assume anything.
7012 if (r.IsTagged()) return Representation::None(); 7012 if (r.IsTagged()) return Representation::None();
7013 return r; 7013 return r;
7014 } 7014 }
7015 7015
(...skipping 14 matching lines...) Expand all
7030 bool IsUninitialized() { return is_uninitialized_; } 7030 bool IsUninitialized() { return is_uninitialized_; }
7031 void SetUninitialized(bool is_uninitialized) { 7031 void SetUninitialized(bool is_uninitialized) {
7032 is_uninitialized_ = is_uninitialized; 7032 is_uninitialized_ = is_uninitialized;
7033 } 7033 }
7034 7034
7035 bool IsConstantHoleStore() { 7035 bool IsConstantHoleStore() {
7036 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); 7036 return value()->IsConstant() && HConstant::cast(value())->IsTheHole();
7037 } 7037 }
7038 7038
7039 virtual bool HandleSideEffectDominator(GVNFlag side_effect, 7039 virtual bool HandleSideEffectDominator(GVNFlag side_effect,
7040 HValue* dominator) V8_OVERRIDE { 7040 HValue* dominator) OVERRIDE {
7041 DCHECK(side_effect == kNewSpacePromotion); 7041 DCHECK(side_effect == kNewSpacePromotion);
7042 dominator_ = dominator; 7042 dominator_ = dominator;
7043 return false; 7043 return false;
7044 } 7044 }
7045 7045
7046 HValue* dominator() const { return dominator_; } 7046 HValue* dominator() const { return dominator_; }
7047 7047
7048 bool NeedsWriteBarrier() { 7048 bool NeedsWriteBarrier() {
7049 if (value_is_smi()) { 7049 if (value_is_smi()) {
7050 return false; 7050 return false;
7051 } else { 7051 } else {
7052 return StoringValueNeedsWriteBarrier(value()) && 7052 return StoringValueNeedsWriteBarrier(value()) &&
7053 ReceiverObjectNeedsWriteBarrier(elements(), value(), dominator()); 7053 ReceiverObjectNeedsWriteBarrier(elements(), value(), dominator());
7054 } 7054 }
7055 } 7055 }
7056 7056
7057 PointersToHereCheck PointersToHereCheckForValue() const { 7057 PointersToHereCheck PointersToHereCheckForValue() const {
7058 return PointersToHereCheckForObject(value(), dominator()); 7058 return PointersToHereCheckForObject(value(), dominator());
7059 } 7059 }
7060 7060
7061 bool NeedsCanonicalization(); 7061 bool NeedsCanonicalization();
7062 7062
7063 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 7063 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
7064 7064
7065 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) 7065 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed)
7066 7066
7067 private: 7067 private:
7068 HStoreKeyed(HValue* obj, HValue* key, HValue* val, 7068 HStoreKeyed(HValue* obj, HValue* key, HValue* val,
7069 ElementsKind elements_kind, 7069 ElementsKind elements_kind,
7070 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE, 7070 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE,
7071 int offset = kDefaultKeyedHeaderOffsetSentinel) 7071 int offset = kDefaultKeyedHeaderOffsetSentinel)
7072 : elements_kind_(elements_kind), 7072 : elements_kind_(elements_kind),
7073 base_offset_(offset == kDefaultKeyedHeaderOffsetSentinel 7073 base_offset_(offset == kDefaultKeyedHeaderOffsetSentinel
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
7110 7110
7111 ElementsKind elements_kind_; 7111 ElementsKind elements_kind_;
7112 uint32_t base_offset_; 7112 uint32_t base_offset_;
7113 bool is_dehoisted_ : 1; 7113 bool is_dehoisted_ : 1;
7114 bool is_uninitialized_ : 1; 7114 bool is_uninitialized_ : 1;
7115 StoreFieldOrKeyedMode store_mode_: 1; 7115 StoreFieldOrKeyedMode store_mode_: 1;
7116 HValue* dominator_; 7116 HValue* dominator_;
7117 }; 7117 };
7118 7118
7119 7119
7120 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { 7120 class HStoreKeyedGeneric FINAL : public HTemplateInstruction<4> {
7121 public: 7121 public:
7122 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, 7122 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*,
7123 HValue*, HValue*, StrictMode); 7123 HValue*, HValue*, StrictMode);
7124 7124
7125 HValue* object() const { return OperandAt(0); } 7125 HValue* object() const { return OperandAt(0); }
7126 HValue* key() const { return OperandAt(1); } 7126 HValue* key() const { return OperandAt(1); }
7127 HValue* value() const { return OperandAt(2); } 7127 HValue* value() const { return OperandAt(2); }
7128 HValue* context() const { return OperandAt(3); } 7128 HValue* context() const { return OperandAt(3); }
7129 StrictMode strict_mode() const { return strict_mode_; } 7129 StrictMode strict_mode() const { return strict_mode_; }
7130 7130
7131 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7131 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
7132 // tagged[tagged] = tagged 7132 // tagged[tagged] = tagged
7133 return Representation::Tagged(); 7133 return Representation::Tagged();
7134 } 7134 }
7135 7135
7136 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 7136 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
7137 7137
7138 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) 7138 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric)
7139 7139
7140 private: 7140 private:
7141 HStoreKeyedGeneric(HValue* context, 7141 HStoreKeyedGeneric(HValue* context,
7142 HValue* object, 7142 HValue* object,
7143 HValue* key, 7143 HValue* key,
7144 HValue* value, 7144 HValue* value,
7145 StrictMode strict_mode) 7145 StrictMode strict_mode)
7146 : strict_mode_(strict_mode) { 7146 : strict_mode_(strict_mode) {
7147 SetOperandAt(0, object); 7147 SetOperandAt(0, object);
7148 SetOperandAt(1, key); 7148 SetOperandAt(1, key);
7149 SetOperandAt(2, value); 7149 SetOperandAt(2, value);
7150 SetOperandAt(3, context); 7150 SetOperandAt(3, context);
7151 SetAllSideEffects(); 7151 SetAllSideEffects();
7152 } 7152 }
7153 7153
7154 StrictMode strict_mode_; 7154 StrictMode strict_mode_;
7155 }; 7155 };
7156 7156
7157 7157
7158 class HTransitionElementsKind V8_FINAL : public HTemplateInstruction<2> { 7158 class HTransitionElementsKind FINAL : public HTemplateInstruction<2> {
7159 public: 7159 public:
7160 inline static HTransitionElementsKind* New(Zone* zone, 7160 inline static HTransitionElementsKind* New(Zone* zone,
7161 HValue* context, 7161 HValue* context,
7162 HValue* object, 7162 HValue* object,
7163 Handle<Map> original_map, 7163 Handle<Map> original_map,
7164 Handle<Map> transitioned_map) { 7164 Handle<Map> transitioned_map) {
7165 return new(zone) HTransitionElementsKind(context, object, 7165 return new(zone) HTransitionElementsKind(context, object,
7166 original_map, transitioned_map); 7166 original_map, transitioned_map);
7167 } 7167 }
7168 7168
7169 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7169 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
7170 return Representation::Tagged(); 7170 return Representation::Tagged();
7171 } 7171 }
7172 7172
7173 HValue* object() const { return OperandAt(0); } 7173 HValue* object() const { return OperandAt(0); }
7174 HValue* context() const { return OperandAt(1); } 7174 HValue* context() const { return OperandAt(1); }
7175 Unique<Map> original_map() const { return original_map_; } 7175 Unique<Map> original_map() const { return original_map_; }
7176 Unique<Map> transitioned_map() const { return transitioned_map_; } 7176 Unique<Map> transitioned_map() const { return transitioned_map_; }
7177 ElementsKind from_kind() const { return from_kind_; } 7177 ElementsKind from_kind() const { return from_kind_; }
7178 ElementsKind to_kind() const { return to_kind_; } 7178 ElementsKind to_kind() const { return to_kind_; }
7179 7179
7180 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 7180 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
7181 7181
7182 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) 7182 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind)
7183 7183
7184 protected: 7184 protected:
7185 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 7185 virtual bool DataEquals(HValue* other) OVERRIDE {
7186 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); 7186 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other);
7187 return original_map_ == instr->original_map_ && 7187 return original_map_ == instr->original_map_ &&
7188 transitioned_map_ == instr->transitioned_map_; 7188 transitioned_map_ == instr->transitioned_map_;
7189 } 7189 }
7190 7190
7191 virtual int RedefinedOperandIndex() { return 0; } 7191 virtual int RedefinedOperandIndex() { return 0; }
7192 7192
7193 private: 7193 private:
7194 HTransitionElementsKind(HValue* context, 7194 HTransitionElementsKind(HValue* context,
7195 HValue* object, 7195 HValue* object,
(...skipping 14 matching lines...) Expand all
7210 set_representation(Representation::Tagged()); 7210 set_representation(Representation::Tagged());
7211 } 7211 }
7212 7212
7213 Unique<Map> original_map_; 7213 Unique<Map> original_map_;
7214 Unique<Map> transitioned_map_; 7214 Unique<Map> transitioned_map_;
7215 ElementsKind from_kind_; 7215 ElementsKind from_kind_;
7216 ElementsKind to_kind_; 7216 ElementsKind to_kind_;
7217 }; 7217 };
7218 7218
7219 7219
7220 class HStringAdd V8_FINAL : public HBinaryOperation { 7220 class HStringAdd FINAL : public HBinaryOperation {
7221 public: 7221 public:
7222 static HInstruction* New(Zone* zone, 7222 static HInstruction* New(Zone* zone,
7223 HValue* context, 7223 HValue* context,
7224 HValue* left, 7224 HValue* left,
7225 HValue* right, 7225 HValue* right,
7226 PretenureFlag pretenure_flag = NOT_TENURED, 7226 PretenureFlag pretenure_flag = NOT_TENURED,
7227 StringAddFlags flags = STRING_ADD_CHECK_BOTH, 7227 StringAddFlags flags = STRING_ADD_CHECK_BOTH,
7228 Handle<AllocationSite> allocation_site = 7228 Handle<AllocationSite> allocation_site =
7229 Handle<AllocationSite>::null()); 7229 Handle<AllocationSite>::null());
7230 7230
7231 StringAddFlags flags() const { return flags_; } 7231 StringAddFlags flags() const { return flags_; }
7232 PretenureFlag pretenure_flag() const { return pretenure_flag_; } 7232 PretenureFlag pretenure_flag() const { return pretenure_flag_; }
7233 7233
7234 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7234 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
7235 return Representation::Tagged(); 7235 return Representation::Tagged();
7236 } 7236 }
7237 7237
7238 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 7238 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
7239 7239
7240 DECLARE_CONCRETE_INSTRUCTION(StringAdd) 7240 DECLARE_CONCRETE_INSTRUCTION(StringAdd)
7241 7241
7242 protected: 7242 protected:
7243 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 7243 virtual bool DataEquals(HValue* other) OVERRIDE {
7244 return flags_ == HStringAdd::cast(other)->flags_ && 7244 return flags_ == HStringAdd::cast(other)->flags_ &&
7245 pretenure_flag_ == HStringAdd::cast(other)->pretenure_flag_; 7245 pretenure_flag_ == HStringAdd::cast(other)->pretenure_flag_;
7246 } 7246 }
7247 7247
7248 private: 7248 private:
7249 HStringAdd(HValue* context, 7249 HStringAdd(HValue* context,
7250 HValue* left, 7250 HValue* left,
7251 HValue* right, 7251 HValue* right,
7252 PretenureFlag pretenure_flag, 7252 PretenureFlag pretenure_flag,
7253 StringAddFlags flags, 7253 StringAddFlags flags,
7254 Handle<AllocationSite> allocation_site) 7254 Handle<AllocationSite> allocation_site)
7255 : HBinaryOperation(context, left, right, HType::String()), 7255 : HBinaryOperation(context, left, right, HType::String()),
7256 flags_(flags), pretenure_flag_(pretenure_flag) { 7256 flags_(flags), pretenure_flag_(pretenure_flag) {
7257 set_representation(Representation::Tagged()); 7257 set_representation(Representation::Tagged());
7258 SetFlag(kUseGVN); 7258 SetFlag(kUseGVN);
7259 SetDependsOnFlag(kMaps); 7259 SetDependsOnFlag(kMaps);
7260 SetChangesFlag(kNewSpacePromotion); 7260 SetChangesFlag(kNewSpacePromotion);
7261 if (FLAG_trace_pretenuring) { 7261 if (FLAG_trace_pretenuring) {
7262 PrintF("HStringAdd with AllocationSite %p %s\n", 7262 PrintF("HStringAdd with AllocationSite %p %s\n",
7263 allocation_site.is_null() 7263 allocation_site.is_null()
7264 ? static_cast<void*>(NULL) 7264 ? static_cast<void*>(NULL)
7265 : static_cast<void*>(*allocation_site), 7265 : static_cast<void*>(*allocation_site),
7266 pretenure_flag == TENURED ? "tenured" : "not tenured"); 7266 pretenure_flag == TENURED ? "tenured" : "not tenured");
7267 } 7267 }
7268 } 7268 }
7269 7269
7270 // No side-effects except possible allocation: 7270 // No side-effects except possible allocation:
7271 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7271 virtual bool IsDeletable() const OVERRIDE { return true; }
7272 7272
7273 const StringAddFlags flags_; 7273 const StringAddFlags flags_;
7274 const PretenureFlag pretenure_flag_; 7274 const PretenureFlag pretenure_flag_;
7275 }; 7275 };
7276 7276
7277 7277
7278 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> { 7278 class HStringCharCodeAt FINAL : public HTemplateInstruction<3> {
7279 public: 7279 public:
7280 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt, 7280 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt,
7281 HValue*, 7281 HValue*,
7282 HValue*); 7282 HValue*);
7283 7283
7284 virtual Representation RequiredInputRepresentation(int index) { 7284 virtual Representation RequiredInputRepresentation(int index) {
7285 // The index is supposed to be Integer32. 7285 // The index is supposed to be Integer32.
7286 return index == 2 7286 return index == 2
7287 ? Representation::Integer32() 7287 ? Representation::Integer32()
7288 : Representation::Tagged(); 7288 : Representation::Tagged();
7289 } 7289 }
7290 7290
7291 HValue* context() const { return OperandAt(0); } 7291 HValue* context() const { return OperandAt(0); }
7292 HValue* string() const { return OperandAt(1); } 7292 HValue* string() const { return OperandAt(1); }
7293 HValue* index() const { return OperandAt(2); } 7293 HValue* index() const { return OperandAt(2); }
7294 7294
7295 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) 7295 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt)
7296 7296
7297 protected: 7297 protected:
7298 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 7298 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
7299 7299
7300 virtual Range* InferRange(Zone* zone) V8_OVERRIDE { 7300 virtual Range* InferRange(Zone* zone) OVERRIDE {
7301 return new(zone) Range(0, String::kMaxUtf16CodeUnit); 7301 return new(zone) Range(0, String::kMaxUtf16CodeUnit);
7302 } 7302 }
7303 7303
7304 private: 7304 private:
7305 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { 7305 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) {
7306 SetOperandAt(0, context); 7306 SetOperandAt(0, context);
7307 SetOperandAt(1, string); 7307 SetOperandAt(1, string);
7308 SetOperandAt(2, index); 7308 SetOperandAt(2, index);
7309 set_representation(Representation::Integer32()); 7309 set_representation(Representation::Integer32());
7310 SetFlag(kUseGVN); 7310 SetFlag(kUseGVN);
7311 SetDependsOnFlag(kMaps); 7311 SetDependsOnFlag(kMaps);
7312 SetDependsOnFlag(kStringChars); 7312 SetDependsOnFlag(kStringChars);
7313 SetChangesFlag(kNewSpacePromotion); 7313 SetChangesFlag(kNewSpacePromotion);
7314 } 7314 }
7315 7315
7316 // No side effects: runtime function assumes string + number inputs. 7316 // No side effects: runtime function assumes string + number inputs.
7317 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7317 virtual bool IsDeletable() const OVERRIDE { return true; }
7318 }; 7318 };
7319 7319
7320 7320
7321 class HStringCharFromCode V8_FINAL : public HTemplateInstruction<2> { 7321 class HStringCharFromCode FINAL : public HTemplateInstruction<2> {
7322 public: 7322 public:
7323 static HInstruction* New(Zone* zone, 7323 static HInstruction* New(Zone* zone,
7324 HValue* context, 7324 HValue* context,
7325 HValue* char_code); 7325 HValue* char_code);
7326 7326
7327 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7327 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
7328 return index == 0 7328 return index == 0
7329 ? Representation::Tagged() 7329 ? Representation::Tagged()
7330 : Representation::Integer32(); 7330 : Representation::Integer32();
7331 } 7331 }
7332 7332
7333 HValue* context() const { return OperandAt(0); } 7333 HValue* context() const { return OperandAt(0); }
7334 HValue* value() const { return OperandAt(1); } 7334 HValue* value() const { return OperandAt(1); }
7335 7335
7336 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 7336 virtual bool DataEquals(HValue* other) OVERRIDE { return true; }
7337 7337
7338 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) 7338 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode)
7339 7339
7340 private: 7340 private:
7341 HStringCharFromCode(HValue* context, HValue* char_code) 7341 HStringCharFromCode(HValue* context, HValue* char_code)
7342 : HTemplateInstruction<2>(HType::String()) { 7342 : HTemplateInstruction<2>(HType::String()) {
7343 SetOperandAt(0, context); 7343 SetOperandAt(0, context);
7344 SetOperandAt(1, char_code); 7344 SetOperandAt(1, char_code);
7345 set_representation(Representation::Tagged()); 7345 set_representation(Representation::Tagged());
7346 SetFlag(kUseGVN); 7346 SetFlag(kUseGVN);
7347 SetChangesFlag(kNewSpacePromotion); 7347 SetChangesFlag(kNewSpacePromotion);
7348 } 7348 }
7349 7349
7350 virtual bool IsDeletable() const V8_OVERRIDE { 7350 virtual bool IsDeletable() const OVERRIDE {
7351 return !value()->ToNumberCanBeObserved(); 7351 return !value()->ToNumberCanBeObserved();
7352 } 7352 }
7353 }; 7353 };
7354 7354
7355 7355
7356 template <int V> 7356 template <int V>
7357 class HMaterializedLiteral : public HTemplateInstruction<V> { 7357 class HMaterializedLiteral : public HTemplateInstruction<V> {
7358 public: 7358 public:
7359 HMaterializedLiteral<V>(int index, int depth, AllocationSiteMode mode) 7359 HMaterializedLiteral<V>(int index, int depth, AllocationSiteMode mode)
7360 : literal_index_(index), depth_(depth), allocation_site_mode_(mode) { 7360 : literal_index_(index), depth_(depth), allocation_site_mode_(mode) {
7361 this->set_representation(Representation::Tagged()); 7361 this->set_representation(Representation::Tagged());
7362 } 7362 }
7363 7363
7364 HMaterializedLiteral<V>(int index, int depth) 7364 HMaterializedLiteral<V>(int index, int depth)
7365 : literal_index_(index), depth_(depth), 7365 : literal_index_(index), depth_(depth),
7366 allocation_site_mode_(DONT_TRACK_ALLOCATION_SITE) { 7366 allocation_site_mode_(DONT_TRACK_ALLOCATION_SITE) {
7367 this->set_representation(Representation::Tagged()); 7367 this->set_representation(Representation::Tagged());
7368 } 7368 }
7369 7369
7370 int literal_index() const { return literal_index_; } 7370 int literal_index() const { return literal_index_; }
7371 int depth() const { return depth_; } 7371 int depth() const { return depth_; }
7372 AllocationSiteMode allocation_site_mode() const { 7372 AllocationSiteMode allocation_site_mode() const {
7373 return allocation_site_mode_; 7373 return allocation_site_mode_;
7374 } 7374 }
7375 7375
7376 private: 7376 private:
7377 virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return true; } 7377 virtual bool IsDeletable() const FINAL OVERRIDE { return true; }
7378 7378
7379 int literal_index_; 7379 int literal_index_;
7380 int depth_; 7380 int depth_;
7381 AllocationSiteMode allocation_site_mode_; 7381 AllocationSiteMode allocation_site_mode_;
7382 }; 7382 };
7383 7383
7384 7384
7385 class HRegExpLiteral V8_FINAL : public HMaterializedLiteral<1> { 7385 class HRegExpLiteral FINAL : public HMaterializedLiteral<1> {
7386 public: 7386 public:
7387 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HRegExpLiteral, 7387 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HRegExpLiteral,
7388 Handle<FixedArray>, 7388 Handle<FixedArray>,
7389 Handle<String>, 7389 Handle<String>,
7390 Handle<String>, 7390 Handle<String>,
7391 int); 7391 int);
7392 7392
7393 HValue* context() { return OperandAt(0); } 7393 HValue* context() { return OperandAt(0); }
7394 Handle<FixedArray> literals() { return literals_; } 7394 Handle<FixedArray> literals() { return literals_; }
7395 Handle<String> pattern() { return pattern_; } 7395 Handle<String> pattern() { return pattern_; }
7396 Handle<String> flags() { return flags_; } 7396 Handle<String> flags() { return flags_; }
7397 7397
7398 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7398 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
7399 return Representation::Tagged(); 7399 return Representation::Tagged();
7400 } 7400 }
7401 7401
7402 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) 7402 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral)
7403 7403
7404 private: 7404 private:
7405 HRegExpLiteral(HValue* context, 7405 HRegExpLiteral(HValue* context,
7406 Handle<FixedArray> literals, 7406 Handle<FixedArray> literals,
7407 Handle<String> pattern, 7407 Handle<String> pattern,
7408 Handle<String> flags, 7408 Handle<String> flags,
7409 int literal_index) 7409 int literal_index)
7410 : HMaterializedLiteral<1>(literal_index, 0), 7410 : HMaterializedLiteral<1>(literal_index, 0),
7411 literals_(literals), 7411 literals_(literals),
7412 pattern_(pattern), 7412 pattern_(pattern),
7413 flags_(flags) { 7413 flags_(flags) {
7414 SetOperandAt(0, context); 7414 SetOperandAt(0, context);
7415 SetAllSideEffects(); 7415 SetAllSideEffects();
7416 set_type(HType::JSObject()); 7416 set_type(HType::JSObject());
7417 } 7417 }
7418 7418
7419 Handle<FixedArray> literals_; 7419 Handle<FixedArray> literals_;
7420 Handle<String> pattern_; 7420 Handle<String> pattern_;
7421 Handle<String> flags_; 7421 Handle<String> flags_;
7422 }; 7422 };
7423 7423
7424 7424
7425 class HFunctionLiteral V8_FINAL : public HTemplateInstruction<1> { 7425 class HFunctionLiteral FINAL : public HTemplateInstruction<1> {
7426 public: 7426 public:
7427 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HFunctionLiteral, 7427 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HFunctionLiteral,
7428 Handle<SharedFunctionInfo>, 7428 Handle<SharedFunctionInfo>,
7429 bool); 7429 bool);
7430 HValue* context() { return OperandAt(0); } 7430 HValue* context() { return OperandAt(0); }
7431 7431
7432 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7432 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
7433 return Representation::Tagged(); 7433 return Representation::Tagged();
7434 } 7434 }
7435 7435
7436 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) 7436 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral)
7437 7437
7438 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } 7438 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
7439 bool pretenure() const { return pretenure_; } 7439 bool pretenure() const { return pretenure_; }
7440 bool has_no_literals() const { return has_no_literals_; } 7440 bool has_no_literals() const { return has_no_literals_; }
7441 bool is_generator() const { return is_generator_; } 7441 bool is_generator() const { return is_generator_; }
7442 StrictMode strict_mode() const { return strict_mode_; } 7442 StrictMode strict_mode() const { return strict_mode_; }
7443 7443
7444 private: 7444 private:
7445 HFunctionLiteral(HValue* context, 7445 HFunctionLiteral(HValue* context,
7446 Handle<SharedFunctionInfo> shared, 7446 Handle<SharedFunctionInfo> shared,
7447 bool pretenure) 7447 bool pretenure)
7448 : HTemplateInstruction<1>(HType::JSObject()), 7448 : HTemplateInstruction<1>(HType::JSObject()),
7449 shared_info_(shared), 7449 shared_info_(shared),
7450 pretenure_(pretenure), 7450 pretenure_(pretenure),
7451 has_no_literals_(shared->num_literals() == 0), 7451 has_no_literals_(shared->num_literals() == 0),
7452 is_generator_(shared->is_generator()), 7452 is_generator_(shared->is_generator()),
7453 strict_mode_(shared->strict_mode()) { 7453 strict_mode_(shared->strict_mode()) {
7454 SetOperandAt(0, context); 7454 SetOperandAt(0, context);
7455 set_representation(Representation::Tagged()); 7455 set_representation(Representation::Tagged());
7456 SetChangesFlag(kNewSpacePromotion); 7456 SetChangesFlag(kNewSpacePromotion);
7457 } 7457 }
7458 7458
7459 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7459 virtual bool IsDeletable() const OVERRIDE { return true; }
7460 7460
7461 Handle<SharedFunctionInfo> shared_info_; 7461 Handle<SharedFunctionInfo> shared_info_;
7462 bool pretenure_ : 1; 7462 bool pretenure_ : 1;
7463 bool has_no_literals_ : 1; 7463 bool has_no_literals_ : 1;
7464 bool is_generator_ : 1; 7464 bool is_generator_ : 1;
7465 StrictMode strict_mode_; 7465 StrictMode strict_mode_;
7466 }; 7466 };
7467 7467
7468 7468
7469 class HTypeof V8_FINAL : public HTemplateInstruction<2> { 7469 class HTypeof FINAL : public HTemplateInstruction<2> {
7470 public: 7470 public:
7471 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HTypeof, HValue*); 7471 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HTypeof, HValue*);
7472 7472
7473 HValue* context() const { return OperandAt(0); } 7473 HValue* context() const { return OperandAt(0); }
7474 HValue* value() const { return OperandAt(1); } 7474 HValue* value() const { return OperandAt(1); }
7475 7475
7476 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 7476 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
7477 7477
7478 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7478 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
7479 return Representation::Tagged(); 7479 return Representation::Tagged();
7480 } 7480 }
7481 7481
7482 DECLARE_CONCRETE_INSTRUCTION(Typeof) 7482 DECLARE_CONCRETE_INSTRUCTION(Typeof)
7483 7483
7484 private: 7484 private:
7485 explicit HTypeof(HValue* context, HValue* value) { 7485 explicit HTypeof(HValue* context, HValue* value) {
7486 SetOperandAt(0, context); 7486 SetOperandAt(0, context);
7487 SetOperandAt(1, value); 7487 SetOperandAt(1, value);
7488 set_representation(Representation::Tagged()); 7488 set_representation(Representation::Tagged());
7489 } 7489 }
7490 7490
7491 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7491 virtual bool IsDeletable() const OVERRIDE { return true; }
7492 }; 7492 };
7493 7493
7494 7494
7495 class HTrapAllocationMemento V8_FINAL : public HTemplateInstruction<1> { 7495 class HTrapAllocationMemento FINAL : public HTemplateInstruction<1> {
7496 public: 7496 public:
7497 DECLARE_INSTRUCTION_FACTORY_P1(HTrapAllocationMemento, HValue*); 7497 DECLARE_INSTRUCTION_FACTORY_P1(HTrapAllocationMemento, HValue*);
7498 7498
7499 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7499 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
7500 return Representation::Tagged(); 7500 return Representation::Tagged();
7501 } 7501 }
7502 7502
7503 HValue* object() { return OperandAt(0); } 7503 HValue* object() { return OperandAt(0); }
7504 7504
7505 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento) 7505 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento)
7506 7506
7507 private: 7507 private:
7508 explicit HTrapAllocationMemento(HValue* obj) { 7508 explicit HTrapAllocationMemento(HValue* obj) {
7509 SetOperandAt(0, obj); 7509 SetOperandAt(0, obj);
7510 } 7510 }
7511 }; 7511 };
7512 7512
7513 7513
7514 class HToFastProperties V8_FINAL : public HUnaryOperation { 7514 class HToFastProperties FINAL : public HUnaryOperation {
7515 public: 7515 public:
7516 DECLARE_INSTRUCTION_FACTORY_P1(HToFastProperties, HValue*); 7516 DECLARE_INSTRUCTION_FACTORY_P1(HToFastProperties, HValue*);
7517 7517
7518 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7518 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
7519 return Representation::Tagged(); 7519 return Representation::Tagged();
7520 } 7520 }
7521 7521
7522 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) 7522 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties)
7523 7523
7524 private: 7524 private:
7525 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { 7525 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) {
7526 set_representation(Representation::Tagged()); 7526 set_representation(Representation::Tagged());
7527 SetChangesFlag(kNewSpacePromotion); 7527 SetChangesFlag(kNewSpacePromotion);
7528 7528
7529 // This instruction is not marked as kChangesMaps, but does 7529 // This instruction is not marked as kChangesMaps, but does
7530 // change the map of the input operand. Use it only when creating 7530 // change the map of the input operand. Use it only when creating
7531 // object literals via a runtime call. 7531 // object literals via a runtime call.
7532 DCHECK(value->IsCallRuntime()); 7532 DCHECK(value->IsCallRuntime());
7533 #ifdef DEBUG 7533 #ifdef DEBUG
7534 const Runtime::Function* function = HCallRuntime::cast(value)->function(); 7534 const Runtime::Function* function = HCallRuntime::cast(value)->function();
7535 DCHECK(function->function_id == Runtime::kCreateObjectLiteral); 7535 DCHECK(function->function_id == Runtime::kCreateObjectLiteral);
7536 #endif 7536 #endif
7537 } 7537 }
7538 7538
7539 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7539 virtual bool IsDeletable() const OVERRIDE { return true; }
7540 }; 7540 };
7541 7541
7542 7542
7543 class HDateField V8_FINAL : public HUnaryOperation { 7543 class HDateField FINAL : public HUnaryOperation {
7544 public: 7544 public:
7545 DECLARE_INSTRUCTION_FACTORY_P2(HDateField, HValue*, Smi*); 7545 DECLARE_INSTRUCTION_FACTORY_P2(HDateField, HValue*, Smi*);
7546 7546
7547 Smi* index() const { return index_; } 7547 Smi* index() const { return index_; }
7548 7548
7549 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7549 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
7550 return Representation::Tagged(); 7550 return Representation::Tagged();
7551 } 7551 }
7552 7552
7553 DECLARE_CONCRETE_INSTRUCTION(DateField) 7553 DECLARE_CONCRETE_INSTRUCTION(DateField)
7554 7554
7555 private: 7555 private:
7556 HDateField(HValue* date, Smi* index) 7556 HDateField(HValue* date, Smi* index)
7557 : HUnaryOperation(date), index_(index) { 7557 : HUnaryOperation(date), index_(index) {
7558 set_representation(Representation::Tagged()); 7558 set_representation(Representation::Tagged());
7559 } 7559 }
7560 7560
7561 Smi* index_; 7561 Smi* index_;
7562 }; 7562 };
7563 7563
7564 7564
7565 class HSeqStringGetChar V8_FINAL : public HTemplateInstruction<2> { 7565 class HSeqStringGetChar FINAL : public HTemplateInstruction<2> {
7566 public: 7566 public:
7567 static HInstruction* New(Zone* zone, 7567 static HInstruction* New(Zone* zone,
7568 HValue* context, 7568 HValue* context,
7569 String::Encoding encoding, 7569 String::Encoding encoding,
7570 HValue* string, 7570 HValue* string,
7571 HValue* index); 7571 HValue* index);
7572 7572
7573 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7573 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
7574 return (index == 0) ? Representation::Tagged() 7574 return (index == 0) ? Representation::Tagged()
7575 : Representation::Integer32(); 7575 : Representation::Integer32();
7576 } 7576 }
7577 7577
7578 String::Encoding encoding() const { return encoding_; } 7578 String::Encoding encoding() const { return encoding_; }
7579 HValue* string() const { return OperandAt(0); } 7579 HValue* string() const { return OperandAt(0); }
7580 HValue* index() const { return OperandAt(1); } 7580 HValue* index() const { return OperandAt(1); }
7581 7581
7582 DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar) 7582 DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar)
7583 7583
7584 protected: 7584 protected:
7585 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 7585 virtual bool DataEquals(HValue* other) OVERRIDE {
7586 return encoding() == HSeqStringGetChar::cast(other)->encoding(); 7586 return encoding() == HSeqStringGetChar::cast(other)->encoding();
7587 } 7587 }
7588 7588
7589 virtual Range* InferRange(Zone* zone) V8_OVERRIDE { 7589 virtual Range* InferRange(Zone* zone) OVERRIDE {
7590 if (encoding() == String::ONE_BYTE_ENCODING) { 7590 if (encoding() == String::ONE_BYTE_ENCODING) {
7591 return new(zone) Range(0, String::kMaxOneByteCharCode); 7591 return new(zone) Range(0, String::kMaxOneByteCharCode);
7592 } else { 7592 } else {
7593 DCHECK_EQ(String::TWO_BYTE_ENCODING, encoding()); 7593 DCHECK_EQ(String::TWO_BYTE_ENCODING, encoding());
7594 return new(zone) Range(0, String::kMaxUtf16CodeUnit); 7594 return new(zone) Range(0, String::kMaxUtf16CodeUnit);
7595 } 7595 }
7596 } 7596 }
7597 7597
7598 private: 7598 private:
7599 HSeqStringGetChar(String::Encoding encoding, 7599 HSeqStringGetChar(String::Encoding encoding,
7600 HValue* string, 7600 HValue* string,
7601 HValue* index) : encoding_(encoding) { 7601 HValue* index) : encoding_(encoding) {
7602 SetOperandAt(0, string); 7602 SetOperandAt(0, string);
7603 SetOperandAt(1, index); 7603 SetOperandAt(1, index);
7604 set_representation(Representation::Integer32()); 7604 set_representation(Representation::Integer32());
7605 SetFlag(kUseGVN); 7605 SetFlag(kUseGVN);
7606 SetDependsOnFlag(kStringChars); 7606 SetDependsOnFlag(kStringChars);
7607 } 7607 }
7608 7608
7609 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7609 virtual bool IsDeletable() const OVERRIDE { return true; }
7610 7610
7611 String::Encoding encoding_; 7611 String::Encoding encoding_;
7612 }; 7612 };
7613 7613
7614 7614
7615 class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<4> { 7615 class HSeqStringSetChar FINAL : public HTemplateInstruction<4> {
7616 public: 7616 public:
7617 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4( 7617 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(
7618 HSeqStringSetChar, String::Encoding, 7618 HSeqStringSetChar, String::Encoding,
7619 HValue*, HValue*, HValue*); 7619 HValue*, HValue*, HValue*);
7620 7620
7621 String::Encoding encoding() { return encoding_; } 7621 String::Encoding encoding() { return encoding_; }
7622 HValue* context() { return OperandAt(0); } 7622 HValue* context() { return OperandAt(0); }
7623 HValue* string() { return OperandAt(1); } 7623 HValue* string() { return OperandAt(1); }
7624 HValue* index() { return OperandAt(2); } 7624 HValue* index() { return OperandAt(2); }
7625 HValue* value() { return OperandAt(3); } 7625 HValue* value() { return OperandAt(3); }
7626 7626
7627 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7627 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
7628 return (index <= 1) ? Representation::Tagged() 7628 return (index <= 1) ? Representation::Tagged()
7629 : Representation::Integer32(); 7629 : Representation::Integer32();
7630 } 7630 }
7631 7631
7632 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar) 7632 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar)
7633 7633
7634 private: 7634 private:
7635 HSeqStringSetChar(HValue* context, 7635 HSeqStringSetChar(HValue* context,
7636 String::Encoding encoding, 7636 String::Encoding encoding,
7637 HValue* string, 7637 HValue* string,
7638 HValue* index, 7638 HValue* index,
7639 HValue* value) : encoding_(encoding) { 7639 HValue* value) : encoding_(encoding) {
7640 SetOperandAt(0, context); 7640 SetOperandAt(0, context);
7641 SetOperandAt(1, string); 7641 SetOperandAt(1, string);
7642 SetOperandAt(2, index); 7642 SetOperandAt(2, index);
7643 SetOperandAt(3, value); 7643 SetOperandAt(3, value);
7644 set_representation(Representation::Tagged()); 7644 set_representation(Representation::Tagged());
7645 SetChangesFlag(kStringChars); 7645 SetChangesFlag(kStringChars);
7646 } 7646 }
7647 7647
7648 String::Encoding encoding_; 7648 String::Encoding encoding_;
7649 }; 7649 };
7650 7650
7651 7651
7652 class HCheckMapValue V8_FINAL : public HTemplateInstruction<2> { 7652 class HCheckMapValue FINAL : public HTemplateInstruction<2> {
7653 public: 7653 public:
7654 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*); 7654 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*);
7655 7655
7656 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7656 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
7657 return Representation::Tagged(); 7657 return Representation::Tagged();
7658 } 7658 }
7659 7659
7660 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 7660 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
7661 7661
7662 virtual HType CalculateInferredType() V8_OVERRIDE { 7662 virtual HType CalculateInferredType() OVERRIDE {
7663 if (value()->type().IsHeapObject()) return value()->type(); 7663 if (value()->type().IsHeapObject()) return value()->type();
7664 return HType::HeapObject(); 7664 return HType::HeapObject();
7665 } 7665 }
7666 7666
7667 HValue* value() const { return OperandAt(0); } 7667 HValue* value() const { return OperandAt(0); }
7668 HValue* map() const { return OperandAt(1); } 7668 HValue* map() const { return OperandAt(1); }
7669 7669
7670 virtual HValue* Canonicalize() V8_OVERRIDE; 7670 virtual HValue* Canonicalize() OVERRIDE;
7671 7671
7672 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue) 7672 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue)
7673 7673
7674 protected: 7674 protected:
7675 virtual int RedefinedOperandIndex() { return 0; } 7675 virtual int RedefinedOperandIndex() { return 0; }
7676 7676
7677 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 7677 virtual bool DataEquals(HValue* other) OVERRIDE {
7678 return true; 7678 return true;
7679 } 7679 }
7680 7680
7681 private: 7681 private:
7682 HCheckMapValue(HValue* value, HValue* map) 7682 HCheckMapValue(HValue* value, HValue* map)
7683 : HTemplateInstruction<2>(HType::HeapObject()) { 7683 : HTemplateInstruction<2>(HType::HeapObject()) {
7684 SetOperandAt(0, value); 7684 SetOperandAt(0, value);
7685 SetOperandAt(1, map); 7685 SetOperandAt(1, map);
7686 set_representation(Representation::Tagged()); 7686 set_representation(Representation::Tagged());
7687 SetFlag(kUseGVN); 7687 SetFlag(kUseGVN);
7688 SetDependsOnFlag(kMaps); 7688 SetDependsOnFlag(kMaps);
7689 SetDependsOnFlag(kElementsKind); 7689 SetDependsOnFlag(kElementsKind);
7690 } 7690 }
7691 }; 7691 };
7692 7692
7693 7693
7694 class HForInPrepareMap V8_FINAL : public HTemplateInstruction<2> { 7694 class HForInPrepareMap FINAL : public HTemplateInstruction<2> {
7695 public: 7695 public:
7696 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HForInPrepareMap, HValue*); 7696 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HForInPrepareMap, HValue*);
7697 7697
7698 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7698 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
7699 return Representation::Tagged(); 7699 return Representation::Tagged();
7700 } 7700 }
7701 7701
7702 HValue* context() const { return OperandAt(0); } 7702 HValue* context() const { return OperandAt(0); }
7703 HValue* enumerable() const { return OperandAt(1); } 7703 HValue* enumerable() const { return OperandAt(1); }
7704 7704
7705 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 7705 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
7706 7706
7707 virtual HType CalculateInferredType() V8_OVERRIDE { 7707 virtual HType CalculateInferredType() OVERRIDE {
7708 return HType::Tagged(); 7708 return HType::Tagged();
7709 } 7709 }
7710 7710
7711 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap); 7711 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap);
7712 7712
7713 private: 7713 private:
7714 HForInPrepareMap(HValue* context, 7714 HForInPrepareMap(HValue* context,
7715 HValue* object) { 7715 HValue* object) {
7716 SetOperandAt(0, context); 7716 SetOperandAt(0, context);
7717 SetOperandAt(1, object); 7717 SetOperandAt(1, object);
7718 set_representation(Representation::Tagged()); 7718 set_representation(Representation::Tagged());
7719 SetAllSideEffects(); 7719 SetAllSideEffects();
7720 } 7720 }
7721 }; 7721 };
7722 7722
7723 7723
7724 class HForInCacheArray V8_FINAL : public HTemplateInstruction<2> { 7724 class HForInCacheArray FINAL : public HTemplateInstruction<2> {
7725 public: 7725 public:
7726 DECLARE_INSTRUCTION_FACTORY_P3(HForInCacheArray, HValue*, HValue*, int); 7726 DECLARE_INSTRUCTION_FACTORY_P3(HForInCacheArray, HValue*, HValue*, int);
7727 7727
7728 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7728 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
7729 return Representation::Tagged(); 7729 return Representation::Tagged();
7730 } 7730 }
7731 7731
7732 HValue* enumerable() const { return OperandAt(0); } 7732 HValue* enumerable() const { return OperandAt(0); }
7733 HValue* map() const { return OperandAt(1); } 7733 HValue* map() const { return OperandAt(1); }
7734 int idx() const { return idx_; } 7734 int idx() const { return idx_; }
7735 7735
7736 HForInCacheArray* index_cache() { 7736 HForInCacheArray* index_cache() {
7737 return index_cache_; 7737 return index_cache_;
7738 } 7738 }
7739 7739
7740 void set_index_cache(HForInCacheArray* index_cache) { 7740 void set_index_cache(HForInCacheArray* index_cache) {
7741 index_cache_ = index_cache; 7741 index_cache_ = index_cache;
7742 } 7742 }
7743 7743
7744 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 7744 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
7745 7745
7746 virtual HType CalculateInferredType() V8_OVERRIDE { 7746 virtual HType CalculateInferredType() OVERRIDE {
7747 return HType::Tagged(); 7747 return HType::Tagged();
7748 } 7748 }
7749 7749
7750 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray); 7750 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray);
7751 7751
7752 private: 7752 private:
7753 HForInCacheArray(HValue* enumerable, 7753 HForInCacheArray(HValue* enumerable,
7754 HValue* keys, 7754 HValue* keys,
7755 int idx) : idx_(idx) { 7755 int idx) : idx_(idx) {
7756 SetOperandAt(0, enumerable); 7756 SetOperandAt(0, enumerable);
7757 SetOperandAt(1, keys); 7757 SetOperandAt(1, keys);
7758 set_representation(Representation::Tagged()); 7758 set_representation(Representation::Tagged());
7759 } 7759 }
7760 7760
7761 int idx_; 7761 int idx_;
7762 HForInCacheArray* index_cache_; 7762 HForInCacheArray* index_cache_;
7763 }; 7763 };
7764 7764
7765 7765
7766 class HLoadFieldByIndex V8_FINAL : public HTemplateInstruction<2> { 7766 class HLoadFieldByIndex FINAL : public HTemplateInstruction<2> {
7767 public: 7767 public:
7768 DECLARE_INSTRUCTION_FACTORY_P2(HLoadFieldByIndex, HValue*, HValue*); 7768 DECLARE_INSTRUCTION_FACTORY_P2(HLoadFieldByIndex, HValue*, HValue*);
7769 7769
7770 HLoadFieldByIndex(HValue* object, 7770 HLoadFieldByIndex(HValue* object,
7771 HValue* index) { 7771 HValue* index) {
7772 SetOperandAt(0, object); 7772 SetOperandAt(0, object);
7773 SetOperandAt(1, index); 7773 SetOperandAt(1, index);
7774 SetChangesFlag(kNewSpacePromotion); 7774 SetChangesFlag(kNewSpacePromotion);
7775 set_representation(Representation::Tagged()); 7775 set_representation(Representation::Tagged());
7776 } 7776 }
7777 7777
7778 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7778 virtual Representation RequiredInputRepresentation(int index) OVERRIDE {
7779 if (index == 1) { 7779 if (index == 1) {
7780 return Representation::Smi(); 7780 return Representation::Smi();
7781 } else { 7781 } else {
7782 return Representation::Tagged(); 7782 return Representation::Tagged();
7783 } 7783 }
7784 } 7784 }
7785 7785
7786 HValue* object() const { return OperandAt(0); } 7786 HValue* object() const { return OperandAt(0); }
7787 HValue* index() const { return OperandAt(1); } 7787 HValue* index() const { return OperandAt(1); }
7788 7788
7789 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT 7789 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT
7790 7790
7791 virtual HType CalculateInferredType() V8_OVERRIDE { 7791 virtual HType CalculateInferredType() OVERRIDE {
7792 return HType::Tagged(); 7792 return HType::Tagged();
7793 } 7793 }
7794 7794
7795 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); 7795 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex);
7796 7796
7797 private: 7797 private:
7798 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7798 virtual bool IsDeletable() const OVERRIDE { return true; }
7799 }; 7799 };
7800 7800
7801 7801
7802 class HStoreFrameContext: public HUnaryOperation { 7802 class HStoreFrameContext: public HUnaryOperation {
7803 public: 7803 public:
7804 DECLARE_INSTRUCTION_FACTORY_P1(HStoreFrameContext, HValue*); 7804 DECLARE_INSTRUCTION_FACTORY_P1(HStoreFrameContext, HValue*);
7805 7805
7806 HValue* context() { return OperandAt(0); } 7806 HValue* context() { return OperandAt(0); }
7807 7807
7808 virtual Representation RequiredInputRepresentation(int index) { 7808 virtual Representation RequiredInputRepresentation(int index) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
7849 }; 7849 };
7850 7850
7851 7851
7852 7852
7853 #undef DECLARE_INSTRUCTION 7853 #undef DECLARE_INSTRUCTION
7854 #undef DECLARE_CONCRETE_INSTRUCTION 7854 #undef DECLARE_CONCRETE_INSTRUCTION
7855 7855
7856 } } // namespace v8::internal 7856 } } // namespace v8::internal
7857 7857
7858 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7858 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen-gvn.cc ('k') | src/hydrogen-types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698