Commit 98927ea5 authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

[ignition] Be smarter about register allocation in VisitSuspend

Split BytecodeGenerator::VisitSuspend into two pieces, one for
building the suspension code and one for resumption (these
are split into separate Build methods for convenience).
Each gets its own RegisterAllocationScope, which allows us to
reduce the register file size of the empty generator by 1.

For consistency, rename VisitGeneratorPrologue() to
BuildGeneratorPrologue() to match the names of the two
newly-created methods.

Bug: v8:6379
Change-Id: I08a617a44f99706cfff09bf86fb0a25a9cd6e032
Reviewed-on: https://chromium-review.googlesource.com/503593
Commit-Queue: Adam Klein <adamk@chromium.org>
Reviewed-by: 's avatarAleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45318}
parent 762d689c
......@@ -2388,12 +2388,13 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) {
}
}
void BytecodeGenerator::VisitSuspend(Suspend* expr) {
void BytecodeGenerator::BuildGeneratorSuspend(Suspend* expr,
Register generator) {
RegisterAllocationScope register_scope(this);
builder()->SetExpressionPosition(expr);
Register value = VisitForRegisterValue(expr->expression());
Register generator = VisitForRegisterValue(expr->generator_object());
// Save context, registers, and state. Then return.
builder()
->LoadLiteral(Smi::FromInt(expr->suspend_id()))
......@@ -2416,79 +2417,85 @@ void BytecodeGenerator::VisitSuspend(Suspend* expr) {
builder()->LoadAccumulatorWithRegister(value);
}
builder()->Return(); // Hard return (ignore any finally blocks).
}
builder()->Bind(generator_jump_table_, static_cast<int>(expr->suspend_id()));
// Upon resume, we continue here.
{
RegisterAllocationScope register_scope(this);
void BytecodeGenerator::BuildGeneratorResume(Suspend* expr,
Register generator) {
RegisterAllocationScope register_scope(this);
// Update state to indicate that we have finished resuming. Loop headers
// rely on this.
builder()
->LoadLiteral(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))
.StoreAccumulatorInRegister(generator_state_);
// Update state to indicate that we have finished resuming. Loop headers
// rely on this.
builder()
->LoadLiteral(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))
.StoreAccumulatorInRegister(generator_state_);
Register input = register_allocator()->NewRegister();
Register input = register_allocator()->NewRegister();
// When resuming an Async Generator from an Await expression, the sent
// value is in the [[await_input_or_debug_pos]] slot. Otherwise, the sent
// value is in the [[input_or_debug_pos]] slot.
Runtime::FunctionId get_generator_input =
expr->is_async_generator() && expr->is_await()
? Runtime::kInlineAsyncGeneratorGetAwaitInputOrDebugPos
: Runtime::kInlineGeneratorGetInputOrDebugPos;
// When resuming an Async Generator from an Await expression, the sent
// value is in the [[await_input_or_debug_pos]] slot. Otherwise, the sent
// value is in the [[input_or_debug_pos]] slot.
Runtime::FunctionId get_generator_input =
expr->is_async_generator() && expr->is_await()
? Runtime::kInlineAsyncGeneratorGetAwaitInputOrDebugPos
: Runtime::kInlineGeneratorGetInputOrDebugPos;
DCHECK(generator.is_valid());
builder()
->CallRuntime(get_generator_input, generator)
.StoreAccumulatorInRegister(input);
DCHECK(generator.is_valid());
builder()
->CallRuntime(get_generator_input, generator)
.StoreAccumulatorInRegister(input);
Register resume_mode = register_allocator()->NewRegister();
builder()
->CallRuntime(Runtime::kInlineGeneratorGetResumeMode, generator)
.StoreAccumulatorInRegister(resume_mode);
Register resume_mode = register_allocator()->NewRegister();
builder()
->CallRuntime(Runtime::kInlineGeneratorGetResumeMode, generator)
.StoreAccumulatorInRegister(resume_mode);
// Now dispatch on resume mode.
// Now dispatch on resume mode.
BytecodeLabel resume_with_next;
BytecodeLabel resume_with_throw;
BytecodeLabel resume_with_next;
BytecodeLabel resume_with_throw;
builder()
->LoadLiteral(Smi::FromInt(JSGeneratorObject::kNext))
.CompareOperation(Token::EQ_STRICT, resume_mode)
.JumpIfTrue(ToBooleanMode::kAlreadyBoolean, &resume_with_next)
.LoadLiteral(Smi::FromInt(JSGeneratorObject::kThrow))
.CompareOperation(Token::EQ_STRICT, resume_mode)
.JumpIfTrue(ToBooleanMode::kAlreadyBoolean, &resume_with_throw);
// Fall through for resuming with return.
if (expr->is_async_generator()) {
// Async generator methods will produce the iter result object.
builder()->LoadAccumulatorWithRegister(input);
execution_control()->AsyncReturnAccumulator();
} else {
RegisterList args = register_allocator()->NewRegisterList(2);
builder()
->MoveRegister(input, args[0])
.LoadTrue()
.StoreAccumulatorInRegister(args[1])
.CallRuntime(Runtime::kInlineCreateIterResultObject, args);
execution_control()->ReturnAccumulator();
}
builder()->Bind(&resume_with_throw);
builder()->SetExpressionPosition(expr);
builder()
->LoadLiteral(Smi::FromInt(JSGeneratorObject::kNext))
.CompareOperation(Token::EQ_STRICT, resume_mode)
.JumpIfTrue(ToBooleanMode::kAlreadyBoolean, &resume_with_next)
.LoadLiteral(Smi::FromInt(JSGeneratorObject::kThrow))
.CompareOperation(Token::EQ_STRICT, resume_mode)
.JumpIfTrue(ToBooleanMode::kAlreadyBoolean, &resume_with_throw);
// Fall through for resuming with return.
if (expr->is_async_generator()) {
// Async generator methods will produce the iter result object.
builder()->LoadAccumulatorWithRegister(input);
if (expr->rethrow_on_exception()) {
builder()->ReThrow();
} else {
builder()->Throw();
}
execution_control()->AsyncReturnAccumulator();
} else {
RegisterList args = register_allocator()->NewRegisterList(2);
builder()
->MoveRegister(input, args[0])
.LoadTrue()
.StoreAccumulatorInRegister(args[1])
.CallRuntime(Runtime::kInlineCreateIterResultObject, args);
execution_control()->ReturnAccumulator();
}
builder()->Bind(&resume_with_next);
builder()->LoadAccumulatorWithRegister(input);
builder()->Bind(&resume_with_throw);
builder()->SetExpressionPosition(expr);
builder()->LoadAccumulatorWithRegister(input);
if (expr->rethrow_on_exception()) {
builder()->ReThrow();
} else {
builder()->Throw();
}
builder()->Bind(&resume_with_next);
builder()->LoadAccumulatorWithRegister(input);
}
void BytecodeGenerator::VisitSuspend(Suspend* expr) {
Register generator = VisitForRegisterValue(expr->generator_object());
BuildGeneratorSuspend(expr, generator);
builder()->Bind(generator_jump_table_, static_cast<int>(expr->suspend_id()));
// Upon resume, we continue here.
BuildGeneratorResume(expr, generator);
}
void BytecodeGenerator::VisitThrow(Throw* expr) {
......
......@@ -135,6 +135,8 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
void BuildNewLocalWithContext(Scope* scope);
void BuildGeneratorPrologue();
void BuildGeneratorSuspend(Suspend* expr, Register generator);
void BuildGeneratorResume(Suspend* expr, Register generator);
void VisitArgumentsObject(Variable* variable);
void VisitRestArgumentsArray(Variable* rest);
......
......@@ -677,30 +677,30 @@ bytecodes: [
B(LdaImmutableCurrentContextSlot), U8(5),
B(Star), R(10),
B(LdaZero),
/* 11 E> */ B(SuspendGenerator), R(10), U8(0),
B(Ldar), R(9),
/* 11 E> */ B(SuspendGenerator), R(9), U8(0),
B(Ldar), R(10),
/* 55 S> */ B(Return),
B(LdaSmi), I8(-2),
B(Star), R(4),
B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(10), U8(1),
B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(9), U8(1),
B(Star), R(10),
B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(9), U8(1),
B(Star), R(11),
B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(10), U8(1),
B(Star), R(12),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(12),
B(TestEqualStrictNoFeedback), R(11),
B(JumpIfTrue), U8(28),
B(LdaSmi), I8(2),
B(TestEqualStrictNoFeedback), R(12),
B(TestEqualStrictNoFeedback), R(11),
B(JumpIfTrue), U8(19),
B(LdaTrue),
B(Star), R(14),
B(Mov), R(11), R(13),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(13), U8(2),
B(Star), R(13),
B(Mov), R(10), R(12),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(12), U8(2),
B(Star), R(7),
B(LdaZero),
B(Star), R(6),
B(JumpConstant), U8(13),
B(Ldar), R(11),
B(Ldar), R(10),
/* 11 E> */ B(Throw),
B(Ldar), R(closure),
B(CreateBlockContext), U8(1),
......@@ -939,7 +939,7 @@ snippet: "
}
f([1, 2, 3]);
"
frame size: 18
frame size: 17
parameter count: 2
bytecode array length: 740
bytecodes: [
......@@ -970,30 +970,30 @@ bytecodes: [
B(LdaImmutableCurrentContextSlot), U8(5),
B(Star), R(9),
B(LdaZero),
/* 11 E> */ B(SuspendGenerator), R(9), U8(0),
B(Ldar), R(8),
/* 11 E> */ B(SuspendGenerator), R(8), U8(0),
B(Ldar), R(9),
/* 49 S> */ B(Return),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(9), U8(1),
B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(8), U8(1),
B(Star), R(9),
B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(8), U8(1),
B(Star), R(10),
B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(9), U8(1),
B(Star), R(11),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(11),
B(TestEqualStrictNoFeedback), R(10),
B(JumpIfTrue), U8(28),
B(LdaSmi), I8(2),
B(TestEqualStrictNoFeedback), R(11),
B(TestEqualStrictNoFeedback), R(10),
B(JumpIfTrue), U8(19),
B(LdaTrue),
B(Star), R(13),
B(Mov), R(10), R(12),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(12), U8(2),
B(Star), R(12),
B(Mov), R(9), R(11),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(11), U8(2),
B(Star), R(6),
B(LdaZero),
B(Star), R(5),
B(JumpConstant), U8(14),
B(Ldar), R(10),
B(Ldar), R(9),
/* 11 E> */ B(Throw),
B(Ldar), R(closure),
B(CreateBlockContext), U8(2),
......@@ -1053,34 +1053,34 @@ bytecodes: [
B(StaCurrentContextSlot), U8(4),
B(LdaContextSlot), R(1), U8(6), U8(0),
B(StaCurrentContextSlot), U8(4),
/* 40 S> */ B(LdaImmutableCurrentContextSlot), U8(4),
/* 40 S> */ B(LdaImmutableContextSlot), R(1), U8(5), U8(0),
B(Star), R(12),
B(LdaFalse),
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(13),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(12), U8(2),
B(Star), R(12),
B(LdaImmutableContextSlot), R(1), U8(5), U8(0),
B(LdaFalse),
B(Star), R(14),
/* 46 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(13), U8(2),
B(Star), R(13),
B(LdaSmi), I8(1),
B(SuspendGenerator), R(13), U8(0),
B(Ldar), R(12),
B(SuspendGenerator), R(12), U8(0),
B(Ldar), R(13),
/* 49 S> */ B(Return),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(13), U8(1),
B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(12), U8(1),
B(Star), R(13),
B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(12), U8(1),
B(Star), R(14),
B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(13), U8(1),
B(Star), R(15),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(15),
B(TestEqualStrictNoFeedback), R(14),
B(JumpIfTrue), U8(40),
B(LdaSmi), I8(2),
B(TestEqualStrictNoFeedback), R(15),
B(TestEqualStrictNoFeedback), R(14),
B(JumpIfTrue), U8(31),
B(LdaTrue),
B(Star), R(17),
B(Mov), R(14), R(16),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(16), U8(2),
B(Star), R(16),
B(Mov), R(13), R(15),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(15), U8(2),
B(PopContext), R(2),
B(PopContext), R(2),
B(PopContext), R(2),
......@@ -1091,7 +1091,7 @@ bytecodes: [
B(LdaZero),
B(Star), R(8),
B(Jump), U8(71),
B(Ldar), R(14),
B(Ldar), R(13),
/* 40 E> */ B(Throw),
B(PopContext), R(2),
B(LdaZero),
......@@ -1565,7 +1565,7 @@ snippet: "
}
f([1, 2, 3]);
"
frame size: 19
frame size: 18
parameter count: 2
bytecode array length: 765
bytecodes: [
......@@ -1654,41 +1654,41 @@ bytecodes: [
B(StaCurrentContextSlot), U8(4),
B(LdaContextSlot), R(1), U8(8), U8(0),
B(StaCurrentContextSlot), U8(4),
/* 45 S> */ B(LdaImmutableContextSlot), R(1), U8(5), U8(0),
B(Star), R(13),
/* 51 S> */ B(LdaImmutableCurrentContextSlot), U8(4),
B(StaContextSlot), R(1), U8(6), U8(0),
/* 45 S> */ B(LdaUndefined),
B(Star), R(13),
B(LdaImmutableContextSlot), R(1), U8(5), U8(0),
B(Star), R(14),
B(LdaContextSlot), R(1), U8(6), U8(0),
B(LdaImmutableContextSlot), R(1), U8(5), U8(0),
B(Star), R(15),
B(LdaContextSlot), R(1), U8(7), U8(0),
B(LdaContextSlot), R(1), U8(6), U8(0),
B(Star), R(16),
B(CallJSRuntime), U8(%async_function_await_uncaught), R(13), U8(4),
B(LdaContextSlot), R(1), U8(7), U8(0),
B(Star), R(13),
B(LdaImmutableContextSlot), R(1), U8(5), U8(0),
B(Star), R(17),
B(CallJSRuntime), U8(%async_function_await_uncaught), R(14), U8(4),
B(LdaContextSlot), R(1), U8(7), U8(0),
B(Star), R(14),
B(LdaZero),
B(SuspendGenerator), R(14), U8(2),
B(Ldar), R(13),
B(SuspendGenerator), R(13), U8(2),
B(Ldar), R(14),
/* 54 S> */ B(Return),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(14), U8(1),
B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(13), U8(1),
B(Star), R(14),
B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(13), U8(1),
B(Star), R(15),
B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(14), U8(1),
B(Star), R(16),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(16),
B(TestEqualStrictNoFeedback), R(15),
B(JumpIfTrue), U8(40),
B(LdaSmi), I8(2),
B(TestEqualStrictNoFeedback), R(16),
B(TestEqualStrictNoFeedback), R(15),
B(JumpIfTrue), U8(31),
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(17),
B(Mov), R(14), R(16),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(16), U8(2),
B(PopContext), R(2),
B(PopContext), R(2),
B(PopContext), R(2),
......@@ -1699,7 +1699,7 @@ bytecodes: [
B(LdaZero),
B(Star), R(9),
B(Jump), U8(75),
B(Ldar), R(15),
B(Ldar), R(14),
B(ReThrow),
B(PopContext), R(2),
B(LdaZero),
......
......@@ -271,7 +271,7 @@ snippet: "
}
f();
"
frame size: 15
frame size: 14
parameter count: 1
bytecode array length: 350
bytecodes: [
......@@ -300,30 +300,30 @@ bytecodes: [
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(10),
B(LdaZero),
/* 11 E> */ B(SuspendGenerator), R(10), U8(0),
B(Ldar), R(9),
/* 11 E> */ B(SuspendGenerator), R(9), U8(0),
B(Ldar), R(10),
/* 62 S> */ B(Return),
B(LdaSmi), I8(-2),
B(Star), R(4),
B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(10), U8(1),
B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(9), U8(1),
B(Star), R(10),
B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(9), U8(1),
B(Star), R(11),
B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(10), U8(1),
B(Star), R(12),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(12),
B(TestEqualStrictNoFeedback), R(11),
B(JumpIfTrue), U8(28),
B(LdaSmi), I8(2),
B(TestEqualStrictNoFeedback), R(12),
B(TestEqualStrictNoFeedback), R(11),
B(JumpIfTrue), U8(19),
B(LdaTrue),
B(Star), R(14),
B(Mov), R(11), R(13),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(13), U8(2),
B(Star), R(13),
B(Mov), R(10), R(12),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(12), U8(2),
B(Star), R(7),
B(LdaZero),
B(Star), R(6),
B(Jump), U8(193),
B(Ldar), R(11),
B(Ldar), R(10),
/* 11 E> */ B(Throw),
B(Ldar), R(closure),
B(CreateBlockContext), U8(1),
......@@ -453,7 +453,7 @@ snippet: "
}
f();
"
frame size: 14
frame size: 13
parameter count: 1
bytecode array length: 469
bytecodes: [
......@@ -482,30 +482,30 @@ bytecodes: [
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(9),
B(LdaZero),
/* 11 E> */ B(SuspendGenerator), R(9), U8(0),
B(Ldar), R(8),
/* 11 E> */ B(SuspendGenerator), R(8), U8(0),
B(Ldar), R(9),
/* 56 S> */ B(Return),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(9), U8(1),
B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(8), U8(1),
B(Star), R(9),
B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(8), U8(1),
B(Star), R(10),
B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(9), U8(1),
B(Star), R(11),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(11),
B(TestEqualStrictNoFeedback), R(10),
B(JumpIfTrue), U8(28),
B(LdaSmi), I8(2),
B(TestEqualStrictNoFeedback), R(11),
B(TestEqualStrictNoFeedback), R(10),
B(JumpIfTrue), U8(19),
B(LdaTrue),
B(Star), R(13),
B(Mov), R(10), R(12),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(12), U8(2),
B(Star), R(12),
B(Mov), R(9), R(11),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(11), U8(2),
B(Star), R(6),
B(LdaZero),
B(Star), R(5),
B(JumpConstant), U8(6),
B(Ldar), R(10),
B(Ldar), R(9),
/* 11 E> */ B(Throw),
B(Ldar), R(closure),
B(CreateBlockContext), U8(2),
......@@ -569,34 +569,34 @@ bytecodes: [
B(TestEqual), R(8), U8(6),
B(JumpIfFalse), U8(102),
/* 18 E> */ B(StackCheck),
/* 47 S> */ B(LdaCurrentContextSlot), U8(4),
/* 47 S> */ B(LdaImmutableContextSlot), R(1), U8(4), U8(0),
B(Star), R(8),
B(LdaFalse),
B(LdaCurrentContextSlot), U8(4),
B(Star), R(9),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(8), U8(2),
B(Star), R(8),
B(LdaImmutableContextSlot), R(1), U8(4), U8(0),
B(LdaFalse),
B(Star), R(10),
/* 53 E> */ B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(9), U8(2),
B(Star), R(9),
B(LdaSmi), I8(1),
B(SuspendGenerator), R(9), U8(0),
B(Ldar), R(8),
B(SuspendGenerator), R(8), U8(0),
B(Ldar), R(9),
/* 56 S> */ B(Return),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(9), U8(1),
B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(8), U8(1),
B(Star), R(9),
B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(8), U8(1),
B(Star), R(10),
B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(9), U8(1),
B(Star), R(11),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(11),
B(TestEqualStrictNoFeedback), R(10),
B(JumpIfTrue), U8(37),
B(LdaSmi), I8(2),
B(TestEqualStrictNoFeedback), R(11),
B(TestEqualStrictNoFeedback), R(10),
B(JumpIfTrue), U8(28),
B(LdaTrue),
B(Star), R(13),
B(Mov), R(10), R(12),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(12), U8(2),
B(Star), R(12),
B(Mov), R(9), R(11),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(11), U8(2),
B(PopContext), R(2),
B(PopContext), R(2),
B(PopContext), R(1),
......@@ -605,7 +605,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(5),
B(Jump), U8(73),
B(Ldar), R(10),
B(Ldar), R(9),
/* 47 E> */ B(Throw),
B(LdaZero),
B(StaContextSlot), R(1), U8(7), U8(0),
......@@ -862,7 +862,7 @@ snippet: "
}
f();
"
frame size: 15
frame size: 14
parameter count: 1
bytecode array length: 508
bytecodes: [
......@@ -953,41 +953,41 @@ bytecodes: [
B(TestEqual), R(9), U8(6),
B(JumpIfFalse), U8(128),
/* 23 E> */ B(StackCheck),
/* 52 S> */ B(LdaImmutableContextSlot), R(1), U8(4), U8(0),
B(Star), R(9),
/* 58 S> */ B(LdaCurrentContextSlot), U8(4),
B(StaContextSlot), R(1), U8(5), U8(0),
/* 52 S> */ B(LdaUndefined),
B(Star), R(9),
B(LdaImmutableContextSlot), R(1), U8(4), U8(0),
B(Star), R(10),
B(LdaContextSlot), R(1), U8(5), U8(0),
B(LdaImmutableContextSlot), R(1), U8(4), U8(0),
B(Star), R(11),
B(LdaContextSlot), R(1), U8(6), U8(0),
B(LdaContextSlot), R(1), U8(5), U8(0),
B(Star), R(12),
B(CallJSRuntime), U8(%async_function_await_uncaught), R(9), U8(4),
B(LdaContextSlot), R(1), U8(6), U8(0),
B(Star), R(9),
B(LdaImmutableContextSlot), R(1), U8(4), U8(0),
B(Star), R(13),
B(CallJSRuntime), U8(%async_function_await_uncaught), R(10), U8(4),
B(LdaContextSlot), R(1), U8(6), U8(0),
B(Star), R(10),
B(LdaZero),
B(SuspendGenerator), R(10), U8(2),
B(Ldar), R(9),
B(SuspendGenerator), R(9), U8(2),
B(Ldar), R(10),
/* 61 S> */ B(Return),
B(LdaSmi), I8(-2),
B(Star), R(3),
B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(10), U8(1),
B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(9), U8(1),
B(Star), R(10),
B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(9), U8(1),
B(Star), R(11),
B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(10), U8(1),
B(Star), R(12),
B(LdaZero),
B(TestEqualStrictNoFeedback), R(12),
B(TestEqualStrictNoFeedback), R(11),
B(JumpIfTrue), U8(40),
B(LdaSmi), I8(2),
B(TestEqualStrictNoFeedback), R(12),
B(TestEqualStrictNoFeedback), R(11),
B(JumpIfTrue), U8(31),
B(LdaTrue),
B(Star), R(14),
B(Mov), R(11), R(13),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(13), U8(2),
B(Star), R(13),
B(Mov), R(10), R(12),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(12), U8(2),
B(PopContext), R(2),
B(PopContext), R(2),
B(PopContext), R(1),
......@@ -998,7 +998,7 @@ bytecodes: [
B(LdaZero),
B(Star), R(5),
B(Jump), U8(136),
B(Ldar), R(11),
B(Ldar), R(10),
B(ReThrow),
B(LdaZero),
B(StaContextSlot), R(1), U8(9), U8(0),
......
......@@ -204,17 +204,17 @@ function testClasses() {
|R|}
async function asyncFoo() {
|_|await Promise.resolve().then(v => v |_|* 2|R|);
|_|await Promise.|C|resolve().|C|then(v => v |_|* 2|R|);
|C|return42();
|_|await |C|asyncBoo();
|R|}
async function asyncBoo() {
|_|await Promise.resolve();
|_|await Promise.|C|resolve();
|R|}
async function testAsyncAwait() {
|_|await asyncFoo();
|_|await |C|asyncFoo();
|_|await |C|awaitBoo();
|R|}
......@@ -247,7 +247,7 @@ async function testPromiseComplex() {
var testPromise = |C|new Promise(resolve => nextTest |_|= resolve|R|);
async function main() {
async function foo() {
|_|await Promise.resolve();
|_|await Promise.|C|resolve();
|_|return 42;
|R|}
var x = |_|1;
......
......@@ -798,11 +798,21 @@ break at:
Running test: testAsyncAwait
break at:
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);
......@@ -833,6 +843,11 @@ break at:
#}
break at:
async function asyncBoo() {
#await Promise.resolve();
}
break at:
async function asyncBoo() {
await Promise.#resolve();
......@@ -870,6 +885,11 @@ break at:
#setTimeout(returnCall, 0);
await foo();
break at:
setTimeout(returnCall, 0);
#await foo();
await foo();
break at:
setTimeout(returnCall, 0);
await #foo();
......@@ -895,6 +915,11 @@ break at:
#setTimeout(resolveNested, 0);
await p;
break at:
setTimeout(resolveNested, 0);
#await p;
}
break at:
setTimeout(resolveNested, 0);
await #p;
......@@ -925,6 +950,11 @@ break at:
#setTimeout(resolveNested, 0);
await p;
break at:
setTimeout(resolveNested, 0);
#await p;
}
break at:
setTimeout(resolveNested, 0);
await #p;
......@@ -1052,6 +1082,11 @@ break at:
returnFunction(emptyFunction(), x++, --y, x => 2 * x, returnCall())().a = await #foo((a => 2 *a)(5));
nextTest();
break at:
async function foo() {
#await Promise.resolve();
return 42;
break at:
async function foo() {
await Promise.#resolve();
......
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