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

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

Issue 13910003: Revert "Incrementally recompute dominators when inlining." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph.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 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"
11 #include "vm/intermediate_language.h" 11 #include "vm/intermediate_language.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 class FlowGraph; 15 class FlowGraph;
16 class Instruction; 16 class Instruction;
17 class ParsedFunction; 17 class ParsedFunction;
18 18
19 // An InliningContext collects the exits from an inlined function during 19 // An InliningContext collects the exits from an inlined function during
20 // graph construction so they can be plugged into the caller's flow graph. 20 // graph construction so they can be plugged into the caller's flow graph.
21 class InliningContext: public ValueObject { 21 class InliningContext: public ValueObject {
22 public: 22 public:
23 InliningContext(FlowGraph* caller_graph, Definition* call) 23 InliningContext() : exits_(4) { }
24 : caller_graph_(caller_graph), call_(call), exits_(4) { }
25 24
26 void AddExit(ReturnInstr* exit); 25 void AddExit(ReturnInstr* exit);
27 26
28 // Inline a flow graph at a call site. 27 // Inline a flow graph at a call site.
29 // 28 //
30 // Assumes the callee graph was computed by BuildGraph with an inlining 29 // Assumes the callee graph was computed by BuildGraph with an inlining
31 // context and transformed to SSA with ComputeSSA with a correct virtual 30 // context and transformed to SSA with ComputeSSA with a correct virtual
32 // register number, and that the use lists have been correctly computed. 31 // register number, and that the use lists have been correctly computed.
33 // 32 //
34 // After inlining the caller graph will have correctly adjusted the use 33 // After inlining the caller graph will correctly have adjusted the
35 // lists. The block orders will need to be recomputed, and the dominator 34 // pre/post orders, the dominator tree and the use lists.
36 // tree will need to be recomputed if it is marked invalid in the caller 35 void ReplaceCall(FlowGraph* caller_graph,
37 // graph. 36 Definition* call,
38 void ReplaceCall(FlowGraph* callee_graph); 37 FlowGraph* callee_graph);
39 38
40 private: 39 private:
41 struct Data { 40 struct Data {
42 BlockEntryInstr* exit_block; 41 BlockEntryInstr* exit_block;
43 ReturnInstr* exit_return; 42 ReturnInstr* exit_return;
44 }; 43 };
45 44
46 void PrepareGraphs(FlowGraph* caller_graph); 45 static void PrepareGraphs(FlowGraph* caller_graph,
46 Definition* call,
47 FlowGraph* callee_graph);
47 48
48 BlockEntryInstr* ExitBlockAt(intptr_t i) const { 49 BlockEntryInstr* ExitBlockAt(intptr_t i) const {
49 ASSERT(exits_[i].exit_block != NULL); 50 ASSERT(exits_[i].exit_block != NULL);
50 return exits_[i].exit_block; 51 return exits_[i].exit_block;
51 } 52 }
52 Instruction* LastInstructionAt(intptr_t i) const { 53 Instruction* LastInstructionAt(intptr_t i) const {
53 return exits_[i].exit_return->previous(); 54 return exits_[i].exit_return->previous();
54 } 55 }
55 Value* ValueAt(intptr_t i) const { 56 Value* ValueAt(intptr_t i) const {
56 return exits_[i].exit_return->value(); 57 return exits_[i].exit_return->value();
57 } 58 }
58 59
59 static int LowestBlockIdFirst(const Data* a, const Data* b); 60 static int LowestBlockIdFirst(const Data* a, const Data* b);
60 void SortExits(); 61 void SortExits();
61 62
62 Definition* JoinReturns(BlockEntryInstr** exit_block,
63 Instruction** last_instruction);
64
65 FlowGraph* caller_graph_;
66 Definition* call_;
67 GrowableArray<Data> exits_; 63 GrowableArray<Data> exits_;
68 }; 64 };
69 65
70 66
71 // Build a flow graph from a parsed function's AST. 67 // Build a flow graph from a parsed function's AST.
72 class FlowGraphBuilder: public ValueObject { 68 class FlowGraphBuilder: public ValueObject {
73 public: 69 public:
74 // The inlining context is NULL if not inlining. 70 // The inlining context is NULL if not inlining.
75 FlowGraphBuilder(const ParsedFunction& parsed_function, 71 FlowGraphBuilder(const ParsedFunction& parsed_function,
76 InliningContext* inlining_context); 72 InliningContext* inlining_context);
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 // Output parameters. 447 // Output parameters.
452 GrowableArray<TargetEntryInstr**> true_successor_addresses_; 448 GrowableArray<TargetEntryInstr**> true_successor_addresses_;
453 GrowableArray<TargetEntryInstr**> false_successor_addresses_; 449 GrowableArray<TargetEntryInstr**> false_successor_addresses_;
454 450
455 intptr_t condition_token_pos_; 451 intptr_t condition_token_pos_;
456 }; 452 };
457 453
458 } // namespace dart 454 } // namespace dart
459 455
460 #endif // VM_FLOW_GRAPH_BUILDER_H_ 456 #endif // VM_FLOW_GRAPH_BUILDER_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph.cc ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698