[deoptimizer] Fix Deoptimizer::GetDeoptInfo for last entry.
This fixes the corner-case where the method in question failed to lookup the very last deoptimization bailout without subsequent entries within the relocation info. Also enable a test covering this. R=tebbi@chromium.org TEST=cctest/test-cpu-profiler/CollectDeoptEvents Review-Url: https://codereview.chromium.org/2565733002 Cr-Commit-Position: refs/heads/master@{#41623}
This commit is contained in:
parent
89e10055e4
commit
50c5ac57de
@ -2714,6 +2714,7 @@ DeoptimizedFrameInfo::DeoptimizedFrameInfo(TranslatedState* state,
|
||||
|
||||
|
||||
Deoptimizer::DeoptInfo Deoptimizer::GetDeoptInfo(Code* code, Address pc) {
|
||||
CHECK(code->instruction_start() <= pc && pc <= code->instruction_end());
|
||||
SourcePosition last_position = SourcePosition::Unknown();
|
||||
DeoptimizeReason last_reason = DeoptimizeReason::kNoReason;
|
||||
int last_deopt_id = kNoDeoptimizationId;
|
||||
@ -2723,9 +2724,7 @@ Deoptimizer::DeoptInfo Deoptimizer::GetDeoptInfo(Code* code, Address pc) {
|
||||
RelocInfo::ModeMask(RelocInfo::DEOPT_INLINING_ID);
|
||||
for (RelocIterator it(code, mask); !it.done(); it.next()) {
|
||||
RelocInfo* info = it.rinfo();
|
||||
if (info->pc() >= pc) {
|
||||
return DeoptInfo(last_position, last_reason, last_deopt_id);
|
||||
}
|
||||
if (info->pc() >= pc) break;
|
||||
if (info->rmode() == RelocInfo::DEOPT_SCRIPT_OFFSET) {
|
||||
int script_offset = static_cast<int>(info->data());
|
||||
it.next();
|
||||
@ -2738,7 +2737,7 @@ Deoptimizer::DeoptInfo Deoptimizer::GetDeoptInfo(Code* code, Address pc) {
|
||||
last_reason = static_cast<DeoptimizeReason>(info->data());
|
||||
}
|
||||
}
|
||||
return DeoptInfo(SourcePosition::Unknown(), DeoptimizeReason::kNoReason, -1);
|
||||
return DeoptInfo(last_position, last_reason, last_deopt_id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -332,9 +332,6 @@
|
||||
|
||||
##############################################################################
|
||||
['variant == turbofan or variant == ignition_turbofan', {
|
||||
# BUG(4751). Deopts with kNotASmi instead of expected deopt reason.
|
||||
'test-cpu-profiler/CollectDeoptEvents': [SKIP],
|
||||
|
||||
# BUG(4751). Flaky with Ignition.
|
||||
'test-cpu-profiler/JsNativeJsSample': [SKIP],
|
||||
|
||||
|
@ -1872,15 +1872,20 @@ TEST(CollectDeoptEvents) {
|
||||
|
||||
{
|
||||
const char* branch[] = {"", "opt_function0", "opt_function0"};
|
||||
CHECK_EQ(reason(i::DeoptimizeReason::kNotAHeapNumber),
|
||||
GetBranchDeoptReason(env, iprofile, branch, arraysize(branch)));
|
||||
const char* deopt_reason =
|
||||
GetBranchDeoptReason(env, iprofile, branch, arraysize(branch));
|
||||
if (deopt_reason != reason(i::DeoptimizeReason::kNotAHeapNumber) &&
|
||||
deopt_reason != reason(i::DeoptimizeReason::kNotASmi)) {
|
||||
FATAL(deopt_reason);
|
||||
}
|
||||
}
|
||||
{
|
||||
const char* branch[] = {"", "opt_function1", "opt_function1"};
|
||||
const char* deopt_reason =
|
||||
GetBranchDeoptReason(env, iprofile, branch, arraysize(branch));
|
||||
if (deopt_reason != reason(i::DeoptimizeReason::kNaN) &&
|
||||
deopt_reason != reason(i::DeoptimizeReason::kLostPrecisionOrNaN)) {
|
||||
deopt_reason != reason(i::DeoptimizeReason::kLostPrecisionOrNaN) &&
|
||||
deopt_reason != reason(i::DeoptimizeReason::kNotASmi)) {
|
||||
FATAL(deopt_reason);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user