1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

LibJS/JIT: Support the EnterObjectEnvironment bytecode instruction

We can now use `with` statements in jitted code. :^)
This commit is contained in:
Andreas Kling 2023-11-12 00:12:21 +01:00
parent cfdb8a2756
commit cb7169d73f
4 changed files with 26 additions and 5 deletions

View file

@ -1988,6 +1988,20 @@ void Compiler::compile_leave_lexical_environment(Bytecode::Op::LeaveLexicalEnvir
native_call((void*)cxx_leave_lexical_environment);
}
static Value cxx_enter_object_environment(VM& vm, Value value)
{
auto object = TRY_OR_SET_EXCEPTION(value.to_object(vm));
vm.bytecode_interpreter().enter_object_environment(*object);
return {};
}
void Compiler::compile_enter_object_environment(Bytecode::Op::EnterObjectEnvironment const&)
{
load_accumulator(ARG1);
native_call((void*)cxx_enter_object_environment);
check_exception();
}
static Value cxx_concat_string(VM& vm, Value lhs, Value rhs)
{
auto string = TRY_OR_SET_EXCEPTION(rhs.to_primitive_string(vm));