Commit graph

19 commits

Author SHA1 Message Date
Andreas Kling
18c54d8d40 LibJS: Make Cell::initialize() return void
Stop worrying about tiny OOMs.

Work towards #20405
2023-08-08 07:39:11 +02:00
Timothy Flynn
2692db8699 LibJS+Everywhere: Allow Cell::initialize overrides to throw OOM errors
Note that as of this commit, there aren't any such throwers, and the
call site in Heap::allocate will drop exceptions on the floor. This
commit only serves to change the declaration of the overrides, make sure
they return an empty value, and to propagate OOM errors frm their base
initialize invocations.
2023-01-29 00:02:45 +00:00
Andreas Kling
35c9aa7c05 LibJS: Hide all the constructors!
Now that the GC allocator is able to invoke Cell subclass constructors
directly via friendship, we no longer need to keep them public. :^)
2022-08-29 03:24:54 +02:00
Linus Groh
5dd5896588 LibJS+LibWeb: Replace GlobalObject with Realm in initialize() functions
This is a continuation of the previous commit.

Calling initialize() is the first thing that's done after allocating a
cell on the JS heap - and in the common case of allocating an object,
that's where properties are assigned and intrinsics occasionally
accessed.
Since those are supposed to live on the realm eventually, this is
another step into that direction.
2022-08-23 13:58:30 +01:00
Linus Groh
ecd163bdf1 LibJS+LibWeb: Replace GlobalObject with Realm in object constructors
No functional changes - we can still very easily get to the global
object via `Realm::global_object()`. This is in preparation of moving
the intrinsics to the realm and no longer having to pass a global
object when allocating any object.
In a few (now, and many more in subsequent commits) places we get a
realm using `GlobalObject::associated_realm()`, this is intended to be
temporary. For example, create() functions will later receive the same
treatment and are passed a realm instead of a global object.
2022-08-23 13:58:30 +01:00
Timothy Flynn
6efbafa6e0 Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
Timothy Flynn
20f73d2abc LibJS: Convert Atomics functions to ThrowCompletionOr 2021-10-23 19:16:03 +01:00
Idan Horowitz
20163c0584 LibJS: Add ThrowCompletionOr versions of the JS native function macros
The old versions were renamed to JS_DECLARE_OLD_NATIVE_FUNCTION and
JS_DEFINE_OLD_NATIVE_FUNCTION, and will be eventually removed once all
native functions were converted to the new format.
2021-10-20 12:27:19 +01:00
Timothy Flynn
1a3e1bff7b LibJS: Implement Atomics.isLockFree 2021-07-14 22:13:15 +01:00
Timothy Flynn
33eb830929 LibJS: Implement Atomics.compareExchange 2021-07-14 22:13:15 +01:00
Timothy Flynn
655ffce64d LibJS: Implement Atomics.exchange 2021-07-14 22:13:15 +01:00
Timothy Flynn
6211eb0f9a LibJS: Implement Atomics.store 2021-07-14 20:44:42 +01:00
Timothy Flynn
b6364ec899 LibJS: Implement Atomics.xor 2021-07-14 20:44:42 +01:00
Timothy Flynn
d2f6255b91 LibJS: Implement Atomics.sub 2021-07-14 20:44:42 +01:00
Timothy Flynn
f9d8e234b2 LibJS: Implement Atomics.or 2021-07-14 20:44:42 +01:00
Timothy Flynn
2d3af5c1b4 LibJS: Implement Atomics.and 2021-07-14 20:44:42 +01:00
Timothy Flynn
940875c9fd LibJS: Implement Atomics.load 2021-07-14 20:44:42 +01:00
Timothy Flynn
cc3b96743a LibJS: Implement Atomics.add 2021-07-14 20:44:42 +01:00
Timothy Flynn
a61723ec59 LibJS: Begin implementing Atomics
This adds the Atomics object to the global object and sets up only its
@@toStringTag property.
2021-07-14 20:44:42 +01:00