|
@@ -386,6 +386,19 @@ void Compiler::compile_get_by_id(Bytecode::Op::GetById const& op)
|
|
check_exception();
|
|
check_exception();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static Value cxx_to_numeric(VM& vm, Value value)
|
|
|
|
+{
|
|
|
|
+ return TRY_OR_SET_EXCEPTION(value.to_numeric(vm));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void Compiler::compile_to_numeric(Bytecode::Op::ToNumeric const&)
|
|
|
|
+{
|
|
|
|
+ load_vm_register(ARG1, Bytecode::Register::accumulator());
|
|
|
|
+ m_assembler.native_call((void*)cxx_to_numeric);
|
|
|
|
+ store_vm_register(Bytecode::Register::accumulator(), RET);
|
|
|
|
+ check_exception();
|
|
|
|
+}
|
|
|
|
+
|
|
OwnPtr<NativeExecutable> Compiler::compile(Bytecode::Executable& bytecode_executable)
|
|
OwnPtr<NativeExecutable> Compiler::compile(Bytecode::Executable& bytecode_executable)
|
|
{
|
|
{
|
|
if (getenv("LIBJS_NO_JIT"))
|
|
if (getenv("LIBJS_NO_JIT"))
|
|
@@ -453,6 +466,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::ToNumeric:
|
|
|
|
+ compiler.compile_to_numeric(static_cast<Bytecode::Op::ToNumeric const&>(op));
|
|
|
|
+ break;
|
|
|
|
|
|
#define DO_COMPILE_COMMON_BINARY_OP(TitleCaseName, snake_case_name) \
|
|
#define DO_COMPILE_COMMON_BINARY_OP(TitleCaseName, snake_case_name) \
|
|
case Bytecode::Instruction::Type::TitleCaseName: \
|
|
case Bytecode::Instruction::Type::TitleCaseName: \
|