mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
LibJS/JIT: Add builtin for Math.sqrt()
This commit is contained in:
parent
1d8a601f96
commit
94b634f029
4 changed files with 26 additions and 5 deletions
|
@ -2637,6 +2637,19 @@ void Compiler::compile_builtin_math_log(Assembler::Label&, Assembler::Label& end
|
|||
m_assembler.jump(end);
|
||||
}
|
||||
|
||||
static Value cxx_math_sqrt(VM& vm, Value, Value value)
|
||||
{
|
||||
return TRY_OR_SET_EXCEPTION(MathObject::sqrt_impl(vm, value));
|
||||
}
|
||||
|
||||
void Compiler::compile_builtin_math_sqrt(Assembler::Label&, Assembler::Label& end)
|
||||
{
|
||||
native_call((void*)cxx_math_sqrt);
|
||||
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, [&] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue