Chromium Code Reviews| 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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 654 private: | 657 private: |
| 655 const NativeBodyNode& ast_node_; | 658 const NativeBodyNode& ast_node_; |
| 656 const intptr_t try_index_; | 659 const intptr_t try_index_; |
| 657 | 660 |
| 658 DISALLOW_COPY_AND_ASSIGN(NativeCallComp); | 661 DISALLOW_COPY_AND_ASSIGN(NativeCallComp); |
| 659 }; | 662 }; |
| 660 | 663 |
| 661 | 664 |
| 662 class LoadInstanceFieldComp : public TemplateComputation<1> { | 665 class LoadInstanceFieldComp : public TemplateComputation<1> { |
| 663 public: | 666 public: |
| 664 LoadInstanceFieldComp(LoadInstanceFieldNode* ast_node, Value* instance) | 667 LoadInstanceFieldComp(const Field& field, |
| 665 : ast_node_(*ast_node) { | 668 Value* instance, |
| 669 InstanceCallComp* original, // Maybe NULL. | |
| 670 ZoneGrowableArray<intptr_t>* class_ids) // Maybe NULL. | |
| 671 : field_(field), original_(original), class_ids_(class_ids) { | |
| 666 ASSERT(instance != NULL); | 672 ASSERT(instance != NULL); |
| 667 inputs_[0] = instance; | 673 inputs_[0] = instance; |
| 668 } | 674 } |
| 669 | 675 |
| 670 DECLARE_COMPUTATION(LoadInstanceField) | 676 DECLARE_COMPUTATION(LoadInstanceField) |
| 671 | 677 |
| 672 const Field& field() const { return ast_node_.field(); } | 678 const Field& field() const { return field_; } |
| 673 | |
| 674 Value* instance() const { return inputs_[0]; } | 679 Value* instance() const { return inputs_[0]; } |
| 680 const ZoneGrowableArray<intptr_t>* class_ids() const { return class_ids_; } | |
| 681 const InstanceCallComp* original() const { return original_; } | |
| 675 | 682 |
| 676 virtual void PrintOperandsTo(BufferFormatter* f) const; | 683 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 677 | 684 |
| 678 private: | 685 private: |
| 679 const LoadInstanceFieldNode& ast_node_; | 686 const Field& field_; |
| 687 const InstanceCallComp* original_; // For optimizations. | |
| 688 // If non-NULL, the instruction is valid only for the clas ids listed. | |
|
Florian Schneider
2012/06/07 08:47:59
s/clas/class/
srdjan
2012/06/07 18:24:50
Done.
| |
| 689 const ZoneGrowableArray<intptr_t>* class_ids_; | |
| 680 | 690 |
| 681 DISALLOW_COPY_AND_ASSIGN(LoadInstanceFieldComp); | 691 DISALLOW_COPY_AND_ASSIGN(LoadInstanceFieldComp); |
| 682 }; | 692 }; |
| 683 | 693 |
| 684 | 694 |
| 685 class StoreInstanceFieldComp : public TemplateComputation<2> { | 695 class StoreInstanceFieldComp : public TemplateComputation<2> { |
| 686 public: | 696 public: |
| 687 StoreInstanceFieldComp(StoreInstanceFieldNode* ast_node, | 697 StoreInstanceFieldComp(const Field& field, |
| 688 Value* instance, | 698 Value* instance, |
| 689 Value* value) | 699 Value* value, |
| 690 : ast_node_(*ast_node) { | 700 InstanceSetterComp* original, // Maybe NULL. |
| 701 ZoneGrowableArray<intptr_t>* class_ids) // Maybe NULL. | |
| 702 : field_(field), original_(original), class_ids_(class_ids) { | |
| 691 ASSERT(instance != NULL); | 703 ASSERT(instance != NULL); |
| 692 ASSERT(value != NULL); | 704 ASSERT(value != NULL); |
| 693 inputs_[0] = instance; | 705 inputs_[0] = instance; |
| 694 inputs_[1] = value; | 706 inputs_[1] = value; |
| 695 } | 707 } |
| 696 | 708 |
| 697 DECLARE_COMPUTATION(StoreInstanceField) | 709 DECLARE_COMPUTATION(StoreInstanceField) |
| 698 | 710 |
| 699 intptr_t token_index() const { return ast_node_.token_index(); } | 711 const Field& field() const { return field_; } |
| 700 const Field& field() const { return ast_node_.field(); } | |
| 701 | 712 |
| 702 Value* instance() const { return inputs_[0]; } | 713 Value* instance() const { return inputs_[0]; } |
| 703 Value* value() const { return inputs_[1]; } | 714 Value* value() const { return inputs_[1]; } |
| 704 | 715 |
| 716 const ZoneGrowableArray<intptr_t>* class_ids() const { return class_ids_; } | |
| 717 const InstanceSetterComp* original() const { return original_; } | |
| 718 | |
| 705 virtual void PrintOperandsTo(BufferFormatter* f) const; | 719 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 706 | 720 |
| 707 private: | 721 private: |
| 708 const StoreInstanceFieldNode& ast_node_; | 722 const Field& field_; |
| 723 const InstanceSetterComp* original_; // For optimizations. | |
| 724 // If non-NULL, the instruction is valid only for the clas ids listed. | |
|
Florian Schneider
2012/06/07 08:47:59
s/clas/class/
srdjan
2012/06/07 18:24:50
Done.
| |
| 725 const ZoneGrowableArray<intptr_t>* class_ids_; | |
| 709 | 726 |
| 710 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldComp); | 727 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldComp); |
| 711 }; | 728 }; |
| 712 | 729 |
| 713 | 730 |
| 714 class LoadStaticFieldComp : public TemplateComputation<0> { | 731 class LoadStaticFieldComp : public TemplateComputation<0> { |
| 715 public: | 732 public: |
| 716 explicit LoadStaticFieldComp(const Field& field) : field_(field) {} | 733 explicit LoadStaticFieldComp(const Field& field) : field_(field) {} |
| 717 | 734 |
| 718 DECLARE_COMPUTATION(LoadStaticField); | 735 DECLARE_COMPUTATION(LoadStaticField); |
| (...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1999 const GrowableArray<BlockEntryInstr*>& block_order_; | 2016 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 2000 | 2017 |
| 2001 private: | 2018 private: |
| 2002 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 2019 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 2003 }; | 2020 }; |
| 2004 | 2021 |
| 2005 | 2022 |
| 2006 } // namespace dart | 2023 } // namespace dart |
| 2007 | 2024 |
| 2008 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 2025 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |