| 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 10 matching lines...) Expand all Loading... |
| 21 #define FOR_EACH_VALUE(M) \ | 21 #define FOR_EACH_VALUE(M) \ |
| 22 M(Temp, TempVal) \ | 22 M(Temp, TempVal) \ |
| 23 M(Constant, ConstantVal) \ | 23 M(Constant, ConstantVal) \ |
| 24 | 24 |
| 25 | 25 |
| 26 // M is a two argument macro. It is applied to each concrete instruction's | 26 // M is a two argument macro. It is applied to each concrete instruction's |
| 27 // (including the values) typename and classname. | 27 // (including the values) typename and classname. |
| 28 #define FOR_EACH_COMPUTATION(M) \ | 28 #define FOR_EACH_COMPUTATION(M) \ |
| 29 FOR_EACH_VALUE(M) \ | 29 FOR_EACH_VALUE(M) \ |
| 30 M(AssertAssignable, AssertAssignableComp) \ | 30 M(AssertAssignable, AssertAssignableComp) \ |
| 31 M(AssertBoolean, AssertBooleanComp) \ |
| 31 M(CurrentContext, CurrentContextComp) \ | 32 M(CurrentContext, CurrentContextComp) \ |
| 32 M(StoreContext, StoreContextComp) \ | 33 M(StoreContext, StoreContextComp) \ |
| 33 M(ClosureCall, ClosureCallComp) \ | 34 M(ClosureCall, ClosureCallComp) \ |
| 34 M(InstanceCall, InstanceCallComp) \ | 35 M(InstanceCall, InstanceCallComp) \ |
| 35 M(StaticCall, StaticCallComp) \ | 36 M(StaticCall, StaticCallComp) \ |
| 36 M(LoadLocal, LoadLocalComp) \ | 37 M(LoadLocal, LoadLocalComp) \ |
| 37 M(StoreLocal, StoreLocalComp) \ | 38 M(StoreLocal, StoreLocalComp) \ |
| 38 M(StrictCompare, StrictCompareComp) \ | 39 M(StrictCompare, StrictCompareComp) \ |
| 39 M(NativeCall, NativeCallComp) \ | 40 M(NativeCall, NativeCallComp) \ |
| 40 M(StoreIndexed, StoreIndexedComp) \ | 41 M(StoreIndexed, StoreIndexedComp) \ |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 const Object& value_; | 131 const Object& value_; |
| 131 | 132 |
| 132 DISALLOW_COPY_AND_ASSIGN(ConstantVal); | 133 DISALLOW_COPY_AND_ASSIGN(ConstantVal); |
| 133 }; | 134 }; |
| 134 | 135 |
| 135 #undef DECLARE_VALUE | 136 #undef DECLARE_VALUE |
| 136 | 137 |
| 137 | 138 |
| 138 class AssertAssignableComp : public Computation { | 139 class AssertAssignableComp : public Computation { |
| 139 public: | 140 public: |
| 140 AssertAssignableComp(Value* value, const AbstractType& type) | 141 AssertAssignableComp(intptr_t node_id, |
| 141 : value_(value), type_(type) { } | 142 intptr_t token_index, |
| 143 intptr_t try_index, |
| 144 Value* value, |
| 145 Value* type_arguments, // Can be NULL. |
| 146 const AbstractType& dst_type, |
| 147 const String& dst_name) |
| 148 : node_id_(node_id), |
| 149 token_index_(token_index), |
| 150 try_index_(try_index), |
| 151 value_(value), |
| 152 type_arguments_(type_arguments), |
| 153 dst_type_(dst_type), |
| 154 dst_name_(dst_name) { |
| 155 ASSERT(value_ != NULL); |
| 156 ASSERT(!dst_type.IsNull()); |
| 157 ASSERT(!dst_name.IsNull()); |
| 158 } |
| 142 | 159 |
| 143 DECLARE_COMPUTATION(AssertAssignable) | 160 DECLARE_COMPUTATION(AssertAssignable) |
| 144 | 161 |
| 162 intptr_t node_id() const { return node_id_; } |
| 163 intptr_t token_index() const { return token_index_; } |
| 164 intptr_t try_index() const { return try_index_; } |
| 145 Value* value() const { return value_; } | 165 Value* value() const { return value_; } |
| 146 const AbstractType& type() const { return type_; } | 166 Value* type_arguments() const { return type_arguments_; } |
| 167 const AbstractType& dst_type() const { return dst_type_; } |
| 168 const String& dst_name() const { return dst_name_; } |
| 147 | 169 |
| 148 private: | 170 private: |
| 171 const intptr_t node_id_; |
| 172 const intptr_t token_index_; |
| 173 const intptr_t try_index_; |
| 149 Value* value_; | 174 Value* value_; |
| 150 const AbstractType& type_; | 175 Value* type_arguments_; |
| 176 const AbstractType& dst_type_; |
| 177 const String& dst_name_; |
| 151 | 178 |
| 152 DISALLOW_COPY_AND_ASSIGN(AssertAssignableComp); | 179 DISALLOW_COPY_AND_ASSIGN(AssertAssignableComp); |
| 153 }; | 180 }; |
| 154 | 181 |
| 155 | 182 |
| 183 class AssertBooleanComp : public Computation { |
| 184 public: |
| 185 AssertBooleanComp(intptr_t node_id, |
| 186 intptr_t token_index, |
| 187 intptr_t try_index, |
| 188 Value* value) |
| 189 : node_id_(node_id), |
| 190 token_index_(token_index), |
| 191 try_index_(try_index), |
| 192 value_(value) { |
| 193 ASSERT(value_ != NULL); |
| 194 } |
| 195 |
| 196 DECLARE_COMPUTATION(AssertBoolean) |
| 197 |
| 198 intptr_t node_id() const { return node_id_; } |
| 199 intptr_t token_index() const { return token_index_; } |
| 200 intptr_t try_index() const { return try_index_; } |
| 201 Value* value() const { return value_; } |
| 202 |
| 203 private: |
| 204 const intptr_t node_id_; |
| 205 const intptr_t token_index_; |
| 206 const intptr_t try_index_; |
| 207 Value* value_; |
| 208 |
| 209 DISALLOW_COPY_AND_ASSIGN(AssertBooleanComp); |
| 210 }; |
| 211 |
| 212 |
| 156 // Denotes the current context, normally held in a register. This is | 213 // Denotes the current context, normally held in a register. This is |
| 157 // a computation, not a value, because it's mutable. | 214 // a computation, not a value, because it's mutable. |
| 158 class CurrentContextComp : public Computation { | 215 class CurrentContextComp : public Computation { |
| 159 public: | 216 public: |
| 160 CurrentContextComp() { } | 217 CurrentContextComp() { } |
| 161 | 218 |
| 162 DECLARE_COMPUTATION(CurrentContext) | 219 DECLARE_COMPUTATION(CurrentContext) |
| 163 | 220 |
| 164 private: | 221 private: |
| 165 DISALLOW_COPY_AND_ASSIGN(CurrentContextComp); | 222 DISALLOW_COPY_AND_ASSIGN(CurrentContextComp); |
| (...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1450 const GrowableArray<BlockEntryInstr*>& block_order_; | 1507 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 1451 | 1508 |
| 1452 private: | 1509 private: |
| 1453 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 1510 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 1454 }; | 1511 }; |
| 1455 | 1512 |
| 1456 | 1513 |
| 1457 } // namespace dart | 1514 } // namespace dart |
| 1458 | 1515 |
| 1459 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 1516 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |