Linus Groh
74e29fa60b
LibJS: Convert perform_atomic_operation() to ThrowCompletionOr
2021-10-04 09:52:15 +01:00
Linus Groh
f95560b21a
LibJS: Convert atomic_read_modify_write() to ThrowCompletionOr
...
Also add spec step comments to it while we're here.
2021-10-04 09:52:15 +01:00
Linus Groh
6cef1dfa6d
LibJS: Convert validate_atomic_access() to ThrowCompletionOr
...
Also add spec step comments to it while we're here.
2021-10-04 09:52:15 +01:00
Linus Groh
12ac2338aa
LibJS: Convert validate_integer_typed_array() to ThrowCompletionOr
...
Also add spec step comments to it while we're here.
2021-10-04 09:52:15 +01:00
Linus Groh
253d9a38d1
LibJS: Convert typed_array_create() to ThrowCompletionOr
...
Also add spec step comments to it while we're here.
2021-10-04 09:52:15 +01:00
Linus Groh
04ff12740c
LibJS: Convert initialize_typed_array_from_list() to ThrowCompletionOr
...
Also add spec step comments to it while we're here.
2021-10-04 09:52:15 +01:00
Linus Groh
d551e0e55e
LibJS: Convert init_typed_array_from_array_like() to ThrowCompletionOr
...
Also add spec step comments to it while we're here.
2021-10-04 09:52:15 +01:00
Linus Groh
8e3957767e
LibJS: Convert init_typed_array_from_typed_array() to ThrowCompletionOr
...
Also add spec step comments to it while we're here.
2021-10-04 09:52:15 +01:00
Linus Groh
7f86c32d62
LibJS: Convert init_typed_array_from_array_buffer() to ThrowCompletionOr
...
Also add spec step comments to it while we're here.
2021-10-04 09:52:15 +01:00
Linus Groh
3655aee543
LibJS: Convert validate_typed_array() to ThrowCompletionOr
...
Also add spec step comments to it while we're here.
2021-10-04 09:52:15 +01:00
Linus Groh
d7d73f9100
LibJS: Convert to_property_descriptor() to ThrowCompletionOr
...
Also add spec step comments to it while we're here.
2021-10-04 09:52:15 +01:00
Linus Groh
2f42675ebd
LibJS: Convert ordinary_set_with_own_descriptor() to ThrowCompletionOr
2021-10-04 09:52:15 +01:00
Linus Groh
3b59a4577d
LibJS: Convert define_properties() to ThrowCompletionOr
2021-10-04 09:52:15 +01:00
Linus Groh
0a49a2db60
LibJS: Convert set_immutable_prototype() to ThrowCompletionOr
2021-10-04 09:52:15 +01:00
Andreas Kling
0cb4d48283
LibJS: Remove unused ExecutionContext::arguments_object
2021-10-03 23:58:21 +02:00
Linus Groh
1f7068ace9
LibJS: Remove unused TemporaryChange include from Object.cpp
2021-10-03 21:40:07 +01:00
Linus Groh
e5b8544762
LibJS: Convert enumerable_own_property_names() to ThrowCompletionOr
2021-10-03 20:14:03 +01:00
Linus Groh
3af559ee8a
LibJS: Convert test_integrity_level() to ThrowCompletionOr
2021-10-03 20:14:03 +01:00
Linus Groh
ed5a9aa038
LibJS: Convert set_integrity_level() to ThrowCompletionOr
2021-10-03 20:14:03 +01:00
Linus Groh
3be26f56db
LibJS: Convert has_own_property() to ThrowCompletionOr
2021-10-03 20:14:03 +01:00
Linus Groh
f38a5957bf
LibJS: Convert has_property() to ThrowCompletionOr
2021-10-03 20:14:03 +01:00
Linus Groh
a29b7a3ec7
LibJS: Convert delete_property_or_throw() to ThrowCompletionOr
2021-10-03 20:14:03 +01:00
Linus Groh
fe86b04b42
LibJS: Convert define_property_or_throw() to ThrowCompletionOr
2021-10-03 20:14:03 +01:00
Linus Groh
ebf57df431
LibJS: Convert create_non_enum_data_p_or_throw() to ThrowCompletionOr
...
The actual name is a bit longer, but you know what I mean :^)
2021-10-03 20:14:03 +01:00
Linus Groh
364dd42fc8
LibJS: Convert create_data_property_or_throw() to ThrowCompletionOr
2021-10-03 20:14:03 +01:00
Linus Groh
bb2499cd7a
LibJS: Convert create_method_property() to ThrowCompletionOr
2021-10-03 20:14:03 +01:00
Linus Groh
fb443b3fb4
LibJS: Convert create_data_property() to ThrowCompletionOr
2021-10-03 20:14:03 +01:00
Linus Groh
1d45541278
LibJS: Convert Object::set() to ThrowCompletionOr
2021-10-03 20:14:03 +01:00
Linus Groh
b7e5f08e56
LibJS: Convert Object::get() to ThrowCompletionOr
...
To no one's surprise, this patch is pretty big - this is possibly the
most used AO of all of them. Definitely worth it though.
2021-10-03 20:14:03 +01:00
Linus Groh
9b6c09e2c4
LibJS: Convert is_extensible() to ThrowCompletionOr
2021-10-03 20:14:03 +01:00
Linus Groh
fa2ac5b759
LibJS: Convert ordinary_to_primitive() to ThrowCompletionOr
...
Also add spec step comments to it while we're here.
2021-10-03 20:14:03 +01:00
Linus Groh
867b19affb
LibJS: Convert install_error_cause() to ThrowCompletionOr
2021-10-03 20:14:03 +01:00
Linus Groh
4d5bd092ea
LibJS: Use MUST() where applicable
2021-10-03 20:14:03 +01:00
Linus Groh
7cd3f7de61
LibJS: Add a MUST() macro, like TRY() but for the spec's !
shortcut
2021-10-03 20:14:03 +01:00
davidot
04454efa72
LibJS: Fix improper usages of forward as flagged by SonarCloud
2021-10-03 17:42:05 +02:00
davidot
ac808a261f
LibJS: Fix that the interpreter did not clear the unwind status
...
This meant that if some program threw an uncaught exception VM still
had unwind_until set. This caused any further programs to not execute
correctly.
This will be fixed more thoroughly once we use Completions in the AST.
Fixes #10323
2021-10-03 17:42:05 +02:00
davidot
f4f1397735
js: Allow for completion of lexically declared variables
...
This does require us to have a method which lists all the bindings in
a declarative environment which is not in the spec.
2021-10-03 17:42:05 +02:00
davidot
ac2c3a73b1
LibJS: Add a specific test for invalid unicode characters in the lexer
...
Also fixes that it tried to make substrings past the end of the source
if we overran the source length.
2021-10-03 17:42:05 +02:00
Andreas Kling
406d3199d0
LibJS: Add a way to save/restore the entire execution context stack
...
This will be used by LibWeb to squirrel away the stack while performing
a microtask checkpoint in some cases. VM will simply consider saved
execution context stacks as GC roots as well.
2021-10-03 16:42:34 +02:00
davidot
1bc945860d
Everywhere: Use my awesome new serenityos email :^)
2021-10-03 13:53:47 +01:00
Andreas Kling
f0b3a06746
LibJS: Use Vector<u16, 1> for UTF-16 in a few more places
2021-10-02 18:32:56 +02:00
Andreas Kling
024367d82e
LibJS+AK: Use Vector<u16, 1> for UTF-16 string storage
...
It's very common to encounter single-character strings in JavaScript on
the web. We can make such strings significantly lighter by having a
1-character inline capacity on the Vectors.
2021-10-02 17:39:38 +02:00
Luke Wilde
ae0bdda86e
LibJS: Remove read buffer overflow in Lexer::consume
...
The position is added to manually in the line terminator and Unicode
character cases. While it checks for EOF after doing so, the EOF check
used `!=` instead of `<`, meaning if the position went _over_ the
source length, it wouldn't think it was EOF and would cause read buffer
overflows.
For example, `0xea` followed by `0xfd` would cause this.
2021-10-02 17:16:09 +02:00
Andreas Kling
6a1b82df2b
LibJS: Put zombie cell tracking code behind a compile-time flag
...
Since this is a debug-only feature, let's not have it impact GC marking
performance when you don't need it.
2021-10-02 16:39:28 +02:00
Andreas Kling
f290c59dd8
LibJS: Keep track of PrimitiveStrings and share them
...
VM now has a string cache which tracks all live PrimitiveStrings and
reuses an existing one if possible. This drastically reduces the number
of GC-allocated strings in many real-word situations.
2021-10-02 16:39:28 +02:00
Linus Groh
ba6e4c7ae1
LibJS+LibWeb: Use Object::set_prototype() in more places
2021-10-02 14:53:06 +01:00
Linus Groh
84c9f3e0d0
LibJS: Add Object::set_prototype()
...
This is just factoring out step "9. Set O.[[Prototype]] to V." of
10.1.2 [[SetPrototypeOf]] into its own method so that we don't have to
use internal_set_prototype_of() for setting an object prototype in all
cases.
2021-10-02 14:53:06 +01:00
Ali Mohammad Pur
36516a4c47
LibJS: Take a pointer in get_or_prune_cached_prototype_transition()
...
Prototypes can be set to null, and while the previous version also kinda
allowed null (by not reading through the null reference), it was making
UBSAN very sad.
2021-10-01 09:20:25 +03:30
Andreas Kling
14c57b4b7f
LibJS: Remove transition avoidance & start caching prototype transitions
...
The way that transition avoidance (foo_without_transition) was
implemented led to shapes being unshareable and caused shape explosion
instead, precisely what we were trying to avoid.
This patch removes all the attempts to avoid transitioning shapes, and
instead *adds* transitions when changing an object's prototype.
This makes transitions flow naturally, and as a result we end up with
way fewer shape objects in real-world situations.
When we run out of big problems, we can get back to avoiding transitions
as an optimization, but for now, let's avoid ballooning our processes
with a unique shape for every object.
2021-10-01 02:59:29 +02:00
Nico Weber
de72332920
Libraries: Fix typos
2021-10-01 01:06:40 +01:00