81835bf03d
This reverts commit 21c0d77e15
.
Reason for revert: Compile failure in bootstrapper.cc
Original change's description:
> [async] Optimize await and AsyncFromSyncIterator
>
> Simplify the promise wrapping in await and
> %AsyncFromSyncIteratorPrototype%.next/return/throw to reuse the PromiseResolve
> primitive. Now await takes 1 tick instead of 3 on the microtask queue.
>
> Change-Id: I7e99b8689eb8fcb09c48915b11c1e06684dc0f1a
> Reviewed-on: https://chromium-review.googlesource.com/1090272
> Commit-Queue: Maya Lekova <mslekova@chromium.org>
> Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
> Reviewed-by: Mathias Bynens <mathias@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53853}
TBR=kozyatinskiy@chromium.org,littledan@chromium.org,gsathya@chromium.org,bmeurer@chromium.org,domenic@chromium.org,mathias@chromium.org,mslekova@chromium.org
Change-Id: Ia631acdfcd5c1f9c28c1540c8da16cdf076abf87
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/1106566
Reviewed-by: Bill Budge <bbudge@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53855}
75 lines
2.5 KiB
JavaScript
75 lines
2.5 KiB
JavaScript
// Copyright 2017 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.
|
|
|
|
let {session, contextGroup, Protocol} =
|
|
InspectorTest.start('Tests breakable locations in variable initializations.');
|
|
|
|
let source = `
|
|
function testFunction() {
|
|
var obj1 = {a : 1};
|
|
var arr1 = [1];
|
|
var promise = Promise.resolve(1).then(x => x * 2).then(x => x / 2);
|
|
Promise.resolve(1).then(x => x * 2).then(x => x / 2);
|
|
promise = Promise.resolve(1).then(x => x * 2).then(x => x / 2);
|
|
var a = 1;
|
|
const x = (a = 20);
|
|
var y = (a = 100);
|
|
var z = x + (a = 1) + (a = 2) + (a = 3) + f();
|
|
function f() {
|
|
for (let { x, y } = { x: 0, y: 1 }; y > 0; --y) { let z = x + y; }
|
|
}
|
|
var b = obj1.a;
|
|
(async function asyncF() {
|
|
let r = await Promise.resolve(42);
|
|
return r;
|
|
})();
|
|
return promise;
|
|
}
|
|
//# sourceURL=test.js`;
|
|
|
|
contextGroup.addScript(source);
|
|
session.setupScriptMap();
|
|
|
|
InspectorTest.runAsyncTestSuite([
|
|
async function testBreakLocations() {
|
|
Protocol.Debugger.enable();
|
|
let {params:{scriptId}} = await Protocol.Debugger.onceScriptParsed();
|
|
let {result:{locations}} = await Protocol.Debugger.getPossibleBreakpoints({
|
|
start: {lineNumber: 0, columnNumber : 0, scriptId}});
|
|
session.logBreakLocations(locations);
|
|
},
|
|
|
|
async function testStepInto() {
|
|
Protocol.Debugger.pause();
|
|
let fin = Protocol.Runtime.evaluate({
|
|
expression: 'testFunction()//# sourceURL=expr.js', awaitPromise: true}).then(() => false);
|
|
let result;
|
|
while (result = await Promise.race([fin, Protocol.Debugger.oncePaused()])) {
|
|
let {params:{callFrames}} = result;
|
|
session.logCallFrames(callFrames);
|
|
session.logSourceLocation(callFrames[0].location);
|
|
Protocol.Debugger.stepInto();
|
|
}
|
|
Protocol.Runtime.evaluate({expression: '42'});
|
|
await Protocol.Debugger.oncePaused();
|
|
await Protocol.Debugger.resume();
|
|
},
|
|
|
|
async function testStepIntoAfterBreakpoint() {
|
|
Protocol.Debugger.setBreakpointByUrl({lineNumber: 10, url: 'test.js'});
|
|
Protocol.Runtime.evaluate({
|
|
expression: 'testFunction()//# sourceURL=expr.js'});
|
|
await awaitPausedAndDump();
|
|
Protocol.Debugger.stepInto();
|
|
await awaitPausedAndDump();
|
|
await Protocol.Debugger.resume();
|
|
|
|
async function awaitPausedAndDump() {
|
|
let {params:{callFrames}} = await Protocol.Debugger.oncePaused();
|
|
session.logCallFrames(callFrames);
|
|
session.logSourceLocation(callFrames[0].location);
|
|
}
|
|
}
|
|
]);
|