1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 19:34:59 +00:00
Commit graph

182 commits

Author SHA1 Message Date
Andreas Kling
afeb551d57 LibJS/JIT: Add builtin for Math.exp() 2023-11-24 12:49:15 +01:00
Andreas Kling
8447544e17 LibJS/JIT: Add builtin for Math.round() 2023-11-24 12:49:15 +01:00
Andreas Kling
c2ff238467 LibJS/JIT: Add builtin for Math.ceil() 2023-11-24 12:49:15 +01:00
Andreas Kling
08590adf40 LibJS/JIT: Add builtin for Math.floor() 2023-11-24 12:49:15 +01:00
Andreas Kling
5e976d611e LibJS/JIT: Add builtin for Math.pow() 2023-11-24 12:49:15 +01:00
Andreas Kling
94b634f029 LibJS/JIT: Add builtin for Math.sqrt() 2023-11-24 12:49:15 +01:00
Andreas Kling
1d8a601f96 LibJS/JIT: Add builtin for Math.log()
Note that we still call out to a C++ helper, but by having a builtin,
we still avoid the cost of a full JS function call.
2023-11-24 12:49:15 +01:00
Andreas Kling
2372584b18 LibJS/JIT: Continue to outer finally before returning
Fixes #21854
2023-11-20 09:30:08 +01:00
Stephan Vedder
84eecbb10e LibJS/JIT: Add fastpath for set variable 2023-11-19 22:36:07 +01:00
Idan Horowitz
f19349e1b6 LibJS: Instantiate primitive array expressions using a single operation
This will not meaningfully affect short array literals, but it does
give us a bit of extra perf when evaluating huge array expressions like
in Kraken/imaging-darkroom.js
2023-11-18 08:37:34 +01:00
Simon Wanner
6c8ab1ca0d LibJS/JIT: Add a builtin for Math.abs 2023-11-17 19:06:25 +01:00
Simon Wanner
86b85aa68b LibJS: Introduce Builtins
Builtins are functions that can be detected during bytecode generation
and enable fast-paths in the JIT.
2023-11-17 19:06:25 +01:00
Stephan Vedder
32352aa729 LibJS/JIT: Add a fast path for floating point comparisons 2023-11-16 11:43:44 +01:00
Bastiaan van der Plaat
d3b3e49e19 LibJS/JIT: Use the x86_64 setcc instruction to remove a branch 2023-11-14 09:54:48 +01:00
Stephan Vedder
9c63f9854b LibJS/JIT: Remove incorrect check for empty tag
This check is not required and prevented put_by_value
to take the actual fastpath.
2023-11-13 14:28:27 +01:00
Andreas Kling
e8c0cea5f9 LibJS/JIT: Use right shift to extract type tags in equality codegen
7% speed-up on Kraken/ai-astar.js, covers up most of the regression
from adding more fast paths. :^)
2023-11-13 13:49:21 +01:00
iliadsh
ad98834b50 LibJS/JIT: Add more equality fast paths 2023-11-13 13:33:43 +01:00
iliadsh
671cbf6a5b LibJS/JIT: Add GetGlobal fast path 2023-11-13 13:33:43 +01:00
iliadsh
c739c931c1 LibJS/JIT: Add PutByValue fast path for simple array access 2023-11-13 13:33:43 +01:00
Andreas Kling
b532dedc91 LibJS/JIT: Add fast path for GetById of Array.length
Array.length is magical (since it has to reflect the number of elements
in the object's property storage).

We now handle it specially in jitted code, giving us a massive speed-up
on Kraken/ai-astar.js (and probably many other things as well) :^)
2023-11-12 19:57:27 +01:00
Andreas Kling
e41f0d9dec LibJS/JIT: Add fast path for loose equality check between 2 objects
There are more fast paths to be added here, just starting with this
one since it's heavy on Kraken/ai-astar.js :^)
2023-11-12 19:57:27 +01:00
Andreas Kling
cb7169d73f LibJS/JIT: Support the EnterObjectEnvironment bytecode instruction
We can now use `with` statements in jitted code. :^)
2023-11-12 14:21:41 +01:00
Andreas Kling
cfdb8a2756 LibJS/JIT: Update "unwind context" stack in JIT code
Until now, the unwind context stack has not been maintained by jitted
code, which meant we were unable to support the `with` statement.
This is a first step towards supporting that by making jitted code
call out to C++ to update the unwind context stack when entering/leaving
unwind contexts.

We also introduce a new "Catch" bytecode instruction that moves the
current exception into the accumulator. It's always emitted at the start
of a "catch" block.
2023-11-12 14:21:41 +01:00
Andreas Kling
b6435ca280 LibJS: Unify bytecode instruction names with their helper names 2023-11-12 14:21:41 +01:00
Idan Horowitz
e58209e5cf LibJS: Skip an always-false branch in the JIT to_boolean slow case 2023-11-11 08:55:18 +01:00
Andreas Kling
2520c46224 LibJS/JIT: Resolve the GetCalleeAndThisFromEnvironment cache at JIT time 2023-11-10 14:49:25 +01:00
Simon Wanner
a3399fa13a LibJS/JIT: Expand Mul fast path to double & i32 combinations
Co-authored-by: Stephan Vedder <vedder@mbits.info>
2023-11-10 11:01:59 +01:00
Simon Wanner
867b8146cf LibJS/JIT: Expand Sub fast path to double & i32 combinations
Co-authored-by: Stephan Vedder <vedder@mbits.info>
2023-11-10 11:01:59 +01:00
Simon Wanner
5edab2679c LibJS/JIT: Expand Add fast path to double & i32 combinations
Co-authored-by: Stephan Vedder <vedder@mbits.info>
2023-11-10 11:01:59 +01:00
Simon Wanner
d91b376393 LibJS/JIT: Add helper for generating combined i32 & double fastpaths
Co-authored-by: Stephan Vedder <vedder@mbits.info>
2023-11-10 11:01:59 +01:00
iliadsh
94b47ff03b LibJS: Add GetByValue fast path for simple array access 2023-11-10 08:22:44 +01:00
Andreas Kling
ac23ab42b3 LibJS/JIT: Add fast path for cached GetById 2023-11-09 16:02:14 +01:00
Andreas Kling
55e467c359 LibJS/JIT: Add fast path for cached PutById 2023-11-09 16:02:14 +01:00
Andreas Kling
b1b2ca1485 LibJS: Add basic monomorphic caching for PutById property access
This patch makes it possible for JS::Object::internal_set() to populate
a CacheablePropertyMetadata, and uses this to implement a basic
monomorphic cache for the most common form of property write access.
2023-11-09 16:02:14 +01:00
Stephan Vedder
13726fd3b7 LibJS/JIT: Add fast path for decrement
Generate jitted code for the decrement opcode.
2023-11-08 21:09:44 +01:00
Stephan Vedder
0e69f744df LibJS/JIT: Add increment instruction
Instead of using `Add` with an immediate of 1 use the `Inc` instruction
2023-11-08 21:09:44 +01:00
Sebastian Bernauer
8eb9c2dc54 LibJS/JIT: Add fast path for number comparisons
So far only less_than was using a fast path. This commits uses the same
path for less_than_equals, greater_than and greater_than_equals.
2023-11-08 14:11:51 +01:00
iliadsh
aef654592f LibJS/JIT: Bail in UnsignedRightShift fast path if result is negative 2023-11-07 21:59:03 +01:00
Simon Wanner
8eeb4e0aff LibJS/JIT: Use mov8/mov32 for loads in compile_get_variable 2023-11-07 14:39:13 +01:00
Andreas Kling
1d8ec677a3 LibJS/JIT: Add fast path for cached GetVariable accesses
We can now stay in machine code for environment variable read accesses
as long as they are cached and initialized.

20% speed-up on Octane/zlib.js :^)
2023-11-07 11:33:04 +01:00
Andreas Kling
e1e7e696ac LibJS/JIT: Store the running ExecutionContext& in a dedicated register 2023-11-07 11:33:04 +01:00
iliadsh
24d5070520 LibJS/JIT: Add fast path for UnsignedRightShift 2023-11-07 10:17:04 +01:00
iliadsh
c956316c98 LibJS/JIT: Add fast path for RightShift 2023-11-07 10:17:04 +01:00
iliadsh
1244e91481 LibJS/JIT: Add fast path for LeftShift 2023-11-07 10:17:04 +01:00
Andreas Kling
536b9c29e4 LibJS/JIT: Resolve the EnvironmentVariableCache pointers at JIT time 2023-11-06 13:06:10 +01:00
Andreas Kling
a616a682fe LibJS/JIT: Resolve the GlobalVariableCache pointers at JIT time 2023-11-06 13:06:10 +01:00
Andreas Kling
f03d4a1ffe LibJS/JIT: Resolve the PropertyLookupCache pointers at JIT time
We know where the lookup cache is by the time we're jitting code, so
let's put the pointer directly into the instruction stream.
2023-11-06 13:06:10 +01:00
Andreas Kling
3b6b9b9f25 LibJS: Take VM instead of Interpreter in more common implementations 2023-11-06 13:06:10 +01:00
Andreas Kling
234ed2d466 LibJS/JIT: Resolve the GetGlobal identifier at JIT time 2023-11-06 13:06:10 +01:00
Andreas Kling
c92954db36 LibJS/JIT: Resolve the GetById property name at JIT time
We can resolve the IdentifierTableIndex to a DeprecatedFlyString& once
when jitting the code, instead of every time GetById executes.
2023-11-06 13:06:10 +01:00