|
@@ -60,7 +60,7 @@ void MathObject::initialize(Realm& realm)
|
|
|
define_native_function(realm, vm.names.fround, fround, 1, attr);
|
|
|
define_native_function(realm, vm.names.f16round, f16round, 1, attr);
|
|
|
define_native_function(realm, vm.names.hypot, hypot, 2, attr);
|
|
|
- define_native_function(realm, vm.names.imul, imul, 2, attr);
|
|
|
+ define_native_function(realm, vm.names.imul, imul, 2, attr, Bytecode::Builtin::MathImul);
|
|
|
define_native_function(realm, vm.names.log, log, 1, attr, Bytecode::Builtin::MathLog);
|
|
|
define_native_function(realm, vm.names.log2, log2, 1, attr);
|
|
|
define_native_function(realm, vm.names.log10, log10, 1, attr);
|
|
@@ -587,19 +587,25 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::hypot)
|
|
|
}
|
|
|
|
|
|
|
|
|
-JS_DEFINE_NATIVE_FUNCTION(MathObject::imul)
|
|
|
+ThrowCompletionOr<Value> MathObject::imul_impl(VM& vm, Value arg_a, Value arg_b)
|
|
|
{
|
|
|
|
|
|
- auto a = TRY(vm.argument(0).to_u32(vm));
|
|
|
+ auto const a = TRY(arg_a.to_u32(vm));
|
|
|
|
|
|
|
|
|
- auto b = TRY(vm.argument(1).to_u32(vm));
|
|
|
+ auto const b = TRY(arg_b.to_u32(vm));
|
|
|
|
|
|
|
|
|
|
|
|
return Value(static_cast<i32>(a * b));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+JS_DEFINE_NATIVE_FUNCTION(MathObject::imul)
|
|
|
+{
|
|
|
+ return imul_impl(vm, vm.argument(0), vm.argument(1));
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
ThrowCompletionOr<Value> MathObject::log_impl(VM& vm, Value x)
|
|
|
{
|