mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +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:
parent
8c8023465b
commit
fc111537bb
Notes:
github-actions[bot]
2025-04-09 22:34:50 +00:00
Author: https://github.com/awesomekling
Commit: fc111537bb
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4303
2 changed files with 20 additions and 20 deletions
|
@ -926,6 +926,26 @@ ThrowCompletionOr<PropertyKey> Value::to_property_key(VM& vm) const
|
||||||
return MUST(key.to_string(vm));
|
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
|
// 7.1.6 ToInt32 ( argument ), https://tc39.es/ecma262/#sec-toint32
|
||||||
ThrowCompletionOr<i32> Value::to_i32_slow_case(VM& vm) const
|
ThrowCompletionOr<i32> Value::to_i32_slow_case(VM& vm) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,24 +48,4 @@ inline ThrowCompletionOr<Value> Value::to_primitive(VM& vm, PreferredType prefer
|
||||||
return to_primitive_slow_case(vm, preferred_type);
|
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)));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue