[Interpreter] Make CallJSRuntime implicitly use undefined reciever.

JS runtime calls are always created with undefined recievers, so make the
bytecode behave similarly to CallUndefinedReciever such that we don't need
to push an explicit undefined register for the receiver for such calls.

Modifies the Async[Generator/Function]Await[Caught/Uncaught] runtime calls
to pass the generator in the first argument rather than the reciever since
these runtime calls were desugered in the bytecode generator and explicitly
passed the generator in the receiver.

Change-Id: I36c8087bb3b663dccd805bfdb1eea04eb6a73269
Reviewed-on: https://chromium-review.googlesource.com/654257
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47870}
This commit is contained in:
Ross McIlroy 2017-09-06 23:48:36 +01:00 committed by Commit Bot
parent 866782e0e0
commit a192639e2f
16 changed files with 257 additions and 349 deletions

View File

@ -128,8 +128,8 @@ void AsyncFunctionBuiltinsAssembler::AsyncFunctionAwait(
// Called by the parser from the desugaring of 'await' when catch
// prediction indicates that there is a locally surrounding catch block.
TF_BUILTIN(AsyncFunctionAwaitCaught, AsyncFunctionBuiltinsAssembler) {
CSA_ASSERT_JS_ARGC_EQ(this, 2);
Node* const generator = Parameter(Descriptor::kReceiver);
CSA_ASSERT_JS_ARGC_EQ(this, 3);
Node* const generator = Parameter(Descriptor::kGenerator);
Node* const awaited = Parameter(Descriptor::kAwaited);
Node* const outer_promise = Parameter(Descriptor::kOuterPromise);
Node* const context = Parameter(Descriptor::kContext);
@ -143,8 +143,8 @@ TF_BUILTIN(AsyncFunctionAwaitCaught, AsyncFunctionBuiltinsAssembler) {
// Called by the parser from the desugaring of 'await' when catch
// prediction indicates no locally surrounding catch block.
TF_BUILTIN(AsyncFunctionAwaitUncaught, AsyncFunctionBuiltinsAssembler) {
CSA_ASSERT_JS_ARGC_EQ(this, 2);
Node* const generator = Parameter(Descriptor::kReceiver);
CSA_ASSERT_JS_ARGC_EQ(this, 3);
Node* const generator = Parameter(Descriptor::kGenerator);
Node* const awaited = Parameter(Descriptor::kAwaited);
Node* const outer_promise = Parameter(Descriptor::kOuterPromise);
Node* const context = Parameter(Descriptor::kContext);

View File

@ -245,7 +245,7 @@ void AsyncGeneratorBuiltinsAssembler::AsyncGeneratorAwaitResumeClosure(
template <typename Descriptor>
void AsyncGeneratorBuiltinsAssembler::AsyncGeneratorAwait(bool is_catchable) {
Node* generator = Parameter(Descriptor::kReceiver);
Node* generator = Parameter(Descriptor::kGenerator);
Node* value = Parameter(Descriptor::kAwaited);
Node* context = Parameter(Descriptor::kContext);

View File

@ -321,8 +321,8 @@ namespace internal {
CPP(ArrayBufferPrototypeSlice) \
\
/* AsyncFunction */ \
TFJ(AsyncFunctionAwaitCaught, 2, kAwaited, kOuterPromise) \
TFJ(AsyncFunctionAwaitUncaught, 2, kAwaited, kOuterPromise) \
TFJ(AsyncFunctionAwaitCaught, 3, kGenerator, kAwaited, kOuterPromise) \
TFJ(AsyncFunctionAwaitUncaught, 3, kGenerator, kAwaited, kOuterPromise) \
TFJ(AsyncFunctionAwaitRejectClosure, 1, kSentError) \
TFJ(AsyncFunctionAwaitResolveClosure, 1, kSentValue) \
TFJ(AsyncFunctionPromiseCreate, 0) \
@ -1050,8 +1050,8 @@ namespace internal {
\
/* Await (proposal-async-iteration/#await), with resume behaviour */ \
/* specific to Async Generators. Internal / Not exposed to JS code. */ \
TFJ(AsyncGeneratorAwaitCaught, 1, kAwaited) \
TFJ(AsyncGeneratorAwaitUncaught, 1, kAwaited) \
TFJ(AsyncGeneratorAwaitCaught, 2, kGenerator, kAwaited) \
TFJ(AsyncGeneratorAwaitUncaught, 2, kGenerator, kAwaited) \
TFJ(AsyncGeneratorAwaitResolveClosure, 1, kValue) \
TFJ(AsyncGeneratorAwaitRejectClosure, 1, kValue) \
TFJ(AsyncGeneratorYieldResolveClosure, 1, kValue) \

View File

@ -1542,7 +1542,7 @@ void BytecodeGraphBuilder::VisitCreateEmptyObjectLiteral() {
environment()->BindAccumulator(literal);
}
Node* const* BytecodeGraphBuilder::GetCallArgumentsFromRegister(
Node* const* BytecodeGraphBuilder::GetCallArgumentsFromRegisters(
Node* callee, Node* receiver, interpreter::Register first_arg,
int arg_count) {
// The arity of the Call node -- includes the callee, receiver and function
@ -1580,8 +1580,8 @@ Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op,
interpreter::Register first_arg = interpreter::Register(receiver.index() + 1);
int arg_count = static_cast<int>(reg_count) - 1;
Node* const* call_args =
GetCallArgumentsFromRegister(callee, receiver_node, first_arg, arg_count);
Node* const* call_args = GetCallArgumentsFromRegisters(callee, receiver_node,
first_arg, arg_count);
return ProcessCallArguments(call_op, call_args, 2 + arg_count);
}
@ -1612,6 +1612,30 @@ void BytecodeGraphBuilder::BuildCall(ConvertReceiverMode receiver_mode,
environment()->BindAccumulator(node, Environment::kAttachFrameState);
}
Node* const* BytecodeGraphBuilder::ProcessCallVarArgs(
ConvertReceiverMode receiver_mode, Node* callee,
interpreter::Register first_reg, int arg_count) {
DCHECK_GE(arg_count, 0);
Node* receiver_node;
interpreter::Register first_arg;
if (receiver_mode == ConvertReceiverMode::kNullOrUndefined) {
// The receiver is implicit (and undefined), the arguments are in
// consecutive registers.
receiver_node = jsgraph()->UndefinedConstant();
first_arg = first_reg;
} else {
// The receiver is the first register, followed by the arguments in the
// consecutive registers.
receiver_node = environment()->LookupRegister(first_reg);
first_arg = interpreter::Register(first_reg.index() + 1);
}
Node* const* call_args = GetCallArgumentsFromRegisters(callee, receiver_node,
first_arg, arg_count);
return call_args;
}
void BytecodeGraphBuilder::BuildCallVarArgs(ConvertReceiverMode receiver_mode) {
DCHECK_EQ(interpreter::Bytecodes::GetReceiverMode(
bytecode_iterator().current_bytecode()),
@ -1622,27 +1646,11 @@ void BytecodeGraphBuilder::BuildCallVarArgs(ConvertReceiverMode receiver_mode) {
size_t reg_count = bytecode_iterator().GetRegisterCountOperand(2);
int const slot_id = bytecode_iterator().GetIndexOperand(3);
Node* receiver_node;
interpreter::Register first_arg;
int arg_count;
if (receiver_mode == ConvertReceiverMode::kNullOrUndefined) {
// The receiver is implicit (and undefined), the arguments are in
// consecutive registers.
receiver_node = jsgraph()->UndefinedConstant();
first_arg = first_reg;
arg_count = static_cast<int>(reg_count);
} else {
// The receiver is the first register, followed by the arguments in the
// consecutive registers.
DCHECK_GE(reg_count, 1);
receiver_node = environment()->LookupRegister(first_reg);
first_arg = interpreter::Register(first_reg.index() + 1);
arg_count = static_cast<int>(reg_count) - 1;
}
int arg_count = receiver_mode == ConvertReceiverMode::kNullOrUndefined
? static_cast<int>(reg_count)
: static_cast<int>(reg_count) - 1;
Node* const* call_args =
GetCallArgumentsFromRegister(callee, receiver_node, first_arg, arg_count);
ProcessCallVarArgs(receiver_mode, callee, first_reg, arg_count);
BuildCall(receiver_mode, call_args, static_cast<size_t>(2 + arg_count),
slot_id);
}
@ -1736,8 +1744,8 @@ void BytecodeGraphBuilder::VisitCallWithSpread() {
size_t reg_count = bytecode_iterator().GetRegisterCountOperand(2);
interpreter::Register first_arg = interpreter::Register(receiver.index() + 1);
int arg_count = static_cast<int>(reg_count) - 1;
Node* const* args =
GetCallArgumentsFromRegister(callee, receiver_node, first_arg, arg_count);
Node* const* args = GetCallArgumentsFromRegisters(callee, receiver_node,
first_arg, arg_count);
int const slot_id = bytecode_iterator().GetIndexOperand(3);
VectorSlotPair feedback = CreateVectorSlotPair(slot_id);
@ -1763,12 +1771,14 @@ void BytecodeGraphBuilder::VisitCallJSRuntime() {
PrepareEagerCheckpoint();
Node* callee = BuildLoadNativeContextField(
bytecode_iterator().GetNativeContextIndexOperand(0));
interpreter::Register receiver = bytecode_iterator().GetRegisterOperand(1);
interpreter::Register first_reg = bytecode_iterator().GetRegisterOperand(1);
size_t reg_count = bytecode_iterator().GetRegisterCountOperand(2);
int arg_count = static_cast<int>(reg_count);
// Create node to perform the JS runtime call.
const Operator* call = javascript()->Call(reg_count + 1);
Node* value = ProcessCallArguments(call, callee, receiver, reg_count);
const Operator* call = javascript()->Call(2 + arg_count);
Node* const* call_args = ProcessCallVarArgs(
ConvertReceiverMode::kNullOrUndefined, callee, first_reg, arg_count);
Node* value = ProcessCallArguments(call, call_args, 2 + arg_count);
environment()->BindAccumulator(value, Environment::kAttachFrameState);
}

View File

@ -120,9 +120,12 @@ class BytecodeGraphBuilder {
Node** EnsureInputBufferSize(int size);
Node* const* GetCallArgumentsFromRegister(Node* callee, Node* receiver,
interpreter::Register first_arg,
int arg_count);
Node* const* GetCallArgumentsFromRegisters(Node* callee, Node* receiver,
interpreter::Register first_arg,
int arg_count);
Node* const* ProcessCallVarArgs(ConvertReceiverMode receiver_mode,
Node* callee, interpreter::Register first_reg,
int arg_count);
Node* ProcessCallArguments(const Operator* call_op, Node* const* args,
int arg_count);
Node* ProcessCallArguments(const Operator* call_op, Node* callee,

View File

@ -304,7 +304,8 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final
Register arg,
RegisterList return_pair);
// Call the JS runtime function with |context_index| and arguments |args|.
// Call the JS runtime function with |context_index| and arguments |args|,
// with no receiver as it is implicitly set to undefined.
BytecodeArrayBuilder& CallJSRuntime(int context_index, RegisterList args);
// Operators (register holds the lhs value, accumulator holds the rhs value).

View File

@ -2299,10 +2299,9 @@ void BytecodeGenerator::BuildAsyncReturn(int source_position) {
.CallRuntime(Runtime::kInlineAsyncGeneratorResolve, args);
} else {
DCHECK(IsAsyncFunction(info()->literal()->kind()));
RegisterList args = register_allocator()->NewRegisterList(3);
Register receiver = args[0];
Register promise = args[1];
Register return_value = args[2];
RegisterList args = register_allocator()->NewRegisterList(2);
Register promise = args[0];
Register return_value = args[1];
builder()->StoreAccumulatorInRegister(return_value);
Variable* var_promise = closure_scope()->promise_var();
@ -2311,8 +2310,6 @@ void BytecodeGenerator::BuildAsyncReturn(int source_position) {
HoleCheckMode::kElided);
builder()
->StoreAccumulatorInRegister(promise)
.LoadUndefined()
.StoreAccumulatorInRegister(receiver)
.CallJSRuntime(Context::PROMISE_RESOLVE_INDEX, args)
.LoadAccumulatorWithRegister(promise);
}
@ -3390,10 +3387,6 @@ void BytecodeGenerator::VisitCallNew(CallNew* expr) {
void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) {
if (expr->is_jsruntime()) {
RegisterList args = register_allocator()->NewGrowableRegisterList();
// Allocate a register for the receiver and load it with undefined.
// TODO(leszeks): If CallJSRuntime always has an undefined receiver, use the
// same mechanism as CallUndefinedReceiver.
BuildPushUndefinedIntoRegisterList(&args);
VisitArguments(expr->arguments(), &args);
builder()->CallJSRuntime(expr->context_index(), args);
} else {

View File

@ -770,13 +770,13 @@ class V8_EXPORT_PRIVATE Bytecodes final {
case Bytecode::kCallUndefinedReceiver0:
case Bytecode::kCallUndefinedReceiver1:
case Bytecode::kCallUndefinedReceiver2:
case Bytecode::kCallJSRuntime:
return ConvertReceiverMode::kNullOrUndefined;
case Bytecode::kCallAnyReceiver:
case Bytecode::kConstruct:
case Bytecode::kCallWithSpread:
case Bytecode::kConstructWithSpread:
case Bytecode::kInvokeIntrinsic:
case Bytecode::kCallJSRuntime:
return ConvertReceiverMode::kAny;
default:
UNREACHABLE();

View File

@ -1832,9 +1832,7 @@ IGNITION_HANDLER(CallJSRuntime, InterpreterAssembler) {
Node* context_index = BytecodeOperandNativeContextIndex(0);
Node* receiver_reg = BytecodeOperandReg(1);
Node* first_arg = RegisterLocation(receiver_reg);
Node* receiver_args_count = BytecodeOperandCount(2);
Node* receiver_count = Int32Constant(1);
Node* args_count = Int32Sub(receiver_args_count, receiver_count);
Node* args_count = BytecodeOperandCount(2);
// Get the function to call from the native context.
Node* context = GetContext();
@ -1843,7 +1841,7 @@ IGNITION_HANDLER(CallJSRuntime, InterpreterAssembler) {
// Call the function.
CallJSAndDispatch(function, context, first_arg, args_count,
ConvertReceiverMode::kAny);
ConvertReceiverMode::kNullOrUndefined);
}
// CallWithSpread <callable> <first_arg> <arg_count>

View File

@ -65,33 +65,27 @@ handlers: [
snippet: "
Math.max(0, ...[1, 2, 3], 4);
"
frame size: 8
frame size: 6
parameter count: 1
bytecode array length: 60
bytecode array length: 51
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 34 S> */ B(LdaUndefined),
B(Star), R(1),
/* 34 E> */ B(LdaGlobal), U8(0), U8(0),
/* 34 S> */ B(LdaGlobal), U8(0), U8(0),
B(Star), R(0),
B(LdaNamedProperty), R(0), U8(1), U8(2),
B(Star), R(2),
B(LdaUndefined),
B(Star), R(4),
B(Star), R(1),
B(CreateArrayLiteral), U8(2), U8(4), U8(37),
B(Star), R(5),
B(LdaUndefined),
B(Star), R(6),
B(Star), R(3),
B(CreateArrayLiteral), U8(3), U8(5), U8(37),
B(Star), R(7),
B(CallJSRuntime), U8(%spread_iterable), R(6), U8(2),
B(Star), R(6),
B(CreateArrayLiteral), U8(4), U8(6), U8(37),
B(Star), R(7),
B(CallJSRuntime), U8(%spread_arguments), R(4), U8(4),
B(Star), R(4),
B(Mov), R(0), R(3),
B(CallJSRuntime), U8(%reflect_apply), R(1), U8(4),
B(CallJSRuntime), U8(%spread_iterable), R(4), U8(1),
B(Star), R(4),
B(CreateArrayLiteral), U8(4), U8(6), U8(37),
B(Star), R(5),
B(CallJSRuntime), U8(%spread_arguments), R(3), U8(3),
B(Star), R(3),
B(Mov), R(0), R(2),
B(CallJSRuntime), U8(%reflect_apply), R(1), U8(3),
B(LdaUndefined),
/* 64 S> */ B(Return),
]

View File

@ -70,16 +70,14 @@ snippet: "
function f() { return %spread_iterable([1]) }
f();
"
frame size: 2
frame size: 1
parameter count: 1
bytecode array length: 15
bytecode array length: 12
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 15 S> */ B(LdaUndefined),
/* 15 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
B(Star), R(0),
B(CreateArrayLiteral), U8(0), U8(0), U8(37),
B(Star), R(1),
B(CallJSRuntime), U8(%spread_iterable), R(0), U8(2),
B(CallJSRuntime), U8(%spread_iterable), R(0), U8(1),
/* 43 S> */ B(Return),
]
constant pool: [

View File

@ -16,7 +16,7 @@ snippet: "
"
frame size: 23
parameter count: 1
bytecode array length: 618
bytecode array length: 603
bytecodes: [
B(Ldar), R(2),
B(JumpIfUndefined), U8(25),
@ -35,9 +35,7 @@ bytecodes: [
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(12), U8(2),
B(Star), R(2),
/* 16 E> */ B(StackCheck),
B(LdaUndefined),
B(Star), R(12),
B(CallJSRuntime), U8(%async_function_promise_create), R(12), U8(1),
B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0),
B(Star), R(10),
B(Mov), R(context), R(14),
B(Mov), R(context), R(15),
@ -223,16 +221,14 @@ bytecodes: [
B(Ldar), R(17),
B(ReThrow),
B(LdaUndefined),
B(Star), R(16),
B(LdaUndefined),
B(Star), R(18),
B(Mov), R(10), R(17),
B(CallJSRuntime), U8(%promise_resolve), R(16), U8(3),
B(Star), R(17),
B(Mov), R(10), R(16),
B(CallJSRuntime), U8(%promise_resolve), R(16), U8(2),
B(LdaZero),
B(Star), R(12),
B(Mov), R(10), R(13),
B(Jump), U8(61),
B(Jump), U8(45),
B(Jump), U8(58),
B(Jump), U8(42),
B(Star), R(16),
B(Ldar), R(closure),
B(CreateCatchContext), R(16), U8(10), U8(15),
@ -241,14 +237,12 @@ bytecodes: [
B(SetPendingMessage),
B(Ldar), R(15),
B(PushContext), R(16),
B(LdaUndefined),
B(Star), R(17),
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(19),
B(Star), R(18),
B(LdaFalse),
B(Star), R(20),
B(Mov), R(10), R(18),
B(CallJSRuntime), U8(%promise_internal_reject), R(17), U8(4),
B(Star), R(19),
B(Mov), R(10), R(17),
B(CallJSRuntime), U8(%promise_internal_reject), R(17), U8(3),
B(PopContext), R(16),
B(LdaZero),
B(Star), R(12),
@ -264,10 +258,7 @@ bytecodes: [
B(LdaTheHole),
B(SetPendingMessage),
B(Star), R(14),
B(LdaUndefined),
B(Star), R(15),
B(Mov), R(10), R(16),
B(CallJSRuntime), U8(%async_function_promise_release), R(15), U8(2),
B(CallJSRuntime), U8(%async_function_promise_release), R(10), U8(1),
B(Ldar), R(14),
B(SetPendingMessage),
B(Ldar), R(12),
@ -281,9 +272,9 @@ bytecodes: [
/* 57 S> */ B(Return),
]
constant pool: [
Smi [99],
Smi [356],
Smi [436],
Smi [96],
Smi [353],
Smi [433],
TUPLE2_TYPE,
SYMBOL_TYPE,
SYMBOL_TYPE,
@ -301,11 +292,11 @@ constant pool: [
Smi [9],
]
handlers: [
[56, 571, 579],
[59, 526, 528],
[65, 274, 282],
[68, 234, 236],
[342, 400, 402],
[53, 562, 570],
[56, 520, 522],
[62, 271, 279],
[65, 231, 233],
[339, 397, 399],
]
---
@ -317,7 +308,7 @@ snippet: "
"
frame size: 23
parameter count: 1
bytecode array length: 650
bytecode array length: 632
bytecodes: [
B(Ldar), R(2),
B(JumpIfUndefined), U8(25),
@ -336,9 +327,7 @@ bytecodes: [
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(12), U8(2),
B(Star), R(2),
/* 16 E> */ B(StackCheck),
B(LdaUndefined),
B(Star), R(12),
B(CallJSRuntime), U8(%async_function_promise_create), R(12), U8(1),
B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0),
B(Star), R(10),
B(Mov), R(context), R(14),
B(Mov), R(context), R(15),
@ -525,20 +514,18 @@ bytecodes: [
B(LdaZero),
B(Star), R(12),
B(Mov), R(17), R(13),
B(Jump), U8(87),
B(Jump), U8(81),
B(Ldar), R(17),
B(ReThrow),
B(LdaUndefined),
B(Star), R(16),
B(LdaUndefined),
B(Star), R(18),
B(Mov), R(10), R(17),
B(CallJSRuntime), U8(%promise_resolve), R(16), U8(3),
B(Star), R(17),
B(Mov), R(10), R(16),
B(CallJSRuntime), U8(%promise_resolve), R(16), U8(2),
B(LdaSmi), I8(1),
B(Star), R(12),
B(Mov), R(10), R(13),
B(Jump), U8(62),
B(Jump), U8(46),
B(Jump), U8(59),
B(Jump), U8(43),
B(Star), R(16),
B(Ldar), R(closure),
B(CreateCatchContext), R(16), U8(10), U8(17),
@ -547,14 +534,12 @@ bytecodes: [
B(SetPendingMessage),
B(Ldar), R(15),
B(PushContext), R(16),
B(LdaUndefined),
B(Star), R(17),
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(19),
B(Star), R(18),
B(LdaFalse),
B(Star), R(20),
B(Mov), R(10), R(18),
B(CallJSRuntime), U8(%promise_internal_reject), R(17), U8(4),
B(Star), R(19),
B(Mov), R(10), R(17),
B(CallJSRuntime), U8(%promise_internal_reject), R(17), U8(3),
B(PopContext), R(16),
B(LdaSmi), I8(1),
B(Star), R(12),
@ -570,20 +555,15 @@ bytecodes: [
B(LdaTheHole),
B(SetPendingMessage),
B(Star), R(14),
B(LdaUndefined),
B(Star), R(15),
B(Mov), R(10), R(16),
B(CallJSRuntime), U8(%async_function_promise_release), R(15), U8(2),
B(CallJSRuntime), U8(%async_function_promise_release), R(10), U8(1),
B(Ldar), R(14),
B(SetPendingMessage),
B(Ldar), R(12),
B(SwitchOnSmiNoFeedback), U8(18), U8(3), I8(0),
B(Jump), U8(24),
B(LdaUndefined),
B(Star), R(15),
B(Mov), R(10), R(16),
B(Mov), R(13), R(17),
B(CallJSRuntime), U8(%promise_resolve), R(15), U8(3),
B(Jump), U8(21),
B(Mov), R(10), R(15),
B(Mov), R(13), R(16),
B(CallJSRuntime), U8(%promise_resolve), R(15), U8(2),
B(Ldar), R(10),
/* 68 S> */ B(Return),
B(Ldar), R(13),
@ -594,9 +574,9 @@ bytecodes: [
/* 68 S> */ B(Return),
]
constant pool: [
Smi [99],
Smi [359],
Smi [439],
Smi [96],
Smi [356],
Smi [436],
TUPLE2_TYPE,
SYMBOL_TYPE,
SYMBOL_TYPE,
@ -613,15 +593,15 @@ constant pool: [
Smi [14],
FIXED_ARRAY_TYPE,
Smi [6],
Smi [19],
Smi [22],
Smi [25],
]
handlers: [
[56, 587, 595],
[59, 541, 543],
[65, 276, 284],
[68, 236, 238],
[345, 403, 405],
[53, 578, 586],
[56, 535, 537],
[62, 273, 281],
[65, 233, 235],
[342, 400, 402],
]
---
@ -636,7 +616,7 @@ snippet: "
"
frame size: 23
parameter count: 1
bytecode array length: 636
bytecode array length: 621
bytecodes: [
B(Ldar), R(2),
B(JumpIfUndefined), U8(25),
@ -655,9 +635,7 @@ bytecodes: [
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(12), U8(2),
B(Star), R(2),
/* 16 E> */ B(StackCheck),
B(LdaUndefined),
B(Star), R(12),
B(CallJSRuntime), U8(%async_function_promise_create), R(12), U8(1),
B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0),
B(Star), R(10),
B(Mov), R(context), R(14),
B(Mov), R(context), R(15),
@ -851,16 +829,14 @@ bytecodes: [
B(Ldar), R(17),
B(ReThrow),
B(LdaUndefined),
B(Star), R(16),
B(LdaUndefined),
B(Star), R(18),
B(Mov), R(10), R(17),
B(CallJSRuntime), U8(%promise_resolve), R(16), U8(3),
B(Star), R(17),
B(Mov), R(10), R(16),
B(CallJSRuntime), U8(%promise_resolve), R(16), U8(2),
B(LdaZero),
B(Star), R(12),
B(Mov), R(10), R(13),
B(Jump), U8(61),
B(Jump), U8(45),
B(Jump), U8(58),
B(Jump), U8(42),
B(Star), R(16),
B(Ldar), R(closure),
B(CreateCatchContext), R(16), U8(10), U8(15),
@ -869,14 +845,12 @@ bytecodes: [
B(SetPendingMessage),
B(Ldar), R(15),
B(PushContext), R(16),
B(LdaUndefined),
B(Star), R(17),
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(19),
B(Star), R(18),
B(LdaFalse),
B(Star), R(20),
B(Mov), R(10), R(18),
B(CallJSRuntime), U8(%promise_internal_reject), R(17), U8(4),
B(Star), R(19),
B(Mov), R(10), R(17),
B(CallJSRuntime), U8(%promise_internal_reject), R(17), U8(3),
B(PopContext), R(16),
B(LdaZero),
B(Star), R(12),
@ -892,10 +866,7 @@ bytecodes: [
B(LdaTheHole),
B(SetPendingMessage),
B(Star), R(14),
B(LdaUndefined),
B(Star), R(15),
B(Mov), R(10), R(16),
B(CallJSRuntime), U8(%async_function_promise_release), R(15), U8(2),
B(CallJSRuntime), U8(%async_function_promise_release), R(10), U8(1),
B(Ldar), R(14),
B(SetPendingMessage),
B(Ldar), R(12),
@ -909,9 +880,9 @@ bytecodes: [
/* 114 S> */ B(Return),
]
constant pool: [
Smi [99],
Smi [374],
Smi [454],
Smi [96],
Smi [371],
Smi [451],
TUPLE2_TYPE,
SYMBOL_TYPE,
SYMBOL_TYPE,
@ -929,11 +900,11 @@ constant pool: [
Smi [9],
]
handlers: [
[56, 589, 597],
[59, 544, 546],
[65, 292, 300],
[68, 252, 254],
[360, 418, 420],
[53, 580, 588],
[56, 538, 540],
[62, 289, 297],
[65, 249, 251],
[357, 415, 417],
]
---
@ -946,12 +917,10 @@ snippet: "
"
frame size: 19
parameter count: 1
bytecode array length: 435
bytecode array length: 417
bytecodes: [
/* 16 E> */ B(StackCheck),
B(LdaUndefined),
B(Star), R(9),
B(CallJSRuntime), U8(%async_function_promise_create), R(9), U8(1),
B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0),
B(Star), R(8),
B(Mov), R(context), R(11),
B(Mov), R(context), R(12),
@ -1071,20 +1040,18 @@ bytecodes: [
B(LdaZero),
B(Star), R(9),
B(Mov), R(14), R(10),
B(Jump), U8(87),
B(Jump), U8(81),
B(Ldar), R(14),
B(ReThrow),
B(LdaUndefined),
B(Star), R(13),
B(LdaUndefined),
B(Star), R(15),
B(Mov), R(8), R(14),
B(CallJSRuntime), U8(%promise_resolve), R(13), U8(3),
B(Star), R(14),
B(Mov), R(8), R(13),
B(CallJSRuntime), U8(%promise_resolve), R(13), U8(2),
B(LdaSmi), I8(1),
B(Star), R(9),
B(Mov), R(8), R(10),
B(Jump), U8(62),
B(Jump), U8(46),
B(Jump), U8(59),
B(Jump), U8(43),
B(Star), R(13),
B(Ldar), R(closure),
B(CreateCatchContext), R(13), U8(7), U8(14),
@ -1093,14 +1060,12 @@ bytecodes: [
B(SetPendingMessage),
B(Ldar), R(12),
B(PushContext), R(13),
B(LdaUndefined),
B(Star), R(14),
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(16),
B(Star), R(15),
B(LdaFalse),
B(Star), R(17),
B(Mov), R(8), R(15),
B(CallJSRuntime), U8(%promise_internal_reject), R(14), U8(4),
B(Star), R(16),
B(Mov), R(8), R(14),
B(CallJSRuntime), U8(%promise_internal_reject), R(14), U8(3),
B(PopContext), R(13),
B(LdaSmi), I8(1),
B(Star), R(9),
@ -1116,20 +1081,15 @@ bytecodes: [
B(LdaTheHole),
B(SetPendingMessage),
B(Star), R(11),
B(LdaUndefined),
B(Star), R(12),
B(Mov), R(8), R(13),
B(CallJSRuntime), U8(%async_function_promise_release), R(12), U8(2),
B(CallJSRuntime), U8(%async_function_promise_release), R(8), U8(1),
B(Ldar), R(11),
B(SetPendingMessage),
B(Ldar), R(9),
B(SwitchOnSmiNoFeedback), U8(15), U8(3), I8(0),
B(Jump), U8(24),
B(LdaUndefined),
B(Star), R(12),
B(Mov), R(8), R(13),
B(Mov), R(10), R(14),
B(CallJSRuntime), U8(%promise_resolve), R(12), U8(3),
B(Jump), U8(21),
B(Mov), R(8), R(12),
B(Mov), R(10), R(13),
B(CallJSRuntime), U8(%promise_resolve), R(12), U8(2),
B(Ldar), R(8),
/* 96 S> */ B(Return),
B(Ldar), R(10),
@ -1156,14 +1116,14 @@ constant pool: [
Smi [14],
FIXED_ARRAY_TYPE,
Smi [6],
Smi [19],
Smi [22],
Smi [25],
]
handlers: [
[13, 372, 380],
[16, 326, 328],
[30, 156, 164],
[33, 116, 118],
[225, 235, 237],
[10, 363, 371],
[13, 320, 322],
[27, 153, 161],
[30, 113, 115],
[222, 232, 234],
]

View File

@ -1035,16 +1035,14 @@ snippet: "
"
frame size: 23
parameter count: 2
bytecode array length: 401
bytecode array length: 386
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(12),
B(Ldar), R(arg0),
B(StaCurrentContextSlot), U8(4),
/* 16 E> */ B(StackCheck),
B(LdaUndefined),
B(Star), R(13),
B(CallJSRuntime), U8(%async_function_promise_create), R(13), U8(1),
B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0),
B(Star), R(11),
B(Mov), R(context), R(15),
B(Mov), R(context), R(16),
@ -1161,16 +1159,14 @@ bytecodes: [
B(Ldar), R(18),
B(ReThrow),
B(LdaUndefined),
B(Star), R(17),
B(LdaUndefined),
B(Star), R(19),
B(Mov), R(11), R(18),
B(CallJSRuntime), U8(%promise_resolve), R(17), U8(3),
B(Star), R(18),
B(Mov), R(11), R(17),
B(CallJSRuntime), U8(%promise_resolve), R(17), U8(2),
B(LdaZero),
B(Star), R(13),
B(Mov), R(11), R(14),
B(Jump), U8(61),
B(Jump), U8(45),
B(Jump), U8(58),
B(Jump), U8(42),
B(Star), R(17),
B(Ldar), R(closure),
B(CreateCatchContext), R(17), U8(4), U8(9),
@ -1179,14 +1175,12 @@ bytecodes: [
B(SetPendingMessage),
B(Ldar), R(16),
B(PushContext), R(17),
B(LdaUndefined),
B(Star), R(18),
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(20),
B(Star), R(19),
B(LdaFalse),
B(Star), R(21),
B(Mov), R(11), R(19),
B(CallJSRuntime), U8(%promise_internal_reject), R(18), U8(4),
B(Star), R(20),
B(Mov), R(11), R(18),
B(CallJSRuntime), U8(%promise_internal_reject), R(18), U8(3),
B(PopContext), R(17),
B(LdaZero),
B(Star), R(13),
@ -1202,10 +1196,7 @@ bytecodes: [
B(LdaTheHole),
B(SetPendingMessage),
B(Star), R(15),
B(LdaUndefined),
B(Star), R(16),
B(Mov), R(11), R(17),
B(CallJSRuntime), U8(%async_function_promise_release), R(16), U8(2),
B(CallJSRuntime), U8(%async_function_promise_release), R(11), U8(1),
B(Ldar), R(15),
B(SetPendingMessage),
B(Ldar), R(13),
@ -1233,11 +1224,11 @@ constant pool: [
Smi [9],
]
handlers: [
[21, 354, 362],
[24, 309, 311],
[30, 152, 160],
[33, 112, 114],
[220, 230, 232],
[18, 345, 353],
[21, 303, 305],
[27, 149, 157],
[30, 109, 111],
[217, 227, 229],
]
---
@ -1249,7 +1240,7 @@ snippet: "
"
frame size: 24
parameter count: 2
bytecode array length: 509
bytecode array length: 494
bytecodes: [
B(Ldar), R(2),
B(JumpIfUndefined), U8(25),
@ -1272,9 +1263,7 @@ bytecodes: [
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(13), U8(2),
B(Star), R(2),
/* 16 E> */ B(StackCheck),
B(LdaUndefined),
B(Star), R(13),
B(CallJSRuntime), U8(%async_function_promise_create), R(13), U8(1),
B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0),
B(Star), R(10),
B(Mov), R(context), R(15),
B(Mov), R(context), R(16),
@ -1416,16 +1405,14 @@ bytecodes: [
B(Ldar), R(18),
B(ReThrow),
B(LdaUndefined),
B(Star), R(17),
B(LdaUndefined),
B(Star), R(19),
B(Mov), R(10), R(18),
B(CallJSRuntime), U8(%promise_resolve), R(17), U8(3),
B(Star), R(18),
B(Mov), R(10), R(17),
B(CallJSRuntime), U8(%promise_resolve), R(17), U8(2),
B(LdaZero),
B(Star), R(13),
B(Mov), R(10), R(14),
B(Jump), U8(61),
B(Jump), U8(45),
B(Jump), U8(58),
B(Jump), U8(42),
B(Star), R(17),
B(Ldar), R(closure),
B(CreateCatchContext), R(17), U8(6), U8(11),
@ -1434,14 +1421,12 @@ bytecodes: [
B(SetPendingMessage),
B(Ldar), R(16),
B(PushContext), R(17),
B(LdaUndefined),
B(Star), R(18),
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(20),
B(Star), R(19),
B(LdaFalse),
B(Star), R(21),
B(Mov), R(10), R(19),
B(CallJSRuntime), U8(%promise_internal_reject), R(18), U8(4),
B(Star), R(20),
B(Mov), R(10), R(18),
B(CallJSRuntime), U8(%promise_internal_reject), R(18), U8(3),
B(PopContext), R(17),
B(LdaZero),
B(Star), R(13),
@ -1457,10 +1442,7 @@ bytecodes: [
B(LdaTheHole),
B(SetPendingMessage),
B(Star), R(15),
B(LdaUndefined),
B(Star), R(16),
B(Mov), R(10), R(17),
B(CallJSRuntime), U8(%async_function_promise_release), R(16), U8(2),
B(CallJSRuntime), U8(%async_function_promise_release), R(10), U8(1),
B(Ldar), R(15),
B(SetPendingMessage),
B(Ldar), R(13),
@ -1474,7 +1456,7 @@ bytecodes: [
/* 54 S> */ B(Return),
]
constant pool: [
Smi [85],
Smi [82],
SYMBOL_TYPE,
Smi [85],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
@ -1490,10 +1472,10 @@ constant pool: [
Smi [9],
]
handlers: [
[64, 462, 470],
[67, 417, 419],
[73, 260, 268],
[76, 220, 222],
[328, 338, 340],
[61, 453, 461],
[64, 411, 413],
[70, 257, 265],
[73, 217, 219],
[325, 335, 337],
]

View File

@ -90,9 +90,9 @@ snippet: "
class A { constructor(...args) { this.args = args; } }
new A(0, ...[1, 2, 3], 4);
"
frame size: 8
frame size: 7
parameter count: 1
bytecode array length: 90
bytecode array length: 81
bytecodes: [
/* 30 E> */ B(StackCheck),
B(CreateClosure), U8(0), U8(0), U8(2),
@ -110,24 +110,18 @@ bytecodes: [
B(CallRuntime), U16(Runtime::kToFastProperties), R(2), U8(1),
B(Star), R(0),
B(Star), R(1),
/* 89 S> */ B(LdaUndefined),
B(Star), R(2),
B(LdaUndefined),
B(Star), R(4),
/* 93 E> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37),
B(Star), R(5),
B(LdaUndefined),
B(Star), R(6),
/* 89 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37),
B(Star), R(3),
B(CreateArrayLiteral), U8(2), U8(2), U8(37),
B(Star), R(7),
B(CallJSRuntime), U8(%spread_iterable), R(6), U8(2),
B(Star), R(6),
B(CreateArrayLiteral), U8(3), U8(3), U8(37),
B(Star), R(7),
B(CallJSRuntime), U8(%spread_arguments), R(4), U8(4),
B(Star), R(4),
B(Mov), R(0), R(3),
B(CallJSRuntime), U8(%reflect_construct), R(2), U8(3),
B(CallJSRuntime), U8(%spread_iterable), R(4), U8(1),
B(Star), R(4),
B(CreateArrayLiteral), U8(3), U8(3), U8(37),
B(Star), R(5),
B(CallJSRuntime), U8(%spread_arguments), R(3), U8(3),
B(Star), R(3),
B(Mov), R(1), R(2),
B(CallJSRuntime), U8(%reflect_construct), R(2), U8(2),
B(LdaUndefined),
/* 116 S> */ B(Return),
]

View File

@ -424,14 +424,12 @@ snippet: "
}
f();
"
frame size: 13
frame size: 12
parameter count: 1
bytecode array length: 152
bytecode array length: 137
bytecodes: [
/* 16 E> */ B(StackCheck),
B(LdaUndefined),
B(Star), R(4),
B(CallJSRuntime), U8(%async_function_promise_create), R(4), U8(1),
B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0),
B(Star), R(3),
B(Mov), R(context), R(6),
B(Mov), R(context), R(7),
@ -447,16 +445,14 @@ bytecodes: [
B(Star), R(1),
B(JumpLoop), U8(17), I8(0),
B(LdaUndefined),
B(Star), R(8),
B(LdaUndefined),
B(Star), R(10),
B(Mov), R(3), R(9),
/* 49 E> */ B(CallJSRuntime), U8(%promise_resolve), R(8), U8(3),
B(Star), R(9),
B(Mov), R(3), R(8),
/* 49 E> */ B(CallJSRuntime), U8(%promise_resolve), R(8), U8(2),
B(LdaZero),
B(Star), R(4),
B(Mov), R(3), R(5),
B(Jump), U8(61),
B(Jump), U8(45),
B(Jump), U8(58),
B(Jump), U8(42),
B(Star), R(8),
B(Ldar), R(closure),
B(CreateCatchContext), R(8), U8(0), U8(1),
@ -465,14 +461,12 @@ bytecodes: [
B(SetPendingMessage),
B(Ldar), R(7),
B(PushContext), R(8),
B(LdaUndefined),
B(Star), R(9),
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(11),
B(Star), R(10),
B(LdaFalse),
B(Star), R(12),
B(Mov), R(3), R(10),
B(CallJSRuntime), U8(%promise_internal_reject), R(9), U8(4),
B(Star), R(11),
B(Mov), R(3), R(9),
B(CallJSRuntime), U8(%promise_internal_reject), R(9), U8(3),
B(PopContext), R(8),
B(LdaZero),
B(Star), R(4),
@ -488,10 +482,7 @@ bytecodes: [
B(LdaTheHole),
B(SetPendingMessage),
B(Star), R(6),
B(LdaUndefined),
B(Star), R(7),
B(Mov), R(3), R(8),
B(CallJSRuntime), U8(%async_function_promise_release), R(7), U8(2),
B(CallJSRuntime), U8(%async_function_promise_release), R(3), U8(1),
B(Ldar), R(6),
B(SetPendingMessage),
B(Ldar), R(4),
@ -511,8 +502,8 @@ constant pool: [
Smi [9],
]
handlers: [
[13, 105, 113],
[16, 60, 62],
[10, 96, 104],
[13, 54, 56],
]
---
@ -522,9 +513,9 @@ snippet: "
}
f();
"
frame size: 13
frame size: 12
parameter count: 1
bytecode array length: 260
bytecode array length: 245
bytecodes: [
B(Ldar), R(1),
B(JumpIfUndefined), U8(25),
@ -543,9 +534,7 @@ bytecodes: [
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
B(Star), R(1),
/* 16 E> */ B(StackCheck),
B(LdaUndefined),
B(Star), R(4),
B(CallJSRuntime), U8(%async_function_promise_create), R(4), U8(1),
B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0),
B(Star), R(2),
B(Mov), R(context), R(6),
B(Mov), R(context), R(7),
@ -586,16 +575,14 @@ bytecodes: [
B(Star), R(0),
B(JumpLoop), U8(82), I8(0),
B(LdaUndefined),
B(Star), R(8),
B(LdaUndefined),
B(Star), R(10),
B(Mov), R(2), R(9),
/* 49 E> */ B(CallJSRuntime), U8(%promise_resolve), R(8), U8(3),
B(Star), R(9),
B(Mov), R(2), R(8),
/* 49 E> */ B(CallJSRuntime), U8(%promise_resolve), R(8), U8(2),
B(LdaZero),
B(Star), R(4),
B(Mov), R(2), R(5),
B(Jump), U8(61),
B(Jump), U8(45),
B(Jump), U8(58),
B(Jump), U8(42),
B(Star), R(8),
B(Ldar), R(closure),
B(CreateCatchContext), R(8), U8(2), U8(3),
@ -604,14 +591,12 @@ bytecodes: [
B(SetPendingMessage),
B(Ldar), R(7),
B(PushContext), R(8),
B(LdaUndefined),
B(Star), R(9),
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(11),
B(Star), R(10),
B(LdaFalse),
B(Star), R(12),
B(Mov), R(2), R(10),
B(CallJSRuntime), U8(%promise_internal_reject), R(9), U8(4),
B(Star), R(11),
B(Mov), R(2), R(9),
B(CallJSRuntime), U8(%promise_internal_reject), R(9), U8(3),
B(PopContext), R(8),
B(LdaZero),
B(Star), R(4),
@ -627,10 +612,7 @@ bytecodes: [
B(LdaTheHole),
B(SetPendingMessage),
B(Star), R(6),
B(LdaUndefined),
B(Star), R(7),
B(Mov), R(2), R(8),
B(CallJSRuntime), U8(%async_function_promise_release), R(7), U8(2),
B(CallJSRuntime), U8(%async_function_promise_release), R(2), U8(1),
B(Ldar), R(6),
B(SetPendingMessage),
B(Ldar), R(4),
@ -644,7 +626,7 @@ bytecodes: [
/* 61 S> */ B(Return),
]
constant pool: [
Smi [48],
Smi [45],
Smi [46],
ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"],
FIXED_ARRAY_TYPE,
@ -652,7 +634,7 @@ constant pool: [
Smi [9],
]
handlers: [
[56, 213, 221],
[59, 168, 170],
[53, 204, 212],
[56, 162, 164],
]

View File

@ -91,34 +91,27 @@ snippet: "
test = new B(1, 2, 3).constructor;
})();
"
frame size: 10
frame size: 8
parameter count: 1
bytecode array length: 72
bytecode array length: 60
bytecodes: [
B(CreateRestParameter),
B(Star), R(2),
B(Mov), R(closure), R(1),
/* 128 E> */ B(StackCheck),
B(Mov), R(2), R(3),
/* 140 S> */ B(LdaUndefined),
/* 140 S> */ B(CallRuntime), U16(Runtime::k_GetSuperConstructor), R(closure), U8(1),
B(Star), R(4),
/* 140 E> */ B(CallRuntime), U16(Runtime::k_GetSuperConstructor), R(closure), U8(1),
B(Star), R(5),
B(LdaUndefined),
B(Star), R(6),
B(CreateArrayLiteral), U8(0), U8(0), U8(37),
B(Star), R(7),
B(LdaUndefined),
B(Star), R(8),
B(Mov), R(2), R(9),
/* 152 E> */ B(CallJSRuntime), U8(%spread_iterable), R(8), U8(2),
B(Star), R(8),
B(CreateArrayLiteral), U8(1), U8(1), U8(37),
B(Star), R(9),
B(CallJSRuntime), U8(%spread_arguments), R(6), U8(4),
B(Star), R(5),
/* 152 E> */ B(CallJSRuntime), U8(%spread_iterable), R(2), U8(1),
B(Star), R(6),
B(Mov), R(0), R(7),
/* 140 E> */ B(CallJSRuntime), U8(%reflect_construct), R(4), U8(4),
B(CreateArrayLiteral), U8(1), U8(1), U8(37),
B(Star), R(7),
B(CallJSRuntime), U8(%spread_arguments), R(5), U8(3),
B(Star), R(5),
B(Mov), R(0), R(6),
/* 140 E> */ B(CallJSRuntime), U8(%reflect_construct), R(4), U8(3),
B(Star), R(4),
B(Ldar), R(this),
/* 140 E> */ B(ThrowSuperAlreadyCalledIfNotHole),