Commit a192639e authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[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/654257Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47870}
parent 866782e0
......@@ -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);
......
......@@ -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);
......
......@@ -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) \
......
......@@ -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,37 +1612,45 @@ void BytecodeGraphBuilder::BuildCall(ConvertReceiverMode receiver_mode,
environment()->BindAccumulator(node, Environment::kAttachFrameState);
}
void BytecodeGraphBuilder::BuildCallVarArgs(ConvertReceiverMode receiver_mode) {
DCHECK_EQ(interpreter::Bytecodes::GetReceiverMode(
bytecode_iterator().current_bytecode()),
receiver_mode);
Node* callee =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
interpreter::Register first_reg = bytecode_iterator().GetRegisterOperand(1);
size_t reg_count = bytecode_iterator().GetRegisterCountOperand(2);
int const slot_id = bytecode_iterator().GetIndexOperand(3);
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;
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;
}
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()),
receiver_mode);
Node* callee =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
interpreter::Register first_reg = bytecode_iterator().GetRegisterOperand(1);
size_t reg_count = bytecode_iterator().GetRegisterCountOperand(2);
int const slot_id = bytecode_iterator().GetIndexOperand(3);
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);
}
......
......@@ -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,
......
......@@ -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).
......
......@@ -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 {
......
......@@ -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();
......
......@@ -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>
......
......@@ -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),
]
......
......@@ -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: [
......
......@@ -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],
]
......@@ -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),
]
......
......@@ -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],
]
......@@ -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(CreateArrayLiteral), U8(0), U8(0), U8(37),
B(Star), R(5),
B(LdaUndefined),
/* 152 E> */ B(CallJSRuntime), U8(%spread_iterable), R(2), U8(1),
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(6),
B(Mov), R(0), R(7),
/* 140 E> */ B(CallJSRuntime), U8(%reflect_construct), R(4), U8(4),
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),
......
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