Commit a9fabeb6 authored by Leszek Swirski's avatar Leszek Swirski Committed by V8 LUCI CQ

[interpreter] Reshuffle registers for super()

Change the constructor and instance registers into a single
constructor_then_instance register, and add some register allocation
scopes to reduce temporary register use. This also allows us to change
FindNonDefaultConstructor to only need one output for both constructor
and instance.

Also make BuildCreateArrayLiteral a bit more friendly to the interpreter
register allocation.,

Bug: v8:13091
Change-Id: I0b6015b0bc6810bb4607157d715b7e536efb89f3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3876386Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83077}
parent c7bf46ea
......@@ -1164,7 +1164,6 @@ void BaselineCompiler::VisitFindNonDefaultConstructor() {
CallBuiltin<Builtin::kFindNonDefaultConstructor>(RegisterOperand(0),
RegisterOperand(1));
StoreRegister(2, kReturnRegister1);
StoreRegister(3, kReturnRegister2);
}
namespace {
......
......@@ -1519,13 +1519,13 @@ TF_BUILTIN(FindNonDefaultConstructor, CodeStubAssembler) {
// Create an object directly, without calling the default base ctor.
TNode<Object> instance = CallBuiltin(Builtin::kFastNewObject, context,
constructor.value(), new_target);
Return(TrueConstant(), constructor.value(), instance);
Return(TrueConstant(), instance);
}
BIND(&found_something_else);
{
// Not a base ctor (or bailed out).
Return(FalseConstant(), constructor.value(), UndefinedConstant());
Return(FalseConstant(), constructor.value());
}
}
......
......@@ -1821,11 +1821,10 @@ class FindNonDefaultConstructorDescriptor
: public StaticCallInterfaceDescriptor<
FindNonDefaultConstructorDescriptor> {
public:
DEFINE_RESULT_AND_PARAMETERS(3, kThisFunction, kNewTarget)
DEFINE_RESULT_AND_PARAMETERS(2, kThisFunction, kNewTarget)
DEFINE_RESULT_AND_PARAMETER_TYPES(
MachineType::AnyTagged(), // result 1 (true / false)
MachineType::AnyTagged(), // result 2 (constructor)
MachineType::AnyTagged(), // result 3 (instance)
MachineType::AnyTagged(), // result 2 (constructor_or_instance)
MachineType::AnyTagged(), // kThisFunction
MachineType::AnyTagged()) // kNewTarget
DECLARE_DESCRIPTOR(FindNonDefaultConstructorDescriptor)
......
......@@ -527,10 +527,10 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::GetSuperConstructor(Register out) {
}
BytecodeArrayBuilder& BytecodeArrayBuilder::FindNonDefaultConstructor(
Register this_function, Register new_target, Register constructor,
Register instance) {
OutputFindNonDefaultConstructor(this_function, new_target, constructor,
instance);
Register this_function, Register new_target,
Register constructor_or_instance) {
OutputFindNonDefaultConstructor(this_function, new_target,
constructor_or_instance);
return *this;
}
......
......@@ -386,10 +386,9 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final {
// throws a TypeError exception.
BytecodeArrayBuilder& GetSuperConstructor(Register out);
BytecodeArrayBuilder& FindNonDefaultConstructor(Register this_function,
Register new_target,
Register constructor,
Register instance);
BytecodeArrayBuilder& FindNonDefaultConstructor(
Register this_function, Register new_target,
Register constructor_or_instance);
// Deletes property from an object. This expects that accumulator contains
// the key to be deleted and the register contains a reference to the object.
......
......@@ -3369,8 +3369,10 @@ void BytecodeGenerator::BuildFillArrayWithIterator(
void BytecodeGenerator::BuildCreateArrayLiteral(
const ZonePtrList<Expression>* elements, ArrayLiteral* expr) {
RegisterAllocationScope register_scope(this);
Register index = register_allocator()->NewRegister();
// Make this the first register allocated so that it has a chance of aliasing
// the next register allocated after returning from this function.
Register array = register_allocator()->NewRegister();
Register index = register_allocator()->NewRegister();
SharedFeedbackSlot element_slot(feedback_spec(),
FeedbackSlotKind::kStoreInArrayLiteral);
ZonePtrList<Expression>::const_iterator current = elements->begin();
......@@ -5646,35 +5648,48 @@ void BytecodeGenerator::VisitCallSuper(Call* expr) {
// Prepare the constructor to the super call.
Register this_function = VisitForRegisterValue(super->this_function_var());
Register instance = register_allocator()->NewRegister();
// This register will initially hold the constructor, then afterward it will
// hold the instance -- the lifetimes of the two don't need to overlap, and
// this way FindNonDefaultConstructor can choose to write either the instance
// or the constructor into the same register.
Register constructor_then_instance = register_allocator()->NewRegister();
BytecodeLabel super_ctor_call_done;
bool omit_super_ctor = FLAG_omit_default_ctors &&
IsDerivedConstructor(info()->literal()->kind());
if (spread_position == Call::kHasNonFinalSpread) {
// First generate the array containing all arguments.
RegisterAllocationScope register_scope(this);
RegisterList construct_args(constructor_then_instance);
const Register& constructor = constructor_then_instance;
// Generate the array containing all arguments.
BuildCreateArrayLiteral(args, nullptr);
RegisterList construct_args = register_allocator()->NewRegisterList(3);
builder()->StoreAccumulatorInRegister(construct_args[1]);
VisitForRegisterValue(super->new_target_var(), construct_args[2]);
Register args_array =
register_allocator()->GrowRegisterList(&construct_args);
builder()->StoreAccumulatorInRegister(args_array);
Register new_target =
register_allocator()->GrowRegisterList(&construct_args);
VisitForRegisterValue(super->new_target_var(), new_target);
if (omit_super_ctor) {
BuildSuperCallOptimization(this_function, construct_args[2],
construct_args[0], instance,
BuildSuperCallOptimization(this_function, new_target,
constructor_then_instance,
&super_ctor_call_done);
} else {
builder()
->LoadAccumulatorWithRegister(this_function)
.GetSuperConstructor(construct_args[0]);
.GetSuperConstructor(constructor);
}
// Check if the constructor is in fact a constructor.
builder()->ThrowIfNotSuperConstructor(construct_args[0]);
builder()->ThrowIfNotSuperConstructor(constructor);
// Now pass that array to %reflect_construct.
builder()->CallJSRuntime(Context::REFLECT_CONSTRUCT_INDEX, construct_args);
} else {
RegisterAllocationScope register_scope(this);
RegisterList args_regs = register_allocator()->NewGrowableRegisterList();
VisitArguments(args, &args_regs);
......@@ -5683,10 +5698,11 @@ void BytecodeGenerator::VisitCallSuper(Call* expr) {
Register new_target = register_allocator()->NewRegister();
VisitForRegisterValue(super->new_target_var(), new_target);
Register constructor = register_allocator()->NewRegister();
const Register& constructor = constructor_then_instance;
if (omit_super_ctor) {
BuildSuperCallOptimization(this_function, new_target, constructor,
instance, &super_ctor_call_done);
BuildSuperCallOptimization(this_function, new_target,
constructor_then_instance,
&super_ctor_call_done);
} else {
builder()
->LoadAccumulatorWithRegister(this_function)
......@@ -5715,6 +5731,9 @@ void BytecodeGenerator::VisitCallSuper(Call* expr) {
builder()->Construct(constructor, args_regs, feedback_slot_index);
}
}
// From here onwards, constructor_then_instance will hold the instance.
const Register& instance = constructor_then_instance;
builder()->StoreAccumulatorInRegister(instance);
builder()->Bind(&super_ctor_call_done);
......@@ -5769,11 +5788,11 @@ void BytecodeGenerator::VisitCallSuper(Call* expr) {
}
void BytecodeGenerator::BuildSuperCallOptimization(
Register this_function, Register new_target, Register constructor,
Register instance, BytecodeLabel* super_ctor_call_done) {
Register this_function, Register new_target,
Register constructor_then_instance, BytecodeLabel* super_ctor_call_done) {
DCHECK(FLAG_omit_default_ctors);
builder()->FindNonDefaultConstructor(this_function, new_target, constructor,
instance);
builder()->FindNonDefaultConstructor(this_function, new_target,
constructor_then_instance);
builder()->JumpIfTrue(ToBooleanMode::kAlreadyBoolean, super_ctor_call_done);
}
......
......@@ -407,7 +407,7 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
void BuildOptionalChain(ExpressionFunc expression_func);
void BuildSuperCallOptimization(Register this_function, Register new_target,
Register constructor, Register instance,
Register constructor_then_instance,
BytecodeLabel* super_ctor_call_done);
// Visitors for obtaining expression result in the accumulator, in a
......
......@@ -229,8 +229,7 @@ namespace interpreter {
V(GetSuperConstructor, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kRegOut) \
V(FindNonDefaultConstructor, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kReg, OperandType::kReg, OperandType::kRegOut, \
OperandType::kRegOut) \
OperandType::kReg, OperandType::kReg, OperandType::kRegOut) \
\
/* Call operations */ \
V(CallAnyReceiver, ImplicitRegisterUse::kWriteAccumulator, \
......
......@@ -2781,14 +2781,14 @@ IGNITION_HANDLER(ThrowIfNotSuperConstructor, InterpreterAssembler) {
}
}
// FinNonDefaultConstructor <this_function> <new_target> <constructor>
// <instance>
// FinNonDefaultConstructor <this_function> <new_target>
// <constructor_or_instance>
//
// Walks the prototype chain from <this_function>'s super ctor until we see a
// non-default ctor. If the walk ends at a default base ctor, creates an
// instance and stores it in <instance> and stores true into the accumulator.
// Otherwise, stores the first non-default ctor into <constructor> and false
// into the accumulator.
// instance and stores it in <constructor_or_instance> and stores true into the
// accumulator. Otherwise, stores the first non-default ctor into
// <constructor_or_instance> and false into the accumulator.
IGNITION_HANDLER(FindNonDefaultConstructor, InterpreterAssembler) {
TNode<Context> context = GetContext();
TVARIABLE(Object, constructor);
......@@ -2806,7 +2806,7 @@ IGNITION_HANDLER(FindNonDefaultConstructor, InterpreterAssembler) {
TNode<Object> new_target = LoadRegisterAtOperandIndex(1);
TNode<Object> instance = CallBuiltin(Builtin::kFastNewObject, context,
constructor.value(), new_target);
StoreRegisterAtOperandIndex(instance, 3);
StoreRegisterAtOperandIndex(instance, 2);
SetAccumulator(TrueConstant());
Dispatch();
}
......
......@@ -33,17 +33,17 @@ bytecodes: [
/* 42 S> */ B(LdaSmi), I8(1),
B(Star0),
/* 45 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
B(Star2),
B(LdaZero),
B(Star1),
B(LdaZero),
B(Star2),
B(Ldar), R(0),
/* 54 E> */ B(StaInArrayLiteral), R(2), R(1), U8(1),
/* 54 E> */ B(StaInArrayLiteral), R(1), R(2), U8(1),
B(LdaSmi), I8(1),
B(Star1),
B(Star2),
B(Ldar), R(0),
/* 59 E> */ B(AddSmi), I8(1), U8(3),
B(StaInArrayLiteral), R(2), R(1), U8(1),
B(Ldar), R(2),
B(StaInArrayLiteral), R(1), R(2), U8(1),
B(Ldar), R(1),
/* 65 S> */ B(Return),
]
constant pool: [
......@@ -80,29 +80,29 @@ bytecodes: [
/* 42 S> */ B(LdaSmi), I8(1),
B(Star0),
/* 45 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(4),
B(Star2),
B(LdaZero),
B(Star1),
B(CreateArrayLiteral), U8(1), U8(1), U8(37),
B(Star4),
B(LdaZero),
B(Star2),
B(CreateArrayLiteral), U8(1), U8(1), U8(37),
B(Star3),
B(LdaZero),
B(Star4),
B(Ldar), R(0),
/* 56 E> */ B(StaInArrayLiteral), R(4), R(3), U8(2),
B(Ldar), R(4),
B(StaInArrayLiteral), R(2), R(1), U8(4),
/* 56 E> */ B(StaInArrayLiteral), R(3), R(4), U8(2),
B(Ldar), R(3),
B(StaInArrayLiteral), R(1), R(2), U8(4),
B(LdaSmi), I8(1),
B(Star1),
B(Star2),
B(CreateArrayLiteral), U8(2), U8(6), U8(37),
B(Star4),
B(LdaZero),
B(Star3),
B(LdaZero),
B(Star4),
B(Ldar), R(0),
/* 68 E> */ B(AddSmi), I8(2), U8(7),
B(StaInArrayLiteral), R(4), R(3), U8(8),
B(Ldar), R(4),
B(StaInArrayLiteral), R(2), R(1), U8(4),
B(Ldar), R(2),
B(StaInArrayLiteral), R(3), R(4), U8(8),
B(Ldar), R(3),
B(StaInArrayLiteral), R(1), R(2), U8(4),
B(Ldar), R(1),
/* 76 S> */ B(Return),
]
constant pool: [
......@@ -143,9 +143,9 @@ bytecodes: [
/* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
B(Star0),
/* 52 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37),
B(Star2),
B(Star1),
B(LdaSmi), I8(1),
/* 67 S> */ B(Star1),
/* 67 S> */ B(Star2),
/* 67 E> */ B(GetIterator), R(0), U8(2), U8(4),
B(Star4),
B(GetNamedProperty), R(4), U8(2), U8(6),
......@@ -157,12 +157,12 @@ bytecodes: [
B(GetNamedProperty), R(5), U8(3), U8(17),
B(JumpIfToBooleanTrue), U8(19),
B(GetNamedProperty), R(5), U8(4), U8(8),
B(StaInArrayLiteral), R(2), R(1), U8(13),
B(Ldar), R(1),
B(StaInArrayLiteral), R(1), R(2), U8(13),
B(Ldar), R(2),
B(Inc), U8(12),
B(Star1),
B(Star2),
B(JumpLoop), U8(31), I8(0), U8(19),
B(Ldar), R(2),
B(Ldar), R(1),
/* 71 S> */ B(Return),
]
constant pool: [
......@@ -186,12 +186,12 @@ bytecodes: [
/* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
B(Star0),
/* 64 S> */ B(CreateArrayFromIterable),
B(Star2),
B(GetNamedProperty), R(2), U8(1), U8(1),
B(Star1),
B(GetNamedProperty), R(1), U8(1), U8(1),
B(Star2),
B(LdaSmi), I8(3),
B(StaInArrayLiteral), R(2), R(1), U8(3),
B(Ldar), R(2),
B(StaInArrayLiteral), R(1), R(2), U8(3),
B(Ldar), R(1),
/* 71 S> */ B(Return),
]
constant pool: [
......
......@@ -65,16 +65,16 @@ snippet: "
"
frame size: 7
parameter count: 1
bytecode array length: 82
bytecode array length: 79
bytecodes: [
/* 34 S> */ B(LdaGlobal), U8(0), U8(0),
B(Star1),
/* 39 E> */ B(GetNamedProperty), R(1), U8(1), U8(2),
B(Star0),
B(CreateArrayLiteral), U8(2), U8(4), U8(37),
B(Star3),
B(LdaSmi), I8(1),
B(Star2),
B(LdaSmi), I8(1),
B(Star3),
/* 49 S> */ B(CreateArrayLiteral), U8(3), U8(5), U8(37),
B(Star6),
/* 49 E> */ B(GetIterator), R(6), U8(6), U8(8),
......@@ -88,14 +88,13 @@ bytecodes: [
B(GetNamedProperty), R(6), U8(5), U8(21),
B(JumpIfToBooleanTrue), U8(19),
B(GetNamedProperty), R(6), U8(6), U8(12),
B(StaInArrayLiteral), R(3), R(2), U8(17),
B(Ldar), R(2),
B(StaInArrayLiteral), R(2), R(3), U8(17),
B(Ldar), R(3),
B(Inc), U8(16),
B(Star2),
B(Star3),
B(JumpLoop), U8(31), I8(0), U8(23),
B(LdaSmi), I8(4),
B(StaInArrayLiteral), R(3), R(2), U8(17),
B(Mov), R(3), R(2),
B(StaInArrayLiteral), R(2), R(3), U8(17),
/* 39 E> */ B(CallJSRuntime), U8(%reflect_apply), R(0), U8(3),
B(LdaUndefined),
/* 64 S> */ B(Return),
......
......@@ -87,7 +87,7 @@ snippet: "
test = new B().constructor;
})();
"
frame size: 7
frame size: 5
parameter count: 1
bytecode array length: 39
bytecodes: [
......@@ -95,10 +95,10 @@ bytecodes: [
/* 118 S> */ B(LdaSmi), I8(1),
B(Star4),
B(Ldar), R(1),
/* 118 E> */ B(GetSuperConstructor), R(6),
B(ThrowIfNotSuperConstructor), R(6),
/* 118 E> */ B(GetSuperConstructor), R(3),
B(ThrowIfNotSuperConstructor), R(3),
B(Ldar), R(0),
/* 118 E> */ B(Construct), R(6), R(4), U8(1), U8(0),
/* 118 E> */ B(Construct), R(3), R(4), U8(1), U8(0),
B(Star3),
B(Ldar), R(this),
B(ThrowSuperAlreadyCalledIfNotHole),
......@@ -130,16 +130,16 @@ snippet: "
test = new B().constructor;
})();
"
frame size: 6
frame size: 4
parameter count: 1
bytecode array length: 36
bytecodes: [
B(Mov), R(closure), R(1),
/* 117 S> */ B(Ldar), R(1),
/* 117 E> */ B(GetSuperConstructor), R(5),
B(ThrowIfNotSuperConstructor), R(5),
/* 117 E> */ B(GetSuperConstructor), R(3),
B(ThrowIfNotSuperConstructor), R(3),
B(Ldar), R(0),
/* 117 E> */ B(Construct), R(5), R(0), U8(0), U8(0),
/* 117 E> */ B(Construct), R(3), R(0), U8(0), U8(0),
B(Star3),
B(Ldar), R(this),
B(ThrowSuperAlreadyCalledIfNotHole),
......
......@@ -88,7 +88,7 @@ snippet: "
"
frame size: 7
parameter count: 1
bytecode array length: 103
bytecode array length: 100
bytecodes: [
/* 30 E> */ B(CreateBlockContext), U8(0),
B(PushContext), R(1),
......@@ -103,9 +103,9 @@ bytecodes: [
B(PopContext), R(1),
B(Mov), R(4), R(0),
/* 89 S> */ B(CreateArrayLiteral), U8(3), U8(0), U8(37),
B(Star3),
B(LdaSmi), I8(1),
B(Star2),
B(LdaSmi), I8(1),
B(Star3),
/* 101 S> */ B(CreateArrayLiteral), U8(4), U8(1), U8(37),
B(Star6),
/* 101 E> */ B(GetIterator), R(6), U8(2), U8(4),
......@@ -120,14 +120,13 @@ bytecodes: [
B(GetNamedProperty), R(6), U8(6), U8(17),
B(JumpIfToBooleanTrue), U8(19),
B(GetNamedProperty), R(6), U8(7), U8(8),
B(StaInArrayLiteral), R(3), R(2), U8(13),
B(Ldar), R(2),
B(StaInArrayLiteral), R(2), R(3), U8(13),
B(Ldar), R(3),
B(Inc), U8(12),
B(Star2),
B(Star3),
B(JumpLoop), U8(31), I8(0), U8(19),
B(LdaSmi), I8(4),
B(StaInArrayLiteral), R(3), R(2), U8(13),
B(Mov), R(3), R(2),
B(StaInArrayLiteral), R(2), R(3), U8(13),
/* 89 E> */ B(CallJSRuntime), U8(%reflect_construct), R(1), U8(2),
B(LdaUndefined),
/* 116 S> */ B(Return),
......
......@@ -157,7 +157,7 @@ snippet: "
};
new F;
"
frame size: 10
frame size: 8
parameter count: 1
bytecode array length: 63
bytecodes: [
......@@ -166,27 +166,27 @@ bytecodes: [
B(LdaImmutableCurrentContextSlot), U8(3),
B(Star2),
B(Ldar), R(0),
/* 89 E> */ B(GetSuperConstructor), R(3),
B(ThrowIfNotSuperConstructor), R(3),
/* 89 E> */ B(GetSuperConstructor), R(1),
B(ThrowIfNotSuperConstructor), R(1),
B(Ldar), R(2),
/* 89 E> */ B(Construct), R(3), R(0), U8(0), U8(0),
/* 89 E> */ B(Construct), R(1), R(0), U8(0), U8(0),
B(Star1),
B(LdaCurrentContextSlot), U8(2),
B(ThrowSuperAlreadyCalledIfNotHole),
B(Ldar), R(1),
B(StaCurrentContextSlot), U8(2),
B(LdaImmutableContextSlot), R(context), U8(3), U8(1),
B(Star5),
B(Star3),
B(LdaSmi), I8(1),
B(Star7),
B(Mov), R(1), R(4),
B(Mov), R(context), R(6),
B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(4), U8(4),
B(Star5),
B(Mov), R(1), R(2),
B(Mov), R(context), R(4),
B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(2), U8(4),
B(GetNamedProperty), R(0), U8(0), U8(2),
B(JumpIfUndefined), U8(10),
B(Star9),
B(CallProperty0), R(9), R(1), U8(4),
B(Mov), R(1), R(8),
B(Star7),
B(CallProperty0), R(7), R(1), U8(4),
B(Mov), R(1), R(6),
B(Ldar), R(1),
/* 96 S> */ B(Return),
]
......@@ -209,7 +209,7 @@ snippet: "
};
new G();
"
frame size: 10
frame size: 8
parameter count: 1
bytecode array length: 63
bytecodes: [
......@@ -218,27 +218,27 @@ bytecodes: [
B(LdaImmutableCurrentContextSlot), U8(3),
B(Star2),
B(Ldar), R(0),
/* 88 E> */ B(GetSuperConstructor), R(3),
B(ThrowIfNotSuperConstructor), R(3),
/* 88 E> */ B(GetSuperConstructor), R(1),
B(ThrowIfNotSuperConstructor), R(1),
B(Ldar), R(2),
/* 88 E> */ B(Construct), R(3), R(0), U8(0), U8(0),
/* 88 E> */ B(Construct), R(1), R(0), U8(0), U8(0),
B(Star1),
B(LdaCurrentContextSlot), U8(2),
B(ThrowSuperAlreadyCalledIfNotHole),
B(Ldar), R(1),
B(StaCurrentContextSlot), U8(2),
B(LdaImmutableContextSlot), R(context), U8(3), U8(1),
B(Star5),
B(Star3),
B(LdaSmi), I8(1),
B(Star7),
B(Mov), R(1), R(4),
B(Mov), R(context), R(6),
B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(4), U8(4),
B(Star5),
B(Mov), R(1), R(2),
B(Mov), R(context), R(4),
B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(2), U8(4),
B(GetNamedProperty), R(0), U8(0), U8(2),
B(JumpIfUndefined), U8(10),
B(Star9),
B(CallProperty0), R(9), R(1), U8(4),
B(Mov), R(1), R(8),
B(Star7),
B(CallProperty0), R(7), R(1), U8(4),
B(Mov), R(1), R(6),
B(Ldar), R(1),
/* 95 S> */ B(Return),
]
......@@ -260,7 +260,7 @@ snippet: "
};
new test('test = () => super(); test()');
"
frame size: 10
frame size: 8
parameter count: 1
bytecode array length: 63
bytecodes: [
......@@ -269,27 +269,27 @@ bytecodes: [
B(LdaImmutableCurrentContextSlot), U8(3),
B(Star2),
B(Ldar), R(0),
/* 88 E> */ B(GetSuperConstructor), R(3),
B(ThrowIfNotSuperConstructor), R(3),
/* 88 E> */ B(GetSuperConstructor), R(1),
B(ThrowIfNotSuperConstructor), R(1),
B(Ldar), R(2),
/* 88 E> */ B(Construct), R(3), R(0), U8(0), U8(0),
/* 88 E> */ B(Construct), R(1), R(0), U8(0), U8(0),
B(Star1),
B(LdaCurrentContextSlot), U8(2),
B(ThrowSuperAlreadyCalledIfNotHole),
B(Ldar), R(1),
B(StaCurrentContextSlot), U8(2),
B(LdaImmutableContextSlot), R(context), U8(3), U8(1),
B(Star5),
B(Star3),
B(LdaSmi), I8(1),
B(Star7),
B(Mov), R(1), R(4),
B(Mov), R(context), R(6),
B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(4), U8(4),
B(Star5),
B(Mov), R(1), R(2),
B(Mov), R(context), R(4),
B(CallRuntime), U16(Runtime::kAddPrivateBrand), R(2), U8(4),
B(GetNamedProperty), R(0), U8(0), U8(2),
B(JumpIfUndefined), U8(10),
B(Star9),
B(CallProperty0), R(9), R(1), U8(4),
B(Mov), R(1), R(8),
B(Star7),
B(CallProperty0), R(7), R(1), U8(4),
B(Mov), R(1), R(6),
B(Ldar), R(1),
/* 95 S> */ B(Return),
]
......
......@@ -17,7 +17,7 @@ snippet: "
test = new B(1, 2, 3).constructor;
})();
"
frame size: 8
frame size: 5
parameter count: 1
bytecode array length: 19
bytecodes: [
......@@ -25,10 +25,10 @@ bytecodes: [
B(Star2),
B(Mov), R(closure), R(1),
/* 93 S> */ B(Ldar), R(1),
/* 93 E> */ B(GetSuperConstructor), R(7),
B(ThrowIfNotSuperConstructor), R(7),
/* 93 E> */ B(GetSuperConstructor), R(4),
B(ThrowIfNotSuperConstructor), R(4),
B(Ldar), R(0),
/* 93 E> */ B(ConstructWithSpread), R(7), R(2), U8(1), U8(0),
/* 93 E> */ B(ConstructWithSpread), R(4), R(2), U8(1), U8(0),
/* 93 S> */ B(Return),
]
constant pool: [
......@@ -49,7 +49,7 @@ snippet: "
test = new B(1, 2, 3).constructor;
})();
"
frame size: 10
frame size: 8
parameter count: 1
bytecode array length: 38
bytecodes: [
......@@ -60,11 +60,11 @@ bytecodes: [
/* 140 S> */ B(LdaSmi), I8(1),
B(Star6),
B(Ldar), R(closure),
/* 140 E> */ B(GetSuperConstructor), R(9),
B(ThrowIfNotSuperConstructor), R(9),
/* 140 E> */ B(GetSuperConstructor), R(5),
B(ThrowIfNotSuperConstructor), R(5),
B(Ldar), R(0),
B(Mov), R(3), R(7),
/* 140 E> */ B(ConstructWithSpread), R(9), R(6), U8(2), U8(0),
/* 140 E> */ B(ConstructWithSpread), R(5), R(6), U8(2), U8(0),
B(Star5),
B(Ldar), R(this),
B(ThrowSuperAlreadyCalledIfNotHole),
......@@ -100,9 +100,9 @@ bytecodes: [
B(Mov), R(closure), R(1),
B(Mov), R(3), R(2),
/* 140 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
B(Star7),
B(Star6),
B(LdaSmi), I8(1),
/* 152 S> */ B(Star6),
/* 152 S> */ B(Star7),
/* 152 E> */ B(GetIterator), R(3), U8(1), U8(3),
B(Star9),
B(GetNamedProperty), R(9), U8(1), U8(5),
......@@ -115,18 +115,18 @@ bytecodes: [
B(GetNamedProperty), R(10), U8(2), U8(16),
B(JumpIfToBooleanTrue), U8(19),
B(GetNamedProperty), R(10), U8(3), U8(7),
B(StaInArrayLiteral), R(7), R(6), U8(12),
B(Ldar), R(6),
B(StaInArrayLiteral), R(6), R(7), U8(12),
B(Ldar), R(7),
B(Inc), U8(11),
B(Star6),
B(Star7),
B(JumpLoop), U8(31), I8(0), U8(18),
B(LdaSmi), I8(1),
B(StaInArrayLiteral), R(7), R(6), U8(12),
B(StaInArrayLiteral), R(6), R(7), U8(12),
B(Ldar), R(4),
/* 140 E> */ B(GetSuperConstructor), R(6),
B(ThrowIfNotSuperConstructor), R(6),
B(Mov), R(0), R(8),
B(CallJSRuntime), U8(%reflect_construct), R(6), U8(3),
/* 140 E> */ B(GetSuperConstructor), R(5),
B(ThrowIfNotSuperConstructor), R(5),
B(Mov), R(0), R(7),
B(CallJSRuntime), U8(%reflect_construct), R(5), U8(3),
B(Star5),
B(Ldar), R(this),
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