| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 protected: | 91 protected: |
| 92 // Helpers for translating parts of the AST. | 92 // Helpers for translating parts of the AST. |
| 93 void TranslateArgumentList(const ArgumentListNode& node, | 93 void TranslateArgumentList(const ArgumentListNode& node, |
| 94 intptr_t next_temp_index, | 94 intptr_t next_temp_index, |
| 95 ZoneGrowableArray<Value*>* values); | 95 ZoneGrowableArray<Value*>* values); |
| 96 | 96 |
| 97 // Build the load part of a instance field increment. Translates the | 97 // Build the load part of a instance field increment. Translates the |
| 98 // receiver and loads the value. The receiver will be named with | 98 // receiver and loads the value. The receiver will be named with |
| 99 // start_index, the temporary index of the value is returned (always | 99 // start_index, the temporary index of the value is returned (always |
| 100 // start_index+1). | 100 // start_index+1). |
| 101 int BuildIncrOpFieldLoad(IncrOpInstanceFieldNode* node, int start_index); | 101 int BuildIncrOpFieldLoad(IncrOpInstanceFieldNode* node, intptr_t start_index); |
| 102 | 102 |
| 103 // Build the load part of an indexed increment. Translates the receiver | 103 // Build the load part of an indexed increment. Translates the receiver |
| 104 // and index and loads the value. The receiver will be named with | 104 // and index and loads the value. The receiver will be named with |
| 105 // start_index, the index with start_index+1, and the temporary index of | 105 // start_index, the index with start_index+1, and the temporary index of |
| 106 // the value is returned (always start_index+2). | 106 // the value is returned (always start_index+2). |
| 107 int BuildIncrOpIndexedLoad(IncrOpIndexedNode* node, int start_index); | 107 int BuildIncrOpIndexedLoad(IncrOpIndexedNode* node, intptr_t start_index); |
| 108 | 108 |
| 109 // Build the increment part of an increment operation (add or subtract 1). | 109 // Build the increment part of an increment operation (add or subtract 1). |
| 110 // The original value is expected to be named with start_index-1, and the | 110 // The original value is expected to be named with start_index-1, and the |
| 111 // result will be named with start_index. | 111 // result will be named with start_index. |
| 112 void BuildIncrOpIncrement(Token::Kind kind, | 112 void BuildIncrOpIncrement(Token::Kind kind, |
| 113 intptr_t node_id, | 113 intptr_t node_id, |
| 114 intptr_t token_index, | 114 intptr_t token_index, |
| 115 int start_index); | 115 intptr_t start_index); |
| 116 | 116 |
| 117 // Creates type arguments (one or two values in 'args') used in preparation | 117 // Creates an instantiated type argument vector used in preparation of a |
| 118 // of a constructor or factory call. | 118 // factory call. |
| 119 // For factory call instantiates and returns type argument vector in 'args'. | |
| 120 // For constructor call returns type arguments and type arguments of the | |
| 121 // instantiator. | |
| 122 // May be called only if allocating an object of a parameterized class. | 119 // May be called only if allocating an object of a parameterized class. |
| 123 void BuildTypeArguments(ConstructorCallNode* node, | 120 Value* BuildFactoryTypeArguments(ConstructorCallNode* node, |
| 124 ZoneGrowableArray<Value*>* args); | 121 intptr_t start_index); |
| 122 |
| 123 // Creates a possibly uninstantiated type argument vector and the type |
| 124 // argument vector of the instantiator (two values in 'args') used in |
| 125 // preparation of a constructor call. |
| 126 // May be called only if allocating an object of a parameterized class. |
| 127 void BuildConstructorTypeArguments(ConstructorCallNode* node, |
| 128 intptr_t start_index, |
| 129 ZoneGrowableArray<Value*>* args); |
| 125 | 130 |
| 126 // Returns the value of the type arguments of the instantiator. | 131 // Returns the value of the type arguments of the instantiator. |
| 127 Value* GenerateInstantiatorTypeArguments(intptr_t token_index, | 132 Value* BuildInstantiatorTypeArguments(intptr_t token_index, |
| 128 intptr_t type_arguments); | 133 intptr_t start_index); |
| 129 | 134 |
| 130 void CloseFragment() { exit_ = NULL; } | 135 void CloseFragment() { exit_ = NULL; } |
| 131 intptr_t AllocateTempIndex() { return temp_index_++; } | 136 intptr_t AllocateTempIndex() { return temp_index_++; } |
| 132 | 137 |
| 133 private: | 138 private: |
| 134 // Specify a computation as the final result. Adds a Do instruction to | 139 // Specify a computation as the final result. Adds a Do instruction to |
| 135 // the graph, but normally overridden in subclasses. | 140 // the graph, but normally overridden in subclasses. |
| 136 virtual void ReturnComputation(Computation* computation) { | 141 virtual void ReturnComputation(Computation* computation) { |
| 137 AddInstruction(new DoInstr(computation)); | 142 AddInstruction(new DoInstr(computation)); |
| 138 } | 143 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 271 } |
| 267 | 272 |
| 268 // Output parameters. | 273 // Output parameters. |
| 269 BlockEntryInstr** true_successor_address_; | 274 BlockEntryInstr** true_successor_address_; |
| 270 BlockEntryInstr** false_successor_address_; | 275 BlockEntryInstr** false_successor_address_; |
| 271 }; | 276 }; |
| 272 | 277 |
| 273 } // namespace dart | 278 } // namespace dart |
| 274 | 279 |
| 275 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 280 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
| OLD | NEW |