LibJS: Handle AsmInt returns without C++ helpers

Handle Return and End entirely in AsmInt when leaving an inline frame.
The handlers now restore the caller, update the interpreter stack
bookkeeping directly, and bump the execution generation without
bouncing through AsmInterpreter.cpp.

Add WeakRef tests that exercise both inline Return and inline End
so this path stays covered.
This commit is contained in:
Andreas Kling
2026-04-13 16:54:18 +02:00
committed by Andreas Kling
parent b1dab18e42
commit 12a916d14a
Notes: github-actions[bot] 2026-04-14 06:16:06 +00:00
4 changed files with 98 additions and 54 deletions

View File

@@ -271,8 +271,6 @@ u64 asm_helper_empty_string(u64);
u64 asm_helper_single_ascii_character_string(u64 encoded_value);
u64 asm_helper_single_utf16_code_unit_string(u64 encoded_value);
i64 asm_try_inline_call(VM*, u32 pc);
i64 asm_pop_inline_frame(VM*, u32 pc);
i64 asm_pop_inline_frame_end(VM*, u32 pc);
i64 asm_try_put_by_id_cache(VM*, u32 pc);
i64 asm_try_get_by_id_cache(VM*, u32 pc);
i64 asm_slow_path_initialize_lexical_binding(VM*, u32 pc);
@@ -885,30 +883,6 @@ i64 asm_try_inline_call(VM* vm, u32 pc)
return 0;
}
// Pop an inline frame after Return. Returns 0 on success.
i64 asm_pop_inline_frame(VM* vm, u32 pc)
{
auto* bytecode = vm->current_executable().bytecode.data();
auto& insn = *reinterpret_cast<Op::Return const*>(&bytecode[pc]);
auto value = vm->get(insn.value());
if (value.is_special_empty_value())
value = js_undefined();
vm->pop_inline_frame(value);
return 0;
}
// Pop an inline frame after End. Returns 0 on success.
i64 asm_pop_inline_frame_end(VM* vm, u32 pc)
{
auto* bytecode = vm->current_executable().bytecode.data();
auto& insn = *reinterpret_cast<Op::End const*>(&bytecode[pc]);
auto value = vm->get(insn.value());
if (value.is_special_empty_value())
value = js_undefined();
vm->pop_inline_frame(value);
return 0;
}
// Fast cache-only PutById. Tries all cache entries for ChangeOwnProperty and
// AddOwnProperty. Returns 0 on cache hit, 1 on miss (caller should use full slow path).
i64 asm_try_put_by_id_cache(VM* vm, u32 pc)