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
Timothy Flynn
1d76738dde
LibJS: Change Intl.Locale info APIs from property getters to methods
...
This is a normative change in the Intl Locale Info spec. See:
e550152
2023-11-13 20:10:58 +01:00
Timothy Flynn
a357874c77
LibJS: Implement Intl.Locale.prototype.firstDayOfWeek
...
This is a normative change in the Intl Locale Info spec. See:
f03a814
2023-11-13 20:10:58 +01:00
Tim Ledbetter
b5875700e2
LibJS: Don't hang when parsing invalid destructuring assignment target
...
Previously, certain crafted input could cause the JS parser to hang, as
it repeatedly tried to parse an EOF token after hitting an "invalid
destructuring assignment target" error. This change ensures that we
stop parsing after hitting this error condition.
2023-11-13 20:10:36 +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
ddea710933
LibJS: Expose various offsets for GetGlobal JIT 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
298dfa96a4
LibJS: Remove unused members from EnterUnwindContext instruction
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
Jesús (gsus) Lapastora
1850652881
LibJS/Bytecode: Check if eval function is a function
...
When overriding 'eval' to a non-function value, the interpreter would
crash. Now it handles this case swiftly, throwing a TypeError.
2023-11-11 08:56:12 +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
Sönke Holz
6824d2a788
Userland+Tests: Add initial riscv64 support
2023-11-10 10:30:08 -07: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
iliadsh
f91c3e9ac3
LibJS: Expose offset to m_indexed_properties
2023-11-10 08:22:44 +01:00
iliadsh
cb933a3e4a
LibJS: Expose offset of m_array_size
2023-11-10 08:22:44 +01:00
iliadsh
32364d66aa
LibJS: Expose offset of is_simple_storage
2023-11-10 08:22:44 +01:00
iliadsh
d9aebeb372
LibJS: Expose offset of elements in IndexedProperties
2023-11-10 08:22:44 +01:00
iliadsh
eb937631bb
LibJS: Expose offset of may_interfere_with_indexed_property_access
2023-11-10 08:22:44 +01:00
iliadsh
ee4948b9e7
LibJS: Devirtualize is_simple_storage()
2023-11-10 08:22:44 +01:00
iliadsh
89da731aa6
LibJS+LibWeb: Devirtualize may_interfere_with_indexed_property_access()
2023-11-10 08:22:44 +01:00
Andreas Kling
4f8e915ef8
LibJS: Remove accidentally-committed bytecode caching
...
This was a hack cache I got from Luke, not ready for prime-time :^)
2023-11-09 21:06:19 +01:00
Tim Schumacher
a2f60911fe
AK: Rename GenericTraits to DefaultTraits
...
This feels like a more fitting name for something that provides the
default values for Traits.
2023-11-09 10:05:51 -05: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
Todderod
bb9230bbcd
LibJS: Remove redundant Store op
...
If the property for GetByValue in Generator::load_from_reference
is a calculated value this would be stored in an allocated
register and returned from the function. Not all callers want
this information however, so now only give it out when asked for.
Reduced the instruction count for Kraken/ai-astar.js function
"neighbours" from 214 to 192.
2023-11-08 22:18:28 +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
Aliaksandr Kalenik
c170dd323e
LibJS: Make eval() prevent GetGlobal usage less aggressively
...
Before usage of GetGlobal was prevented whenever eval() is present in
the scope chain.
With this change GetGlobal is emitted for `g` in the following program:
```js
function screw_everything_up() {
eval("");
}
var g;
g;
```
It makes Octane/mandreel.js benchmark run 2x faster :)
2023-11-08 10:07:56 +01:00
Sergey Bugaev
21b946791e
LibJS: Link with libatomic on i*86
...
Basically, this would be needed on any platform where the compiler
cannot tell at compile time whether or not some atomic size is
lock-free.
2023-11-08 09:29:59 +01:00
Sergey Bugaev
9c6c2284d9
LibJS: Fix build error when some atomics are not lock-free
...
Normally, we want to avoid accidentally using such atomics, since
they're much slower. In this case however, we're just implementing
another atomics API, it is then up to the JavaScript code to avoid
using the slow atomics.
2023-11-08 09:29:59 +01:00
Timothy Flynn
bf3fce1766
LibJS: Add Date.parse formats for the output of Date.prototype.to*String
...
We currently cannot parse the output of `toString` and `toUTCString`.
While the spec does not require such support, test262 expects it, and
all major engines support it.
2023-11-08 09:28:17 +01:00
Timothy Flynn
9d3f942d43
LibJS: Display example Date strings inline with their format strings
...
The current comment style feels a bit awkward to read.
2023-11-08 09:28:17 +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