diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index fea392b567..646e1a9689 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -352,6 +352,8 @@ bool LCodeGen::GenerateJumpTable() { } else { __ bl(&call_deopt_entry); } + info()->LogDeoptCallPosition(masm()->pc_offset(), + table_entry->deopt_info.inlining_id); masm()->CheckConstPool(false, false); } @@ -887,6 +889,7 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, !info()->saves_caller_doubles()) { DeoptComment(deopt_info); __ Call(entry, RelocInfo::RUNTIME_ENTRY); + info()->LogDeoptCallPosition(masm()->pc_offset(), deopt_info.inlining_id); } else { Deoptimizer::JumpTableEntry table_entry(entry, deopt_info, bailout_type, !frame_is_built_); diff --git a/src/arm64/lithium-codegen-arm64.cc b/src/arm64/lithium-codegen-arm64.cc index 620f841d8c..2c99a607f5 100644 --- a/src/arm64/lithium-codegen-arm64.cc +++ b/src/arm64/lithium-codegen-arm64.cc @@ -876,6 +876,8 @@ bool LCodeGen::GenerateJumpTable() { // table. __ Bl(&call_deopt_entry); } + info()->LogDeoptCallPosition(masm()->pc_offset(), + table_entry->deopt_info.inlining_id); masm()->CheckConstPool(false, false); } @@ -1061,6 +1063,7 @@ void LCodeGen::DeoptimizeBranch( frame_is_built_ && !info()->saves_caller_doubles()) { DeoptComment(deopt_info); __ Call(entry, RelocInfo::RUNTIME_ENTRY); + info()->LogDeoptCallPosition(masm()->pc_offset(), deopt_info.inlining_id); } else { Deoptimizer::JumpTableEntry* table_entry = new (zone()) Deoptimizer::JumpTableEntry( diff --git a/src/compiler.cc b/src/compiler.cc index 35c581f6b0..b622d9ce85 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -322,6 +322,14 @@ int CompilationInfo::TraceInlinedFunction(Handle shared, } +void CompilationInfo::LogDeoptCallPosition(int pc_offset, int inlining_id) { + if (!track_positions_ || IsStub()) return; + DCHECK_LT(static_cast(inlining_id), inlined_function_infos_->size()); + inlined_function_infos_->at(inlining_id) + .deopt_pc_offsets.push_back(pc_offset); +} + + class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder { public: explicit HOptimizedGraphBuilderWithPositions(CompilationInfo* info) diff --git a/src/compiler.h b/src/compiler.h index 3f2aa4beb9..630e9cb74e 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -97,6 +97,7 @@ struct InlinedFunctionInfo { SourcePosition inline_position; int script_id; int start_position; + std::vector deopt_pc_offsets; static const int kNoParentId = -1; }; @@ -342,6 +343,13 @@ class CompilationInfo { std::vector* inlined_function_infos() { return inlined_function_infos_; } + std::vector* ReleaseInlinedFunctionInfos() { + std::vector* tmp = inlined_function_infos_; + inlined_function_infos_ = NULL; + return tmp; + } + + void LogDeoptCallPosition(int pc_offset, int inlining_id); int TraceInlinedFunction(Handle shared, SourcePosition position, int pareint_id); diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index 8b0fbc222f..ed3e4b205f 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -395,6 +395,8 @@ bool LCodeGen::GenerateJumpTable() { if (info()->saves_caller_doubles()) RestoreCallerDoubles(); __ call(entry, RelocInfo::RUNTIME_ENTRY); } + info()->LogDeoptCallPosition(masm()->pc_offset(), + table_entry->deopt_info.inlining_id); } if (needs_frame.is_linked()) { __ bind(&needs_frame); @@ -888,6 +890,7 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr, if (cc == no_condition && frame_is_built_) { DeoptComment(deopt_info); __ call(entry, RelocInfo::RUNTIME_ENTRY); + info()->LogDeoptCallPosition(masm()->pc_offset(), deopt_info.inlining_id); } else { Deoptimizer::JumpTableEntry table_entry(entry, deopt_info, bailout_type, !frame_is_built_); diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index fca001f98b..18d0c9bdae 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -353,6 +353,8 @@ bool LCodeGen::GenerateJumpTable() { } else { __ Call(&call_deopt_entry); } + info()->LogDeoptCallPosition(masm()->pc_offset(), + table_entry->deopt_info.inlining_id); } if (needs_frame.is_linked()) { @@ -853,6 +855,7 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, !info()->saves_caller_doubles()) { DeoptComment(deopt_info); __ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2); + info()->LogDeoptCallPosition(masm()->pc_offset(), deopt_info.inlining_id); } else { Deoptimizer::JumpTableEntry table_entry(entry, deopt_info, bailout_type, !frame_is_built_); diff --git a/src/mips64/lithium-codegen-mips64.cc b/src/mips64/lithium-codegen-mips64.cc index 1471d58b89..51c5ec48fe 100644 --- a/src/mips64/lithium-codegen-mips64.cc +++ b/src/mips64/lithium-codegen-mips64.cc @@ -320,6 +320,8 @@ bool LCodeGen::GenerateJumpTable() { } else { __ Call(&call_deopt_entry); } + info()->LogDeoptCallPosition(masm()->pc_offset(), + table_entry->deopt_info.inlining_id); } if (needs_frame.is_linked()) { __ bind(&needs_frame); @@ -820,6 +822,7 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, !info()->saves_caller_doubles()) { DeoptComment(deopt_info); __ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2); + info()->LogDeoptCallPosition(masm()->pc_offset(), deopt_info.inlining_id); } else { Deoptimizer::JumpTableEntry table_entry(entry, deopt_info, bailout_type, !frame_is_built_); diff --git a/src/ppc/lithium-codegen-ppc.cc b/src/ppc/lithium-codegen-ppc.cc index f67f4c94de..9af13ae235 100644 --- a/src/ppc/lithium-codegen-ppc.cc +++ b/src/ppc/lithium-codegen-ppc.cc @@ -343,6 +343,8 @@ bool LCodeGen::GenerateJumpTable() { } else { __ b(&call_deopt_entry, SetLK); } + info()->LogDeoptCallPosition(masm()->pc_offset(), + table_entry->deopt_info.inlining_id); } if (needs_frame.is_linked()) { @@ -809,6 +811,7 @@ void LCodeGen::DeoptimizeIf(Condition cond, LInstruction* instr, if (cond == al && frame_is_built_ && !info()->saves_caller_doubles()) { DeoptComment(deopt_info); __ Call(entry, RelocInfo::RUNTIME_ENTRY); + info()->LogDeoptCallPosition(masm()->pc_offset(), deopt_info.inlining_id); } else { Deoptimizer::JumpTableEntry table_entry(entry, deopt_info, bailout_type, !frame_is_built_); diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index 204030f5be..ffa0c4cd0f 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -317,6 +317,8 @@ bool LCodeGen::GenerateJumpTable() { } __ call(entry, RelocInfo::RUNTIME_ENTRY); } + info()->LogDeoptCallPosition(masm()->pc_offset(), + table_entry->deopt_info.inlining_id); } if (needs_frame.is_linked()) { @@ -358,7 +360,7 @@ bool LCodeGen::GenerateJumpTable() { __ Move(MemOperand(rsp, 2 * kPointerSize), Smi::FromInt(StackFrame::STUB)); /* stack layout - 4: old ebp + 4: old rbp 3: context pointer 2: stub marker 1: return address @@ -811,6 +813,7 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr, !info()->saves_caller_doubles()) { DeoptComment(deopt_info); __ call(entry, RelocInfo::RUNTIME_ENTRY); + info()->LogDeoptCallPosition(masm()->pc_offset(), deopt_info.inlining_id); } else { Deoptimizer::JumpTableEntry table_entry(entry, deopt_info, bailout_type, !frame_is_built_); diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc index 53914b1985..4467d2e6ce 100644 --- a/src/x87/lithium-codegen-x87.cc +++ b/src/x87/lithium-codegen-x87.cc @@ -391,6 +391,8 @@ bool LCodeGen::GenerateJumpTable() { } else { __ call(entry, RelocInfo::RUNTIME_ENTRY); } + info()->LogDeoptCallPosition(masm()->pc_offset(), + table_entry->deopt_info.inlining_id); } if (needs_frame.is_linked()) { __ bind(&needs_frame); @@ -1173,6 +1175,7 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr, if (cc == no_condition && frame_is_built_) { DeoptComment(deopt_info); __ call(entry, RelocInfo::RUNTIME_ENTRY); + info()->LogDeoptCallPosition(masm()->pc_offset(), deopt_info.inlining_id); } else { Deoptimizer::JumpTableEntry table_entry(entry, deopt_info, bailout_type, !frame_is_built_);