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 25 matching lines...) Expand all Loading... | |
| 36 // | LoadStaticField <Field> | 36 // | LoadStaticField <Field> |
| 37 // | StoreStaticField <Field> <Value> | 37 // | StoreStaticField <Field> <Value> |
| 38 // | BooleanNegate <Value> | 38 // | BooleanNegate <Value> |
| 39 // | InstanceOf <Value> <Type> | 39 // | InstanceOf <Value> <Type> |
| 40 // | CreateArray <ArrayNode> <Value> ... | 40 // | CreateArray <ArrayNode> <Value> ... |
| 41 // | CreateClosure <ClosureNode> | 41 // | CreateClosure <ClosureNode> |
| 42 // | AllocateObject <ConstructorCallNode> | 42 // | AllocateObject <ConstructorCallNode> |
| 43 // | Throw <Value> | 43 // | Throw <Value> |
| 44 // | ReThrow <Value> <Value> | 44 // | ReThrow <Value> <Value> |
| 45 // | NativeLoadField <Value> <intptr_t> | 45 // | NativeLoadField <Value> <intptr_t> |
| 46 // | ExtractTypeArgumentsComp <ConstructorCallNode> <Value> | 46 // | ExtractFactoryTypeArgumentsComp <ConstructorCallNode> <Value> |
| 47 // | ExtractConstructorTypeArgumentsComp <ConstructorCallNode> <Value> | |
| 48 // | ExtractConstructorInstantiatorComp <ConstructorCallNode> <Value> <Value> | |
| 47 // | 49 // |
| 48 // <Value> ::= | 50 // <Value> ::= |
| 49 // Temp <int> | 51 // Temp <int> |
| 50 // | Constant <Instance> | 52 // | Constant <Instance> |
| 51 | 53 |
| 52 // M is a two argument macro. It is applied to each concrete value's | 54 // M is a two argument macro. It is applied to each concrete value's |
| 53 // typename and classname. | 55 // typename and classname. |
| 54 #define FOR_EACH_VALUE(M) \ | 56 #define FOR_EACH_VALUE(M) \ |
| 55 M(Temp, TempVal) \ | 57 M(Temp, TempVal) \ |
| 56 M(Constant, ConstantVal) \ | 58 M(Constant, ConstantVal) \ |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 76 M(LoadStaticField, LoadStaticFieldComp) \ | 78 M(LoadStaticField, LoadStaticFieldComp) \ |
| 77 M(StoreStaticField, StoreStaticFieldComp) \ | 79 M(StoreStaticField, StoreStaticFieldComp) \ |
| 78 M(BooleanNegate, BooleanNegateComp) \ | 80 M(BooleanNegate, BooleanNegateComp) \ |
| 79 M(InstanceOf, InstanceOfComp) \ | 81 M(InstanceOf, InstanceOfComp) \ |
| 80 M(CreateArray, CreateArrayComp) \ | 82 M(CreateArray, CreateArrayComp) \ |
| 81 M(CreateClosure, CreateClosureComp) \ | 83 M(CreateClosure, CreateClosureComp) \ |
| 82 M(AllocateObject, AllocateObjectComp) \ | 84 M(AllocateObject, AllocateObjectComp) \ |
| 83 M(Throw, ThrowComp) \ | 85 M(Throw, ThrowComp) \ |
| 84 M(ReThrow, ReThrowComp) \ | 86 M(ReThrow, ReThrowComp) \ |
| 85 M(NativeLoadField, NativeLoadFieldComp) \ | 87 M(NativeLoadField, NativeLoadFieldComp) \ |
| 86 M(ExtractTypeArguments, ExtractTypeArgumentsComp) \ | 88 M(ExtractFactoryTypeArguments, ExtractFactoryTypeArgumentsComp) \ |
| 89 M(ExtractConstructorTypeArguments, ExtractConstructorTypeArgumentsComp) \ | |
| 90 M(ExtractConstructorInstantiator, ExtractConstructorInstantiatorComp) \ | |
| 87 | 91 |
| 88 | 92 |
| 89 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; | 93 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; |
| 90 FOR_EACH_COMPUTATION(FORWARD_DECLARATION) | 94 FOR_EACH_COMPUTATION(FORWARD_DECLARATION) |
| 91 #undef FORWARD_DECLARATION | 95 #undef FORWARD_DECLARATION |
| 92 | 96 |
| 93 class Computation : public ZoneAllocated { | 97 class Computation : public ZoneAllocated { |
| 94 public: | 98 public: |
| 95 Computation() { } | 99 Computation() { } |
| 96 | 100 |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 698 }; | 702 }; |
| 699 | 703 |
| 700 | 704 |
| 701 class NativeLoadFieldComp : public Computation { | 705 class NativeLoadFieldComp : public Computation { |
| 702 public: | 706 public: |
| 703 NativeLoadFieldComp(Value* value, intptr_t offset_in_bytes) | 707 NativeLoadFieldComp(Value* value, intptr_t offset_in_bytes) |
| 704 : value_(value), offset_in_bytes_(offset_in_bytes) { | 708 : value_(value), offset_in_bytes_(offset_in_bytes) { |
| 705 ASSERT(value != NULL); | 709 ASSERT(value != NULL); |
| 706 } | 710 } |
| 707 | 711 |
| 708 DECLARE_COMPUTATION(NativeLoadFieldComp) | 712 DECLARE_COMPUTATION(NativeLoadFieldComp) |
|
regis
2012/03/15 20:13:02
I fixed this one too.
| |
| 709 | 713 |
| 710 Value* value() const { return value_; } | 714 Value* value() const { return value_; } |
| 711 intptr_t offset_in_bytes() const { return offset_in_bytes_; } | 715 intptr_t offset_in_bytes() const { return offset_in_bytes_; } |
| 712 | 716 |
| 713 private: | 717 private: |
| 714 Value* value_; | 718 Value* value_; |
| 715 intptr_t offset_in_bytes_; | 719 intptr_t offset_in_bytes_; |
| 716 | 720 |
| 717 DISALLOW_COPY_AND_ASSIGN(NativeLoadFieldComp); | 721 DISALLOW_COPY_AND_ASSIGN(NativeLoadFieldComp); |
| 718 }; | 722 }; |
| 719 | 723 |
| 720 | 724 |
| 721 class ExtractTypeArgumentsComp : public Computation { | 725 class ExtractFactoryTypeArgumentsComp : public Computation { |
| 722 public: | 726 public: |
| 723 ExtractTypeArgumentsComp(ConstructorCallNode* ast_node, Value* instantiator) | 727 ExtractFactoryTypeArgumentsComp(ConstructorCallNode* ast_node, |
| 728 Value* instantiator) | |
| 724 : ast_node_(*ast_node), instantiator_(instantiator) { | 729 : ast_node_(*ast_node), instantiator_(instantiator) { |
| 725 ASSERT(instantiator_ != NULL); | 730 ASSERT(instantiator_ != NULL); |
| 726 } | 731 } |
| 727 | 732 |
| 728 DECLARE_COMPUTATION(ExtractTypeArgumentsComp) | 733 DECLARE_COMPUTATION(ExtractFactoryTypeArgumentsComp) |
|
srdjan
2012/03/15 19:58:05
DEFCLARE_COMPUTATION(ExtractFactoryTypeArguments)
regis
2012/03/15 20:13:02
Done.
| |
| 734 | |
| 735 Value* instantiator() const { return instantiator_; } | |
| 736 const AbstractTypeArguments& type_arguments() const { | |
| 737 return ast_node_.type_arguments(); | |
| 738 } | |
| 739 const Function& factory() const { return ast_node_.constructor(); } | |
| 740 intptr_t node_id() const { return ast_node_.id(); } | |
| 741 intptr_t token_index() const { return ast_node_.token_index(); } | |
| 742 | |
| 743 private: | |
| 744 const ConstructorCallNode& ast_node_; | |
| 745 Value* instantiator_; | |
| 746 | |
| 747 DISALLOW_COPY_AND_ASSIGN(ExtractFactoryTypeArgumentsComp); | |
| 748 }; | |
| 749 | |
| 750 | |
| 751 class ExtractConstructorTypeArgumentsComp : public Computation { | |
| 752 public: | |
| 753 ExtractConstructorTypeArgumentsComp(ConstructorCallNode* ast_node, | |
| 754 Value* instantiator) | |
| 755 : ast_node_(*ast_node), instantiator_(instantiator) { | |
| 756 ASSERT(instantiator_ != NULL); | |
| 757 } | |
| 758 | |
| 759 DECLARE_COMPUTATION(ExtractConstructorTypeArgumentsComp) | |
|
regis
2012/03/15 20:13:02
Fixed this one too.
| |
| 729 | 760 |
| 730 Value* instantiator() const { return instantiator_; } | 761 Value* instantiator() const { return instantiator_; } |
| 731 const AbstractTypeArguments& type_arguments() const { | 762 const AbstractTypeArguments& type_arguments() const { |
| 732 return ast_node_.type_arguments(); | 763 return ast_node_.type_arguments(); |
| 733 } | 764 } |
| 734 const Function& constructor() const { return ast_node_.constructor(); } | 765 const Function& constructor() const { return ast_node_.constructor(); } |
| 735 intptr_t node_id() const { return ast_node_.id(); } | 766 intptr_t node_id() const { return ast_node_.id(); } |
| 736 intptr_t token_index() const { return ast_node_.token_index(); } | 767 intptr_t token_index() const { return ast_node_.token_index(); } |
| 737 | 768 |
| 738 private: | 769 private: |
| 739 const ConstructorCallNode& ast_node_; | 770 const ConstructorCallNode& ast_node_; |
| 740 Value* instantiator_; | 771 Value* instantiator_; |
| 741 | 772 |
| 742 DISALLOW_COPY_AND_ASSIGN(ExtractTypeArgumentsComp); | 773 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsComp); |
| 774 }; | |
| 775 | |
| 776 | |
| 777 class ExtractConstructorInstantiatorComp : public Computation { | |
| 778 public: | |
| 779 ExtractConstructorInstantiatorComp(ConstructorCallNode* ast_node, | |
| 780 Value* instantiator, | |
| 781 Value* discard_value) | |
| 782 : ast_node_(*ast_node), | |
| 783 instantiator_(instantiator), | |
| 784 discard_value_(discard_value) { | |
| 785 ASSERT(instantiator_ != NULL); | |
| 786 } | |
| 787 | |
| 788 DECLARE_COMPUTATION(ExtractConstructorInstantiatorComp) | |
|
srdjan
2012/03/15 19:58:05
ditto
regis
2012/03/15 20:13:02
Done.
| |
| 789 | |
| 790 Value* instantiator() const { return instantiator_; } | |
| 791 Value* discard_value() const { return discard_value_; } | |
| 792 const AbstractTypeArguments& type_arguments() const { | |
| 793 return ast_node_.type_arguments(); | |
| 794 } | |
| 795 const Function& constructor() const { return ast_node_.constructor(); } | |
| 796 intptr_t node_id() const { return ast_node_.id(); } | |
| 797 intptr_t token_index() const { return ast_node_.token_index(); } | |
| 798 | |
| 799 private: | |
| 800 const ConstructorCallNode& ast_node_; | |
| 801 Value* instantiator_; | |
| 802 Value* discard_value_; | |
| 803 | |
| 804 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorInstantiatorComp); | |
| 743 }; | 805 }; |
| 744 | 806 |
| 745 | 807 |
| 746 #undef DECLARE_COMPUTATION | 808 #undef DECLARE_COMPUTATION |
| 747 | 809 |
| 748 | 810 |
| 749 // Instructions. | 811 // Instructions. |
| 750 // | 812 // |
| 751 // <Instruction> ::= JoinEntry <Instruction> | 813 // <Instruction> ::= JoinEntry <Instruction> |
| 752 // | TargetEntry <Instruction> | 814 // | TargetEntry <Instruction> |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1085 #undef DECLARE_VISIT_INSTRUCTION | 1147 #undef DECLARE_VISIT_INSTRUCTION |
| 1086 | 1148 |
| 1087 private: | 1149 private: |
| 1088 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 1150 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 1089 }; | 1151 }; |
| 1090 | 1152 |
| 1091 | 1153 |
| 1092 } // namespace dart | 1154 } // namespace dart |
| 1093 | 1155 |
| 1094 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 1156 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |