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

Unified Diff: src/compiler/jump-threading.cc

Issue 1014853002: [turbofan] Clean up TRACE macros and use variadic macros. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « src/compiler/js-inlining.cc ('k') | src/compiler/scheduler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/jump-threading.cc
diff --git a/src/compiler/jump-threading.cc b/src/compiler/jump-threading.cc
index 780e6300158d6a3a0b06dde7ad7a52b94a788718..e5b4595960d4ec2db1086ebe6d715f876335087d 100644
--- a/src/compiler/jump-threading.cc
+++ b/src/compiler/jump-threading.cc
@@ -9,8 +9,10 @@ namespace v8 {
namespace internal {
namespace compiler {
-#define TRACE(x) \
- if (FLAG_trace_turbo_jt) PrintF x
+#define TRACE(...) \
+ do { \
+ if (FLAG_trace_turbo_jt) PrintF(__VA_ARGS__); \
+ } while (false)
struct JumpThreadingState {
bool forwarded;
@@ -29,19 +31,19 @@ struct JumpThreadingState {
RpoNumber to_to = result[to.ToInt()];
bool pop = true;
if (to == from) {
- TRACE((" xx %d\n", from.ToInt()));
+ TRACE(" xx %d\n", from.ToInt());
result[from.ToInt()] = from;
} else if (to_to == unvisited()) {
- TRACE((" fw %d -> %d (recurse)\n", from.ToInt(), to.ToInt()));
+ TRACE(" fw %d -> %d (recurse)\n", from.ToInt(), to.ToInt());
stack.push(to);
result[to.ToInt()] = onstack();
pop = false; // recurse.
} else if (to_to == onstack()) {
- TRACE((" fw %d -> %d (cycle)\n", from.ToInt(), to.ToInt()));
+ TRACE(" fw %d -> %d (cycle)\n", from.ToInt(), to.ToInt());
result[from.ToInt()] = to; // break the cycle.
forwarded = true;
} else {
- TRACE((" fw %d -> %d (forward)\n", from.ToInt(), to.ToInt()));
+ TRACE(" fw %d -> %d (forward)\n", from.ToInt(), to.ToInt());
result[from.ToInt()] = to_to; // forward the block.
forwarded = true;
}
@@ -68,36 +70,36 @@ bool JumpThreading::ComputeForwarding(Zone* local_zone,
while (!state.stack.empty()) {
InstructionBlock* block = code->InstructionBlockAt(state.stack.top());
// Process the instructions in a block up to a non-empty instruction.
- TRACE(("jt [%d] B%d\n", static_cast<int>(stack.size()),
- block->rpo_number().ToInt()));
+ TRACE("jt [%d] B%d\n", static_cast<int>(stack.size()),
+ block->rpo_number().ToInt());
bool fallthru = true;
RpoNumber fw = block->rpo_number();
for (int i = block->code_start(); i < block->code_end(); ++i) {
Instruction* instr = code->InstructionAt(i);
if (instr->IsGapMoves() && GapInstruction::cast(instr)->IsRedundant()) {
// skip redundant gap moves.
- TRACE((" nop gap\n"));
+ TRACE(" nop gap\n");
continue;
} else if (instr->IsSourcePosition()) {
// skip source positions.
- TRACE((" src pos\n"));
+ TRACE(" src pos\n");
continue;
} else if (FlagsModeField::decode(instr->opcode()) != kFlags_none) {
// can't skip instructions with flags continuations.
- TRACE((" flags\n"));
+ TRACE(" flags\n");
fallthru = false;
} else if (instr->IsNop()) {
// skip nops.
- TRACE((" nop\n"));
+ TRACE(" nop\n");
continue;
} else if (instr->arch_opcode() == kArchJmp) {
// try to forward the jump instruction.
- TRACE((" jmp\n"));
+ TRACE(" jmp\n");
fw = code->InputRpo(instr, 0);
fallthru = false;
} else {
// can't skip other instructions.
- TRACE((" other\n"));
+ TRACE(" other\n");
fallthru = false;
}
break;
@@ -118,12 +120,12 @@ bool JumpThreading::ComputeForwarding(Zone* local_zone,
if (FLAG_trace_turbo_jt) {
for (int i = 0; i < static_cast<int>(result.size()); i++) {
- TRACE(("B%d ", i));
+ TRACE("B%d ", i);
int to = result[i].ToInt();
if (i != to) {
- TRACE(("-> B%d\n", to));
+ TRACE("-> B%d\n", to);
} else {
- TRACE(("\n"));
+ TRACE("\n");
}
}
}
@@ -153,7 +155,7 @@ void JumpThreading::ApplyForwarding(ZoneVector<RpoNumber>& result,
} else if (instr->arch_opcode() == kArchJmp) {
if (skip[block_num]) {
// Overwrite a redundant jump with a nop.
- TRACE(("jt-fw nop @%d\n", i));
+ TRACE("jt-fw nop @%d\n", i);
instr->OverwriteWithNop();
}
fallthru = false; // jumps don't fall through to the next block.
« no previous file with comments | « src/compiler/js-inlining.cc ('k') | src/compiler/scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698