| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 FOR_EACH_INSTRUCTION(DECLARE_TAG) | 611 FOR_EACH_INSTRUCTION(DECLARE_TAG) |
| 612 }; | 612 }; |
| 613 #undef DECLARE_TAG | 613 #undef DECLARE_TAG |
| 614 | 614 |
| 615 Instruction() | 615 Instruction() |
| 616 : deopt_id_(Isolate::Current()->GetNextDeoptId()), | 616 : deopt_id_(Isolate::Current()->GetNextDeoptId()), |
| 617 lifetime_position_(-1), | 617 lifetime_position_(-1), |
| 618 previous_(NULL), | 618 previous_(NULL), |
| 619 next_(NULL), | 619 next_(NULL), |
| 620 env_(NULL), | 620 env_(NULL), |
| 621 expr_id_(-1) { } | 621 expr_id_(kNoExprId) { } |
| 622 | 622 |
| 623 virtual Tag tag() const = 0; | 623 virtual Tag tag() const = 0; |
| 624 | 624 |
| 625 intptr_t deopt_id() const { | 625 intptr_t deopt_id() const { |
| 626 ASSERT(CanDeoptimize() || CanBeDeoptimizationTarget()); | 626 ASSERT(CanDeoptimize() || CanBeDeoptimizationTarget()); |
| 627 return deopt_id_; | 627 return deopt_id_; |
| 628 } | 628 } |
| 629 | 629 |
| 630 bool IsBlockEntry() { return (AsBlockEntry() != NULL); } | 630 bool IsBlockEntry() { return (AsBlockEntry() != NULL); } |
| 631 virtual BlockEntryInstr* AsBlockEntry() { return NULL; } | 631 virtual BlockEntryInstr* AsBlockEntry() { return NULL; } |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 | 787 |
| 788 // Returns set of effects that affect this instruction. | 788 // Returns set of effects that affect this instruction. |
| 789 virtual EffectSet Dependencies() const { | 789 virtual EffectSet Dependencies() const { |
| 790 UNREACHABLE(); | 790 UNREACHABLE(); |
| 791 return EffectSet::All(); | 791 return EffectSet::All(); |
| 792 } | 792 } |
| 793 | 793 |
| 794 // Get the block entry for this instruction. | 794 // Get the block entry for this instruction. |
| 795 virtual BlockEntryInstr* GetBlock() const; | 795 virtual BlockEntryInstr* GetBlock() const; |
| 796 | 796 |
| 797 // Id for instructions used in CSE. | 797 // Id for load instructions used during load forwarding pass and later in |
| 798 // LICM. |
| 798 intptr_t expr_id() const { return expr_id_; } | 799 intptr_t expr_id() const { return expr_id_; } |
| 799 void set_expr_id(intptr_t expr_id) { expr_id_ = expr_id; } | 800 void set_expr_id(intptr_t expr_id) { expr_id_ = expr_id; } |
| 801 bool HasExprId() const { return expr_id_ != kNoExprId; } |
| 800 | 802 |
| 801 // Returns a hash code for use with hash maps. | 803 // Returns a hash code for use with hash maps. |
| 802 virtual intptr_t Hashcode() const; | 804 virtual intptr_t Hashcode() const; |
| 803 | 805 |
| 804 // Compares two instructions. Returns true, iff: | 806 // Compares two instructions. Returns true, iff: |
| 805 // 1. They have the same tag. | 807 // 1. They have the same tag. |
| 806 // 2. All input operands are Equals. | 808 // 2. All input operands are Equals. |
| 807 // 3. They satisfy AttributesEqual. | 809 // 3. They satisfy AttributesEqual. |
| 808 bool Equals(Instruction* other) const; | 810 bool Equals(Instruction* other) const; |
| 809 | 811 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 friend class TargetEntryInstr; | 883 friend class TargetEntryInstr; |
| 882 friend class JoinEntryInstr; | 884 friend class JoinEntryInstr; |
| 883 friend class InstanceOfInstr; | 885 friend class InstanceOfInstr; |
| 884 friend class PolymorphicInstanceCallInstr; | 886 friend class PolymorphicInstanceCallInstr; |
| 885 friend class SmiToDoubleInstr; | 887 friend class SmiToDoubleInstr; |
| 886 friend class DoubleToIntegerInstr; | 888 friend class DoubleToIntegerInstr; |
| 887 friend class BranchSimplifier; | 889 friend class BranchSimplifier; |
| 888 | 890 |
| 889 virtual void RawSetInputAt(intptr_t i, Value* value) = 0; | 891 virtual void RawSetInputAt(intptr_t i, Value* value) = 0; |
| 890 | 892 |
| 893 enum { |
| 894 kNoExprId = -1 |
| 895 }; |
| 896 |
| 891 intptr_t deopt_id_; | 897 intptr_t deopt_id_; |
| 892 intptr_t lifetime_position_; // Position used by register allocator. | 898 intptr_t lifetime_position_; // Position used by register allocator. |
| 893 Instruction* previous_; | 899 Instruction* previous_; |
| 894 Instruction* next_; | 900 Instruction* next_; |
| 895 Environment* env_; | 901 Environment* env_; |
| 896 intptr_t expr_id_; | 902 intptr_t expr_id_; |
| 897 | 903 |
| 898 DISALLOW_COPY_AND_ASSIGN(Instruction); | 904 DISALLOW_COPY_AND_ASSIGN(Instruction); |
| 899 }; | 905 }; |
| 900 | 906 |
| (...skipping 5170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6071 ForwardInstructionIterator* current_iterator_; | 6077 ForwardInstructionIterator* current_iterator_; |
| 6072 | 6078 |
| 6073 private: | 6079 private: |
| 6074 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 6080 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 6075 }; | 6081 }; |
| 6076 | 6082 |
| 6077 | 6083 |
| 6078 } // namespace dart | 6084 } // namespace dart |
| 6079 | 6085 |
| 6080 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 6086 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |