mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 09:27:35 +00:00
LibJS/JIT: Compile the GetByValue bytecode instruction
This commit is contained in:
parent
e8190105db
commit
966b6f78a6
2 changed files with 18 additions and 0 deletions
|
@ -386,6 +386,20 @@ void Compiler::compile_get_by_id(Bytecode::Op::GetById const& op)
|
||||||
check_exception();
|
check_exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Value cxx_get_by_value(VM& vm, Value base, Value property)
|
||||||
|
{
|
||||||
|
return TRY_OR_SET_EXCEPTION(Bytecode::get_by_value(vm.bytecode_interpreter(), base, property));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Compiler::compile_get_by_value(Bytecode::Op::GetByValue const& op)
|
||||||
|
{
|
||||||
|
load_vm_register(ARG1, op.base());
|
||||||
|
load_vm_register(ARG2, Bytecode::Register::accumulator());
|
||||||
|
m_assembler.native_call((void*)cxx_get_by_value);
|
||||||
|
store_vm_register(Bytecode::Register::accumulator(), RET);
|
||||||
|
check_exception();
|
||||||
|
}
|
||||||
|
|
||||||
static Value cxx_to_numeric(VM& vm, Value value)
|
static Value cxx_to_numeric(VM& vm, Value value)
|
||||||
{
|
{
|
||||||
return TRY_OR_SET_EXCEPTION(value.to_numeric(vm));
|
return TRY_OR_SET_EXCEPTION(value.to_numeric(vm));
|
||||||
|
@ -478,6 +492,9 @@ OwnPtr<NativeExecutable> Compiler::compile(Bytecode::Executable& bytecode_execut
|
||||||
case Bytecode::Instruction::Type::GetById:
|
case Bytecode::Instruction::Type::GetById:
|
||||||
compiler.compile_get_by_id(static_cast<Bytecode::Op::GetById const&>(op));
|
compiler.compile_get_by_id(static_cast<Bytecode::Op::GetById const&>(op));
|
||||||
break;
|
break;
|
||||||
|
case Bytecode::Instruction::Type::GetByValue:
|
||||||
|
compiler.compile_get_by_value(static_cast<Bytecode::Op::GetByValue const&>(op));
|
||||||
|
break;
|
||||||
case Bytecode::Instruction::Type::ToNumeric:
|
case Bytecode::Instruction::Type::ToNumeric:
|
||||||
compiler.compile_to_numeric(static_cast<Bytecode::Op::ToNumeric const&>(op));
|
compiler.compile_to_numeric(static_cast<Bytecode::Op::ToNumeric const&>(op));
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -53,6 +53,7 @@ private:
|
||||||
void compile_return(Bytecode::Op::Return const&);
|
void compile_return(Bytecode::Op::Return const&);
|
||||||
void compile_new_string(Bytecode::Op::NewString const&);
|
void compile_new_string(Bytecode::Op::NewString const&);
|
||||||
void compile_get_by_id(Bytecode::Op::GetById const&);
|
void compile_get_by_id(Bytecode::Op::GetById const&);
|
||||||
|
void compile_get_by_value(Bytecode::Op::GetByValue const&);
|
||||||
|
|
||||||
void store_vm_register(Bytecode::Register, Assembler::Reg);
|
void store_vm_register(Bytecode::Register, Assembler::Reg);
|
||||||
void load_vm_register(Assembler::Reg, Bytecode::Register);
|
void load_vm_register(Assembler::Reg, Bytecode::Register);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue