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

Unified Diff: src/compiler/code-generator.cc

Issue 1186273005: Block pretty printing (partial re-revert of 1177123002). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/code-generator.cc
diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc
index 374e6774305dfa437109146a0fec0972ec069172..59d1000113a8929545f77560554e31348fc1ea1e 100644
--- a/src/compiler/code-generator.cc
+++ b/src/compiler/code-generator.cc
@@ -97,12 +97,29 @@ Handle<Code> CodeGenerator::GenerateCode() {
if (FLAG_code_comments) {
// TODO(titzer): these code comments are a giant memory leak.
Vector<char> buffer = Vector<char>::New(200);
- SNPrintF(buffer, "-- B%d start%s%s%s%s --", block->rpo_number().ToInt(),
- block->IsDeferred() ? " (deferred)" : "",
- block->needs_frame() ? "" : " (no frame)",
- block->must_construct_frame() ? " (construct frame)" : "",
- block->must_deconstruct_frame() ? " (deconstruct frame)" : "");
- masm()->RecordComment(buffer.start());
+ char* buffer_start = buffer.start();
+
+ int next = SNPrintF(
+ buffer, "-- B%d start%s%s%s%s", block->rpo_number().ToInt(),
+ block->IsDeferred() ? " (deferred)" : "",
+ block->needs_frame() ? "" : " (no frame)",
+ block->must_construct_frame() ? " (construct frame)" : "",
+ block->must_deconstruct_frame() ? " (deconstruct frame)" : "");
+
+ buffer = buffer.SubVector(next, buffer.length());
+
+ if (block->IsLoopHeader()) {
+ next =
+ SNPrintF(buffer, " (loop up to %d)", block->loop_end().ToInt());
+ buffer = buffer.SubVector(next, buffer.length());
+ }
+ if (block->loop_header().IsValid()) {
+ next =
+ SNPrintF(buffer, " (in loop %d)", block->loop_header().ToInt());
+ buffer = buffer.SubVector(next, buffer.length());
+ }
+ SNPrintF(buffer, " --");
+ masm()->RecordComment(buffer_start);
}
masm()->bind(GetLabel(current_block_));
for (int i = block->code_start(); i < block->code_end(); ++i) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698