Andreas Kling
cd7dbe3e97
LibJS: Include source locations in VM::dump_backtrace() output
2021-09-11 17:01:19 +02:00
Andreas Kling
c364520c24
LibJS+js+test-js: Add GC debug mode that keeps cells "alive" as zombies
...
This patch adds a `-z` option to js and test-js. When run in this mode,
garbage cells are never actually destroyed. We instead keep them around
in a special zombie state.
This allows us to validate that zombies don't get marked in future GC
scans (since there were not supposed to be any more references!) :^)
Cells get notified when they become a zombie (via did_become_zombie())
and this is used by WeakContainer cells to deregister themselves from
the heap.
2021-09-11 16:52:03 +02:00
Andreas Kling
89f0e501a0
LibJS: Mark the global object in Environment::visit_edges()
2021-09-11 14:10:11 +02:00
Andreas Kling
d42d655853
LibJS+LibWeb+Spreadsheet: Upcall visit_edges() via Base typedef
...
Let's use Base::visit_edges() when calling the base class, to prevent
accidentally skipping over anyone in the inheritance chain.
2021-09-11 14:10:11 +02:00
Andreas Kling
19ee5e01ad
LibJS: Use Span<Cell*> instead of Vector<Cell*> in more places
2021-09-11 14:10:11 +02:00
Andreas Kling
466649c1e8
LibJS: Mark instance field names in FunctionObject::visit_edges()
2021-09-11 14:10:11 +02:00
Andreas Kling
470c99a2a6
LibJS: Tweak the WeakContainer::remove_swept_cells() API a little bit
...
Make this API take a Span<Cell*> instead of a Vector<Cell*>&.
This is behavior neutral, but stops the API looking like it wants to
do mutable things to the Vector.
2021-09-11 12:09:55 +02:00
Timothy Flynn
9b5696fee7
LibJS: Implement Intl.NumberFormat.prototype.resolvedOptions
2021-09-11 11:05:50 +01:00
Timothy Flynn
071e193d92
LibJS: Implement Intl.NumberFormat.supportedLocalesOf
2021-09-11 11:05:50 +01:00
Timothy Flynn
e42ba7f748
LibJS: Implement the Intl.NumberFormat constructor
2021-09-11 11:05:50 +01:00
Timothy Flynn
07f12b108b
LibJS: Implement a nearly empty Intl.NumberFormat object
...
This adds plumbing for the Intl.NumberFormat object, constructor, and
prototype.
2021-09-11 11:05:50 +01:00
Timothy Flynn
a1954262f8
LibJS: Handle Unicode locale extensions in the ResolveLocale operation
...
Currently, all callers of ResolveLocale invoke the operation with an
empty [[RelevantExtensionKeys]] slot, so the block of the method that
deals with those keys was unimplemented. This implements that block now
to prepare for Intl.NumberFormat which has a [[RelevantExtensionKeys]].
Note that the find_key_in_value() method is a simple VERIFY_NOT_REACHED
in just this commit until the Intl.NumberFormat's keys are handled in
its implementation.
2021-09-11 11:05:50 +01:00
Luke Wilde
3548b08de2
LibJS: Implement Temporal.PlainMonthDay.prototype.equals
2021-09-10 23:10:18 +01:00
Luke Wilde
2d5b15295a
LibJS: Implement Temporal.PlainMonthDay.from
2021-09-10 23:10:18 +01:00
Luke Wilde
d9d1e25db3
LibJS: Implement ToTemporalMonthDay AO
2021-09-10 23:10:18 +01:00
Ali Mohammad Pur
5a0cdb15b0
AK+Everywhere: Reduce the number of template parameters of IntrusiveList
...
This makes the user-facing type only take the node member pointer, and
lets the compiler figure out the other needed types from that.
2021-09-10 18:05:46 +03:00
Linus Groh
4e5becf36e
LibJS: Make default_merge_fields() {additional_,}fields Object a const&
...
This only calls Object::{get,enumerable_own_property_names}() on the
fields and additional_fields Objects, both of which are const-qualified.
2021-09-09 23:46:45 +01:00
Linus Groh
4bba61fd59
LibJS: Make resolve_iso_month() fields Object a const&
...
This only calls Object::get() on the fields Object, which is
const-qualified.
2021-09-09 23:46:45 +01:00
Linus Groh
1f99538185
LibJS: Make Temporal foo_from_fields() AO field/options Object a const*
...
This is a bit of a lie as the Value(Object const*) ctor will const_cast
them in invoke(), but at least it ensures that nothing else in the
function relies on getting non-const Objects.
Perhaps we can have an actual Object const* Value in the future as well.
2021-09-09 23:46:45 +01:00
Linus Groh
4be2aeca00
LibJS: Make prepare_temporal_fields() fields Object a const&
...
This only calls Object::get() on the fields Object, which is
const-qualified.
2021-09-09 23:46:45 +01:00
Linus Groh
c9951ad26b
LibJS: Make to_temporal_time_record() time like Object a const&
...
This only calls Object::get() on the temporal_time_like Object, which is
const-qualified.
2021-09-09 23:46:45 +01:00
Linus Groh
77a18392ff
LibJS: Make to_temporal_duration_record() time like Object a const&
...
This only calls Object::get() or some Duration getters on the
temporal_duration_like Object, both of which are const-qualified.
2021-09-09 23:46:45 +01:00
Linus Groh
1d24699ca8
LibJS: Make Temporal to_foo() AO normalized_options Object a const&
...
These only pass the normalized_options Object directly or indirectly to
get_option(), which now takes a const reference.
2021-09-09 23:46:45 +01:00
Linus Groh
a422ea8792
LibJS: Make get_string_or_number_option() options Object a const&
...
This only passes the options Object to get_option(), which now takes a
const reference.
2021-09-09 23:46:45 +01:00
Linus Groh
c099b1b8a5
LibJS: Make get_option() options Object a const&
...
This only calls Object::get() on the options Object, which is
const-qualified.
2021-09-09 23:46:45 +01:00
Linus Groh
5ae6ad8557
LibJS: Store Instant's and ZonedDateTime's m_nanoseconds as a const&
...
There's no need for these to be non-const. Suggested by @IdanHo in
https://github.com/SerenityOS/serenity/pull/9904#discussion_r704960184 .
Perhaps we can make more internal slots of these and other objects const
references as well, but that's a bit more involved as they are used by
various functions expecting non-const references.
2021-09-09 23:46:45 +01:00
Linus Groh
e4c07c5b8f
LibJS: Make new_target parameter of all Temporal AOs a const*
...
These are passed to ordinary_create_from_constructor() in each case,
which takes the parameter as a const&, so these can also be const.
2021-09-09 23:46:45 +01:00
Linus Groh
92363a4ef8
LibJS: Mark TemporalTimeToString as infallible
...
This is an editorial change in the Temporal spec.
See: 899cc24
2021-09-09 18:24:18 +01:00
Luke Wilde
90ada407db
LibJS: Implement Temporal.PlainYearMonth.compare
2021-09-09 09:06:23 +01:00
Luke Wilde
092ec0cecf
LibJS: Implement Temporal.PlainYearMonth.from
2021-09-09 09:06:23 +01:00
Luke Wilde
58e2597dc2
LibJS: Implement Temporal.PlainYearMonth.prototype.equals
2021-09-09 09:06:23 +01:00
Luke Wilde
ff0b01a505
LibJS: Implement ToTemporalYearMonth AO
2021-09-09 09:06:23 +01:00
Linus Groh
d3fcf5a570
LibJS: Implement Temporal.Instant.prototype.toZonedDateTimeISO()
2021-09-09 08:52:48 +01:00
Linus Groh
6607d1dfb1
LibJS: Implement Temporal.Instant.prototype.toZonedDateTime()
2021-09-09 08:52:48 +01:00
Andreas Kling
b76456f0ed
LibJS: Add a way to attach custom data to a JS::VM instance
...
This will be used by LibWeb to attach web engine specific stuff that
LibJS doesn't need to know about.
2021-09-09 02:18:31 +02:00
Linus Groh
9661d15fe2
LibJS: Implement Temporal.PlainTime.prototype.toJSON()
2021-09-08 23:42:26 +01:00
Linus Groh
6987e326d8
LibJS: Implement Temporal.PlainTime.prototype.toLocaleString()
2021-09-08 23:42:26 +01:00
Linus Groh
9f78a957d5
LibJS: Implement Temporal.PlainTime.prototype.toString()
2021-09-08 23:42:26 +01:00
Linus Groh
81aaa9ccd5
LibJS: Replace String const& with StringView in various Temporal AOs
...
This is especially helpful where we already pass StringView literals
and only compare them with others, e.g. overflow and largest/smallest
unit, in which case there's no need to actually allocate a string.
2021-09-08 23:42:26 +01:00
Timothy Flynn
4f2bcebe74
LibUnicode+LibJS: Store locale keyword values as a single string
...
Previously, LibUnicode would store the values of a keyword as a Vector.
For example, the locale "en-u-ca-abc-def" would have its keyword "ca"
stored as {"abc, "def"}. Then, canonicalization would occur on each of
the elements in that Vector.
This is incorrect because, for example, the keyword value "true" should
only be dropped if that is the entire value. That is, the canonical form
of "en-u-kb-true" is "en-u-kb", but "en-u-kb-abc-true" does not change
for canonicalization. However, we would canonicalize that locale as
"en-u-kb-abc".
2021-09-08 21:08:48 +01:00
Timothy Flynn
2ebafe000a
LibJS: Fix typos in Intl.ListFormat comments
2021-09-08 21:08:48 +01:00
Luke Wilde
d943b8f100
LibJS: Implement Temporal.PlainTime.prototype.with
...
Ticks off one box in #8982 and fixes one test262 case.
2021-09-08 19:57:29 +01:00
Linus Groh
33f76f88bb
LibJS: Add and use the CreateNegatedTemporalDuration AO
...
This is a normative change in the Temporal spec.
See: 6178ed3
2021-09-08 00:07:18 +01:00
Linus Groh
f046a4a75d
LibJS: Make implementation-defined language more concise
...
This is a normative change in the Temporal spec. No behavioral change,
just a clarification.
See: 42c964e
2021-09-08 00:07:18 +01:00
Linus Groh
86a7c795f6
LibJS: Use the newly added remainder operation in GetISOPartsFromEpoch
...
This is a normative change in the Temporal spec. No behavioral change,
just a clarification.
See: b7bdc65
2021-09-08 00:07:18 +01:00
Linus Groh
97cc8f4613
LibJS: Validate Calendar.prototype.fields() values more strictly
...
This is a normative change in the Temporal spec.
See:
- 75b66d8
- 9c2262b
2021-09-08 00:07:18 +01:00
Andreas Kling
6ad427993a
Everywhere: Behaviour => Behavior
2021-09-07 13:53:14 +02:00
Timothy Flynn
ef94c73a01
LibJS: Implement Intl.ListFormat.prototype.resolvedOptions
2021-09-06 23:49:56 +01:00
Timothy Flynn
5c06a91dfa
LibJS: Implement Intl.ListFormat.prototype.formatToParts
2021-09-06 23:49:56 +01:00
Timothy Flynn
cdba40f7ea
LibJS: Implement Intl.ListFormat.prototype.format
2021-09-06 23:49:56 +01:00