Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: runtime/vm/flow_graph_builder.h

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/flow_graph_allocator.cc ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 RUNTIME_VM_FLOW_GRAPH_BUILDER_H_ 5 #ifndef RUNTIME_VM_FLOW_GRAPH_BUILDER_H_
6 #define RUNTIME_VM_FLOW_GRAPH_BUILDER_H_ 6 #define RUNTIME_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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 intptr_t try_index); 83 intptr_t try_index);
84 84
85 Isolate* isolate() const { return caller_graph_->isolate(); } 85 Isolate* isolate() const { return caller_graph_->isolate(); }
86 Zone* zone() const { return caller_graph_->zone(); } 86 Zone* zone() const { return caller_graph_->zone(); }
87 87
88 FlowGraph* caller_graph_; 88 FlowGraph* caller_graph_;
89 Definition* call_; 89 Definition* call_;
90 GrowableArray<Data> exits_; 90 GrowableArray<Data> exits_;
91 }; 91 };
92 92
93
94 // Build a flow graph from a parsed function's AST. 93 // Build a flow graph from a parsed function's AST.
95 class FlowGraphBuilder : public ValueObject { 94 class FlowGraphBuilder : public ValueObject {
96 public: 95 public:
97 // The inlining context is NULL if not inlining. The osr_id is the deopt 96 // The inlining context is NULL if not inlining. The osr_id is the deopt
98 // id of the OSR entry or Compiler::kNoOSRDeoptId if not compiling for OSR. 97 // id of the OSR entry or Compiler::kNoOSRDeoptId if not compiling for OSR.
99 FlowGraphBuilder(const ParsedFunction& parsed_function, 98 FlowGraphBuilder(const ParsedFunction& parsed_function,
100 const ZoneGrowableArray<const ICData*>& ic_data_array, 99 const ZoneGrowableArray<const ICData*>& ic_data_array,
101 ZoneGrowableArray<intptr_t>* context_level_array, 100 ZoneGrowableArray<intptr_t>* context_level_array,
102 InlineExitCollector* exit_collector, 101 InlineExitCollector* exit_collector,
103 intptr_t osr_id); 102 intptr_t osr_id);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // for OSR. 222 // for OSR.
224 const intptr_t osr_id_; 223 const intptr_t osr_id_;
225 224
226 intptr_t jump_count_; 225 intptr_t jump_count_;
227 ZoneGrowableArray<JoinEntryInstr*>* await_joins_; 226 ZoneGrowableArray<JoinEntryInstr*>* await_joins_;
228 ZoneGrowableArray<TokenPosition>* await_token_positions_; 227 ZoneGrowableArray<TokenPosition>* await_token_positions_;
229 228
230 DISALLOW_IMPLICIT_CONSTRUCTORS(FlowGraphBuilder); 229 DISALLOW_IMPLICIT_CONSTRUCTORS(FlowGraphBuilder);
231 }; 230 };
232 231
233
234 // Translate an AstNode to a control-flow graph fragment for its effects 232 // Translate an AstNode to a control-flow graph fragment for its effects
235 // (e.g., a statement or an expression in an effect context). Implements a 233 // (e.g., a statement or an expression in an effect context). Implements a
236 // function from an AstNode and next temporary index to a graph fragment 234 // function from an AstNode and next temporary index to a graph fragment
237 // with a single entry and at most one exit. The fragment is represented by 235 // with a single entry and at most one exit. The fragment is represented by
238 // an (entry, exit) pair of Instruction pointers: 236 // an (entry, exit) pair of Instruction pointers:
239 // 237 //
240 // - (NULL, NULL): an empty and open graph fragment 238 // - (NULL, NULL): an empty and open graph fragment
241 // - (i0, NULL): a closed graph fragment which has only non-local exits 239 // - (i0, NULL): a closed graph fragment which has only non-local exits
242 // - (i0, i1): an open graph fragment 240 // - (i0, i1): an open graph fragment
243 class EffectGraphVisitor : public AstNodeVisitor { 241 class EffectGraphVisitor : public AstNodeVisitor {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 } 459 }
462 460
463 // Shared global state. 461 // Shared global state.
464 FlowGraphBuilder* owner_; 462 FlowGraphBuilder* owner_;
465 463
466 // Output parameters. 464 // Output parameters.
467 Instruction* entry_; 465 Instruction* entry_;
468 Instruction* exit_; 466 Instruction* exit_;
469 }; 467 };
470 468
471
472 // Translate an AstNode to a control-flow graph fragment for both its effects 469 // Translate an AstNode to a control-flow graph fragment for both its effects
473 // and value (e.g., for an expression in a value context). Implements a 470 // and value (e.g., for an expression in a value context). Implements a
474 // function from an AstNode and next temporary index to a graph fragment (as 471 // function from an AstNode and next temporary index to a graph fragment (as
475 // in the EffectGraphVisitor), a next temporary index, and an intermediate 472 // in the EffectGraphVisitor), a next temporary index, and an intermediate
476 // language Value. 473 // language Value.
477 class ValueGraphVisitor : public EffectGraphVisitor { 474 class ValueGraphVisitor : public EffectGraphVisitor {
478 public: 475 public:
479 explicit ValueGraphVisitor(FlowGraphBuilder* owner) 476 explicit ValueGraphVisitor(FlowGraphBuilder* owner)
480 : EffectGraphVisitor(owner), value_(NULL) {} 477 : EffectGraphVisitor(owner), value_(NULL) {}
481 478
(...skipping 25 matching lines...) Expand all
507 virtual void ReturnValue(Value* value) { value_ = value; } 504 virtual void ReturnValue(Value* value) { value_ = value; }
508 505
509 // Specify a definition of the final result. Adds the definition to 506 // Specify a definition of the final result. Adds the definition to
510 // the graph and returns a use of it (i.e., set the visitor's output 507 // the graph and returns a use of it (i.e., set the visitor's output
511 // parameters). 508 // parameters).
512 virtual void ReturnDefinition(Definition* definition) { 509 virtual void ReturnDefinition(Definition* definition) {
513 ReturnValue(Bind(definition)); 510 ReturnValue(Bind(definition));
514 } 511 }
515 }; 512 };
516 513
517
518 // Translate an AstNode to a control-flow graph fragment for both its 514 // Translate an AstNode to a control-flow graph fragment for both its
519 // effects and true/false control flow (e.g., for an expression in a test 515 // effects and true/false control flow (e.g., for an expression in a test
520 // context). The resulting graph is always closed (even if it is empty) 516 // context). The resulting graph is always closed (even if it is empty)
521 // Successor control flow is explicitly set by a pair of pointers to 517 // Successor control flow is explicitly set by a pair of pointers to
522 // TargetEntryInstr*. 518 // TargetEntryInstr*.
523 // 519 //
524 // To distinguish between the graphs with only nonlocal exits and graphs 520 // To distinguish between the graphs with only nonlocal exits and graphs
525 // with both true and false exits, there are a pair of TargetEntryInstr**: 521 // with both true and false exits, there are a pair of TargetEntryInstr**:
526 // 522 //
527 // - Both NULL: only non-local exits, truly closed 523 // - Both NULL: only non-local exits, truly closed
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 // Output parameters. 567 // Output parameters.
572 GrowableArray<TargetEntryInstr**> true_successor_addresses_; 568 GrowableArray<TargetEntryInstr**> true_successor_addresses_;
573 GrowableArray<TargetEntryInstr**> false_successor_addresses_; 569 GrowableArray<TargetEntryInstr**> false_successor_addresses_;
574 570
575 TokenPosition condition_token_pos_; 571 TokenPosition condition_token_pos_;
576 }; 572 };
577 573
578 } // namespace dart 574 } // namespace dart
579 575
580 #endif // RUNTIME_VM_FLOW_GRAPH_BUILDER_H_ 576 #endif // RUNTIME_VM_FLOW_GRAPH_BUILDER_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_allocator.cc ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698