| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 intptr_t start_index); | 147 intptr_t start_index); |
| 148 | 148 |
| 149 bool MustSaveRestoreContext(SequenceNode* node) const; | 149 bool MustSaveRestoreContext(SequenceNode* node) const; |
| 150 | 150 |
| 151 // Moves parent context into the context register. | 151 // Moves parent context into the context register. |
| 152 void UnchainContext(); | 152 void UnchainContext(); |
| 153 | 153 |
| 154 void CloseFragment() { exit_ = NULL; } | 154 void CloseFragment() { exit_ = NULL; } |
| 155 intptr_t AllocateTempIndex() { return temp_index_++; } | 155 intptr_t AllocateTempIndex() { return temp_index_++; } |
| 156 | 156 |
| 157 virtual void CompiletimeStringInterpolation(const Function& interpol_func, |
| 158 const Array& literals); |
| 159 |
| 157 private: | 160 private: |
| 158 // Specify a computation as the final result. Adds a Do instruction to | 161 // Specify a computation as the final result. Adds a Do instruction to |
| 159 // the graph, but normally overridden in subclasses. | 162 // the graph, but normally overridden in subclasses. |
| 160 virtual void ReturnComputation(Computation* computation) { | 163 virtual void ReturnComputation(Computation* computation) { |
| 161 AddInstruction(new DoInstr(computation)); | 164 AddInstruction(new DoInstr(computation)); |
| 162 } | 165 } |
| 163 | 166 |
| 164 // Shared global state. | 167 // Shared global state. |
| 165 FlowGraphBuilder* owner_; | 168 FlowGraphBuilder* owner_; |
| 166 | 169 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // Helper to set the output state to return a Value. | 206 // Helper to set the output state to return a Value. |
| 204 virtual void ReturnValue(Value* value) { value_ = value; } | 207 virtual void ReturnValue(Value* value) { value_ = value; } |
| 205 | 208 |
| 206 // Specify a computation as the final result. Adds a Bind instruction to | 209 // Specify a computation as the final result. Adds a Bind instruction to |
| 207 // the graph and returns its temporary value (i.e., set the output | 210 // the graph and returns its temporary value (i.e., set the output |
| 208 // parameters). | 211 // parameters). |
| 209 virtual void ReturnComputation(Computation* computation) { | 212 virtual void ReturnComputation(Computation* computation) { |
| 210 AddInstruction(new BindInstr(temp_index(), computation)); | 213 AddInstruction(new BindInstr(temp_index(), computation)); |
| 211 value_ = new TempVal(AllocateTempIndex()); | 214 value_ = new TempVal(AllocateTempIndex()); |
| 212 } | 215 } |
| 216 |
| 217 virtual void CompiletimeStringInterpolation(const Function& interpol_func, |
| 218 const Array& literals); |
| 213 }; | 219 }; |
| 214 | 220 |
| 215 | 221 |
| 216 // Translate an AstNode to a control-flow graph fragment for both its effects | 222 // Translate an AstNode to a control-flow graph fragment for both its effects |
| 217 // and value as an outgoing argument. Implements a function from an AstNode | 223 // and value as an outgoing argument. Implements a function from an AstNode |
| 218 // and next temporary index to a graph fragment (as in the | 224 // and next temporary index to a graph fragment (as in the |
| 219 // EffectGraphBuilder), an updated temporary index, and an intermediate | 225 // EffectGraphBuilder), an updated temporary index, and an intermediate |
| 220 // language Value. | 226 // language Value. |
| 221 class ArgumentGraphVisitor : public ValueGraphVisitor { | 227 class ArgumentGraphVisitor : public ValueGraphVisitor { |
| 222 public: | 228 public: |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 283 } |
| 278 | 284 |
| 279 // Output parameters. | 285 // Output parameters. |
| 280 TargetEntryInstr** true_successor_address_; | 286 TargetEntryInstr** true_successor_address_; |
| 281 TargetEntryInstr** false_successor_address_; | 287 TargetEntryInstr** false_successor_address_; |
| 282 }; | 288 }; |
| 283 | 289 |
| 284 } // namespace dart | 290 } // namespace dart |
| 285 | 291 |
| 286 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 292 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
| OLD | NEW |