Linus Groh
c48f695b90
LibJS: Remove '-000000' check from ParseTemporalYearMonthString
...
This is an editorial change in the Temporal spec.
See: 3be4b5d
2022-02-04 20:00:34 +00:00
Linus Groh
28ac5a1333
LibJS: Update fallibility of ParseISODateTime in spec comments
...
This is an editorial change in the Temporal spec.
See: bc79069
2022-02-04 20:00:34 +00:00
Timothy Flynn
30a143c79e
LibJS: Explicitly handle invalid Date objects in UTC time setters
...
This is a normative change in the ECMA-262 spec:
ca53334
Note that this also fixes a few errors where we errantly converted the
stored time value to local time.
2022-02-04 13:47:50 +00:00
Timothy Flynn
fd7d0a31d9
LibJS: Explicitly handle invalid Date objects in local time setters
...
This is a normative change in the ECMA-262 spec:
ca53334
2022-02-04 13:47:50 +00:00
Linus Groh
40ba12aa7d
LibJS: Consider calls of parse_iso_date_time() fallible
...
See: https://github.com/tc39/proposal-temporal/pull/2027
2022-02-02 18:55:00 +00:00
Linus Groh
19a2b32065
LibJS: Reject '-000000' as extended year
...
This is a normative change in the Temporal spec.
See: e60ef9e
2022-02-02 14:46:52 +00:00
Idan Horowitz
2cd3d4a287
LibJS: Implement Intl %SegmentIteratorPrototype%.next ( )
2022-01-31 21:05:04 +02:00
Idan Horowitz
366468f1de
LibJS: Implement Intl %SegmentsPrototype%.containing
2022-01-31 21:05:04 +02:00
Idan Horowitz
96af50bbba
LibJS: Implement the Intl CreateSegmentDataObject AO
2022-01-31 21:05:04 +02:00
Idan Horowitz
cea6c81c77
LibJS: Implement the Intl.Segmenter FindBoundary AO
2022-01-31 21:05:04 +02:00
Idan Horowitz
b1d19b5917
LibJS: Convert Intl.Segmenter, Segments and SegmentIterator to Utf16
...
This is a precursor to implementing the FindBoundary AO, which operates
on Utf16 code unit indexes.
2022-01-31 21:05:04 +02:00
Timothy Flynn
6efbafa6e0
Everywhere: Update copyrights with my new serenityos.org e-mail :^)
2022-01-31 18:23:22 +00:00
Timothy Flynn
02b7bf34c9
LibJS: Implement BigInt IsLessThan according to the spec
2022-01-31 17:50:54 +00:00
Timothy Flynn
9ad3debf35
LibJS: Implement BigInt loose-equality according to the spec
2022-01-31 17:50:54 +00:00
Timothy Flynn
281b0411f2
LibJS: Implement conversion of strings to BigInts according to the spec
...
The spec defines a StringToBigInt AO which allows for converting binary,
octal, decimal, and hexadecimal strings to a BigInt. Our conversion was
only allowing for decimal strings.
2022-01-31 17:50:54 +00:00
Andreas Kling
8bdf6441b1
LibJS: Use u32 for the JS::Shape property count
...
We don't need to support more than 2^32 object properties anyway, so
there's no point in using 64-bit property counts.
This small reduction in memory usage makes test-js run ~10% faster on
x86_64 locally.
2022-01-31 16:19:23 +01:00
Andreas Kling
7a742b17da
LibJS: Store ECMAScriptFunctionObject bytecode in an OwnPtr
...
Using an Optional was extremely wasteful for function objects that don't
even have a bytecode executable.
This allows ECMAScriptFunctionObject to fit in a smaller size class.
2022-01-31 16:19:23 +01:00
Andreas Kling
8d3f92c844
LibJS: Make JS::ECMAScriptFunctionObject smaller by reordering members
...
...and making heavy use of bitfields.
2022-01-31 16:19:23 +01:00
Andreas Kling
fc04465fa3
LibJS: Remove unnecessary GlobalObject pointer from Environment
...
As it turns out, we didn't actually need this pointer. :^)
2022-01-31 16:19:23 +01:00
Andreas Kling
4a51165f5f
LibJS: Reorganize JS::Shape members a little bit
...
Now that AK::Weakable doesn't have a bunch of padding at the end,
let's move the smaller members of JS::Shape to the end, since there's
nothing to fold into at the start.
2022-01-31 16:19:23 +01:00
Andreas Kling
1469057033
LibJS: Make JS::Shape smaller by using OwnPtr<HashMap> for transitions
...
Many shapes don't have any forward transitions to cache, so we can save
a bunch of memory (and time) by only creating the cache maps when
actually needed.
2022-01-31 16:19:23 +01:00
Andreas Kling
30fcb07fe8
LibJS: Make JS::Environment smaller by reordering members
...
By putting `m_permanently_screwed_by_eval` first, it folds into the
padding at the end of the base class (JS::Cell).
2022-01-31 16:19:23 +01:00
Timothy Flynn
fb08a5a896
LibJS: Implement Intl.supportedValuesOf
...
This is a stage 3 ECMA-402 proposal:
https://tc39.es/proposal-intl-enumeration/
2022-01-31 00:32:41 +00:00
Timothy Flynn
a120e85596
LibJS: Provide public access to list of sanctioned unit identifiers
2022-01-31 00:32:41 +00:00
Timothy Flynn
98348d9a33
LibJS: Allow calling Array::create_from without allocating a Vector
...
This method works as-is with a Span instead of a Vector (with some minor
const correctness adjustments).
2022-01-31 00:32:41 +00:00
Timothy Flynn
687276fc38
LibJS: Implement ECMA-402 BigInt.prototype.toLocaleString
2022-01-30 20:05:27 +00:00
Timothy Flynn
d6e926e5b1
LibJS: Support BigInt number formatting with Intl.NumberFormat
2022-01-30 20:05:27 +00:00
Timothy Flynn
a0253af8c1
LibJS: Generalize Intl.NumberFormat to operate on Value types
...
Intl.NumberFormat is meant to format both Number and BigInt types. To
prepare for formatting BigInt types, this generalizes our NumberFormat
implementation to operate on Value instances rather than doubles. All
arithmetic is moved to static helpers that can now be updated with
BigInt semantics.
2022-01-30 20:05:27 +00:00
Idan Horowitz
4ba4e4c777
LibJS: Implement Intl %SegmentsPrototype%[@@iterator]
2022-01-30 19:47:01 +00:00
Idan Horowitz
6c26a02aa8
LibJS: Start implementing Intl Segment Iterator objects
2022-01-30 19:47:01 +00:00
Idan Horowitz
9001a8cbe1
LibJS: Implement Intl.Segmenter.prototype.segment
2022-01-30 19:47:01 +00:00
Idan Horowitz
bbacea255f
LibJS: Start implementing Intl Segments objects
2022-01-30 19:47:01 +00:00
Idan Horowitz
891dfd9cbb
LibJS: Implement Intl.Segmenter.prototype.resolvedOptions
2022-01-30 19:47:01 +00:00
Idan Horowitz
6b8dfefc20
LibJS: Implement Intl.Segmenter.supportedLocalesOf
2022-01-30 19:47:01 +00:00
Idan Horowitz
a3bc06bb23
LibJS: Start implementing Intl.Segmenter
2022-01-30 19:47:01 +00:00
davidot
6b5c882af3
LibJS: Add support for JSON modules
...
We now have one supported assertion: 'type' if that is 'json' we attempt
to parse the module as JSON.
2022-01-30 17:40:20 +00:00
davidot
202de6ed25
LibJS: Expose JSON.parse as an intrinsic value of the global object
...
This will allow us to safely call it if we need to parse JSON within
LibJS.
2022-01-30 17:40:20 +00:00
davidot
f568939568
LibJS: Implement the import assertions proposal
...
The hard part of parsing them in import statements and calls was already
done so this is just removing some check which threw before on
assertions. And filtering the assertions based on the result of a new
host hook.
2022-01-30 17:40:20 +00:00
Idan Horowitz
fe687412a6
LibJS: Visit m_async_from_sync_iterator_prototype in GlobalObject
...
This prevents random crashes in for async loops due to GC.
2022-01-29 22:35:43 +00:00
Timothy Flynn
3b2ec01038
LibJS: Update spec numbers for ECMA-402
...
Intl.Segmenter is now section 18; bump the "Locale Sensitive Functions".
2022-01-29 22:23:25 +00:00
Timothy Flynn
4a99170cd2
LibJS: Implement Intl.Collator.prototype.resolvedOptions
2022-01-29 20:27:24 +00:00
Timothy Flynn
17306078b5
LibJS: Implement Intl.Collator.supportedLocalesOf
2022-01-29 20:27:24 +00:00
Timothy Flynn
06a6100b12
LibJS: Implement the Intl.Collator constructor
2022-01-29 20:27:24 +00:00
Timothy Flynn
1607a05d4c
LibJS: Add co, kf, and kn Unicode locale keywords to ResolveLocale
2022-01-29 20:27:24 +00:00
Timothy Flynn
4a3e142d55
LibJS: Implement a nearly empty Intl.Collator object
...
This adds plumbing for the Intl.Collator object, constructor, and
prototype.
2022-01-29 20:27:24 +00:00
Timothy Flynn
74939eb943
LibJS: Implement Intl.PluralRules.prototype.resolvedOptions
2022-01-28 19:38:47 +00:00
Timothy Flynn
8b3f49ff84
LibJS: Implement Intl.PluralRules.supportedLocalesOf
2022-01-28 19:38:47 +00:00
Timothy Flynn
348059bffd
LibJS: Implement the Intl.PluralRules constructor
2022-01-28 19:38:47 +00:00
Timothy Flynn
0087804d10
LibJS: Implement a nearly empty Intl.PluralRules object
...
This adds plumbing for the Intl.PluralRules object, constructor, and
prototype.
2022-01-28 19:38:47 +00:00
Timothy Flynn
ac3e42a8de
LibJS: Move some Intl.NumberFormat fields into a NumberFormatBase class
...
Other Intl objects, such as PluralRules, are to be treated as a
NumberFormat object in some AOs. There's only a handful of fields which
are to be shared between those objects - move them to a base class for
shared reuse.
This also updates the couple of NumberFormat AOs that are meant to
operate on these NumberFormat-like objects.
Alternatively, we could just have objects like PluralRules inherit from
NumberFormat directly. But that messes up the is<NumberFormat> runtime
checks, so this feels safer.
2022-01-28 19:38:47 +00:00