From cebe41bd233db774a75de6de9d36e1c3cce7fd6f Mon Sep 17 00:00:00 2001 From: "svenpanne@chromium.org" Date: Mon, 22 Sep 2014 09:05:22 +0000 Subject: [PATCH] Emit source positions in deopt comments, too. R=jarin@chromium.org Review URL: https://codereview.chromium.org/587223002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24109 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/lithium-codegen-arm.cc | 3 ++- src/arm64/lithium-codegen-arm64.cc | 3 ++- src/deoptimizer.h | 4 +++- src/hydrogen-instructions.h | 2 +- src/ia32/lithium-codegen-ia32.cc | 3 ++- src/lithium-codegen.cc | 7 +++++-- src/mips/lithium-codegen-mips.cc | 3 ++- src/mips64/lithium-codegen-mips64.cc | 3 ++- src/x64/lithium-codegen-x64.cc | 3 ++- src/x87/lithium-codegen-x87.cc | 3 ++- 10 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index 300572a..0357cc3 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -899,7 +899,8 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, __ stop("trap_on_deopt", condition); } - Deoptimizer::Reason reason(instr->Mnemonic(), detail); + Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(), + instr->Mnemonic(), detail); DCHECK(info()->IsStub() || frame_is_built_); // Go through jump table if we need to handle condition, build frame, or // restore caller doubles. diff --git a/src/arm64/lithium-codegen-arm64.cc b/src/arm64/lithium-codegen-arm64.cc index 75d3c7b..20cc44d 100644 --- a/src/arm64/lithium-codegen-arm64.cc +++ b/src/arm64/lithium-codegen-arm64.cc @@ -1044,7 +1044,8 @@ void LCodeGen::DeoptimizeBranch( __ Bind(&dont_trap); } - Deoptimizer::Reason reason(instr->Mnemonic(), detail); + Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(), + instr->Mnemonic(), detail); DCHECK(info()->IsStub() || frame_is_built_); // Go through jump table if we need to build frame, or restore caller doubles. if (branch_type == always && diff --git a/src/deoptimizer.h b/src/deoptimizer.h index 281751c..3cf0a3e 100644 --- a/src/deoptimizer.h +++ b/src/deoptimizer.h @@ -102,7 +102,9 @@ class Deoptimizer : public Malloced { static const int kBailoutTypesWithCodeEntry = SOFT + 1; struct Reason { - Reason(const char* m, const char* d) : mnemonic(m), detail(d) {} + Reason(int r, const char* m, const char* d) + : raw_position(r), mnemonic(m), detail(d) {} + int raw_position; const char* mnemonic; const char* detail; }; diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index ab57147..695c629 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -455,10 +455,10 @@ class HSourcePosition { // Offset from the start of the inlined function. typedef BitField PositionField; - // On HPositionInfo can use this constructor. explicit HSourcePosition(int value) : value_(value) { } friend class HPositionInfo; + friend class LCodeGenBase; // If FLAG_hydrogen_track_positions is set contains bitfields InliningIdField // and PositionField. diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index eeb2472..f1a587f 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -867,7 +867,8 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr, __ bind(&done); } - Deoptimizer::Reason reason(instr->Mnemonic(), detail); + Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(), + instr->Mnemonic(), detail); DCHECK(info()->IsStub() || frame_is_built_); if (cc == no_condition && frame_is_built_) { DeoptComment(reason); diff --git a/src/lithium-codegen.cc b/src/lithium-codegen.cc index bc73bb9..0207188 100644 --- a/src/lithium-codegen.cc +++ b/src/lithium-codegen.cc @@ -148,8 +148,11 @@ void LCodeGenBase::Comment(const char* format, ...) { void LCodeGenBase::DeoptComment(const Deoptimizer::Reason& reason) { - Comment(";;; deoptimize %s: %s", reason.mnemonic, - reason.detail == NULL ? "unknown reason" : reason.detail); + OStringStream os; + os << ";;; deoptimize at " << HSourcePosition(reason.raw_position) << " " + << reason.mnemonic; + if (reason.detail != NULL) os << ": " << reason.detail; + Comment("%s", os.c_str()); } diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index 24aed86..5ea68b2 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -860,7 +860,8 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, __ bind(&skip); } - Deoptimizer::Reason reason(instr->Mnemonic(), detail); + Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(), + instr->Mnemonic(), detail); DCHECK(info()->IsStub() || frame_is_built_); // Go through jump table if we need to handle condition, build frame, or // restore caller doubles. diff --git a/src/mips64/lithium-codegen-mips64.cc b/src/mips64/lithium-codegen-mips64.cc index 859ccd2..7cc23dc 100644 --- a/src/mips64/lithium-codegen-mips64.cc +++ b/src/mips64/lithium-codegen-mips64.cc @@ -810,7 +810,8 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, __ bind(&skip); } - Deoptimizer::Reason reason(instr->Mnemonic(), detail); + Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(), + instr->Mnemonic(), detail); DCHECK(info()->IsStub() || frame_is_built_); // Go through jump table if we need to handle condition, build frame, or // restore caller doubles. diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index 4ce57e6..3e342d8 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -774,7 +774,8 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr, __ bind(&done); } - Deoptimizer::Reason reason(instr->Mnemonic(), detail); + Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(), + instr->Mnemonic(), detail); DCHECK(info()->IsStub() || frame_is_built_); // Go through jump table if we need to handle condition, build frame, or // restore caller doubles. diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc index 690ebcc..ed4755b 100644 --- a/src/x87/lithium-codegen-x87.cc +++ b/src/x87/lithium-codegen-x87.cc @@ -1148,7 +1148,8 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr, __ bind(&done); } - Deoptimizer::Reason reason(instr->Mnemonic(), detail); + Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(), + instr->Mnemonic(), detail); DCHECK(info()->IsStub() || frame_is_built_); if (cc == no_condition && frame_is_built_) { DeoptComment(reason); -- 2.7.4