2016-06-03 15:30:42 +00:00
|
|
|
// Copyright 2016 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.
|
|
|
|
|
|
|
|
var Debug = debug.Debug;
|
|
|
|
var step_count = 0;
|
|
|
|
|
|
|
|
function listener(event, execState, eventData, data) {
|
|
|
|
if (event != Debug.DebugEvent.Break) return;
|
|
|
|
try {
|
|
|
|
var line = execState.frame(0).sourceLineText();
|
|
|
|
print(line);
|
|
|
|
var [match, expected_count, step] = /\/\/ B(\d) (\w+)$/.exec(line);
|
|
|
|
assertEquals(step_count++, parseInt(expected_count));
|
|
|
|
if (step != "Continue") execState.prepareStep(Debug.StepAction[step]);
|
|
|
|
} catch (e) {
|
|
|
|
print(e, e.stack);
|
|
|
|
quit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Debug.setListener(listener);
|
|
|
|
|
|
|
|
var late_resolve;
|
|
|
|
|
|
|
|
function g() {
|
2017-05-31 11:40:31 +00:00
|
|
|
return new Promise( // B3 StepOut
|
2016-06-03 15:30:42 +00:00
|
|
|
function(res, rej) {
|
|
|
|
late_resolve = res;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
async function f1() {
|
|
|
|
var a = 1;
|
|
|
|
debugger; // B0 StepNext
|
2017-05-31 11:40:31 +00:00
|
|
|
a += // B1 StepIn
|
[inspector] moved var initialization break location before init expression (reland)
This CL improves break locations for expressions like 'var a = <expr>'. Without CL we use <expr> position as break location for initialization statement, with this CL we use position of first character after '=' as position.
Benefits (see test for details):
- only one break in expressions which includes mix of property lookup and calls, e.g. var p = Promise.resolve().then(x => x * 2),
- removed redundant break location for expressions like: let { x, y } = { x: 1, y: 2}.
TBR=dgozman@chromium.org,rmcilroy@chromium.org,machenbach@chromium.org,marja@chromium.org,kozyatinskiy@chromium.org,devtools-reviews@chromium.org,v8-reviews@googlegroups.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: v8:5909
Change-Id: Ie84fa79afeed09e28cf8478ba610a0cfbfdfc294
Reviewed-on: https://chromium-review.googlesource.com/518116
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45598}
2017-05-30 12:25:55 +00:00
|
|
|
await // B7 StepNext
|
2016-06-03 15:30:42 +00:00
|
|
|
f2(); // B2 StepIn
|
2017-05-31 11:40:31 +00:00
|
|
|
return a; // B5 StepNext
|
|
|
|
} // B6 Continue
|
2016-06-03 15:30:42 +00:00
|
|
|
|
|
|
|
async function f2() {
|
2017-05-31 11:40:31 +00:00
|
|
|
var b = 0 + // B2 StepIn
|
|
|
|
await
|
|
|
|
g();
|
|
|
|
return b; // B4 StepOut
|
2016-06-03 15:30:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
f1();
|
|
|
|
|
|
|
|
late_resolve(3);
|
|
|
|
|
|
|
|
%RunMicrotasks();
|
|
|
|
|
2017-05-31 11:40:31 +00:00
|
|
|
assertEquals(7, step_count);
|