Andreas Kling
7ad4702cbf
LibJS: Unbreak build with JS_MODULE_DEBUG
...
Thanks to David for noticing this! :^)
2022-02-07 19:59:21 +01:00
Andreas Kling
aeb72fe9d0
LibJS: Reduce header dependency graph in Realm.h
2022-02-07 19:16:46 +01:00
Andreas Kling
77a1ef06a4
LibJS: Add [[HostDefined]] internal slot to Realm objects
...
In C++, this is an OwnPtr<Realm::HostDefined>.
2022-02-07 19:16:45 +01:00
Andreas Kling
85cf80507f
LibJS: Make ScriptOrModule use WeakPtr instead of raw pointers
2022-02-07 19:16:45 +01:00
Linus Groh
acb91d7869
LibJS: Add spec comments to the NativeError constructor
2022-02-07 14:44:42 +00:00
Linus Groh
6a9eeb2c5c
LibJS: Add spec comments to the Error constructor
2022-02-07 14:41:37 +00:00
Linus Groh
a75ab15f15
LibJS: Add spec comments to Error.prototype.toString()
2022-02-07 14:35:29 +00:00
Linus Groh
e106d5ecf4
LibJS: Let Error prototypes inherit from PrototypeObject
2022-02-07 14:32:39 +00:00
Hendiadyoin1
89c82abf1f
LibJS: Implement non standard error.stack attribute
...
All other browser already support this feature.
There is a Stage 1 proposal to standardize this, but it does not seem
to be active.
2022-02-07 14:17:57 +00:00
Jorropo
dc42ca37bd
LibJS: Fix JSON.stringify with stale surrogate codepoints
...
This fix this test262 test:
built-ins/JSON/stringify/value-string-escape-unicode.js
2022-02-07 13:53:36 +00:00
Timothy Flynn
b0e5609b88
LibJS: Use GetV to look up the toJSON property in SerializeJSONProperty
...
The current implementation of step 2a sort of manually implemented GetV
with a ToObject + Get combo. But in the call to Get, the receiver wasn't
the correct object. So when invoking toJSON, the receiver was an Object
type rather than a BigInt.
This also adds spec comments to SerializeJSONProperty.
2022-02-07 09:24:09 +00:00
Linus Groh
6f20f49b21
Everywhere: Rename JS::PropertyKey variables from property_{name => key}
...
PropertyKey used to be called PropertyName, but got renamed. Let's
update all the variables of this type as well.
2022-02-06 22:02:45 +00:00
Timothy Flynn
cb57475168
LibJS: Implement BigInt.asUintN
2022-02-06 15:49:54 +00:00
Timothy Flynn
460c2caaf7
LibJS: Implement BigInt.asIntN
2022-02-06 15:49:54 +00:00
Andreas Kling
4d785b9aa0
LibJS: Mark Completion constructors with ALWAYS_INLINE
...
These were showing up in profiles.
2022-02-06 16:30:57 +01:00
Andreas Kling
2518f2045e
LibJS: Explicitly initialize primitive IndexedPropertyIterator members
2022-02-05 22:50:39 +01:00
Andreas Kling
0d60cf211d
LibJS: Cache valid indices in IndexedPropertyIterator
...
Refetching the list of indices every time we increment the iterator was
showing up hot & heavy in a profile of Discord.
2022-02-05 22:50:39 +01:00
davidot
14d1601a76
LibJS: Remove the VERIFY_NOT_REACHED in link_and_eval_module
...
Since the spec does not fully define the entry points of modules what
this means is kind of unclear. But it does work in most cases and can
be useful. We do print out a warning just to clarify why there could be
strange things.
2022-02-05 11:52:51 +01:00
davidot
d46be7e7f2
LibJS: Visit internal values in PromiseValueList
2022-02-05 11:52:51 +01:00
davidot
5749d85534
LibJS: Keep handles on promise functions while resolving a module
2022-02-05 11:52:51 +01:00
davidot
8da6c01d8f
LibJS: Remove the JS_TRACK_ZOMBIE_CELLS option
...
This feature had bitrotted somewhat and would trigger errors because
PrimitiveStrings were "destroyed" but because of this mode they were not
removed from the string cache. Even fixing that case running test-js
with the options still failed in more places.
2022-02-05 11:52:51 +01:00
Ali Mohammad Pur
a962ee020a
LibJS+LibRegex: Don't repeat regex match in regexp_exec()
...
LibRegex already implements this loop in a more performant way, so all
LibJS has to do here is to return things in the right shape, and not
loop over the input string.
Previously this was a quadratic operation on string length, which lead
to crazy execution times on failing regexps - now it's nice and fast :^)
Note that a Regex test has to be updated to remove the stateful flag as
it repeats matching on multiple strings.
2022-02-05 00:09:32 +01:00
Ali Mohammad Pur
2b028f6faa
LibRegex+LibJS: Avoid searching for more than one match in JS RegExps
...
All of JS's regular expression APIs only want a single match, so avoid
trying to produce more (which will be discarded anyway).
2022-02-05 00:09:32 +01:00
Linus Groh
e087cd574e
LibJS: Rename variables to 'calendarLike' in a couple of places
...
This is an editorial change in the Temporal spec.
See: 9af2d35
2022-02-04 20:00:34 +00:00
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