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

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 10914314: Simple redundant load elimination. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 enum Tag { 271 enum Tag {
272 FOR_EACH_INSTRUCTION(DECLARE_TAG) 272 FOR_EACH_INSTRUCTION(DECLARE_TAG)
273 }; 273 };
274 #undef DECLARE_TAG 274 #undef DECLARE_TAG
275 275
276 Instruction() 276 Instruction()
277 : deopt_id_(Isolate::Current()->GetNextDeoptId()), 277 : deopt_id_(Isolate::Current()->GetNextDeoptId()),
278 lifetime_position_(-1), 278 lifetime_position_(-1),
279 previous_(NULL), 279 previous_(NULL),
280 next_(NULL), 280 next_(NULL),
281 env_(NULL) { } 281 env_(NULL),
282 expr_id_(-1) { }
282 283
283 virtual Tag tag() const = 0; 284 virtual Tag tag() const = 0;
284 285
285 intptr_t deopt_id() const { 286 intptr_t deopt_id() const {
286 ASSERT(CanDeoptimize()); 287 ASSERT(CanDeoptimize());
287 return deopt_id_; 288 return deopt_id_;
288 } 289 }
289 290
290 bool IsBlockEntry() { return (AsBlockEntry() != NULL); } 291 bool IsBlockEntry() { return (AsBlockEntry() != NULL); }
291 virtual BlockEntryInstr* AsBlockEntry() { return NULL; } 292 virtual BlockEntryInstr* AsBlockEntry() { return NULL; }
(...skipping 12 matching lines...) Expand all
304 // pushed arguments. 305 // pushed arguments.
305 virtual intptr_t ArgumentCount() const = 0; 306 virtual intptr_t ArgumentCount() const = 0;
306 virtual PushArgumentInstr* ArgumentAt(intptr_t index) const { 307 virtual PushArgumentInstr* ArgumentAt(intptr_t index) const {
307 UNREACHABLE(); 308 UNREACHABLE();
308 return NULL; 309 return NULL;
309 }; 310 };
310 311
311 // Returns true, if this instruction can deoptimize. 312 // Returns true, if this instruction can deoptimize.
312 virtual bool CanDeoptimize() const = 0; 313 virtual bool CanDeoptimize() const = 0;
313 314
315 // Returns true if the instruction may have side effects.
316 virtual bool HasSideEffect() const = 0;
317
314 // Visiting support. 318 // Visiting support.
315 virtual void Accept(FlowGraphVisitor* visitor) = 0; 319 virtual void Accept(FlowGraphVisitor* visitor) = 0;
316 320
317 Instruction* previous() const { return previous_; } 321 Instruction* previous() const { return previous_; }
318 void set_previous(Instruction* instr) { 322 void set_previous(Instruction* instr) {
319 ASSERT(!IsBlockEntry()); 323 ASSERT(!IsBlockEntry());
320 previous_ = instr; 324 previous_ = instr;
321 } 325 }
322 326
323 Instruction* next() const { return next_; } 327 Instruction* next() const { return next_; }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 } 431 }
428 432
429 // Returns deoptimization id that corresponds to the deoptimization target 433 // Returns deoptimization id that corresponds to the deoptimization target
430 // that input operands conversions inserted for this instruction can jump 434 // that input operands conversions inserted for this instruction can jump
431 // to. 435 // to.
432 virtual intptr_t DeoptimizationTarget() const { 436 virtual intptr_t DeoptimizationTarget() const {
433 UNREACHABLE(); 437 UNREACHABLE();
434 return Isolate::kNoDeoptId; 438 return Isolate::kNoDeoptId;
435 } 439 }
436 440
441 // Id for instructions used in CSE.
442 intptr_t expr_id() const { return expr_id_; }
443 void set_expr_id(intptr_t expr_id) { expr_id_ = expr_id; }
444
437 protected: 445 protected:
438 // Fetch deopt id without checking if this computation can deoptimize. 446 // Fetch deopt id without checking if this computation can deoptimize.
439 intptr_t GetDeoptId() const { 447 intptr_t GetDeoptId() const {
440 return deopt_id_; 448 return deopt_id_;
441 } 449 }
442 450
443 private: 451 private:
444 friend class Definition; // Needed for InsertBefore, InsertAfter. 452 friend class Definition; // Needed for InsertBefore, InsertAfter.
445 453
446 // Classes that set deopt_id_. 454 // Classes that set deopt_id_.
447 friend class UnboxDoubleInstr; 455 friend class UnboxDoubleInstr;
448 friend class UnboxedDoubleBinaryOpInstr; 456 friend class UnboxedDoubleBinaryOpInstr;
449 friend class MathSqrtInstr; 457 friend class MathSqrtInstr;
450 friend class CheckClassInstr; 458 friend class CheckClassInstr;
451 friend class CheckSmiInstr; 459 friend class CheckSmiInstr;
452 friend class CheckArrayBoundInstr; 460 friend class CheckArrayBoundInstr;
453 friend class CheckEitherNonSmiInstr; 461 friend class CheckEitherNonSmiInstr;
454 friend class LICM; 462 friend class LICM;
455 463
456 intptr_t deopt_id_; 464 intptr_t deopt_id_;
457 intptr_t lifetime_position_; // Position used by register allocator. 465 intptr_t lifetime_position_; // Position used by register allocator.
458 Instruction* previous_; 466 Instruction* previous_;
459 Instruction* next_; 467 Instruction* next_;
460 Environment* env_; 468 Environment* env_;
469 intptr_t expr_id_;
470
461 DISALLOW_COPY_AND_ASSIGN(Instruction); 471 DISALLOW_COPY_AND_ASSIGN(Instruction);
462 }; 472 };
463 473
464 474
465 template<intptr_t N> 475 template<intptr_t N>
466 class TemplateInstruction: public Instruction { 476 class TemplateInstruction: public Instruction {
467 public: 477 public:
468 TemplateInstruction<N>() : locs_(NULL) { } 478 TemplateInstruction<N>() : locs_(NULL) { }
469 479
470 virtual intptr_t InputCount() const { return N; } 480 virtual intptr_t InputCount() const { return N; }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 class ParallelMoveInstr : public TemplateInstruction<0> { 560 class ParallelMoveInstr : public TemplateInstruction<0> {
551 public: 561 public:
552 ParallelMoveInstr() : moves_(4) { } 562 ParallelMoveInstr() : moves_(4) { }
553 563
554 DECLARE_INSTRUCTION(ParallelMove) 564 DECLARE_INSTRUCTION(ParallelMove)
555 565
556 virtual intptr_t ArgumentCount() const { return 0; } 566 virtual intptr_t ArgumentCount() const { return 0; }
557 567
558 virtual bool CanDeoptimize() const { return false; } 568 virtual bool CanDeoptimize() const { return false; }
559 569
570 virtual bool HasSideEffect() const { return false; }
571
560 MoveOperands* AddMove(Location dest, Location src) { 572 MoveOperands* AddMove(Location dest, Location src) {
561 MoveOperands* move = new MoveOperands(dest, src); 573 MoveOperands* move = new MoveOperands(dest, src);
562 moves_.Add(move); 574 moves_.Add(move);
563 return move; 575 return move;
564 } 576 }
565 577
566 MoveOperands* MoveOperandsAt(intptr_t index) const { return moves_[index]; } 578 MoveOperands* MoveOperandsAt(intptr_t index) const { return moves_[index]; }
567 579
568 void SetSrcSlotAt(intptr_t index, const Location& loc); 580 void SetSrcSlotAt(intptr_t index, const Location& loc);
569 void SetDestSlotAt(intptr_t index, const Location& loc); 581 void SetDestSlotAt(intptr_t index, const Location& loc);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 virtual Value* InputAt(intptr_t i) const { 664 virtual Value* InputAt(intptr_t i) const {
653 UNREACHABLE(); 665 UNREACHABLE();
654 return NULL; 666 return NULL;
655 } 667 }
656 virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } 668 virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); }
657 669
658 virtual intptr_t ArgumentCount() const { return 0; } 670 virtual intptr_t ArgumentCount() const { return 0; }
659 671
660 virtual bool CanDeoptimize() const { return false; } 672 virtual bool CanDeoptimize() const { return false; }
661 673
674 virtual bool HasSideEffect() const { return false; }
675
662 intptr_t try_index() const { return try_index_; } 676 intptr_t try_index() const { return try_index_; }
663 677
664 BitVector* loop_info() const { return loop_info_; } 678 BitVector* loop_info() const { return loop_info_; }
665 void set_loop_info(BitVector* loop_info) { 679 void set_loop_info(BitVector* loop_info) {
666 loop_info_ = loop_info; 680 loop_info_ = loop_info;
667 } 681 }
668 682
669 protected: 683 protected:
670 explicit BlockEntryInstr(intptr_t try_index) 684 explicit BlockEntryInstr(intptr_t try_index)
671 : try_index_(try_index), 685 : try_index_(try_index),
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 virtual intptr_t ArgumentCount() const { return 0; } 1093 virtual intptr_t ArgumentCount() const { return 0; }
1080 1094
1081 intptr_t InputCount() const { return inputs_.length(); } 1095 intptr_t InputCount() const { return inputs_.length(); }
1082 1096
1083 Value* InputAt(intptr_t i) const { return inputs_[i]; } 1097 Value* InputAt(intptr_t i) const { return inputs_[i]; }
1084 1098
1085 void SetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } 1099 void SetInputAt(intptr_t i, Value* value) { inputs_[i] = value; }
1086 1100
1087 virtual bool CanDeoptimize() const { return false; } 1101 virtual bool CanDeoptimize() const { return false; }
1088 1102
1103 virtual bool HasSideEffect() const { return false; }
1104
1089 // TODO(regis): This helper will be removed once we support type sets. 1105 // TODO(regis): This helper will be removed once we support type sets.
1090 RawAbstractType* LeastSpecificInputType() const; 1106 RawAbstractType* LeastSpecificInputType() const;
1091 1107
1092 // Phi is alive if it reaches a non-environment use. 1108 // Phi is alive if it reaches a non-environment use.
1093 bool is_alive() const { return is_alive_; } 1109 bool is_alive() const { return is_alive_; }
1094 void mark_alive() { is_alive_ = true; } 1110 void mark_alive() { is_alive_ = true; }
1095 1111
1096 virtual Representation RequiredInputRepresentation(intptr_t i) const { 1112 virtual Representation RequiredInputRepresentation(intptr_t i) const {
1097 return representation_; 1113 return representation_;
1098 } 1114 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 1168
1153 intptr_t InputCount() const { return 0; } 1169 intptr_t InputCount() const { return 0; }
1154 Value* InputAt(intptr_t i) const { 1170 Value* InputAt(intptr_t i) const {
1155 UNREACHABLE(); 1171 UNREACHABLE();
1156 return NULL; 1172 return NULL;
1157 } 1173 }
1158 void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } 1174 void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); }
1159 1175
1160 virtual bool CanDeoptimize() const { return false; } 1176 virtual bool CanDeoptimize() const { return false; }
1161 1177
1178 virtual bool HasSideEffect() const { return false; }
1179
1162 virtual intptr_t Hashcode() const { 1180 virtual intptr_t Hashcode() const {
1163 UNREACHABLE(); 1181 UNREACHABLE();
1164 return 0; 1182 return 0;
1165 } 1183 }
1166 1184
1167 virtual intptr_t ResultCid() const { 1185 virtual intptr_t ResultCid() const {
1168 UNREACHABLE(); 1186 UNREACHABLE();
1169 return kIllegalCid; 1187 return kIllegalCid;
1170 } 1188 }
1171 1189
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 return locs_; 1235 return locs_;
1218 } 1236 }
1219 1237
1220 virtual intptr_t Hashcode() const { 1238 virtual intptr_t Hashcode() const {
1221 UNREACHABLE(); 1239 UNREACHABLE();
1222 return 0; 1240 return 0;
1223 } 1241 }
1224 1242
1225 virtual bool CanDeoptimize() const { return false; } 1243 virtual bool CanDeoptimize() const { return false; }
1226 1244
1245 virtual bool HasSideEffect() const { return false; }
1246
1227 virtual void PrintOperandsTo(BufferFormatter* f) const; 1247 virtual void PrintOperandsTo(BufferFormatter* f) const;
1228 virtual void PrintToVisualizer(BufferFormatter* f) const; 1248 virtual void PrintToVisualizer(BufferFormatter* f) const;
1229 1249
1230 private: 1250 private:
1231 Value* value_; 1251 Value* value_;
1232 LocationSummary* locs_; 1252 LocationSummary* locs_;
1233 1253
1234 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); 1254 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr);
1235 }; 1255 };
1236 1256
1237 1257
1238 class ReturnInstr : public TemplateInstruction<1> { 1258 class ReturnInstr : public TemplateInstruction<1> {
1239 public: 1259 public:
1240 ReturnInstr(intptr_t token_pos, Value* value) 1260 ReturnInstr(intptr_t token_pos, Value* value)
1241 : token_pos_(token_pos) { 1261 : token_pos_(token_pos) {
1242 ASSERT(value != NULL); 1262 ASSERT(value != NULL);
1243 inputs_[0] = value; 1263 inputs_[0] = value;
1244 } 1264 }
1245 1265
1246 DECLARE_INSTRUCTION(Return) 1266 DECLARE_INSTRUCTION(Return)
1247 1267
1248 virtual intptr_t ArgumentCount() const { return 0; } 1268 virtual intptr_t ArgumentCount() const { return 0; }
1249 1269
1250 intptr_t token_pos() const { return token_pos_; } 1270 intptr_t token_pos() const { return token_pos_; }
1251 Value* value() const { return inputs_[0]; } 1271 Value* value() const { return inputs_[0]; }
1252 1272
1253 virtual bool CanDeoptimize() const { return false; } 1273 virtual bool CanDeoptimize() const { return false; }
1254 1274
1275 virtual bool HasSideEffect() const { return false; }
1276
1255 virtual void PrintTo(BufferFormatter* f) const; 1277 virtual void PrintTo(BufferFormatter* f) const;
1256 virtual void PrintToVisualizer(BufferFormatter* f) const; 1278 virtual void PrintToVisualizer(BufferFormatter* f) const;
1257 1279
1258 private: 1280 private:
1259 const intptr_t token_pos_; 1281 const intptr_t token_pos_;
1260 1282
1261 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); 1283 DISALLOW_COPY_AND_ASSIGN(ReturnInstr);
1262 }; 1284 };
1263 1285
1264 1286
1265 class ThrowInstr : public TemplateInstruction<0> { 1287 class ThrowInstr : public TemplateInstruction<0> {
1266 public: 1288 public:
1267 explicit ThrowInstr(intptr_t token_pos) : token_pos_(token_pos) { } 1289 explicit ThrowInstr(intptr_t token_pos) : token_pos_(token_pos) { }
1268 1290
1269 DECLARE_INSTRUCTION(Throw) 1291 DECLARE_INSTRUCTION(Throw)
1270 1292
1271 virtual intptr_t ArgumentCount() const { return 1; } 1293 virtual intptr_t ArgumentCount() const { return 1; }
1272 1294
1273 intptr_t token_pos() const { return token_pos_; } 1295 intptr_t token_pos() const { return token_pos_; }
1274 1296
1275 virtual bool CanDeoptimize() const { return false; } 1297 virtual bool CanDeoptimize() const { return false; }
1276 1298
1299 virtual bool HasSideEffect() const { return true; }
1300
1277 virtual void PrintTo(BufferFormatter* f) const; 1301 virtual void PrintTo(BufferFormatter* f) const;
1278 virtual void PrintToVisualizer(BufferFormatter* f) const; 1302 virtual void PrintToVisualizer(BufferFormatter* f) const;
1279 1303
1280 private: 1304 private:
1281 const intptr_t token_pos_; 1305 const intptr_t token_pos_;
1282 1306
1283 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); 1307 DISALLOW_COPY_AND_ASSIGN(ThrowInstr);
1284 }; 1308 };
1285 1309
1286 1310
1287 class ReThrowInstr : public TemplateInstruction<0> { 1311 class ReThrowInstr : public TemplateInstruction<0> {
1288 public: 1312 public:
1289 explicit ReThrowInstr(intptr_t token_pos) : token_pos_(token_pos) { } 1313 explicit ReThrowInstr(intptr_t token_pos) : token_pos_(token_pos) { }
1290 1314
1291 DECLARE_INSTRUCTION(ReThrow) 1315 DECLARE_INSTRUCTION(ReThrow)
1292 1316
1293 virtual intptr_t ArgumentCount() const { return 2; } 1317 virtual intptr_t ArgumentCount() const { return 2; }
1294 1318
1295 intptr_t token_pos() const { return token_pos_; } 1319 intptr_t token_pos() const { return token_pos_; }
1296 1320
1297 virtual bool CanDeoptimize() const { return false; } 1321 virtual bool CanDeoptimize() const { return false; }
1298 1322
1323 virtual bool HasSideEffect() const { return true; }
1324
1299 virtual void PrintTo(BufferFormatter* f) const; 1325 virtual void PrintTo(BufferFormatter* f) const;
1300 virtual void PrintToVisualizer(BufferFormatter* f) const; 1326 virtual void PrintToVisualizer(BufferFormatter* f) const;
1301 1327
1302 private: 1328 private:
1303 const intptr_t token_pos_; 1329 const intptr_t token_pos_;
1304 1330
1305 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); 1331 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr);
1306 }; 1332 };
1307 1333
1308 1334
1309 class GotoInstr : public TemplateInstruction<0> { 1335 class GotoInstr : public TemplateInstruction<0> {
1310 public: 1336 public:
1311 explicit GotoInstr(JoinEntryInstr* entry) 1337 explicit GotoInstr(JoinEntryInstr* entry)
1312 : successor_(entry), 1338 : successor_(entry),
1313 parallel_move_(NULL) { } 1339 parallel_move_(NULL) { }
1314 1340
1315 DECLARE_INSTRUCTION(Goto) 1341 DECLARE_INSTRUCTION(Goto)
1316 1342
1317 virtual intptr_t ArgumentCount() const { return 0; } 1343 virtual intptr_t ArgumentCount() const { return 0; }
1318 1344
1319 JoinEntryInstr* successor() const { return successor_; } 1345 JoinEntryInstr* successor() const { return successor_; }
1320 void set_successor(JoinEntryInstr* successor) { successor_ = successor; } 1346 void set_successor(JoinEntryInstr* successor) { successor_ = successor; }
1321 virtual intptr_t SuccessorCount() const; 1347 virtual intptr_t SuccessorCount() const;
1322 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; 1348 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const;
1323 1349
1324 virtual bool CanDeoptimize() const { return false; } 1350 virtual bool CanDeoptimize() const { return false; }
1325 1351
1352 virtual bool HasSideEffect() const { return false; }
1353
1326 ParallelMoveInstr* parallel_move() const { 1354 ParallelMoveInstr* parallel_move() const {
1327 return parallel_move_; 1355 return parallel_move_;
1328 } 1356 }
1329 1357
1330 bool HasParallelMove() const { 1358 bool HasParallelMove() const {
1331 return parallel_move_ != NULL; 1359 return parallel_move_ != NULL;
1332 } 1360 }
1333 1361
1334 ParallelMoveInstr* GetParallelMove() { 1362 ParallelMoveInstr* GetParallelMove() {
1335 if (parallel_move_ == NULL) { 1363 if (parallel_move_ == NULL) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 : comparison_(comparison) { } 1422 : comparison_(comparison) { }
1395 1423
1396 DECLARE_INSTRUCTION(Branch) 1424 DECLARE_INSTRUCTION(Branch)
1397 1425
1398 virtual intptr_t ArgumentCount() const; 1426 virtual intptr_t ArgumentCount() const;
1399 intptr_t InputCount() const; 1427 intptr_t InputCount() const;
1400 Value* InputAt(intptr_t i) const; 1428 Value* InputAt(intptr_t i) const;
1401 void SetInputAt(intptr_t i, Value* value); 1429 void SetInputAt(intptr_t i, Value* value);
1402 virtual bool CanDeoptimize() const; 1430 virtual bool CanDeoptimize() const;
1403 1431
1432 virtual bool HasSideEffect() const;
1433
1404 ComparisonInstr* comparison() const { return comparison_; } 1434 ComparisonInstr* comparison() const { return comparison_; }
1405 void set_comparison(ComparisonInstr* value) { comparison_ = value; } 1435 void set_comparison(ComparisonInstr* value) { comparison_ = value; }
1406 1436
1407 virtual LocationSummary* locs(); 1437 virtual LocationSummary* locs();
1408 virtual intptr_t DeoptimizationTarget() const; 1438 virtual intptr_t DeoptimizationTarget() const;
1409 virtual Representation RequiredInputRepresentation(intptr_t i) const; 1439 virtual Representation RequiredInputRepresentation(intptr_t i) const;
1410 1440
1411 // Replace the comparison with another, leaving the branch intact. 1441 // Replace the comparison with another, leaving the branch intact.
1412 void ReplaceWith(ComparisonInstr* other, 1442 void ReplaceWith(ComparisonInstr* other,
1413 ForwardInstructionIterator* ignored) { 1443 ForwardInstructionIterator* ignored) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 1491
1462 DECLARE_INSTRUCTION(Constant) 1492 DECLARE_INSTRUCTION(Constant)
1463 virtual RawAbstractType* CompileType() const; 1493 virtual RawAbstractType* CompileType() const;
1464 1494
1465 const Object& value() const { return value_; } 1495 const Object& value() const { return value_; }
1466 1496
1467 virtual void PrintOperandsTo(BufferFormatter* f) const; 1497 virtual void PrintOperandsTo(BufferFormatter* f) const;
1468 1498
1469 virtual bool CanDeoptimize() const { return false; } 1499 virtual bool CanDeoptimize() const { return false; }
1470 1500
1501 virtual bool HasSideEffect() const { return false; }
1502
1471 virtual intptr_t ResultCid() const; 1503 virtual intptr_t ResultCid() const;
1472 1504
1473 virtual bool AttributesEqual(Definition* other) const; 1505 virtual bool AttributesEqual(Definition* other) const;
1474 1506
1475 private: 1507 private:
1476 const Object& value_; 1508 const Object& value_;
1477 1509
1478 DISALLOW_COPY_AND_ASSIGN(ConstantInstr); 1510 DISALLOW_COPY_AND_ASSIGN(ConstantInstr);
1479 }; 1511 };
1480 1512
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 return is_eliminated_; 1548 return is_eliminated_;
1517 } 1549 }
1518 void eliminate() { 1550 void eliminate() {
1519 ASSERT(!is_eliminated_); 1551 ASSERT(!is_eliminated_);
1520 is_eliminated_ = true; 1552 is_eliminated_ = true;
1521 } 1553 }
1522 1554
1523 virtual void PrintOperandsTo(BufferFormatter* f) const; 1555 virtual void PrintOperandsTo(BufferFormatter* f) const;
1524 1556
1525 virtual bool CanDeoptimize() const { return false; } 1557 virtual bool CanDeoptimize() const { return false; }
1558
1559 virtual bool HasSideEffect() const { return false; }
1560
1526 virtual intptr_t ResultCid() const { return kDynamicCid; } 1561 virtual intptr_t ResultCid() const { return kDynamicCid; }
1527 1562
1528 private: 1563 private:
1529 const intptr_t token_pos_; 1564 const intptr_t token_pos_;
1530 const AbstractType& dst_type_; 1565 const AbstractType& dst_type_;
1531 const String& dst_name_; 1566 const String& dst_name_;
1532 bool is_eliminated_; 1567 bool is_eliminated_;
1533 1568
1534 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr); 1569 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr);
1535 }; 1570 };
(...skipping 18 matching lines...) Expand all
1554 return is_eliminated_; 1589 return is_eliminated_;
1555 } 1590 }
1556 void eliminate() { 1591 void eliminate() {
1557 ASSERT(!is_eliminated_); 1592 ASSERT(!is_eliminated_);
1558 is_eliminated_ = true; 1593 is_eliminated_ = true;
1559 } 1594 }
1560 1595
1561 virtual void PrintOperandsTo(BufferFormatter* f) const; 1596 virtual void PrintOperandsTo(BufferFormatter* f) const;
1562 1597
1563 virtual bool CanDeoptimize() const { return false; } 1598 virtual bool CanDeoptimize() const { return false; }
1599
1600 virtual bool HasSideEffect() const { return false; }
1601
1564 virtual intptr_t ResultCid() const { return kBoolCid; } 1602 virtual intptr_t ResultCid() const { return kBoolCid; }
1565 1603
1566 private: 1604 private:
1567 const intptr_t token_pos_; 1605 const intptr_t token_pos_;
1568 bool is_eliminated_; 1606 bool is_eliminated_;
1569 1607
1570 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr); 1608 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr);
1571 }; 1609 };
1572 1610
1573 1611
(...skipping 14 matching lines...) Expand all
1588 return ast_node_.formal_parameter_index(); 1626 return ast_node_.formal_parameter_index();
1589 } 1627 }
1590 const String& formal_parameter_name() const { 1628 const String& formal_parameter_name() const {
1591 return ast_node_.formal_parameter_name(); 1629 return ast_node_.formal_parameter_name();
1592 } 1630 }
1593 Value* saved_arguments_descriptor() const { return inputs_[0]; } 1631 Value* saved_arguments_descriptor() const { return inputs_[0]; }
1594 1632
1595 virtual void PrintOperandsTo(BufferFormatter* f) const; 1633 virtual void PrintOperandsTo(BufferFormatter* f) const;
1596 1634
1597 virtual bool CanDeoptimize() const { return false; } 1635 virtual bool CanDeoptimize() const { return false; }
1636
1637 virtual bool HasSideEffect() const { return true; }
1638
1598 virtual intptr_t ResultCid() const { return kBoolCid; } 1639 virtual intptr_t ResultCid() const { return kBoolCid; }
1599 1640
1600 private: 1641 private:
1601 const ArgumentDefinitionTestNode& ast_node_; 1642 const ArgumentDefinitionTestNode& ast_node_;
1602 1643
1603 DISALLOW_COPY_AND_ASSIGN(ArgumentDefinitionTestInstr); 1644 DISALLOW_COPY_AND_ASSIGN(ArgumentDefinitionTestInstr);
1604 }; 1645 };
1605 1646
1606 1647
1607 // Denotes the current context, normally held in a register. This is 1648 // Denotes the current context, normally held in a register. This is
1608 // a computation, not a value, because it's mutable. 1649 // a computation, not a value, because it's mutable.
1609 class CurrentContextInstr : public TemplateDefinition<0> { 1650 class CurrentContextInstr : public TemplateDefinition<0> {
1610 public: 1651 public:
1611 CurrentContextInstr() { } 1652 CurrentContextInstr() { }
1612 1653
1613 DECLARE_INSTRUCTION(CurrentContext) 1654 DECLARE_INSTRUCTION(CurrentContext)
1614 virtual RawAbstractType* CompileType() const; 1655 virtual RawAbstractType* CompileType() const;
1615 1656
1616 virtual bool CanDeoptimize() const { return false; } 1657 virtual bool CanDeoptimize() const { return false; }
1658
1659 virtual bool HasSideEffect() const { return false; }
1660
1617 virtual intptr_t ResultCid() const { return kDynamicCid; } 1661 virtual intptr_t ResultCid() const { return kDynamicCid; }
1618 1662
1619 private: 1663 private:
1620 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr); 1664 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr);
1621 }; 1665 };
1622 1666
1623 1667
1624 class StoreContextInstr : public TemplateDefinition<1> { 1668 class StoreContextInstr : public TemplateDefinition<1> {
1625 public: 1669 public:
1626 explicit StoreContextInstr(Value* value) { 1670 explicit StoreContextInstr(Value* value) {
1627 ASSERT(value != NULL); 1671 ASSERT(value != NULL);
1628 inputs_[0] = value; 1672 inputs_[0] = value;
1629 } 1673 }
1630 1674
1631 DECLARE_INSTRUCTION(StoreContext); 1675 DECLARE_INSTRUCTION(StoreContext);
1632 virtual RawAbstractType* CompileType() const; 1676 virtual RawAbstractType* CompileType() const;
1633 1677
1634 Value* value() const { return inputs_[0]; } 1678 Value* value() const { return inputs_[0]; }
1635 1679
1636 virtual bool CanDeoptimize() const { return false; } 1680 virtual bool CanDeoptimize() const { return false; }
1681
1682 virtual bool HasSideEffect() const { return false; }
1683
1637 virtual intptr_t ResultCid() const { return kIllegalCid; } 1684 virtual intptr_t ResultCid() const { return kIllegalCid; }
1638 1685
1639 private: 1686 private:
1640 DISALLOW_COPY_AND_ASSIGN(StoreContextInstr); 1687 DISALLOW_COPY_AND_ASSIGN(StoreContextInstr);
1641 }; 1688 };
1642 1689
1643 1690
1644 class ClosureCallInstr : public TemplateDefinition<0> { 1691 class ClosureCallInstr : public TemplateDefinition<0> {
1645 public: 1692 public:
1646 ClosureCallInstr(ClosureCallNode* node, 1693 ClosureCallInstr(ClosureCallNode* node,
1647 ZoneGrowableArray<PushArgumentInstr*>* arguments) 1694 ZoneGrowableArray<PushArgumentInstr*>* arguments)
1648 : ast_node_(*node), 1695 : ast_node_(*node),
1649 arguments_(arguments) { } 1696 arguments_(arguments) { }
1650 1697
1651 DECLARE_INSTRUCTION(ClosureCall) 1698 DECLARE_INSTRUCTION(ClosureCall)
1652 virtual RawAbstractType* CompileType() const; 1699 virtual RawAbstractType* CompileType() const;
1653 1700
1654 const Array& argument_names() const { return ast_node_.arguments()->names(); } 1701 const Array& argument_names() const { return ast_node_.arguments()->names(); }
1655 intptr_t token_pos() const { return ast_node_.token_pos(); } 1702 intptr_t token_pos() const { return ast_node_.token_pos(); }
1656 1703
1657 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 1704 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
1658 PushArgumentInstr* ArgumentAt(intptr_t index) const { 1705 PushArgumentInstr* ArgumentAt(intptr_t index) const {
1659 return (*arguments_)[index]; 1706 return (*arguments_)[index];
1660 } 1707 }
1661 1708
1662 virtual void PrintOperandsTo(BufferFormatter* f) const; 1709 virtual void PrintOperandsTo(BufferFormatter* f) const;
1663 1710
1664 virtual bool CanDeoptimize() const { return true; } 1711 virtual bool CanDeoptimize() const { return true; }
1712
1713 virtual bool HasSideEffect() const { return true; }
1714
1665 virtual intptr_t ResultCid() const { return kDynamicCid; } 1715 virtual intptr_t ResultCid() const { return kDynamicCid; }
1666 1716
1667 private: 1717 private:
1668 const ClosureCallNode& ast_node_; 1718 const ClosureCallNode& ast_node_;
1669 ZoneGrowableArray<PushArgumentInstr*>* arguments_; 1719 ZoneGrowableArray<PushArgumentInstr*>* arguments_;
1670 1720
1671 DISALLOW_COPY_AND_ASSIGN(ClosureCallInstr); 1721 DISALLOW_COPY_AND_ASSIGN(ClosureCallInstr);
1672 }; 1722 };
1673 1723
1674 1724
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 1762 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
1713 PushArgumentInstr* ArgumentAt(intptr_t index) const { 1763 PushArgumentInstr* ArgumentAt(intptr_t index) const {
1714 return (*arguments_)[index]; 1764 return (*arguments_)[index];
1715 } 1765 }
1716 const Array& argument_names() const { return argument_names_; } 1766 const Array& argument_names() const { return argument_names_; }
1717 intptr_t checked_argument_count() const { return checked_argument_count_; } 1767 intptr_t checked_argument_count() const { return checked_argument_count_; }
1718 1768
1719 virtual void PrintOperandsTo(BufferFormatter* f) const; 1769 virtual void PrintOperandsTo(BufferFormatter* f) const;
1720 1770
1721 virtual bool CanDeoptimize() const { return true; } 1771 virtual bool CanDeoptimize() const { return true; }
1772
1773 virtual bool HasSideEffect() const { return true; }
1774
1722 virtual intptr_t ResultCid() const { return kDynamicCid; } 1775 virtual intptr_t ResultCid() const { return kDynamicCid; }
1723 1776
1724 private: 1777 private:
1725 const ICData* ic_data_; 1778 const ICData* ic_data_;
1726 const intptr_t token_pos_; 1779 const intptr_t token_pos_;
1727 const String& function_name_; 1780 const String& function_name_;
1728 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. 1781 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL.
1729 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; 1782 ZoneGrowableArray<PushArgumentInstr*>* const arguments_;
1730 const Array& argument_names_; 1783 const Array& argument_names_;
1731 const intptr_t checked_argument_count_; 1784 const intptr_t checked_argument_count_;
(...skipping 22 matching lines...) Expand all
1754 PushArgumentInstr* ArgumentAt(intptr_t index) const { 1807 PushArgumentInstr* ArgumentAt(intptr_t index) const {
1755 return instance_call()->ArgumentAt(index); 1808 return instance_call()->ArgumentAt(index);
1756 } 1809 }
1757 1810
1758 DECLARE_INSTRUCTION(PolymorphicInstanceCall) 1811 DECLARE_INSTRUCTION(PolymorphicInstanceCall)
1759 virtual RawAbstractType* CompileType() const; 1812 virtual RawAbstractType* CompileType() const;
1760 1813
1761 const ICData& ic_data() const { return ic_data_; } 1814 const ICData& ic_data() const { return ic_data_; }
1762 1815
1763 virtual bool CanDeoptimize() const { return true; } 1816 virtual bool CanDeoptimize() const { return true; }
1817
1818 virtual bool HasSideEffect() const { return true; }
1819
1764 virtual intptr_t ResultCid() const { return kDynamicCid; } 1820 virtual intptr_t ResultCid() const { return kDynamicCid; }
1765 1821
1766 virtual void PrintOperandsTo(BufferFormatter* f) const; 1822 virtual void PrintOperandsTo(BufferFormatter* f) const;
1767 1823
1768 private: 1824 private:
1769 InstanceCallInstr* instance_call_; 1825 InstanceCallInstr* instance_call_;
1770 const ICData& ic_data_; 1826 const ICData& ic_data_;
1771 const bool with_checks_; 1827 const bool with_checks_;
1772 1828
1773 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr); 1829 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 inline void BranchInstr::SetInputAt(intptr_t i, Value* value) { 1873 inline void BranchInstr::SetInputAt(intptr_t i, Value* value) {
1818 comparison()->SetInputAt(i, value); 1874 comparison()->SetInputAt(i, value);
1819 } 1875 }
1820 1876
1821 1877
1822 inline bool BranchInstr::CanDeoptimize() const { 1878 inline bool BranchInstr::CanDeoptimize() const {
1823 return comparison()->CanDeoptimize(); 1879 return comparison()->CanDeoptimize();
1824 } 1880 }
1825 1881
1826 1882
1883 inline bool BranchInstr::HasSideEffect() const {
1884 return comparison()->HasSideEffect();
1885 }
1886
1887
1827 inline LocationSummary* BranchInstr::locs() { 1888 inline LocationSummary* BranchInstr::locs() {
1828 if (comparison()->locs_ == NULL) { 1889 if (comparison()->locs_ == NULL) {
1829 LocationSummary* summary = comparison()->MakeLocationSummary(); 1890 LocationSummary* summary = comparison()->MakeLocationSummary();
1830 // Branches don't produce a result. 1891 // Branches don't produce a result.
1831 summary->set_out(Location::NoLocation()); 1892 summary->set_out(Location::NoLocation());
1832 comparison()->locs_ = summary; 1893 comparison()->locs_ = summary;
1833 } 1894 }
1834 return comparison()->locs_; 1895 return comparison()->locs_;
1835 } 1896 }
1836 1897
(...skipping 16 matching lines...) Expand all
1853 ASSERT((kind == Token::kEQ_STRICT) || (kind == Token::kNE_STRICT)); 1914 ASSERT((kind == Token::kEQ_STRICT) || (kind == Token::kNE_STRICT));
1854 } 1915 }
1855 1916
1856 DECLARE_INSTRUCTION(StrictCompare) 1917 DECLARE_INSTRUCTION(StrictCompare)
1857 virtual RawAbstractType* CompileType() const; 1918 virtual RawAbstractType* CompileType() const;
1858 1919
1859 virtual void PrintOperandsTo(BufferFormatter* f) const; 1920 virtual void PrintOperandsTo(BufferFormatter* f) const;
1860 1921
1861 virtual bool CanDeoptimize() const { return false; } 1922 virtual bool CanDeoptimize() const { return false; }
1862 1923
1924 virtual bool HasSideEffect() const { return false; }
1925
1926 virtual bool AttributesEqual(Definition* other) const;
1927 virtual bool AffectedBySideEffect() const { return false; }
1928
1863 virtual Definition* Canonicalize(); 1929 virtual Definition* Canonicalize();
1864 1930
1865 virtual intptr_t ResultCid() const { return kBoolCid; } 1931 virtual intptr_t ResultCid() const { return kBoolCid; }
1866 1932
1867 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 1933 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
1868 BranchInstr* branch); 1934 BranchInstr* branch);
1869 1935
1870 private: 1936 private:
1871 DISALLOW_COPY_AND_ASSIGN(StrictCompareInstr); 1937 DISALLOW_COPY_AND_ASSIGN(StrictCompareInstr);
1872 }; 1938 };
(...skipping 25 matching lines...) Expand all
1898 // Receiver class id is computed from collected ICData. 1964 // Receiver class id is computed from collected ICData.
1899 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; } 1965 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; }
1900 intptr_t receiver_class_id() const { return receiver_class_id_; } 1966 intptr_t receiver_class_id() const { return receiver_class_id_; }
1901 1967
1902 virtual void PrintOperandsTo(BufferFormatter* f) const; 1968 virtual void PrintOperandsTo(BufferFormatter* f) const;
1903 1969
1904 virtual bool CanDeoptimize() const { 1970 virtual bool CanDeoptimize() const {
1905 return (receiver_class_id() != kDoubleCid) 1971 return (receiver_class_id() != kDoubleCid)
1906 && (receiver_class_id() != kSmiCid); 1972 && (receiver_class_id() != kSmiCid);
1907 } 1973 }
1974 virtual bool HasSideEffect() const {
1975 return (receiver_class_id() != kDoubleCid)
1976 && (receiver_class_id() != kSmiCid);
1977 }
1908 1978
1909 virtual intptr_t ResultCid() const; 1979 virtual intptr_t ResultCid() const;
1910 1980
1911 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 1981 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
1912 BranchInstr* branch); 1982 BranchInstr* branch);
1913 1983
1914 virtual intptr_t DeoptimizationTarget() const { 1984 virtual intptr_t DeoptimizationTarget() const {
1915 return GetDeoptId(); 1985 return GetDeoptId();
1916 } 1986 }
1917 1987
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1959 } 2029 }
1960 2030
1961 intptr_t operands_class_id() const { return operands_class_id_; } 2031 intptr_t operands_class_id() const { return operands_class_id_; }
1962 2032
1963 virtual void PrintOperandsTo(BufferFormatter* f) const; 2033 virtual void PrintOperandsTo(BufferFormatter* f) const;
1964 2034
1965 virtual bool CanDeoptimize() const { 2035 virtual bool CanDeoptimize() const {
1966 return (operands_class_id() != kDoubleCid) 2036 return (operands_class_id() != kDoubleCid)
1967 && (operands_class_id() != kSmiCid); 2037 && (operands_class_id() != kSmiCid);
1968 } 2038 }
2039 virtual bool HasSideEffect() const {
2040 return (operands_class_id() != kDoubleCid)
2041 && (operands_class_id() != kSmiCid);
2042 }
1969 2043
1970 virtual intptr_t ResultCid() const; 2044 virtual intptr_t ResultCid() const;
1971 2045
1972 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 2046 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
1973 BranchInstr* branch); 2047 BranchInstr* branch);
1974 2048
1975 2049
1976 virtual intptr_t DeoptimizationTarget() const { 2050 virtual intptr_t DeoptimizationTarget() const {
1977 return GetDeoptId(); 2051 return GetDeoptId();
1978 } 2052 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2015 intptr_t token_pos() const { return token_pos_; } 2089 intptr_t token_pos() const { return token_pos_; }
2016 2090
2017 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 2091 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
2018 PushArgumentInstr* ArgumentAt(intptr_t index) const { 2092 PushArgumentInstr* ArgumentAt(intptr_t index) const {
2019 return (*arguments_)[index]; 2093 return (*arguments_)[index];
2020 } 2094 }
2021 2095
2022 virtual void PrintOperandsTo(BufferFormatter* f) const; 2096 virtual void PrintOperandsTo(BufferFormatter* f) const;
2023 2097
2024 virtual bool CanDeoptimize() const { return true; } 2098 virtual bool CanDeoptimize() const { return true; }
2099
2100 virtual bool HasSideEffect() const { return true; }
2101
2025 virtual intptr_t ResultCid() const { return result_cid_; } 2102 virtual intptr_t ResultCid() const { return result_cid_; }
2026 void set_result_cid(intptr_t value) { result_cid_ = value; } 2103 void set_result_cid(intptr_t value) { result_cid_ = value; }
2027 2104
2028 private: 2105 private:
2029 const intptr_t token_pos_; 2106 const intptr_t token_pos_;
2030 const Function& function_; 2107 const Function& function_;
2031 const Array& argument_names_; 2108 const Array& argument_names_;
2032 ZoneGrowableArray<PushArgumentInstr*>* arguments_; 2109 ZoneGrowableArray<PushArgumentInstr*>* arguments_;
2033 intptr_t result_cid_; // For some library functions we know the result. 2110 intptr_t result_cid_; // For some library functions we know the result.
2034 2111
2035 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); 2112 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr);
2036 }; 2113 };
2037 2114
2038 2115
2039 class LoadLocalInstr : public TemplateDefinition<0> { 2116 class LoadLocalInstr : public TemplateDefinition<0> {
2040 public: 2117 public:
2041 LoadLocalInstr(const LocalVariable& local, intptr_t context_level) 2118 LoadLocalInstr(const LocalVariable& local, intptr_t context_level)
2042 : local_(local), 2119 : local_(local),
2043 context_level_(context_level) { } 2120 context_level_(context_level) { }
2044 2121
2045 DECLARE_INSTRUCTION(LoadLocal) 2122 DECLARE_INSTRUCTION(LoadLocal)
2046 virtual RawAbstractType* CompileType() const; 2123 virtual RawAbstractType* CompileType() const;
2047 2124
2048 const LocalVariable& local() const { return local_; } 2125 const LocalVariable& local() const { return local_; }
2049 intptr_t context_level() const { return context_level_; } 2126 intptr_t context_level() const { return context_level_; }
2050 2127
2051 virtual void PrintOperandsTo(BufferFormatter* f) const; 2128 virtual void PrintOperandsTo(BufferFormatter* f) const;
2052 2129
2053 virtual bool CanDeoptimize() const { return false; } 2130 virtual bool CanDeoptimize() const { return false; }
2131
2132 virtual bool HasSideEffect() const {
2133 UNREACHABLE();
2134 return false;
2135 }
2136
2054 virtual intptr_t ResultCid() const { return kDynamicCid; } 2137 virtual intptr_t ResultCid() const { return kDynamicCid; }
2055 2138
2056 private: 2139 private:
2057 const LocalVariable& local_; 2140 const LocalVariable& local_;
2058 const intptr_t context_level_; 2141 const intptr_t context_level_;
2059 2142
2060 DISALLOW_COPY_AND_ASSIGN(LoadLocalInstr); 2143 DISALLOW_COPY_AND_ASSIGN(LoadLocalInstr);
2061 }; 2144 };
2062 2145
2063 2146
(...skipping 14 matching lines...) Expand all
2078 const LocalVariable& local() const { return local_; } 2161 const LocalVariable& local() const { return local_; }
2079 Value* value() const { return inputs_[0]; } 2162 Value* value() const { return inputs_[0]; }
2080 intptr_t context_level() const { return context_level_; } 2163 intptr_t context_level() const { return context_level_; }
2081 2164
2082 virtual void RecordAssignedVars(BitVector* assigned_vars, 2165 virtual void RecordAssignedVars(BitVector* assigned_vars,
2083 intptr_t fixed_parameter_count); 2166 intptr_t fixed_parameter_count);
2084 2167
2085 virtual void PrintOperandsTo(BufferFormatter* f) const; 2168 virtual void PrintOperandsTo(BufferFormatter* f) const;
2086 2169
2087 virtual bool CanDeoptimize() const { return false; } 2170 virtual bool CanDeoptimize() const { return false; }
2171
2172 virtual bool HasSideEffect() const {
2173 UNREACHABLE();
2174 return false;
2175 }
2176
2088 virtual intptr_t ResultCid() const { return kDynamicCid; } 2177 virtual intptr_t ResultCid() const { return kDynamicCid; }
2089 2178
2090 private: 2179 private:
2091 const LocalVariable& local_; 2180 const LocalVariable& local_;
2092 const intptr_t context_level_; 2181 const intptr_t context_level_;
2093 2182
2094 DISALLOW_COPY_AND_ASSIGN(StoreLocalInstr); 2183 DISALLOW_COPY_AND_ASSIGN(StoreLocalInstr);
2095 }; 2184 };
2096 2185
2097 2186
(...skipping 21 matching lines...) Expand all
2119 return ast_node_.has_optional_parameters(); 2208 return ast_node_.has_optional_parameters();
2120 } 2209 }
2121 2210
2122 bool is_native_instance_closure() const { 2211 bool is_native_instance_closure() const {
2123 return ast_node_.is_native_instance_closure(); 2212 return ast_node_.is_native_instance_closure();
2124 } 2213 }
2125 2214
2126 virtual void PrintOperandsTo(BufferFormatter* f) const; 2215 virtual void PrintOperandsTo(BufferFormatter* f) const;
2127 2216
2128 virtual bool CanDeoptimize() const { return false; } 2217 virtual bool CanDeoptimize() const { return false; }
2218
2219 virtual bool HasSideEffect() const { return true; }
2220
2129 virtual intptr_t ResultCid() const { return kDynamicCid; } 2221 virtual intptr_t ResultCid() const { return kDynamicCid; }
2130 2222
2131 private: 2223 private:
2132 const NativeBodyNode& ast_node_; 2224 const NativeBodyNode& ast_node_;
2133 2225
2134 DISALLOW_COPY_AND_ASSIGN(NativeCallInstr); 2226 DISALLOW_COPY_AND_ASSIGN(NativeCallInstr);
2135 }; 2227 };
2136 2228
2137 2229
2138 class StoreInstanceFieldInstr : public TemplateDefinition<2> { 2230 class StoreInstanceFieldInstr : public TemplateDefinition<2> {
(...skipping 16 matching lines...) Expand all
2155 2247
2156 Value* instance() const { return inputs_[0]; } 2248 Value* instance() const { return inputs_[0]; }
2157 Value* value() const { return inputs_[1]; } 2249 Value* value() const { return inputs_[1]; }
2158 bool ShouldEmitStoreBarrier() const { 2250 bool ShouldEmitStoreBarrier() const {
2159 return value()->NeedsStoreBuffer() && emit_store_barrier_; 2251 return value()->NeedsStoreBuffer() && emit_store_barrier_;
2160 } 2252 }
2161 2253
2162 virtual void PrintOperandsTo(BufferFormatter* f) const; 2254 virtual void PrintOperandsTo(BufferFormatter* f) const;
2163 2255
2164 virtual bool CanDeoptimize() const { return false; } 2256 virtual bool CanDeoptimize() const { return false; }
2257
2258 virtual bool HasSideEffect() const { return true; }
2259
2165 virtual intptr_t ResultCid() const { return kDynamicCid; } 2260 virtual intptr_t ResultCid() const { return kDynamicCid; }
2166 2261
2167 private: 2262 private:
2168 const Field& field_; 2263 const Field& field_;
2169 const bool emit_store_barrier_; 2264 const bool emit_store_barrier_;
2170 2265
2171 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); 2266 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr);
2172 }; 2267 };
2173 2268
2174 2269
2175 class LoadStaticFieldInstr : public TemplateDefinition<0> { 2270 class LoadStaticFieldInstr : public TemplateDefinition<0> {
2176 public: 2271 public:
2177 explicit LoadStaticFieldInstr(const Field& field) : field_(field) {} 2272 explicit LoadStaticFieldInstr(const Field& field) : field_(field) {}
2178 2273
2179 DECLARE_INSTRUCTION(LoadStaticField); 2274 DECLARE_INSTRUCTION(LoadStaticField);
2180 virtual RawAbstractType* CompileType() const; 2275 virtual RawAbstractType* CompileType() const;
2181 2276
2182 const Field& field() const { return field_; } 2277 const Field& field() const { return field_; }
2183 2278
2184 virtual void PrintOperandsTo(BufferFormatter* f) const; 2279 virtual void PrintOperandsTo(BufferFormatter* f) const;
2185 2280
2186 virtual bool CanDeoptimize() const { return false; } 2281 virtual bool CanDeoptimize() const { return false; }
2282
2283 virtual bool HasSideEffect() const { return false; }
2284
2187 virtual intptr_t ResultCid() const { return kDynamicCid; } 2285 virtual intptr_t ResultCid() const { return kDynamicCid; }
2188 2286
2189 virtual bool AffectedBySideEffect() const { return !field().is_final(); } 2287 virtual bool AffectedBySideEffect() const { return !field().is_final(); }
2190 virtual bool AttributesEqual(Definition* other) const; 2288 virtual bool AttributesEqual(Definition* other) const;
2191 2289
2192 private: 2290 private:
2193 const Field& field_; 2291 const Field& field_;
2194 2292
2195 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); 2293 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr);
2196 }; 2294 };
(...skipping 10 matching lines...) Expand all
2207 2305
2208 DECLARE_INSTRUCTION(StoreStaticField); 2306 DECLARE_INSTRUCTION(StoreStaticField);
2209 virtual RawAbstractType* CompileType() const; 2307 virtual RawAbstractType* CompileType() const;
2210 2308
2211 const Field& field() const { return field_; } 2309 const Field& field() const { return field_; }
2212 Value* value() const { return inputs_[0]; } 2310 Value* value() const { return inputs_[0]; }
2213 2311
2214 virtual void PrintOperandsTo(BufferFormatter* f) const; 2312 virtual void PrintOperandsTo(BufferFormatter* f) const;
2215 2313
2216 virtual bool CanDeoptimize() const { return false; } 2314 virtual bool CanDeoptimize() const { return false; }
2315
2316 virtual bool HasSideEffect() const { return true; }
2317
2217 virtual intptr_t ResultCid() const { return kDynamicCid; } 2318 virtual intptr_t ResultCid() const { return kDynamicCid; }
2218 2319
2219 private: 2320 private:
2220 const Field& field_; 2321 const Field& field_;
2221 2322
2222 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr); 2323 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr);
2223 }; 2324 };
2224 2325
2225 2326
2226 class LoadIndexedInstr : public TemplateDefinition<2> { 2327 class LoadIndexedInstr : public TemplateDefinition<2> {
2227 public: 2328 public:
2228 LoadIndexedInstr(Value* array, Value* index) { 2329 LoadIndexedInstr(Value* array, Value* index) {
2229 ASSERT(array != NULL); 2330 ASSERT(array != NULL);
2230 ASSERT(index != NULL); 2331 ASSERT(index != NULL);
2231 inputs_[0] = array; 2332 inputs_[0] = array;
2232 inputs_[1] = index; 2333 inputs_[1] = index;
2233 } 2334 }
2234 2335
2235 DECLARE_INSTRUCTION(LoadIndexed) 2336 DECLARE_INSTRUCTION(LoadIndexed)
2236 virtual RawAbstractType* CompileType() const; 2337 virtual RawAbstractType* CompileType() const;
2237 2338
2238 Value* array() const { return inputs_[0]; } 2339 Value* array() const { return inputs_[0]; }
2239 Value* index() const { return inputs_[1]; } 2340 Value* index() const { return inputs_[1]; }
2240 2341
2241 virtual bool CanDeoptimize() const { return false; } 2342 virtual bool CanDeoptimize() const { return false; }
2343
2344 virtual bool HasSideEffect() const { return false; }
2345
2242 virtual intptr_t ResultCid() const { return kDynamicCid; } 2346 virtual intptr_t ResultCid() const { return kDynamicCid; }
2243 2347
2244 private: 2348 private:
2245 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr); 2349 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr);
2246 }; 2350 };
2247 2351
2248 2352
2249 class StoreIndexedInstr : public TemplateDefinition<3> { 2353 class StoreIndexedInstr : public TemplateDefinition<3> {
2250 public: 2354 public:
2251 StoreIndexedInstr(Value* array, 2355 StoreIndexedInstr(Value* array,
(...skipping 14 matching lines...) Expand all
2266 2370
2267 Value* array() const { return inputs_[0]; } 2371 Value* array() const { return inputs_[0]; }
2268 Value* index() const { return inputs_[1]; } 2372 Value* index() const { return inputs_[1]; }
2269 Value* value() const { return inputs_[2]; } 2373 Value* value() const { return inputs_[2]; }
2270 2374
2271 bool ShouldEmitStoreBarrier() const { 2375 bool ShouldEmitStoreBarrier() const {
2272 return value()->NeedsStoreBuffer() && emit_store_barrier_; 2376 return value()->NeedsStoreBuffer() && emit_store_barrier_;
2273 } 2377 }
2274 2378
2275 virtual bool CanDeoptimize() const { return false; } 2379 virtual bool CanDeoptimize() const { return false; }
2380
2381 virtual bool HasSideEffect() const { return true; }
2382
2276 virtual intptr_t ResultCid() const { return kDynamicCid; } 2383 virtual intptr_t ResultCid() const { return kDynamicCid; }
2277 2384
2278 private: 2385 private:
2279 const bool emit_store_barrier_; 2386 const bool emit_store_barrier_;
2280 2387
2281 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); 2388 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr);
2282 }; 2389 };
2283 2390
2284 2391
2285 // Note overrideable, built-in: value? false : true. 2392 // Note overrideable, built-in: value? false : true.
2286 class BooleanNegateInstr : public TemplateDefinition<1> { 2393 class BooleanNegateInstr : public TemplateDefinition<1> {
2287 public: 2394 public:
2288 explicit BooleanNegateInstr(Value* value) { 2395 explicit BooleanNegateInstr(Value* value) {
2289 ASSERT(value != NULL); 2396 ASSERT(value != NULL);
2290 inputs_[0] = value; 2397 inputs_[0] = value;
2291 } 2398 }
2292 2399
2293 DECLARE_INSTRUCTION(BooleanNegate) 2400 DECLARE_INSTRUCTION(BooleanNegate)
2294 virtual RawAbstractType* CompileType() const; 2401 virtual RawAbstractType* CompileType() const;
2295 2402
2296 Value* value() const { return inputs_[0]; } 2403 Value* value() const { return inputs_[0]; }
2297 2404
2298 virtual bool CanDeoptimize() const { return false; } 2405 virtual bool CanDeoptimize() const { return false; }
2406
2407 virtual bool HasSideEffect() const { return false; }
2408
2299 virtual intptr_t ResultCid() const { return kBoolCid; } 2409 virtual intptr_t ResultCid() const { return kBoolCid; }
2300 2410
2301 private: 2411 private:
2302 DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr); 2412 DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr);
2303 }; 2413 };
2304 2414
2305 2415
2306 class InstanceOfInstr : public TemplateDefinition<3> { 2416 class InstanceOfInstr : public TemplateDefinition<3> {
2307 public: 2417 public:
2308 InstanceOfInstr(intptr_t token_pos, 2418 InstanceOfInstr(intptr_t token_pos,
(...skipping 21 matching lines...) Expand all
2330 Value* instantiator() const { return inputs_[1]; } 2440 Value* instantiator() const { return inputs_[1]; }
2331 Value* instantiator_type_arguments() const { return inputs_[2]; } 2441 Value* instantiator_type_arguments() const { return inputs_[2]; }
2332 2442
2333 bool negate_result() const { return negate_result_; } 2443 bool negate_result() const { return negate_result_; }
2334 const AbstractType& type() const { return type_; } 2444 const AbstractType& type() const { return type_; }
2335 intptr_t token_pos() const { return token_pos_; } 2445 intptr_t token_pos() const { return token_pos_; }
2336 2446
2337 virtual void PrintOperandsTo(BufferFormatter* f) const; 2447 virtual void PrintOperandsTo(BufferFormatter* f) const;
2338 2448
2339 virtual bool CanDeoptimize() const { return false; } 2449 virtual bool CanDeoptimize() const { return false; }
2450
2451 virtual bool HasSideEffect() const { return true; }
2452
2340 virtual intptr_t ResultCid() const { return kBoolCid; } 2453 virtual intptr_t ResultCid() const { return kBoolCid; }
2341 2454
2342 private: 2455 private:
2343 const intptr_t token_pos_; 2456 const intptr_t token_pos_;
2344 Value* value_; 2457 Value* value_;
2345 Value* instantiator_; 2458 Value* instantiator_;
2346 Value* type_arguments_; 2459 Value* type_arguments_;
2347 const AbstractType& type_; 2460 const AbstractType& type_;
2348 const bool negate_result_; 2461 const bool negate_result_;
2349 2462
(...skipping 17 matching lines...) Expand all
2367 PushArgumentInstr* ArgumentAt(intptr_t index) const { 2480 PushArgumentInstr* ArgumentAt(intptr_t index) const {
2368 return (*arguments_)[index]; 2481 return (*arguments_)[index];
2369 } 2482 }
2370 2483
2371 const Function& constructor() const { return ast_node_.constructor(); } 2484 const Function& constructor() const { return ast_node_.constructor(); }
2372 intptr_t token_pos() const { return ast_node_.token_pos(); } 2485 intptr_t token_pos() const { return ast_node_.token_pos(); }
2373 2486
2374 virtual void PrintOperandsTo(BufferFormatter* f) const; 2487 virtual void PrintOperandsTo(BufferFormatter* f) const;
2375 2488
2376 virtual bool CanDeoptimize() const { return false; } 2489 virtual bool CanDeoptimize() const { return false; }
2490
2491 virtual bool HasSideEffect() const { return true; }
2492
2377 virtual intptr_t ResultCid() const { return kDynamicCid; } 2493 virtual intptr_t ResultCid() const { return kDynamicCid; }
2378 2494
2379 private: 2495 private:
2380 const ConstructorCallNode& ast_node_; 2496 const ConstructorCallNode& ast_node_;
2381 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; 2497 ZoneGrowableArray<PushArgumentInstr*>* const arguments_;
2382 2498
2383 DISALLOW_COPY_AND_ASSIGN(AllocateObjectInstr); 2499 DISALLOW_COPY_AND_ASSIGN(AllocateObjectInstr);
2384 }; 2500 };
2385 2501
2386 2502
(...skipping 11 matching lines...) Expand all
2398 2514
2399 DECLARE_INSTRUCTION(AllocateObjectWithBoundsCheck) 2515 DECLARE_INSTRUCTION(AllocateObjectWithBoundsCheck)
2400 virtual RawAbstractType* CompileType() const; 2516 virtual RawAbstractType* CompileType() const;
2401 2517
2402 const Function& constructor() const { return ast_node_.constructor(); } 2518 const Function& constructor() const { return ast_node_.constructor(); }
2403 intptr_t token_pos() const { return ast_node_.token_pos(); } 2519 intptr_t token_pos() const { return ast_node_.token_pos(); }
2404 2520
2405 virtual void PrintOperandsTo(BufferFormatter* f) const; 2521 virtual void PrintOperandsTo(BufferFormatter* f) const;
2406 2522
2407 virtual bool CanDeoptimize() const { return false; } 2523 virtual bool CanDeoptimize() const { return false; }
2524
2525 virtual bool HasSideEffect() const { return true; }
2526
2408 virtual intptr_t ResultCid() const { return kDynamicCid; } 2527 virtual intptr_t ResultCid() const { return kDynamicCid; }
2409 2528
2410 private: 2529 private:
2411 const ConstructorCallNode& ast_node_; 2530 const ConstructorCallNode& ast_node_;
2412 2531
2413 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckInstr); 2532 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckInstr);
2414 }; 2533 };
2415 2534
2416 2535
2417 class CreateArrayInstr : public TemplateDefinition<1> { 2536 class CreateArrayInstr : public TemplateDefinition<1> {
(...skipping 23 matching lines...) Expand all
2441 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 2560 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
2442 2561
2443 intptr_t token_pos() const { return token_pos_; } 2562 intptr_t token_pos() const { return token_pos_; }
2444 PushArgumentInstr* ArgumentAt(intptr_t i) const { return (*arguments_)[i]; } 2563 PushArgumentInstr* ArgumentAt(intptr_t i) const { return (*arguments_)[i]; }
2445 const AbstractType& type() const { return type_; } 2564 const AbstractType& type() const { return type_; }
2446 Value* element_type() const { return inputs_[0]; } 2565 Value* element_type() const { return inputs_[0]; }
2447 2566
2448 virtual void PrintOperandsTo(BufferFormatter* f) const; 2567 virtual void PrintOperandsTo(BufferFormatter* f) const;
2449 2568
2450 virtual bool CanDeoptimize() const { return false; } 2569 virtual bool CanDeoptimize() const { return false; }
2570
2571 virtual bool HasSideEffect() const { return true; }
2572
2451 virtual intptr_t ResultCid() const { return kDynamicCid; } 2573 virtual intptr_t ResultCid() const { return kDynamicCid; }
2452 2574
2453 private: 2575 private:
2454 const intptr_t token_pos_; 2576 const intptr_t token_pos_;
2455 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; 2577 ZoneGrowableArray<PushArgumentInstr*>* const arguments_;
2456 const AbstractType& type_; 2578 const AbstractType& type_;
2457 2579
2458 DISALLOW_COPY_AND_ASSIGN(CreateArrayInstr); 2580 DISALLOW_COPY_AND_ASSIGN(CreateArrayInstr);
2459 }; 2581 };
2460 2582
(...skipping 12 matching lines...) Expand all
2473 const Function& function() const { return ast_node_.function(); } 2595 const Function& function() const { return ast_node_.function(); }
2474 2596
2475 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 2597 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
2476 PushArgumentInstr* ArgumentAt(intptr_t index) const { 2598 PushArgumentInstr* ArgumentAt(intptr_t index) const {
2477 return (*arguments_)[index]; 2599 return (*arguments_)[index];
2478 } 2600 }
2479 2601
2480 virtual void PrintOperandsTo(BufferFormatter* f) const; 2602 virtual void PrintOperandsTo(BufferFormatter* f) const;
2481 2603
2482 virtual bool CanDeoptimize() const { return false; } 2604 virtual bool CanDeoptimize() const { return false; }
2605
2606 virtual bool HasSideEffect() const { return true; }
2607
2483 virtual intptr_t ResultCid() const { return kDynamicCid; } 2608 virtual intptr_t ResultCid() const { return kDynamicCid; }
2484 2609
2485 private: 2610 private:
2486 const ClosureNode& ast_node_; 2611 const ClosureNode& ast_node_;
2487 ZoneGrowableArray<PushArgumentInstr*>* arguments_; 2612 ZoneGrowableArray<PushArgumentInstr*>* arguments_;
2488 2613
2489 DISALLOW_COPY_AND_ASSIGN(CreateClosureInstr); 2614 DISALLOW_COPY_AND_ASSIGN(CreateClosureInstr);
2490 }; 2615 };
2491 2616
2492 2617
(...skipping 16 matching lines...) Expand all
2509 virtual RawAbstractType* CompileType() const; 2634 virtual RawAbstractType* CompileType() const;
2510 2635
2511 Value* value() const { return inputs_[0]; } 2636 Value* value() const { return inputs_[0]; }
2512 intptr_t offset_in_bytes() const { return offset_in_bytes_; } 2637 intptr_t offset_in_bytes() const { return offset_in_bytes_; }
2513 const AbstractType& type() const { return type_; } 2638 const AbstractType& type() const { return type_; }
2514 void set_result_cid(intptr_t value) { result_cid_ = value; } 2639 void set_result_cid(intptr_t value) { result_cid_ = value; }
2515 2640
2516 virtual void PrintOperandsTo(BufferFormatter* f) const; 2641 virtual void PrintOperandsTo(BufferFormatter* f) const;
2517 2642
2518 virtual bool CanDeoptimize() const { return false; } 2643 virtual bool CanDeoptimize() const { return false; }
2644
2645 virtual bool HasSideEffect() const { return false; }
2646
2519 virtual intptr_t ResultCid() const { return result_cid_; } 2647 virtual intptr_t ResultCid() const { return result_cid_; }
2520 2648
2521 virtual bool AttributesEqual(Definition* other) const; 2649 virtual bool AttributesEqual(Definition* other) const;
2522 2650
2523 virtual bool AffectedBySideEffect() const { return !immutable_; } 2651 virtual bool AffectedBySideEffect() const { return !immutable_; }
2524 2652
2525 private: 2653 private:
2526 const intptr_t offset_in_bytes_; 2654 const intptr_t offset_in_bytes_;
2527 const AbstractType& type_; 2655 const AbstractType& type_;
2528 intptr_t result_cid_; 2656 intptr_t result_cid_;
(...skipping 21 matching lines...) Expand all
2550 virtual RawAbstractType* CompileType() const; 2678 virtual RawAbstractType* CompileType() const;
2551 2679
2552 Value* value() const { return inputs_[0]; } 2680 Value* value() const { return inputs_[0]; }
2553 Value* dest() const { return inputs_[1]; } 2681 Value* dest() const { return inputs_[1]; }
2554 intptr_t offset_in_bytes() const { return offset_in_bytes_; } 2682 intptr_t offset_in_bytes() const { return offset_in_bytes_; }
2555 const AbstractType& type() const { return type_; } 2683 const AbstractType& type() const { return type_; }
2556 2684
2557 virtual void PrintOperandsTo(BufferFormatter* f) const; 2685 virtual void PrintOperandsTo(BufferFormatter* f) const;
2558 2686
2559 virtual bool CanDeoptimize() const { return false; } 2687 virtual bool CanDeoptimize() const { return false; }
2688
2689 virtual bool HasSideEffect() const { return true; }
2690
2560 virtual intptr_t ResultCid() const { return kDynamicCid; } 2691 virtual intptr_t ResultCid() const { return kDynamicCid; }
2561 2692
2562 private: 2693 private:
2563 const intptr_t offset_in_bytes_; 2694 const intptr_t offset_in_bytes_;
2564 const AbstractType& type_; 2695 const AbstractType& type_;
2565 2696
2566 DISALLOW_COPY_AND_ASSIGN(StoreVMFieldInstr); 2697 DISALLOW_COPY_AND_ASSIGN(StoreVMFieldInstr);
2567 }; 2698 };
2568 2699
2569 2700
(...skipping 14 matching lines...) Expand all
2584 2715
2585 Value* instantiator() const { return inputs_[0]; } 2716 Value* instantiator() const { return inputs_[0]; }
2586 const AbstractTypeArguments& type_arguments() const { 2717 const AbstractTypeArguments& type_arguments() const {
2587 return type_arguments_; 2718 return type_arguments_;
2588 } 2719 }
2589 intptr_t token_pos() const { return token_pos_; } 2720 intptr_t token_pos() const { return token_pos_; }
2590 2721
2591 virtual void PrintOperandsTo(BufferFormatter* f) const; 2722 virtual void PrintOperandsTo(BufferFormatter* f) const;
2592 2723
2593 virtual bool CanDeoptimize() const { return false; } 2724 virtual bool CanDeoptimize() const { return false; }
2725
2726 virtual bool HasSideEffect() const { return true; }
2727
2594 virtual intptr_t ResultCid() const { return kDynamicCid; } 2728 virtual intptr_t ResultCid() const { return kDynamicCid; }
2595 2729
2596 private: 2730 private:
2597 const intptr_t token_pos_; 2731 const intptr_t token_pos_;
2598 const AbstractTypeArguments& type_arguments_; 2732 const AbstractTypeArguments& type_arguments_;
2599 2733
2600 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsInstr); 2734 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsInstr);
2601 }; 2735 };
2602 2736
2603 2737
(...skipping 14 matching lines...) Expand all
2618 2752
2619 Value* instantiator() const { return inputs_[0]; } 2753 Value* instantiator() const { return inputs_[0]; }
2620 const AbstractTypeArguments& type_arguments() const { 2754 const AbstractTypeArguments& type_arguments() const {
2621 return type_arguments_; 2755 return type_arguments_;
2622 } 2756 }
2623 intptr_t token_pos() const { return token_pos_; } 2757 intptr_t token_pos() const { return token_pos_; }
2624 2758
2625 virtual void PrintOperandsTo(BufferFormatter* f) const; 2759 virtual void PrintOperandsTo(BufferFormatter* f) const;
2626 2760
2627 virtual bool CanDeoptimize() const { return false; } 2761 virtual bool CanDeoptimize() const { return false; }
2762
2763 virtual bool HasSideEffect() const { return false; }
2764
2628 virtual intptr_t ResultCid() const { return kDynamicCid; } 2765 virtual intptr_t ResultCid() const { return kDynamicCid; }
2629 2766
2630 private: 2767 private:
2631 const intptr_t token_pos_; 2768 const intptr_t token_pos_;
2632 const AbstractTypeArguments& type_arguments_; 2769 const AbstractTypeArguments& type_arguments_;
2633 2770
2634 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsInstr); 2771 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsInstr);
2635 }; 2772 };
2636 2773
2637 2774
(...skipping 10 matching lines...) Expand all
2648 virtual RawAbstractType* CompileType() const; 2785 virtual RawAbstractType* CompileType() const;
2649 2786
2650 Value* instantiator() const { return inputs_[0]; } 2787 Value* instantiator() const { return inputs_[0]; }
2651 const AbstractTypeArguments& type_arguments() const { 2788 const AbstractTypeArguments& type_arguments() const {
2652 return ast_node_.type_arguments(); 2789 return ast_node_.type_arguments();
2653 } 2790 }
2654 const Function& constructor() const { return ast_node_.constructor(); } 2791 const Function& constructor() const { return ast_node_.constructor(); }
2655 intptr_t token_pos() const { return ast_node_.token_pos(); } 2792 intptr_t token_pos() const { return ast_node_.token_pos(); }
2656 2793
2657 virtual bool CanDeoptimize() const { return false; } 2794 virtual bool CanDeoptimize() const { return false; }
2795
2796 virtual bool HasSideEffect() const { return false; }
2797
2658 virtual intptr_t ResultCid() const { return kDynamicCid; } 2798 virtual intptr_t ResultCid() const { return kDynamicCid; }
2659 2799
2660 private: 2800 private:
2661 const ConstructorCallNode& ast_node_; 2801 const ConstructorCallNode& ast_node_;
2662 2802
2663 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorInstantiatorInstr); 2803 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorInstantiatorInstr);
2664 }; 2804 };
2665 2805
2666 2806
2667 class AllocateContextInstr : public TemplateDefinition<0> { 2807 class AllocateContextInstr : public TemplateDefinition<0> {
2668 public: 2808 public:
2669 AllocateContextInstr(intptr_t token_pos, 2809 AllocateContextInstr(intptr_t token_pos,
2670 intptr_t num_context_variables) 2810 intptr_t num_context_variables)
2671 : token_pos_(token_pos), 2811 : token_pos_(token_pos),
2672 num_context_variables_(num_context_variables) {} 2812 num_context_variables_(num_context_variables) {}
2673 2813
2674 DECLARE_INSTRUCTION(AllocateContext); 2814 DECLARE_INSTRUCTION(AllocateContext);
2675 virtual RawAbstractType* CompileType() const; 2815 virtual RawAbstractType* CompileType() const;
2676 2816
2677 intptr_t token_pos() const { return token_pos_; } 2817 intptr_t token_pos() const { return token_pos_; }
2678 intptr_t num_context_variables() const { return num_context_variables_; } 2818 intptr_t num_context_variables() const { return num_context_variables_; }
2679 2819
2680 virtual void PrintOperandsTo(BufferFormatter* f) const; 2820 virtual void PrintOperandsTo(BufferFormatter* f) const;
2681 2821
2682 virtual bool CanDeoptimize() const { return false; } 2822 virtual bool CanDeoptimize() const { return false; }
2823
2824 virtual bool HasSideEffect() const { return false; }
2825
2683 virtual intptr_t ResultCid() const { return kDynamicCid; } 2826 virtual intptr_t ResultCid() const { return kDynamicCid; }
2684 2827
2685 private: 2828 private:
2686 const intptr_t token_pos_; 2829 const intptr_t token_pos_;
2687 const intptr_t num_context_variables_; 2830 const intptr_t num_context_variables_;
2688 2831
2689 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr); 2832 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr);
2690 }; 2833 };
2691 2834
2692 2835
2693 class ChainContextInstr : public TemplateDefinition<1> { 2836 class ChainContextInstr : public TemplateDefinition<1> {
2694 public: 2837 public:
2695 explicit ChainContextInstr(Value* context_value) { 2838 explicit ChainContextInstr(Value* context_value) {
2696 ASSERT(context_value != NULL); 2839 ASSERT(context_value != NULL);
2697 inputs_[0] = context_value; 2840 inputs_[0] = context_value;
2698 } 2841 }
2699 2842
2700 DECLARE_INSTRUCTION(ChainContext) 2843 DECLARE_INSTRUCTION(ChainContext)
2701 virtual RawAbstractType* CompileType() const; 2844 virtual RawAbstractType* CompileType() const;
2702 2845
2703 Value* context_value() const { return inputs_[0]; } 2846 Value* context_value() const { return inputs_[0]; }
2704 2847
2705 virtual bool CanDeoptimize() const { return false; } 2848 virtual bool CanDeoptimize() const { return false; }
2849
2850 virtual bool HasSideEffect() const { return true; }
2851
2706 virtual intptr_t ResultCid() const { return kIllegalCid; } 2852 virtual intptr_t ResultCid() const { return kIllegalCid; }
2707 2853
2708 private: 2854 private:
2709 DISALLOW_COPY_AND_ASSIGN(ChainContextInstr); 2855 DISALLOW_COPY_AND_ASSIGN(ChainContextInstr);
2710 }; 2856 };
2711 2857
2712 2858
2713 class CloneContextInstr : public TemplateDefinition<1> { 2859 class CloneContextInstr : public TemplateDefinition<1> {
2714 public: 2860 public:
2715 CloneContextInstr(intptr_t token_pos, Value* context_value) 2861 CloneContextInstr(intptr_t token_pos, Value* context_value)
2716 : token_pos_(token_pos) { 2862 : token_pos_(token_pos) {
2717 ASSERT(context_value != NULL); 2863 ASSERT(context_value != NULL);
2718 inputs_[0] = context_value; 2864 inputs_[0] = context_value;
2719 } 2865 }
2720 2866
2721 intptr_t token_pos() const { return token_pos_; } 2867 intptr_t token_pos() const { return token_pos_; }
2722 Value* context_value() const { return inputs_[0]; } 2868 Value* context_value() const { return inputs_[0]; }
2723 2869
2724 DECLARE_INSTRUCTION(CloneContext) 2870 DECLARE_INSTRUCTION(CloneContext)
2725 virtual RawAbstractType* CompileType() const; 2871 virtual RawAbstractType* CompileType() const;
2726 2872
2727 virtual bool CanDeoptimize() const { return false; } 2873 virtual bool CanDeoptimize() const { return false; }
2874
2875 virtual bool HasSideEffect() const { return false; }
2876
2728 virtual intptr_t ResultCid() const { return kIllegalCid; } 2877 virtual intptr_t ResultCid() const { return kIllegalCid; }
2729 2878
2730 private: 2879 private:
2731 const intptr_t token_pos_; 2880 const intptr_t token_pos_;
2732 2881
2733 DISALLOW_COPY_AND_ASSIGN(CloneContextInstr); 2882 DISALLOW_COPY_AND_ASSIGN(CloneContextInstr);
2734 }; 2883 };
2735 2884
2736 2885
2737 class CatchEntryInstr : public TemplateDefinition<0> { 2886 class CatchEntryInstr : public TemplateDefinition<0> {
2738 public: 2887 public:
2739 CatchEntryInstr(const LocalVariable& exception_var, 2888 CatchEntryInstr(const LocalVariable& exception_var,
2740 const LocalVariable& stacktrace_var) 2889 const LocalVariable& stacktrace_var)
2741 : exception_var_(exception_var), stacktrace_var_(stacktrace_var) {} 2890 : exception_var_(exception_var), stacktrace_var_(stacktrace_var) {}
2742 2891
2743 const LocalVariable& exception_var() const { return exception_var_; } 2892 const LocalVariable& exception_var() const { return exception_var_; }
2744 const LocalVariable& stacktrace_var() const { return stacktrace_var_; } 2893 const LocalVariable& stacktrace_var() const { return stacktrace_var_; }
2745 2894
2746 DECLARE_INSTRUCTION(CatchEntry) 2895 DECLARE_INSTRUCTION(CatchEntry)
2747 virtual RawAbstractType* CompileType() const; 2896 virtual RawAbstractType* CompileType() const;
2748 2897
2749 virtual void PrintOperandsTo(BufferFormatter* f) const; 2898 virtual void PrintOperandsTo(BufferFormatter* f) const;
2750 2899
2751 virtual bool CanDeoptimize() const { return false; } 2900 virtual bool CanDeoptimize() const { return false; }
2901
2902 virtual bool HasSideEffect() const { return true; }
2903
2752 virtual intptr_t ResultCid() const { return kIllegalCid; } 2904 virtual intptr_t ResultCid() const { return kIllegalCid; }
2753 2905
2754 private: 2906 private:
2755 const LocalVariable& exception_var_; 2907 const LocalVariable& exception_var_;
2756 const LocalVariable& stacktrace_var_; 2908 const LocalVariable& stacktrace_var_;
2757 2909
2758 DISALLOW_COPY_AND_ASSIGN(CatchEntryInstr); 2910 DISALLOW_COPY_AND_ASSIGN(CatchEntryInstr);
2759 }; 2911 };
2760 2912
2761 2913
2762 class CheckEitherNonSmiInstr : public TemplateDefinition<2> { 2914 class CheckEitherNonSmiInstr : public TemplateDefinition<2> {
2763 public: 2915 public:
2764 CheckEitherNonSmiInstr(Value* left, 2916 CheckEitherNonSmiInstr(Value* left,
2765 Value* right, 2917 Value* right,
2766 InstanceCallInstr* instance_call) { 2918 InstanceCallInstr* instance_call) {
2767 ASSERT(left != NULL); 2919 ASSERT(left != NULL);
2768 ASSERT(right != NULL); 2920 ASSERT(right != NULL);
2769 inputs_[0] = left; 2921 inputs_[0] = left;
2770 inputs_[1] = right; 2922 inputs_[1] = right;
2771 deopt_id_ = instance_call->deopt_id(); 2923 deopt_id_ = instance_call->deopt_id();
2772 } 2924 }
2773 2925
2774 DECLARE_INSTRUCTION(CheckEitherNonSmi) 2926 DECLARE_INSTRUCTION(CheckEitherNonSmi)
2775 virtual RawAbstractType* CompileType() const; 2927 virtual RawAbstractType* CompileType() const;
2776 2928
2777 virtual bool CanDeoptimize() const { return true; } 2929 virtual bool CanDeoptimize() const { return true; }
2930
2931 virtual bool HasSideEffect() const { return false; }
2932
2778 virtual intptr_t ResultCid() const { return kIllegalCid; } 2933 virtual intptr_t ResultCid() const { return kIllegalCid; }
2779 2934
2780 virtual bool AttributesEqual(Definition* other) const { return true; } 2935 virtual bool AttributesEqual(Definition* other) const { return true; }
2781 2936
2782 virtual bool AffectedBySideEffect() const { return false; } 2937 virtual bool AffectedBySideEffect() const { return false; }
2783 2938
2784 Value* left() const { return inputs_[0]; } 2939 Value* left() const { return inputs_[0]; }
2785 2940
2786 Value* right() const { return inputs_[1]; } 2941 Value* right() const { return inputs_[1]; }
2787 2942
(...skipping 10 matching lines...) Expand all
2798 : token_pos_((instance_call != NULL) ? instance_call->token_pos() : 0) { 2953 : token_pos_((instance_call != NULL) ? instance_call->token_pos() : 0) {
2799 ASSERT(value != NULL); 2954 ASSERT(value != NULL);
2800 inputs_[0] = value; 2955 inputs_[0] = value;
2801 } 2956 }
2802 2957
2803 Value* value() const { return inputs_[0]; } 2958 Value* value() const { return inputs_[0]; }
2804 2959
2805 intptr_t token_pos() const { return token_pos_; } 2960 intptr_t token_pos() const { return token_pos_; }
2806 2961
2807 virtual bool CanDeoptimize() const { return false; } 2962 virtual bool CanDeoptimize() const { return false; }
2963
2964 virtual bool HasSideEffect() const { return false; }
2965
2808 virtual bool AffectedBySideEffect() const { return false; } 2966 virtual bool AffectedBySideEffect() const { return false; }
2809 virtual bool AttributesEqual(Definition* other) const { return true; } 2967 virtual bool AttributesEqual(Definition* other) const { return true; }
2810 2968
2811 virtual intptr_t ResultCid() const; 2969 virtual intptr_t ResultCid() const;
2812 2970
2813 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 2971 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
2814 ASSERT(idx == 0); 2972 ASSERT(idx == 0);
2815 return kUnboxedDouble; 2973 return kUnboxedDouble;
2816 } 2974 }
2817 2975
(...skipping 14 matching lines...) Expand all
2832 inputs_[0] = value; 2990 inputs_[0] = value;
2833 deopt_id_ = deopt_id; 2991 deopt_id_ = deopt_id;
2834 } 2992 }
2835 2993
2836 Value* value() const { return inputs_[0]; } 2994 Value* value() const { return inputs_[0]; }
2837 2995
2838 virtual bool CanDeoptimize() const { 2996 virtual bool CanDeoptimize() const {
2839 return value()->ResultCid() != kDoubleCid; 2997 return value()->ResultCid() != kDoubleCid;
2840 } 2998 }
2841 2999
3000 virtual bool HasSideEffect() const { return false; }
3001
2842 // The output is not an instance but when it is boxed it becomes double. 3002 // The output is not an instance but when it is boxed it becomes double.
2843 virtual intptr_t ResultCid() const { return kDoubleCid; } 3003 virtual intptr_t ResultCid() const { return kDoubleCid; }
2844 3004
2845 virtual Representation representation() const { 3005 virtual Representation representation() const {
2846 return kUnboxedDouble; 3006 return kUnboxedDouble;
2847 } 3007 }
2848 3008
2849 virtual bool AffectedBySideEffect() const { return false; } 3009 virtual bool AffectedBySideEffect() const { return false; }
2850 virtual bool AttributesEqual(Definition* other) const { return true; } 3010 virtual bool AttributesEqual(Definition* other) const { return true; }
2851 3011
2852 DECLARE_INSTRUCTION(UnboxDouble) 3012 DECLARE_INSTRUCTION(UnboxDouble)
2853 virtual RawAbstractType* CompileType() const; 3013 virtual RawAbstractType* CompileType() const;
2854 3014
2855 private: 3015 private:
2856 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr); 3016 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr);
2857 }; 3017 };
2858 3018
2859 3019
2860 class MathSqrtInstr : public TemplateDefinition<1> { 3020 class MathSqrtInstr : public TemplateDefinition<1> {
2861 public: 3021 public:
2862 MathSqrtInstr(Value* value, StaticCallInstr* instance_call) { 3022 MathSqrtInstr(Value* value, StaticCallInstr* instance_call) {
2863 ASSERT(value != NULL); 3023 ASSERT(value != NULL);
2864 inputs_[0] = value; 3024 inputs_[0] = value;
2865 deopt_id_ = instance_call->deopt_id(); 3025 deopt_id_ = instance_call->deopt_id();
2866 } 3026 }
2867 3027
2868 Value* value() const { return inputs_[0]; } 3028 Value* value() const { return inputs_[0]; }
2869 3029
2870 virtual bool CanDeoptimize() const { return false; } 3030 virtual bool CanDeoptimize() const { return false; }
3031
2871 virtual bool HasSideEffect() const { return false; } 3032 virtual bool HasSideEffect() const { return false; }
2872 3033
2873 virtual bool AttributesEqual(Definition* other) const { 3034 virtual bool AttributesEqual(Definition* other) const {
2874 return true; 3035 return true;
2875 } 3036 }
2876 3037
2877 // The output is not an instance but when it is boxed it becomes double. 3038 // The output is not an instance but when it is boxed it becomes double.
2878 virtual intptr_t ResultCid() const { return kDoubleCid; } 3039 virtual intptr_t ResultCid() const { return kDoubleCid; }
2879 3040
2880 virtual Representation representation() const { 3041 virtual Representation representation() const {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2915 } 3076 }
2916 3077
2917 Value* left() const { return inputs_[0]; } 3078 Value* left() const { return inputs_[0]; }
2918 Value* right() const { return inputs_[1]; } 3079 Value* right() const { return inputs_[1]; }
2919 3080
2920 Token::Kind op_kind() const { return op_kind_; } 3081 Token::Kind op_kind() const { return op_kind_; }
2921 3082
2922 virtual void PrintOperandsTo(BufferFormatter* f) const; 3083 virtual void PrintOperandsTo(BufferFormatter* f) const;
2923 3084
2924 virtual bool CanDeoptimize() const { return false; } 3085 virtual bool CanDeoptimize() const { return false; }
3086
3087 virtual bool HasSideEffect() const { return false; }
3088
2925 virtual bool AffectedBySideEffect() const { return false; } 3089 virtual bool AffectedBySideEffect() const { return false; }
2926 3090
2927 virtual bool AttributesEqual(Definition* other) const { 3091 virtual bool AttributesEqual(Definition* other) const {
2928 return op_kind() == other->AsUnboxedDoubleBinaryOp()->op_kind(); 3092 return op_kind() == other->AsUnboxedDoubleBinaryOp()->op_kind();
2929 } 3093 }
2930 3094
2931 // The output is not an instance but when it is boxed it becomes double. 3095 // The output is not an instance but when it is boxed it becomes double.
2932 virtual intptr_t ResultCid() const { return kDoubleCid; } 3096 virtual intptr_t ResultCid() const { return kDoubleCid; }
2933 3097
2934 virtual Representation representation() const { 3098 virtual Representation representation() const {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2979 3143
2980 const ICData* ic_data() const { return instance_call()->ic_data(); } 3144 const ICData* ic_data() const { return instance_call()->ic_data(); }
2981 3145
2982 virtual void PrintOperandsTo(BufferFormatter* f) const; 3146 virtual void PrintOperandsTo(BufferFormatter* f) const;
2983 3147
2984 DECLARE_INSTRUCTION(BinarySmiOp) 3148 DECLARE_INSTRUCTION(BinarySmiOp)
2985 virtual RawAbstractType* CompileType() const; 3149 virtual RawAbstractType* CompileType() const;
2986 3150
2987 virtual bool CanDeoptimize() const; 3151 virtual bool CanDeoptimize() const;
2988 3152
3153 virtual bool HasSideEffect() const { return false; }
3154
3155 virtual bool AffectedByEffect() const { return false; }
3156 virtual bool AttributesEqual(Definition* other) const;
3157
2989 virtual intptr_t ResultCid() const; 3158 virtual intptr_t ResultCid() const;
2990 3159
2991 private: 3160 private:
2992 const Token::Kind op_kind_; 3161 const Token::Kind op_kind_;
2993 InstanceCallInstr* instance_call_; 3162 InstanceCallInstr* instance_call_;
2994 3163
2995 DISALLOW_COPY_AND_ASSIGN(BinarySmiOpInstr); 3164 DISALLOW_COPY_AND_ASSIGN(BinarySmiOpInstr);
2996 }; 3165 };
2997 3166
2998 3167
(...skipping 19 matching lines...) Expand all
3018 InstanceCallInstr* instance_call() const { return instance_call_; } 3187 InstanceCallInstr* instance_call() const { return instance_call_; }
3019 3188
3020 const ICData* ic_data() const { return instance_call()->ic_data(); } 3189 const ICData* ic_data() const { return instance_call()->ic_data(); }
3021 3190
3022 virtual void PrintOperandsTo(BufferFormatter* f) const; 3191 virtual void PrintOperandsTo(BufferFormatter* f) const;
3023 3192
3024 DECLARE_INSTRUCTION(BinaryMintOp) 3193 DECLARE_INSTRUCTION(BinaryMintOp)
3025 virtual RawAbstractType* CompileType() const; 3194 virtual RawAbstractType* CompileType() const;
3026 3195
3027 virtual bool CanDeoptimize() const { return true; } 3196 virtual bool CanDeoptimize() const { return true; }
3197
3198 virtual bool HasSideEffect() const { return false; }
3199
3028 virtual intptr_t ResultCid() const; 3200 virtual intptr_t ResultCid() const;
3029 3201
3030 private: 3202 private:
3031 const Token::Kind op_kind_; 3203 const Token::Kind op_kind_;
3032 InstanceCallInstr* instance_call_; 3204 InstanceCallInstr* instance_call_;
3033 3205
3034 DISALLOW_COPY_AND_ASSIGN(BinaryMintOpInstr); 3206 DISALLOW_COPY_AND_ASSIGN(BinaryMintOpInstr);
3035 }; 3207 };
3036 3208
3037 3209
(...skipping 13 matching lines...) Expand all
3051 Token::Kind op_kind() const { return op_kind_; } 3223 Token::Kind op_kind() const { return op_kind_; }
3052 3224
3053 InstanceCallInstr* instance_call() const { return instance_call_; } 3225 InstanceCallInstr* instance_call() const { return instance_call_; }
3054 3226
3055 virtual void PrintOperandsTo(BufferFormatter* f) const; 3227 virtual void PrintOperandsTo(BufferFormatter* f) const;
3056 3228
3057 DECLARE_INSTRUCTION(UnarySmiOp) 3229 DECLARE_INSTRUCTION(UnarySmiOp)
3058 virtual RawAbstractType* CompileType() const; 3230 virtual RawAbstractType* CompileType() const;
3059 3231
3060 virtual bool CanDeoptimize() const { return op_kind() == Token::kNEGATE; } 3232 virtual bool CanDeoptimize() const { return op_kind() == Token::kNEGATE; }
3233
3234 virtual bool HasSideEffect() const { return false; }
3235
3061 virtual intptr_t ResultCid() const { return kSmiCid; } 3236 virtual intptr_t ResultCid() const { return kSmiCid; }
3062 3237
3063 private: 3238 private:
3064 const Token::Kind op_kind_; 3239 const Token::Kind op_kind_;
3065 InstanceCallInstr* instance_call_; 3240 InstanceCallInstr* instance_call_;
3066 3241
3067 DISALLOW_COPY_AND_ASSIGN(UnarySmiOpInstr); 3242 DISALLOW_COPY_AND_ASSIGN(UnarySmiOpInstr);
3068 }; 3243 };
3069 3244
3070 3245
3071 // Handles non-Smi NEGATE operations 3246 // Handles non-Smi NEGATE operations
3072 class NumberNegateInstr : public TemplateDefinition<1> { 3247 class NumberNegateInstr : public TemplateDefinition<1> {
3073 public: 3248 public:
3074 NumberNegateInstr(InstanceCallInstr* instance_call, Value* value) 3249 NumberNegateInstr(InstanceCallInstr* instance_call, Value* value)
3075 : instance_call_(instance_call) { 3250 : instance_call_(instance_call) {
3076 ASSERT(value != NULL); 3251 ASSERT(value != NULL);
3077 inputs_[0] = value; 3252 inputs_[0] = value;
3078 } 3253 }
3079 3254
3080 Value* value() const { return inputs_[0]; } 3255 Value* value() const { return inputs_[0]; }
3081 3256
3082 InstanceCallInstr* instance_call() const { return instance_call_; } 3257 InstanceCallInstr* instance_call() const { return instance_call_; }
3083 3258
3084 const ICData* ic_data() const { return instance_call()->ic_data(); } 3259 const ICData* ic_data() const { return instance_call()->ic_data(); }
3085 3260
3086 DECLARE_INSTRUCTION(NumberNegate) 3261 DECLARE_INSTRUCTION(NumberNegate)
3087 virtual RawAbstractType* CompileType() const; 3262 virtual RawAbstractType* CompileType() const;
3088 3263
3089 virtual bool CanDeoptimize() const { return true; } 3264 virtual bool CanDeoptimize() const { return true; }
3265
3266 virtual bool HasSideEffect() const { return false; }
3267
3090 virtual intptr_t ResultCid() const { return kDoubleCid; } 3268 virtual intptr_t ResultCid() const { return kDoubleCid; }
3091 3269
3092 private: 3270 private:
3093 InstanceCallInstr* instance_call_; 3271 InstanceCallInstr* instance_call_;
3094 3272
3095 DISALLOW_COPY_AND_ASSIGN(NumberNegateInstr); 3273 DISALLOW_COPY_AND_ASSIGN(NumberNegateInstr);
3096 }; 3274 };
3097 3275
3098 3276
3099 class CheckStackOverflowInstr : public TemplateDefinition<0> { 3277 class CheckStackOverflowInstr : public TemplateDefinition<0> {
3100 public: 3278 public:
3101 explicit CheckStackOverflowInstr(intptr_t token_pos) 3279 explicit CheckStackOverflowInstr(intptr_t token_pos)
3102 : token_pos_(token_pos) {} 3280 : token_pos_(token_pos) {}
3103 3281
3104 intptr_t token_pos() const { return token_pos_; } 3282 intptr_t token_pos() const { return token_pos_; }
3105 3283
3106 DECLARE_INSTRUCTION(CheckStackOverflow) 3284 DECLARE_INSTRUCTION(CheckStackOverflow)
3107 virtual RawAbstractType* CompileType() const; 3285 virtual RawAbstractType* CompileType() const;
3108 3286
3109 virtual bool CanDeoptimize() const { return false; } 3287 virtual bool CanDeoptimize() const { return false; }
3288
3289 virtual bool HasSideEffect() const { return false; }
3290
3110 virtual intptr_t ResultCid() const { return kIllegalCid; } 3291 virtual intptr_t ResultCid() const { return kIllegalCid; }
3111 3292
3112 private: 3293 private:
3113 const intptr_t token_pos_; 3294 const intptr_t token_pos_;
3114 3295
3115 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowInstr); 3296 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowInstr);
3116 }; 3297 };
3117 3298
3118 3299
3119 class DoubleToDoubleInstr : public TemplateDefinition<1> { 3300 class DoubleToDoubleInstr : public TemplateDefinition<1> {
3120 public: 3301 public:
3121 DoubleToDoubleInstr(Value* value, InstanceCallInstr* instance_call) 3302 DoubleToDoubleInstr(Value* value, InstanceCallInstr* instance_call)
3122 : instance_call_(instance_call) { 3303 : instance_call_(instance_call) {
3123 ASSERT(value != NULL); 3304 ASSERT(value != NULL);
3124 inputs_[0] = value; 3305 inputs_[0] = value;
3125 } 3306 }
3126 3307
3127 Value* value() const { return inputs_[0]; } 3308 Value* value() const { return inputs_[0]; }
3128 3309
3129 InstanceCallInstr* instance_call() const { return instance_call_; } 3310 InstanceCallInstr* instance_call() const { return instance_call_; }
3130 3311
3131 DECLARE_INSTRUCTION(DoubleToDouble) 3312 DECLARE_INSTRUCTION(DoubleToDouble)
3132 virtual RawAbstractType* CompileType() const; 3313 virtual RawAbstractType* CompileType() const;
3133 3314
3134 virtual bool CanDeoptimize() const { return true; } 3315 virtual bool CanDeoptimize() const { return true; }
3316
3317 virtual bool HasSideEffect() const { return false; }
3318
3135 virtual intptr_t ResultCid() const { return kDoubleCid; } 3319 virtual intptr_t ResultCid() const { return kDoubleCid; }
3136 3320
3137 private: 3321 private:
3138 InstanceCallInstr* instance_call_; 3322 InstanceCallInstr* instance_call_;
3139 3323
3140 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr); 3324 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr);
3141 }; 3325 };
3142 3326
3143 3327
3144 class SmiToDoubleInstr : public TemplateDefinition<0> { 3328 class SmiToDoubleInstr : public TemplateDefinition<0> {
3145 public: 3329 public:
3146 explicit SmiToDoubleInstr(InstanceCallInstr* instance_call) 3330 explicit SmiToDoubleInstr(InstanceCallInstr* instance_call)
3147 : instance_call_(instance_call) { } 3331 : instance_call_(instance_call) { }
3148 3332
3149 InstanceCallInstr* instance_call() const { return instance_call_; } 3333 InstanceCallInstr* instance_call() const { return instance_call_; }
3150 3334
3151 DECLARE_INSTRUCTION(SmiToDouble) 3335 DECLARE_INSTRUCTION(SmiToDouble)
3152 virtual RawAbstractType* CompileType() const; 3336 virtual RawAbstractType* CompileType() const;
3153 3337
3154 virtual intptr_t ArgumentCount() const { return 1; } 3338 virtual intptr_t ArgumentCount() const { return 1; }
3155 3339
3156 virtual bool CanDeoptimize() const { return true; } 3340 virtual bool CanDeoptimize() const { return true; }
3341
3342 virtual bool HasSideEffect() const { return false; }
3343
3157 virtual intptr_t ResultCid() const { return kDoubleCid; } 3344 virtual intptr_t ResultCid() const { return kDoubleCid; }
3158 3345
3159 private: 3346 private:
3160 InstanceCallInstr* instance_call_; 3347 InstanceCallInstr* instance_call_;
3161 3348
3162 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); 3349 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr);
3163 }; 3350 };
3164 3351
3165 3352
3166 class CheckClassInstr : public TemplateDefinition<1> { 3353 class CheckClassInstr : public TemplateDefinition<1> {
3167 public: 3354 public:
3168 CheckClassInstr(Value* value, 3355 CheckClassInstr(Value* value,
3169 InstanceCallInstr* instance_call, 3356 InstanceCallInstr* instance_call,
3170 const ICData& unary_checks) 3357 const ICData& unary_checks)
3171 : unary_checks_(unary_checks) { 3358 : unary_checks_(unary_checks) {
3172 ASSERT(value != NULL); 3359 ASSERT(value != NULL);
3173 inputs_[0] = value; 3360 inputs_[0] = value;
3174 deopt_id_ = instance_call->deopt_id(); 3361 deopt_id_ = instance_call->deopt_id();
3175 } 3362 }
3176 3363
3177 DECLARE_INSTRUCTION(CheckClass) 3364 DECLARE_INSTRUCTION(CheckClass)
3178 virtual RawAbstractType* CompileType() const; 3365 virtual RawAbstractType* CompileType() const;
3179 3366
3180 virtual bool CanDeoptimize() const { return true; } 3367 virtual bool CanDeoptimize() const { return true; }
3368
3369 virtual bool HasSideEffect() const { return false; }
3370
3181 virtual intptr_t ResultCid() const { return kIllegalCid; } 3371 virtual intptr_t ResultCid() const { return kIllegalCid; }
3182 3372
3183 virtual bool AttributesEqual(Definition* other) const; 3373 virtual bool AttributesEqual(Definition* other) const;
3184 3374
3185 virtual bool AffectedBySideEffect() const { return false; } 3375 virtual bool AffectedBySideEffect() const { return false; }
3186 3376
3187 Value* value() const { return inputs_[0]; } 3377 Value* value() const { return inputs_[0]; }
3188 3378
3189 const ICData& unary_checks() const { return unary_checks_; } 3379 const ICData& unary_checks() const { return unary_checks_; }
3190 3380
(...skipping 14 matching lines...) Expand all
3205 ASSERT(value != NULL); 3395 ASSERT(value != NULL);
3206 ASSERT(original_deopt_id != Isolate::kNoDeoptId); 3396 ASSERT(original_deopt_id != Isolate::kNoDeoptId);
3207 inputs_[0] = value; 3397 inputs_[0] = value;
3208 deopt_id_ = original_deopt_id; 3398 deopt_id_ = original_deopt_id;
3209 } 3399 }
3210 3400
3211 DECLARE_INSTRUCTION(CheckSmi) 3401 DECLARE_INSTRUCTION(CheckSmi)
3212 virtual RawAbstractType* CompileType() const; 3402 virtual RawAbstractType* CompileType() const;
3213 3403
3214 virtual bool CanDeoptimize() const { return true; } 3404 virtual bool CanDeoptimize() const { return true; }
3405
3406 virtual bool HasSideEffect() const { return false; }
3407
3215 virtual intptr_t ResultCid() const { return kIllegalCid; } 3408 virtual intptr_t ResultCid() const { return kIllegalCid; }
3216 3409
3217 virtual bool AttributesEqual(Definition* other) const { return true; } 3410 virtual bool AttributesEqual(Definition* other) const { return true; }
3218 3411
3219 virtual bool AffectedBySideEffect() const { return false; } 3412 virtual bool AffectedBySideEffect() const { return false; }
3220 3413
3221 virtual Definition* Canonicalize(); 3414 virtual Definition* Canonicalize();
3222 3415
3223 Value* value() const { return inputs_[0]; } 3416 Value* value() const { return inputs_[0]; }
3224 3417
(...skipping 13 matching lines...) Expand all
3238 ASSERT(index != NULL); 3431 ASSERT(index != NULL);
3239 inputs_[0] = array; 3432 inputs_[0] = array;
3240 inputs_[1] = index; 3433 inputs_[1] = index;
3241 deopt_id_ = instance_call->deopt_id(); 3434 deopt_id_ = instance_call->deopt_id();
3242 } 3435 }
3243 3436
3244 DECLARE_INSTRUCTION(CheckArrayBound) 3437 DECLARE_INSTRUCTION(CheckArrayBound)
3245 virtual RawAbstractType* CompileType() const; 3438 virtual RawAbstractType* CompileType() const;
3246 3439
3247 virtual bool CanDeoptimize() const { return true; } 3440 virtual bool CanDeoptimize() const { return true; }
3441
3442 virtual bool HasSideEffect() const { return false; }
3443
3248 virtual intptr_t ResultCid() const { return kIllegalCid; } 3444 virtual intptr_t ResultCid() const { return kIllegalCid; }
3249 3445
3250 virtual bool AttributesEqual(Definition* other) const; 3446 virtual bool AttributesEqual(Definition* other) const;
3251 3447
3252 virtual bool AffectedBySideEffect() const { return false; } 3448 virtual bool AffectedBySideEffect() const { return false; }
3253 3449
3254 Value* array() const { return inputs_[0]; } 3450 Value* array() const { return inputs_[0]; }
3255 Value* index() const { return inputs_[1]; } 3451 Value* index() const { return inputs_[1]; }
3256 3452
3257 intptr_t array_type() const { return array_type_; } 3453 intptr_t array_type() const { return array_type_; }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
3444 ForwardInstructionIterator* current_iterator_; 3640 ForwardInstructionIterator* current_iterator_;
3445 3641
3446 private: 3642 private:
3447 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 3643 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
3448 }; 3644 };
3449 3645
3450 3646
3451 } // namespace dart 3647 } // namespace dart
3452 3648
3453 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 3649 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698