1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 18:25:06 +00:00
Commit graph

1035 commits

Author SHA1 Message Date
Linus Groh
ccdfa2320c LibJS: Replace GlobalObject with VM in Iterator AOs [Part 7/19] 2022-08-23 13:58:30 +01:00
Linus Groh
a022e548b8 LibJS: Replace GlobalObject with VM in Value AOs [Part 4/19]
This is where the fun begins. :^)
2022-08-23 13:58:30 +01:00
Linus Groh
f6c4a0f5d0 LibJS: Replace GlobalObject with VM in PrototypeObject AOs [Part 3/19] 2022-08-23 13:58:30 +01:00
Linus Groh
694f66b5ca LibJS: Replace GlobalObject with VM in Temporal AOs [Part 2/19] 2022-08-23 13:58:30 +01:00
Linus Groh
f3117d46dc LibJS: Remove GlobalObject from VM::throw_completion()
This is a continuation of the previous five commits.

A first big step into the direction of no longer having to pass a realm
(or currently, a global object) trough layers upon layers of AOs!
Unlike the create() APIs we can safely assume that this is only ever
called when a running execution context and therefore current realm
exists. If not, you can always manually allocate the Error and put it in
a Completion :^)

In the spec, throw exceptions implicitly use the current realm's
intrinsics as well: https://tc39.es/ecma262/#sec-throw-an-exception
2022-08-23 13:58:30 +01:00
Linus Groh
e992a9f469 LibJS+LibWeb: Replace GlobalObject with Realm in Heap::allocate<T>()
This is a continuation of the previous three commits.

Now that create() receives the allocating realm, we can simply forward
that to allocate(), which accounts for the majority of these changes.
Additionally, we can get rid of the realm_from_global_object() in one
place, with one more remaining in VM::throw_completion().
2022-08-23 13:58:30 +01:00
Linus Groh
b99cc7d050 LibJS+LibWeb: Replace GlobalObject with Realm in create() functions
This is a continuation of the previous two commits.

As allocating a JS cell already primarily involves a realm instead of a
global object, and we'll need to pass one to the allocate() function
itself eventually (it's bridged via the global object right now), the
create() functions need to receive a realm as well.
The plan is for this to be the highest-level function that actually
receives a realm and passes it around, AOs on an even higher level will
use the "current realm" concept via VM::current_realm() as that's what
the spec assumes; passing around realms (or global objects, for that
matter) on higher AO levels is pointless and unlike for allocating
individual objects, which may happen outside of regular JS execution, we
don't need control over the specific realm that is being used there.
2022-08-23 13:58:30 +01: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
Linus Groh
8ed28890e4 LibJS: Correct BalanceDurationRelative algorithm
This is a normative change in the Temporal spec.

See:
- cbf5863
- f47d57d
2022-08-06 13:42:37 +01:00
Linus Groh
fb47a87340 LibJS: Add previously skipped assertion in RegulateTime
The spec issue preventing us from doing this in the past has long been
fixed.
2022-08-03 22:46:38 +01:00
Linus Groh
0355c72d6a LibJS: Validate fractionalSecondDigits after truncation
This is a normative change in the Temporal spec.
Also correct some bogus spec numbers.

See:
- 39e1784
- c3c0ee1
- 273cb2e
2022-07-30 10:50:50 +01:00
Linus Groh
6850f25840 LibJS: Support IANA legacy names in the Temporal ISO 8601 grammar
This is a normative change in the Temporal spec.

See: 2419680
2022-07-30 10:50:50 +01:00
Linus Groh
41791146fd LibJS: Disallow out-of-range return from previous / next transition
This is a normative change in the Temporal spec.

See: f3c771f
2022-07-30 10:50:50 +01:00
Luke Wilde
1e829c4ea8 LibJS: Check PlainMonthDay is in the ISO date time limits in creation
This is a normative change in the Temporal spec.

See: 374305c
2022-07-22 17:10:03 +01:00
Luke Wilde
61847b3cef LibJS: Disallow negative day lengths in ZonedDateTime.protoype.round
This is a normative change in the Temporal spec.

See: 6f04074
2022-07-22 17:10:03 +01:00
Idan Horowitz
d35d106f01 LibJS: Remove invalid CreateDateDurationRecord AO overload 2022-07-20 21:07:49 +01:00
Timothy Flynn
a712c7b5e1 LibJS: Replace comparisons of "0"_bigint with SignedBigInteger::is_zero
This just avoids creating UnsignedBigInteger's underlying vector.
2022-07-18 08:51:07 +01:00
Linus Groh
071b92e920 LibJS: Fix typos in Temporal spec comments
This is an editorial change in the Temporal spec.

See: b0411b4
2022-07-10 01:29:28 +02:00
Linus Groh
fb2012dfc7 LibJS: Add Add IsValidISODate assertions
This is an editorial change in the Temporal spec.

See: 46f97ea
2022-07-10 01:22:34 +02:00
Linus Groh
8733fbae76 LibJS: Rename TimeHourMinuteBasicFormatNotAmbiguous
This is an editorial change in the Temporal spec.

See: 70de75b
2022-07-05 23:15:52 +02:00
Linus Groh
e1a6418015 LibJS: Rename TimeZoneNumericUTCOffsetNotAmbiguousAllowedNegative
This is an editorial change in the Temporal spec.

See: 9ddd57e
2022-07-05 23:15:52 +02:00
Linus Groh
8dcd0d4a06 LibJS: Rename TimeZoneNumericUTCOffsetNotAmbiguous
This is an editorial change in the Temporal spec.

See: 5ebd34b
2022-07-05 23:15:52 +02:00
Linus Groh
7ef3b42685 LibJS: Simplify TimeZoneNumericUTCOffsetNotAmbiguous
This is an editorial change in the Temporal spec.

See:
- ccef468
- 5b38ab4
2022-07-05 23:15:52 +02:00
Linus Groh
fec5d8d531 LibJS: Consistently check Temporal overflow options
This is a normative change in the Temporal spec.

See: c8ee2bd
2022-07-05 23:15:52 +02:00
Linus Groh
c3567faa8c LibJS: Remove unnecessary checks for undefined before ToPositiveInteger
This is an editorial change in the Temporal spec.

See: 9f3bf53
2022-07-05 23:15:52 +02:00
Linus Groh
e1ee33ba7c LibJS: Fix incorrect ErrorType in Temporal.PlainMonthDay constructor 2022-06-30 20:20:08 +01:00
Linus Groh
ca85e157e8 LibJS: Use null-prototype objects in a few more places in Temporal
This is a normative change in the Temporal spec.

See: 334479f
2022-06-29 07:35:42 +01:00
Linus Groh
3720f4bd8f LibJS: Fix production for time zone name in time zone strings
This is a normative change in the Temporal spec.

See:
- caf013a
- fb7cfa6
2022-06-29 07:35:42 +01:00
Linus Groh
f5669a1373 LibJS: Mark CreateTemporalDate as infallible in DifferenceISODateTime
This is an editorial change in the Temporal spec.

See:
- af2dc2f
- 2e9ee68
2022-06-29 07:35:42 +01:00
Linus Groh
abb3f327ad LibJS: Mark BalanceDuration as infallible in DifferenceISODateTime
This is an editorial change in the Temporal spec.

See: 5fefc2f
2022-06-29 07:35:42 +01:00
Linus Groh
cee54d2725 LibJS: Replace one use of BalanceISODate with CreateISODateRecord
This is an editorial change in the Temporal spec.

See: 7a7ddb7
2022-06-29 07:35:42 +01:00
Linus Groh
6eab1f0212 LibJS: Assert DifferenceISODateTime is called with valid datetime values
This is an editorial change in the Temporal spec.

See: 143b2e2
2022-06-29 07:35:42 +01:00
Linus Groh
4ba1018273 LibJS: Replace guaranteed zero [[Days]] field with constant zero
This is an editorial change in the Temporal spec.

See: 68f2802
2022-06-29 07:35:42 +01:00
Linus Groh
11a6702cef LibJS: Assert [[Days]] is zero for the balanced time in DifferenceTime
This is an editorial change in the Temporal spec.

See: be982fb
2022-06-29 07:35:42 +01:00
Linus Groh
ee0d5d6649 LibJS: Refactor common option reading into the GetDifferenceSettings AO
This is an editorial change in the Temporal spec.

See: 78abbb8
2022-06-24 22:12:03 +01:00
Linus Groh
05c5263ecc LibJS: Mark CreateTemporalDate in AddDateTime as infallible
This is an editorial change in the Temporal spec.

See: cd356a6
2022-06-24 22:12:03 +01:00
Linus Groh
80663d9d3b LibJS: Mark CreateTemporalDate in ToRelativeTemporalObject as fallible
This is an editorial change in the Temporal spec.

See: 09e9f9c
2022-06-24 22:12:03 +01:00
Linus Groh
3679f671b9 LibJS: Mark some calls of CreateTemporalDate as infallible
This is an editorial change in the Temporal spec.

See: 30344e8
2022-06-24 22:12:03 +01:00
Linus Groh
26990ab41c LibJS: Mark PlainTime.prototype.round's CreateTemporalTime infallible
This is an editorial change in the Temporal spec.

See: 6b57938
2022-06-24 22:12:03 +01:00
Linus Groh
709e16004d LibJS: Assert RoundISODateTime is called with values within the limits
This is an editorial change in the Temporal spec.

See: eaa7042
2022-06-24 22:12:03 +01:00
Linus Groh
f54ed48ef1 LibJS: Assert AddTime is called with a valid time
This is an editorial change in the Temporal spec.

See: 0ead23c
2022-06-24 22:12:03 +01:00
Linus Groh
416f94eb3b LibJS: Add Number conversion in PrepareTemporalFields
This is an editorial change in the Temporal spec.

See: 687d06c
2022-06-24 22:12:03 +01:00
Linus Groh
78bfeca643 LibJS: Add Number conversion in ZonedDateTime.prototype.getISOFields()
This is an editorial change in the Temporal spec.

See: bc59d8d
2022-06-24 22:12:03 +01:00
Linus Groh
ea023ac62c LibJS: Add Number conversion in AddDu/ToOrSubtractDu/FromPlainYearMonth
This is an editorial change in the Temporal spec.

See: 823300c
2022-06-24 22:12:03 +01:00
Linus Groh
98dc964649 LibJS: Add conversion to mathematical number in ToTemporalTimeRecord
This is an editorial change in the Temporal spec.

See: 9f37d10
2022-06-24 22:12:03 +01:00
Linus Groh
7138f10c30 LibJS: Check for invalid epoch ns in DisambiguatePossibleInstants
This is a normative change in the Temporal spec.

See: c12d20d
2022-06-24 22:12:03 +01:00
Linus Groh
7b5a7e7759 LibJS: Check for invalid epoch nanoseconds in NanosecondsToDays
This is a normative change in the Temporal spec.

See: f1f016e
2022-06-24 22:12:03 +01:00
Linus Groh
ddea6d451b LibJS: Check for invalid epoch nanoseconds in InterpretISODateTimeOffset
This is a normative change in the Temporal spec.

See: cdfe4a5
2022-06-24 22:12:03 +01:00
Linus Groh
d10e0f0e3e LibJS: Check for invalid epoch nanoseconds in getPossibleInstantsFor()
This is a normative change in the Temporal spec.

See: 439e6af
2022-06-24 22:12:03 +01:00