Index: src/mips/lithium-codegen-mips.cc |
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc |
index bf227a2f9158f6d433e418d2241c2d7cad464d04..9ae5132cf3bb8140c5b8108fb366298e2819e9cb 100644 |
--- a/src/mips/lithium-codegen-mips.cc |
+++ b/src/mips/lithium-codegen-mips.cc |
@@ -257,38 +257,21 @@ bool LCodeGen::GenerateBody() { |
!is_aborted() && current_instruction_ < instructions_->length(); |
current_instruction_++) { |
LInstruction* instr = instructions_->at(current_instruction_); |
+ |
+ // Don't emit code for basic blocks with a replacement. |
if (instr->IsLabel()) { |
- LLabel* label = LLabel::cast(instr); |
- emit_instructions = !label->HasReplacement(); |
+ emit_instructions = !LLabel::cast(instr)->HasReplacement(); |
} |
+ if (!emit_instructions) continue; |
- if (emit_instructions) { |
- if (FLAG_code_comments) { |
- HValue* hydrogen = instr->hydrogen_value(); |
- if (hydrogen != NULL) { |
- if (hydrogen->IsChange()) { |
- HValue* changed_value = HChange::cast(hydrogen)->value(); |
- int use_id = 0; |
- const char* use_mnemo = "dead"; |
- if (hydrogen->UseCount() >= 1) { |
- HValue* use_value = hydrogen->uses().value(); |
- use_id = use_value->id(); |
- use_mnemo = use_value->Mnemonic(); |
- } |
- Comment(";;; @%d: %s. <of #%d %s for #%d %s>", |
- current_instruction_, instr->Mnemonic(), |
- changed_value->id(), changed_value->Mnemonic(), |
- use_id, use_mnemo); |
- } else { |
- Comment(";;; @%d: %s. <#%d>", current_instruction_, |
- instr->Mnemonic(), hydrogen->id()); |
- } |
- } else { |
- Comment(";;; @%d: %s.", current_instruction_, instr->Mnemonic()); |
- } |
- } |
- instr->CompileToNative(this); |
+ if (FLAG_code_comments && instr->HasInterestingComment(this)) { |
+ Comment(";;; <@%d,#%d> %s", |
+ current_instruction_, |
+ instr->hydrogen_value()->id(), |
+ instr->Mnemonic()); |
} |
+ |
+ instr->CompileToNative(this); |
} |
return !is_aborted(); |
} |
@@ -299,11 +282,14 @@ bool LCodeGen::GenerateDeferredCode() { |
if (deferred_.length() > 0) { |
for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { |
LDeferredCode* code = deferred_[i]; |
+ Comment(";;; <@%d,#%d> " |
+ "-------------------- Deferred %s --------------------", |
+ code->instruction_index(), |
+ code->instr()->hydrogen_value()->id(), |
+ code->instr()->Mnemonic()); |
__ bind(code->entry()); |
if (NeedsDeferredFrame()) { |
- Comment(";;; Deferred build frame @%d: %s.", |
- code->instruction_index(), |
- code->instr()->Mnemonic()); |
+ Comment(";;; Build frame"); |
ASSERT(!frame_is_built_); |
ASSERT(info()->IsStub()); |
frame_is_built_ = true; |
@@ -311,15 +297,11 @@ bool LCodeGen::GenerateDeferredCode() { |
__ li(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); |
__ push(scratch0()); |
__ Addu(fp, sp, Operand(2 * kPointerSize)); |
+ Comment(";;; Deferred code"); |
} |
- Comment(";;; Deferred code @%d: %s.", |
- code->instruction_index(), |
- code->instr()->Mnemonic()); |
code->Generate(); |
if (NeedsDeferredFrame()) { |
- Comment(";;; Deferred destroy frame @%d: %s.", |
- code->instruction_index(), |
- code->instr()->Mnemonic()); |
+ Comment(";;; Destroy frame"); |
ASSERT(frame_is_built_); |
__ pop(at); |
__ MultiPop(cp.bit() | fp.bit() | ra.bit()); |
@@ -346,8 +328,10 @@ bool LCodeGen::GenerateDeoptJumpTable() { |
Abort("Generated code is too large"); |
} |
+ if (deopt_jump_table_.length() > 0) { |
+ Comment(";;; -------------------- Jump table --------------------"); |
+ } |
Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); |
- __ RecordComment("[ Deoptimization jump table"); |
Label table_start; |
__ bind(&table_start); |
Label needs_frame_not_call; |
@@ -1023,10 +1007,19 @@ void LCodeGen::RecordPosition(int position) { |
} |
+static const char* LabelType(LLabel* label) { |
+ if (label->is_loop_header()) return " (loop header)"; |
+ if (label->is_osr_entry()) return " (OSR entry)"; |
+ return ""; |
+} |
+ |
+ |
void LCodeGen::DoLabel(LLabel* label) { |
- Comment(";;; -------------------- B%d%s --------------------", |
+ Comment(";;; <@%d,#%d> -------------------- B%d%s --------------------", |
+ current_instruction_, |
+ label->hydrogen_value()->id(), |
label->block_id(), |
- label->is_loop_header() ? " (loop header)" : ""); |
+ LabelType(label)); |
__ bind(label->label()); |
current_block_ = label->block_id(); |
DoGap(label); |
@@ -1756,7 +1749,7 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) { |
} |
-int LCodeGen::GetNextEmittedBlock() { |
+int LCodeGen::GetNextEmittedBlock() const { |
for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { |
if (!chunk_->GetLabel(i)->HasReplacement()) return i; |
} |
@@ -1915,9 +1908,8 @@ void LCodeGen::DoBranch(LBranch* instr) { |
void LCodeGen::EmitGoto(int block) { |
- int destination = chunk_->LookupDestination(block); |
- if (destination != GetNextEmittedBlock()) { |
- __ jmp(chunk_->GetAssemblyLabel(destination)); |
+ if (!IsNextEmittedBlock(block)) { |
+ __ jmp(chunk_->GetAssemblyLabel(chunk_->LookupDestination(block))); |
} |
} |