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

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

Issue 617933003: Iterative graph traversal in FlowGraph::DiscoverBlocks() (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_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/handles_impl.h" 11 #include "vm/handles_impl.h"
12 #include "vm/locations.h" 12 #include "vm/locations.h"
13 #include "vm/method_recognizer.h" 13 #include "vm/method_recognizer.h"
14 #include "vm/object.h" 14 #include "vm/object.h"
15 #include "vm/parser.h" 15 #include "vm/parser.h"
16 16
17 namespace dart { 17 namespace dart {
18 18
19 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); 19 DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
20 20
21 class BitVector; 21 class BitVector;
22 class BlockEntryInstr; 22 class BlockEntryInstr;
23 class BlockEntryEdge;
23 class BoxIntNInstr; 24 class BoxIntNInstr;
24 class BufferFormatter; 25 class BufferFormatter;
25 class CatchBlockEntryInstr; 26 class CatchBlockEntryInstr;
26 class ComparisonInstr; 27 class ComparisonInstr;
27 class Definition; 28 class Definition;
28 class Environment; 29 class Environment;
29 class FlowGraph; 30 class FlowGraph;
30 class FlowGraphBuilder; 31 class FlowGraphBuilder;
31 class FlowGraphCompiler; 32 class FlowGraphCompiler;
32 class FlowGraphVisitor; 33 class FlowGraphVisitor;
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 return parallel_move_ != NULL; 1131 return parallel_move_ != NULL;
1131 } 1132 }
1132 1133
1133 ParallelMoveInstr* GetParallelMove() { 1134 ParallelMoveInstr* GetParallelMove() {
1134 if (parallel_move_ == NULL) { 1135 if (parallel_move_ == NULL) {
1135 parallel_move_ = new ParallelMoveInstr(); 1136 parallel_move_ = new ParallelMoveInstr();
1136 } 1137 }
1137 return parallel_move_; 1138 return parallel_move_;
1138 } 1139 }
1139 1140
1140 // Discover basic-block structure by performing a recursive depth first 1141 // Discover basic-block structure by performing an iterative depth first
1141 // traversal of the instruction graph reachable from this instruction. As 1142 // traversal of the instruction graph reachable from this instruction. As
1142 // a side effect, the block entry instructions in the graph are assigned 1143 // a side effect, the block entry instructions in the graph are assigned
1143 // numbers in both preorder and postorder. The array 'preorder' maps 1144 // preorder numbers. The array 'preorder' maps preorder block numbers to
1144 // preorder block numbers to the block entry instruction with that number 1145 // the block entry instruction with that number. The depth first spanning
1145 // and analogously for the array 'postorder'. The depth first spanning
1146 // tree is recorded in the array 'parent', which maps preorder block 1146 // tree is recorded in the array 'parent', which maps preorder block
1147 // numbers to the preorder number of the block's spanning-tree parent. 1147 // numbers to the preorder number of the block's spanning-tree parent.
1148 // The array 'assigned_vars' maps preorder block numbers to the set of 1148 // The array 'assigned_vars' maps preorder block numbers to the set of
1149 // assigned frame-allocated local variables in the block. As a side 1149 // assigned frame-allocated local variables in the block. As a side
1150 // effect of this function, the set of basic block predecessors (e.g., 1150 // effect of this function, the set of basic block predecessors (e.g.,
1151 // block entry instructions of predecessor blocks) and also the last 1151 // block entry instructions of predecessor blocks) and also the last
1152 // instruction in the block is recorded in each entry instruction. 1152 // instruction in the block is recorded in each entry instruction.
1153 void DiscoverBlocks( 1153 void DiscoverBlocks(
1154 BlockEntryInstr* predecessor, 1154 BlockEntryInstr* predecessor,
1155 GrowableArray<BlockEntryInstr*>* preorder, 1155 GrowableArray<BlockEntryInstr*>* preorder,
1156 GrowableArray<BlockEntryInstr*>* postorder,
1157 GrowableArray<intptr_t>* parent, 1156 GrowableArray<intptr_t>* parent,
1158 intptr_t variable_count, 1157 GrowableArray<BlockEntryEdge>* block_stack);
1159 intptr_t fixed_parameter_count);
1160 1158
1161 // Perform a depth first search to prune code not reachable from an OSR 1159 // Perform a depth first search to prune code not reachable from an OSR
1162 // entry point. 1160 // entry point.
1163 bool PruneUnreachable(FlowGraphBuilder* builder, 1161 bool PruneUnreachable(FlowGraphBuilder* builder,
1164 GraphEntryInstr* graph_entry, 1162 GraphEntryInstr* graph_entry,
1165 Instruction* parent, 1163 Instruction* parent,
1166 intptr_t osr_id, 1164 intptr_t osr_id,
1167 BitVector* block_marks); 1165 BitVector* block_marks);
1168 1166
1169 virtual intptr_t InputCount() const { return 0; } 1167 virtual intptr_t InputCount() const { return 0; }
(...skipping 7241 matching lines...) Expand 10 before | Expand all | Expand 10 after
8411 Isolate* isolate, bool opt) const { \ 8409 Isolate* isolate, bool opt) const { \
8412 UNIMPLEMENTED(); \ 8410 UNIMPLEMENTED(); \
8413 return NULL; \ 8411 return NULL; \
8414 } \ 8412 } \
8415 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 8413 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8416 8414
8417 8415
8418 } // namespace dart 8416 } // namespace dart
8419 8417
8420 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 8418 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698