1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 06:55:07 +00:00

LibJS/Bytecode: Add Call opcode for fixed-argument-count calls

This avoids the overhead of allocating a new Array on every function
call, saving a substantial amount of time and avoiding GC thrash.

This patch only makes use of Op::Call in CallExpression. There are other
places we should codegen this op. We should also do the same for super
expression calls.

~5% speed-up on Kraken/stanford-crypto-ccm.js
This commit is contained in:
Andreas Kling 2023-07-02 16:33:00 +02:00
parent 7eb87dec9f
commit c37b204ce1
5 changed files with 135 additions and 41 deletions

View file

@ -124,6 +124,7 @@ static NonnullOwnPtr<BasicBlock> eliminate_loads(BasicBlock const& block, size_t
// Attribute accesses (`a.o` or `a[o]`) may result in calls to getters or setters
// or may trigger proxies
// So these are treated like calls
case Call:
case CallWithArgumentArray:
// Calls, especially to local functions and eval, may poison visible and
// cached variables, hence we need to clear the lookup cache after emitting them