1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00

LibJS: Move Value::to_i32() and to_u32() back out-of-line

While good on arm64, this appears to have angered the x86_64 benchmark
runner, so let's just put them back out-of-line.
This commit is contained in:
Andreas Kling 2025-04-09 23:08:32 +02:00 committed by Andreas Kling
parent 8c8023465b
commit fc111537bb
Notes: github-actions[bot] 2025-04-09 22:34:50 +00:00
2 changed files with 20 additions and 20 deletions

View file

@ -926,6 +926,26 @@ ThrowCompletionOr<PropertyKey> Value::to_property_key(VM& vm) const
return MUST(key.to_string(vm));
}
// 7.1.6 ToInt32 ( argument ), https://tc39.es/ecma262/#sec-toint32
ThrowCompletionOr<i32> Value::to_i32(VM& vm) const
{
if (is_int32())
return as_i32();
#if __has_builtin(__builtin_arm_jcvt)
if (is_double())
return __builtin_arm_jcvt(m_value.as_double);
#endif
return to_i32_slow_case(vm);
}
// 7.1.7 ToUint32 ( argument ), https://tc39.es/ecma262/#sec-touint32
ThrowCompletionOr<u32> Value::to_u32(VM& vm) const
{
return static_cast<u32>(TRY(to_i32(vm)));
}
// 7.1.6 ToInt32 ( argument ), https://tc39.es/ecma262/#sec-toint32
ThrowCompletionOr<i32> Value::to_i32_slow_case(VM& vm) const
{

View file

@ -48,24 +48,4 @@ inline ThrowCompletionOr<Value> Value::to_primitive(VM& vm, PreferredType prefer
return to_primitive_slow_case(vm, preferred_type);
}
// 7.1.6 ToInt32 ( argument ), https://tc39.es/ecma262/#sec-toint32
inline ThrowCompletionOr<i32> Value::to_i32(VM& vm) const
{
if (is_int32())
return as_i32();
#if __has_builtin(__builtin_arm_jcvt)
if (is_double())
return __builtin_arm_jcvt(m_value.as_double);
#endif
return to_i32_slow_case(vm);
}
// 7.1.7 ToUint32 ( argument ), https://tc39.es/ecma262/#sec-touint32
inline ThrowCompletionOr<u32> Value::to_u32(VM& vm) const
{
return static_cast<u32>(TRY(to_i32(vm)));
}
}