| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 288 |
| 289 protected: | 289 protected: |
| 290 EmbeddedArray<Value*, N> inputs_; | 290 EmbeddedArray<Value*, N> inputs_; |
| 291 }; | 291 }; |
| 292 | 292 |
| 293 | 293 |
| 294 class Value : public TemplateComputation<0> { | 294 class Value : public TemplateComputation<0> { |
| 295 public: | 295 public: |
| 296 Value() { } | 296 Value() { } |
| 297 | 297 |
| 298 // Returns true if the value is constant null. |
| 299 bool IsConstantNull() const; |
| 300 |
| 301 // Reminder: The type of the constant null is the bottom type, which is more |
| 302 // specific than any type. |
| 298 bool CompileTypeIsMoreSpecificThan(const AbstractType& dst_type) const; | 303 bool CompileTypeIsMoreSpecificThan(const AbstractType& dst_type) const; |
| 299 | 304 |
| 300 virtual void RemoveFromUseList() = 0; | 305 virtual void RemoveFromUseList() = 0; |
| 301 | 306 |
| 302 private: | 307 private: |
| 303 DISALLOW_COPY_AND_ASSIGN(Value); | 308 DISALLOW_COPY_AND_ASSIGN(Value); |
| 304 }; | 309 }; |
| 305 | 310 |
| 306 | 311 |
| 307 // Functions defined in all concrete computation classes. | 312 // Functions defined in all concrete computation classes. |
| (...skipping 2567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2875 | 2880 |
| 2876 DISALLOW_COPY_AND_ASSIGN(Environment); | 2881 DISALLOW_COPY_AND_ASSIGN(Environment); |
| 2877 }; | 2882 }; |
| 2878 | 2883 |
| 2879 | 2884 |
| 2880 // Visitor base class to visit each instruction and computation in a flow | 2885 // Visitor base class to visit each instruction and computation in a flow |
| 2881 // graph as defined by a reversed list of basic blocks. | 2886 // graph as defined by a reversed list of basic blocks. |
| 2882 class FlowGraphVisitor : public ValueObject { | 2887 class FlowGraphVisitor : public ValueObject { |
| 2883 public: | 2888 public: |
| 2884 explicit FlowGraphVisitor(const GrowableArray<BlockEntryInstr*>& block_order) | 2889 explicit FlowGraphVisitor(const GrowableArray<BlockEntryInstr*>& block_order) |
| 2885 : block_order_(block_order) { } | 2890 : block_order_(block_order), current_iterator_(NULL) { } |
| 2886 virtual ~FlowGraphVisitor() { } | 2891 virtual ~FlowGraphVisitor() { } |
| 2887 | 2892 |
| 2893 ForwardInstructionIterator* current_iterator() const { |
| 2894 return current_iterator_; |
| 2895 } |
| 2896 |
| 2888 // Visit each block in the block order, and for each block its | 2897 // Visit each block in the block order, and for each block its |
| 2889 // instructions in order from the block entry to exit. | 2898 // instructions in order from the block entry to exit. |
| 2890 virtual void VisitBlocks(); | 2899 virtual void VisitBlocks(); |
| 2891 | 2900 |
| 2892 // Visit functions for instruction and computation classes, with empty | 2901 // Visit functions for instruction and computation classes, with empty |
| 2893 // default implementations. | 2902 // default implementations. |
| 2894 #define DECLARE_VISIT_COMPUTATION(ShortName, ClassName) \ | 2903 #define DECLARE_VISIT_COMPUTATION(ShortName, ClassName) \ |
| 2895 virtual void Visit##ShortName(ClassName* comp, BindInstr* instr) { } | 2904 virtual void Visit##ShortName(ClassName* comp, BindInstr* instr) { } |
| 2896 | 2905 |
| 2897 #define DECLARE_VISIT_INSTRUCTION(ShortName) \ | 2906 #define DECLARE_VISIT_INSTRUCTION(ShortName) \ |
| 2898 virtual void Visit##ShortName(ShortName##Instr* instr) { } | 2907 virtual void Visit##ShortName(ShortName##Instr* instr) { } |
| 2899 | 2908 |
| 2900 FOR_EACH_COMPUTATION(DECLARE_VISIT_COMPUTATION) | 2909 FOR_EACH_COMPUTATION(DECLARE_VISIT_COMPUTATION) |
| 2901 FOR_EACH_INSTRUCTION(DECLARE_VISIT_INSTRUCTION) | 2910 FOR_EACH_INSTRUCTION(DECLARE_VISIT_INSTRUCTION) |
| 2902 | 2911 |
| 2903 #undef DECLARE_VISIT_COMPUTATION | 2912 #undef DECLARE_VISIT_COMPUTATION |
| 2904 #undef DECLARE_VISIT_INSTRUCTION | 2913 #undef DECLARE_VISIT_INSTRUCTION |
| 2905 | 2914 |
| 2906 protected: | 2915 protected: |
| 2907 const GrowableArray<BlockEntryInstr*>& block_order_; | 2916 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 2917 ForwardInstructionIterator* current_iterator_; |
| 2908 | 2918 |
| 2909 private: | 2919 private: |
| 2910 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 2920 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 2911 }; | 2921 }; |
| 2912 | 2922 |
| 2913 | 2923 |
| 2914 } // namespace dart | 2924 } // namespace dart |
| 2915 | 2925 |
| 2916 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 2926 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |