mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibJS: Don't convert to UTF-8 in order to compare two UTF-16 strings
If we have two PrimitiveString objects that are both backed by UTF-16 data, we don't have to convert them to UTF-8 for equality checking. Just compare the underlying UTF-16 data. :^)
This commit is contained in:
parent
e80d1c1a86
commit
d78e3590d5
Notes:
github-actions[bot]
2025-04-12 09:08:53 +00:00
Author: https://github.com/awesomekling
Commit: d78e3590d5
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4328
3 changed files with 14 additions and 1 deletions
|
@ -2225,7 +2225,7 @@ bool same_value_non_number(Value lhs, Value rhs)
|
|||
// 5. If x is a String, then
|
||||
if (lhs.is_string()) {
|
||||
// a. If x and y are exactly the same sequence of code units (same length and same code units at corresponding indices), return true; otherwise, return false.
|
||||
return lhs.as_string().utf8_string_view() == rhs.as_string().utf8_string_view();
|
||||
return lhs.as_string() == rhs.as_string();
|
||||
}
|
||||
|
||||
// 3. If x is undefined, return true.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue