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

Unified Diff: runtime/vm/compiler.cc

Issue 9719003: Compute preorder as well as postorder basic block orderings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.h » ('j') | runtime/vm/flow_graph_builder.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/compiler.cc
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
index 42c568a3db2e8b0fc8a2c417834d27145dbf610e..56ca014df6b78b4d49d15e8e23153ce20de7bf42 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -142,9 +142,16 @@ static RawError* CompileFunctionHelper(const Function& function,
graph_builder.BuildGraph();
Assembler assembler;
- FlowGraphCompiler graph_compiler(&assembler,
- parsed_function,
- graph_builder.blocks());
+ // The non-optimizing compiler compiles blocks in reverse postorder,
+ // because it is a 'natural' order for the human reader of the
+ // generated code.
+ intptr_t length = graph_builder.postorder_block_entries().length();
+ GrowableArray<BlockEntryInstr*> block_order(length);
+ for (intptr_t i = length - 1; i >= 0; --i) {
+ block_order.Add(graph_builder.postorder_block_entries()[i]);
+ }
+ FlowGraphCompiler graph_compiler(&assembler, parsed_function,
+ block_order);
graph_compiler.CompileGraph();
const Code& code =
Code::Handle(Code::FinalizeCode(function_fullname, &assembler));
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.h » ('j') | runtime/vm/flow_graph_builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698