[turbofan] Support initial step-in through debugger statement.

This adapts the debugger so that the first break event starting the
stepping process can come from optimized code. TurboFan supports a
debugger statement and hence can be the top-most frame whenever the
Debug::HandleDebugBreak handler is triggered.

R=yangguo@chromium.org
TEST=mjsunit/debug,cctest/test-debug

Review URL: https://codereview.chromium.org/1038613002

Cr-Commit-Position: refs/heads/master@{#27447}
This commit is contained in:
mstarzinger 2015-03-25 08:02:31 -07:00 committed by Commit bot
parent 5a91597383
commit 7d0e5593e5
5 changed files with 15 additions and 26 deletions

View File

@ -1264,8 +1264,12 @@ void Debug::PrepareStep(StepAction step_action,
return;
}
List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
frames_it.frame()->Summarize(&frames);
FrameSummary summary = frames.first();
// Get the debug info (create it if it does not exist).
Handle<JSFunction> function(frame->function());
Handle<JSFunction> function(summary.function());
Handle<SharedFunctionInfo> shared(function->shared());
if (!EnsureDebugInfo(shared, function)) {
// Return if ensuring debug info failed.
@ -1281,7 +1285,7 @@ void Debug::PrepareStep(StepAction step_action,
// PC points to the instruction after the current one, possibly a break
// location as well. So the "- 1" to exclude it from the search.
Address call_pc = frame->pc() - 1;
Address call_pc = summary.pc() - 1;
BreakLocation location =
BreakLocation::FromAddress(debug_info, ALL_BREAK_LOCATIONS, call_pc);
@ -1348,7 +1352,7 @@ void Debug::PrepareStep(StepAction step_action,
// Remember source position and frame to handle step next.
thread_local_.last_statement_position_ =
debug_info->code()->SourceStatementPosition(frame->pc());
debug_info->code()->SourceStatementPosition(summary.pc());
thread_local_.last_fp_ = frame->UnpaddedFP();
} else {
// If there's restarter frame on top of the stack, just get the pointer
@ -1420,7 +1424,7 @@ void Debug::PrepareStep(StepAction step_action,
// Object::Get/SetPropertyWithAccessor, otherwise the step action will be
// propagated on the next Debug::Break.
thread_local_.last_statement_position_ =
debug_info->code()->SourceStatementPosition(frame->pc());
debug_info->code()->SourceStatementPosition(summary.pc());
thread_local_.last_fp_ = frame->UnpaddedFP();
}

View File

@ -1552,9 +1552,11 @@ RUNTIME_FUNCTION(Runtime_GetStepInPositions) {
JavaScriptFrameIterator frame_it(isolate, id);
RUNTIME_ASSERT(!frame_it.done());
JavaScriptFrame* frame = frame_it.frame();
List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
frame_it.frame()->Summarize(&frames);
FrameSummary summary = frames.first();
Handle<JSFunction> fun = Handle<JSFunction>(frame->function());
Handle<JSFunction> fun = Handle<JSFunction>(summary.function());
Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo>(fun->shared());
if (!isolate->debug()->EnsureDebugInfo(shared, fun)) {
@ -1565,7 +1567,7 @@ RUNTIME_FUNCTION(Runtime_GetStepInPositions) {
// Find range of break points starting from the break point where execution
// has stopped.
Address call_pc = frame->pc() - 1;
Address call_pc = summary.pc() - 1;
List<BreakLocation> locations;
BreakLocation::FromAddressSameStatement(debug_info, ALL_BREAK_LOCATIONS,
call_pc, &locations);
@ -1575,7 +1577,7 @@ RUNTIME_FUNCTION(Runtime_GetStepInPositions) {
int index = 0;
for (BreakLocation location : locations) {
bool accept;
if (location.pc() > frame->pc()) {
if (location.pc() > summary.pc()) {
accept = true;
} else {
StackFrame::Id break_frame_id = isolate->debug()->break_frame_id();

View File

@ -102,11 +102,6 @@
# BUG(3742).
'test-mark-compact/MarkCompactCollector': [PASS, ['arch==arm', NO_VARIANTS]],
# TODO(jarin/mstarzinger): Investigate debugger issues with TurboFan.
'test-debug/DebugStepNatives': [PASS, NO_VARIANTS],
'test-debug/DebugStepFunctionApply': [PASS, NO_VARIANTS],
'test-debug/DebugStepFunctionCall': [PASS, NO_VARIANTS],
# TODO(jarin): Cannot lazy-deoptimize from conversions before comparisons.
'test-js-typed-lowering/OrderCompareEffects': [SKIP],

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --turbo-filter=g --allow-natives-syntax
// Flags: --expose-debug-as debug --turbo-filter=g --allow-natives-syntax
// Test that Debug::PrepareForBreakPoints can deal with turbofan code (g)
// on the stack. Without deoptimization support, we will not be able to

View File

@ -96,24 +96,12 @@
'debug-evaluate-locals': [PASS, NO_VARIANTS],
'debug-liveedit-check-stack': [PASS, NO_VARIANTS], # only in no-snap mode.
'debug-liveedit-double-call': [PASS, NO_VARIANTS],
'debug-step-stub-callfunction': [PASS, NO_VARIANTS],
'debug-set-variable-value': [PASS, NO_VARIANTS],
'debug-stepin-accessor': [PASS, NO_VARIANTS],
'debug-stepin-builtin': [PASS, NO_VARIANTS],
'debug-stepin-constructor': [PASS, NO_VARIANTS],
'debug-stepin-function-call': [PASS, NO_VARIANTS],
'debug-stepin-positions': [PASS, NO_VARIANTS],
'debug-stepin-property-function-call': [PASS, NO_VARIANTS],
'debug-stepnext-do-while': [PASS, NO_VARIANTS],
'debug-stepout-scope-part1': [PASS, NO_VARIANTS],
'debug-stepout-scope-part2': [PASS, NO_VARIANTS],
'debug-stepout-scope-part3': [PASS, NO_VARIANTS],
'debug-scripts-request': [PASS, NO_VARIANTS],
'es6/debug-stepin-microtasks': [PASS, NO_VARIANTS],
'es6/debug-stepnext-for': [PASS, NO_VARIANTS],
'es6/debug-evaluate-blockscopes': [PASS, NO_VARIANTS],
'regress/regress-crbug-259300': [PASS, NO_VARIANTS],
'es6/regress/regress-468661': [PASS, NO_VARIANTS],
##############################################################################
# Too slow in debug mode with --stress-opt mode.