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

Unified Diff: runtime/vm/flow_graph_compiler.cc

Issue 515913003: Add loop printing to block comments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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 | « runtime/vm/flow_graph.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler.cc
===================================================================
--- runtime/vm/flow_graph_compiler.cc (revision 39664)
+++ runtime/vm/flow_graph_compiler.cc (working copy)
@@ -6,6 +6,7 @@
#include "vm/flow_graph_compiler.h"
+#include "vm/bit_vector.h"
#include "vm/cha.h"
#include "vm/dart_entry.h"
#include "vm/debugger.h"
@@ -313,8 +314,32 @@
}
+static void LoopInfoComment(
+ Assembler* assembler,
+ const BlockEntryInstr& block,
+ const ZoneGrowableArray<BlockEntryInstr*>& loop_headers) {
+ if (Assembler::EmittingComments()) {
+ for (intptr_t loop_id = 0; loop_id < loop_headers.length(); ++loop_id) {
+ for (BitVector::Iterator loop_it(loop_headers[loop_id]->loop_info());
+ !loop_it.Done();
+ loop_it.Advance()) {
+ if (loop_it.Current() == block.preorder_number()) {
+ assembler->Comment(" Loop %" Pd "", loop_id);
+ }
+ }
+ }
+ }
+}
+
+
void FlowGraphCompiler::VisitBlocks() {
CompactBlocks();
+ const ZoneGrowableArray<BlockEntryInstr*>* loop_headers = NULL;
+ if (Assembler::EmittingComments()) {
+ // 'loop_headers' were cleared, recompute.
+ loop_headers = flow_graph().ComputeLoops();
+ ASSERT(loop_headers != NULL);
+ }
for (intptr_t i = 0; i < block_order().length(); ++i) {
// Compile the block entry.
@@ -326,6 +351,8 @@
continue;
}
+ LoopInfoComment(assembler(), *entry, *loop_headers);
+
entry->EmitNativeCode(this);
// Compile all successors until an exit, branch, or a block entry.
for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
« no previous file with comments | « runtime/vm/flow_graph.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698