| 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_FLOW_GRAPH_BUILDER_H_ | 5 #ifndef VM_FLOW_GRAPH_BUILDER_H_ |
| 6 #define VM_FLOW_GRAPH_BUILDER_H_ | 6 #define VM_FLOW_GRAPH_BUILDER_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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // which parts are reachable. Afterward, the graph exit is the false | 110 // which parts are reachable. Afterward, the graph exit is the false |
| 111 // successor of the loop condition. | 111 // successor of the loop condition. |
| 112 void TieLoop(const TestGraphVisitor& test_fragment, | 112 void TieLoop(const TestGraphVisitor& test_fragment, |
| 113 const EffectGraphVisitor& body_fragment); | 113 const EffectGraphVisitor& body_fragment); |
| 114 | 114 |
| 115 protected: | 115 protected: |
| 116 // Helpers for translating parts of the AST. | 116 // Helpers for translating parts of the AST. |
| 117 void TranslateArgumentList(const ArgumentListNode& node, | 117 void TranslateArgumentList(const ArgumentListNode& node, |
| 118 ZoneGrowableArray<Value*>* values); | 118 ZoneGrowableArray<Value*>* values); |
| 119 | 119 |
| 120 // Build the load part of a instance field increment. Translates the | |
| 121 // receiver and loads the value. The receiver will be returned in the | |
| 122 // output parameter 'receiver'. | |
| 123 Definition* BuildIncrOpFieldLoad(IncrOpInstanceFieldNode* node, | |
| 124 Value** receiver); | |
| 125 | |
| 126 // Build the load part of an indexed increment. Translates the receiver | |
| 127 // and index and loads the value. The receiver will be returned in the | |
| 128 // output parameter 'receiver' and the index will be returned in the | |
| 129 // output parameter 'index'.. | |
| 130 Definition* BuildIncrOpIndexedLoad(IncrOpIndexedNode* node, | |
| 131 Value** receiver, | |
| 132 Value** index); | |
| 133 | |
| 134 // Build the increment part of an increment operation (add or subtract 1). | |
| 135 // Consumes the original value and produces the value +/- 1. | |
| 136 Definition* BuildIncrOpIncrement(Token::Kind kind, | |
| 137 intptr_t token_index, | |
| 138 Value* original); | |
| 139 | |
| 140 // Creates an instantiated type argument vector used in preparation of a | 120 // Creates an instantiated type argument vector used in preparation of a |
| 141 // factory call. | 121 // factory call. |
| 142 // May be called only if allocating an object of a parameterized class. | 122 // May be called only if allocating an object of a parameterized class. |
| 143 Definition* BuildFactoryTypeArguments(ConstructorCallNode* node); | 123 Definition* BuildFactoryTypeArguments(ConstructorCallNode* node); |
| 144 | 124 |
| 145 // Creates a possibly uninstantiated type argument vector and the type | 125 // Creates a possibly uninstantiated type argument vector and the type |
| 146 // argument vector of the instantiator (two values in 'args') used in | 126 // argument vector of the instantiator (two values in 'args') used in |
| 147 // preparation of a constructor call. | 127 // preparation of a constructor call. |
| 148 // May be called only if allocating an object of a parameterized class. | 128 // May be called only if allocating an object of a parameterized class. |
| 149 void BuildConstructorTypeArguments(ConstructorCallNode* node, | 129 void BuildConstructorTypeArguments(ConstructorCallNode* node, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // in the EffectGraphVisitor), a next temporary index, and an intermediate | 194 // in the EffectGraphVisitor), a next temporary index, and an intermediate |
| 215 // language Value. | 195 // language Value. |
| 216 class ValueGraphVisitor : public EffectGraphVisitor { | 196 class ValueGraphVisitor : public EffectGraphVisitor { |
| 217 public: | 197 public: |
| 218 ValueGraphVisitor(FlowGraphBuilder* owner, intptr_t temp_index) | 198 ValueGraphVisitor(FlowGraphBuilder* owner, intptr_t temp_index) |
| 219 : EffectGraphVisitor(owner, temp_index), value_(NULL) { } | 199 : EffectGraphVisitor(owner, temp_index), value_(NULL) { } |
| 220 | 200 |
| 221 // Visit functions overridden by this class. | 201 // Visit functions overridden by this class. |
| 222 virtual void VisitLiteralNode(LiteralNode* node); | 202 virtual void VisitLiteralNode(LiteralNode* node); |
| 223 virtual void VisitAssignableNode(AssignableNode* node); | 203 virtual void VisitAssignableNode(AssignableNode* node); |
| 224 virtual void VisitIncrOpInstanceFieldNode(IncrOpInstanceFieldNode* node); | |
| 225 virtual void VisitIncrOpIndexedNode(IncrOpIndexedNode* node); | |
| 226 virtual void VisitConstructorCallNode(ConstructorCallNode* node); | 204 virtual void VisitConstructorCallNode(ConstructorCallNode* node); |
| 227 virtual void VisitBinaryOpNode(BinaryOpNode* node); | 205 virtual void VisitBinaryOpNode(BinaryOpNode* node); |
| 228 virtual void VisitConditionalExprNode(ConditionalExprNode* node); | 206 virtual void VisitConditionalExprNode(ConditionalExprNode* node); |
| 229 virtual void VisitLoadLocalNode(LoadLocalNode* node); | 207 virtual void VisitLoadLocalNode(LoadLocalNode* node); |
| 230 virtual void VisitThrowNode(ThrowNode* node); | 208 virtual void VisitThrowNode(ThrowNode* node); |
| 231 | 209 |
| 232 Value* value() const { return value_; } | 210 Value* value() const { return value_; } |
| 233 | 211 |
| 234 protected: | 212 protected: |
| 235 // Output parameters. | 213 // Output parameters. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 // Output parameters. | 283 // Output parameters. |
| 306 TargetEntryInstr** true_successor_address_; | 284 TargetEntryInstr** true_successor_address_; |
| 307 TargetEntryInstr** false_successor_address_; | 285 TargetEntryInstr** false_successor_address_; |
| 308 | 286 |
| 309 intptr_t condition_token_index_; | 287 intptr_t condition_token_index_; |
| 310 }; | 288 }; |
| 311 | 289 |
| 312 } // namespace dart | 290 } // namespace dart |
| 313 | 291 |
| 314 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 292 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
| OLD | NEW |