Commit 34fc7f62 authored by Pierre Langlois's avatar Pierre Langlois Committed by Commit Bot

[perf-prof] Let UnwindingInfoWriter know about throw and debug abort.

In order to keep track of where the return address is stored in each block, the
UnwindingInfoWriter needs to know if a block exits the current function.
However, we would only mark returns and tail-calls as exists, while we also have
kArchDebugAbort, kArchThrowTerminator and kArchDeoptimize. This would lead to
assertions when generating the snapshot in debug mode with
`v8_perf_prof_unwinding_info = true`.

Bug: v8:7660
Change-Id: Iee2ab222251f6922dd21442e12cbb6b56534bf54
Reviewed-on: https://chromium-review.googlesource.com/1019504Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Pierre Langlois <pierre.langlois@arm.com>
Cr-Commit-Position: refs/heads/master@{#52906}
parent c63c5c22
...@@ -875,6 +875,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -875,6 +875,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
} }
__ stop("kArchDebugAbort"); __ stop("kArchDebugAbort");
unwinding_info_writer_.MarkBlockWillExit();
break; break;
case kArchDebugBreak: case kArchDebugBreak:
__ stop("kArchDebugBreak"); __ stop("kArchDebugBreak");
...@@ -884,8 +885,11 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -884,8 +885,11 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ RecordComment(reinterpret_cast<const char*>(comment_string)); __ RecordComment(reinterpret_cast<const char*>(comment_string));
break; break;
} }
case kArchNop:
case kArchThrowTerminator: case kArchThrowTerminator:
DCHECK_EQ(LeaveCC, i.OutputSBit());
unwinding_info_writer_.MarkBlockWillExit();
break;
case kArchNop:
// don't emit code for nops. // don't emit code for nops.
DCHECK_EQ(LeaveCC, i.OutputSBit()); DCHECK_EQ(LeaveCC, i.OutputSBit());
break; break;
...@@ -895,6 +899,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -895,6 +899,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
CodeGenResult result = CodeGenResult result =
AssembleDeoptimizerCall(deopt_state_id, current_source_position_); AssembleDeoptimizerCall(deopt_state_id, current_source_position_);
if (result != kSuccess) return result; if (result != kSuccess) return result;
unwinding_info_writer_.MarkBlockWillExit();
break; break;
} }
case kArchRet: case kArchRet:
......
...@@ -790,6 +790,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -790,6 +790,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
} }
__ Debug("kArchDebugAbort", 0, BREAK); __ Debug("kArchDebugAbort", 0, BREAK);
unwinding_info_writer_.MarkBlockWillExit();
break; break;
case kArchDebugBreak: case kArchDebugBreak:
__ Debug("kArchDebugBreak", 0, BREAK); __ Debug("kArchDebugBreak", 0, BREAK);
...@@ -799,8 +800,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -799,8 +800,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ RecordComment(reinterpret_cast<const char*>(comment_string)); __ RecordComment(reinterpret_cast<const char*>(comment_string));
break; break;
} }
case kArchNop:
case kArchThrowTerminator: case kArchThrowTerminator:
unwinding_info_writer_.MarkBlockWillExit();
break;
case kArchNop:
// don't emit code for nops. // don't emit code for nops.
break; break;
case kArchDeoptimize: { case kArchDeoptimize: {
...@@ -809,6 +812,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -809,6 +812,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
CodeGenResult result = CodeGenResult result =
AssembleDeoptimizerCall(deopt_state_id, current_source_position_); AssembleDeoptimizerCall(deopt_state_id, current_source_position_);
if (result != kSuccess) return result; if (result != kSuccess) return result;
unwinding_info_writer_.MarkBlockWillExit();
break; break;
} }
case kArchRet: case kArchRet:
......
...@@ -897,12 +897,15 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -897,12 +897,15 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
} }
__ int3(); __ int3();
unwinding_info_writer_.MarkBlockWillExit();
break; break;
case kArchDebugBreak: case kArchDebugBreak:
__ int3(); __ int3();
break; break;
case kArchNop:
case kArchThrowTerminator: case kArchThrowTerminator:
unwinding_info_writer_.MarkBlockWillExit();
break;
case kArchNop:
// don't emit code for nops. // don't emit code for nops.
break; break;
case kArchDeoptimize: { case kArchDeoptimize: {
...@@ -911,6 +914,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -911,6 +914,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
CodeGenResult result = CodeGenResult result =
AssembleDeoptimizerCall(deopt_state_id, current_source_position_); AssembleDeoptimizerCall(deopt_state_id, current_source_position_);
if (result != kSuccess) return result; if (result != kSuccess) return result;
unwinding_info_writer_.MarkBlockWillExit();
break; break;
} }
case kArchRet: case kArchRet:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment