mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
LibJS: Compile the CallWithArgumentArray bytecode instruction
This commit is contained in:
parent
2b65a80ecb
commit
b2d8d0c270
5 changed files with 52 additions and 27 deletions
|
@ -923,6 +923,25 @@ void Compiler::compile_call(Bytecode::Op::Call const& op)
|
|||
check_exception();
|
||||
}
|
||||
|
||||
static Value cxx_call_with_argument_array(VM& vm, Value callee, Value this_value, Bytecode::Op::CallType call_type, Optional<Bytecode::StringTableIndex> const& expression_string)
|
||||
{
|
||||
TRY_OR_SET_EXCEPTION(throw_if_needed_for_call(vm.bytecode_interpreter(), callee, call_type, expression_string));
|
||||
auto argument_values = argument_list_evaluation(vm.bytecode_interpreter());
|
||||
return TRY_OR_SET_EXCEPTION(perform_call(vm.bytecode_interpreter(), this_value, call_type, callee, move(argument_values)));
|
||||
}
|
||||
|
||||
void Compiler::compile_call_with_argument_array(Bytecode::Op::CallWithArgumentArray const& op)
|
||||
{
|
||||
load_vm_register(ARG1, op.callee());
|
||||
load_vm_register(ARG2, op.this_value());
|
||||
m_assembler.mov(
|
||||
Assembler::Operand::Register(ARG3),
|
||||
Assembler::Operand::Imm(to_underlying(op.call_type())));
|
||||
native_call((void*)cxx_call_with_argument_array);
|
||||
store_vm_register(Bytecode::Register::accumulator(), RET);
|
||||
check_exception();
|
||||
}
|
||||
|
||||
static Value cxx_typeof_variable(VM& vm, DeprecatedFlyString const& identifier)
|
||||
{
|
||||
return TRY_OR_SET_EXCEPTION(Bytecode::typeof_variable(vm, identifier));
|
||||
|
@ -1153,6 +1172,9 @@ OwnPtr<NativeExecutable> Compiler::compile(Bytecode::Executable& bytecode_execut
|
|||
case Bytecode::Instruction::Type::Call:
|
||||
compiler.compile_call(static_cast<Bytecode::Op::Call const&>(op));
|
||||
break;
|
||||
case Bytecode::Instruction::Type::CallWithArgumentArray:
|
||||
compiler.compile_call_with_argument_array(static_cast<Bytecode::Op::CallWithArgumentArray const&>(op));
|
||||
break;
|
||||
case Bytecode::Instruction::Type::TypeofVariable:
|
||||
compiler.compile_typeof_variable(static_cast<Bytecode::Op::TypeofVariable const&>(op));
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue