| 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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 class Instruction : public ZoneAllocated { | 603 class Instruction : public ZoneAllocated { |
| 604 public: | 604 public: |
| 605 #define DECLARE_TAG(type) k##type, | 605 #define DECLARE_TAG(type) k##type, |
| 606 enum Tag { | 606 enum Tag { |
| 607 FOR_EACH_INSTRUCTION(DECLARE_TAG) | 607 FOR_EACH_INSTRUCTION(DECLARE_TAG) |
| 608 }; | 608 }; |
| 609 #undef DECLARE_TAG | 609 #undef DECLARE_TAG |
| 610 | 610 |
| 611 explicit Instruction(intptr_t deopt_id = Isolate::kNoDeoptId) | 611 explicit Instruction(intptr_t deopt_id = Isolate::kNoDeoptId) |
| 612 : deopt_id_(deopt_id), | 612 : deopt_id_(deopt_id), |
| 613 lifetime_position_(-1), | 613 lifetime_position_(kNoPlaceId), |
| 614 previous_(NULL), | 614 previous_(NULL), |
| 615 next_(NULL), | 615 next_(NULL), |
| 616 env_(NULL), | 616 env_(NULL), |
| 617 locs_(NULL), | 617 locs_(NULL), |
| 618 inlining_id_(-1), | 618 inlining_id_(-1) { } |
| 619 place_id_(kNoPlaceId) { } | |
| 620 | 619 |
| 621 virtual ~Instruction() { } | 620 virtual ~Instruction() { } |
| 622 | 621 |
| 623 virtual Tag tag() const = 0; | 622 virtual Tag tag() const = 0; |
| 624 | 623 |
| 625 intptr_t deopt_id() const { | 624 intptr_t deopt_id() const { |
| 626 ASSERT(CanDeoptimize() || CanBecomeDeoptimizationTarget()); | 625 ASSERT(CanDeoptimize() || CanBecomeDeoptimizationTarget()); |
| 627 return GetDeoptId(); | 626 return GetDeoptId(); |
| 628 } | 627 } |
| 629 | 628 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 } | 881 } |
| 883 | 882 |
| 884 private: | 883 private: |
| 885 virtual void RawSetInputAt(intptr_t i, Value* value) = 0; | 884 virtual void RawSetInputAt(intptr_t i, Value* value) = 0; |
| 886 | 885 |
| 887 enum { | 886 enum { |
| 888 kNoPlaceId = -1 | 887 kNoPlaceId = -1 |
| 889 }; | 888 }; |
| 890 | 889 |
| 891 intptr_t deopt_id_; | 890 intptr_t deopt_id_; |
| 892 intptr_t lifetime_position_; // Position used by register allocator. | 891 union { |
| 892 intptr_t lifetime_position_; // Position used by register allocator. |
| 893 intptr_t place_id_; |
| 894 }; |
| 893 Instruction* previous_; | 895 Instruction* previous_; |
| 894 Instruction* next_; | 896 Instruction* next_; |
| 895 Environment* env_; | 897 Environment* env_; |
| 896 LocationSummary* locs_; | 898 LocationSummary* locs_; |
| 897 intptr_t inlining_id_; | 899 intptr_t inlining_id_; |
| 898 intptr_t place_id_; | |
| 899 | 900 |
| 900 DISALLOW_COPY_AND_ASSIGN(Instruction); | 901 DISALLOW_COPY_AND_ASSIGN(Instruction); |
| 901 }; | 902 }; |
| 902 | 903 |
| 903 | 904 |
| 904 class PureInstruction : public Instruction { | 905 class PureInstruction : public Instruction { |
| 905 public: | 906 public: |
| 906 explicit PureInstruction(intptr_t deopt_id) | 907 explicit PureInstruction(intptr_t deopt_id) |
| 907 : Instruction(deopt_id) { } | 908 : Instruction(deopt_id) { } |
| 908 | 909 |
| (...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2151 const char* message_; | 2152 const char* message_; |
| 2152 | 2153 |
| 2153 DISALLOW_COPY_AND_ASSIGN(StopInstr); | 2154 DISALLOW_COPY_AND_ASSIGN(StopInstr); |
| 2154 }; | 2155 }; |
| 2155 | 2156 |
| 2156 | 2157 |
| 2157 class GotoInstr : public TemplateInstruction<0, NoThrow> { | 2158 class GotoInstr : public TemplateInstruction<0, NoThrow> { |
| 2158 public: | 2159 public: |
| 2159 explicit GotoInstr(JoinEntryInstr* entry) | 2160 explicit GotoInstr(JoinEntryInstr* entry) |
| 2160 : TemplateInstruction(Isolate::Current()->GetNextDeoptId()), | 2161 : TemplateInstruction(Isolate::Current()->GetNextDeoptId()), |
| 2162 block_(NULL), |
| 2161 successor_(entry), | 2163 successor_(entry), |
| 2162 edge_weight_(0.0), | 2164 edge_weight_(0.0), |
| 2163 parallel_move_(NULL) { | 2165 parallel_move_(NULL) { |
| 2164 } | 2166 } |
| 2165 | 2167 |
| 2166 DECLARE_INSTRUCTION(Goto) | 2168 DECLARE_INSTRUCTION(Goto) |
| 2167 | 2169 |
| 2170 BlockEntryInstr* block() const { return block_; } |
| 2171 void set_block(BlockEntryInstr* block) { block_ = block; } |
| 2172 |
| 2168 JoinEntryInstr* successor() const { return successor_; } | 2173 JoinEntryInstr* successor() const { return successor_; } |
| 2169 void set_successor(JoinEntryInstr* successor) { successor_ = successor; } | 2174 void set_successor(JoinEntryInstr* successor) { successor_ = successor; } |
| 2170 virtual intptr_t SuccessorCount() const; | 2175 virtual intptr_t SuccessorCount() const; |
| 2171 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; | 2176 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; |
| 2172 | 2177 |
| 2173 double edge_weight() const { return edge_weight_; } | 2178 double edge_weight() const { return edge_weight_; } |
| 2174 void set_edge_weight(double weight) { edge_weight_ = weight; } | 2179 void set_edge_weight(double weight) { edge_weight_ = weight; } |
| 2175 void adjust_edge_weight(double scale_factor) { edge_weight_ *= scale_factor; } | 2180 void adjust_edge_weight(double scale_factor) { edge_weight_ *= scale_factor; } |
| 2176 | 2181 |
| 2177 virtual bool CanBecomeDeoptimizationTarget() const { | 2182 virtual bool CanBecomeDeoptimizationTarget() const { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2199 ParallelMoveInstr* GetParallelMove() { | 2204 ParallelMoveInstr* GetParallelMove() { |
| 2200 if (parallel_move_ == NULL) { | 2205 if (parallel_move_ == NULL) { |
| 2201 parallel_move_ = new ParallelMoveInstr(); | 2206 parallel_move_ = new ParallelMoveInstr(); |
| 2202 } | 2207 } |
| 2203 return parallel_move_; | 2208 return parallel_move_; |
| 2204 } | 2209 } |
| 2205 | 2210 |
| 2206 virtual void PrintTo(BufferFormatter* f) const; | 2211 virtual void PrintTo(BufferFormatter* f) const; |
| 2207 | 2212 |
| 2208 private: | 2213 private: |
| 2214 BlockEntryInstr* block_; |
| 2209 JoinEntryInstr* successor_; | 2215 JoinEntryInstr* successor_; |
| 2210 double edge_weight_; | 2216 double edge_weight_; |
| 2211 | 2217 |
| 2212 // Parallel move that will be used by linear scan register allocator to | 2218 // Parallel move that will be used by linear scan register allocator to |
| 2213 // connect live ranges at the end of the block and resolve phis. | 2219 // connect live ranges at the end of the block and resolve phis. |
| 2214 ParallelMoveInstr* parallel_move_; | 2220 ParallelMoveInstr* parallel_move_; |
| 2215 }; | 2221 }; |
| 2216 | 2222 |
| 2217 | 2223 |
| 2218 // IndirectGotoInstr represents a dynamically computed jump. Only | 2224 // IndirectGotoInstr represents a dynamically computed jump. Only |
| (...skipping 5886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8105 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8111 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
| 8106 UNIMPLEMENTED(); \ | 8112 UNIMPLEMENTED(); \ |
| 8107 return NULL; \ | 8113 return NULL; \ |
| 8108 } \ | 8114 } \ |
| 8109 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8115 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
| 8110 | 8116 |
| 8111 | 8117 |
| 8112 } // namespace dart | 8118 } // namespace dart |
| 8113 | 8119 |
| 8114 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 8120 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |