| 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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 Instruction() { } | 795 Instruction() { } |
| 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 Instruction* StraightLineSuccessor() const = 0; |
| 805 virtual void SetSuccessor(Instruction* instr) = 0; | 806 virtual void SetSuccessor(Instruction* instr) = 0; |
| 806 | 807 |
| 807 // Discover basic-block structure by performing a recursive depth first | 808 // Discover basic-block structure by performing a recursive depth first |
| 808 // traversal of the instruction graph reachable from this instruction. As | 809 // traversal of the instruction graph reachable from this instruction. As |
| 809 // a side effect, the block entry instructions in the graph are assigned | 810 // a side effect, the block entry instructions in the graph are assigned |
| 810 // numbers in both preorder and postorder. The array 'preorder' maps | 811 // numbers in both preorder and postorder. The array 'preorder' maps |
| 811 // preorder block numbers to the block entry instruction with that number | 812 // preorder block numbers to the block entry instruction with that number |
| 812 // and analogously for the array 'postorder'. The depth first spanning | 813 // and analogously for the array 'postorder'. The depth first spanning |
| 813 // tree is recorded in the array 'parent', which maps preorder block | 814 // 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 // 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 // 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 // instructions of predecessor blocks) and also the last instruction in |
| 817 // the block is recorded in each entry instruction. | 818 // the block is recorded in each entry instruction. |
| 818 virtual void DiscoverBlocks( | 819 virtual void DiscoverBlocks( |
| 819 BlockEntryInstr* current_block, | 820 BlockEntryInstr* current_block, |
| 820 GrowableArray<BlockEntryInstr*>* preorder, | 821 GrowableArray<BlockEntryInstr*>* preorder, |
| 821 GrowableArray<BlockEntryInstr*>* postorder, | 822 GrowableArray<BlockEntryInstr*>* postorder, |
| 822 GrowableArray<BlockEntryInstr*>* parent) = 0; | 823 GrowableArray<BlockEntryInstr*>* parent) { |
| 824 // Never called for instructions except block entries and branches. |
| 825 UNREACHABLE(); |
| 826 } |
| 823 | 827 |
| 824 #define INSTRUCTION_TYPE_CHECK(type) \ | 828 #define INSTRUCTION_TYPE_CHECK(type) \ |
| 825 virtual bool Is##type() const { return false; } \ | 829 virtual bool Is##type() const { return false; } \ |
| 826 virtual type##Instr* As##type() { return NULL; } | 830 virtual type##Instr* As##type() { return NULL; } |
| 827 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK) | 831 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK) |
| 828 #undef INSTRUCTION_TYPE_CHECK | 832 #undef INSTRUCTION_TYPE_CHECK |
| 829 | 833 |
| 830 private: | 834 private: |
| 831 DISALLOW_COPY_AND_ASSIGN(Instruction); | 835 DISALLOW_COPY_AND_ASSIGN(Instruction); |
| 832 }; | 836 }; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 | 870 |
| 867 class JoinEntryInstr : public BlockEntryInstr { | 871 class JoinEntryInstr : public BlockEntryInstr { |
| 868 public: | 872 public: |
| 869 JoinEntryInstr() | 873 JoinEntryInstr() |
| 870 : BlockEntryInstr(), | 874 : BlockEntryInstr(), |
| 871 predecessors_(2), // Two is the assumed to be the common case. | 875 predecessors_(2), // Two is the assumed to be the common case. |
| 872 successor_(NULL) { } | 876 successor_(NULL) { } |
| 873 | 877 |
| 874 DECLARE_INSTRUCTION(JoinEntry) | 878 DECLARE_INSTRUCTION(JoinEntry) |
| 875 | 879 |
| 880 virtual Instruction* StraightLineSuccessor() const { |
| 881 return successor_; |
| 882 } |
| 876 virtual void SetSuccessor(Instruction* instr) { | 883 virtual void SetSuccessor(Instruction* instr) { |
| 877 ASSERT(successor_ == NULL); | 884 ASSERT(successor_ == NULL); |
| 878 successor_ = instr; | 885 successor_ = instr; |
| 879 } | 886 } |
| 880 | 887 |
| 881 virtual void DiscoverBlocks( | 888 virtual void DiscoverBlocks( |
| 882 BlockEntryInstr* current_block, | 889 BlockEntryInstr* current_block, |
| 883 GrowableArray<BlockEntryInstr*>* preorder, | 890 GrowableArray<BlockEntryInstr*>* preorder, |
| 884 GrowableArray<BlockEntryInstr*>* postorder, | 891 GrowableArray<BlockEntryInstr*>* postorder, |
| 885 GrowableArray<BlockEntryInstr*>* parent); | 892 GrowableArray<BlockEntryInstr*>* parent); |
| 886 | 893 |
| 887 private: | 894 private: |
| 888 ZoneGrowableArray<BlockEntryInstr*> predecessors_; | 895 ZoneGrowableArray<BlockEntryInstr*> predecessors_; |
| 889 Instruction* successor_; | 896 Instruction* successor_; |
| 890 | 897 |
| 891 DISALLOW_COPY_AND_ASSIGN(JoinEntryInstr); | 898 DISALLOW_COPY_AND_ASSIGN(JoinEntryInstr); |
| 892 }; | 899 }; |
| 893 | 900 |
| 894 | 901 |
| 895 class TargetEntryInstr : public BlockEntryInstr { | 902 class TargetEntryInstr : public BlockEntryInstr { |
| 896 public: | 903 public: |
| 897 TargetEntryInstr() | 904 TargetEntryInstr() |
| 898 : BlockEntryInstr(), predecessor_(NULL), successor_(NULL) { } | 905 : BlockEntryInstr(), predecessor_(NULL), successor_(NULL) { } |
| 899 | 906 |
| 900 DECLARE_INSTRUCTION(TargetEntry) | 907 DECLARE_INSTRUCTION(TargetEntry) |
| 901 | 908 |
| 909 virtual Instruction* StraightLineSuccessor() const { |
| 910 return successor_; |
| 911 } |
| 902 virtual void SetSuccessor(Instruction* instr) { | 912 virtual void SetSuccessor(Instruction* instr) { |
| 903 ASSERT(successor_ == NULL); | 913 ASSERT(successor_ == NULL); |
| 904 successor_ = instr; | 914 successor_ = instr; |
| 905 } | 915 } |
| 906 | 916 |
| 907 virtual void DiscoverBlocks( | 917 virtual void DiscoverBlocks( |
| 908 BlockEntryInstr* current_block, | 918 BlockEntryInstr* current_block, |
| 909 GrowableArray<BlockEntryInstr*>* preorder, | 919 GrowableArray<BlockEntryInstr*>* preorder, |
| 910 GrowableArray<BlockEntryInstr*>* postorder, | 920 GrowableArray<BlockEntryInstr*>* postorder, |
| 911 GrowableArray<BlockEntryInstr*>* parent); | 921 GrowableArray<BlockEntryInstr*>* parent); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 928 class PickTempInstr : public Instruction { | 938 class PickTempInstr : public Instruction { |
| 929 public: | 939 public: |
| 930 PickTempInstr(intptr_t dst, intptr_t src) | 940 PickTempInstr(intptr_t dst, intptr_t src) |
| 931 : destination_(dst), source_(src), successor_(NULL) { } | 941 : destination_(dst), source_(src), successor_(NULL) { } |
| 932 | 942 |
| 933 DECLARE_INSTRUCTION(PickTemp) | 943 DECLARE_INSTRUCTION(PickTemp) |
| 934 | 944 |
| 935 intptr_t destination() const { return destination_; } | 945 intptr_t destination() const { return destination_; } |
| 936 intptr_t source() const { return source_; } | 946 intptr_t source() const { return source_; } |
| 937 | 947 |
| 948 virtual Instruction* StraightLineSuccessor() const { |
| 949 return successor_; |
| 950 } |
| 938 virtual void SetSuccessor(Instruction* instr) { | 951 virtual void SetSuccessor(Instruction* instr) { |
| 939 ASSERT(successor_ == NULL && instr != NULL); | 952 ASSERT(successor_ == NULL && instr != NULL); |
| 940 successor_ = instr; | 953 successor_ = instr; |
| 941 } | 954 } |
| 942 | 955 |
| 943 virtual void DiscoverBlocks( | |
| 944 BlockEntryInstr* current_block, | |
| 945 GrowableArray<BlockEntryInstr*>* preorder, | |
| 946 GrowableArray<BlockEntryInstr*>* postorder, | |
| 947 GrowableArray<BlockEntryInstr*>* parent); | |
| 948 | |
| 949 private: | 956 private: |
| 950 const intptr_t destination_; | 957 const intptr_t destination_; |
| 951 const intptr_t source_; | 958 const intptr_t source_; |
| 952 Instruction* successor_; | 959 Instruction* successor_; |
| 953 | 960 |
| 954 DISALLOW_COPY_AND_ASSIGN(PickTempInstr); | 961 DISALLOW_COPY_AND_ASSIGN(PickTempInstr); |
| 955 }; | 962 }; |
| 956 | 963 |
| 957 | 964 |
| 958 // The non-optimizing compiler assumes that temporary definitions and uses | 965 // The non-optimizing compiler assumes that temporary definitions and uses |
| 959 // obey a stack discipline, so they can be allocated and deallocated with | 966 // obey a stack discipline, so they can be allocated and deallocated with |
| 960 // push and pop. Some Some AST nodes, e.g., expr++, violate this assumption | 967 // push and pop. Some Some AST nodes, e.g., expr++, violate this assumption |
| 961 // (the value expr+1 is produced after the value of expr, and also consumed | 968 // (the value expr+1 is produced after the value of expr, and also consumed |
| 962 // after it). | 969 // after it). |
| 963 // | 970 // |
| 964 // We 'preallocate' temporaries (named with 'destination') such as the one | 971 // We 'preallocate' temporaries (named with 'destination') such as the one |
| 965 // for expr+1 and use TuckTemp to mutate them by overwriting them with a | 972 // for expr+1 and use TuckTemp to mutate them by overwriting them with a |
| 966 // copy of a temporary (named with 'source'). | 973 // copy of a temporary (named with 'source'). |
| 967 class TuckTempInstr : public Instruction { | 974 class TuckTempInstr : public Instruction { |
| 968 public: | 975 public: |
| 969 TuckTempInstr(intptr_t dst, intptr_t src) | 976 TuckTempInstr(intptr_t dst, intptr_t src) |
| 970 : destination_(dst), source_(src), successor_(NULL) { } | 977 : destination_(dst), source_(src), successor_(NULL) { } |
| 971 | 978 |
| 972 DECLARE_INSTRUCTION(TuckTemp) | 979 DECLARE_INSTRUCTION(TuckTemp) |
| 973 | 980 |
| 974 intptr_t destination() const { return destination_; } | 981 intptr_t destination() const { return destination_; } |
| 975 intptr_t source() const { return source_; } | 982 intptr_t source() const { return source_; } |
| 976 | 983 |
| 984 virtual Instruction* StraightLineSuccessor() const { |
| 985 return successor_; |
| 986 } |
| 977 virtual void SetSuccessor(Instruction* instr) { | 987 virtual void SetSuccessor(Instruction* instr) { |
| 978 ASSERT(successor_ == NULL && instr != NULL); | 988 ASSERT(successor_ == NULL && instr != NULL); |
| 979 successor_ = instr; | 989 successor_ = instr; |
| 980 } | 990 } |
| 981 | 991 |
| 982 virtual void DiscoverBlocks( | |
| 983 BlockEntryInstr* current_block, | |
| 984 GrowableArray<BlockEntryInstr*>* preorder, | |
| 985 GrowableArray<BlockEntryInstr*>* postorder, | |
| 986 GrowableArray<BlockEntryInstr*>* parent); | |
| 987 | |
| 988 private: | 992 private: |
| 989 const intptr_t destination_; | 993 const intptr_t destination_; |
| 990 const intptr_t source_; | 994 const intptr_t source_; |
| 991 Instruction* successor_; | 995 Instruction* successor_; |
| 992 | 996 |
| 993 DISALLOW_COPY_AND_ASSIGN(TuckTempInstr); | 997 DISALLOW_COPY_AND_ASSIGN(TuckTempInstr); |
| 994 }; | 998 }; |
| 995 | 999 |
| 996 | 1000 |
| 997 class DoInstr : public Instruction { | 1001 class DoInstr : public Instruction { |
| 998 public: | 1002 public: |
| 999 explicit DoInstr(Computation* comp) | 1003 explicit DoInstr(Computation* comp) |
| 1000 : computation_(comp), successor_(NULL) { } | 1004 : computation_(comp), successor_(NULL) { } |
| 1001 | 1005 |
| 1002 DECLARE_INSTRUCTION(Do) | 1006 DECLARE_INSTRUCTION(Do) |
| 1003 | 1007 |
| 1004 Computation* computation() const { return computation_; } | 1008 Computation* computation() const { return computation_; } |
| 1005 | 1009 |
| 1010 virtual Instruction* StraightLineSuccessor() const { |
| 1011 return successor_; |
| 1012 } |
| 1006 virtual void SetSuccessor(Instruction* instr) { | 1013 virtual void SetSuccessor(Instruction* instr) { |
| 1007 ASSERT(successor_ == NULL); | 1014 ASSERT(successor_ == NULL); |
| 1008 successor_ = instr; | 1015 successor_ = instr; |
| 1009 } | 1016 } |
| 1010 | 1017 |
| 1011 virtual void DiscoverBlocks( | |
| 1012 BlockEntryInstr* current_block, | |
| 1013 GrowableArray<BlockEntryInstr*>* preorder, | |
| 1014 GrowableArray<BlockEntryInstr*>* postorder, | |
| 1015 GrowableArray<BlockEntryInstr*>* parent); | |
| 1016 | |
| 1017 private: | 1018 private: |
| 1018 Computation* computation_; | 1019 Computation* computation_; |
| 1019 Instruction* successor_; | 1020 Instruction* successor_; |
| 1020 | 1021 |
| 1021 DISALLOW_COPY_AND_ASSIGN(DoInstr); | 1022 DISALLOW_COPY_AND_ASSIGN(DoInstr); |
| 1022 }; | 1023 }; |
| 1023 | 1024 |
| 1024 | 1025 |
| 1025 class BindInstr : public Instruction { | 1026 class BindInstr : public Instruction { |
| 1026 public: | 1027 public: |
| 1027 BindInstr(intptr_t temp_index, Computation* computation) | 1028 BindInstr(intptr_t temp_index, Computation* computation) |
| 1028 : temp_index_(temp_index), computation_(computation), successor_(NULL) { } | 1029 : temp_index_(temp_index), computation_(computation), successor_(NULL) { } |
| 1029 | 1030 |
| 1030 DECLARE_INSTRUCTION(Bind) | 1031 DECLARE_INSTRUCTION(Bind) |
| 1031 | 1032 |
| 1032 intptr_t temp_index() const { return temp_index_; } | 1033 intptr_t temp_index() const { return temp_index_; } |
| 1033 Computation* computation() const { return computation_; } | 1034 Computation* computation() const { return computation_; } |
| 1034 | 1035 |
| 1036 virtual Instruction* StraightLineSuccessor() const { |
| 1037 return successor_; |
| 1038 } |
| 1035 virtual void SetSuccessor(Instruction* instr) { | 1039 virtual void SetSuccessor(Instruction* instr) { |
| 1036 ASSERT(successor_ == NULL); | 1040 ASSERT(successor_ == NULL); |
| 1037 successor_ = instr; | 1041 successor_ = instr; |
| 1038 } | 1042 } |
| 1039 | 1043 |
| 1040 virtual void DiscoverBlocks( | |
| 1041 BlockEntryInstr* current_block, | |
| 1042 GrowableArray<BlockEntryInstr*>* preorder, | |
| 1043 GrowableArray<BlockEntryInstr*>* postorder, | |
| 1044 GrowableArray<BlockEntryInstr*>* parent); | |
| 1045 | |
| 1046 private: | 1044 private: |
| 1047 const intptr_t temp_index_; | 1045 const intptr_t temp_index_; |
| 1048 Computation* computation_; | 1046 Computation* computation_; |
| 1049 Instruction* successor_; | 1047 Instruction* successor_; |
| 1050 | 1048 |
| 1051 DISALLOW_COPY_AND_ASSIGN(BindInstr); | 1049 DISALLOW_COPY_AND_ASSIGN(BindInstr); |
| 1052 }; | 1050 }; |
| 1053 | 1051 |
| 1054 | 1052 |
| 1055 class ReturnInstr : public Instruction { | 1053 class ReturnInstr : public Instruction { |
| 1056 public: | 1054 public: |
| 1057 ReturnInstr(Value* value, intptr_t token_index) | 1055 ReturnInstr(Value* value, intptr_t token_index) |
| 1058 : value_(value), token_index_(token_index) { | 1056 : value_(value), token_index_(token_index) { |
| 1059 ASSERT(value_ != NULL); | 1057 ASSERT(value_ != NULL); |
| 1060 } | 1058 } |
| 1061 | 1059 |
| 1062 DECLARE_INSTRUCTION(Return) | 1060 DECLARE_INSTRUCTION(Return) |
| 1063 | 1061 |
| 1064 Value* value() const { return value_; } | 1062 Value* value() const { return value_; } |
| 1065 intptr_t token_index() const { return token_index_; } | 1063 intptr_t token_index() const { return token_index_; } |
| 1066 | 1064 |
| 1065 virtual Instruction* StraightLineSuccessor() const { return NULL; } |
| 1067 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } | 1066 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } |
| 1068 | 1067 |
| 1069 virtual void DiscoverBlocks( | |
| 1070 BlockEntryInstr* current_block, | |
| 1071 GrowableArray<BlockEntryInstr*>* preorder, | |
| 1072 GrowableArray<BlockEntryInstr*>* postorder, | |
| 1073 GrowableArray<BlockEntryInstr*>* parent); | |
| 1074 | |
| 1075 private: | 1068 private: |
| 1076 Value* value_; | 1069 Value* value_; |
| 1077 intptr_t token_index_; | 1070 intptr_t token_index_; |
| 1078 | 1071 |
| 1079 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); | 1072 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); |
| 1080 }; | 1073 }; |
| 1081 | 1074 |
| 1082 | 1075 |
| 1083 class ThrowInstr : public Instruction { | 1076 class ThrowInstr : public Instruction { |
| 1084 public: | 1077 public: |
| 1085 ThrowInstr(intptr_t node_id, intptr_t token_index, Value* exception) | 1078 ThrowInstr(intptr_t node_id, intptr_t token_index, Value* exception) |
| 1086 : node_id_(node_id), token_index_(token_index), exception_(exception) { | 1079 : node_id_(node_id), token_index_(token_index), exception_(exception) { |
| 1087 ASSERT(exception_ != NULL); | 1080 ASSERT(exception_ != NULL); |
| 1088 } | 1081 } |
| 1089 | 1082 |
| 1090 DECLARE_INSTRUCTION(Throw) | 1083 DECLARE_INSTRUCTION(Throw) |
| 1091 | 1084 |
| 1092 intptr_t node_id() const { return node_id_; } | 1085 intptr_t node_id() const { return node_id_; } |
| 1093 intptr_t token_index() const { return token_index_; } | 1086 intptr_t token_index() const { return token_index_; } |
| 1094 Value* exception() const { return exception_; } | 1087 Value* exception() const { return exception_; } |
| 1095 | 1088 |
| 1089 virtual Instruction* StraightLineSuccessor() const { return NULL; } |
| 1096 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } | 1090 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } |
| 1097 | 1091 |
| 1098 virtual void DiscoverBlocks( | |
| 1099 BlockEntryInstr* current_block, | |
| 1100 GrowableArray<BlockEntryInstr*>* preorder, | |
| 1101 GrowableArray<BlockEntryInstr*>* postorder, | |
| 1102 GrowableArray<BlockEntryInstr*>* parent); | |
| 1103 | |
| 1104 private: | 1092 private: |
| 1105 intptr_t node_id_; | 1093 intptr_t node_id_; |
| 1106 intptr_t token_index_; | 1094 intptr_t token_index_; |
| 1107 Value* exception_; | 1095 Value* exception_; |
| 1108 | 1096 |
| 1109 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); | 1097 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); |
| 1110 }; | 1098 }; |
| 1111 | 1099 |
| 1112 | 1100 |
| 1113 class ReThrowInstr : public Instruction { | 1101 class ReThrowInstr : public Instruction { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1124 ASSERT(stack_trace_ != NULL); | 1112 ASSERT(stack_trace_ != NULL); |
| 1125 } | 1113 } |
| 1126 | 1114 |
| 1127 DECLARE_INSTRUCTION(ReThrow) | 1115 DECLARE_INSTRUCTION(ReThrow) |
| 1128 | 1116 |
| 1129 intptr_t node_id() const { return node_id_; } | 1117 intptr_t node_id() const { return node_id_; } |
| 1130 intptr_t token_index() const { return token_index_; } | 1118 intptr_t token_index() const { return token_index_; } |
| 1131 Value* exception() const { return exception_; } | 1119 Value* exception() const { return exception_; } |
| 1132 Value* stack_trace() const { return stack_trace_; } | 1120 Value* stack_trace() const { return stack_trace_; } |
| 1133 | 1121 |
| 1122 virtual Instruction* StraightLineSuccessor() const { return NULL; } |
| 1134 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } | 1123 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } |
| 1135 | 1124 |
| 1136 virtual void DiscoverBlocks( | |
| 1137 BlockEntryInstr* current_block, | |
| 1138 GrowableArray<BlockEntryInstr*>* preorder, | |
| 1139 GrowableArray<BlockEntryInstr*>* postorder, | |
| 1140 GrowableArray<BlockEntryInstr*>* parent); | |
| 1141 | |
| 1142 private: | 1125 private: |
| 1143 intptr_t node_id_; | 1126 intptr_t node_id_; |
| 1144 intptr_t token_index_; | 1127 intptr_t token_index_; |
| 1145 Value* exception_; | 1128 Value* exception_; |
| 1146 Value* stack_trace_; | 1129 Value* stack_trace_; |
| 1147 | 1130 |
| 1148 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); | 1131 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); |
| 1149 }; | 1132 }; |
| 1150 | 1133 |
| 1151 | 1134 |
| 1152 class BranchInstr : public Instruction { | 1135 class BranchInstr : public Instruction { |
| 1153 public: | 1136 public: |
| 1154 explicit BranchInstr(Value* value) | 1137 explicit BranchInstr(Value* value) |
| 1155 : value_(value), | 1138 : value_(value), |
| 1156 true_successor_(NULL), | 1139 true_successor_(NULL), |
| 1157 false_successor_(NULL) { } | 1140 false_successor_(NULL) { } |
| 1158 | 1141 |
| 1159 DECLARE_INSTRUCTION(Branch) | 1142 DECLARE_INSTRUCTION(Branch) |
| 1160 | 1143 |
| 1161 Value* value() const { return value_; } | 1144 Value* value() const { return value_; } |
| 1162 TargetEntryInstr* true_successor() const { return true_successor_; } | 1145 TargetEntryInstr* true_successor() const { return true_successor_; } |
| 1163 TargetEntryInstr* false_successor() const { return false_successor_; } | 1146 TargetEntryInstr* false_successor() const { return false_successor_; } |
| 1164 | 1147 |
| 1165 TargetEntryInstr** true_successor_address() { return &true_successor_; } | 1148 TargetEntryInstr** true_successor_address() { return &true_successor_; } |
| 1166 TargetEntryInstr** false_successor_address() { return &false_successor_; } | 1149 TargetEntryInstr** false_successor_address() { return &false_successor_; } |
| 1167 | 1150 |
| 1151 virtual Instruction* StraightLineSuccessor() const { return NULL; } |
| 1168 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } | 1152 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } |
| 1169 | 1153 |
| 1170 virtual void DiscoverBlocks( | 1154 virtual void DiscoverBlocks( |
| 1171 BlockEntryInstr* current_block, | 1155 BlockEntryInstr* current_block, |
| 1172 GrowableArray<BlockEntryInstr*>* preorder, | 1156 GrowableArray<BlockEntryInstr*>* preorder, |
| 1173 GrowableArray<BlockEntryInstr*>* postorder, | 1157 GrowableArray<BlockEntryInstr*>* postorder, |
| 1174 GrowableArray<BlockEntryInstr*>* parent); | 1158 GrowableArray<BlockEntryInstr*>* parent); |
| 1175 | 1159 |
| 1176 private: | 1160 private: |
| 1177 Value* value_; | 1161 Value* value_; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1221 const GrowableArray<BlockEntryInstr*>& block_order_; | 1205 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 1222 | 1206 |
| 1223 private: | 1207 private: |
| 1224 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 1208 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 1225 }; | 1209 }; |
| 1226 | 1210 |
| 1227 | 1211 |
| 1228 } // namespace dart | 1212 } // namespace dart |
| 1229 | 1213 |
| 1230 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 1214 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |