mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
LibJS: Add fast path for Int32 values in ToBoolean
It's not uncommon to branch on the boolean value of integers, so let's do that on the ToBoolean fast path.
This commit is contained in:
parent
8de03e8cfd
commit
976ccb9224
Notes:
github-actions[bot]
2025-04-03 16:48:45 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/976ccb92241 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4208
1 changed files with 3 additions and 0 deletions
|
@ -17,6 +17,9 @@ inline bool Value::to_boolean() const
|
|||
if (is_boolean())
|
||||
return as_bool();
|
||||
|
||||
if (is_int32())
|
||||
return as_i32() != 0;
|
||||
|
||||
return to_boolean_slow_case();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue