LibJS: Avoid roundtrip through Value for comparison bytecode evaluation
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

1.1x speedup on strictly-equals-object.js
This commit is contained in:
Shannon Booth 2025-05-08 15:19:35 +12:00 committed by Andreas Kling
commit 19bf897116
Notes: github-actions[bot] 2025-05-08 18:40:23 +00:00
4 changed files with 42 additions and 42 deletions

View file

@ -1261,7 +1261,7 @@ ThrowCompletionOr<GC::Ptr<FunctionObject>> Value::get_method(VM& vm, PropertyKey
// 13.10 Relational Operators, https://tc39.es/ecma262/#sec-relational-operators
// RelationalExpression : RelationalExpression > ShiftExpression
ThrowCompletionOr<Value> greater_than(VM& vm, Value lhs, Value rhs)
ThrowCompletionOr<bool> greater_than(VM& vm, Value lhs, Value rhs)
{
// 1. Let lref be ? Evaluation of RelationalExpression.
// 2. Let lval be ? GetValue(lref).
@ -1278,13 +1278,13 @@ ThrowCompletionOr<Value> greater_than(VM& vm, Value lhs, Value rhs)
// 6. If r is undefined, return false. Otherwise, return r.
if (relation == TriState::Unknown)
return Value(false);
return Value(relation == TriState::True);
return false;
return relation == TriState::True;
}
// 13.10 Relational Operators, https://tc39.es/ecma262/#sec-relational-operators
// RelationalExpression : RelationalExpression >= ShiftExpression
ThrowCompletionOr<Value> greater_than_equals(VM& vm, Value lhs, Value rhs)
ThrowCompletionOr<bool> greater_than_equals(VM& vm, Value lhs, Value rhs)
{
// 1. Let lref be ? Evaluation of RelationalExpression.
// 2. Let lval be ? GetValue(lref).
@ -1301,13 +1301,13 @@ ThrowCompletionOr<Value> greater_than_equals(VM& vm, Value lhs, Value rhs)
// 6. If r is true or undefined, return false. Otherwise, return true.
if (relation == TriState::Unknown || relation == TriState::True)
return Value(false);
return Value(true);
return false;
return true;
}
// 13.10 Relational Operators, https://tc39.es/ecma262/#sec-relational-operators
// RelationalExpression : RelationalExpression < ShiftExpression
ThrowCompletionOr<Value> less_than(VM& vm, Value lhs, Value rhs)
ThrowCompletionOr<bool> less_than(VM& vm, Value lhs, Value rhs)
{
// 1. Let lref be ? Evaluation of RelationalExpression.
// 2. Let lval be ? GetValue(lref).
@ -1324,13 +1324,13 @@ ThrowCompletionOr<Value> less_than(VM& vm, Value lhs, Value rhs)
// 6. If r is undefined, return false. Otherwise, return r.
if (relation == TriState::Unknown)
return Value(false);
return Value(relation == TriState::True);
return false;
return relation == TriState::True;
}
// 13.10 Relational Operators, https://tc39.es/ecma262/#sec-relational-operators
// RelationalExpression : RelationalExpression <= ShiftExpression
ThrowCompletionOr<Value> less_than_equals(VM& vm, Value lhs, Value rhs)
ThrowCompletionOr<bool> less_than_equals(VM& vm, Value lhs, Value rhs)
{
// 1. Let lref be ? Evaluation of RelationalExpression.
// 2. Let lval be ? GetValue(lref).
@ -1347,8 +1347,8 @@ ThrowCompletionOr<Value> less_than_equals(VM& vm, Value lhs, Value rhs)
// 6. If r is true or undefined, return false. Otherwise, return true.
if (relation == TriState::True || relation == TriState::Unknown)
return Value(false);
return Value(true);
return false;
return true;
}
// 13.12 Binary Bitwise Operators, https://tc39.es/ecma262/#sec-binary-bitwise-operators