| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 M(ExtractConstructorTypeArguments, ExtractConstructorTypeArgumentsComp) \ | 63 M(ExtractConstructorTypeArguments, ExtractConstructorTypeArgumentsComp) \ |
| 64 M(ExtractConstructorInstantiator, ExtractConstructorInstantiatorComp) \ | 64 M(ExtractConstructorInstantiator, ExtractConstructorInstantiatorComp) \ |
| 65 M(AllocateContext, AllocateContextComp) \ | 65 M(AllocateContext, AllocateContextComp) \ |
| 66 M(ChainContext, ChainContextComp) \ | 66 M(ChainContext, ChainContextComp) \ |
| 67 M(CloneContext, CloneContextComp) \ | 67 M(CloneContext, CloneContextComp) \ |
| 68 M(CatchEntry, CatchEntryComp) \ | 68 M(CatchEntry, CatchEntryComp) \ |
| 69 M(BinaryOp, BinaryOpComp) \ | 69 M(BinaryOp, BinaryOpComp) \ |
| 70 M(UnarySmiOp, UnarySmiOpComp) \ | 70 M(UnarySmiOp, UnarySmiOpComp) \ |
| 71 M(NumberNegate, NumberNegateComp) \ | 71 M(NumberNegate, NumberNegateComp) \ |
| 72 M(CheckStackOverflow, CheckStackOverflowComp) \ | 72 M(CheckStackOverflow, CheckStackOverflowComp) \ |
| 73 M(ToDouble, ToDoubleComp) \ |
| 73 | 74 |
| 74 | 75 |
| 75 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; | 76 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; |
| 76 FOR_EACH_COMPUTATION(FORWARD_DECLARATION) | 77 FOR_EACH_COMPUTATION(FORWARD_DECLARATION) |
| 77 #undef FORWARD_DECLARATION | 78 #undef FORWARD_DECLARATION |
| 78 | 79 |
| 79 // Forward declarations. | 80 // Forward declarations. |
| 80 class BufferFormatter; | 81 class BufferFormatter; |
| 81 class Instruction; | 82 class Instruction; |
| 82 class Value; | 83 class Value; |
| (...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1525 DECLARE_COMPUTATION(CheckStackOverflow) | 1526 DECLARE_COMPUTATION(CheckStackOverflow) |
| 1526 | 1527 |
| 1527 private: | 1528 private: |
| 1528 const intptr_t token_index_; | 1529 const intptr_t token_index_; |
| 1529 const intptr_t try_index_; | 1530 const intptr_t try_index_; |
| 1530 | 1531 |
| 1531 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowComp); | 1532 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowComp); |
| 1532 }; | 1533 }; |
| 1533 | 1534 |
| 1534 | 1535 |
| 1536 class ToDoubleComp : public TemplateComputation<1> { |
| 1537 public: |
| 1538 ToDoubleComp(Value* value, |
| 1539 ObjectKind from, |
| 1540 InstanceCallComp* instance_call) |
| 1541 : from_(from), instance_call_(instance_call) { |
| 1542 ASSERT(value != NULL); |
| 1543 inputs_[0] = value; |
| 1544 } |
| 1545 |
| 1546 Value* value() const { return inputs_[0]; } |
| 1547 ObjectKind from() const { return from_; } |
| 1548 |
| 1549 InstanceCallComp* instance_call() const { return instance_call_; } |
| 1550 |
| 1551 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1552 |
| 1553 DECLARE_COMPUTATION(ToDouble) |
| 1554 |
| 1555 private: |
| 1556 const ObjectKind from_; |
| 1557 InstanceCallComp* instance_call_; |
| 1558 |
| 1559 DISALLOW_COPY_AND_ASSIGN(ToDoubleComp); |
| 1560 }; |
| 1561 |
| 1562 |
| 1535 #undef DECLARE_COMPUTATION | 1563 #undef DECLARE_COMPUTATION |
| 1536 | 1564 |
| 1537 | 1565 |
| 1538 // Implementation of type testers and cast functins. | 1566 // Implementation of type testers and cast functins. |
| 1539 #define DEFINE_PREDICATE(ShortName, ClassName) \ | 1567 #define DEFINE_PREDICATE(ShortName, ClassName) \ |
| 1540 bool Computation::Is##ShortName() const { \ | 1568 bool Computation::Is##ShortName() const { \ |
| 1541 return computation_type() == k##ShortName; \ | 1569 return computation_type() == k##ShortName; \ |
| 1542 } \ | 1570 } \ |
| 1543 ClassName* Computation::As##ShortName() { \ | 1571 ClassName* Computation::As##ShortName() { \ |
| 1544 if (!Is##ShortName()) return NULL; \ | 1572 if (!Is##ShortName()) return NULL; \ |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2184 const GrowableArray<BlockEntryInstr*>& block_order_; | 2212 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 2185 | 2213 |
| 2186 private: | 2214 private: |
| 2187 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 2215 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 2188 }; | 2216 }; |
| 2189 | 2217 |
| 2190 | 2218 |
| 2191 } // namespace dart | 2219 } // namespace dart |
| 2192 | 2220 |
| 2193 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 2221 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |