Truly independent web browser
LibJS: Check a class heritage before evaluating the class elements
Shannon Boothc662a3b681e0
diff --git a/Libraries/LibJS/Flap/tests/interpreter-assembly/aarch64.S b/Libraries/LibJS/Flap/tests/interpreter-assembly/aarch64.Sindex e9d0bc85b7b..a2bf8934427 100644--- a/Libraries/LibJS/Flap/tests/interpreter-assembly/aarch64.S+++ b/Libraries/LibJS/Flap/tests/interpreter-assembly/aarch64.S@@ -22,6 +22,7 @@ asm_dispatch_table:.quad asm_handler_ConcatString.quad asm_handler_CopyObjectExcludingProperties.quad asm_handler_ImportCall+ .quad asm_handler_GetClassProtoParent.quad asm_handler_NewClass.quad asm_handler_Jump.quad asm_handler_JumpIf@@ -268,7 +269,6 @@ asm_dispatch_table:.quad asm_handler_fallback.quad asm_handler_fallback.quad asm_handler_fallback- .quad asm_handler_fallback.globl CSYM(js_interpreter_debug_dispatch_table)CSYM(js_interpreter_debug_dispatch_table):@@ -569,6 +569,10 @@ CSYM(js_interpreter_handler_ranges):.quad asm_handler_ImportCall_hot_end.quad asm_handler_ImportCall_cold.quad asm_handler_ImportCall_cold_end+ .quad asm_handler_GetClassProtoParent+ .quad asm_handler_GetClassProtoParent_hot_end+ .quad asm_handler_GetClassProtoParent_cold+ .quad asm_handler_GetClassProtoParent_cold_end.quad asm_handler_NewClass.quad asm_handler_NewClass_hot_end.quad asm_handler_NewClass_cold@@ -1553,10 +1557,6 @@ CSYM(js_interpreter_handler_ranges):.quad asm_handler_fallback_hot_end.quad asm_handler_fallback_cold.quad asm_handler_fallback_cold_end- .quad asm_handler_fallback- .quad asm_handler_fallback_hot_end- .quad asm_handler_fallback_cold- .quad asm_handler_fallback_cold_end.text@@ -9061,15 +9061,58 @@ asm_handler_ImportCall_hot_end:asm_handler_ImportCall_cold:asm_handler_ImportCall_cold_end:+.p2align 4+asm_handler_GetClassProtoParent:+ mov x0, x20+ sub w1, w21, w26+ str w1, [x28, #64]+ ldr w9, [x21, #8]+ ldr x10, [x27, x9, lsl #3]+.Lasm_GetClassProtoParent.scalar_value_ready_0:+ mov x3, x10+ mov x0, x20+ sub w1, w21, w26+ mov x2, x21+ bl CSYM(asm_slow_path_get_class_proto_parent)+ tbnz x0, #63, .Lasm_GetClassProtoParent.scalar_result_done_1+ tbz x0, #32, .Lasm_GetClassProtoParent.scalar_result_done_1+ ldr w9, [x21, #4]+ str x1, [x27, x9, lsl #3]+ add x21, x26, w0, uxtw+ ldrb w9, [x21]+ ldr x10, [x19, x9, lsl #3]+ br x10+.Lasm_GetClassProtoParent.scalar_result_done_1:+ tbz x0, #63, 1f+ b .Lexit+1:+ tbz x0, #32, .Lasm_GetClassProtoParent.slow_path_transfer_2+ add x21, x26, w0, uxtw+ ldrb w9, [x21]+ ldr x10, [x19, x9, lsl #3]+ br x10+.Lasm_GetClassProtoParent.slow_path_transfer_2:+ ldr x28, [x20]+ ldr x9, [x28, #88]+ ldr x26, [x9, #40]+ add x27, x28, #128+ add x21, x26, w0, uxtw+ ldrb w9, [x21]+ ldr x10, [x19, x9, lsl #3]+ br x10+asm_handler_GetClassProtoParent_hot_end:+asm_handler_GetClassProtoParent_cold:+asm_handler_GetClassProtoParent_cold_end:+.p2align 4asm_handler_NewClass:mov x0, x20sub w1, w21, w26str w1, [x28, #64]add x9, sp, #0- ldr w10, [x21, #28]+ ldr w10, [x21, #32]lsl x10, x10, #3- add x10, x10, #55+ add x10, x10, #63and x10, x10, #0xfffffffffffffff0sub x14, x9, x10ldr x12, [x20, #40]@@ -9100,59 +9143,67 @@ asm_handler_NewClass:ldr x11, [x27, x12, lsl #3].Lasm_NewClass.value_ready_4:str x11, [sp, #24]+ movz x11, #0x7ffb, lsl #48ldr w12, [x21, #16]+ movn w13, #0+ cmp w12, w13+ b.eq .Lasm_NewClass.value_ready_5ldr x11, [x27, x12, lsl #3].Lasm_NewClass.value_ready_5:str x11, [sp, #32]+ ldr w12, [x21, #20]+ ldr x11, [x27, x12, lsl #3]+.Lasm_NewClass.value_ready_6:+ str x11, [sp, #40]mov w9, #0- ldr w10, [x21, #28]- add x14, sp, #40- add x3, x21, #32-.Lasm_NewClass.array_value_next_6:+ ldr w10, [x21, #32]+ add x14, sp, #48+ add x3, x21, #36+.Lasm_NewClass.array_value_next_7:cmp x9, x10- b.hs .Lasm_NewClass.array_values_end_8+ b.hs .Lasm_NewClass.array_values_end_9ldr w12, [x3, x9, lsl #2]movz x11, #0x7ffb, lsl #48movn w13, #0cmp w12, w13- b.eq .Lasm_NewClass.array_value_ready_7+ b.eq .Lasm_NewClass.array_value_ready_8ldr x11, [x27, x12, lsl #3]-.Lasm_NewClass.array_value_ready_7:+.Lasm_NewClass.array_value_ready_8:str x11, [x14, x9, lsl #3]add x9, x9, #1- b .Lasm_NewClass.array_value_next_6-.Lasm_NewClass.array_values_end_8:+ b .Lasm_NewClass.array_value_next_7+.Lasm_NewClass.array_values_end_9:mov x0, x20sub w1, w21, w26mov x2, x21add x3, sp, #16bl CSYM(asm_slow_path_new_class)- tbnz x0, #63, .Lasm_NewClass.values_exceptional_outputs_10- tbz x0, #32, .Lasm_NewClass.values_exceptional_outputs_10+ tbnz x0, #63, .Lasm_NewClass.values_exceptional_outputs_11+ tbz x0, #32, .Lasm_NewClass.values_exceptional_outputs_11ldr w12, [x21, #8]ldr x11, [sp, #16]str x11, [x27, x12, lsl #3]-.Lasm_NewClass.skip_output_value_11:+.Lasm_NewClass.skip_output_value_12:ldr x9, [sp]add sp, x9, #0add x21, x26, w0, uxtwldrb w9, [x21]ldr x10, [x19, x9, lsl #3]br x10-.Lasm_NewClass.values_exceptional_outputs_10:-.Lasm_NewClass.values_restore_stack_9:+.Lasm_NewClass.values_exceptional_outputs_11:+.Lasm_NewClass.values_restore_stack_10:ldr x9, [sp]add sp, x9, #0.Lasm_NewClass.values_call_done_0:tbz x0, #63, 1fb .Lexit1:- tbz x0, #32, .Lasm_NewClass.slow_path_transfer_12+ tbz x0, #32, .Lasm_NewClass.slow_path_transfer_13add x21, x26, w0, uxtwldrb w9, [x21]ldr x10, [x19, x9, lsl #3]br x10-.Lasm_NewClass.slow_path_transfer_12:+.Lasm_NewClass.slow_path_transfer_13:ldr x28, [x20]ldr x9, [x28, #88]ldr x26, [x9, #40]diff --git a/Libraries/LibJS/Flap/tests/interpreter-assembly/x86_64.S b/Libraries/LibJS/Flap/tests/interpreter-assembly/x86_64.Sindex 971d6059011..53476246279 100644--- a/Libraries/LibJS/Flap/tests/interpreter-assembly/x86_64.S+++ b/Libraries/LibJS/Flap/tests/interpreter-assembly/x86_64.S@@ -23,6 +23,7 @@ asm_dispatch_table:.quad asm_handler_ConcatString.quad asm_handler_CopyObjectExcludingProperties.quad asm_handler_ImportCall+ .quad asm_handler_GetClassProtoParent.quad asm_handler_NewClass.quad asm_handler_Jump.quad asm_handler_JumpIf@@ -269,7 +270,6 @@ asm_dispatch_table:.quad asm_handler_fallback.quad asm_handler_fallback.quad asm_handler_fallback- .quad asm_handler_fallback.globl CSYM(js_interpreter_debug_dispatch_table)CSYM(js_interpreter_debug_dispatch_table):@@ -570,6 +570,10 @@ CSYM(js_interpreter_handler_ranges):.quad asm_handler_ImportCall_hot_end.quad asm_handler_ImportCall_cold.quad asm_handler_ImportCall_cold_end+ .quad asm_handler_GetClassProtoParent+ .quad asm_handler_GetClassProtoParent_hot_end+ .quad asm_handler_GetClassProtoParent_cold+ .quad asm_handler_GetClassProtoParent_cold_end.quad asm_handler_NewClass.quad asm_handler_NewClass_hot_end.quad asm_handler_NewClass_cold@@ -1554,10 +1558,6 @@ CSYM(js_interpreter_handler_ranges):.quad asm_handler_fallback_hot_end.quad asm_handler_fallback_cold.quad asm_handler_fallback_cold_end- .quad asm_handler_fallback- .quad asm_handler_fallback_hot_end- .quad asm_handler_fallback_cold- .quad asm_handler_fallback_cold_end.text@@ -9073,14 +9073,57 @@ asm_handler_ImportCall_hot_end:asm_handler_ImportCall_cold:asm_handler_ImportCall_cold_end:+.p2align 4+asm_handler_GetClassProtoParent:+ mov DWORD PTR [rbx + -64], r13d+ lea r11, [r14 + r13]+ mov r10d, DWORD PTR [r11 + 8]+ mov rax, QWORD PTR [rbx + r10 * 8]+.Lasm_GetClassProtoParent.scalar_value_ready_0:+ mov rcx, rax+ mov rdi, QWORD PTR [rbp - 48]+ mov esi, r13d+ lea rdx, [r14 + r13]+ call CSYM(asm_slow_path_get_class_proto_parent)+ test rax, rax+ js .Lasm_GetClassProtoParent.scalar_result_done_1+ bt rax, 32+ jnc .Lasm_GetClassProtoParent.scalar_result_done_1+ lea rcx, [r14 + r13]+ mov r10d, DWORD PTR [rcx + 4]+ mov QWORD PTR [rbx + r10 * 8], rdx+ mov r13d, eax+ movzx eax, BYTE PTR [r14 + r13]+ jmp [r12 + rax * 8]+.Lasm_GetClassProtoParent.scalar_result_done_1:+ test rax, rax+ js .Lexit+ bt rax, 32+ jnc .Lasm_GetClassProtoParent.slow_path_transfer_2+ mov r13d, eax+ movzx eax, BYTE PTR [r14 + r13]+ jmp [r12 + rax * 8]+.Lasm_GetClassProtoParent.slow_path_transfer_2:+ mov rcx, QWORD PTR [rbp - 48]+ mov rbx, QWORD PTR [rcx]+ add rbx, 128+ mov rcx, QWORD PTR [rbx + -40]+ mov r14, QWORD PTR [rcx + 40]+ mov r13d, eax+ movzx eax, BYTE PTR [r14 + r13]+ jmp [r12 + rax * 8]+asm_handler_GetClassProtoParent_hot_end:+asm_handler_GetClassProtoParent_cold:+asm_handler_GetClassProtoParent_cold_end:+.p2align 4asm_handler_NewClass:mov DWORD PTR [rbx + -64], r13dlea rcx, [r14 + r13]mov r11, rsp- mov r10d, DWORD PTR [rcx + 28]+ mov r10d, DWORD PTR [rcx + 32]shl r10, 3- add r10, 55+ add r10, 63and r10, -16mov rax, rspsub rax, r10@@ -9112,55 +9155,62 @@ asm_handler_NewClass:mov rax, QWORD PTR [rbx + r10 * 8].Lasm_NewClass.value_ready_4:mov QWORD PTR [rsp + 24], rax+ movabs rax, 9221964661971222528mov r10d, DWORD PTR [rcx + 16]+ cmp r10d, -1+ je .Lasm_NewClass.value_ready_5mov rax, QWORD PTR [rbx + r10 * 8].Lasm_NewClass.value_ready_5:mov QWORD PTR [rsp + 32], rax+ mov r10d, DWORD PTR [rcx + 20]+ mov rax, QWORD PTR [rbx + r10 * 8]+.Lasm_NewClass.value_ready_6:+ mov QWORD PTR [rsp + 40], raxmov r11d, 0- mov r10d, DWORD PTR [rcx + 28]-.Lasm_NewClass.array_value_next_6:+ mov r10d, DWORD PTR [rcx + 32]+.Lasm_NewClass.array_value_next_7:cmp r11, r10- jae .Lasm_NewClass.array_values_end_8- mov edx, DWORD PTR [rcx + r11 * 4 + 32]+ jae .Lasm_NewClass.array_values_end_9+ mov edx, DWORD PTR [rcx + r11 * 4 + 36]movabs rax, 9221964661971222528cmp edx, -1- je .Lasm_NewClass.array_value_ready_7+ je .Lasm_NewClass.array_value_ready_8mov rax, QWORD PTR [rbx + rdx * 8]-.Lasm_NewClass.array_value_ready_7:- mov QWORD PTR [rsp + r11 * 8 + 40], rax+.Lasm_NewClass.array_value_ready_8:+ mov QWORD PTR [rsp + r11 * 8 + 48], raxadd r11, 1- jmp .Lasm_NewClass.array_value_next_6-.Lasm_NewClass.array_values_end_8:+ jmp .Lasm_NewClass.array_value_next_7+.Lasm_NewClass.array_values_end_9:mov rdi, QWORD PTR [rbp - 48]mov esi, r13dlea rdx, [r14 + r13]lea rcx, [rsp + 16]call CSYM(asm_slow_path_new_class)test rax, rax- js .Lasm_NewClass.values_exceptional_outputs_10+ js .Lasm_NewClass.values_exceptional_outputs_11bt rax, 32- jnc .Lasm_NewClass.values_exceptional_outputs_10+ jnc .Lasm_NewClass.values_exceptional_outputs_11lea rcx, [r14 + r13]mov r10d, DWORD PTR [rcx + 8]mov r11, QWORD PTR [rsp + 16]mov QWORD PTR [rbx + r10 * 8], r11-.Lasm_NewClass.skip_output_value_11:+.Lasm_NewClass.skip_output_value_12:mov rsp, QWORD PTR [rsp]mov r13d, eaxmovzx eax, BYTE PTR [r14 + r13]jmp [r12 + rax * 8]-.Lasm_NewClass.values_exceptional_outputs_10:-.Lasm_NewClass.values_restore_stack_9:+.Lasm_NewClass.values_exceptional_outputs_11:+.Lasm_NewClass.values_restore_stack_10:mov rsp, QWORD PTR [rsp].Lasm_NewClass.values_call_done_0:test rax, raxjs .Lexitbt rax, 32- jnc .Lasm_NewClass.slow_path_transfer_12+ jnc .Lasm_NewClass.slow_path_transfer_13mov r13d, eaxmovzx eax, BYTE PTR [r14 + r13]jmp [r12 + rax * 8]-.Lasm_NewClass.slow_path_transfer_12:+.Lasm_NewClass.slow_path_transfer_13:mov rcx, QWORD PTR [rbp - 48]mov rbx, QWORD PTR [rcx]add rbx, 128diff --git a/Libraries/LibJS/Interpreter/interpreter.flap b/Libraries/LibJS/Interpreter/interpreter.flapindex 9854bb88273..afc12a5f121 100644--- a/Libraries/LibJS/Interpreter/interpreter.flap+++ b/Libraries/LibJS/Interpreter/interpreter.flap@@ -1515,10 +1515,16 @@ handler ImportCall(options: Operand) @cold = call_slow_path(import_call);+handler GetClassProtoParent(+ dst: out Operand,+ super_class: Operand+) @cold = call_slow_path(get_class_proto_parent);+handler NewClass(length: u32,dst: out Operand,super_class: Optional<Operand>,+ proto_parent: Optional<Operand>,class_environment: Operand,class_blueprint_index: u32,lhs_name: Optional<IdentifierTableIndex>,diff --git a/Libraries/LibJS/JIT/Rust/src/builder/handling.rs b/Libraries/LibJS/JIT/Rust/src/builder/handling.rsindex 5209fa1a944..3f648d84861 100644--- a/Libraries/LibJS/JIT/Rust/src/builder/handling.rs+++ b/Libraries/LibJS/JIT/Rust/src/builder/handling.rs@@ -286,6 +286,7 @@ pub fn handling(opcode: OpCode) -> Handling {O::Exp| O::CopyObjectExcludingProperties| O::ImportCall+ | O::GetClassProtoParent| O::NewClass| O::GetImportMeta| O::GetImportdiff --git a/Libraries/LibJS/JIT/Rust/src/bytecode/instruction.rs b/Libraries/LibJS/JIT/Rust/src/bytecode/instruction.rsindex f14a6eccd5c..948f01d8427 100644--- a/Libraries/LibJS/JIT/Rust/src/bytecode/instruction.rs+++ b/Libraries/LibJS/JIT/Rust/src/bytecode/instruction.rs@@ -392,6 +392,7 @@ mod tests {Instruction::NewClass {dst: operand(6),super_class: None,+ proto_parent: None,class_environment: operand(7),class_blueprint_index: 1,lhs_name: Some(IdentifierTableIndex(4)),diff --git a/Libraries/LibJS/Rust/src/bytecode/codegen.rs b/Libraries/LibJS/Rust/src/bytecode/codegen.rsindex 2f0b31c38ea..864b0a68a53 100644--- a/Libraries/LibJS/Rust/src/bytecode/codegen.rs+++ b/Libraries/LibJS/Rust/src/bytecode/codegen.rs@@ -7115,11 +7115,22 @@ fn generate_class_expression(}// Evaluate super class if present+ // NB: NewClass reads the superclass after the class elements, which can reassign the local it was read from.let super_class = if let Some(super_expression) = &data.super_class {generate_class_part_expression(super_expression, generator, None)+ .map(|super_class| generator.copy_if_needed_to_preserve_evaluation_order(&super_class))} else {None};+ // NB: The heritage is checked before any class element is evaluated.+ let proto_parent = super_class.as_ref().map(|super_class| {+ let proto_parent = generator.allocate_register();+ generator.emit(Instruction::GetClassProtoParent {+ dst: proto_parent.operand(),+ super_class: super_class.operand(),+ });+ proto_parent+ });// Create private environment for private class elements.let mut has_private_env = false;@@ -7420,6 +7431,7 @@ fn generate_class_expression(generator.emit(Instruction::NewClass {dst: dst.operand(),super_class: super_class.as_ref().map(|s| s.operand()),+ proto_parent: proto_parent.as_ref().map(|p| p.operand()),class_environment: class_env.operand(),class_blueprint_index: blueprint_index,lhs_name,diff --git a/Libraries/LibJS/Rust/src/interpreter/slow_paths/calls.rs b/Libraries/LibJS/Rust/src/interpreter/slow_paths/calls.rsindex b1d9d667ed5..1b8e97e3c77 100644--- a/Libraries/LibJS/Rust/src/interpreter/slow_paths/calls.rs+++ b/Libraries/LibJS/Rust/src/interpreter/slow_paths/calls.rs@@ -27,6 +27,8 @@ use crate::runtime::abstract_operations::{};use crate::runtime::array::Array;use crate::runtime::bound_function::BoundFunction;+use crate::runtime::class_construction::ClassHeritage;+use crate::runtime::class_construction::class_proto_parent;use crate::runtime::class_construction::construct_class;use crate::runtime::class_field_definition::ClassElementName;use crate::runtime::completion::{Must, ThrowCompletionOr};@@ -156,6 +158,11 @@ fn element_key_operands(instruction: &op::NewClass) -> &[OptionalOperand] {instruction.element_keys()}+pub fn get_class_proto_parent(vm: &Vm, pc: u32, values: &mut op::GetClassProtoParentValues) -> SlowPathControl {+ values.dst = asm_try!(vm, pc, class_proto_parent(vm, values.super_class));+ SlowPathControl::continue_at(pc + op::GetClassProtoParent::LENGTH)+}+pub fn new_class(vm: &Vm,pc: u32,@@ -163,9 +170,13 @@ pub fn new_class(values: &mut op::NewClassValues,element_keys: &mut [Value],) -> SlowPathControl {- let mut super_class = Value::UNDEFINED;+ let mut heritage = None;if instruction.super_class.get().is_some() {- super_class = values.super_class;+ assert!(instruction.proto_parent.get().is_some());+ heritage = Some(ClassHeritage {+ super_class: values.super_class,+ proto_parent: values.proto_parent,+ });}// NB: The element keys stay in the operand record the interpreter passed, which lives on its stack, so the keys// of elements without one become undefined in place.@@ -201,7 +212,7 @@ pub fn new_class(executable,Some(class_environment),outer_environment,- super_class,+ heritage,element_keys,binding_name.as_ref(),&class_name,diff --git a/Libraries/LibJS/Rust/src/interpreter/slow_paths/mod.rs b/Libraries/LibJS/Rust/src/interpreter/slow_paths/mod.rsindex 63e06db0530..d0507187680 100644--- a/Libraries/LibJS/Rust/src/interpreter/slow_paths/mod.rs+++ b/Libraries/LibJS/Rust/src/interpreter/slow_paths/mod.rs@@ -1155,6 +1155,15 @@ impl RuntimeFunctions for Runtime {calls::get_super_constructor(vm, pc, values)}+ fn get_class_proto_parent(+ vm: &Vm,+ pc: u32,+ _instruction: &op::GetClassProtoParent,+ values: &mut op::GetClassProtoParentValues,+ ) -> SlowPathControl {+ calls::get_class_proto_parent(vm, pc, values)+ }+fn new_class(vm: &Vm,pc: u32,diff --git a/Libraries/LibJS/Rust/src/runtime/class_construction.rs b/Libraries/LibJS/Rust/src/runtime/class_construction.rsindex bcbb8d4b85d..4b677306dd6 100644--- a/Libraries/LibJS/Rust/src/runtime/class_construction.rs+++ b/Libraries/LibJS/Rust/src/runtime/class_construction.rs@@ -78,6 +78,43 @@ fn resolve_element_key(Ok(ClassElementName::PropertyKey(key))}+/// The values of the class heritage of a class being defined.+pub struct ClassHeritage {+ pub super_class: Value,+ pub proto_parent: Value,+}++/// https://tc39.es/ecma262/#sec-runtime-semantics-classdefinitionevaluation+pub fn class_proto_parent(vm: &Vm, super_class: Value) -> ThrowCompletionOr<Value> {+ // 8. Else,+ // f. If superclass is null, then+ if super_class.is_null() {+ // i. Let protoParent be null.+ return Ok(Value::NULL);+ }+ // g. Else if IsConstructor(superclass) is false, then+ if !super_class.is_constructor() {+ // i. Throw a TypeError exception.+ return vm.throw_completion(+ ErrorKind::TypeError,+ ErrorType::ClassExtendsValueNotAConstructorOrNull,+ &[&super_class],+ );+ }+ // h. Else,+ // i. Let protoParent be ? Get(superclass, "prototype").+ let proto_parent = super_class.get(vm, &vm.names.prototype)?;+ // ii. If protoParent is not an Object and protoParent is not null, throw a TypeError exception.+ if !proto_parent.is_object() && !proto_parent.is_null() {+ return vm.throw_completion(+ ErrorKind::TypeError,+ ErrorType::ClassExtendsValueInvalidPrototype,+ &[&proto_parent],+ );+ }+ Ok(proto_parent)+}+#[derive(Clone, Trace)]enum StaticElement {Field(ClassFieldDefinition),@@ -92,7 +129,7 @@ pub fn construct_class(executable: Gc<Executable>,class_environment: Option<Gc<Environment>>,outer_environment: Option<Gc<Environment>>,- super_class: Value,+ heritage: Option<ClassHeritage>,element_keys: &[Value],binding_name: Option<&Utf16FlyString>,class_name: &Utf16FlyString,@@ -112,32 +149,16 @@ pub fn construct_class(let mut proto_parent = Some(realm.object_prototype());let mut constructor_parent = realm.function_prototype();- if blueprint.has_super_class {- if super_class.is_null() {+ assert_eq!(heritage.is_some(), blueprint.has_super_class);+ if let Some(heritage) = heritage {+ // NB: The bytecode performs the steps that check the heritage, before evaluating the class elements.+ if heritage.proto_parent.is_null() {proto_parent = None;- } else if !super_class.is_constructor() {- return vm.throw_completion(- ErrorKind::TypeError,- ErrorType::ClassExtendsValueNotAConstructorOrNull,- &[&super_class],- );} else {- let super_class_prototype = super_class.get(vm, &vm.names.prototype)?;- if !super_class_prototype.is_null() && !super_class_prototype.is_object() {- return vm.throw_completion(- ErrorKind::TypeError,- ErrorType::ClassExtendsValueInvalidPrototype,- &[&super_class_prototype],- );- }-- if super_class_prototype.is_null() {- proto_parent = None;- } else {- proto_parent = Some(super_class_prototype.as_object());- }-- constructor_parent = super_class.as_object();+ proto_parent = Some(heritage.proto_parent.as_object());+ }+ if !heritage.super_class.is_null() {+ constructor_parent = heritage.super_class.as_object();}}diff --git a/Tests/LibJS/Bytecode/expected/class-computed-field-lhs-name.txt b/Tests/LibJS/Bytecode/expected/class-computed-field-lhs-name.txtindex e0df56072e0..fbdf7e4ef18 100644--- a/Tests/LibJS/Bytecode/expected/class-computed-field-lhs-name.txt+++ b/Tests/LibJS/Bytecode/expected/class-computed-field-lhs-name.txt@@ -1,4 +1,4 @@-$87b8bc45 class-computed-field-lhs-name.js:1:1+$091ab4cd class-computed-field-lhs-name.js:1:1Registers: 7Blocks: 1Constants:@@ -13,10 +13,10 @@ block0:[ 10] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:0, is_catch_environment:false[ 28] SetLexicalEnvironment environment:reg4[ 30] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0 (C), element_keys:[element_keys:Int32(3)]- [ 58] SetGlobal `C`, src:reg6- [ 68] GetGlobal value_feedback:0, dst:reg5, `C`- [ 78] CallConstruct value_feedback:1, call_feedback:0, dst:reg6, callee:reg5, C- [ 98] End value:reg6+ [ 60] SetGlobal `C`, src:reg6+ [ 70] GetGlobal value_feedback:0, dst:reg5, `C`+ [ 80] CallConstruct value_feedback:1, call_feedback:0, dst:reg6, callee:reg5, C+ [ a0] End value:reg6C$638b9046diff --git a/Tests/LibJS/Bytecode/expected/class-computed-key.txt b/Tests/LibJS/Bytecode/expected/class-computed-key.txtindex 779a88dbb9f..a24dfc5178f 100644--- a/Tests/LibJS/Bytecode/expected/class-computed-key.txt+++ b/Tests/LibJS/Bytecode/expected/class-computed-key.txt@@ -11,7 +11,7 @@ block0:[ 38] End value:reg5-f$8066d1e2 class-computed-key.js:4:5+f$048cbb7a class-computed-key.js:4:5Registers: 8Blocks: 1@@ -25,4 +25,4 @@ block0:[ 60] ToPrimitiveWithStringHint dst:reg6, value:reg7[ 70] SetLexicalEnvironment environment:reg4[ 78] NewClass dst:reg7, class_environment:reg5, class_blueprint_index:0, element_keys:[element_keys:reg6]- [ a0] Return value:reg7+ [ a8] Return value:reg7diff --git a/Tests/LibJS/Bytecode/expected/class-environment.txt b/Tests/LibJS/Bytecode/expected/class-environment.txtindex a18786d312a..990d340f308 100644--- a/Tests/LibJS/Bytecode/expected/class-environment.txt+++ b/Tests/LibJS/Bytecode/expected/class-environment.txt@@ -14,7 +14,7 @@ block0:[ 88] End value:reg5-classWithName$18215401 class-environment.js:2:13+classWithName$91377959 class-environment.js:2:13Registers: 8Blocks: 1Locals: C~0@@ -29,11 +29,11 @@ block0:[ 28] CreateVariable `Foo`, is_immutable:true, is_global:false, is_strict:true[ 38] SetLexicalEnvironment environment:reg4[ 40] NewClass dst:C~0, class_environment:reg5, class_blueprint_index:0, element_keys:[element_keys:String("method")]- [ 68] CallConstruct value_feedback:0, call_feedback:0, dst:reg6, callee:C~0, C- [ 88] GetById value_feedback:1, dst:reg7, base:reg6, `method`- [ a0] Call value_feedback:2, call_feedback:1, dst:reg5, callee:reg7, this_value:reg6, <object>.method- [ c0] StrictlyEquals arith_feedback:0, dst:reg7, lhs:reg5, rhs:C~0- [ d0] Return value:reg7+ [ 70] CallConstruct value_feedback:0, call_feedback:0, dst:reg6, callee:C~0, C+ [ 90] GetById value_feedback:1, dst:reg7, base:reg6, `method`+ [ a8] Call value_feedback:2, call_feedback:1, dst:reg5, callee:reg7, this_value:reg6, <object>.method+ [ c8] StrictlyEquals arith_feedback:0, dst:reg7, lhs:reg5, rhs:C~0+ [ d8] Return value:reg7Foo$cf27a8b3diff --git a/Tests/LibJS/Bytecode/expected/class-lhs-name-no-createvariable.txt b/Tests/LibJS/Bytecode/expected/class-lhs-name-no-createvariable.txtindex 537b8e55919..57400daeca3 100644--- a/Tests/LibJS/Bytecode/expected/class-lhs-name-no-createvariable.txt+++ b/Tests/LibJS/Bytecode/expected/class-lhs-name-no-createvariable.txt@@ -1,4 +1,4 @@-$63c57e75 class-lhs-name-no-createvariable.js:1:1+$e52776fd class-lhs-name-no-createvariable.js:1:1Registers: 7Blocks: 1Constants:@@ -11,5 +11,5 @@ block0:[ 10] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:0, is_catch_environment:false[ 28] SetLexicalEnvironment environment:reg4[ 30] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0 (x), element_keys:[element_keys:String("method")]- [ 58] SetGlobal `x`, src:reg6- [ 68] End value:Undefined+ [ 60] SetGlobal `x`, src:reg6+ [ 70] End value:Undefineddiff --git a/Tests/LibJS/Bytecode/expected/class-literal-fields.txt b/Tests/LibJS/Bytecode/expected/class-literal-fields.txtindex d474eb80609..61e5628e813 100644--- a/Tests/LibJS/Bytecode/expected/class-literal-fields.txt+++ b/Tests/LibJS/Bytecode/expected/class-literal-fields.txt@@ -27,7 +27,7 @@ block0:[ 198] End value:reg5-test$f7b067c4 class-literal-fields.js:2:5+test$8c6df7bc class-literal-fields.js:2:5Registers: 7Blocks: 1Locals: A~0@@ -47,10 +47,10 @@ block0:[ 28] CreateVariable `A`, is_immutable:true, is_global:false, is_strict:true[ 38] SetLexicalEnvironment environment:reg4[ 40] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0, element_keys:[element_keys:String("x"), element_keys:String("y"), element_keys:String("z"), element_keys:String("w"), element_keys:String("s"), element_keys:String("computed")]- [ 78] Mov dst:A~0, src:reg6- [ 88] ThrowIfTDZ src:A~0- [ 90] CallConstruct value_feedback:0, call_feedback:0, dst:reg6, callee:A~0, A- [ b0] Return value:reg6+ [ 80] Mov dst:A~0, src:reg6+ [ 90] ThrowIfTDZ src:A~0+ [ 98] CallConstruct value_feedback:0, call_feedback:0, dst:reg6, callee:A~0, A+ [ b8] Return value:reg6A$70678274diff --git a/Tests/LibJS/Bytecode/expected/delete-super-eval-order.txt b/Tests/LibJS/Bytecode/expected/delete-super-eval-order.txtindex 015c8728715..d6ce8d8db90 100644--- a/Tests/LibJS/Bytecode/expected/delete-super-eval-order.txt+++ b/Tests/LibJS/Bytecode/expected/delete-super-eval-order.txt@@ -1,4 +1,4 @@-$67bc40cb delete-super-eval-order.js:4:1+$e91e3953 delete-super-eval-order.js:4:1Registers: 10Blocks: 3Constants:@@ -13,27 +13,27 @@ block0:[ 28] CreateVariable `A`, is_immutable:true, is_global:false, is_strict:true[ 38] SetLexicalEnvironment environment:reg4[ 40] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0, element_keys:[element_keys:String("m")]- [ 68] DynamicInitializeLexicalBinding `A`, src:reg6- [ 78] MovSrcUndefined dst:reg6- [ 80] Jump target:block2+ [ 70] DynamicInitializeLexicalBinding `A`, src:reg6+ [ 80] MovSrcUndefined dst:reg6+ [ 88] Jump target:block2block1:- [ 88] Catch value_feedback:0, dst:reg5- [ 90] SetLexicalEnvironment environment:reg4- [ 98] Mov2 c0_dst:reg7, c0_src:Undefined, c1_dst:reg6, c1_src:reg7- [ b0] End value:reg6+ [ 90] Catch value_feedback:0, dst:reg5+ [ 98] SetLexicalEnvironment environment:reg4+ [ a0] Mov2 c0_dst:reg7, c0_src:Undefined, c1_dst:reg6, c1_src:reg7+ [ b8] End value:reg6block2:- [ b8] MovSrcUndefined dst:reg5- [ c0] GetGlobal value_feedback:1, dst:reg9, `A`- [ d0] CallConstruct value_feedback:2, call_feedback:0, dst:reg8, callee:reg9, A- [ f0] GetById value_feedback:3, dst:reg9, base:reg8, `m`- [ 108] Call value_feedback:4, call_feedback:1, dst:reg7, callee:reg9, this_value:reg8, <object>.m, arguments:[String("x")]- [ 130] Mov2 c0_dst:reg5, c0_src:reg7, c1_dst:reg6, c1_src:reg5- [ 148] End value:reg6+ [ c0] MovSrcUndefined dst:reg5+ [ c8] GetGlobal value_feedback:1, dst:reg9, `A`+ [ d8] CallConstruct value_feedback:2, call_feedback:0, dst:reg8, callee:reg9, A+ [ f8] GetById value_feedback:3, dst:reg9, base:reg8, `m`+ [ 110] Call value_feedback:4, call_feedback:1, dst:reg7, callee:reg9, this_value:reg8, <object>.m, arguments:[String("x")]+ [ 138] Mov2 c0_dst:reg5, c0_src:reg7, c1_dst:reg6, c1_src:reg5+ [ 150] End value:reg6Exception handlers:- [ b8 .. 150] => handler block1+ [ c0 .. 158] => handler block1A$70678274diff --git a/Tests/LibJS/Bytecode/expected/delete-super-property.txt b/Tests/LibJS/Bytecode/expected/delete-super-property.txtindex 96f2864e7bb..efd03511208 100644--- a/Tests/LibJS/Bytecode/expected/delete-super-property.txt+++ b/Tests/LibJS/Bytecode/expected/delete-super-property.txt@@ -1,4 +1,4 @@-$f3cbcd2f delete-super-property.js:1:1+$752dc5b7 delete-super-property.js:1:1Registers: 11Blocks: 6Locals: e~0, e~1@@ -14,46 +14,46 @@ block0:[ 28] CreateVariable `A`, is_immutable:true, is_global:false, is_strict:true[ 38] SetLexicalEnvironment environment:reg4[ 40] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0, element_keys:[element_keys:String("foo"), element_keys:String("baz")]- [ 68] DynamicInitializeLexicalBinding `A`, src:reg6- [ 78] MovSrcUndefined dst:reg6- [ 80] Jump target:block3+ [ 70] DynamicInitializeLexicalBinding `A`, src:reg6+ [ 80] MovSrcUndefined dst:reg6+ [ 88] Jump target:block3block1:- [ 88] Catch value_feedback:0, dst:reg5- [ 90] SetLexicalEnvironment environment:reg4- [ 98] Mov3 c0_dst:e~0, c0_src:reg5, c1_dst:reg7, c1_src:Undefined, c2_dst:reg6, c2_src:reg7+ [ 90] Catch value_feedback:0, dst:reg5+ [ 98] SetLexicalEnvironment environment:reg4+ [ a0] Mov3 c0_dst:e~0, c0_src:reg5, c1_dst:reg7, c1_src:Undefined, c2_dst:reg6, c2_src:reg7block2:- [ b8] MovSrcUndefined dst:reg5- [ c0] Jump target:block5+ [ c0] MovSrcUndefined dst:reg5+ [ c8] Jump target:block5block3:- [ c8] MovSrcUndefined dst:reg5- [ d0] GetGlobal value_feedback:1, dst:reg9, `A`- [ e0] CallConstruct value_feedback:2, call_feedback:0, dst:reg8, callee:reg9, A- [ 100] GetById value_feedback:3, dst:reg9, base:reg8, `foo`- [ 118] Call value_feedback:4, call_feedback:1, dst:reg7, callee:reg9, this_value:reg8, <object>.foo- [ 138] Mov2 c0_dst:reg5, c0_src:reg7, c1_dst:reg6, c1_src:reg5- [ 150] JumpLoop target:block2+ [ d0] MovSrcUndefined dst:reg5+ [ d8] GetGlobal value_feedback:1, dst:reg9, `A`+ [ e8] CallConstruct value_feedback:2, call_feedback:0, dst:reg8, callee:reg9, A+ [ 108] GetById value_feedback:3, dst:reg9, base:reg8, `foo`+ [ 120] Call value_feedback:4, call_feedback:1, dst:reg7, callee:reg9, this_value:reg8, <object>.foo+ [ 140] Mov2 c0_dst:reg5, c0_src:reg7, c1_dst:reg6, c1_src:reg5+ [ 158] JumpLoop target:block2block4:- [ 158] Catch value_feedback:5, dst:reg7- [ 160] SetLexicalEnvironment environment:reg4- [ 168] Mov3 c0_dst:e~1, c0_src:reg7, c1_dst:reg9, c1_src:Undefined, c2_dst:reg5, c2_src:reg9- [ 188] End value:reg5+ [ 160] Catch value_feedback:5, dst:reg7+ [ 168] SetLexicalEnvironment environment:reg4+ [ 170] Mov3 c0_dst:e~1, c0_src:reg7, c1_dst:reg9, c1_src:Undefined, c2_dst:reg5, c2_src:reg9+ [ 190] End value:reg5block5:- [ 190] MovSrcUndefined dst:reg7- [ 198] GetGlobal value_feedback:6, dst:reg10, `A`- [ 1a8] CallConstruct value_feedback:7, call_feedback:2, dst:reg8, callee:reg10, A- [ 1c8] GetById value_feedback:8, dst:reg10, base:reg8, `baz`- [ 1e0] Call value_feedback:9, call_feedback:3, dst:reg9, callee:reg10, this_value:reg8, <object>.baz- [ 200] Mov2 c0_dst:reg7, c0_src:reg9, c1_dst:reg5, c1_src:reg7- [ 218] End value:reg5+ [ 198] MovSrcUndefined dst:reg7+ [ 1a0] GetGlobal value_feedback:6, dst:reg10, `A`+ [ 1b0] CallConstruct value_feedback:7, call_feedback:2, dst:reg8, callee:reg10, A+ [ 1d0] GetById value_feedback:8, dst:reg10, base:reg8, `baz`+ [ 1e8] Call value_feedback:9, call_feedback:3, dst:reg9, callee:reg10, this_value:reg8, <object>.baz+ [ 208] Mov2 c0_dst:reg7, c0_src:reg9, c1_dst:reg5, c1_src:reg7+ [ 220] End value:reg5Exception handlers:- [ c8 .. 158] => handler block1- [ 190 .. 220] => handler block4+ [ d0 .. 160] => handler block1+ [ 198 .. 228] => handler block4A$70678274diff --git a/Tests/LibJS/Bytecode/expected/destructuring-assignment.txt b/Tests/LibJS/Bytecode/expected/destructuring-assignment.txtindex dec59c3fc96..6bc9a995457 100644--- a/Tests/LibJS/Bytecode/expected/destructuring-assignment.txt+++ b/Tests/LibJS/Bytecode/expected/destructuring-assignment.txt@@ -15,7 +15,7 @@ block0:[ 98] End value:reg5-array_destructuring_with_class_default$d77d6ad0 destructuring-assignment.js:6:10+array_destructuring_with_class_default$58df6358 destructuring-assignment.js:6:10Registers: 15Blocks: 18Locals: x~0@@ -62,44 +62,44 @@ block7:[ 108] CreateVariable `C`, is_immutable:true, is_global:false, is_strict:true[ 118] SetLexicalEnvironment environment:reg4[ 120] NewClass dst:reg14, class_environment:reg13, class_blueprint_index:0- [ 140] Mov dst:reg12, src:reg14+ [ 148] Mov dst:reg12, src:reg14block8:- [ 150] Mov dst:x~0, src:reg12+ [ 158] Mov dst:x~0, src:reg12block9:- [ 160] JumpFalse condition:reg9, target:block11+ [ 168] JumpFalse condition:reg9, target:block11block10:- [ 170] Return value:x~0+ [ 178] Return value:x~0block11:- [ 178] IteratorClose iterator_object:reg7, iterator_next:reg8, iterator_done:reg9, completion_value:Undefined- [ 198] JumpLoop target:block10+ [ 180] IteratorClose iterator_object:reg7, iterator_next:reg8, iterator_done:reg9, completion_value:Undefined+ [ 1a0] JumpLoop target:block10block12:- [ 1a0] JumpStrictlyEqualsRhsInt32 arith_feedback:0, lhs:reg10, rhs:1, true_target:block14, false_target:block15+ [ 1a8] JumpStrictlyEqualsRhsInt32 arith_feedback:0, lhs:reg10, rhs:1, true_target:block14, false_target:block15block13:- [ 1b8] JumpStrictlyEqualsRhsInt32 arith_feedback:1, lhs:reg10, rhs:2, true_target:block16, false_target:block17+ [ 1c0] JumpStrictlyEqualsRhsInt32 arith_feedback:1, lhs:reg10, rhs:2, true_target:block16, false_target:block17block14:- [ 1d0] IteratorClose iterator_object:reg7, iterator_next:reg8, iterator_done:reg9, completion_value:reg11- [ 1f0] Throw src:reg11+ [ 1d8] IteratorClose iterator_object:reg7, iterator_next:reg8, iterator_done:reg9, completion_value:reg11+ [ 1f8] Throw src:reg11block15:- [ 1f8] IteratorClose iterator_object:reg7, iterator_next:reg8, iterator_done:reg9, completion_value:Undefined- [ 218] JumpLoop target:block13+ [ 200] IteratorClose iterator_object:reg7, iterator_next:reg8, iterator_done:reg9, completion_value:Undefined+ [ 220] JumpLoop target:block13block16:- [ 220] Return value:reg11+ [ 228] Return value:reg11block17:- [ 228] Throw src:reg11+ [ 230] Throw src:reg11Exception handlers:[ a0 .. b8] => handler block1- [ e0 .. 160] => handler block1+ [ e0 .. 168] => handler block1object_destructuring_with_function_default$cadc791a destructuring-assignment.js:12:12diff --git a/Tests/LibJS/Bytecode/expected/named-class-expression-no-lhs-name-leak.txt b/Tests/LibJS/Bytecode/expected/named-class-expression-no-lhs-name-leak.txtindex aec5ef314be..c37b0663fdb 100644--- a/Tests/LibJS/Bytecode/expected/named-class-expression-no-lhs-name-leak.txt+++ b/Tests/LibJS/Bytecode/expected/named-class-expression-no-lhs-name-leak.txt@@ -1,4 +1,4 @@-$f3cbcd2f named-class-expression-no-lhs-name-leak.js:1:1+$752dc5b7 named-class-expression-no-lhs-name-leak.js:1:1Registers: 15Blocks: 18Constants:@@ -43,41 +43,41 @@ block7:[ f8] CreateVariable `Foo`, is_immutable:true, is_global:false, is_strict:true[ 108] SetLexicalEnvironment environment:reg4[ 110] NewClass dst:reg14, class_environment:reg13, class_blueprint_index:0- [ 130] Mov dst:reg12, src:reg14+ [ 138] Mov dst:reg12, src:reg14block8:- [ 140] SetGlobal `C`, src:reg12+ [ 148] SetGlobal `C`, src:reg12block9:- [ 150] JumpFalse condition:reg9, target:block11+ [ 158] JumpFalse condition:reg9, target:block11block10:- [ 160] JumpLoop target:block2+ [ 168] JumpLoop target:block2block11:- [ 168] IteratorClose iterator_object:reg7, iterator_next:reg8, iterator_done:reg9, completion_value:Undefined- [ 188] JumpLoop target:block10+ [ 170] IteratorClose iterator_object:reg7, iterator_next:reg8, iterator_done:reg9, completion_value:Undefined+ [ 190] JumpLoop target:block10block12:- [ 190] JumpStrictlyEqualsRhsInt32 arith_feedback:0, lhs:reg10, rhs:1, true_target:block14, false_target:block15+ [ 198] JumpStrictlyEqualsRhsInt32 arith_feedback:0, lhs:reg10, rhs:1, true_target:block14, false_target:block15block13:- [ 1a8] JumpStrictlyEqualsRhsInt32 arith_feedback:1, lhs:reg10, rhs:2, true_target:block16, false_target:block17+ [ 1b0] JumpStrictlyEqualsRhsInt32 arith_feedback:1, lhs:reg10, rhs:2, true_target:block16, false_target:block17block14:- [ 1c0] IteratorClose iterator_object:reg7, iterator_next:reg8, iterator_done:reg9, completion_value:reg11- [ 1e0] Throw src:reg11+ [ 1c8] IteratorClose iterator_object:reg7, iterator_next:reg8, iterator_done:reg9, completion_value:reg11+ [ 1e8] Throw src:reg11block15:- [ 1e8] IteratorClose iterator_object:reg7, iterator_next:reg8, iterator_done:reg9, completion_value:Undefined- [ 208] JumpLoop target:block13+ [ 1f0] IteratorClose iterator_object:reg7, iterator_next:reg8, iterator_done:reg9, completion_value:Undefined+ [ 210] JumpLoop target:block13block16:- [ 210] Return value:reg11+ [ 218] Return value:reg11block17:- [ 218] Throw src:reg11+ [ 220] Throw src:reg11Exception handlers:[ 90 .. a8] => handler block1- [ d0 .. 150] => handler block1+ [ d0 .. 158] => handler block1diff --git a/Tests/LibJS/Bytecode/expected/numeric-class-field-name.txt b/Tests/LibJS/Bytecode/expected/numeric-class-field-name.txtindex 28c886bbd68..e4c5a1dc44e 100644--- a/Tests/LibJS/Bytecode/expected/numeric-class-field-name.txt+++ b/Tests/LibJS/Bytecode/expected/numeric-class-field-name.txt@@ -1,4 +1,4 @@-$fe0af08d numeric-class-field-name.js:1:1+$79e506f5 numeric-class-field-name.js:1:1Registers: 7Blocks: 1Constants:@@ -12,12 +12,12 @@ block0:[ 28] CreateVariable `C`, is_immutable:true, is_global:false, is_strict:true[ 38] SetLexicalEnvironment environment:reg4[ 40] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0, element_keys:[element_keys:Int32(42)]- [ 68] DynamicInitializeLexicalBinding `C`, src:reg6- [ 78] GetGlobal value_feedback:0, dst:reg5, `C`- [ 88] CallConstruct value_feedback:1, call_feedback:0, dst:reg6, callee:reg5, C- [ a8] GetByValue value_feedback:2, keyed_feedback:0, dst:reg5, base:reg6, property:Int32(42)- [ c8] GetById value_feedback:3, dst:reg6, base:reg5, `name` ([42].name)- [ e0] End value:reg6+ [ 70] DynamicInitializeLexicalBinding `C`, src:reg6+ [ 80] GetGlobal value_feedback:0, dst:reg5, `C`+ [ 90] CallConstruct value_feedback:1, call_feedback:0, dst:reg6, callee:reg5, C+ [ b0] GetByValue value_feedback:2, keyed_feedback:0, dst:reg5, base:reg6, property:Int32(42)+ [ d0] GetById value_feedback:3, dst:reg6, base:reg5, `name` ([42].name)+ [ e8] End value:reg6C$638b9046@@ -31,7 +31,7 @@ block0:[ 8] End value:Undefined-field$307a5207 numeric-class-field-name.js:2:10+field$b4a03b9f numeric-class-field-name.js:2:10Registers: 7Blocks: 1@@ -41,4 +41,4 @@ block0:[ 10] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:0, is_catch_environment:false[ 28] SetLexicalEnvironment environment:reg4[ 30] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0 (42)- [ 50] Return value:reg6+ [ 58] Return value:reg6diff --git a/Tests/LibJS/Bytecode/expected/parameter-environment-capacity.txt b/Tests/LibJS/Bytecode/expected/parameter-environment-capacity.txtindex e9ac634b73e..2dae3705d37 100644--- a/Tests/LibJS/Bytecode/expected/parameter-environment-capacity.txt+++ b/Tests/LibJS/Bytecode/expected/parameter-environment-capacity.txt@@ -1,4 +1,4 @@-$83182f31 parameter-environment-capacity.js:10:1+$0cc5fae9 parameter-environment-capacity.js:10:1Registers: 9Blocks: 1Constants:@@ -12,14 +12,14 @@ block0:[ 28] CreateVariable `Strict`, is_immutable:true, is_global:false, is_strict:true[ 38] SetLexicalEnvironment environment:reg4[ 40] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0, element_keys:[element_keys:String("method")]- [ 68] DynamicInitializeLexicalBinding `Strict`, src:reg6- [ 78] GetGlobal value_feedback:0, dst:reg5, `sloppy`- [ 88] Call value_feedback:1, call_feedback:0, dst:reg6, callee:reg5, this_value:Undefined, sloppy- [ a8] GetGlobal value_feedback:2, dst:reg8, `Strict`- [ b8] CallConstruct value_feedback:3, call_feedback:1, dst:reg7, callee:reg8, Strict- [ d8] GetById value_feedback:4, dst:reg8, base:reg7, `method`- [ f0] Call value_feedback:5, call_feedback:2, dst:reg5, callee:reg8, this_value:reg7, <object>.method- [ 110] End value:reg5+ [ 70] DynamicInitializeLexicalBinding `Strict`, src:reg6+ [ 80] GetGlobal value_feedback:0, dst:reg5, `sloppy`+ [ 90] Call value_feedback:1, call_feedback:0, dst:reg6, callee:reg5, this_value:Undefined, sloppy+ [ b0] GetGlobal value_feedback:2, dst:reg8, `Strict`+ [ c0] CallConstruct value_feedback:3, call_feedback:1, dst:reg7, callee:reg8, Strict+ [ e0] GetById value_feedback:4, dst:reg8, base:reg7, `method`+ [ f8] Call value_feedback:5, call_feedback:2, dst:reg5, callee:reg8, this_value:reg7, <object>.method+ [ 118] End value:reg5sloppy$b222ab46 parameter-environment-capacity.js:7:5diff --git a/Tests/LibJS/Bytecode/expected/postfix-increment-private-member.txt b/Tests/LibJS/Bytecode/expected/postfix-increment-private-member.txtindex 277bdfc9b11..88ea4bfd94c 100644--- a/Tests/LibJS/Bytecode/expected/postfix-increment-private-member.txt+++ b/Tests/LibJS/Bytecode/expected/postfix-increment-private-member.txt@@ -1,4 +1,4 @@-$2d2a9e5a postfix-increment-private-member.js:1:1+$ae8c96e2 postfix-increment-private-member.js:1:1Registers: 8Blocks: 1Constants:@@ -14,13 +14,13 @@ block0:[ 40] AddPrivateName `#c`[ 48] SetLexicalEnvironment environment:reg4[ 50] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0, element_keys:[element_keys:String("nextId")]- [ 78] LeavePrivateEnvironment- [ 80] DynamicInitializeLexicalBinding `C`, src:reg6- [ 90] GetGlobal value_feedback:0, dst:reg7, `C`- [ a0] CallConstruct value_feedback:1, call_feedback:0, dst:reg5, callee:reg7, C- [ c0] GetById value_feedback:2, dst:reg7, base:reg5, `nextId`- [ d8] Call value_feedback:3, call_feedback:1, dst:reg6, callee:reg7, this_value:reg5, <object>.nextId- [ f8] End value:reg6+ [ 80] LeavePrivateEnvironment+ [ 88] DynamicInitializeLexicalBinding `C`, src:reg6+ [ 98] GetGlobal value_feedback:0, dst:reg7, `C`+ [ a8] CallConstruct value_feedback:1, call_feedback:0, dst:reg5, callee:reg7, C+ [ c8] GetById value_feedback:2, dst:reg7, base:reg5, `nextId`+ [ e0] Call value_feedback:3, call_feedback:1, dst:reg6, callee:reg7, this_value:reg5, <object>.nextId+ [ 100] End value:reg6C$638b9046diff --git a/Tests/LibJS/Bytecode/expected/private-identifier-access-patterns.txt b/Tests/LibJS/Bytecode/expected/private-identifier-access-patterns.txtindex e0ce20ced07..50c9db3eabd 100644--- a/Tests/LibJS/Bytecode/expected/private-identifier-access-patterns.txt+++ b/Tests/LibJS/Bytecode/expected/private-identifier-access-patterns.txt@@ -1,4 +1,4 @@-$00cee19d private-identifier-access-patterns.js:1:1+$87b8bc45 private-identifier-access-patterns.js:1:1Registers: 7Blocks: 1Constants:@@ -14,6 +14,6 @@ block0:[ 40] AddPrivateName `#x`[ 48] SetLexicalEnvironment environment:reg4[ 50] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0, element_keys:[element_keys:String("method")]- [ 78] LeavePrivateEnvironment- [ 80] DynamicInitializeLexicalBinding `C`, src:reg6- [ 90] End value:Undefined+ [ 80] LeavePrivateEnvironment+ [ 88] DynamicInitializeLexicalBinding `C`, src:reg6+ [ 98] End value:Undefineddiff --git a/Tests/LibJS/Bytecode/expected/private-logical-assignment-register-order.txt b/Tests/LibJS/Bytecode/expected/private-logical-assignment-register-order.txtindex 03fe32b4ca2..a3c117ac490 100644--- a/Tests/LibJS/Bytecode/expected/private-logical-assignment-register-order.txt+++ b/Tests/LibJS/Bytecode/expected/private-logical-assignment-register-order.txt@@ -1,4 +1,4 @@-$2d2a9e5a private-logical-assignment-register-order.js:1:1+$ae8c96e2 private-logical-assignment-register-order.js:1:1Registers: 8Blocks: 1Constants:@@ -14,13 +14,13 @@ block0:[ 40] AddPrivateName `#x`[ 48] SetLexicalEnvironment environment:reg4[ 50] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0, element_keys:[element_keys:String("f")]- [ 78] LeavePrivateEnvironment- [ 80] DynamicInitializeLexicalBinding `C`, src:reg6- [ 90] GetGlobal value_feedback:0, dst:reg7, `C`- [ a0] CallConstruct value_feedback:1, call_feedback:0, dst:reg5, callee:reg7, C- [ c0] GetById value_feedback:2, dst:reg7, base:reg5, `f`- [ d8] Call value_feedback:3, call_feedback:1, dst:reg6, callee:reg7, this_value:reg5, <object>.f- [ f8] End value:reg6+ [ 80] LeavePrivateEnvironment+ [ 88] DynamicInitializeLexicalBinding `C`, src:reg6+ [ 98] GetGlobal value_feedback:0, dst:reg7, `C`+ [ a8] CallConstruct value_feedback:1, call_feedback:0, dst:reg5, callee:reg7, C+ [ c8] GetById value_feedback:2, dst:reg7, base:reg5, `f`+ [ e0] Call value_feedback:3, call_feedback:1, dst:reg6, callee:reg7, this_value:reg5, <object>.f+ [ 100] End value:reg6C$638b9046diff --git a/Tests/LibJS/Bytecode/expected/private-method-call-description.txt b/Tests/LibJS/Bytecode/expected/private-method-call-description.txtindex a87401aacda..768c0ae253c 100644--- a/Tests/LibJS/Bytecode/expected/private-method-call-description.txt+++ b/Tests/LibJS/Bytecode/expected/private-method-call-description.txt@@ -1,4 +1,4 @@-$2d2a9e5a private-method-call-description.js:1:1+$ae8c96e2 private-method-call-description.js:1:1Registers: 8Blocks: 1Constants:@@ -14,13 +14,13 @@ block0:[ 40] AddPrivateName `#m`[ 48] SetLexicalEnvironment environment:reg4[ 50] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0, element_keys:[element_keys:String("call")]- [ 78] LeavePrivateEnvironment- [ 80] DynamicInitializeLexicalBinding `C`, src:reg6- [ 90] GetGlobal value_feedback:0, dst:reg7, `C`- [ a0] CallConstruct value_feedback:1, call_feedback:0, dst:reg5, callee:reg7, C- [ c0] GetById value_feedback:2, dst:reg7, base:reg5, `call`- [ d8] Call value_feedback:3, call_feedback:1, dst:reg6, callee:reg7, this_value:reg5, <object>.call- [ f8] End value:reg6+ [ 80] LeavePrivateEnvironment+ [ 88] DynamicInitializeLexicalBinding `C`, src:reg6+ [ 98] GetGlobal value_feedback:0, dst:reg7, `C`+ [ a8] CallConstruct value_feedback:1, call_feedback:0, dst:reg5, callee:reg7, C+ [ c8] GetById value_feedback:2, dst:reg7, base:reg5, `call`+ [ e0] Call value_feedback:3, call_feedback:1, dst:reg6, callee:reg7, this_value:reg5, <object>.call+ [ 100] End value:reg6C$638b9046diff --git a/Tests/LibJS/Bytecode/expected/super-call-spread-register-order.txt b/Tests/LibJS/Bytecode/expected/super-call-spread-register-order.txtindex a9dbd830623..7fcbd2fa87e 100644--- a/Tests/LibJS/Bytecode/expected/super-call-spread-register-order.txt+++ b/Tests/LibJS/Bytecode/expected/super-call-spread-register-order.txt@@ -1,5 +1,5 @@-$0656c3bd super-call-spread-register-order.js:1:1- Registers: 8+$745d24d5 super-call-spread-register-order.js:1:1+ Registers: 9Blocks: 1Constants:[0] = Undefined@@ -10,12 +10,13 @@ block0:[ 10] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:1, is_catch_environment:false[ 28] CreateVariable `C`, is_immutable:true, is_global:false, is_strict:true[ 38] GetGlobal value_feedback:0, dst:reg6, `Object`- [ 48] SetLexicalEnvironment environment:reg4- [ 50] NewClass dst:reg7, super_class:reg6, class_environment:reg5, class_blueprint_index:0- [ 70] DynamicInitializeLexicalBinding `C`, src:reg7- [ 80] GetGlobal value_feedback:1, dst:reg5, `C`- [ 90] CallConstruct value_feedback:2, call_feedback:0, dst:reg7, callee:reg5, C- [ b0] End value:reg7+ [ 48] GetClassProtoParent dst:reg7, super_class:reg6+ [ 58] SetLexicalEnvironment environment:reg4+ [ 60] NewClass dst:reg8, super_class:reg6, proto_parent:reg7, class_environment:reg5, class_blueprint_index:0+ [ 88] DynamicInitializeLexicalBinding `C`, src:reg8+ [ 98] GetGlobal value_feedback:1, dst:reg5, `C`+ [ a8] CallConstruct value_feedback:2, call_feedback:0, dst:reg8, callee:reg5, C+ [ c8] End value:reg8C$3cf8ba4b super-call-spread-register-order.js:3:14diff --git a/Tests/LibJS/Bytecode/expected/super-computed-eval-order.txt b/Tests/LibJS/Bytecode/expected/super-computed-eval-order.txtindex 3c1b7136f47..bd1d5598124 100644--- a/Tests/LibJS/Bytecode/expected/super-computed-eval-order.txt+++ b/Tests/LibJS/Bytecode/expected/super-computed-eval-order.txt@@ -1,5 +1,5 @@-$a0b8e192 super-computed-eval-order.js:1:1- Registers: 8+$a640c3b2 super-computed-eval-order.js:1:1+ Registers: 9Blocks: 1Constants:[0] = String("test")@@ -12,18 +12,19 @@ block0:[ 28] CreateVariable `Base`, is_immutable:true, is_global:false, is_strict:true[ 38] SetLexicalEnvironment environment:reg4[ 40] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0- [ 60] DynamicInitializeLexicalBinding `Base`, src:reg6- [ 70] CreateLexicalEnvironment dst:reg6, parent:reg4, capacity:1, is_catch_environment:false- [ 88] CreateVariable `Derived`, is_immutable:true, is_global:false, is_strict:true- [ 98] GetGlobal value_feedback:0, dst:reg5, `Base`- [ a8] SetLexicalEnvironment environment:reg4- [ b0] NewClass dst:reg7, super_class:reg5, class_environment:reg6, class_blueprint_index:1, element_keys:[element_keys:String("test")]- [ d8] DynamicInitializeLexicalBinding `Derived`, src:reg7- [ e8] GetGlobal value_feedback:1, dst:reg5, `Derived`- [ f8] CallConstruct value_feedback:2, call_feedback:0, dst:reg6, callee:reg5, Derived- [ 118] GetById value_feedback:3, dst:reg5, base:reg6, `test`- [ 130] Call value_feedback:4, call_feedback:1, dst:reg7, callee:reg5, this_value:reg6, <object>.test- [ 150] End value:reg7+ [ 68] DynamicInitializeLexicalBinding `Base`, src:reg6+ [ 78] CreateLexicalEnvironment dst:reg6, parent:reg4, capacity:1, is_catch_environment:false+ [ 90] CreateVariable `Derived`, is_immutable:true, is_global:false, is_strict:true+ [ a0] GetGlobal value_feedback:0, dst:reg5, `Base`+ [ b0] GetClassProtoParent dst:reg7, super_class:reg5+ [ c0] SetLexicalEnvironment environment:reg4+ [ c8] NewClass dst:reg8, super_class:reg5, proto_parent:reg7, class_environment:reg6, class_blueprint_index:1, element_keys:[element_keys:String("test")]+ [ f8] DynamicInitializeLexicalBinding `Derived`, src:reg8+ [ 108] GetGlobal value_feedback:1, dst:reg5, `Derived`+ [ 118] CallConstruct value_feedback:2, call_feedback:0, dst:reg6, callee:reg5, Derived+ [ 138] GetById value_feedback:3, dst:reg5, base:reg6, `test`+ [ 150] Call value_feedback:4, call_feedback:1, dst:reg8, callee:reg5, this_value:reg6, <object>.test+ [ 170] End value:reg8Derived$eee8d5da super-computed-eval-order.js:4:14diff --git a/Tests/LibJS/Bytecode/expected/super-computed-string-to-id.txt b/Tests/LibJS/Bytecode/expected/super-computed-string-to-id.txtindex 8f323b6f3ea..01964aa3aa0 100644--- a/Tests/LibJS/Bytecode/expected/super-computed-string-to-id.txt+++ b/Tests/LibJS/Bytecode/expected/super-computed-string-to-id.txt@@ -1,5 +1,5 @@-$0656c3bd super-computed-string-to-id.js:1:1- Registers: 8+$745d24d5 super-computed-string-to-id.js:1:1+ Registers: 9Blocks: 1Constants:[0] = Undefined@@ -10,12 +10,13 @@ block0:[ 10] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:1, is_catch_environment:false[ 28] CreateVariable `C`, is_immutable:true, is_global:false, is_strict:true[ 38] GetGlobal value_feedback:0, dst:reg6, `Object`- [ 48] SetLexicalEnvironment environment:reg4- [ 50] NewClass dst:reg7, super_class:reg6, class_environment:reg5, class_blueprint_index:0- [ 70] DynamicInitializeLexicalBinding `C`, src:reg7- [ 80] GetGlobal value_feedback:1, dst:reg5, `C`- [ 90] CallConstruct value_feedback:2, call_feedback:0, dst:reg7, callee:reg5, C- [ b0] End value:reg7+ [ 48] GetClassProtoParent dst:reg7, super_class:reg6+ [ 58] SetLexicalEnvironment environment:reg4+ [ 60] NewClass dst:reg8, super_class:reg6, proto_parent:reg7, class_environment:reg5, class_blueprint_index:0+ [ 88] DynamicInitializeLexicalBinding `C`, src:reg8+ [ 98] GetGlobal value_feedback:1, dst:reg5, `C`+ [ a8] CallConstruct value_feedback:2, call_feedback:0, dst:reg8, callee:reg5, C+ [ c8] End value:reg8C$3a34c93b super-computed-string-to-id.js:3:14diff --git a/Tests/LibJS/Bytecode/expected/super-constructor-call.txt b/Tests/LibJS/Bytecode/expected/super-constructor-call.txtindex 1aaa0e1d83f..c19c7d8a11c 100644--- a/Tests/LibJS/Bytecode/expected/super-constructor-call.txt+++ b/Tests/LibJS/Bytecode/expected/super-constructor-call.txt@@ -1,5 +1,5 @@-$32b2807a super-constructor-call.js:1:1- Registers: 8+$221ada1a super-constructor-call.js:1:1+ Registers: 9Blocks: 1Constants:[0] = Undefined@@ -12,16 +12,17 @@ block0:[ 28] CreateVariable `Base`, is_immutable:true, is_global:false, is_strict:true[ 38] SetLexicalEnvironment environment:reg4[ 40] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0- [ 60] DynamicInitializeLexicalBinding `Base`, src:reg6- [ 70] CreateLexicalEnvironment dst:reg6, parent:reg4, capacity:1, is_catch_environment:false- [ 88] CreateVariable `Derived`, is_immutable:true, is_global:false, is_strict:true- [ 98] GetGlobal value_feedback:0, dst:reg5, `Base`- [ a8] SetLexicalEnvironment environment:reg4- [ b0] NewClass dst:reg7, super_class:reg5, class_environment:reg6, class_blueprint_index:1- [ d0] DynamicInitializeLexicalBinding `Derived`, src:reg7- [ e0] GetGlobal value_feedback:1, dst:reg6, `Derived`- [ f0] CallConstruct value_feedback:2, call_feedback:0, dst:reg7, callee:reg6, Derived, arguments:[Int32(1)]- [ 118] End value:reg7+ [ 68] DynamicInitializeLexicalBinding `Base`, src:reg6+ [ 78] CreateLexicalEnvironment dst:reg6, parent:reg4, capacity:1, is_catch_environment:false+ [ 90] CreateVariable `Derived`, is_immutable:true, is_global:false, is_strict:true+ [ a0] GetGlobal value_feedback:0, dst:reg5, `Base`+ [ b0] GetClassProtoParent dst:reg7, super_class:reg5+ [ c0] SetLexicalEnvironment environment:reg4+ [ c8] NewClass dst:reg8, super_class:reg5, proto_parent:reg7, class_environment:reg6, class_blueprint_index:1+ [ f0] DynamicInitializeLexicalBinding `Derived`, src:reg8+ [ 100] GetGlobal value_feedback:1, dst:reg6, `Derived`+ [ 110] CallConstruct value_feedback:2, call_feedback:0, dst:reg8, callee:reg6, Derived, arguments:[Int32(1)]+ [ 138] End value:reg8Derived$6ac2ec42 super-constructor-call.js:4:14diff --git a/Tests/LibJS/Bytecode/expected/super-evaluation-order.txt b/Tests/LibJS/Bytecode/expected/super-evaluation-order.txtindex 8c412447936..ab8feab6aa0 100644--- a/Tests/LibJS/Bytecode/expected/super-evaluation-order.txt+++ b/Tests/LibJS/Bytecode/expected/super-evaluation-order.txt@@ -1,4 +1,4 @@-$3576718a super-evaluation-order.js:1:1+$bf243d42 super-evaluation-order.js:1:1Registers: 9Blocks: 1Constants:@@ -13,22 +13,23 @@ block0:[ 10] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:1, is_catch_environment:false[ 28] CreateVariable `A`, is_immutable:true, is_global:false, is_strict:true[ 38] GetGlobal value_feedback:0, dst:reg6, `Object`- [ 48] SetLexicalEnvironment environment:reg4- [ 50] NewClass dst:reg7, super_class:reg6, class_environment:reg5, class_blueprint_index:0, element_keys:[element_keys:String("read"), element_keys:String("write"), element_keys:String("update")]- [ 80] DynamicInitializeLexicalBinding `A`, src:reg7- [ 90] GetGlobal value_feedback:1, dst:reg6, `A`- [ a0] CallConstruct value_feedback:2, call_feedback:0, dst:reg5, callee:reg6, A- [ c0] GetById value_feedback:3, dst:reg6, base:reg5, `read`- [ d8] Call value_feedback:4, call_feedback:1, dst:reg7, callee:reg6, this_value:reg5, <object>.read- [ f8] GetGlobal value_feedback:5, dst:reg8, `A`- [ 108] CallConstruct value_feedback:6, call_feedback:2, dst:reg5, callee:reg8, A- [ 128] GetById value_feedback:7, dst:reg8, base:reg5, `write`- [ 140] Call value_feedback:8, call_feedback:3, dst:reg6, callee:reg8, this_value:reg5, <object>.write- [ 160] GetGlobal value_feedback:9, dst:reg5, `A`- [ 170] CallConstruct value_feedback:10, call_feedback:4, dst:reg8, callee:reg5, A- [ 190] GetById value_feedback:11, dst:reg5, base:reg8, `update`- [ 1a8] Call value_feedback:12, call_feedback:5, dst:reg7, callee:reg5, this_value:reg8, <object>.update- [ 1c8] End value:reg7+ [ 48] GetClassProtoParent dst:reg7, super_class:reg6+ [ 58] SetLexicalEnvironment environment:reg4+ [ 60] NewClass dst:reg8, super_class:reg6, proto_parent:reg7, class_environment:reg5, class_blueprint_index:0, element_keys:[element_keys:String("read"), element_keys:String("write"), element_keys:String("update")]+ [ 98] DynamicInitializeLexicalBinding `A`, src:reg8+ [ a8] GetGlobal value_feedback:1, dst:reg6, `A`+ [ b8] CallConstruct value_feedback:2, call_feedback:0, dst:reg5, callee:reg6, A+ [ d8] GetById value_feedback:3, dst:reg6, base:reg5, `read`+ [ f0] Call value_feedback:4, call_feedback:1, dst:reg8, callee:reg6, this_value:reg5, <object>.read+ [ 110] GetGlobal value_feedback:5, dst:reg7, `A`+ [ 120] CallConstruct value_feedback:6, call_feedback:2, dst:reg5, callee:reg7, A+ [ 140] GetById value_feedback:7, dst:reg7, base:reg5, `write`+ [ 158] Call value_feedback:8, call_feedback:3, dst:reg6, callee:reg7, this_value:reg5, <object>.write+ [ 178] GetGlobal value_feedback:9, dst:reg5, `A`+ [ 188] CallConstruct value_feedback:10, call_feedback:4, dst:reg7, callee:reg5, A+ [ 1a8] GetById value_feedback:11, dst:reg5, base:reg7, `update`+ [ 1c0] Call value_feedback:12, call_feedback:5, dst:reg8, callee:reg5, this_value:reg7, <object>.update+ [ 1e0] End value:reg8A$9ff96274 super-evaluation-order.js:1:1diff --git a/Tests/LibJS/Bytecode/expected/super-for-of-resolve-order.txt b/Tests/LibJS/Bytecode/expected/super-for-of-resolve-order.txtindex 62ecc648370..42bad3cc829 100644--- a/Tests/LibJS/Bytecode/expected/super-for-of-resolve-order.txt+++ b/Tests/LibJS/Bytecode/expected/super-for-of-resolve-order.txt@@ -1,4 +1,4 @@-$091ab4cd super-for-of-resolve-order.js:1:1+$84f4cb35 super-for-of-resolve-order.js:1:1Registers: 7Blocks: 1Constants:@@ -11,10 +11,10 @@ block0:[ 28] CreateVariable `C`, is_immutable:true, is_global:false, is_strict:true[ 38] SetLexicalEnvironment environment:reg4[ 40] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0- [ 60] DynamicInitializeLexicalBinding `C`, src:reg6- [ 70] GetGlobal value_feedback:0, dst:reg5, `C`- [ 80] CallConstruct value_feedback:1, call_feedback:0, dst:reg6, callee:reg5, C- [ a0] End value:reg6+ [ 68] DynamicInitializeLexicalBinding `C`, src:reg6+ [ 78] GetGlobal value_feedback:0, dst:reg5, `C`+ [ 88] CallConstruct value_feedback:1, call_feedback:0, dst:reg6, callee:reg5, C+ [ a8] End value:reg6C$a04f1576 super-for-of-resolve-order.js:3:28diff --git a/Tests/LibJS/Bytecode/expected/super-length-access.txt b/Tests/LibJS/Bytecode/expected/super-length-access.txtindex 6958bc69139..4b66310606c 100644--- a/Tests/LibJS/Bytecode/expected/super-length-access.txt+++ b/Tests/LibJS/Bytecode/expected/super-length-access.txt@@ -1,5 +1,5 @@-$e4db251c super-length-access.js:3:1- Registers: 8+$be23f63c super-length-access.js:3:1+ Registers: 9Blocks: 1Constants:[0] = String("length")@@ -13,18 +13,19 @@ block0:[ 28] CreateVariable `A`, is_immutable:true, is_global:false, is_strict:true[ 38] SetLexicalEnvironment environment:reg4[ 40] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0, element_keys:[element_keys:String("length")]- [ 68] DynamicInitializeLexicalBinding `A`, src:reg6- [ 78] CreateLexicalEnvironment dst:reg6, parent:reg4, capacity:1, is_catch_environment:false- [ 90] CreateVariable `B`, is_immutable:true, is_global:false, is_strict:true- [ a0] GetGlobal value_feedback:0, dst:reg5, `A`- [ b0] SetLexicalEnvironment environment:reg4- [ b8] NewClass dst:reg7, super_class:reg5, class_environment:reg6, class_blueprint_index:1, element_keys:[element_keys:String("m")]- [ e0] DynamicInitializeLexicalBinding `B`, src:reg7- [ f0] GetGlobal value_feedback:1, dst:reg5, `B`- [ 100] CallConstruct value_feedback:2, call_feedback:0, dst:reg6, callee:reg5, B- [ 120] GetById value_feedback:3, dst:reg5, base:reg6, `m`- [ 138] Call value_feedback:4, call_feedback:1, dst:reg7, callee:reg5, this_value:reg6, <object>.m- [ 158] End value:reg7+ [ 70] DynamicInitializeLexicalBinding `A`, src:reg6+ [ 80] CreateLexicalEnvironment dst:reg6, parent:reg4, capacity:1, is_catch_environment:false+ [ 98] CreateVariable `B`, is_immutable:true, is_global:false, is_strict:true+ [ a8] GetGlobal value_feedback:0, dst:reg5, `A`+ [ b8] GetClassProtoParent dst:reg7, super_class:reg5+ [ c8] SetLexicalEnvironment environment:reg4+ [ d0] NewClass dst:reg8, super_class:reg5, proto_parent:reg7, class_environment:reg6, class_blueprint_index:1, element_keys:[element_keys:String("m")]+ [ 100] DynamicInitializeLexicalBinding `B`, src:reg8+ [ 110] GetGlobal value_feedback:1, dst:reg5, `B`+ [ 120] CallConstruct value_feedback:2, call_feedback:0, dst:reg6, callee:reg5, B+ [ 140] GetById value_feedback:3, dst:reg5, base:reg6, `m`+ [ 158] Call value_feedback:4, call_feedback:1, dst:reg8, callee:reg5, this_value:reg6, <object>.m+ [ 178] End value:reg8B$73f1ca79 super-length-access.js:7:1diff --git a/Tests/LibJS/Bytecode/expected/super-optional-call-this.txt b/Tests/LibJS/Bytecode/expected/super-optional-call-this.txtindex ac9a6aae266..498dc089ca4 100644--- a/Tests/LibJS/Bytecode/expected/super-optional-call-this.txt+++ b/Tests/LibJS/Bytecode/expected/super-optional-call-this.txt@@ -1,5 +1,5 @@-$27a2bc3a super-optional-call-this.js:1:1- Registers: 8+$434a26da super-optional-call-this.js:1:1+ Registers: 9Blocks: 1Constants:[0] = String("method")@@ -12,18 +12,19 @@ block0:[ 28] CreateVariable `Base`, is_immutable:true, is_global:false, is_strict:true[ 38] SetLexicalEnvironment environment:reg4[ 40] NewClass dst:reg6, class_environment:reg5, class_blueprint_index:0, element_keys:[element_keys:String("method")]- [ 68] DynamicInitializeLexicalBinding `Base`, src:reg6- [ 78] CreateLexicalEnvironment dst:reg6, parent:reg4, capacity:1, is_catch_environment:false- [ 90] CreateVariable `Foo`, is_immutable:true, is_global:false, is_strict:true- [ a0] GetGlobal value_feedback:0, dst:reg5, `Base`- [ b0] SetLexicalEnvironment environment:reg4- [ b8] NewClass dst:reg7, super_class:reg5, class_environment:reg6, class_blueprint_index:1, element_keys:[element_keys:String("method")]- [ e0] DynamicInitializeLexicalBinding `Foo`, src:reg7- [ f0] GetGlobal value_feedback:1, dst:reg5, `Foo`- [ 100] CallConstruct value_feedback:2, call_feedback:0, dst:reg6, callee:reg5, Foo- [ 120] GetById value_feedback:3, dst:reg5, base:reg6, `method`- [ 138] Call value_feedback:4, call_feedback:1, dst:reg7, callee:reg5, this_value:reg6, <object>.method- [ 158] End value:reg7+ [ 70] DynamicInitializeLexicalBinding `Base`, src:reg6+ [ 80] CreateLexicalEnvironment dst:reg6, parent:reg4, capacity:1, is_catch_environment:false+ [ 98] CreateVariable `Foo`, is_immutable:true, is_global:false, is_strict:true+ [ a8] GetGlobal value_feedback:0, dst:reg5, `Base`+ [ b8] GetClassProtoParent dst:reg7, super_class:reg5+ [ c8] SetLexicalEnvironment environment:reg4+ [ d0] NewClass dst:reg8, super_class:reg5, proto_parent:reg7, class_environment:reg6, class_blueprint_index:1, element_keys:[element_keys:String("method")]+ [ 100] DynamicInitializeLexicalBinding `Foo`, src:reg8+ [ 110] GetGlobal value_feedback:1, dst:reg5, `Foo`+ [ 120] CallConstruct value_feedback:2, call_feedback:0, dst:reg6, callee:reg5, Foo+ [ 140] GetById value_feedback:3, dst:reg5, base:reg6, `method`+ [ 158] Call value_feedback:4, call_feedback:1, dst:reg8, callee:reg5, this_value:reg6, <object>.method+ [ 178] End value:reg8Foo$9e411946 super-optional-call-this.js:4:1diff --git a/Tests/LibJS/Runtime/classes/class-definition-evaluation-order.js b/Tests/LibJS/Runtime/classes/class-definition-evaluation-order.jsindex 4d101bb4949..245dd9a74d7 100644--- a/Tests/LibJS/Runtime/classes/class-definition-evaluation-order.js+++ b/Tests/LibJS/Runtime/classes/class-definition-evaluation-order.js@@ -31,4 +31,49 @@ describe("class definition evaluation order", () => {expect(Object.getOwnPropertyNames(C.prototype)).toEqual(["constructor", "first"]);expect(C.second).toBe(1);});++ test("the superclass is the value the heritage evaluated to", () => {+ function reassignToNonConstructor() {+ let Base = class {};+ const Original = Base;+ const C = class extends Base {+ [((Base = 1), "m")]() {}+ };+ return Object.getPrototypeOf(C) === Original;+ }++ function reassignToOtherConstructor() {+ class First {}+ class Second {}+ let Base = First;+ const C = class extends Base {+ [((Base = Second), "m")]() {}+ };+ return [Object.getPrototypeOf(C) === First, Object.getPrototypeOf(C.prototype) === First.prototype];+ }++ expect(reassignToNonConstructor()).toBeTrue();+ expect(reassignToOtherConstructor()).toEqual([true, true]);+ });++ test("the heritage is checked before computed keys are evaluated", () => {+ const log = [];+ expect(() => {+ class C extends (0, 1) {+ [(log.push("key"), "m")]() {}+ }+ }).toThrowWithMessage(TypeError, "Class extends value 1 is not a constructor or null");+ expect(log).toEqual([]);++ const Base = new Proxy(function () {}, {+ get(target, property) {+ log.push(`get ${String(property)}`);+ return target[property];+ },+ });+ class D extends Base {+ [(log.push("key"), "m")]() {}+ }+ expect(log).toEqual(["get prototype", "key"]);+ });});