| 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 "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
| 10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 124 } |
| 125 | 125 |
| 126 static int LowestBlockIdFirst(const Data* a, const Data* b); | 126 static int LowestBlockIdFirst(const Data* a, const Data* b); |
| 127 void SortExits(); | 127 void SortExits(); |
| 128 | 128 |
| 129 Definition* JoinReturns(BlockEntryInstr** exit_block, | 129 Definition* JoinReturns(BlockEntryInstr** exit_block, |
| 130 Instruction** last_instruction, | 130 Instruction** last_instruction, |
| 131 intptr_t try_index); | 131 intptr_t try_index); |
| 132 | 132 |
| 133 Isolate* isolate() const { return caller_graph_->isolate(); } | 133 Isolate* isolate() const { return caller_graph_->isolate(); } |
| 134 Zone* zone() const { return caller_graph_->zone(); } |
| 134 | 135 |
| 135 FlowGraph* caller_graph_; | 136 FlowGraph* caller_graph_; |
| 136 Definition* call_; | 137 Definition* call_; |
| 137 GrowableArray<Data> exits_; | 138 GrowableArray<Data> exits_; |
| 138 }; | 139 }; |
| 139 | 140 |
| 140 | 141 |
| 141 // Build a flow graph from a parsed function's AST. | 142 // Build a flow graph from a parsed function's AST. |
| 142 class FlowGraphBuilder : public ValueObject { | 143 class FlowGraphBuilder : public ValueObject { |
| 143 public: | 144 public: |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 NestedStatement* nesting_stack() const { return nesting_stack_; } | 224 NestedStatement* nesting_stack() const { return nesting_stack_; } |
| 224 | 225 |
| 225 // When compiling for OSR, remove blocks that are not reachable from the | 226 // When compiling for OSR, remove blocks that are not reachable from the |
| 226 // OSR entry point. | 227 // OSR entry point. |
| 227 void PruneUnreachable(); | 228 void PruneUnreachable(); |
| 228 | 229 |
| 229 // Returns address where the constant 'value' is stored or 0 if not found. | 230 // Returns address where the constant 'value' is stored or 0 if not found. |
| 230 static uword FindDoubleConstant(double value); | 231 static uword FindDoubleConstant(double value); |
| 231 | 232 |
| 232 Isolate* isolate() const { return parsed_function().isolate(); } | 233 Isolate* isolate() const { return parsed_function().isolate(); } |
| 234 Zone* zone() const { return parsed_function().zone(); } |
| 233 | 235 |
| 234 private: | 236 private: |
| 235 friend class NestedStatement; // Explicit access to nesting_stack_. | 237 friend class NestedStatement; // Explicit access to nesting_stack_. |
| 236 friend class Intrinsifier; | 238 friend class Intrinsifier; |
| 237 | 239 |
| 238 intptr_t parameter_count() const { | 240 intptr_t parameter_count() const { |
| 239 return num_copied_params_ + num_non_copied_params_; | 241 return num_copied_params_ + num_non_copied_params_; |
| 240 } | 242 } |
| 241 intptr_t variable_count() const { | 243 intptr_t variable_count() const { |
| 242 return parameter_count() + num_stack_locals_; | 244 return parameter_count() + num_stack_locals_; |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 JoinEntryInstr* target); | 475 JoinEntryInstr* target); |
| 474 | 476 |
| 475 void BuildAsyncJump(LocalVariable* old_context, | 477 void BuildAsyncJump(LocalVariable* old_context, |
| 476 LocalVariable* continuation_result, | 478 LocalVariable* continuation_result, |
| 477 LocalVariable* continuation_error, | 479 LocalVariable* continuation_error, |
| 478 LocalVariable* continuation_stack_trace, | 480 LocalVariable* continuation_stack_trace, |
| 479 const intptr_t old_ctx_level, | 481 const intptr_t old_ctx_level, |
| 480 JoinEntryInstr* target); | 482 JoinEntryInstr* target); |
| 481 | 483 |
| 482 Isolate* isolate() const { return owner()->isolate(); } | 484 Isolate* isolate() const { return owner()->isolate(); } |
| 485 Zone* zone() const { return owner()->zone(); } |
| 483 | 486 |
| 484 private: | 487 private: |
| 485 friend class TempLocalScope; // For ReturnDefinition. | 488 friend class TempLocalScope; // For ReturnDefinition. |
| 486 | 489 |
| 487 // Helper to drop the result value. | 490 // Helper to drop the result value. |
| 488 virtual void ReturnValue(Value* value) { | 491 virtual void ReturnValue(Value* value) { |
| 489 Do(new DropTempsInstr(0, value)); | 492 Do(new DropTempsInstr(0, value)); |
| 490 } | 493 } |
| 491 | 494 |
| 492 // Specify a definition of the final result. Adds the definition to | 495 // Specify a definition of the final result. Adds the definition to |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 // Output parameters. | 613 // Output parameters. |
| 611 GrowableArray<TargetEntryInstr**> true_successor_addresses_; | 614 GrowableArray<TargetEntryInstr**> true_successor_addresses_; |
| 612 GrowableArray<TargetEntryInstr**> false_successor_addresses_; | 615 GrowableArray<TargetEntryInstr**> false_successor_addresses_; |
| 613 | 616 |
| 614 intptr_t condition_token_pos_; | 617 intptr_t condition_token_pos_; |
| 615 }; | 618 }; |
| 616 | 619 |
| 617 } // namespace dart | 620 } // namespace dart |
| 618 | 621 |
| 619 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 622 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
| OLD | NEW |