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

LibJS/JIT: Add builtin for Math.floor()

This commit is contained in:
Andreas Kling 2023-11-24 09:44:00 +01:00
parent 5e976d611e
commit 08590adf40
4 changed files with 28 additions and 7 deletions

View file

@ -2663,6 +2663,19 @@ void Compiler::compile_builtin_math_pow(Assembler::Label&, Assembler::Label& end
m_assembler.jump(end);
}
static Value cxx_math_floor(VM& vm, Value, Value value)
{
return TRY_OR_SET_EXCEPTION(MathObject::floor_impl(vm, value));
}
void Compiler::compile_builtin_math_floor(Assembler::Label&, Assembler::Label& end)
{
native_call((void*)cxx_math_floor);
store_accumulator(RET);
check_exception();
m_assembler.jump(end);
}
void Compiler::compile_builtin_math_abs(Assembler::Label& slow_case, Assembler::Label& end)
{
branch_if_int32(ARG2, [&] {