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
Nikodem Rabuliński
bacbd830fe
LibJIT: Make X86_64Assembler::native_call take u64 instead of void*
...
Now that x86-specific Assembler will be compiled on every architecture
we can't rely on void* being the right width.
It also fixes compilation on targets which have void*
be different length from u64 (WASM in particular).
2023-11-06 10:05:42 +01:00
Nikodem Rabuliński
8aa35f4fab
LibJIT+LibJS: Rename Assembler to X86_64Assembler
...
This is in preparation for making LibJIT support multiple architectures.
Assembler will now be typedefed to the specific assembler
for a particular architecture.
Additionally, there's now JIT_ARCH_SUPPORTED which is defined on
architectures which LibJIT supports.
2023-11-06 10:05:42 +01:00
Nikodem Rabuliński
9f5450527f
LibJS+LibJIT: Make Assembler::native_call accept preserved_registers
...
This makes JS::JIT::Compiler less architecture-specific
and unifies aligning the stack into a single operation,
where previously we were doing it separately for preserved registers
and for stack arguments.
2023-11-06 10:05:42 +01:00
Idan Horowitz
58e2fe895c
LibJS: Stash thrown exception in a register before executing finalizer
...
This kills 2 birds with one stone:
1. It makes sure generated check_exception() calls in the finalizer
don't mis-read the pending exception as caused by their matching
operation.
2. It implicitly ensures that terminated finally blocks (by a return
statement) overwrite any pending exceptions, since they will never
execute the ContinuePendingUnwind operation that restores the
stashed exception.
This additional logic is required in the JIT (as opposed to the
interpreter), since the JIT uses the exception register to store and
check the possibly-exceptional results from each individual operation,
while the interpreter only modifies it when an operation has thrown an
exception.
2023-11-03 20:27:45 +01:00
Idan Horowitz
aaa81cd3b9
Revert "LibJS/JIT: Clear exception before executing finalizer"
...
This reverts commit 0daebef727
.
Finally blocks do not unconditionally swallow pending exceptions.
This resolves #21759 and fixes the 2 remaining failing test-js tests.
2023-11-03 20:27:45 +01:00
Andreas Kling
24fb009cf5
LibJS+LibJIT: Add fast path for Int32 * Int32
2023-11-03 10:48:02 +01:00
Andreas Kling
0aeb83b03f
LibJS+LibJIT: Add fast path for Int32 ^ Int32
2023-11-03 10:48:02 +01:00
Andreas Kling
3a5c177025
LibJS/JIT: Add fast path for Int32 | Int32
2023-11-03 10:48:02 +01:00
Andreas Kling
82635083dc
LibJS/JIT: Add fast path for Int32 & Int32
2023-11-03 10:48:02 +01:00
Andreas Kling
17ae6edd8e
LibJS+LibJIT: Add fast path for Int32 - Int32
2023-11-03 10:48:02 +01:00
Simon Wanner
c810d4784e
LibJS/JIT: Compile the Await instruction
2023-11-03 07:31:11 +01:00
Simon Wanner
4671520c0a
LibJS/JIT: Compile the Yield 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
112eadc863
LibJS/JIT: Annotate disassembly with bytecode information
2023-10-31 07:07:17 +01:00
Simon Wanner
9f78e56823
LibJS/JIT: Record machine code location to bytecode location mapping
2023-10-31 07:07:17 +01:00
Simon Wanner
0daebef727
LibJS/JIT: Clear exception before executing finalizer
...
language/statements/try/S12.14_A13_T2.js ❌ -> ✅
language/statements/try/S12.14_A15.js ❌ -> ✅
language/statements/try/S12.14_A7_T1.js ❌ -> ✅
language/statements/try/S12.14_A7_T2.js ❌ -> ✅
language/statements/try/S12.14_A7_T3.js ❌ -> ✅
language/statements/try/completion-values-fn-finally-abrupt.js ❌ -> ✅
language/statements/try/completion-values-fn-finally-return.js ❌ -> ✅
2023-10-30 15:05:26 +01:00
Simon Wanner
bd62c4763c
LibJS/JIT: Flip saved_return_value condition in ContinuePendingUnwind
...
This did not match the `if (saved_return_value) return else resume`
in Interpreter.
test/built-ins/Promise/all/resolve-poisoned-then.js ❌ -> ✅
test/built-ins/Promise/all/resolve-thenable.js ❌ -> ✅
test/built-ins/Promise/allSettled/resolve-poisoned-then.js ❌ -> ✅
test/built-ins/Promise/allSettled/resolve-thenable.js ❌ -> ✅
test/built-ins/Promise/race/resolve-self.js ❌ -> ✅
test/language/statements/try/S12.14_A7_T1.js ✅ -> ❌
test/language/statements/try/S12.14_A7_T2.js ✅ -> ❌
test/language/statements/try/S12.14_A7_T3.js ✅ -> ❌
2023-10-30 15:05:26 +01:00
Simon Wanner
82c057391e
LibJS/JIT: Handle uninitialized bindings in GetLocal
...
test262: +78 ✅ -72 ❌ -4 💥 ️
2023-10-30 15:05:26 +01:00
Simon Wanner
5b2c0dfec0
LibJS/JIT: Return result of SuperCallWithArgumentArray
...
test/language/expressions/optional-chaining/call-expression.js 💥 ️ -> ✅
test/language/expressions/super/call-expr-value.js 💥 ️ -> ✅
2023-10-30 15:05:26 +01:00
Evgeniy Baskov
da45bd3fde
LibJS/JIT: Implement static exception handling
2023-10-30 13:10:08 +01:00
Andreas Kling
0c6d094a7e
LibJS/JIT: Stop logging JIT success by default (but still log failure)
2023-10-30 07:11:43 +01:00
Zaggy1024
dfaf645302
LibJS: Add an inline JIT fast path when ToNumeric
has nothing to do
...
In most cases, this op will do nothing, as it is running on an the
accumulator while it already contains a number. Let's avoid doing that
native call.
2023-10-30 07:10:54 +01:00
Simon Wanner
a2b0154661
LibJS/JIT: Compile the AsyncIteratorClose instruction
2023-10-30 07:10:24 +01:00
Simon Wanner
ac59e982a9
LibJS/JIT: Compile the CopyObjectExcludingProperties instruction
2023-10-30 07:10:24 +01:00
Simon Wanner
9494fbe670
LibJS/JIT: Compile the PutByValueWithThis instruction
2023-10-30 07:10:24 +01:00
Simon Wanner
847889343f
LibJS/JIT: Compile the New##ErrorName instructions
2023-10-30 07:10:24 +01:00
Simon Wanner
fd059d4e4a
LibJS/JIT: Compile the JumpUndefined instruction
2023-10-30 07:10:24 +01:00
Simon Wanner
a16082c6a5
LibJS/JIT: Compile the HasPrivateId instruction
2023-10-30 07:10:24 +01:00
Simon Wanner
712c89dacf
LibJS/JIT: Compile the GetNewTarget instruction
2023-10-30 07:10:24 +01:00
Simon Wanner
19045d6431
LibJS/JIT: Compile the GetMethod instruction
2023-10-30 07:10:24 +01:00
Simon Wanner
06ea4cfc4f
LibJS/JIT: Compile the DeleteVariable instruction
2023-10-30 07:10:24 +01:00
Simon Wanner
cd18bc9d55
LibJS/JIT: Compile the GetImportMeta instruction
2023-10-30 07:10:24 +01:00
Simon Wanner
c0c40110c1
LibJS/JIT: Compile the ImportCall instruction
2023-10-30 07:10:24 +01:00
Simon Wanner
ac43d3f6db
LibJS/JIT: Compile the PutPrivateById instruction
2023-10-29 22:57:19 +01:00
Simon Wanner
81697549b7
LibJS/JIT: Compile the PutByIdWithThis instruction
2023-10-29 22:57:19 +01:00
Simon Wanner
38d5d7979b
LibJS/JIT: Compile the DeleteByIdWithThis instruction
2023-10-29 22:57:19 +01:00
Simon Wanner
b53277110e
LibJS/JIT: Compile the GetByValueWithThis instruction
2023-10-29 22:57:19 +01:00
Simon Wanner
569ca57e22
LibJS/JIT: Compile the GetByIdWithThis instruction
2023-10-29 22:57:19 +01:00
Simon Wanner
ad81f49b02
LibJS/JIT: Compile the ResolveSuperBase instruction
2023-10-29 22:57:19 +01:00
Simon Wanner
4e9edb8c53
LibJS/JIT: Compile the GetPrivateById instruction
2023-10-29 22:57:19 +01:00
Simon Wanner
4ce2878394
LibJS/JIT: Compile the GetObjectPropertyIterator instruction
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
40064d872f
LibJS/JIT: Compile the Append instruction
2023-10-29 17:36:09 +01:00
Simon Wanner
3dc5c8d28e
LibJS/JIT: Compile the IteratorToArray instruction
2023-10-29 17:36:09 +01:00