| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 M(LoadVMField, LoadVMFieldComp) \ | 58 M(LoadVMField, LoadVMFieldComp) \ |
| 59 M(StoreVMField, StoreVMFieldComp) \ | 59 M(StoreVMField, StoreVMFieldComp) \ |
| 60 M(InstantiateTypeArguments, InstantiateTypeArgumentsComp) \ | 60 M(InstantiateTypeArguments, InstantiateTypeArgumentsComp) \ |
| 61 M(ExtractConstructorTypeArguments, ExtractConstructorTypeArgumentsComp) \ | 61 M(ExtractConstructorTypeArguments, ExtractConstructorTypeArgumentsComp) \ |
| 62 M(ExtractConstructorInstantiator, ExtractConstructorInstantiatorComp) \ | 62 M(ExtractConstructorInstantiator, ExtractConstructorInstantiatorComp) \ |
| 63 M(AllocateContext, AllocateContextComp) \ | 63 M(AllocateContext, AllocateContextComp) \ |
| 64 M(ChainContext, ChainContextComp) \ | 64 M(ChainContext, ChainContextComp) \ |
| 65 M(CloneContext, CloneContextComp) \ | 65 M(CloneContext, CloneContextComp) \ |
| 66 M(CatchEntry, CatchEntryComp) \ | 66 M(CatchEntry, CatchEntryComp) \ |
| 67 M(BinaryOp, BinaryOpComp) \ | 67 M(BinaryOp, BinaryOpComp) \ |
| 68 M(UnaryOp, UnaryOpComp) \ |
| 68 | 69 |
| 69 | 70 |
| 70 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; | 71 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; |
| 71 FOR_EACH_COMPUTATION(FORWARD_DECLARATION) | 72 FOR_EACH_COMPUTATION(FORWARD_DECLARATION) |
| 72 #undef FORWARD_DECLARATION | 73 #undef FORWARD_DECLARATION |
| 73 | 74 |
| 74 // Forward declarations. | 75 // Forward declarations. |
| 75 class BufferFormatter; | 76 class BufferFormatter; |
| 76 class Instruction; | 77 class Instruction; |
| 77 class Value; | 78 class Value; |
| (...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 }; | 1277 }; |
| 1277 | 1278 |
| 1278 | 1279 |
| 1279 class BinaryOpComp : public TemplateComputation<2> { | 1280 class BinaryOpComp : public TemplateComputation<2> { |
| 1280 public: | 1281 public: |
| 1281 BinaryOpComp(Token::Kind op_kind, | 1282 BinaryOpComp(Token::Kind op_kind, |
| 1282 InstanceCallComp* instance_call, | 1283 InstanceCallComp* instance_call, |
| 1283 Value* left, | 1284 Value* left, |
| 1284 Value* right) | 1285 Value* right) |
| 1285 : op_kind_(op_kind), instance_call_(instance_call) { | 1286 : op_kind_(op_kind), instance_call_(instance_call) { |
| 1287 ASSERT(left != NULL); |
| 1288 ASSERT(right != NULL); |
| 1286 inputs_[0] = left; | 1289 inputs_[0] = left; |
| 1287 inputs_[1] = right; | 1290 inputs_[1] = right; |
| 1288 } | 1291 } |
| 1289 | 1292 |
| 1290 Value* left() const { return inputs_[0]; } | 1293 Value* left() const { return inputs_[0]; } |
| 1291 Value* right() const { return inputs_[1]; } | 1294 Value* right() const { return inputs_[1]; } |
| 1292 | 1295 |
| 1293 Token::Kind op_kind() const { return op_kind_; } | 1296 Token::Kind op_kind() const { return op_kind_; } |
| 1294 | 1297 |
| 1295 InstanceCallComp* instance_call() const { return instance_call_; } | 1298 InstanceCallComp* instance_call() const { return instance_call_; } |
| 1296 | 1299 |
| 1297 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1300 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1298 | 1301 |
| 1299 DECLARE_COMPUTATION(BinaryOp) | 1302 DECLARE_COMPUTATION(BinaryOp) |
| 1300 | 1303 |
| 1301 private: | 1304 private: |
| 1302 const Token::Kind op_kind_; | 1305 const Token::Kind op_kind_; |
| 1303 InstanceCallComp* instance_call_; | 1306 InstanceCallComp* instance_call_; |
| 1304 | 1307 |
| 1305 DISALLOW_COPY_AND_ASSIGN(BinaryOpComp); | 1308 DISALLOW_COPY_AND_ASSIGN(BinaryOpComp); |
| 1306 }; | 1309 }; |
| 1307 | 1310 |
| 1311 |
| 1312 class UnaryOpComp : public TemplateComputation<1> { |
| 1313 public: |
| 1314 UnaryOpComp(Token::Kind op_kind, |
| 1315 InstanceCallComp* instance_call, |
| 1316 Value* value) : op_kind_(op_kind), instance_call_(instance_call) { |
| 1317 ASSERT(value != NULL); |
| 1318 inputs_[0] = value; |
| 1319 } |
| 1320 |
| 1321 Value* value() const { return inputs_[0]; } |
| 1322 Token::Kind op_kind() const { return op_kind_; } |
| 1323 |
| 1324 InstanceCallComp* instance_call() const { return instance_call_; } |
| 1325 |
| 1326 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1327 |
| 1328 DECLARE_COMPUTATION(UnaryOp) |
| 1329 |
| 1330 private: |
| 1331 const Token::Kind op_kind_; |
| 1332 InstanceCallComp* instance_call_; |
| 1333 |
| 1334 DISALLOW_COPY_AND_ASSIGN(UnaryOpComp); |
| 1335 }; |
| 1336 |
| 1308 #undef DECLARE_COMPUTATION | 1337 #undef DECLARE_COMPUTATION |
| 1309 | 1338 |
| 1310 | 1339 |
| 1311 // Instructions. | 1340 // Instructions. |
| 1312 // | 1341 // |
| 1313 // <Instruction> ::= JoinEntry <Instruction> | 1342 // <Instruction> ::= JoinEntry <Instruction> |
| 1314 // | TargetEntry <Instruction> | 1343 // | TargetEntry <Instruction> |
| 1315 // | Do <Computation> <Instruction> | 1344 // | Do <Computation> <Instruction> |
| 1316 // | Return <Value> | 1345 // | Return <Value> |
| 1317 // | Branch <Value> <Instruction> <Instruction> | 1346 // | Branch <Value> <Instruction> <Instruction> |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1891 const GrowableArray<BlockEntryInstr*>& block_order_; | 1920 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 1892 | 1921 |
| 1893 private: | 1922 private: |
| 1894 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 1923 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 1895 }; | 1924 }; |
| 1896 | 1925 |
| 1897 | 1926 |
| 1898 } // namespace dart | 1927 } // namespace dart |
| 1899 | 1928 |
| 1900 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 1929 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |