| 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 8155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8166 | 8166 |
| 8167 DISALLOW_COPY_AND_ASSIGN(Environment); | 8167 DISALLOW_COPY_AND_ASSIGN(Environment); |
| 8168 }; | 8168 }; |
| 8169 | 8169 |
| 8170 | 8170 |
| 8171 // Visitor base class to visit each instruction and computation in a flow | 8171 // Visitor base class to visit each instruction and computation in a flow |
| 8172 // graph as defined by a reversed list of basic blocks. | 8172 // graph as defined by a reversed list of basic blocks. |
| 8173 class FlowGraphVisitor : public ValueObject { | 8173 class FlowGraphVisitor : public ValueObject { |
| 8174 public: | 8174 public: |
| 8175 explicit FlowGraphVisitor(const GrowableArray<BlockEntryInstr*>& block_order) | 8175 explicit FlowGraphVisitor(const GrowableArray<BlockEntryInstr*>& block_order) |
| 8176 : block_order_(block_order), current_iterator_(NULL) { } | 8176 : current_iterator_(NULL), block_order_(block_order) { } |
| 8177 virtual ~FlowGraphVisitor() { } | 8177 virtual ~FlowGraphVisitor() { } |
| 8178 | 8178 |
| 8179 ForwardInstructionIterator* current_iterator() const { | 8179 ForwardInstructionIterator* current_iterator() const { |
| 8180 return current_iterator_; | 8180 return current_iterator_; |
| 8181 } | 8181 } |
| 8182 | 8182 |
| 8183 // Visit each block in the block order, and for each block its | 8183 // Visit each block in the block order, and for each block its |
| 8184 // instructions in order from the block entry to exit. | 8184 // instructions in order from the block entry to exit. |
| 8185 virtual void VisitBlocks(); | 8185 virtual void VisitBlocks(); |
| 8186 | 8186 |
| 8187 // Visit functions for instruction classes, with an empty default | 8187 // Visit functions for instruction classes, with an empty default |
| 8188 // implementation. | 8188 // implementation. |
| 8189 #define DECLARE_VISIT_INSTRUCTION(ShortName) \ | 8189 #define DECLARE_VISIT_INSTRUCTION(ShortName) \ |
| 8190 virtual void Visit##ShortName(ShortName##Instr* instr) { } | 8190 virtual void Visit##ShortName(ShortName##Instr* instr) { } |
| 8191 | 8191 |
| 8192 FOR_EACH_INSTRUCTION(DECLARE_VISIT_INSTRUCTION) | 8192 FOR_EACH_INSTRUCTION(DECLARE_VISIT_INSTRUCTION) |
| 8193 | 8193 |
| 8194 #undef DECLARE_VISIT_INSTRUCTION | 8194 #undef DECLARE_VISIT_INSTRUCTION |
| 8195 | 8195 |
| 8196 protected: | 8196 protected: |
| 8197 const GrowableArray<BlockEntryInstr*>& block_order_; | |
| 8198 ForwardInstructionIterator* current_iterator_; | 8197 ForwardInstructionIterator* current_iterator_; |
| 8199 | 8198 |
| 8200 private: | 8199 private: |
| 8200 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 8201 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 8201 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 8202 }; | 8202 }; |
| 8203 | 8203 |
| 8204 | 8204 |
| 8205 // Helper macros for platform ports. | 8205 // Helper macros for platform ports. |
| 8206 #define DEFINE_UNIMPLEMENTED_INSTRUCTION(Name) \ | 8206 #define DEFINE_UNIMPLEMENTED_INSTRUCTION(Name) \ |
| 8207 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8207 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
| 8208 UNIMPLEMENTED(); \ | 8208 UNIMPLEMENTED(); \ |
| 8209 return NULL; \ | 8209 return NULL; \ |
| 8210 } \ | 8210 } \ |
| 8211 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8211 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
| 8212 | 8212 |
| 8213 | 8213 |
| 8214 } // namespace dart | 8214 } // namespace dart |
| 8215 | 8215 |
| 8216 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 8216 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |