[inspector] removed break location right before suspension in async function

In current implementation in expressions like await foo() we have break location right after foo call and before actual await.
And we additionally have a lot of other statement locations because of do scope.

Let's move async debugging closer to sync debugging and introduce only one break location for await - before awaited function call.

Bug: v8:6425,v8:6162
Change-Id: I7568767856022c49101e7f3b7e39a2e401d21644
Reviewed-on: https://chromium-review.googlesource.com/514046
Reviewed-by: Marja Hölttä <marja@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45625}
This commit is contained in:
Alexey Kozyatinskiy 2017-05-31 12:40:31 +01:00 committed by Commit Bot
parent 73cf88d6a0
commit 6f69e3ceca
17 changed files with 1450 additions and 1078 deletions

View File

@ -3872,15 +3872,13 @@ void Parser::RewriteAsyncFunctionBody(ZoneList<Statement*>* body, Block* block,
Expression* Parser::RewriteAwaitExpression(Expression* value, int await_pos) {
// In an Async Function:
// yield do {
// tmp = <operand>;
// %AsyncFunctionAwait(.generator_object, tmp, .promise);
// %AsyncFunctionAwait(.generator_object, <operand>, .promise);
// .promise
// }
//
// In an Async Generator:
// yield do {
// tmp = <operand>;
// %AsyncGeneratorAwait(.generator_object, tmp)
// %AsyncGeneratorAwait(.generator_object, <operand>)
// .await_result_var
// }
//
@ -3894,10 +3892,6 @@ Expression* Parser::RewriteAwaitExpression(Expression* value, int await_pos) {
// ignored. If we yielded the value of the throwawayPromise that
// AsyncFunctionAwait creates as an intermediate, it would create a memory
// leak; we must return .promise instead;
// The operand needs to be evaluated on a separate statement in order to get
// a break location, and the .promise needs to be read earlier so that it
// doesn't insert a false location.
// TODO(littledan): investigate why this ordering is needed in more detail.
//
// In the case of Async Generators, `.await_result_var` is not actually used
// for anything, but exists because of the current requirement that
@ -3909,15 +3903,6 @@ Expression* Parser::RewriteAwaitExpression(Expression* value, int await_pos) {
const int nopos = kNoSourcePosition;
Block* do_block = factory()->NewBlock(nullptr, 2, false, nopos);
// Wrap value evaluation to provide a break location.
Variable* temp_var = NewTemporary(ast_value_factory()->empty_string());
Expression* value_assignment = factory()->NewAssignment(
Token::ASSIGN, factory()->NewVariableProxy(temp_var), value, nopos);
do_block->statements()->Add(
factory()->NewExpressionStatement(value_assignment, value->position()),
zone());
Expression* generator_object =
factory()->NewVariableProxy(generator_object_variable);
@ -3928,18 +3913,16 @@ Expression* Parser::RewriteAwaitExpression(Expression* value, int await_pos) {
// ParseAndRewriteGeneratorFunctionBody)
ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone());
args->Add(generator_object, zone());
args->Add(factory()->NewVariableProxy(temp_var), zone());
args->Add(value, zone());
Expression* await = factory()->NewCallRuntime(
Context::ASYNC_GENERATOR_AWAIT_CAUGHT, args, nopos);
do_block->statements()->Add(
factory()->NewExpressionStatement(await, await_pos), zone());
do_block->statements()->Add(factory()->NewExpressionStatement(await, nopos),
zone());
// Wrap await to provide a break location between value evaluation and
// yield.
Expression* do_expr = factory()->NewDoExpression(
do_block, AsyncGeneratorAwaitVariable(), nopos);
return BuildSuspend(generator_object, do_expr, nopos,
return BuildSuspend(generator_object, do_expr, await_pos,
Suspend::kOnExceptionRethrow, SuspendFlags::kAwait);
}
@ -3948,19 +3931,18 @@ Expression* Parser::RewriteAwaitExpression(Expression* value, int await_pos) {
// there is no local enclosing try/catch block.
ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(3, zone());
args->Add(generator_object, zone());
args->Add(factory()->NewVariableProxy(temp_var), zone());
args->Add(value, zone());
args->Add(factory()->NewVariableProxy(PromiseVariable()), zone());
Expression* await = factory()->NewCallRuntime(
Context::ASYNC_FUNCTION_AWAIT_CAUGHT_INDEX, args, nopos);
do_block->statements()->Add(
factory()->NewExpressionStatement(await, await_pos), zone());
do_block->statements()->Add(factory()->NewExpressionStatement(await, nopos),
zone());
// Wrap await to provide a break location between value evaluation and yield.
Expression* do_expr =
factory()->NewDoExpression(do_block, PromiseVariable(), nopos);
return factory()->NewSuspend(generator_object, do_expr, nopos,
return factory()->NewSuspend(generator_object, do_expr, await_pos,
Suspend::kOnExceptionRethrow,
SuspendFlags::kAwait);
}

File diff suppressed because it is too large Load Diff

View File

@ -1348,248 +1348,246 @@ snippet: "
}
f([1, 2, 3]);
"
frame size: 28
frame size: 27
parameter count: 2
bytecode array length: 550
bytecode array length: 546
bytecodes: [
B(Ldar), R(new_target),
B(JumpIfUndefined), U8(25),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(new_target), U8(1),
B(PushContext), R(13),
B(PushContext), R(12),
B(ResumeGenerator), R(new_target),
B(Star), R(12),
B(Star), R(11),
B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0),
B(LdaSmi), I8(79),
B(Star), R(14),
B(CallRuntime), U16(Runtime::kAbort), R(14), U8(1),
B(Star), R(13),
B(CallRuntime), U16(Runtime::kAbort), R(13), U8(1),
B(LdaSmi), I8(-2),
B(Star), R(12),
B(Star), R(11),
B(CreateFunctionContext), U8(1),
B(PushContext), R(14),
B(PushContext), R(13),
B(Ldar), R(arg0),
B(StaCurrentContextSlot), U8(4),
B(Mov), R(closure), R(15),
B(Mov), R(this), R(16),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(15), U8(2),
B(Mov), R(closure), R(14),
B(Mov), R(this), R(15),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(14), U8(2),
B(Star), R(2),
/* 16 E> */ B(StackCheck),
B(LdaUndefined),
B(Star), R(15),
B(CallJSRuntime), U8(%async_function_promise_create), R(15), U8(1),
B(Star), R(4),
B(Star), R(14),
B(CallJSRuntime), U8(%async_function_promise_create), R(14), U8(1),
B(Star), R(3),
B(Mov), R(context), R(16),
B(Mov), R(context), R(17),
B(Mov), R(context), R(18),
B(LdaZero),
B(Star), R(8),
B(Star), R(7),
B(Mov), R(context), R(20),
B(Mov), R(context), R(21),
B(Mov), R(context), R(22),
/* 40 S> */ B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(22),
B(LdaNamedProperty), R(22), U8(1), U8(3),
B(Star), R(23),
B(LdaNamedProperty), R(23), U8(1), U8(3),
B(Star), R(24),
B(CallProperty0), R(24), R(23), U8(5),
B(CallProperty0), R(23), R(22), U8(5),
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
B(Star), R(6),
B(Ldar), R(12),
B(Star), R(5),
B(Ldar), R(11),
B(SwitchOnSmiNoFeedback), U8(2), U8(1), I8(0),
B(LdaSmi), I8(-2),
/* 40 E> */ B(TestEqualStrictNoFeedback), R(12),
/* 40 E> */ B(TestEqualStrictNoFeedback), R(11),
B(JumpIfTrue), U8(11),
B(LdaSmi), I8(79),
B(Star), R(23),
B(CallRuntime), U16(Runtime::kAbort), R(23), U8(1),
/* 35 S> */ B(LdaNamedProperty), R(6), U8(3), U8(9),
B(Star), R(23),
B(CallProperty0), R(23), R(6), U8(7),
B(Star), R(7),
/* 35 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(7), U8(1),
B(Star), R(22),
B(CallRuntime), U16(Runtime::kAbort), R(22), U8(1),
/* 35 S> */ B(LdaNamedProperty), R(5), U8(3), U8(9),
B(Star), R(22),
B(CallProperty0), R(22), R(5), U8(7),
B(Star), R(6),
/* 35 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1),
B(ToBooleanLogicalNot),
B(JumpIfFalse), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1),
B(LdaNamedProperty), R(7), U8(4), U8(11),
B(JumpIfToBooleanTrue), U8(105),
B(LdaNamedProperty), R(7), U8(5), U8(13),
B(Star), R(9),
B(LdaSmi), I8(2),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1),
B(LdaNamedProperty), R(6), U8(4), U8(11),
B(JumpIfToBooleanTrue), U8(101),
B(LdaNamedProperty), R(6), U8(5), U8(13),
B(Star), R(8),
B(Mov), R(9), R(5),
B(LdaSmi), I8(2),
B(Star), R(7),
B(Mov), R(8), R(4),
/* 26 E> */ B(StackCheck),
B(Mov), R(5), R(0),
/* 45 S> */ B(Nop),
/* 51 S> */ B(Mov), R(5), R(3),
B(Mov), R(4), R(0),
/* 45 S> */ B(LdaUndefined),
B(Star), R(24),
B(Mov), R(2), R(25),
B(Mov), R(5), R(26),
B(Mov), R(4), R(27),
B(CallJSRuntime), U8(%async_function_await_uncaught), R(24), U8(4),
B(Star), R(23),
B(Mov), R(2), R(24),
B(Mov), R(4), R(25),
B(Mov), R(3), R(26),
/* 51 E> */ B(CallJSRuntime), U8(%async_function_await_uncaught), R(23), U8(4),
B(LdaZero),
B(Mov), R(2), R(23),
B(Mov), R(4), R(24),
B(SuspendGenerator), R(23), U8(2),
B(Ldar), R(24),
B(Mov), R(2), R(22),
B(Mov), R(3), R(23),
B(SuspendGenerator), R(22), U8(2),
B(Ldar), R(23),
/* 54 S> */ B(Return),
B(LdaSmi), I8(-2),
B(Star), R(12),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(23), U8(1),
B(Star), R(11),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(22), U8(1),
B(Star), R(23),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(22), U8(1),
B(Star), R(24),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(23), U8(1),
B(Star), R(25),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(25),
B(TestEqualStrictNoFeedback), R(24),
B(JumpIfTrue), U8(28),
B(LdaSmi), I8(2),
B(TestEqualStrictNoFeedback), R(25),
B(TestEqualStrictNoFeedback), R(24),
B(JumpIfTrue), U8(19),
B(LdaTrue),
B(Star), R(27),
B(Mov), R(24), R(26),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(26), U8(2),
B(Star), R(20),
B(LdaZero),
B(Star), R(26),
B(Mov), R(23), R(25),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(25), U8(2),
B(Star), R(19),
B(Jump), U8(63),
B(Ldar), R(24),
B(ReThrow),
B(LdaZero),
B(Star), R(8),
B(JumpLoop), U8(151), I8(0),
B(Star), R(18),
B(Jump), U8(63),
B(Ldar), R(23),
/* 45 E> */ B(ReThrow),
B(LdaZero),
B(Star), R(7),
B(JumpLoop), U8(147), I8(0),
B(Jump), U8(40),
B(Star), R(23),
B(Ldar), R(closure),
B(CreateCatchContext), R(23), U8(6), U8(7),
B(Star), R(22),
B(Ldar), R(closure),
B(CreateCatchContext), R(22), U8(6), U8(7),
B(Star), R(21),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(22),
B(PushContext), R(23),
B(Ldar), R(21),
B(PushContext), R(22),
B(LdaSmi), I8(2),
B(TestEqualStrict), R(8), U8(15),
B(TestEqualStrict), R(7), U8(15),
B(JumpIfFalse), U8(6),
B(LdaSmi), I8(1),
B(Star), R(8),
B(Star), R(7),
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(24),
B(CallRuntime), U16(Runtime::kReThrow), R(24), U8(1),
B(PopContext), R(23),
B(Star), R(23),
B(CallRuntime), U16(Runtime::kReThrow), R(23), U8(1),
B(PopContext), R(22),
B(LdaSmi), I8(-1),
B(Star), R(19),
B(Star), R(18),
B(Jump), U8(8),
B(Star), R(20),
B(LdaSmi), I8(1),
B(Star), R(19),
B(LdaSmi), I8(1),
B(Star), R(18),
B(LdaTheHole),
B(SetPendingMessage),
B(Star), R(21),
B(Star), R(20),
B(LdaZero),
B(TestEqualStrict), R(8), U8(16),
B(TestEqualStrict), R(7), U8(16),
B(JumpIfTrue), U8(104),
B(LdaNamedProperty), R(6), U8(8), U8(17),
B(Star), R(10),
B(LdaNamedProperty), R(5), U8(8), U8(17),
B(Star), R(9),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
B(Jump), U8(93),
B(LdaSmi), I8(1),
B(TestEqualStrict), R(8), U8(20),
B(TestEqualStrict), R(7), U8(20),
B(JumpIfFalse), U8(61),
B(Ldar), R(10),
B(Ldar), R(9),
B(TestTypeOf), U8(5),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(130),
B(Star), R(22),
B(Star), R(21),
B(LdaConstant), U8(9),
B(Star), R(23),
B(CallRuntime), U16(Runtime::kNewTypeError), R(22), U8(2),
B(Throw),
B(Mov), R(context), R(22),
B(Mov), R(10), R(23),
B(Mov), R(6), R(24),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(23), U8(2),
B(Jump), U8(20),
B(Star), R(23),
B(Ldar), R(closure),
B(CreateCatchContext), R(23), U8(6), U8(10),
B(Star), R(22),
B(CallRuntime), U16(Runtime::kNewTypeError), R(21), U8(2),
B(Throw),
B(Mov), R(context), R(21),
B(Mov), R(9), R(22),
B(Mov), R(5), R(23),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(22), U8(2),
B(Jump), U8(20),
B(Star), R(22),
B(Ldar), R(closure),
B(CreateCatchContext), R(22), U8(6), U8(10),
B(Star), R(21),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(22),
B(PushContext), R(23),
B(PopContext), R(23),
B(Ldar), R(21),
B(PushContext), R(22),
B(PopContext), R(22),
B(Jump), U8(27),
B(Mov), R(10), R(22),
B(Mov), R(6), R(23),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(22), U8(2),
B(Star), R(11),
B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(11), U8(1),
B(Mov), R(9), R(21),
B(Mov), R(5), R(22),
B(InvokeIntrinsic), U8(Runtime::k_Call), R(21), U8(2),
B(Star), R(10),
B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(10), U8(1),
B(JumpIfToBooleanFalse), U8(4),
B(Jump), U8(7),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1),
B(Ldar), R(21),
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1),
B(Ldar), R(20),
B(SetPendingMessage),
B(Ldar), R(19),
B(Ldar), R(18),
B(SwitchOnSmiNoFeedback), U8(11), U8(2), I8(0),
B(Jump), U8(13),
B(LdaZero),
B(Star), R(15),
B(Mov), R(20), R(16),
B(Star), R(14),
B(Mov), R(19), R(15),
B(Jump), U8(83),
B(Ldar), R(20),
B(Ldar), R(19),
B(ReThrow),
B(LdaUndefined),
B(Star), R(19),
B(LdaUndefined),
B(Star), R(21),
B(Mov), R(4), R(20),
B(CallJSRuntime), U8(%promise_resolve), R(19), U8(3),
B(LdaZero),
B(Star), R(15),
B(Mov), R(4), R(16),
B(Jump), U8(59),
B(Jump), U8(45),
B(Star), R(19),
B(Ldar), R(closure),
B(CreateCatchContext), R(19), U8(6), U8(13),
B(Star), R(18),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(18),
B(PushContext), R(19),
B(LdaUndefined),
B(Star), R(20),
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(22),
B(LdaFalse),
B(Star), R(23),
B(Mov), R(4), R(21),
B(CallJSRuntime), U8(%promise_internal_reject), R(20), U8(4),
B(PopContext), R(19),
B(Mov), R(3), R(19),
B(CallJSRuntime), U8(%promise_resolve), R(18), U8(3),
B(LdaZero),
B(Star), R(15),
B(Mov), R(4), R(16),
B(Jump), U8(14),
B(LdaSmi), I8(-1),
B(Star), R(15),
B(Jump), U8(8),
B(Star), R(16),
B(LdaSmi), I8(1),
B(Star), R(15),
B(Star), R(14),
B(Mov), R(3), R(15),
B(Jump), U8(59),
B(Jump), U8(45),
B(Star), R(18),
B(Ldar), R(closure),
B(CreateCatchContext), R(18), U8(6), U8(13),
B(Star), R(17),
B(LdaTheHole),
B(SetPendingMessage),
B(Star), R(17),
B(LdaUndefined),
B(Star), R(18),
B(Mov), R(4), R(19),
B(CallJSRuntime), U8(%async_function_promise_release), R(18), U8(2),
B(Ldar), R(17),
B(PushContext), R(18),
B(LdaUndefined),
B(Star), R(19),
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(21),
B(LdaFalse),
B(Star), R(22),
B(Mov), R(3), R(20),
B(CallJSRuntime), U8(%promise_internal_reject), R(19), U8(4),
B(PopContext), R(18),
B(LdaZero),
B(Star), R(14),
B(Mov), R(3), R(15),
B(Jump), U8(14),
B(LdaSmi), I8(-1),
B(Star), R(14),
B(Jump), U8(8),
B(Star), R(15),
B(LdaSmi), I8(1),
B(Star), R(14),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(15),
B(Star), R(16),
B(LdaUndefined),
B(Star), R(17),
B(Mov), R(3), R(18),
B(CallJSRuntime), U8(%async_function_promise_release), R(17), U8(2),
B(Ldar), R(16),
B(SetPendingMessage),
B(Ldar), R(14),
B(SwitchOnSmiNoFeedback), U8(14), U8(2), I8(0),
B(Jump), U8(8),
B(Ldar), R(16),
B(Ldar), R(15),
/* 54 S> */ B(Return),
B(Ldar), R(16),
B(Ldar), R(15),
B(ReThrow),
B(LdaUndefined),
/* 54 S> */ B(Return),
@ -1597,7 +1595,7 @@ bytecodes: [
constant pool: [
Smi [85],
SYMBOL_TYPE,
Smi [99],
Smi [95],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
@ -1613,10 +1611,10 @@ constant pool: [
Smi [9],
]
handlers: [
[64, 505, 511],
[67, 460, 462],
[73, 293, 299],
[76, 253, 255],
[360, 370, 372],
[64, 501, 507],
[67, 456, 458],
[73, 289, 295],
[76, 249, 251],
[356, 366, 368],
]

View File

@ -715,175 +715,173 @@ snippet: "
}
f();
"
frame size: 19
frame size: 18
parameter count: 1
bytecode array length: 369
bytecode array length: 365
bytecodes: [
B(Ldar), R(new_target),
B(JumpIfUndefined), U8(25),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetContext), R(new_target), U8(1),
B(PushContext), R(9),
B(PushContext), R(8),
B(ResumeGenerator), R(new_target),
B(Star), R(8),
B(Star), R(7),
B(SwitchOnSmiNoFeedback), U8(0), U8(1), I8(0),
B(LdaSmi), I8(79),
B(Star), R(10),
B(CallRuntime), U16(Runtime::kAbort), R(10), U8(1),
B(Star), R(9),
B(CallRuntime), U16(Runtime::kAbort), R(9), U8(1),
B(LdaSmi), I8(-2),
B(Star), R(8),
B(Mov), R(closure), R(10),
B(Mov), R(this), R(11),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(10), U8(2),
B(Star), R(7),
B(Mov), R(closure), R(9),
B(Mov), R(this), R(10),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(9), U8(2),
B(Star), R(2),
/* 16 E> */ B(StackCheck),
B(LdaUndefined),
B(Star), R(10),
B(CallJSRuntime), U8(%async_function_promise_create), R(10), U8(1),
B(Star), R(4),
B(Star), R(9),
B(CallJSRuntime), U8(%async_function_promise_create), R(9), U8(1),
B(Star), R(3),
B(Mov), R(context), R(11),
B(Mov), R(context), R(12),
B(Mov), R(context), R(13),
/* 36 S> */ B(LdaZero),
B(Star), R(1),
B(Star), R(5),
B(Star), R(4),
B(LdaSmi), I8(1),
B(Star), R(6),
B(Ldar), R(8),
B(Star), R(5),
B(Ldar), R(7),
B(SwitchOnSmiNoFeedback), U8(1), U8(1), I8(0),
B(LdaSmi), I8(-2),
/* 59 E> */ B(TestEqualStrictNoFeedback), R(8),
/* 59 E> */ B(TestEqualStrictNoFeedback), R(7),
B(JumpIfTrue), U8(11),
B(LdaSmi), I8(79),
B(Star), R(14),
B(CallRuntime), U16(Runtime::kAbort), R(14), U8(1),
B(Star), R(13),
B(CallRuntime), U16(Runtime::kAbort), R(13), U8(1),
B(StackCheck),
B(Mov), R(5), R(0),
B(Mov), R(4), R(0),
B(LdaSmi), I8(1),
B(TestEqual), R(6), U8(3),
B(TestEqual), R(5), U8(3),
B(JumpIfFalse), U8(7),
B(LdaZero),
B(Star), R(6),
B(Star), R(5),
B(Jump), U8(8),
/* 49 S> */ B(Ldar), R(0),
B(Inc), U8(4),
B(Star), R(0),
B(LdaSmi), I8(1),
B(Star), R(7),
B(Star), R(6),
/* 41 S> */ B(LdaSmi), I8(10),
/* 41 E> */ B(TestLessThan), R(0), U8(5),
B(JumpIfFalse), U8(4),
B(Jump), U8(4),
B(Jump), U8(134),
B(Ldar), R(8),
B(Jump), U8(130),
B(Ldar), R(7),
B(SwitchOnSmiNoFeedback), U8(2), U8(1), I8(0),
B(LdaSmi), I8(-2),
B(TestEqualStrictNoFeedback), R(8),
B(TestEqualStrictNoFeedback), R(7),
B(JumpIfTrue), U8(11),
B(LdaSmi), I8(79),
B(Star), R(14),
B(CallRuntime), U16(Runtime::kAbort), R(14), U8(1),
B(Star), R(13),
B(CallRuntime), U16(Runtime::kAbort), R(13), U8(1),
B(LdaSmi), I8(1),
B(TestEqual), R(7), U8(6),
B(JumpIfFalse), U8(94),
B(TestEqual), R(6), U8(6),
B(JumpIfFalse), U8(90),
/* 23 E> */ B(StackCheck),
/* 52 S> */ B(Nop),
/* 58 S> */ B(Mov), R(0), R(3),
/* 52 S> */ B(LdaUndefined),
B(Star), R(15),
B(Mov), R(2), R(16),
B(Mov), R(0), R(17),
B(Mov), R(4), R(18),
B(CallJSRuntime), U8(%async_function_await_uncaught), R(15), U8(4),
B(Star), R(14),
B(Mov), R(2), R(15),
B(Mov), R(0), R(16),
B(Mov), R(3), R(17),
/* 58 E> */ B(CallJSRuntime), U8(%async_function_await_uncaught), R(14), U8(4),
B(LdaZero),
B(Mov), R(2), R(14),
B(Mov), R(4), R(15),
B(SuspendGenerator), R(14), U8(2),
B(Ldar), R(15),
B(Mov), R(2), R(13),
B(Mov), R(3), R(14),
B(SuspendGenerator), R(13), U8(2),
B(Ldar), R(14),
/* 61 S> */ B(Return),
B(LdaSmi), I8(-2),
B(Star), R(8),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(14), U8(1),
B(Star), R(7),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetInputOrDebugPos), R(13), U8(1),
B(Star), R(14),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(13), U8(1),
B(Star), R(15),
B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(14), U8(1),
B(Star), R(16),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(16),
B(TestEqualStrictNoFeedback), R(15),
B(JumpIfTrue), U8(28),
B(LdaSmi), I8(2),
B(TestEqualStrictNoFeedback), R(16),
B(TestEqualStrictNoFeedback), R(15),
B(JumpIfTrue), U8(19),
B(LdaTrue),
B(Star), R(18),
B(Mov), R(15), R(17),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(17), U8(2),
B(Star), R(11),
B(LdaZero),
B(Star), R(17),
B(Mov), R(14), R(16),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(16), U8(2),
B(Star), R(10),
B(Jump), U8(106),
B(Ldar), R(15),
B(ReThrow),
B(LdaZero),
B(Star), R(7),
B(Mov), R(0), R(5),
B(Star), R(9),
B(Jump), U8(106),
B(Ldar), R(14),
/* 52 E> */ B(ReThrow),
B(LdaZero),
B(Star), R(6),
B(Mov), R(0), R(4),
B(Ldar), R(0),
B(JumpLoop), U8(117), I8(1),
B(JumpLoop), U8(113), I8(1),
B(LdaSmi), I8(1),
/* 59 E> */ B(TestEqual), R(7), U8(7),
/* 59 E> */ B(TestEqual), R(6), U8(7),
B(JumpIfFalse), U8(4),
B(Jump), U8(5),
B(JumpLoop), U8(187), I8(0),
B(JumpLoop), U8(183), I8(0),
B(LdaUndefined),
B(Star), R(14),
B(LdaUndefined),
B(Star), R(16),
B(Mov), R(4), R(15),
B(CallJSRuntime), U8(%promise_resolve), R(14), U8(3),
B(LdaZero),
B(Star), R(10),
B(Mov), R(4), R(11),
B(Jump), U8(59),
B(Jump), U8(45),
B(Star), R(14),
B(Ldar), R(closure),
B(CreateCatchContext), R(14), U8(3), U8(4),
B(Star), R(13),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(13),
B(PushContext), R(14),
B(LdaUndefined),
B(Star), R(15),
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(17),
B(LdaFalse),
B(Star), R(18),
B(Mov), R(4), R(16),
B(CallJSRuntime), U8(%promise_internal_reject), R(15), U8(4),
B(PopContext), R(14),
B(Mov), R(3), R(14),
B(CallJSRuntime), U8(%promise_resolve), R(13), U8(3),
B(LdaZero),
B(Star), R(10),
B(Mov), R(4), R(11),
B(Jump), U8(14),
B(LdaSmi), I8(-1),
B(Star), R(10),
B(Jump), U8(8),
B(Star), R(11),
B(LdaSmi), I8(1),
B(Star), R(10),
B(Star), R(9),
B(Mov), R(3), R(10),
B(Jump), U8(59),
B(Jump), U8(45),
B(Star), R(13),
B(Ldar), R(closure),
B(CreateCatchContext), R(13), U8(3), U8(4),
B(Star), R(12),
B(LdaTheHole),
B(SetPendingMessage),
B(Star), R(12),
B(LdaUndefined),
B(Star), R(13),
B(Mov), R(4), R(14),
B(CallJSRuntime), U8(%async_function_promise_release), R(13), U8(2),
B(Ldar), R(12),
B(PushContext), R(13),
B(LdaUndefined),
B(Star), R(14),
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(16),
B(LdaFalse),
B(Star), R(17),
B(Mov), R(3), R(15),
B(CallJSRuntime), U8(%promise_internal_reject), R(14), U8(4),
B(PopContext), R(13),
B(LdaZero),
B(Star), R(9),
B(Mov), R(3), R(10),
B(Jump), U8(14),
B(LdaSmi), I8(-1),
B(Star), R(9),
B(Jump), U8(8),
B(Star), R(10),
B(LdaSmi), I8(1),
B(Star), R(9),
B(LdaTheHole),
B(SetPendingMessage),
B(Ldar), R(10),
B(Star), R(11),
B(LdaUndefined),
B(Star), R(12),
B(Mov), R(3), R(13),
B(CallJSRuntime), U8(%async_function_promise_release), R(12), U8(2),
B(Ldar), R(11),
B(SetPendingMessage),
B(Ldar), R(9),
B(SwitchOnSmiNoFeedback), U8(5), U8(2), I8(0),
B(Jump), U8(8),
B(Ldar), R(11),
B(Ldar), R(10),
/* 61 S> */ B(Return),
B(Ldar), R(11),
B(Ldar), R(10),
B(ReThrow),
B(LdaUndefined),
/* 61 S> */ B(Return),
@ -891,14 +889,14 @@ bytecodes: [
constant pool: [
Smi [54],
Smi [56],
Smi [60],
Smi [56],
ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"],
FIXED_ARRAY_TYPE,
Smi [6],
Smi [9],
]
handlers: [
[56, 324, 330],
[59, 279, 281],
[56, 320, 326],
[59, 275, 277],
]

View File

@ -24,7 +24,7 @@ Debug.setListener(listener);
var late_resolve;
function g() {
return new Promise( // B3 StepOut
return new Promise( // B2 StepOut
function(res, rej) {
late_resolve = res;
}
@ -34,8 +34,8 @@ function g() {
async function f() {
var a = 1;
debugger; // B0 StepNext
a += // B1 StepNext
await // B4 StepNext
a += // B1 StepIn
await
g(); // B2 StepIn
return a;
}
@ -44,10 +44,10 @@ f();
// Starting a new step action at an intermediate break point
// means that we will abort the current async step.
debugger; // B5 StepNext
debugger; // B3 StepNext
late_resolve(3); // B6 Continue
late_resolve(3); // B4 Continue
%RunMicrotasks();
assertEquals(7, step_count);
assertEquals(5, step_count);

View File

@ -24,7 +24,7 @@ Debug.setListener(listener);
var late_resolve;
function g() {
return new Promise( // B3 StepOut
return new Promise( // B2 StepOut
function(res, rej) {
late_resolve = res;
}
@ -34,20 +34,20 @@ function g() {
async function f() {
var a = 1;
debugger; // B0 StepNext
a += // B1 StepNext
a += // B1 StepIn
await // B4 StepNext
g(); // B2 StepIn
return a; // B6 StepNext
} // B7 Continue
return a; // B4 StepNext
} // B5 Continue
f();
// Continuing at an intermediate break point means that we will
// carry on with the current async step.
debugger; // B5 Continue
debugger; // B3 Continue
late_resolve(3);
%RunMicrotasks();
assertEquals(8, step_count);
assertEquals(6, step_count);

View File

@ -24,7 +24,7 @@ Debug.setListener(listener);
var late_resolve;
function g() {
return new Promise( // B3 StepOut
return new Promise( // B2 StepOut
function(res, rej) {
late_resolve = res;
}
@ -34,11 +34,11 @@ function g() {
async function f() {
var a = 1;
debugger; // B0 StepNext
a += // B1 StepNext
await // B4 StepNext
g(); // B2 StepIn
return a; // B5 StepNext
} // B6 Continue
a += // B1 StepIn
await
g();
return a; // B3 StepNext
} // B4 Continue
f();
@ -46,4 +46,4 @@ late_resolve(3);
%RunMicrotasks();
assertEquals(7, step_count);
assertEquals(5, step_count);

View File

@ -24,7 +24,7 @@ Debug.setListener(listener);
var late_resolve;
function g() {
return new Promise( // B3 StepOut
return new Promise( // B2 StepOut
function(res, rej) {
late_resolve = res;
}
@ -34,16 +34,16 @@ function g() {
async function f() {
var a = 1;
debugger; // B0 StepNext
a += // B1 StepNext
await // B4 StepOut
g(); // B2 StepIn
return a;
a += // B1 StepIn
await
g();
return a; // B3 Continue
}
f();
late_resolve(3); // B5 Continue
late_resolve(3);
%RunMicrotasks();
assertEquals(6, step_count);
assertEquals(4, step_count);

View File

@ -24,21 +24,21 @@ Debug.setListener(listener);
var late_resolve;
function g() {
return new Promise( // B3 StepIn
return new Promise( // B2 StepIn
function(res, rej) {
late_resolve = res; // B4 StepIn
} // B5 StepIn
late_resolve = res; // B3 StepIn
} // B4 StepIn
);
} // B6 StepIn
} // B5 StepIn
async function f() {
var a = 1;
debugger; // B0 StepNext
a += // B1 StepIn
await // B7 StepIn
g(); // B2 StepIn
return a; // B8 StepIn
} // B9 Continue
await
g();
return a; // B6 StepIn
} // B7 Continue
f().then(value => assertEquals(4, value));
@ -46,4 +46,4 @@ late_resolve(3);
%RunMicrotasks();
assertEquals(10, step_count);
assertEquals(8, step_count);

View File

@ -24,7 +24,7 @@ Debug.setListener(listener);
var late_resolve;
function g() {
return new Promise( // B5 StepOut
return new Promise( // B3 StepOut
function(res, rej) {
late_resolve = res;
}
@ -34,17 +34,17 @@ function g() {
async function f1() {
var a = 1;
debugger; // B0 StepNext
a += // B1 StepNext
a += // B1 StepIn
await // B7 StepNext
f2(); // B2 StepIn
return a; // B8 StepNext
} // B9 Continue
return a; // B5 StepNext
} // B6 Continue
async function f2() {
var b = 0 + // B3 StepIn
await // B6 StepOut
g(); // B4 StepIn
return b;
var b = 0 + // B2 StepIn
await
g();
return b; // B4 StepOut
}
f1();
@ -53,4 +53,4 @@ late_resolve(3);
%RunMicrotasks();
assertEquals(10, step_count);
assertEquals(7, step_count);

View File

@ -25,13 +25,13 @@ async function f() {
var a = 1;
debugger; // B0 StepNext
a += // B1 StepNext
await // B3 StepNext
5; // B2 StepNext
return a; // B4 StepNext
} // B5 Continue
await
5;
return a; // B2 StepNext
} // B3 Continue
f();
%RunMicrotasks();
assertEquals(6, step_count);
assertEquals(4, step_count);

View File

@ -35,10 +35,10 @@ async function f() {
var a = 1;
debugger; // B0 StepNext
a += // B1 StepNext
await // B3 StepNext
g(); // B2 StepNext
return a; // B4 StepNext
} // B5 Continue
await
g();
return a; // B2 StepNext
} // B3 Continue
f();
@ -46,4 +46,4 @@ late_resolve(3);
%RunMicrotasks();
assertEquals(6, step_count);
assertEquals(4, step_count);

View File

@ -0,0 +1,361 @@
Tests breakable locations in await expression.
Running test: testBreakLocations
function testFunction() {
async function f1() {
for (let x = |_|0; x |_|< 1; ++|_|x) |_|await |C|x;
|_|return await Promise.|C|resolve(2);
|R|}
async function f2() {
let r = |_|await |C|f1() + await |C|f1();
|_|await |C|f1();
|_|await |C|f1().|C|then(x => x |_|* 2|R|);
|_|await [1].|C|map(x => Promise.|C|resolve(x)|R|)[0];
|_|await Promise.|C|resolve().|C|then(x => x |_|* 2|R|);
let p = |_|Promise.|C|resolve(42);
|_|await |C|p;
|_|return r;
|R|}
|_|return |C|f2();
|R|}
Running test: testStepInto
(anonymous) (expr.js:0:0)
testFunction (test.js:18:2)
(anonymous) (expr.js:0:0)
#return f2();
}
f2 (test.js:8:12)
testFunction (test.js:18:9)
(anonymous) (expr.js:0:0)
async function f2() {
let r = #await f1() + await f1();
await f1();
f1 (test.js:3:17)
f2 (test.js:8:18)
testFunction (test.js:18:9)
(anonymous) (expr.js:0:0)
async function f1() {
for (let x = #0; x < 1; ++x) await x;
return await Promise.resolve(2);
f1 (test.js:3:22)
f2 (test.js:8:18)
testFunction (test.js:18:9)
(anonymous) (expr.js:0:0)
async function f1() {
for (let x = 0; x #< 1; ++x) await x;
return await Promise.resolve(2);
f1 (test.js:3:32)
f2 (test.js:8:18)
testFunction (test.js:18:9)
(anonymous) (expr.js:0:0)
async function f1() {
for (let x = 0; x < 1; ++x) #await x;
return await Promise.resolve(2);
f1 (test.js:3:29)
async function f1() {
for (let x = 0; x < 1; ++#x) await x;
return await Promise.resolve(2);
f1 (test.js:3:22)
async function f1() {
for (let x = 0; x #< 1; ++x) await x;
return await Promise.resolve(2);
f1 (test.js:4:4)
for (let x = 0; x < 1; ++x) await x;
#return await Promise.resolve(2);
}
f1 (test.js:5:2)
return await Promise.resolve(2);
#}
f2 (test.js:8:31)
async function f2() {
let r = await f1() + await #f1();
await f1();
f1 (test.js:3:17)
f2 (test.js:8:31)
async function f1() {
for (let x = #0; x < 1; ++x) await x;
return await Promise.resolve(2);
f1 (test.js:3:22)
f2 (test.js:8:31)
async function f1() {
for (let x = 0; x #< 1; ++x) await x;
return await Promise.resolve(2);
f1 (test.js:3:32)
f2 (test.js:8:31)
async function f1() {
for (let x = 0; x < 1; ++x) #await x;
return await Promise.resolve(2);
f1 (test.js:3:29)
async function f1() {
for (let x = 0; x < 1; ++#x) await x;
return await Promise.resolve(2);
f1 (test.js:3:22)
async function f1() {
for (let x = 0; x #< 1; ++x) await x;
return await Promise.resolve(2);
f1 (test.js:4:4)
for (let x = 0; x < 1; ++x) await x;
#return await Promise.resolve(2);
}
f1 (test.js:5:2)
return await Promise.resolve(2);
#}
f2 (test.js:9:4)
let r = await f1() + await f1();
#await f1();
await f1().then(x => x * 2);
f1 (test.js:3:17)
f2 (test.js:9:10)
async function f1() {
for (let x = #0; x < 1; ++x) await x;
return await Promise.resolve(2);
f1 (test.js:3:22)
f2 (test.js:9:10)
async function f1() {
for (let x = 0; x #< 1; ++x) await x;
return await Promise.resolve(2);
f1 (test.js:3:32)
f2 (test.js:9:10)
async function f1() {
for (let x = 0; x < 1; ++x) #await x;
return await Promise.resolve(2);
f1 (test.js:3:29)
async function f1() {
for (let x = 0; x < 1; ++#x) await x;
return await Promise.resolve(2);
f1 (test.js:3:22)
async function f1() {
for (let x = 0; x #< 1; ++x) await x;
return await Promise.resolve(2);
f1 (test.js:4:4)
for (let x = 0; x < 1; ++x) await x;
#return await Promise.resolve(2);
}
f1 (test.js:5:2)
return await Promise.resolve(2);
#}
f2 (test.js:10:4)
await f1();
#await f1().then(x => x * 2);
await [1].map(x => Promise.resolve(x))[0];
f1 (test.js:3:17)
f2 (test.js:10:10)
async function f1() {
for (let x = #0; x < 1; ++x) await x;
return await Promise.resolve(2);
f1 (test.js:3:22)
f2 (test.js:10:10)
async function f1() {
for (let x = 0; x #< 1; ++x) await x;
return await Promise.resolve(2);
f1 (test.js:3:32)
f2 (test.js:10:10)
async function f1() {
for (let x = 0; x < 1; ++x) #await x;
return await Promise.resolve(2);
f1 (test.js:3:29)
async function f1() {
for (let x = 0; x < 1; ++#x) await x;
return await Promise.resolve(2);
f1 (test.js:3:22)
async function f1() {
for (let x = 0; x #< 1; ++x) await x;
return await Promise.resolve(2);
f1 (test.js:4:4)
for (let x = 0; x < 1; ++x) await x;
#return await Promise.resolve(2);
}
f1 (test.js:5:2)
return await Promise.resolve(2);
#}
f1.then.x (test.js:10:27)
await f1();
await f1().then(x => x #* 2);
await [1].map(x => Promise.resolve(x))[0];
f1.then.x (test.js:10:30)
await f1();
await f1().then(x => x * 2#);
await [1].map(x => Promise.resolve(x))[0];
f2 (test.js:11:4)
await f1().then(x => x * 2);
#await [1].map(x => Promise.resolve(x))[0];
await Promise.resolve().then(x => x * 2);
map.x (test.js:11:31)
f2 (test.js:11:14)
await f1().then(x => x * 2);
await [1].map(x => Promise.#resolve(x))[0];
await Promise.resolve().then(x => x * 2);
map.x (test.js:11:41)
f2 (test.js:11:14)
await f1().then(x => x * 2);
await [1].map(x => Promise.resolve(x)#)[0];
await Promise.resolve().then(x => x * 2);
f2 (test.js:12:4)
await [1].map(x => Promise.resolve(x))[0];
#await Promise.resolve().then(x => x * 2);
let p = Promise.resolve(42);
f2 (test.js:13:12)
await Promise.resolve().then(x => x * 2);
let p = #Promise.resolve(42);
await p;
f2 (test.js:14:4)
let p = Promise.resolve(42);
#await p;
return r;
f2 (test.js:15:4)
await p;
#return r;
}
f2 (test.js:16:2)
return r;
#}
Running test: testStepOver
f2 (test.js:8:12)
testFunction (test.js:18:9)
(anonymous) (expr.js:0:0)
async function f2() {
let r = #await f1() + await f1();
await f1();
f2 (test.js:8:31)
async function f2() {
let r = await f1() + await #f1();
await f1();
f2 (test.js:9:4)
let r = await f1() + await f1();
#await f1();
await f1().then(x => x * 2);
f2 (test.js:10:4)
await f1();
#await f1().then(x => x * 2);
await [1].map(x => Promise.resolve(x))[0];
f2 (test.js:11:4)
await f1().then(x => x * 2);
#await [1].map(x => Promise.resolve(x))[0];
await Promise.resolve().then(x => x * 2);
f2 (test.js:12:4)
await [1].map(x => Promise.resolve(x))[0];
#await Promise.resolve().then(x => x * 2);
let p = Promise.resolve(42);
f2 (test.js:13:12)
await Promise.resolve().then(x => x * 2);
let p = #Promise.resolve(42);
await p;
f2 (test.js:14:4)
let p = Promise.resolve(42);
#await p;
return r;
f2 (test.js:15:4)
await p;
#return r;
}
f2 (test.js:16:2)
return r;
#}
Running test: testStepIntoAfterBreakpoint
f2 (test.js:9:4)
let r = await f1() + await f1();
#await f1();
await f1().then(x => x * 2);
f1 (test.js:3:17)
f2 (test.js:9:10)
async function f1() {
for (let x = #0; x < 1; ++x) await x;
return await Promise.resolve(2);
f1 (test.js:3:22)
f2 (test.js:9:10)
async function f1() {
for (let x = 0; x #< 1; ++x) await x;
return await Promise.resolve(2);
f1 (test.js:3:32)
f2 (test.js:9:10)
async function f1() {
for (let x = 0; x < 1; ++x) #await x;
return await Promise.resolve(2);
f1 (test.js:3:29)
async function f1() {
for (let x = 0; x < 1; ++#x) await x;
return await Promise.resolve(2);
f1 (test.js:3:22)
async function f1() {
for (let x = 0; x #< 1; ++x) await x;
return await Promise.resolve(2);
f1 (test.js:4:4)
for (let x = 0; x < 1; ++x) await x;
#return await Promise.resolve(2);
}

View File

@ -0,0 +1,126 @@
// 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 await expression.');
let source = `
function testFunction() {
async function f1() {
for (let x = 0; x < 1; ++x) await x;
return await Promise.resolve(2);
}
async function f2() {
let r = await f1() + await f1();
await f1();
await f1().then(x => x * 2);
await [1].map(x => Promise.resolve(x))[0];
await Promise.resolve().then(x => x * 2);
let p = Promise.resolve(42);
await p;
return r;
}
return f2();
}
//# 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}});
dumpAllLocations(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 testStepOver() {
Protocol.Debugger.pause();
let fin = Protocol.Runtime.evaluate({
expression: 'testFunction()//# sourceURL=expr.js', awaitPromise: true}).then(() => false);
Protocol.Debugger.stepInto();
await Protocol.Debugger.oncePaused();
Protocol.Debugger.stepInto();
await Protocol.Debugger.oncePaused();
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.stepOver();
}
Protocol.Runtime.evaluate({expression: '42'});
await Protocol.Debugger.oncePaused();
await Protocol.Debugger.resume();
},
async function testStepIntoAfterBreakpoint() {
Protocol.Debugger.setBreakpointByUrl({lineNumber: 9, url: 'test.js'});
Protocol.Runtime.evaluate({
expression: 'testFunction()//# sourceURL=expr.js'});
await awaitPausedAndDump();
Protocol.Debugger.stepInto();
await awaitPausedAndDump();
Protocol.Debugger.stepInto();
await awaitPausedAndDump();
Protocol.Debugger.stepInto();
await awaitPausedAndDump();
Protocol.Debugger.stepInto();
await awaitPausedAndDump();
Protocol.Debugger.stepInto();
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);
}
}
]);
function dumpAllLocations(locations) {
var lines = source.split('\n');
var locations = locations.sort((loc1, loc2) => {
if (loc2.lineNumber !== loc1.lineNumber) return loc2.lineNumber - loc1.lineNumber;
return loc2.columnNumber - loc1.columnNumber;
});
for (var location of locations) {
var line = lines[location.lineNumber];
line = line.slice(0, location.columnNumber) + locationMark(location.type) + line.slice(location.columnNumber);
lines[location.lineNumber] = line;
}
lines = lines.filter(line => line.indexOf('//# sourceURL=') === -1);
InspectorTest.log(lines.join('\n') + '\n');
}
function locationMark(type) {
if (type === 'return') return '|R|';
if (type === 'call') return '|C|';
if (type === 'debuggerStatement') return '|D|';
return '|_|';
}

View File

@ -143,20 +143,6 @@ testFunction (test.js:18:4)
let r = #await Promise.resolve(42);
return r;
asyncF (test.js:16:26)
testFunction (test.js:18:4)
(anonymous) (expr.js:0:0)
(async function asyncF() {
let r = await Promise.#resolve(42);
return r;
asyncF (test.js:16:12)
testFunction (test.js:18:4)
(anonymous) (expr.js:0:0)
(async function asyncF() {
let r = #await Promise.resolve(42);
return r;
asyncF (test.js:17:4)
let r = await Promise.resolve(42);
#return r;

View File

@ -227,7 +227,7 @@ async function testPromiseAsyncWithCode() {
var resolveNested;
var p = |C|new Promise(resolve => resolveNested |_|= resolve|R|);
|C|setTimeout(resolveNested, 0);
|_|await |_|p;
|_|await |C|p;
|R|}
|C|setTimeout(returnCall, 0);
|_|await |C|foo();
@ -252,7 +252,7 @@ async function testPromiseComplex() {
|R|}
var x = |_|1;
var y = |_|2;
|C|returnFunction(|C|emptyFunction(), x++, --y, x => 2 |_|* x|R|, |C|returnCall())|C|().a = |_|await |C|foo((a => 2 |_|*a|R|)|C|(5));
|C|returnFunction(|C|emptyFunction(), x++, --y, x => 2 |_|* x|R|, |C|returnCall())|C|().a = await |C|foo((a => 2 |_|*a|R|)|C|(5));
|C|nextTest();
|R|}
|C|main();

View File

@ -803,31 +803,6 @@ async function testAsyncAwait() {
#await asyncFoo();
await awaitBoo();
break at:
async function testAsyncAwait() {
await #asyncFoo();
await awaitBoo();
break at:
async function asyncFoo() {
#await Promise.resolve().then(v => v * 2);
return42();
break at:
async function asyncFoo() {
await Promise.resolve().#then(v => v * 2);
return42();
break at:
async function asyncFoo() {
await Promise.#resolve().then(v => v * 2);
return42();
break at:
async function asyncFoo() {
await Promise.resolve().#then(v => v * 2);
return42();
break at:
async function asyncFoo() {
#await Promise.resolve().then(v => v * 2);
@ -843,16 +818,6 @@ break at:
#}
break at:
async function asyncBoo() {
#await Promise.resolve();
}
break at:
async function asyncBoo() {
await Promise.#resolve();
}
break at:
async function asyncBoo() {
#await Promise.resolve();
@ -890,11 +855,6 @@ break at:
#await foo();
await foo();
break at:
setTimeout(returnCall, 0);
await #foo();
await foo();
break at:
var resolveNested;
var p = #new Promise(resolve => resolveNested = resolve);
@ -920,16 +880,6 @@ break at:
#await p;
}
break at:
setTimeout(resolveNested, 0);
await #p;
}
break at:
setTimeout(resolveNested, 0);
#await p;
}
break at:
var resolveNested;
var p = #new Promise(resolve => resolveNested = resolve);
@ -955,16 +905,6 @@ break at:
#await p;
}
break at:
setTimeout(resolveNested, 0);
await #p;
}
break at:
setTimeout(resolveNested, 0);
#await p;
}
Running test: testPromiseComplex
break at:
@ -1064,7 +1004,7 @@ break at:
break at:
var y = 2;
returnFunction(emptyFunction(), x++, --y, x => 2 * x, returnCall())().a = await #foo((a => 2 *a)(5));
returnFunction(emptyFunction(), x++, --y, x => 2 * x, returnCall())().a = await foo((a => 2 *a)#(5));
nextTest();
break at:
@ -1087,13 +1027,3 @@ break at:
#await Promise.resolve();
return 42;
break at:
async function foo() {
await Promise.#resolve();
return 42;
break at:
async function foo() {
#await Promise.resolve();
return 42;