mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-28 11:54:15 +00:00
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
17 lines
540 B
JavaScript
17 lines
540 B
JavaScript
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]);
|
|
});
|