From 275891079a2921ac2d7473cc8c459d34ca7303fd Mon Sep 17 00:00:00 2001 From: "svenpanne@chromium.org" Date: Thu, 18 Apr 2013 13:45:19 +0000 Subject: [PATCH] Cleaned up and fixed code comment handling a bit. * Let GCC check the arguments of LCodeGen::Coment. * Fixed a few call sites. * Made basic blocks a little bit more visible in the code output. * Sorted #includes. Review URL: https://codereview.chromium.org/14079007 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14331 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/lithium-codegen-arm.cc | 12 +++++------- src/arm/lithium-codegen-arm.h | 4 +++- src/ia32/lithium-codegen-ia32.cc | 12 +++++------- src/ia32/lithium-codegen-ia32.h | 5 +++-- src/mips/lithium-codegen-mips.cc | 12 +++++------- src/mips/lithium-codegen-mips.h | 7 ++++--- src/x64/lithium-codegen-x64.cc | 12 +++++------- src/x64/lithium-codegen-x64.h | 3 ++- 8 files changed, 32 insertions(+), 35 deletions(-) diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index 01011ef..d2f44b0 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -304,7 +304,7 @@ bool LCodeGen::GenerateDeferredCode() { LDeferredCode* code = deferred_[i]; __ bind(code->entry()); if (NeedsDeferredFrame()) { - Comment(";;; Deferred build frame", + Comment(";;; Deferred build frame @%d: %s.", code->instruction_index(), code->instr()->Mnemonic()); ASSERT(!frame_is_built_); @@ -320,7 +320,7 @@ bool LCodeGen::GenerateDeferredCode() { code->instr()->Mnemonic()); code->Generate(); if (NeedsDeferredFrame()) { - Comment(";;; Deferred destroy frame", + Comment(";;; Deferred destroy frame @%d: %s.", code->instruction_index(), code->instr()->Mnemonic()); ASSERT(frame_is_built_); @@ -1043,11 +1043,9 @@ void LCodeGen::RecordPosition(int position) { void LCodeGen::DoLabel(LLabel* label) { - if (label->is_loop_header()) { - Comment(";;; B%d - LOOP entry", label->block_id()); - } else { - Comment(";;; B%d", label->block_id()); - } + Comment(";;; -------------------- B%d%s --------------------", + label->block_id(), + label->is_loop_header() ? " (loop header)" : ""); __ bind(label->label()); current_block_ = label->block_id(); DoGap(label); diff --git a/src/arm/lithium-codegen-arm.h b/src/arm/lithium-codegen-arm.h index 3e24dae..c55558c 100644 --- a/src/arm/lithium-codegen-arm.h +++ b/src/arm/lithium-codegen-arm.h @@ -29,10 +29,12 @@ #define V8_ARM_LITHIUM_CODEGEN_ARM_H_ #include "arm/lithium-arm.h" + #include "arm/lithium-gap-resolver-arm.h" #include "deoptimizer.h" #include "safepoint-table.h" #include "scopes.h" +#include "v8utils.h" namespace v8 { namespace internal { @@ -211,7 +213,7 @@ class LCodeGen BASE_EMBEDDED { int GetStackSlotCount() const { return chunk()->spill_slot_count(); } void Abort(const char* reason); - void Comment(const char* format, ...); + void FPRINTF_CHECKING Comment(const char* format, ...); void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index bc6f5cb..665c85e 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -467,7 +467,7 @@ bool LCodeGen::GenerateDeferredCode() { LDeferredCode* code = deferred_[i]; __ bind(code->entry()); if (NeedsDeferredFrame()) { - Comment(";;; Deferred build frame", + Comment(";;; Deferred build frame @%d: %s.", code->instruction_index(), code->instr()->Mnemonic()); ASSERT(!frame_is_built_); @@ -484,7 +484,7 @@ bool LCodeGen::GenerateDeferredCode() { code->instr()->Mnemonic()); code->Generate(); if (NeedsDeferredFrame()) { - Comment(";;; Deferred destroy frame", + Comment(";;; Deferred destroy frame @%d: %s.", code->instruction_index(), code->instr()->Mnemonic()); ASSERT(frame_is_built_); @@ -1126,11 +1126,9 @@ void LCodeGen::RecordPosition(int position) { void LCodeGen::DoLabel(LLabel* label) { - if (label->is_loop_header()) { - Comment(";;; B%d - LOOP entry", label->block_id()); - } else { - Comment(";;; B%d", label->block_id()); - } + Comment(";;; -------------------- B%d%s --------------------", + label->block_id(), + label->is_loop_header() ? " (loop header)" : ""); __ bind(label->label()); current_block_ = label->block_id(); DoGap(label); diff --git a/src/ia32/lithium-codegen-ia32.h b/src/ia32/lithium-codegen-ia32.h index 362f091..b268456 100644 --- a/src/ia32/lithium-codegen-ia32.h +++ b/src/ia32/lithium-codegen-ia32.h @@ -32,9 +32,10 @@ #include "checks.h" #include "deoptimizer.h" +#include "ia32/lithium-gap-resolver-ia32.h" #include "safepoint-table.h" #include "scopes.h" -#include "ia32/lithium-gap-resolver-ia32.h" +#include "v8utils.h" namespace v8 { namespace internal { @@ -201,7 +202,7 @@ class LCodeGen BASE_EMBEDDED { int GetStackSlotCount() const { return chunk()->spill_slot_count(); } void Abort(const char* reason); - void Comment(const char* format, ...); + void FPRINTF_CHECKING Comment(const char* format, ...); void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index 59cfcd9..7794931 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -301,7 +301,7 @@ bool LCodeGen::GenerateDeferredCode() { LDeferredCode* code = deferred_[i]; __ bind(code->entry()); if (NeedsDeferredFrame()) { - Comment(";;; Deferred build frame", + Comment(";;; Deferred build frame @%d: %s.", code->instruction_index(), code->instr()->Mnemonic()); ASSERT(!frame_is_built_); @@ -317,7 +317,7 @@ bool LCodeGen::GenerateDeferredCode() { code->instr()->Mnemonic()); code->Generate(); if (NeedsDeferredFrame()) { - Comment(";;; Deferred destroy frame", + Comment(";;; Deferred destroy frame @%d: %s.", code->instruction_index(), code->instr()->Mnemonic()); ASSERT(frame_is_built_); @@ -1024,11 +1024,9 @@ void LCodeGen::RecordPosition(int position) { void LCodeGen::DoLabel(LLabel* label) { - if (label->is_loop_header()) { - Comment(";;; B%d - LOOP entry", label->block_id()); - } else { - Comment(";;; B%d", label->block_id()); - } + Comment(";;; -------------------- B%d%s --------------------", + label->block_id(), + label->is_loop_header() ? " (loop header)" : ""); __ bind(label->label()); current_block_ = label->block_id(); DoGap(label); diff --git a/src/mips/lithium-codegen-mips.h b/src/mips/lithium-codegen-mips.h index a1bc4ba..01d0ffc 100644 --- a/src/mips/lithium-codegen-mips.h +++ b/src/mips/lithium-codegen-mips.h @@ -28,11 +28,12 @@ #ifndef V8_MIPS_LITHIUM_CODEGEN_MIPS_H_ #define V8_MIPS_LITHIUM_CODEGEN_MIPS_H_ -#include "mips/lithium-mips.h" -#include "mips/lithium-gap-resolver-mips.h" #include "deoptimizer.h" +#include "mips/lithium-gap-resolver-mips.h" +#include "mips/lithium-mips.h" #include "safepoint-table.h" #include "scopes.h" +#include "v8utils.h" namespace v8 { namespace internal { @@ -207,7 +208,7 @@ class LCodeGen BASE_EMBEDDED { int GetStackSlotCount() const { return chunk()->spill_slot_count(); } void Abort(const char* reason); - void Comment(const char* format, ...); + void FPRINTF_CHECKING Comment(const char* format, ...); void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index fb5dd59..3e8fd5c 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -370,7 +370,7 @@ bool LCodeGen::GenerateDeferredCode() { LDeferredCode* code = deferred_[i]; __ bind(code->entry()); if (NeedsDeferredFrame()) { - Comment(";;; Deferred build frame", + Comment(";;; Deferred build frame @%d: %s.", code->instruction_index(), code->instr()->Mnemonic()); ASSERT(!frame_is_built_); @@ -387,7 +387,7 @@ bool LCodeGen::GenerateDeferredCode() { code->instr()->Mnemonic()); code->Generate(); if (NeedsDeferredFrame()) { - Comment(";;; Deferred destroy frame", + Comment(";;; Deferred destroy frame @%d: %s.", code->instruction_index(), code->instr()->Mnemonic()); ASSERT(frame_is_built_); @@ -926,11 +926,9 @@ void LCodeGen::RecordPosition(int position) { void LCodeGen::DoLabel(LLabel* label) { - if (label->is_loop_header()) { - Comment(";;; B%d - LOOP entry", label->block_id()); - } else { - Comment(";;; B%d", label->block_id()); - } + Comment(";;; -------------------- B%d%s --------------------", + label->block_id(), + label->is_loop_header() ? " (loop header)" : ""); __ bind(label->label()); current_block_ = label->block_id(); DoGap(label); diff --git a/src/x64/lithium-codegen-x64.h b/src/x64/lithium-codegen-x64.h index e857606..adcc3e5 100644 --- a/src/x64/lithium-codegen-x64.h +++ b/src/x64/lithium-codegen-x64.h @@ -34,6 +34,7 @@ #include "deoptimizer.h" #include "safepoint-table.h" #include "scopes.h" +#include "v8utils.h" #include "x64/lithium-gap-resolver-x64.h" namespace v8 { @@ -172,7 +173,7 @@ class LCodeGen BASE_EMBEDDED { int GetStackSlotCount() const { return chunk()->spill_slot_count(); } void Abort(const char* reason); - void Comment(const char* format, ...); + void FPRINTF_CHECKING Comment(const char* format, ...); void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } -- 2.7.4