| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 Isolate* isolate = Isolate::Current(); | 87 Isolate* isolate = Isolate::Current(); |
| 88 cid_ = GetNextCid(isolate); | 88 cid_ = GetNextCid(isolate); |
| 89 ic_data_ = GetICDataForCid(cid_, isolate); | 89 ic_data_ = GetICDataForCid(cid_, isolate); |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Unique computation/instruction id, used for deoptimization. | 92 // Unique computation/instruction id, used for deoptimization. |
| 93 intptr_t cid() const { return cid_; } | 93 intptr_t cid() const { return cid_; } |
| 94 | 94 |
| 95 ICData* ic_data() const { return ic_data_; } | 95 ICData* ic_data() const { return ic_data_; } |
| 96 void set_ic_data(ICData* value) { ic_data_ = value; } | 96 void set_ic_data(ICData* value) { ic_data_ = value; } |
| 97 bool HasICData() const { |
| 98 return (ic_data() != NULL) && !ic_data()->IsNull(); |
| 99 } |
| 97 | 100 |
| 98 // Visiting support. | 101 // Visiting support. |
| 99 virtual void Accept(FlowGraphVisitor* visitor) = 0; | 102 virtual void Accept(FlowGraphVisitor* visitor) = 0; |
| 100 | 103 |
| 101 virtual intptr_t InputCount() const = 0; | 104 virtual intptr_t InputCount() const = 0; |
| 102 virtual Value* InputAt(intptr_t i) const = 0; | 105 virtual Value* InputAt(intptr_t i) const = 0; |
| 103 | 106 |
| 104 // Static type of the computation. | 107 // Static type of the computation. |
| 105 virtual RawAbstractType* StaticType() const = 0; | 108 virtual RawAbstractType* StaticType() const = 0; |
| 106 | 109 |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 private: | 670 private: |
| 668 const NativeBodyNode& ast_node_; | 671 const NativeBodyNode& ast_node_; |
| 669 const intptr_t try_index_; | 672 const intptr_t try_index_; |
| 670 | 673 |
| 671 DISALLOW_COPY_AND_ASSIGN(NativeCallComp); | 674 DISALLOW_COPY_AND_ASSIGN(NativeCallComp); |
| 672 }; | 675 }; |
| 673 | 676 |
| 674 | 677 |
| 675 class LoadInstanceFieldComp : public TemplateComputation<1> { | 678 class LoadInstanceFieldComp : public TemplateComputation<1> { |
| 676 public: | 679 public: |
| 677 LoadInstanceFieldComp(LoadInstanceFieldNode* ast_node, Value* instance) | 680 LoadInstanceFieldComp(const Field& field, |
| 678 : ast_node_(*ast_node) { | 681 Value* instance, |
| 682 InstanceCallComp* original, // Maybe NULL. |
| 683 ZoneGrowableArray<intptr_t>* class_ids) // Maybe NULL. |
| 684 : field_(field), original_(original), class_ids_(class_ids) { |
| 679 ASSERT(instance != NULL); | 685 ASSERT(instance != NULL); |
| 680 inputs_[0] = instance; | 686 inputs_[0] = instance; |
| 681 } | 687 } |
| 682 | 688 |
| 683 DECLARE_COMPUTATION(LoadInstanceField) | 689 DECLARE_COMPUTATION(LoadInstanceField) |
| 684 | 690 |
| 685 const Field& field() const { return ast_node_.field(); } | 691 const Field& field() const { return field_; } |
| 686 | |
| 687 Value* instance() const { return inputs_[0]; } | 692 Value* instance() const { return inputs_[0]; } |
| 693 const ZoneGrowableArray<intptr_t>* class_ids() const { return class_ids_; } |
| 694 const InstanceCallComp* original() const { return original_; } |
| 688 | 695 |
| 689 virtual void PrintOperandsTo(BufferFormatter* f) const; | 696 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 690 | 697 |
| 691 private: | 698 private: |
| 692 const LoadInstanceFieldNode& ast_node_; | 699 const Field& field_; |
| 700 const InstanceCallComp* original_; // For optimizations. |
| 701 // If non-NULL, the instruction is valid only for the class ids listed. |
| 702 const ZoneGrowableArray<intptr_t>* class_ids_; |
| 693 | 703 |
| 694 DISALLOW_COPY_AND_ASSIGN(LoadInstanceFieldComp); | 704 DISALLOW_COPY_AND_ASSIGN(LoadInstanceFieldComp); |
| 695 }; | 705 }; |
| 696 | 706 |
| 697 | 707 |
| 698 class StoreInstanceFieldComp : public TemplateComputation<2> { | 708 class StoreInstanceFieldComp : public TemplateComputation<2> { |
| 699 public: | 709 public: |
| 700 StoreInstanceFieldComp(StoreInstanceFieldNode* ast_node, | 710 StoreInstanceFieldComp(const Field& field, |
| 701 Value* instance, | 711 Value* instance, |
| 702 Value* value) | 712 Value* value, |
| 703 : ast_node_(*ast_node) { | 713 InstanceSetterComp* original, // Maybe NULL. |
| 714 ZoneGrowableArray<intptr_t>* class_ids) // Maybe NULL. |
| 715 : field_(field), original_(original), class_ids_(class_ids) { |
| 704 ASSERT(instance != NULL); | 716 ASSERT(instance != NULL); |
| 705 ASSERT(value != NULL); | 717 ASSERT(value != NULL); |
| 706 inputs_[0] = instance; | 718 inputs_[0] = instance; |
| 707 inputs_[1] = value; | 719 inputs_[1] = value; |
| 708 } | 720 } |
| 709 | 721 |
| 710 DECLARE_COMPUTATION(StoreInstanceField) | 722 DECLARE_COMPUTATION(StoreInstanceField) |
| 711 | 723 |
| 712 intptr_t token_index() const { return ast_node_.token_index(); } | 724 const Field& field() const { return field_; } |
| 713 const Field& field() const { return ast_node_.field(); } | |
| 714 | 725 |
| 715 Value* instance() const { return inputs_[0]; } | 726 Value* instance() const { return inputs_[0]; } |
| 716 Value* value() const { return inputs_[1]; } | 727 Value* value() const { return inputs_[1]; } |
| 717 | 728 |
| 729 const ZoneGrowableArray<intptr_t>* class_ids() const { return class_ids_; } |
| 730 const InstanceSetterComp* original() const { return original_; } |
| 731 |
| 718 virtual void PrintOperandsTo(BufferFormatter* f) const; | 732 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 719 | 733 |
| 720 private: | 734 private: |
| 721 const StoreInstanceFieldNode& ast_node_; | 735 const Field& field_; |
| 736 const InstanceSetterComp* original_; // For optimizations. |
| 737 // If non-NULL, the instruction is valid only for the class ids listed. |
| 738 const ZoneGrowableArray<intptr_t>* class_ids_; |
| 722 | 739 |
| 723 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldComp); | 740 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldComp); |
| 724 }; | 741 }; |
| 725 | 742 |
| 726 | 743 |
| 727 class LoadStaticFieldComp : public TemplateComputation<0> { | 744 class LoadStaticFieldComp : public TemplateComputation<0> { |
| 728 public: | 745 public: |
| 729 explicit LoadStaticFieldComp(const Field& field) : field_(field) {} | 746 explicit LoadStaticFieldComp(const Field& field) : field_(field) {} |
| 730 | 747 |
| 731 DECLARE_COMPUTATION(LoadStaticField); | 748 DECLARE_COMPUTATION(LoadStaticField); |
| (...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2025 const GrowableArray<BlockEntryInstr*>& block_order_; | 2042 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 2026 | 2043 |
| 2027 private: | 2044 private: |
| 2028 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 2045 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 2029 }; | 2046 }; |
| 2030 | 2047 |
| 2031 | 2048 |
| 2032 } // namespace dart | 2049 } // namespace dart |
| 2033 | 2050 |
| 2034 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 2051 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |