Commit c062b28a authored by yangguo's avatar yangguo Committed by Commit bot

Revert of Debugger: use FrameInspector in ScopeIterator to find context....

Revert of Debugger: use FrameInspector in ScopeIterator to find context. (patchset #3 id:40001 of https://codereview.chromium.org/1239033002/)

Reason for revert:
breaks roll: http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/87292/steps/browser_tests%20%28with%20patch%29/logs/DevToolsSanityTest.TestPauseWhenScriptIsRunning

Original issue's description:
> Debugger: use FrameInspector in ScopeIterator to find context.
>
> In optimized code, it's not guaranteed that the current context
> is stored in its frame slot.
>
> R=bmeurer@chromium.org
> BUG=v8:4309
> LOG=N
>
> Committed: https://crrev.com/3a0ee39cbde6a9778cfc4e2a6a0a8ff68933ff38
> Cr-Commit-Position: refs/heads/master@{#29697}

TBR=bmeurer@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:4309

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

Cr-Commit-Position: refs/heads/master@{#29722}
parent dc71c1b5
......@@ -2735,8 +2735,19 @@ void Debug::HandleDebugBreak() {
bool debug_command_only = isolate_->stack_guard()->CheckDebugCommand() &&
!isolate_->stack_guard()->CheckDebugBreak();
bool is_debugger_statement = !isolate_->stack_guard()->CheckDebugCommand() &&
!isolate_->stack_guard()->CheckDebugBreak();
isolate_->stack_guard()->ClearDebugBreak();
if (is_debugger_statement) {
// If we have been called via 'debugger' Javascript statement,
// we might not be prepared for breakpoints.
// TODO(dslomov,yangguo): CheckDebugBreak may race with RequestDebugBreak.
// Revisit this to clean-up.
HandleScope handle_scope(isolate_);
PrepareForBreakPoints();
}
ProcessDebugMessages(debug_command_only);
}
......
This diff is collapsed.
......@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug --allow-natives-syntax
// Flags: --expose-debug-as debug
// The functions used for testing backtraces. They are at the top to make the
// testing of source line/column easier.
......@@ -187,14 +187,6 @@ function CheckScopeContent(content, number, exec_state) {
}
function assertEqualsUnlessOptimized(expected, value, f) {
try {
assertEquals(expected, value);
} catch (e) {
assertOptimized(f);
}
}
// Simple empty block scope in local scope.
BeginTest("Local block 1");
......@@ -525,11 +517,11 @@ function shadowing_1() {
{
let i = 5;
debugger;
assertEqualsUnlessOptimized(27, i, shadowing_1);
assertEquals(27, i);
}
assertEquals(0, i);
debugger;
assertEqualsUnlessOptimized(27, i, shadowing_1);
assertEquals(27, i);
}
listener_delegate = function (exec_state) {
......@@ -546,9 +538,9 @@ function shadowing_2() {
{
let j = 5;
debugger;
assertEqualsUnlessOptimized(27, j, shadowing_2);
assertEquals(27, j);
}
assertEqualsUnlessOptimized(0, i, shadowing_2);
assertEquals(0, i);
}
listener_delegate = function (exec_state) {
......
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax
var Debug = debug.Debug;
var exception = null;
function listener(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Break) return;
try {
var scopes = exec_state.frame().allScopes();
assertEquals(3, scopes.length);
assertEquals(debug.ScopeType.Local, scopes[0].scopeType());
assertEquals(debug.ScopeType.Script, scopes[1].scopeType());
assertEquals(debug.ScopeType.Global, scopes[2].scopeType());
} catch (e) {
exception = e;
}
}
function f() {
eval('');
debugger;
}
f();
f();
%OptimizeFunctionOnNextCall(f);
Debug.setListener(listener);
f();
assertNull(exception);
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax
var Debug = debug.Debug;
var exception = null;
function listener(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Break) return;
try {
var scope = exec_state.frame().scope(0);
assertEquals(5, scope.scopeObject().property("i").value().value());
} catch (e) {
exception = e;
}
}
function f() {
eval('var i = 5');
debugger;
}
f();
f();
%OptimizeFunctionOnNextCall(f);
Debug.setListener(listener);
f();
assertNull(exception);
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax
var Debug = debug.Debug;
var exception = null;
function listener(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Break) return;
try {
var scopes = exec_state.frame().allScopes();
assertEquals(4, scopes.length);
assertEquals(debug.ScopeType.With, scopes[0].scopeType());
assertEquals(debug.ScopeType.Local, scopes[1].scopeType());
assertEquals(debug.ScopeType.Script, scopes[2].scopeType());
assertEquals(debug.ScopeType.Global, scopes[3].scopeType());
} catch (e) {
exception = e;
}
}
function f() {
with({}) {
debugger;
}
}
f();
f();
%OptimizeFunctionOnNextCall(f);
Debug.setListener(listener);
f();
assertNull(exception);
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