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 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 796 | 796 |
| 797 virtual bool IsBlockEntry() const { return false; } | 797 virtual bool IsBlockEntry() const { return false; } |
| 798 BlockEntryInstr* AsBlockEntry() { | 798 BlockEntryInstr* AsBlockEntry() { |
| 799 return IsBlockEntry() ? reinterpret_cast<BlockEntryInstr*>(this) : NULL; | 799 return IsBlockEntry() ? reinterpret_cast<BlockEntryInstr*>(this) : NULL; |
| 800 } | 800 } |
| 801 | 801 |
| 802 // Visiting support. | 802 // Visiting support. |
| 803 virtual Instruction* Accept(FlowGraphVisitor* visitor) = 0; | 803 virtual Instruction* Accept(FlowGraphVisitor* visitor) = 0; |
| 804 | 804 |
| 805 virtual void SetSuccessor(Instruction* instr) = 0; | 805 virtual void SetSuccessor(Instruction* instr) = 0; |
| 806 // Perform a postorder traversal of the instruction graph reachable from | 806 |
| 807 // this instruction. Accumulate basic block entries in the order visited | 807 // Discover basic-block structure by performing a recursive depth first |
| 808 // in the in/out parameter 'block_entries'. | 808 // traversal of the instruction graph reachable from this instruction. As |
| 809 virtual void DepthFirstSearch( | 809 // a side effect, the block entry instructions in the graph are assigned |
| 810 // numbers in both preorder and postorder. The array 'preorder' maps | |
| 811 // preorder block numbers to the block entry instruction with that number | |
| 812 // and analogously for the array 'postorder'. The depth first spanning | |
| 813 // tree is recorded in the array 'parent', which maps preorder block | |
| 814 // numbers to the preorder number of the block's spanning-tree parent. As | |
| 815 // a side effect, the set of basic block predecessors (e.g., block entry | |
| 816 // instructions of predecessor blocks) and also the last instruction in | |
| 817 // the block is recorded in each entry instruction. | |
| 818 virtual void DiscoverBlocks( | |
| 819 BlockEntryInstr* current_block, | |
| 810 GrowableArray<BlockEntryInstr*>* preorder, | 820 GrowableArray<BlockEntryInstr*>* preorder, |
| 811 GrowableArray<BlockEntryInstr*>* postorder) = 0; | 821 GrowableArray<BlockEntryInstr*>* postorder, |
| 822 GrowableArray<BlockEntryInstr*>* parent) = 0; | |
| 812 | 823 |
| 813 #define INSTRUCTION_TYPE_CHECK(type) \ | 824 #define INSTRUCTION_TYPE_CHECK(type) \ |
| 814 virtual bool Is##type() const { return false; } \ | 825 virtual bool Is##type() const { return false; } \ |
| 815 virtual type##Instr* As##type() { return NULL; } | 826 virtual type##Instr* As##type() { return NULL; } |
| 816 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK) | 827 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK) |
| 817 #undef INSTRUCTION_TYPE_CHECK | 828 #undef INSTRUCTION_TYPE_CHECK |
| 818 | 829 |
| 819 private: | 830 private: |
| 820 DISALLOW_COPY_AND_ASSIGN(Instruction); | 831 DISALLOW_COPY_AND_ASSIGN(Instruction); |
| 821 }; | 832 }; |
| 822 | 833 |
| 823 | 834 |
| 824 // Basic block entries are administrative nodes. Joins are the only nodes | 835 // Basic block entries are administrative nodes. Joins are the only nodes |
| 825 // with multiple predecessors. Targets are the other basic block entries. | 836 // with multiple predecessors. Targets are the other basic block entries. |
| 826 // The types enforce edge-split form---joins are forbidden as the successors | 837 // The types enforce edge-split form---joins are forbidden as the successors |
| 827 // of branches. | 838 // of branches. |
| 828 class BlockEntryInstr : public Instruction { | 839 class BlockEntryInstr : public Instruction { |
| 829 public: | 840 public: |
| 830 virtual bool IsBlockEntry() const { return true; } | 841 virtual bool IsBlockEntry() const { return true; } |
| 831 | 842 |
| 832 intptr_t preorder_number() const { return preorder_number_; } | 843 intptr_t preorder_number() const { return preorder_number_; } |
| 833 void set_preorder_number(intptr_t number) { preorder_number_ = number; } | 844 void set_preorder_number(intptr_t number) { preorder_number_ = number; } |
| 834 | 845 |
| 835 intptr_t postorder_number() const { return postorder_number_; } | 846 intptr_t postorder_number() const { return postorder_number_; } |
| 836 void set_postorder_number(intptr_t number) { postorder_number_ = number; } | 847 void set_postorder_number(intptr_t number) { postorder_number_ = number; } |
| 837 | 848 |
| 849 Instruction* last_instruction() const { return last_instruction_; } | |
| 850 void set_last_instruction(Instruction* instr) { last_instruction_ = instr; } | |
| 851 | |
| 838 protected: | 852 protected: |
| 839 BlockEntryInstr() : preorder_number_(-1), postorder_number_(-1) { } | 853 BlockEntryInstr() |
| 854 : preorder_number_(-1), | |
| 855 postorder_number_(-1), | |
| 856 last_instruction_(NULL) { } | |
| 840 | 857 |
| 841 private: | 858 private: |
| 842 intptr_t preorder_number_; | 859 intptr_t preorder_number_; |
| 843 intptr_t postorder_number_; | 860 intptr_t postorder_number_; |
| 861 Instruction* last_instruction_; | |
| 844 | 862 |
| 845 DISALLOW_COPY_AND_ASSIGN(BlockEntryInstr); | 863 DISALLOW_COPY_AND_ASSIGN(BlockEntryInstr); |
| 846 }; | 864 }; |
| 847 | 865 |
| 848 | 866 |
| 849 class JoinEntryInstr : public BlockEntryInstr { | 867 class JoinEntryInstr : public BlockEntryInstr { |
| 850 public: | 868 public: |
| 851 JoinEntryInstr() : BlockEntryInstr(), successor_(NULL) { } | 869 JoinEntryInstr() |
| 870 : BlockEntryInstr(), | |
| 871 predecessors_(2), // Two is the assumed to be the common case. | |
| 872 successor_(NULL) { } | |
| 852 | 873 |
| 853 DECLARE_INSTRUCTION(JoinEntry) | 874 DECLARE_INSTRUCTION(JoinEntry) |
| 854 | 875 |
| 855 virtual void SetSuccessor(Instruction* instr) { | 876 virtual void SetSuccessor(Instruction* instr) { |
| 856 ASSERT(successor_ == NULL); | 877 ASSERT(successor_ == NULL); |
| 857 successor_ = instr; | 878 successor_ = instr; |
| 858 } | 879 } |
| 859 | 880 |
| 860 virtual void DepthFirstSearch( | 881 virtual void DiscoverBlocks( |
| 882 BlockEntryInstr* current_block, | |
| 861 GrowableArray<BlockEntryInstr*>* preorder, | 883 GrowableArray<BlockEntryInstr*>* preorder, |
| 862 GrowableArray<BlockEntryInstr*>* postorder); | 884 GrowableArray<BlockEntryInstr*>* postorder, |
| 885 GrowableArray<BlockEntryInstr*>* parent); | |
| 863 | 886 |
| 864 private: | 887 private: |
| 888 ZoneGrowableArray<BlockEntryInstr*> predecessors_; | |
| 865 Instruction* successor_; | 889 Instruction* successor_; |
| 866 | 890 |
| 867 DISALLOW_COPY_AND_ASSIGN(JoinEntryInstr); | 891 DISALLOW_COPY_AND_ASSIGN(JoinEntryInstr); |
| 868 }; | 892 }; |
| 869 | 893 |
| 870 | 894 |
| 871 class TargetEntryInstr : public BlockEntryInstr { | 895 class TargetEntryInstr : public BlockEntryInstr { |
| 872 public: | 896 public: |
| 873 TargetEntryInstr() : BlockEntryInstr(), successor_(NULL) { | 897 TargetEntryInstr() |
| 874 } | 898 : BlockEntryInstr(), predecessor_(NULL), successor_(NULL) { } |
| 875 | 899 |
| 876 DECLARE_INSTRUCTION(TargetEntry) | 900 DECLARE_INSTRUCTION(TargetEntry) |
| 877 | 901 |
| 878 virtual void SetSuccessor(Instruction* instr) { | 902 virtual void SetSuccessor(Instruction* instr) { |
| 879 ASSERT(successor_ == NULL); | 903 ASSERT(successor_ == NULL); |
| 880 successor_ = instr; | 904 successor_ = instr; |
| 881 } | 905 } |
| 882 | 906 |
| 883 virtual void DepthFirstSearch( | 907 virtual void DiscoverBlocks( |
| 908 BlockEntryInstr* current_block, | |
| 884 GrowableArray<BlockEntryInstr*>* preorder, | 909 GrowableArray<BlockEntryInstr*>* preorder, |
| 885 GrowableArray<BlockEntryInstr*>* postorder); | 910 GrowableArray<BlockEntryInstr*>* postorder, |
| 911 GrowableArray<BlockEntryInstr*>* parent); | |
| 886 | 912 |
| 887 private: | 913 private: |
| 914 BlockEntryInstr* predecessor_; | |
|
srdjan
2012/03/19 18:43:35
It is not publicly accessible, what is its use? Fu
Kevin Millikin (Google)
2012/03/19 18:53:55
The dominator computation needs to iterate predece
| |
| 888 Instruction* successor_; | 915 Instruction* successor_; |
| 889 | 916 |
| 890 DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr); | 917 DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr); |
| 891 }; | 918 }; |
| 892 | 919 |
| 893 | 920 |
| 894 // The non-optimizing compiler assumes that there is exactly one use of | 921 // The non-optimizing compiler assumes that there is exactly one use of |
| 895 // every temporary so they can be deallocated at their use. Some AST nodes, | 922 // every temporary so they can be deallocated at their use. Some AST nodes, |
| 896 // e.g., expr0[expr1]++, violate this assumption (there are two uses of each | 923 // e.g., expr0[expr1]++, violate this assumption (there are two uses of each |
| 897 // of the values expr0 and expr1). | 924 // of the values expr0 and expr1). |
| 898 // | 925 // |
| 899 // PickTemp is used to name (with 'destination') a copy of a live temporary | 926 // PickTemp is used to name (with 'destination') a copy of a live temporary |
| 900 // (named 'source') without counting as the use of the source. | 927 // (named 'source') without counting as the use of the source. |
| 901 class PickTempInstr : public Instruction { | 928 class PickTempInstr : public Instruction { |
| 902 public: | 929 public: |
| 903 PickTempInstr(intptr_t dst, intptr_t src) | 930 PickTempInstr(intptr_t dst, intptr_t src) |
| 904 : destination_(dst), source_(src), successor_(NULL) { } | 931 : destination_(dst), source_(src), successor_(NULL) { } |
| 905 | 932 |
| 906 DECLARE_INSTRUCTION(PickTemp) | 933 DECLARE_INSTRUCTION(PickTemp) |
| 907 | 934 |
| 908 intptr_t destination() const { return destination_; } | 935 intptr_t destination() const { return destination_; } |
| 909 intptr_t source() const { return source_; } | 936 intptr_t source() const { return source_; } |
| 910 | 937 |
| 911 virtual void SetSuccessor(Instruction* instr) { | 938 virtual void SetSuccessor(Instruction* instr) { |
| 912 ASSERT(successor_ == NULL && instr != NULL); | 939 ASSERT(successor_ == NULL && instr != NULL); |
| 913 successor_ = instr; | 940 successor_ = instr; |
| 914 } | 941 } |
| 915 | 942 |
| 916 virtual void DepthFirstSearch( | 943 virtual void DiscoverBlocks( |
| 944 BlockEntryInstr* current_block, | |
| 917 GrowableArray<BlockEntryInstr*>* preorder, | 945 GrowableArray<BlockEntryInstr*>* preorder, |
| 918 GrowableArray<BlockEntryInstr*>* postorder); | 946 GrowableArray<BlockEntryInstr*>* postorder, |
| 947 GrowableArray<BlockEntryInstr*>* parent); | |
| 919 | 948 |
| 920 private: | 949 private: |
| 921 const intptr_t destination_; | 950 const intptr_t destination_; |
| 922 const intptr_t source_; | 951 const intptr_t source_; |
| 923 Instruction* successor_; | 952 Instruction* successor_; |
| 924 | 953 |
| 925 DISALLOW_COPY_AND_ASSIGN(PickTempInstr); | 954 DISALLOW_COPY_AND_ASSIGN(PickTempInstr); |
| 926 }; | 955 }; |
| 927 | 956 |
| 928 | 957 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 943 DECLARE_INSTRUCTION(TuckTemp) | 972 DECLARE_INSTRUCTION(TuckTemp) |
| 944 | 973 |
| 945 intptr_t destination() const { return destination_; } | 974 intptr_t destination() const { return destination_; } |
| 946 intptr_t source() const { return source_; } | 975 intptr_t source() const { return source_; } |
| 947 | 976 |
| 948 virtual void SetSuccessor(Instruction* instr) { | 977 virtual void SetSuccessor(Instruction* instr) { |
| 949 ASSERT(successor_ == NULL && instr != NULL); | 978 ASSERT(successor_ == NULL && instr != NULL); |
| 950 successor_ = instr; | 979 successor_ = instr; |
| 951 } | 980 } |
| 952 | 981 |
| 953 virtual void DepthFirstSearch( | 982 virtual void DiscoverBlocks( |
| 983 BlockEntryInstr* current_block, | |
| 954 GrowableArray<BlockEntryInstr*>* preorder, | 984 GrowableArray<BlockEntryInstr*>* preorder, |
| 955 GrowableArray<BlockEntryInstr*>* postorder); | 985 GrowableArray<BlockEntryInstr*>* postorder, |
| 986 GrowableArray<BlockEntryInstr*>* parent); | |
| 956 | 987 |
| 957 private: | 988 private: |
| 958 const intptr_t destination_; | 989 const intptr_t destination_; |
| 959 const intptr_t source_; | 990 const intptr_t source_; |
| 960 Instruction* successor_; | 991 Instruction* successor_; |
| 961 | 992 |
| 962 DISALLOW_COPY_AND_ASSIGN(TuckTempInstr); | 993 DISALLOW_COPY_AND_ASSIGN(TuckTempInstr); |
| 963 }; | 994 }; |
| 964 | 995 |
| 965 | 996 |
| 966 class DoInstr : public Instruction { | 997 class DoInstr : public Instruction { |
| 967 public: | 998 public: |
| 968 explicit DoInstr(Computation* comp) | 999 explicit DoInstr(Computation* comp) |
| 969 : computation_(comp), successor_(NULL) { } | 1000 : computation_(comp), successor_(NULL) { } |
| 970 | 1001 |
| 971 DECLARE_INSTRUCTION(Do) | 1002 DECLARE_INSTRUCTION(Do) |
| 972 | 1003 |
| 973 Computation* computation() const { return computation_; } | 1004 Computation* computation() const { return computation_; } |
| 974 | 1005 |
| 975 virtual void SetSuccessor(Instruction* instr) { | 1006 virtual void SetSuccessor(Instruction* instr) { |
| 976 ASSERT(successor_ == NULL); | 1007 ASSERT(successor_ == NULL); |
| 977 successor_ = instr; | 1008 successor_ = instr; |
| 978 } | 1009 } |
| 979 | 1010 |
| 980 virtual void DepthFirstSearch( | 1011 virtual void DiscoverBlocks( |
| 1012 BlockEntryInstr* current_block, | |
| 981 GrowableArray<BlockEntryInstr*>* preorder, | 1013 GrowableArray<BlockEntryInstr*>* preorder, |
| 982 GrowableArray<BlockEntryInstr*>* postorder); | 1014 GrowableArray<BlockEntryInstr*>* postorder, |
| 1015 GrowableArray<BlockEntryInstr*>* parent); | |
| 983 | 1016 |
| 984 private: | 1017 private: |
| 985 Computation* computation_; | 1018 Computation* computation_; |
| 986 Instruction* successor_; | 1019 Instruction* successor_; |
| 987 | 1020 |
| 988 DISALLOW_COPY_AND_ASSIGN(DoInstr); | 1021 DISALLOW_COPY_AND_ASSIGN(DoInstr); |
| 989 }; | 1022 }; |
| 990 | 1023 |
| 991 | 1024 |
| 992 class BindInstr : public Instruction { | 1025 class BindInstr : public Instruction { |
| 993 public: | 1026 public: |
| 994 BindInstr(intptr_t temp_index, Computation* computation) | 1027 BindInstr(intptr_t temp_index, Computation* computation) |
| 995 : temp_index_(temp_index), computation_(computation), successor_(NULL) { } | 1028 : temp_index_(temp_index), computation_(computation), successor_(NULL) { } |
| 996 | 1029 |
| 997 DECLARE_INSTRUCTION(Bind) | 1030 DECLARE_INSTRUCTION(Bind) |
| 998 | 1031 |
| 999 intptr_t temp_index() const { return temp_index_; } | 1032 intptr_t temp_index() const { return temp_index_; } |
| 1000 Computation* computation() const { return computation_; } | 1033 Computation* computation() const { return computation_; } |
| 1001 | 1034 |
| 1002 virtual void SetSuccessor(Instruction* instr) { | 1035 virtual void SetSuccessor(Instruction* instr) { |
| 1003 ASSERT(successor_ == NULL); | 1036 ASSERT(successor_ == NULL); |
| 1004 successor_ = instr; | 1037 successor_ = instr; |
| 1005 } | 1038 } |
| 1006 | 1039 |
| 1007 virtual void DepthFirstSearch( | 1040 virtual void DiscoverBlocks( |
| 1041 BlockEntryInstr* current_block, | |
| 1008 GrowableArray<BlockEntryInstr*>* preorder, | 1042 GrowableArray<BlockEntryInstr*>* preorder, |
| 1009 GrowableArray<BlockEntryInstr*>* postorder); | 1043 GrowableArray<BlockEntryInstr*>* postorder, |
| 1044 GrowableArray<BlockEntryInstr*>* parent); | |
| 1010 | 1045 |
| 1011 private: | 1046 private: |
| 1012 const intptr_t temp_index_; | 1047 const intptr_t temp_index_; |
| 1013 Computation* computation_; | 1048 Computation* computation_; |
| 1014 Instruction* successor_; | 1049 Instruction* successor_; |
| 1015 | 1050 |
| 1016 DISALLOW_COPY_AND_ASSIGN(BindInstr); | 1051 DISALLOW_COPY_AND_ASSIGN(BindInstr); |
| 1017 }; | 1052 }; |
| 1018 | 1053 |
| 1019 | 1054 |
| 1020 class ReturnInstr : public Instruction { | 1055 class ReturnInstr : public Instruction { |
| 1021 public: | 1056 public: |
| 1022 ReturnInstr(Value* value, intptr_t token_index) | 1057 ReturnInstr(Value* value, intptr_t token_index) |
| 1023 : value_(value), token_index_(token_index) { | 1058 : value_(value), token_index_(token_index) { |
| 1024 ASSERT(value_ != NULL); | 1059 ASSERT(value_ != NULL); |
| 1025 } | 1060 } |
| 1026 | 1061 |
| 1027 DECLARE_INSTRUCTION(Return) | 1062 DECLARE_INSTRUCTION(Return) |
| 1028 | 1063 |
| 1029 Value* value() const { return value_; } | 1064 Value* value() const { return value_; } |
| 1030 intptr_t token_index() const { return token_index_; } | 1065 intptr_t token_index() const { return token_index_; } |
| 1031 | 1066 |
| 1032 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } | 1067 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } |
| 1033 | 1068 |
| 1034 virtual void DepthFirstSearch( | 1069 virtual void DiscoverBlocks( |
| 1070 BlockEntryInstr* current_block, | |
| 1035 GrowableArray<BlockEntryInstr*>* preorder, | 1071 GrowableArray<BlockEntryInstr*>* preorder, |
| 1036 GrowableArray<BlockEntryInstr*>* postorder); | 1072 GrowableArray<BlockEntryInstr*>* postorder, |
| 1073 GrowableArray<BlockEntryInstr*>* parent); | |
| 1037 | 1074 |
| 1038 private: | 1075 private: |
| 1039 Value* value_; | 1076 Value* value_; |
| 1040 intptr_t token_index_; | 1077 intptr_t token_index_; |
| 1041 | 1078 |
| 1042 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); | 1079 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); |
| 1043 }; | 1080 }; |
| 1044 | 1081 |
| 1045 | 1082 |
| 1046 class ThrowInstr : public Instruction { | 1083 class ThrowInstr : public Instruction { |
| 1047 public: | 1084 public: |
| 1048 ThrowInstr(intptr_t node_id, intptr_t token_index, Value* exception) | 1085 ThrowInstr(intptr_t node_id, intptr_t token_index, Value* exception) |
| 1049 : node_id_(node_id), token_index_(token_index), exception_(exception) { | 1086 : node_id_(node_id), token_index_(token_index), exception_(exception) { |
| 1050 ASSERT(exception_ != NULL); | 1087 ASSERT(exception_ != NULL); |
| 1051 } | 1088 } |
| 1052 | 1089 |
| 1053 DECLARE_INSTRUCTION(Throw) | 1090 DECLARE_INSTRUCTION(Throw) |
| 1054 | 1091 |
| 1055 intptr_t node_id() const { return node_id_; } | 1092 intptr_t node_id() const { return node_id_; } |
| 1056 intptr_t token_index() const { return token_index_; } | 1093 intptr_t token_index() const { return token_index_; } |
| 1057 Value* exception() const { return exception_; } | 1094 Value* exception() const { return exception_; } |
| 1058 | 1095 |
| 1059 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } | 1096 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } |
| 1060 | 1097 |
| 1061 virtual void DepthFirstSearch( | 1098 virtual void DiscoverBlocks( |
| 1099 BlockEntryInstr* current_block, | |
| 1062 GrowableArray<BlockEntryInstr*>* preorder, | 1100 GrowableArray<BlockEntryInstr*>* preorder, |
| 1063 GrowableArray<BlockEntryInstr*>* postorder); | 1101 GrowableArray<BlockEntryInstr*>* postorder, |
| 1102 GrowableArray<BlockEntryInstr*>* parent); | |
| 1064 | 1103 |
| 1065 private: | 1104 private: |
| 1066 intptr_t node_id_; | 1105 intptr_t node_id_; |
| 1067 intptr_t token_index_; | 1106 intptr_t token_index_; |
| 1068 Value* exception_; | 1107 Value* exception_; |
| 1069 | 1108 |
| 1070 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); | 1109 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); |
| 1071 }; | 1110 }; |
| 1072 | 1111 |
| 1073 | 1112 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1087 | 1126 |
| 1088 DECLARE_INSTRUCTION(ReThrow) | 1127 DECLARE_INSTRUCTION(ReThrow) |
| 1089 | 1128 |
| 1090 intptr_t node_id() const { return node_id_; } | 1129 intptr_t node_id() const { return node_id_; } |
| 1091 intptr_t token_index() const { return token_index_; } | 1130 intptr_t token_index() const { return token_index_; } |
| 1092 Value* exception() const { return exception_; } | 1131 Value* exception() const { return exception_; } |
| 1093 Value* stack_trace() const { return stack_trace_; } | 1132 Value* stack_trace() const { return stack_trace_; } |
| 1094 | 1133 |
| 1095 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } | 1134 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } |
| 1096 | 1135 |
| 1097 virtual void DepthFirstSearch( | 1136 virtual void DiscoverBlocks( |
| 1137 BlockEntryInstr* current_block, | |
| 1098 GrowableArray<BlockEntryInstr*>* preorder, | 1138 GrowableArray<BlockEntryInstr*>* preorder, |
| 1099 GrowableArray<BlockEntryInstr*>* postorder); | 1139 GrowableArray<BlockEntryInstr*>* postorder, |
| 1140 GrowableArray<BlockEntryInstr*>* parent); | |
| 1100 | 1141 |
| 1101 private: | 1142 private: |
| 1102 intptr_t node_id_; | 1143 intptr_t node_id_; |
| 1103 intptr_t token_index_; | 1144 intptr_t token_index_; |
| 1104 Value* exception_; | 1145 Value* exception_; |
| 1105 Value* stack_trace_; | 1146 Value* stack_trace_; |
| 1106 | 1147 |
| 1107 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); | 1148 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); |
| 1108 }; | 1149 }; |
| 1109 | 1150 |
| 1110 | 1151 |
| 1111 class BranchInstr : public Instruction { | 1152 class BranchInstr : public Instruction { |
| 1112 public: | 1153 public: |
| 1113 explicit BranchInstr(Value* value) | 1154 explicit BranchInstr(Value* value) |
| 1114 : value_(value), | 1155 : value_(value), |
| 1115 true_successor_(NULL), | 1156 true_successor_(NULL), |
| 1116 false_successor_(NULL) { } | 1157 false_successor_(NULL) { } |
| 1117 | 1158 |
| 1118 DECLARE_INSTRUCTION(Branch) | 1159 DECLARE_INSTRUCTION(Branch) |
| 1119 | 1160 |
| 1120 Value* value() const { return value_; } | 1161 Value* value() const { return value_; } |
| 1121 TargetEntryInstr* true_successor() const { return true_successor_; } | 1162 TargetEntryInstr* true_successor() const { return true_successor_; } |
| 1122 TargetEntryInstr* false_successor() const { return false_successor_; } | 1163 TargetEntryInstr* false_successor() const { return false_successor_; } |
| 1123 | 1164 |
| 1124 TargetEntryInstr** true_successor_address() { return &true_successor_; } | 1165 TargetEntryInstr** true_successor_address() { return &true_successor_; } |
| 1125 TargetEntryInstr** false_successor_address() { return &false_successor_; } | 1166 TargetEntryInstr** false_successor_address() { return &false_successor_; } |
| 1126 | 1167 |
| 1127 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } | 1168 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } |
| 1128 | 1169 |
| 1129 virtual void DepthFirstSearch( | 1170 virtual void DiscoverBlocks( |
| 1171 BlockEntryInstr* current_block, | |
| 1130 GrowableArray<BlockEntryInstr*>* preorder, | 1172 GrowableArray<BlockEntryInstr*>* preorder, |
| 1131 GrowableArray<BlockEntryInstr*>* postorder); | 1173 GrowableArray<BlockEntryInstr*>* postorder, |
| 1174 GrowableArray<BlockEntryInstr*>* parent); | |
| 1132 | 1175 |
| 1133 private: | 1176 private: |
| 1134 Value* value_; | 1177 Value* value_; |
| 1135 TargetEntryInstr* true_successor_; | 1178 TargetEntryInstr* true_successor_; |
| 1136 TargetEntryInstr* false_successor_; | 1179 TargetEntryInstr* false_successor_; |
| 1137 | 1180 |
| 1138 DISALLOW_COPY_AND_ASSIGN(BranchInstr); | 1181 DISALLOW_COPY_AND_ASSIGN(BranchInstr); |
| 1139 }; | 1182 }; |
| 1140 | 1183 |
| 1141 #undef DECLARE_INSTRUCTION | 1184 #undef DECLARE_INSTRUCTION |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1178 const GrowableArray<BlockEntryInstr*>& block_order_; | 1221 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 1179 | 1222 |
| 1180 private: | 1223 private: |
| 1181 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 1224 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 1182 }; | 1225 }; |
| 1183 | 1226 |
| 1184 | 1227 |
| 1185 } // namespace dart | 1228 } // namespace dart |
| 1186 | 1229 |
| 1187 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 1230 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |