Commit graph

158 commits

Author SHA1 Message Date
Andreas Kling
b6435ca280 LibJS: Unify bytecode instruction names with their helper names 2023-11-12 14:21:41 +01:00
Andreas Kling
2520c46224 LibJS/JIT: Resolve the GetCalleeAndThisFromEnvironment cache at JIT time 2023-11-10 14:49:25 +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
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
Simon Wanner
dd466ec83a LibJS/Bytecode: Remove the PushDeclarativeEnvironment instruction 2023-11-03 07:31:11 +01:00
Simon Wanner
e400682fb1 LibJS/JIT: Support alternative entry point blocks
If Interpreter::run_and_return_frame is called with a specific entry
point we now map that to a native instruction address, which the JIT
code jumps to after the function prologue.
2023-11-03 07:31:11 +01:00
Idan Horowitz
38f3b78a1d LibJS: Store the bytecode accumulator in a dedicated physical register
We now use a dedicated physical register to store the bytecode
accumulator, instead of loading and storing it to the memory everytime.
2023-11-02 22:35:35 +01:00
Simon Wanner
68f4d21de2 LibJS: Lazily collect stack trace information
The previous implementation was calling `backtrace()` for every
function call, which is quite slow.

Instead, this implementation provides VM::stack_trace() which unwinds
the native stack, maps it through NativeExecutable::get_source_range
and combines it with source ranges from interpreted call frames.
2023-11-02 07:37:41 +01:00
Simon Wanner
fb7b4b9c59 LibJS/JIT: Provide source location information for JIT code
This works by walking a backtrace until the currently executing
native executable is found, and then mapping the native address
to its bytecode instruction.
2023-10-31 07:07:17 +01:00
Hendiadyoin1
1341f4438d LibJS: Save scheduled jumps when entering unwind contexts
These are then restored upon `ContinuePendingUnwind`.
This stops us from forgetting where we needed to jump when we do extra
try-catches in finally blocks.

Co-Authored-By: Jesús "gsus" Lapastora <cyber.gsuscode@gmail.com>
2023-10-30 13:10:08 +01:00
Hendiadyoin1
4da5b8ec67 LibJS: Reset scheduled-jump flag when throwing an exception
Otherwise we might attempt to follow the scheduled jump later
2023-10-30 13:10:08 +01:00
Hendiadyoin1
f5645e3c9c LibJS: Use static unwind mappings for unwind related functions 2023-10-30 13:10:08 +01:00
Simon Wanner
ad81bf47bb LibJS: Move GetObjectPropertyIterator impl to CommonImplementations 2023-10-29 22:57:19 +01:00
Jakub Berkop
6a7b9b85a4 LibJS/JIT: Compile the DeleteByValueWithThis instruction 2023-10-29 21:51:46 +01:00
Jakub Berkop
0776404e03 LibJS/JIT: Compile the DeleteByValue instruction 2023-10-29 21:51:46 +01:00
Jakub Berkop
f5fcd4596c LibJS/JIT: Compile the DeleteById instruction 2023-10-29 21:51:46 +01:00
Simon Wanner
516bb01082 LibJS/Bytecode: Move Append impl to CommonImplementations 2023-10-29 17:36:09 +01:00
Simon Wanner
5179ff5fc9 LibJS/Bytecode: Move IteratorToArray impl to CommonImplementations 2023-10-29 17:36:09 +01:00
Simon Wanner
661dbbc83d LibJS/Bytecode: Move object_to_iterator to CommonImplementations 2023-10-29 17:36:09 +01:00
Simon Wanner
d416cef9bb LibJS/Bytecode: Move iterator_to_object to CommonImplementations 2023-10-29 17:36:09 +01:00
Simon Wanner
1eee110575 LibJS: Move SuperCallWithArgumentArray impl to CommonImplementations 2023-10-29 17:36:09 +01:00
Simon Wanner
f9fbb8cff2 LibJS/Bytecode: Move NewClass impl to CommonImplementations 2023-10-29 07:44:11 +01:00
Simon Wanner
54f1f7a51b LibJS/Bytecode: Move CreateVariable impl to CommonImplementations 2023-10-29 07:44:11 +01:00
Idan Horowitz
b2d8d0c270 LibJS: Compile the CallWithArgumentArray bytecode instruction 2023-10-28 20:27:16 +02:00
Andreas Kling
c1551a64dc LibJS/JIT: Compile the NewRegExp bytecode instruction 2023-10-27 19:07:22 +02:00
Andreas Kling
935d67cfcf LibJS/JIT: Compile the GetCalleeAndThisFromEnvironment instruction 2023-10-27 19:07:22 +02:00
Andreas Kling
dabaaabfc0 LibJS/JIT: Support the GetVariable bytecode instruction 2023-10-27 19:07:22 +02:00
Andreas Kling
bcf7cdb679 LibJS/Bytecode: Un-templatize throw_if_needed_for_call() 2023-10-27 19:07:22 +02:00
Andreas Kling
c2aad0f573 LibJS/Bytecode: Move PutByValue impl to CommonImplementations 2023-10-27 19:07:22 +02:00
Andreas Kling
9f61cda27e LibJS/Bytecode: Move NewFunction impl into CommonImplementations 2023-10-27 19:07:22 +02:00
Andreas Kling
393d90abe1 LibJS/Bytecode: Move SetVariable implementation to CommonImplementations 2023-10-27 19:07:22 +02:00
Andreas Kling
d368dc5d25 LibJS/Bytecode: Move TypeofVariable impl to CommonImplementations 2023-10-27 19:07:22 +02:00
Andreas Kling
640455b1d2 LibJS/JIT: Compile the Call bytecode instruction
I've left a FIXME about dealing with some throwsy cases.
2023-10-27 19:07:22 +02:00
Andreas Kling
7fc35fde09 LibJS/Bytecode: Move throw_if_needed_for_call to CommonImplementations 2023-10-27 19:07:22 +02:00
Andreas Kling
b56ecc7e34 LibJS/Bytecode: Move perform_call helper to CommonImplementations 2023-10-27 19:07:22 +02:00
Andreas Kling
580249d650 LibJS/JIT: Compile the PutById bytecode instruction 2023-10-27 19:07:22 +02:00
Andreas Kling
3974ce2069 LibJS/JIT: Compile the GetGlobal bytecode instruction 2023-10-27 19:07:22 +02:00
Andreas Kling
12898f5aef LibJS/JIT: Compile the Decrement bytecode instruction 2023-10-27 19:07:22 +02:00
Andreas Kling
e8190105db LibJS/Bytecode: Move GetByValue implementation to CommonImplementations 2023-10-27 19:07:22 +02:00
Andreas Kling
310bcd4717 LibJS/JIT: Don't keep trying to JIT unsupported bytecode executables
We now only try jitting each Bytecode::Executable once, and then cache
the resulting NativeExecutable.
2023-10-27 19:07:22 +02:00
Andreas Kling
8905682a16 LibJS/Bytecode: Begin moving shareable (JIT+Interpreter) stuff somewhere
There are a lot of native C++ functions that will be used by both the
bytecode interpreter and jitted code. Let's put them in their own file
instead of having them in Interpreter.cpp.
2023-10-27 19:07:22 +02:00
Andreas Kling
babdc0a25b LibJS: Work-in-progress JIT compiler :^) 2023-10-27 19:07:22 +02:00
Andreas Kling
2e23f00a2f LibJS/Bytecode: Move environment coordinate caches to Executable
Moving them out of the respective instructions allows the bytecode
stream to be immutable.
2023-10-27 07:26:37 +02:00
Andreas Kling
6a3f27509f LibJS: Avoid IdentifierTable lookup in cached GetGlobal op
When we hit the cache in GetGlobal, we don't need the identifier string
at all, so let's defer fetching it until after the cache miss.

7% speed-up on Kraken/imaging-gaussian-blur.js :^)
2023-10-08 11:55:27 +02:00
Andreas Kling
ae4e46a037 LibJS: Do less work in successfully cached GetByValue* ops
If we have a cached environment coordinate that hasn't been screwed
by eval(), we can get the value directly without instantiating a
Reference.

15% speed-up on Octane/zlib.js :^)
2023-10-07 20:01:52 +02:00