mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibJS: Avoid redundant ExecutionContext allocation for bound functions
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
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
Instead of creating a second ExecutionContext in BoundFunction.[[Call]], we now implement BoundFunction::get_stack_frame_size() and combine information from the target + the bound arguments list. This allows BoundFunction.[[Call]] to reuse the already-established ExecutionContext for the callee. 1.20x speedup on MicroBench/bound-call-04-args.js
This commit is contained in:
parent
dbece92637
commit
74f133293d
Notes:
github-actions[bot]
2025-05-07 11:21:37 +00:00
Author: https://github.com/awesomekling
Commit: 74f133293d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4627
3 changed files with 31 additions and 13 deletions
17
Libraries/LibJS/Tests/regress/function-bind-arguments.js
Normal file
17
Libraries/LibJS/Tests/regress/function-bind-arguments.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
test("Some function.bind cases", () => {
|
||||
function collectArguments() {
|
||||
let a = [];
|
||||
for (let i = 0; i < arguments.length; ++i) a.push(arguments[i]);
|
||||
return a;
|
||||
}
|
||||
|
||||
let b = collectArguments.bind(null);
|
||||
expect(b()).toEqual([]);
|
||||
expect(b(3, 4)).toEqual([3, 4]);
|
||||
expect(b(3, 4, 5, 6)).toEqual([3, 4, 5, 6]);
|
||||
|
||||
let b12 = collectArguments.bind(null, 1, 2);
|
||||
expect(b12()).toEqual([1, 2]);
|
||||
expect(b12(3, 4)).toEqual([1, 2, 3, 4]);
|
||||
expect(b12(3, 4, 5, 6)).toEqual([1, 2, 3, 4, 5, 6]);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue