| OLD | NEW |
| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 } | 379 } |
| 380 | 380 |
| 381 // Mutate assigned_vars to add the local variable index for all | 381 // Mutate assigned_vars to add the local variable index for all |
| 382 // frame-allocated locals assigned to by the instruction. | 382 // frame-allocated locals assigned to by the instruction. |
| 383 virtual void RecordAssignedVars(BitVector* assigned_vars, | 383 virtual void RecordAssignedVars(BitVector* assigned_vars, |
| 384 intptr_t fixed_parameter_count); | 384 intptr_t fixed_parameter_count); |
| 385 | 385 |
| 386 virtual const char* DebugName() const = 0; | 386 virtual const char* DebugName() const = 0; |
| 387 | 387 |
| 388 // Printing support. | 388 // Printing support. |
| 389 virtual void PrintTo(BufferFormatter* f) const = 0; | 389 virtual void PrintTo(BufferFormatter* f) const; |
| 390 virtual void PrintToVisualizer(BufferFormatter* f) const = 0; | 390 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 391 virtual void PrintToVisualizer(BufferFormatter* f) const; |
| 391 | 392 |
| 392 #define INSTRUCTION_TYPE_CHECK(type) \ | 393 #define INSTRUCTION_TYPE_CHECK(type) \ |
| 393 bool Is##type() { return (As##type() != NULL); } \ | 394 bool Is##type() { return (As##type() != NULL); } \ |
| 394 virtual type##Instr* As##type() { return NULL; } | 395 virtual type##Instr* As##type() { return NULL; } |
| 395 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK) | 396 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK) |
| 396 #undef INSTRUCTION_TYPE_CHECK | 397 #undef INSTRUCTION_TYPE_CHECK |
| 397 | 398 |
| 398 // Returns structure describing location constraints required | 399 // Returns structure describing location constraints required |
| 399 // to emit native code for this instruction. | 400 // to emit native code for this instruction. |
| 400 virtual LocationSummary* locs() { | 401 virtual LocationSummary* locs() { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 } | 436 } |
| 436 | 437 |
| 437 // Returns deoptimization id that corresponds to the deoptimization target | 438 // Returns deoptimization id that corresponds to the deoptimization target |
| 438 // that input operands conversions inserted for this instruction can jump | 439 // that input operands conversions inserted for this instruction can jump |
| 439 // to. | 440 // to. |
| 440 virtual intptr_t DeoptimizationTarget() const { | 441 virtual intptr_t DeoptimizationTarget() const { |
| 441 UNREACHABLE(); | 442 UNREACHABLE(); |
| 442 return Isolate::kNoDeoptId; | 443 return Isolate::kNoDeoptId; |
| 443 } | 444 } |
| 444 | 445 |
| 446 // Returns a replacement for the instruction or NULL if the instruction can |
| 447 // be eliminated. By default returns the this instruction which means no |
| 448 // change. |
| 449 virtual Instruction* Canonicalize(); |
| 450 |
| 451 // Insert this instruction before 'next'. |
| 452 void InsertBefore(Instruction* next); |
| 453 |
| 454 // Insert this instruction after 'prev'. |
| 455 void InsertAfter(Instruction* prev); |
| 456 |
| 457 // Returns true if the instruction is affected by side effects. |
| 458 // Only instructions that are not affected by side effects can participate |
| 459 // in redundancy elimination or loop invariant code motion. |
| 460 // TODO(fschneider): Make this abstract and implement for all instructions |
| 461 // instead of returning the safe default (true). |
| 462 virtual bool AffectedBySideEffect() const { return true; } |
| 463 |
| 464 // Get the block entry for this instruction. |
| 465 virtual BlockEntryInstr* GetBlock() const; |
| 466 |
| 445 // Id for instructions used in CSE. | 467 // Id for instructions used in CSE. |
| 446 intptr_t expr_id() const { return expr_id_; } | 468 intptr_t expr_id() const { return expr_id_; } |
| 447 void set_expr_id(intptr_t expr_id) { expr_id_ = expr_id; } | 469 void set_expr_id(intptr_t expr_id) { expr_id_ = expr_id; } |
| 448 | 470 |
| 471 // Returns a hash code for use with hash maps. |
| 472 virtual intptr_t Hashcode() const; |
| 473 |
| 474 // Compares two instructions. Returns true, iff: |
| 475 // 1. They have the same tag. |
| 476 // 2. All input operands are Equals. |
| 477 // 3. They satisfy AttributesEqual. |
| 478 bool Equals(Instruction* other) const; |
| 479 |
| 480 // Compare attributes of a instructions (except input operands and tag). |
| 481 // All instructions that participate in CSE have to override this function. |
| 482 // This function can assume that the argument has the same type as this. |
| 483 virtual bool AttributesEqual(Instruction* other) const { |
| 484 UNREACHABLE(); |
| 485 return false; |
| 486 } |
| 487 |
| 449 protected: | 488 protected: |
| 450 // Fetch deopt id without checking if this computation can deoptimize. | 489 // Fetch deopt id without checking if this computation can deoptimize. |
| 451 intptr_t GetDeoptId() const { | 490 intptr_t GetDeoptId() const { |
| 452 return deopt_id_; | 491 return deopt_id_; |
| 453 } | 492 } |
| 454 | 493 |
| 455 private: | 494 private: |
| 456 friend class Definition; // Needed for InsertBefore, InsertAfter. | 495 friend class Definition; // Needed for InsertBefore, InsertAfter. |
| 457 | 496 |
| 458 // Classes that set deopt_id_. | 497 // Classes that set deopt_id_. |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 | 1028 |
| 990 bool has_propagated_cid() const { return propagated_cid_ != kIllegalCid; } | 1029 bool has_propagated_cid() const { return propagated_cid_ != kIllegalCid; } |
| 991 intptr_t propagated_cid() const { return propagated_cid_; } | 1030 intptr_t propagated_cid() const { return propagated_cid_; } |
| 992 | 1031 |
| 993 // May compute and set propagated cid. | 1032 // May compute and set propagated cid. |
| 994 virtual intptr_t GetPropagatedCid(); | 1033 virtual intptr_t GetPropagatedCid(); |
| 995 | 1034 |
| 996 // Returns true if the propagated cid has changed. | 1035 // Returns true if the propagated cid has changed. |
| 997 bool SetPropagatedCid(intptr_t cid); | 1036 bool SetPropagatedCid(intptr_t cid); |
| 998 | 1037 |
| 999 // Returns true if the definition is affected by side effects. | |
| 1000 // Only instructions that are not affected by side effects can participate | |
| 1001 // in redundancy elimination or loop invariant code motion. | |
| 1002 // TODO(fschneider): Make this abstract and implement for all definitions | |
| 1003 // instead of returning the safe default (true). | |
| 1004 virtual bool AffectedBySideEffect() const { return true; } | |
| 1005 | |
| 1006 Value* input_use_list() { return input_use_list_; } | 1038 Value* input_use_list() { return input_use_list_; } |
| 1007 void set_input_use_list(Value* head) { input_use_list_ = head; } | 1039 void set_input_use_list(Value* head) { input_use_list_ = head; } |
| 1008 | 1040 |
| 1009 Value* env_use_list() { return env_use_list_; } | 1041 Value* env_use_list() { return env_use_list_; } |
| 1010 void set_env_use_list(Value* head) { env_use_list_ = head; } | 1042 void set_env_use_list(Value* head) { env_use_list_ = head; } |
| 1011 | 1043 |
| 1012 // Returns a replacement for the definition or NULL if the definition can | |
| 1013 // be eliminated. By default returns the definition (input parameter) | |
| 1014 // which means no change. | |
| 1015 virtual Definition* Canonicalize(); | |
| 1016 | |
| 1017 // Replace uses of this definition with uses of other definition or value. | 1044 // Replace uses of this definition with uses of other definition or value. |
| 1018 // Precondition: use lists must be properly calculated. | 1045 // Precondition: use lists must be properly calculated. |
| 1019 // Postcondition: use lists and use values are still valid. | 1046 // Postcondition: use lists and use values are still valid. |
| 1020 void ReplaceUsesWith(Definition* other); | 1047 void ReplaceUsesWith(Definition* other); |
| 1021 | 1048 |
| 1022 // Replace this definition and all uses with another definition. If | 1049 // Replace this definition and all uses with another definition. If |
| 1023 // replacing during iteration, pass the iterator so that the instruction | 1050 // replacing during iteration, pass the iterator so that the instruction |
| 1024 // can be replaced without affecting iteration order, otherwise pass a | 1051 // can be replaced without affecting iteration order, otherwise pass a |
| 1025 // NULL iterator. | 1052 // NULL iterator. |
| 1026 void ReplaceWith(Definition* other, ForwardInstructionIterator* iterator); | 1053 void ReplaceWith(Definition* other, ForwardInstructionIterator* iterator); |
| 1027 | 1054 |
| 1028 // Insert this definition before 'next'. | |
| 1029 void InsertBefore(Instruction* next); | |
| 1030 | |
| 1031 // Insert this definition after 'prev'. | |
| 1032 void InsertAfter(Instruction* prev); | |
| 1033 | |
| 1034 // Compares two definitions. Returns true, iff: | |
| 1035 // 1. They have the same tag. | |
| 1036 // 2. All input operands are Equals. | |
| 1037 // 3. They satisfy AttributesEqual. | |
| 1038 bool Equals(Definition* other) const; | |
| 1039 | |
| 1040 // Compare attributes of a definition (except input operands and tag). | |
| 1041 // All definition that participate in CSE have to override this function. | |
| 1042 // This function can assume that the argument has the same type as this. | |
| 1043 virtual bool AttributesEqual(Definition* other) const { | |
| 1044 UNREACHABLE(); | |
| 1045 return false; | |
| 1046 } | |
| 1047 | |
| 1048 // Returns a hash code for use with hash maps. | |
| 1049 virtual intptr_t Hashcode() const; | |
| 1050 | |
| 1051 virtual void RecordAssignedVars(BitVector* assigned_vars, | 1055 virtual void RecordAssignedVars(BitVector* assigned_vars, |
| 1052 intptr_t fixed_parameter_count); | 1056 intptr_t fixed_parameter_count); |
| 1053 | 1057 |
| 1054 // Get the block entry for that instruction. | |
| 1055 virtual BlockEntryInstr* GetBlock() const; | |
| 1056 | |
| 1057 // Printing support. These functions are sometimes overridden for custom | 1058 // Printing support. These functions are sometimes overridden for custom |
| 1058 // formatting. Otherwise, it prints in the format "opcode(op1, op2, op3)". | 1059 // formatting. Otherwise, it prints in the format "opcode(op1, op2, op3)". |
| 1059 virtual void PrintTo(BufferFormatter* f) const; | 1060 virtual void PrintTo(BufferFormatter* f) const; |
| 1060 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1061 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1061 virtual void PrintToVisualizer(BufferFormatter* f) const; | 1062 virtual void PrintToVisualizer(BufferFormatter* f) const; |
| 1062 | 1063 |
| 1064 // Definitions can be canonicalized only into definitions to ensure |
| 1065 // this check statically we override base Canonicalize with a Canonicalize |
| 1066 // returning Definition (return type is covariant). |
| 1067 virtual Definition* Canonicalize(); |
| 1068 |
| 1063 private: | 1069 private: |
| 1064 intptr_t temp_index_; | 1070 intptr_t temp_index_; |
| 1065 intptr_t ssa_temp_index_; | 1071 intptr_t ssa_temp_index_; |
| 1066 // TODO(regis): GrowableArray<const AbstractType*> propagated_types_; | 1072 // TODO(regis): GrowableArray<const AbstractType*> propagated_types_; |
| 1067 // For now: | 1073 // For now: |
| 1068 AbstractType& propagated_type_; | 1074 AbstractType& propagated_type_; |
| 1069 intptr_t propagated_cid_; | 1075 intptr_t propagated_cid_; |
| 1070 Value* input_use_list_; | 1076 Value* input_use_list_; |
| 1071 Value* env_use_list_; | 1077 Value* env_use_list_; |
| 1072 UseKind use_kind_; | 1078 UseKind use_kind_; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1271 | 1277 |
| 1272 virtual intptr_t ArgumentCount() const { return 0; } | 1278 virtual intptr_t ArgumentCount() const { return 0; } |
| 1273 | 1279 |
| 1274 intptr_t token_pos() const { return token_pos_; } | 1280 intptr_t token_pos() const { return token_pos_; } |
| 1275 Value* value() const { return inputs_[0]; } | 1281 Value* value() const { return inputs_[0]; } |
| 1276 | 1282 |
| 1277 virtual bool CanDeoptimize() const { return false; } | 1283 virtual bool CanDeoptimize() const { return false; } |
| 1278 | 1284 |
| 1279 virtual bool HasSideEffect() const { return false; } | 1285 virtual bool HasSideEffect() const { return false; } |
| 1280 | 1286 |
| 1281 virtual void PrintTo(BufferFormatter* f) const; | |
| 1282 virtual void PrintToVisualizer(BufferFormatter* f) const; | |
| 1283 | |
| 1284 private: | 1287 private: |
| 1285 const intptr_t token_pos_; | 1288 const intptr_t token_pos_; |
| 1286 | 1289 |
| 1287 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); | 1290 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); |
| 1288 }; | 1291 }; |
| 1289 | 1292 |
| 1290 | 1293 |
| 1291 class ThrowInstr : public TemplateInstruction<0> { | 1294 class ThrowInstr : public TemplateInstruction<0> { |
| 1292 public: | 1295 public: |
| 1293 explicit ThrowInstr(intptr_t token_pos) : token_pos_(token_pos) { } | 1296 explicit ThrowInstr(intptr_t token_pos) : token_pos_(token_pos) { } |
| 1294 | 1297 |
| 1295 DECLARE_INSTRUCTION(Throw) | 1298 DECLARE_INSTRUCTION(Throw) |
| 1296 | 1299 |
| 1297 virtual intptr_t ArgumentCount() const { return 1; } | 1300 virtual intptr_t ArgumentCount() const { return 1; } |
| 1298 | 1301 |
| 1299 intptr_t token_pos() const { return token_pos_; } | 1302 intptr_t token_pos() const { return token_pos_; } |
| 1300 | 1303 |
| 1301 virtual bool CanDeoptimize() const { return false; } | 1304 virtual bool CanDeoptimize() const { return false; } |
| 1302 | 1305 |
| 1303 virtual bool HasSideEffect() const { return true; } | 1306 virtual bool HasSideEffect() const { return true; } |
| 1304 | 1307 |
| 1305 virtual void PrintTo(BufferFormatter* f) const; | |
| 1306 virtual void PrintToVisualizer(BufferFormatter* f) const; | |
| 1307 | |
| 1308 private: | 1308 private: |
| 1309 const intptr_t token_pos_; | 1309 const intptr_t token_pos_; |
| 1310 | 1310 |
| 1311 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); | 1311 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); |
| 1312 }; | 1312 }; |
| 1313 | 1313 |
| 1314 | 1314 |
| 1315 class ReThrowInstr : public TemplateInstruction<0> { | 1315 class ReThrowInstr : public TemplateInstruction<0> { |
| 1316 public: | 1316 public: |
| 1317 explicit ReThrowInstr(intptr_t token_pos) : token_pos_(token_pos) { } | 1317 explicit ReThrowInstr(intptr_t token_pos) : token_pos_(token_pos) { } |
| 1318 | 1318 |
| 1319 DECLARE_INSTRUCTION(ReThrow) | 1319 DECLARE_INSTRUCTION(ReThrow) |
| 1320 | 1320 |
| 1321 virtual intptr_t ArgumentCount() const { return 2; } | 1321 virtual intptr_t ArgumentCount() const { return 2; } |
| 1322 | 1322 |
| 1323 intptr_t token_pos() const { return token_pos_; } | 1323 intptr_t token_pos() const { return token_pos_; } |
| 1324 | 1324 |
| 1325 virtual bool CanDeoptimize() const { return false; } | 1325 virtual bool CanDeoptimize() const { return false; } |
| 1326 | 1326 |
| 1327 virtual bool HasSideEffect() const { return true; } | 1327 virtual bool HasSideEffect() const { return true; } |
| 1328 | 1328 |
| 1329 virtual void PrintTo(BufferFormatter* f) const; | |
| 1330 virtual void PrintToVisualizer(BufferFormatter* f) const; | |
| 1331 | |
| 1332 private: | 1329 private: |
| 1333 const intptr_t token_pos_; | 1330 const intptr_t token_pos_; |
| 1334 | 1331 |
| 1335 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); | 1332 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); |
| 1336 }; | 1333 }; |
| 1337 | 1334 |
| 1338 | 1335 |
| 1339 class GotoInstr : public TemplateInstruction<0> { | 1336 class GotoInstr : public TemplateInstruction<0> { |
| 1340 public: | 1337 public: |
| 1341 explicit GotoInstr(JoinEntryInstr* entry) | 1338 explicit GotoInstr(JoinEntryInstr* entry) |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1451 virtual void PrintTo(BufferFormatter* f) const; | 1448 virtual void PrintTo(BufferFormatter* f) const; |
| 1452 virtual void PrintToVisualizer(BufferFormatter* f) const; | 1449 virtual void PrintToVisualizer(BufferFormatter* f) const; |
| 1453 | 1450 |
| 1454 private: | 1451 private: |
| 1455 ComparisonInstr* comparison_; | 1452 ComparisonInstr* comparison_; |
| 1456 | 1453 |
| 1457 DISALLOW_COPY_AND_ASSIGN(BranchInstr); | 1454 DISALLOW_COPY_AND_ASSIGN(BranchInstr); |
| 1458 }; | 1455 }; |
| 1459 | 1456 |
| 1460 | 1457 |
| 1458 class StoreContextInstr : public TemplateInstruction<1> { |
| 1459 public: |
| 1460 explicit StoreContextInstr(Value* value) { |
| 1461 ASSERT(value != NULL); |
| 1462 inputs_[0] = value; |
| 1463 } |
| 1464 |
| 1465 DECLARE_INSTRUCTION(StoreContext); |
| 1466 virtual RawAbstractType* CompileType() const; |
| 1467 |
| 1468 virtual intptr_t ArgumentCount() const { return 0; } |
| 1469 |
| 1470 Value* value() const { return inputs_[0]; } |
| 1471 |
| 1472 virtual bool CanDeoptimize() const { return false; } |
| 1473 |
| 1474 virtual bool HasSideEffect() const { return false; } |
| 1475 |
| 1476 private: |
| 1477 DISALLOW_COPY_AND_ASSIGN(StoreContextInstr); |
| 1478 }; |
| 1479 |
| 1480 |
| 1461 template<intptr_t N> | 1481 template<intptr_t N> |
| 1462 class TemplateDefinition : public Definition { | 1482 class TemplateDefinition : public Definition { |
| 1463 public: | 1483 public: |
| 1464 TemplateDefinition<N>() : locs_(NULL) { } | 1484 TemplateDefinition<N>() : locs_(NULL) { } |
| 1465 | 1485 |
| 1466 virtual intptr_t InputCount() const { return N; } | 1486 virtual intptr_t InputCount() const { return N; } |
| 1467 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } | 1487 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } |
| 1468 virtual void SetInputAt(intptr_t i, Value* value) { | 1488 virtual void SetInputAt(intptr_t i, Value* value) { |
| 1469 ASSERT(value != NULL); | 1489 ASSERT(value != NULL); |
| 1470 inputs_[i] = value; | 1490 inputs_[i] = value; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1499 const Object& value() const { return value_; } | 1519 const Object& value() const { return value_; } |
| 1500 | 1520 |
| 1501 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1521 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1502 | 1522 |
| 1503 virtual bool CanDeoptimize() const { return false; } | 1523 virtual bool CanDeoptimize() const { return false; } |
| 1504 | 1524 |
| 1505 virtual bool HasSideEffect() const { return false; } | 1525 virtual bool HasSideEffect() const { return false; } |
| 1506 | 1526 |
| 1507 virtual intptr_t ResultCid() const; | 1527 virtual intptr_t ResultCid() const; |
| 1508 | 1528 |
| 1509 virtual bool AttributesEqual(Definition* other) const; | 1529 virtual bool AttributesEqual(Instruction* other) const; |
| 1510 virtual bool AffectedBySideEffect() const { return false; } | 1530 virtual bool AffectedBySideEffect() const { return false; } |
| 1511 | 1531 |
| 1512 private: | 1532 private: |
| 1513 const Object& value_; | 1533 const Object& value_; |
| 1514 | 1534 |
| 1515 DISALLOW_COPY_AND_ASSIGN(ConstantInstr); | 1535 DISALLOW_COPY_AND_ASSIGN(ConstantInstr); |
| 1516 }; | 1536 }; |
| 1517 | 1537 |
| 1518 | 1538 |
| 1519 class AssertAssignableInstr : public TemplateDefinition<3> { | 1539 class AssertAssignableInstr : public TemplateDefinition<3> { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1663 | 1683 |
| 1664 virtual bool HasSideEffect() const { return false; } | 1684 virtual bool HasSideEffect() const { return false; } |
| 1665 | 1685 |
| 1666 virtual intptr_t ResultCid() const { return kDynamicCid; } | 1686 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 1667 | 1687 |
| 1668 private: | 1688 private: |
| 1669 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr); | 1689 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr); |
| 1670 }; | 1690 }; |
| 1671 | 1691 |
| 1672 | 1692 |
| 1673 class StoreContextInstr : public TemplateDefinition<1> { | |
| 1674 public: | |
| 1675 explicit StoreContextInstr(Value* value) { | |
| 1676 ASSERT(value != NULL); | |
| 1677 inputs_[0] = value; | |
| 1678 } | |
| 1679 | |
| 1680 DECLARE_INSTRUCTION(StoreContext); | |
| 1681 virtual RawAbstractType* CompileType() const; | |
| 1682 | |
| 1683 Value* value() const { return inputs_[0]; } | |
| 1684 | |
| 1685 virtual bool CanDeoptimize() const { return false; } | |
| 1686 | |
| 1687 virtual bool HasSideEffect() const { return false; } | |
| 1688 | |
| 1689 virtual intptr_t ResultCid() const { return kIllegalCid; } | |
| 1690 | |
| 1691 private: | |
| 1692 DISALLOW_COPY_AND_ASSIGN(StoreContextInstr); | |
| 1693 }; | |
| 1694 | |
| 1695 | |
| 1696 class ClosureCallInstr : public TemplateDefinition<0> { | 1693 class ClosureCallInstr : public TemplateDefinition<0> { |
| 1697 public: | 1694 public: |
| 1698 ClosureCallInstr(ClosureCallNode* node, | 1695 ClosureCallInstr(ClosureCallNode* node, |
| 1699 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 1696 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
| 1700 : ast_node_(*node), | 1697 : ast_node_(*node), |
| 1701 arguments_(arguments) { } | 1698 arguments_(arguments) { } |
| 1702 | 1699 |
| 1703 DECLARE_INSTRUCTION(ClosureCall) | 1700 DECLARE_INSTRUCTION(ClosureCall) |
| 1704 virtual RawAbstractType* CompileType() const; | 1701 virtual RawAbstractType* CompileType() const; |
| 1705 | 1702 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1921 | 1918 |
| 1922 DECLARE_INSTRUCTION(StrictCompare) | 1919 DECLARE_INSTRUCTION(StrictCompare) |
| 1923 virtual RawAbstractType* CompileType() const; | 1920 virtual RawAbstractType* CompileType() const; |
| 1924 | 1921 |
| 1925 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1922 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1926 | 1923 |
| 1927 virtual bool CanDeoptimize() const { return false; } | 1924 virtual bool CanDeoptimize() const { return false; } |
| 1928 | 1925 |
| 1929 virtual bool HasSideEffect() const { return false; } | 1926 virtual bool HasSideEffect() const { return false; } |
| 1930 | 1927 |
| 1931 virtual bool AttributesEqual(Definition* other) const; | 1928 virtual bool AttributesEqual(Instruction* other) const; |
| 1932 virtual bool AffectedBySideEffect() const { return false; } | 1929 virtual bool AffectedBySideEffect() const { return false; } |
| 1933 | 1930 |
| 1934 virtual Definition* Canonicalize(); | 1931 virtual Definition* Canonicalize(); |
| 1935 | 1932 |
| 1936 virtual intptr_t ResultCid() const { return kBoolCid; } | 1933 virtual intptr_t ResultCid() const { return kBoolCid; } |
| 1937 | 1934 |
| 1938 virtual void EmitBranchCode(FlowGraphCompiler* compiler, | 1935 virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
| 1939 BranchInstr* branch); | 1936 BranchInstr* branch); |
| 1940 | 1937 |
| 1941 private: | 1938 private: |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2283 | 2280 |
| 2284 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2281 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 2285 | 2282 |
| 2286 virtual bool CanDeoptimize() const { return false; } | 2283 virtual bool CanDeoptimize() const { return false; } |
| 2287 | 2284 |
| 2288 virtual bool HasSideEffect() const { return false; } | 2285 virtual bool HasSideEffect() const { return false; } |
| 2289 | 2286 |
| 2290 virtual intptr_t ResultCid() const { return kDynamicCid; } | 2287 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 2291 | 2288 |
| 2292 virtual bool AffectedBySideEffect() const { return !field().is_final(); } | 2289 virtual bool AffectedBySideEffect() const { return !field().is_final(); } |
| 2293 virtual bool AttributesEqual(Definition* other) const; | 2290 virtual bool AttributesEqual(Instruction* other) const; |
| 2294 | 2291 |
| 2295 private: | 2292 private: |
| 2296 const Field& field_; | 2293 const Field& field_; |
| 2297 | 2294 |
| 2298 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); | 2295 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); |
| 2299 }; | 2296 }; |
| 2300 | 2297 |
| 2301 | 2298 |
| 2302 class StoreStaticFieldInstr : public TemplateDefinition<1> { | 2299 class StoreStaticFieldInstr : public TemplateDefinition<1> { |
| 2303 public: | 2300 public: |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2644 void set_result_cid(intptr_t value) { result_cid_ = value; } | 2641 void set_result_cid(intptr_t value) { result_cid_ = value; } |
| 2645 | 2642 |
| 2646 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2643 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 2647 | 2644 |
| 2648 virtual bool CanDeoptimize() const { return false; } | 2645 virtual bool CanDeoptimize() const { return false; } |
| 2649 | 2646 |
| 2650 virtual bool HasSideEffect() const { return false; } | 2647 virtual bool HasSideEffect() const { return false; } |
| 2651 | 2648 |
| 2652 virtual intptr_t ResultCid() const { return result_cid_; } | 2649 virtual intptr_t ResultCid() const { return result_cid_; } |
| 2653 | 2650 |
| 2654 virtual bool AttributesEqual(Definition* other) const; | 2651 virtual bool AttributesEqual(Instruction* other) const; |
| 2655 | 2652 |
| 2656 virtual bool AffectedBySideEffect() const { return !immutable_; } | 2653 virtual bool AffectedBySideEffect() const { return !immutable_; } |
| 2657 | 2654 |
| 2658 private: | 2655 private: |
| 2659 const intptr_t offset_in_bytes_; | 2656 const intptr_t offset_in_bytes_; |
| 2660 const AbstractType& type_; | 2657 const AbstractType& type_; |
| 2661 intptr_t result_cid_; | 2658 intptr_t result_cid_; |
| 2662 const bool immutable_; | 2659 const bool immutable_; |
| 2663 | 2660 |
| 2664 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr); | 2661 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2831 virtual intptr_t ResultCid() const { return kDynamicCid; } | 2828 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 2832 | 2829 |
| 2833 private: | 2830 private: |
| 2834 const intptr_t token_pos_; | 2831 const intptr_t token_pos_; |
| 2835 const intptr_t num_context_variables_; | 2832 const intptr_t num_context_variables_; |
| 2836 | 2833 |
| 2837 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr); | 2834 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr); |
| 2838 }; | 2835 }; |
| 2839 | 2836 |
| 2840 | 2837 |
| 2841 class ChainContextInstr : public TemplateDefinition<1> { | 2838 class ChainContextInstr : public TemplateInstruction<1> { |
| 2842 public: | 2839 public: |
| 2843 explicit ChainContextInstr(Value* context_value) { | 2840 explicit ChainContextInstr(Value* context_value) { |
| 2844 ASSERT(context_value != NULL); | 2841 ASSERT(context_value != NULL); |
| 2845 inputs_[0] = context_value; | 2842 inputs_[0] = context_value; |
| 2846 } | 2843 } |
| 2847 | 2844 |
| 2848 DECLARE_INSTRUCTION(ChainContext) | 2845 DECLARE_INSTRUCTION(ChainContext) |
| 2849 virtual RawAbstractType* CompileType() const; | 2846 virtual RawAbstractType* CompileType() const; |
| 2850 | 2847 |
| 2848 virtual intptr_t ArgumentCount() const { return 0; } |
| 2849 |
| 2851 Value* context_value() const { return inputs_[0]; } | 2850 Value* context_value() const { return inputs_[0]; } |
| 2852 | 2851 |
| 2853 virtual bool CanDeoptimize() const { return false; } | 2852 virtual bool CanDeoptimize() const { return false; } |
| 2854 | 2853 |
| 2855 virtual bool HasSideEffect() const { return true; } | 2854 virtual bool HasSideEffect() const { return true; } |
| 2856 | 2855 |
| 2857 virtual intptr_t ResultCid() const { return kIllegalCid; } | |
| 2858 | |
| 2859 private: | 2856 private: |
| 2860 DISALLOW_COPY_AND_ASSIGN(ChainContextInstr); | 2857 DISALLOW_COPY_AND_ASSIGN(ChainContextInstr); |
| 2861 }; | 2858 }; |
| 2862 | 2859 |
| 2863 | 2860 |
| 2864 class CloneContextInstr : public TemplateDefinition<1> { | 2861 class CloneContextInstr : public TemplateDefinition<1> { |
| 2865 public: | 2862 public: |
| 2866 CloneContextInstr(intptr_t token_pos, Value* context_value) | 2863 CloneContextInstr(intptr_t token_pos, Value* context_value) |
| 2867 : token_pos_(token_pos) { | 2864 : token_pos_(token_pos) { |
| 2868 ASSERT(context_value != NULL); | 2865 ASSERT(context_value != NULL); |
| 2869 inputs_[0] = context_value; | 2866 inputs_[0] = context_value; |
| 2870 } | 2867 } |
| 2871 | 2868 |
| 2872 intptr_t token_pos() const { return token_pos_; } | 2869 intptr_t token_pos() const { return token_pos_; } |
| 2873 Value* context_value() const { return inputs_[0]; } | 2870 Value* context_value() const { return inputs_[0]; } |
| 2874 | 2871 |
| 2875 DECLARE_INSTRUCTION(CloneContext) | 2872 DECLARE_INSTRUCTION(CloneContext) |
| 2876 virtual RawAbstractType* CompileType() const; | 2873 virtual RawAbstractType* CompileType() const; |
| 2877 | 2874 |
| 2878 virtual bool CanDeoptimize() const { return false; } | 2875 virtual bool CanDeoptimize() const { return false; } |
| 2879 | 2876 |
| 2880 virtual bool HasSideEffect() const { return false; } | 2877 virtual bool HasSideEffect() const { return false; } |
| 2881 | 2878 |
| 2882 virtual intptr_t ResultCid() const { return kIllegalCid; } | 2879 virtual intptr_t ResultCid() const { return kContextCid; } |
| 2883 | 2880 |
| 2884 private: | 2881 private: |
| 2885 const intptr_t token_pos_; | 2882 const intptr_t token_pos_; |
| 2886 | 2883 |
| 2887 DISALLOW_COPY_AND_ASSIGN(CloneContextInstr); | 2884 DISALLOW_COPY_AND_ASSIGN(CloneContextInstr); |
| 2888 }; | 2885 }; |
| 2889 | 2886 |
| 2890 | 2887 |
| 2891 class CatchEntryInstr : public TemplateDefinition<0> { | 2888 class CatchEntryInstr : public TemplateInstruction<0> { |
| 2892 public: | 2889 public: |
| 2893 CatchEntryInstr(const LocalVariable& exception_var, | 2890 CatchEntryInstr(const LocalVariable& exception_var, |
| 2894 const LocalVariable& stacktrace_var) | 2891 const LocalVariable& stacktrace_var) |
| 2895 : exception_var_(exception_var), stacktrace_var_(stacktrace_var) {} | 2892 : exception_var_(exception_var), stacktrace_var_(stacktrace_var) {} |
| 2896 | 2893 |
| 2897 const LocalVariable& exception_var() const { return exception_var_; } | 2894 const LocalVariable& exception_var() const { return exception_var_; } |
| 2898 const LocalVariable& stacktrace_var() const { return stacktrace_var_; } | 2895 const LocalVariable& stacktrace_var() const { return stacktrace_var_; } |
| 2899 | 2896 |
| 2900 DECLARE_INSTRUCTION(CatchEntry) | 2897 DECLARE_INSTRUCTION(CatchEntry) |
| 2901 virtual RawAbstractType* CompileType() const; | 2898 virtual RawAbstractType* CompileType() const; |
| 2902 | 2899 |
| 2900 virtual intptr_t ArgumentCount() const { return 0; } |
| 2901 |
| 2903 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2902 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 2904 | 2903 |
| 2905 virtual bool CanDeoptimize() const { return false; } | 2904 virtual bool CanDeoptimize() const { return false; } |
| 2906 | 2905 |
| 2907 virtual bool HasSideEffect() const { return true; } | 2906 virtual bool HasSideEffect() const { return true; } |
| 2908 | 2907 |
| 2909 virtual intptr_t ResultCid() const { return kIllegalCid; } | |
| 2910 | |
| 2911 private: | 2908 private: |
| 2912 const LocalVariable& exception_var_; | 2909 const LocalVariable& exception_var_; |
| 2913 const LocalVariable& stacktrace_var_; | 2910 const LocalVariable& stacktrace_var_; |
| 2914 | 2911 |
| 2915 DISALLOW_COPY_AND_ASSIGN(CatchEntryInstr); | 2912 DISALLOW_COPY_AND_ASSIGN(CatchEntryInstr); |
| 2916 }; | 2913 }; |
| 2917 | 2914 |
| 2918 | 2915 |
| 2919 class CheckEitherNonSmiInstr : public TemplateDefinition<2> { | 2916 class CheckEitherNonSmiInstr : public TemplateInstruction<2> { |
| 2920 public: | 2917 public: |
| 2921 CheckEitherNonSmiInstr(Value* left, | 2918 CheckEitherNonSmiInstr(Value* left, |
| 2922 Value* right, | 2919 Value* right, |
| 2923 InstanceCallInstr* instance_call) { | 2920 InstanceCallInstr* instance_call) { |
| 2924 ASSERT(left != NULL); | 2921 ASSERT(left != NULL); |
| 2925 ASSERT(right != NULL); | 2922 ASSERT(right != NULL); |
| 2926 inputs_[0] = left; | 2923 inputs_[0] = left; |
| 2927 inputs_[1] = right; | 2924 inputs_[1] = right; |
| 2928 deopt_id_ = instance_call->deopt_id(); | 2925 deopt_id_ = instance_call->deopt_id(); |
| 2929 } | 2926 } |
| 2930 | 2927 |
| 2931 DECLARE_INSTRUCTION(CheckEitherNonSmi) | 2928 DECLARE_INSTRUCTION(CheckEitherNonSmi) |
| 2932 virtual RawAbstractType* CompileType() const; | 2929 virtual RawAbstractType* CompileType() const; |
| 2933 | 2930 |
| 2931 virtual intptr_t ArgumentCount() const { return 0; } |
| 2932 |
| 2934 virtual bool CanDeoptimize() const { return true; } | 2933 virtual bool CanDeoptimize() const { return true; } |
| 2935 | 2934 |
| 2936 virtual bool HasSideEffect() const { return false; } | 2935 virtual bool HasSideEffect() const { return false; } |
| 2937 | 2936 |
| 2938 virtual intptr_t ResultCid() const { return kIllegalCid; } | 2937 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 2939 | |
| 2940 virtual bool AttributesEqual(Definition* other) const { return true; } | |
| 2941 | 2938 |
| 2942 virtual bool AffectedBySideEffect() const { return false; } | 2939 virtual bool AffectedBySideEffect() const { return false; } |
| 2943 | 2940 |
| 2944 Value* left() const { return inputs_[0]; } | 2941 Value* left() const { return inputs_[0]; } |
| 2945 | 2942 |
| 2946 Value* right() const { return inputs_[1]; } | 2943 Value* right() const { return inputs_[1]; } |
| 2947 | 2944 |
| 2948 virtual Definition* Canonicalize(); | 2945 virtual Instruction* Canonicalize(); |
| 2949 | 2946 |
| 2950 private: | 2947 private: |
| 2951 DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiInstr); | 2948 DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiInstr); |
| 2952 }; | 2949 }; |
| 2953 | 2950 |
| 2954 | 2951 |
| 2955 class BoxDoubleInstr : public TemplateDefinition<1> { | 2952 class BoxDoubleInstr : public TemplateDefinition<1> { |
| 2956 public: | 2953 public: |
| 2957 BoxDoubleInstr(Value* value, InstanceCallInstr* instance_call) | 2954 BoxDoubleInstr(Value* value, InstanceCallInstr* instance_call) |
| 2958 : token_pos_((instance_call != NULL) ? instance_call->token_pos() : 0) { | 2955 : token_pos_((instance_call != NULL) ? instance_call->token_pos() : 0) { |
| 2959 ASSERT(value != NULL); | 2956 ASSERT(value != NULL); |
| 2960 inputs_[0] = value; | 2957 inputs_[0] = value; |
| 2961 } | 2958 } |
| 2962 | 2959 |
| 2963 Value* value() const { return inputs_[0]; } | 2960 Value* value() const { return inputs_[0]; } |
| 2964 | 2961 |
| 2965 intptr_t token_pos() const { return token_pos_; } | 2962 intptr_t token_pos() const { return token_pos_; } |
| 2966 | 2963 |
| 2967 virtual bool CanDeoptimize() const { return false; } | 2964 virtual bool CanDeoptimize() const { return false; } |
| 2968 | 2965 |
| 2969 virtual bool HasSideEffect() const { return false; } | 2966 virtual bool HasSideEffect() const { return false; } |
| 2970 | 2967 |
| 2971 virtual bool AffectedBySideEffect() const { return false; } | 2968 virtual bool AffectedBySideEffect() const { return false; } |
| 2972 virtual bool AttributesEqual(Definition* other) const { return true; } | 2969 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 2973 | 2970 |
| 2974 virtual intptr_t ResultCid() const; | 2971 virtual intptr_t ResultCid() const; |
| 2975 | 2972 |
| 2976 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 2973 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 2977 ASSERT(idx == 0); | 2974 ASSERT(idx == 0); |
| 2978 return kUnboxedDouble; | 2975 return kUnboxedDouble; |
| 2979 } | 2976 } |
| 2980 | 2977 |
| 2981 DECLARE_INSTRUCTION(BoxDouble) | 2978 DECLARE_INSTRUCTION(BoxDouble) |
| 2982 virtual RawAbstractType* CompileType() const; | 2979 virtual RawAbstractType* CompileType() const; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3006 virtual bool HasSideEffect() const { return false; } | 3003 virtual bool HasSideEffect() const { return false; } |
| 3007 | 3004 |
| 3008 // The output is not an instance but when it is boxed it becomes double. | 3005 // The output is not an instance but when it is boxed it becomes double. |
| 3009 virtual intptr_t ResultCid() const { return kDoubleCid; } | 3006 virtual intptr_t ResultCid() const { return kDoubleCid; } |
| 3010 | 3007 |
| 3011 virtual Representation representation() const { | 3008 virtual Representation representation() const { |
| 3012 return kUnboxedDouble; | 3009 return kUnboxedDouble; |
| 3013 } | 3010 } |
| 3014 | 3011 |
| 3015 virtual bool AffectedBySideEffect() const { return false; } | 3012 virtual bool AffectedBySideEffect() const { return false; } |
| 3016 virtual bool AttributesEqual(Definition* other) const { return true; } | 3013 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 3017 | 3014 |
| 3018 DECLARE_INSTRUCTION(UnboxDouble) | 3015 DECLARE_INSTRUCTION(UnboxDouble) |
| 3019 virtual RawAbstractType* CompileType() const; | 3016 virtual RawAbstractType* CompileType() const; |
| 3020 | 3017 |
| 3021 private: | 3018 private: |
| 3022 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr); | 3019 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr); |
| 3023 }; | 3020 }; |
| 3024 | 3021 |
| 3025 | 3022 |
| 3026 class MathSqrtInstr : public TemplateDefinition<1> { | 3023 class MathSqrtInstr : public TemplateDefinition<1> { |
| 3027 public: | 3024 public: |
| 3028 MathSqrtInstr(Value* value, StaticCallInstr* instance_call) { | 3025 MathSqrtInstr(Value* value, StaticCallInstr* instance_call) { |
| 3029 ASSERT(value != NULL); | 3026 ASSERT(value != NULL); |
| 3030 inputs_[0] = value; | 3027 inputs_[0] = value; |
| 3031 deopt_id_ = instance_call->deopt_id(); | 3028 deopt_id_ = instance_call->deopt_id(); |
| 3032 } | 3029 } |
| 3033 | 3030 |
| 3034 Value* value() const { return inputs_[0]; } | 3031 Value* value() const { return inputs_[0]; } |
| 3035 | 3032 |
| 3036 virtual bool CanDeoptimize() const { return false; } | 3033 virtual bool CanDeoptimize() const { return false; } |
| 3037 | 3034 |
| 3038 virtual bool HasSideEffect() const { return false; } | 3035 virtual bool HasSideEffect() const { return false; } |
| 3039 | 3036 |
| 3040 virtual bool AttributesEqual(Definition* other) const { | 3037 virtual bool AttributesEqual(Instruction* other) const { |
| 3041 return true; | 3038 return true; |
| 3042 } | 3039 } |
| 3043 | 3040 |
| 3044 // The output is not an instance but when it is boxed it becomes double. | 3041 // The output is not an instance but when it is boxed it becomes double. |
| 3045 virtual intptr_t ResultCid() const { return kDoubleCid; } | 3042 virtual intptr_t ResultCid() const { return kDoubleCid; } |
| 3046 | 3043 |
| 3047 virtual Representation representation() const { | 3044 virtual Representation representation() const { |
| 3048 return kUnboxedDouble; | 3045 return kUnboxedDouble; |
| 3049 } | 3046 } |
| 3050 | 3047 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3087 Token::Kind op_kind() const { return op_kind_; } | 3084 Token::Kind op_kind() const { return op_kind_; } |
| 3088 | 3085 |
| 3089 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3086 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3090 | 3087 |
| 3091 virtual bool CanDeoptimize() const { return false; } | 3088 virtual bool CanDeoptimize() const { return false; } |
| 3092 | 3089 |
| 3093 virtual bool HasSideEffect() const { return false; } | 3090 virtual bool HasSideEffect() const { return false; } |
| 3094 | 3091 |
| 3095 virtual bool AffectedBySideEffect() const { return false; } | 3092 virtual bool AffectedBySideEffect() const { return false; } |
| 3096 | 3093 |
| 3097 virtual bool AttributesEqual(Definition* other) const { | 3094 virtual bool AttributesEqual(Instruction* other) const { |
| 3098 return op_kind() == other->AsUnboxedDoubleBinaryOp()->op_kind(); | 3095 return op_kind() == other->AsUnboxedDoubleBinaryOp()->op_kind(); |
| 3099 } | 3096 } |
| 3100 | 3097 |
| 3101 // The output is not an instance but when it is boxed it becomes double. | 3098 // The output is not an instance but when it is boxed it becomes double. |
| 3102 virtual intptr_t ResultCid() const { return kDoubleCid; } | 3099 virtual intptr_t ResultCid() const { return kDoubleCid; } |
| 3103 | 3100 |
| 3104 virtual Representation representation() const { | 3101 virtual Representation representation() const { |
| 3105 return kUnboxedDouble; | 3102 return kUnboxedDouble; |
| 3106 } | 3103 } |
| 3107 | 3104 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3152 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3149 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3153 | 3150 |
| 3154 DECLARE_INSTRUCTION(BinarySmiOp) | 3151 DECLARE_INSTRUCTION(BinarySmiOp) |
| 3155 virtual RawAbstractType* CompileType() const; | 3152 virtual RawAbstractType* CompileType() const; |
| 3156 | 3153 |
| 3157 virtual bool CanDeoptimize() const; | 3154 virtual bool CanDeoptimize() const; |
| 3158 | 3155 |
| 3159 virtual bool HasSideEffect() const { return false; } | 3156 virtual bool HasSideEffect() const { return false; } |
| 3160 | 3157 |
| 3161 virtual bool AffectedBySideEffect() const { return false; } | 3158 virtual bool AffectedBySideEffect() const { return false; } |
| 3162 virtual bool AttributesEqual(Definition* other) const; | 3159 virtual bool AttributesEqual(Instruction* other) const; |
| 3163 | 3160 |
| 3164 virtual intptr_t ResultCid() const; | 3161 virtual intptr_t ResultCid() const; |
| 3165 | 3162 |
| 3166 private: | 3163 private: |
| 3167 const Token::Kind op_kind_; | 3164 const Token::Kind op_kind_; |
| 3168 InstanceCallInstr* instance_call_; | 3165 InstanceCallInstr* instance_call_; |
| 3169 | 3166 |
| 3170 DISALLOW_COPY_AND_ASSIGN(BinarySmiOpInstr); | 3167 DISALLOW_COPY_AND_ASSIGN(BinarySmiOpInstr); |
| 3171 }; | 3168 }; |
| 3172 | 3169 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3242 virtual intptr_t ResultCid() const { return kSmiCid; } | 3239 virtual intptr_t ResultCid() const { return kSmiCid; } |
| 3243 | 3240 |
| 3244 private: | 3241 private: |
| 3245 const Token::Kind op_kind_; | 3242 const Token::Kind op_kind_; |
| 3246 InstanceCallInstr* instance_call_; | 3243 InstanceCallInstr* instance_call_; |
| 3247 | 3244 |
| 3248 DISALLOW_COPY_AND_ASSIGN(UnarySmiOpInstr); | 3245 DISALLOW_COPY_AND_ASSIGN(UnarySmiOpInstr); |
| 3249 }; | 3246 }; |
| 3250 | 3247 |
| 3251 | 3248 |
| 3252 class CheckStackOverflowInstr : public TemplateDefinition<0> { | 3249 class CheckStackOverflowInstr : public TemplateInstruction<0> { |
| 3253 public: | 3250 public: |
| 3254 explicit CheckStackOverflowInstr(intptr_t token_pos) | 3251 explicit CheckStackOverflowInstr(intptr_t token_pos) |
| 3255 : token_pos_(token_pos) {} | 3252 : token_pos_(token_pos) {} |
| 3256 | 3253 |
| 3257 intptr_t token_pos() const { return token_pos_; } | 3254 intptr_t token_pos() const { return token_pos_; } |
| 3258 | 3255 |
| 3259 DECLARE_INSTRUCTION(CheckStackOverflow) | 3256 DECLARE_INSTRUCTION(CheckStackOverflow) |
| 3260 virtual RawAbstractType* CompileType() const; | 3257 virtual RawAbstractType* CompileType() const; |
| 3261 | 3258 |
| 3259 virtual intptr_t ArgumentCount() const { return 0; } |
| 3260 |
| 3262 virtual bool CanDeoptimize() const { return false; } | 3261 virtual bool CanDeoptimize() const { return false; } |
| 3263 | 3262 |
| 3264 virtual bool HasSideEffect() const { return false; } | 3263 virtual bool HasSideEffect() const { return false; } |
| 3265 | 3264 |
| 3266 virtual intptr_t ResultCid() const { return kIllegalCid; } | |
| 3267 | |
| 3268 private: | 3265 private: |
| 3269 const intptr_t token_pos_; | 3266 const intptr_t token_pos_; |
| 3270 | 3267 |
| 3271 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowInstr); | 3268 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowInstr); |
| 3272 }; | 3269 }; |
| 3273 | 3270 |
| 3274 | 3271 |
| 3275 class DoubleToDoubleInstr : public TemplateDefinition<1> { | 3272 class DoubleToDoubleInstr : public TemplateDefinition<1> { |
| 3276 public: | 3273 public: |
| 3277 DoubleToDoubleInstr(Value* value, InstanceCallInstr* instance_call) | 3274 DoubleToDoubleInstr(Value* value, InstanceCallInstr* instance_call) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3318 | 3315 |
| 3319 virtual intptr_t ResultCid() const { return kDoubleCid; } | 3316 virtual intptr_t ResultCid() const { return kDoubleCid; } |
| 3320 | 3317 |
| 3321 private: | 3318 private: |
| 3322 InstanceCallInstr* instance_call_; | 3319 InstanceCallInstr* instance_call_; |
| 3323 | 3320 |
| 3324 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); | 3321 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); |
| 3325 }; | 3322 }; |
| 3326 | 3323 |
| 3327 | 3324 |
| 3328 class CheckClassInstr : public TemplateDefinition<1> { | 3325 class CheckClassInstr : public TemplateInstruction<1> { |
| 3329 public: | 3326 public: |
| 3330 CheckClassInstr(Value* value, | 3327 CheckClassInstr(Value* value, |
| 3331 InstanceCallInstr* instance_call, | 3328 InstanceCallInstr* instance_call, |
| 3332 const ICData& unary_checks) | 3329 const ICData& unary_checks) |
| 3333 : unary_checks_(unary_checks) { | 3330 : unary_checks_(unary_checks) { |
| 3334 ASSERT(value != NULL); | 3331 ASSERT(value != NULL); |
| 3335 inputs_[0] = value; | 3332 inputs_[0] = value; |
| 3336 deopt_id_ = instance_call->deopt_id(); | 3333 deopt_id_ = instance_call->deopt_id(); |
| 3337 } | 3334 } |
| 3338 | 3335 |
| 3339 DECLARE_INSTRUCTION(CheckClass) | 3336 DECLARE_INSTRUCTION(CheckClass) |
| 3340 virtual RawAbstractType* CompileType() const; | 3337 virtual RawAbstractType* CompileType() const; |
| 3341 | 3338 |
| 3339 virtual intptr_t ArgumentCount() const { return 0; } |
| 3340 |
| 3342 virtual bool CanDeoptimize() const { return true; } | 3341 virtual bool CanDeoptimize() const { return true; } |
| 3343 | 3342 |
| 3344 virtual bool HasSideEffect() const { return false; } | 3343 virtual bool HasSideEffect() const { return false; } |
| 3345 | 3344 |
| 3346 virtual intptr_t ResultCid() const { return kIllegalCid; } | 3345 virtual bool AttributesEqual(Instruction* other) const; |
| 3347 | |
| 3348 virtual bool AttributesEqual(Definition* other) const; | |
| 3349 | 3346 |
| 3350 virtual bool AffectedBySideEffect() const { return false; } | 3347 virtual bool AffectedBySideEffect() const { return false; } |
| 3351 | 3348 |
| 3352 Value* value() const { return inputs_[0]; } | 3349 Value* value() const { return inputs_[0]; } |
| 3353 | 3350 |
| 3354 const ICData& unary_checks() const { return unary_checks_; } | 3351 const ICData& unary_checks() const { return unary_checks_; } |
| 3355 | 3352 |
| 3356 virtual Definition* Canonicalize(); | 3353 virtual Instruction* Canonicalize(); |
| 3357 | 3354 |
| 3358 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3355 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3359 | 3356 |
| 3360 private: | 3357 private: |
| 3361 const ICData& unary_checks_; | 3358 const ICData& unary_checks_; |
| 3362 | 3359 |
| 3363 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr); | 3360 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr); |
| 3364 }; | 3361 }; |
| 3365 | 3362 |
| 3366 | 3363 |
| 3367 class CheckSmiInstr : public TemplateDefinition<1> { | 3364 class CheckSmiInstr : public TemplateInstruction<1> { |
| 3368 public: | 3365 public: |
| 3369 CheckSmiInstr(Value* value, intptr_t original_deopt_id) { | 3366 CheckSmiInstr(Value* value, intptr_t original_deopt_id) { |
| 3370 ASSERT(value != NULL); | 3367 ASSERT(value != NULL); |
| 3371 ASSERT(original_deopt_id != Isolate::kNoDeoptId); | 3368 ASSERT(original_deopt_id != Isolate::kNoDeoptId); |
| 3372 inputs_[0] = value; | 3369 inputs_[0] = value; |
| 3373 deopt_id_ = original_deopt_id; | 3370 deopt_id_ = original_deopt_id; |
| 3374 } | 3371 } |
| 3375 | 3372 |
| 3376 DECLARE_INSTRUCTION(CheckSmi) | 3373 DECLARE_INSTRUCTION(CheckSmi) |
| 3377 virtual RawAbstractType* CompileType() const; | 3374 virtual RawAbstractType* CompileType() const; |
| 3378 | 3375 |
| 3376 virtual intptr_t ArgumentCount() const { return 0; } |
| 3377 |
| 3379 virtual bool CanDeoptimize() const { return true; } | 3378 virtual bool CanDeoptimize() const { return true; } |
| 3380 | 3379 |
| 3381 virtual bool HasSideEffect() const { return false; } | 3380 virtual bool HasSideEffect() const { return false; } |
| 3382 | 3381 |
| 3383 virtual intptr_t ResultCid() const { return kIllegalCid; } | 3382 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 3384 | |
| 3385 virtual bool AttributesEqual(Definition* other) const { return true; } | |
| 3386 | 3383 |
| 3387 virtual bool AffectedBySideEffect() const { return false; } | 3384 virtual bool AffectedBySideEffect() const { return false; } |
| 3388 | 3385 |
| 3389 virtual Definition* Canonicalize(); | 3386 virtual Instruction* Canonicalize(); |
| 3390 | 3387 |
| 3391 Value* value() const { return inputs_[0]; } | 3388 Value* value() const { return inputs_[0]; } |
| 3392 | 3389 |
| 3393 private: | 3390 private: |
| 3394 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); | 3391 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); |
| 3395 }; | 3392 }; |
| 3396 | 3393 |
| 3397 | 3394 |
| 3398 class CheckArrayBoundInstr : public TemplateDefinition<2> { | 3395 class CheckArrayBoundInstr : public TemplateInstruction<2> { |
| 3399 public: | 3396 public: |
| 3400 CheckArrayBoundInstr(Value* array, | 3397 CheckArrayBoundInstr(Value* array, |
| 3401 Value* index, | 3398 Value* index, |
| 3402 intptr_t array_type, | 3399 intptr_t array_type, |
| 3403 InstanceCallInstr* instance_call) | 3400 InstanceCallInstr* instance_call) |
| 3404 : array_type_(array_type) { | 3401 : array_type_(array_type) { |
| 3405 ASSERT(array != NULL); | 3402 ASSERT(array != NULL); |
| 3406 ASSERT(index != NULL); | 3403 ASSERT(index != NULL); |
| 3407 inputs_[0] = array; | 3404 inputs_[0] = array; |
| 3408 inputs_[1] = index; | 3405 inputs_[1] = index; |
| 3409 deopt_id_ = instance_call->deopt_id(); | 3406 deopt_id_ = instance_call->deopt_id(); |
| 3410 } | 3407 } |
| 3411 | 3408 |
| 3412 DECLARE_INSTRUCTION(CheckArrayBound) | 3409 DECLARE_INSTRUCTION(CheckArrayBound) |
| 3413 virtual RawAbstractType* CompileType() const; | 3410 virtual RawAbstractType* CompileType() const; |
| 3414 | 3411 |
| 3412 virtual intptr_t ArgumentCount() const { return 0; } |
| 3413 |
| 3415 virtual bool CanDeoptimize() const { return true; } | 3414 virtual bool CanDeoptimize() const { return true; } |
| 3416 | 3415 |
| 3417 virtual bool HasSideEffect() const { return false; } | 3416 virtual bool HasSideEffect() const { return false; } |
| 3418 | 3417 |
| 3419 virtual intptr_t ResultCid() const { return kIllegalCid; } | 3418 virtual bool AttributesEqual(Instruction* other) const; |
| 3420 | |
| 3421 virtual bool AttributesEqual(Definition* other) const; | |
| 3422 | 3419 |
| 3423 virtual bool AffectedBySideEffect() const { return false; } | 3420 virtual bool AffectedBySideEffect() const { return false; } |
| 3424 | 3421 |
| 3425 Value* array() const { return inputs_[0]; } | 3422 Value* array() const { return inputs_[0]; } |
| 3426 Value* index() const { return inputs_[1]; } | 3423 Value* index() const { return inputs_[1]; } |
| 3427 | 3424 |
| 3428 intptr_t array_type() const { return array_type_; } | 3425 intptr_t array_type() const { return array_type_; } |
| 3429 | 3426 |
| 3430 private: | 3427 private: |
| 3431 intptr_t array_type_; | 3428 intptr_t array_type_; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3641 ForwardInstructionIterator* current_iterator_; | 3638 ForwardInstructionIterator* current_iterator_; |
| 3642 | 3639 |
| 3643 private: | 3640 private: |
| 3644 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 3641 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 3645 }; | 3642 }; |
| 3646 | 3643 |
| 3647 | 3644 |
| 3648 } // namespace dart | 3645 } // namespace dart |
| 3649 | 3646 |
| 3650 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 3647 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |