Commit graph

955 commits

Author SHA1 Message Date
Brian Smith
d972016c23 Issue #2026 - Part 2a - Support BigInt in NumberFormat and toLocaleString. https://bugzilla.mozilla.org/show_bug.cgi?id=1543677 2023-07-29 23:38:30 +08:00
Brian Smith
b64643e410 Issue #2026 - Part 1 - Implement BigInt64 and BigUint64Array. https://bugzilla.mozilla.org/show_bug.cgi?id=1456569 2023-07-29 23:38:09 +08:00
Brian Smith
15115c97fd Issue #1240 - Part 11 - Fix several issue reported on review. Skip over block delimiters when parsing BigInt literals. Update BigInt hashing to account for the possibility of moving GC. https://bugzilla.mozilla.org/show_bug.cgi?id=1531018 Make HashableValue comparison of BigInts infallible. https://bugzilla.mozilla.org/show_bug.cgi?id=1530406 Fix BigInt constructor API CallArgs usage. https://bugzilla.mozilla.org/show_bug.cgi?id=1526279 2023-07-25 09:15:38 +08:00
Brian Smith
2d5ee3c457 Issue #1240 - Part 10 - Implement minimal Ion support for BigInt. https://bugzilla.mozilla.org/show_bug.cgi?id=1507484 Implement IC support for BigInt. https://bugzilla.mozilla.org/show_bug.cgi?id=1522431 2023-07-25 09:15:18 +08:00
Brian Smith
4aa193b16b Issue #1240 - Part 9 - Fix incorrectly parsing decimal BigInt 0n. The decimal parser strips leading 0s, so prevent tokenbuf being empty. 2023-07-25 09:14:59 +08:00
Brian Smith
7a30b0fa2d Issue #1240 - Part 8 - Fix incorrect asserts with debug enabled. Fix BigInt errors in remainder operations https://bugzilla.mozilla.org/show_bug.cgi?id=1524136 Also fix 2 debug asserts in fallthroughs due to missing BigInt cases. 2023-07-25 09:14:42 +08:00
Brian Smith
4a3f1b7570 Issue #1240 - Part 7 - Handle BigInt values in XPCVariant code. https://bugzilla.mozilla.org/show_bug.cgi?id=1603055 2023-07-25 09:14:25 +08:00
Brian Smith
1355043d40 Issue #1240 - Part 5g - Implement BigInt comparison operators. Implement BigInt support for equality operators. https://bugzilla.mozilla.org/show_bug.cgi?id=1486173 Part 3. Implement BigInt support for relational comparison operators. https://bugzilla.mozilla.org/show_bug.cgi?id=1492669 2023-07-25 09:14:06 +08:00
Brian Smith
bbbab3898f Issue #1240 - Part 6c - Implement asIntN and asUintN methods for BigInt values. https://bugzilla.mozilla.org/show_bug.cgi?id=1501104 2023-07-25 09:13:51 +08:00
Brian Smith
e004b99054 Issue #1240 - Part 6b - Use ToIndex when constructing TypedArray with length argument. https://bugzilla.mozilla.org/show_bug.cgi?id=1317383 Part 2. 2023-07-25 09:13:36 +08:00
Brian Smith
e8f0ea219f Issue #1240 - Part 6a - Implement BigInt.prototype.toLocaleString. https://bugzilla.mozilla.org/show_bug.cgi?id=1366287 Part 5. 2023-07-25 09:13:18 +08:00
Brian Smith
e3ec738471 Issue #1240 - Part 5f - Add DataView methods for BigInt access. https://bugzilla.mozilla.org/show_bug.cgi?id=1528582 2023-07-25 09:12:59 +08:00
Brian Smith
03734326e8 Issue #1240 - Part 5e - BigInt bitwise operators. https://bugzilla.mozilla.org/show_bug.cgi?id=1490387 2023-07-25 09:12:38 +08:00
Brian Smith
20b52c9e2e Issue #1240 - Part 5d - Use the radix when parsing BigInts. Fixes Hex, Octal and Binary BigInt literal parsing. Previously it was only parsing in decimal. 2023-07-25 09:12:20 +08:00
Brian Smith
d44e3c9941 Issue #1240 - Part 5c -Implement ToInt32OrBigInt operation. https://bugzilla.mozilla.org/show_bug.cgi?id=1490387 2023-07-25 09:12:02 +08:00
Brian Smith
44b5d8dec3 Issue #1240 - Part 5b - BigInt support for basic arithmetic operations. https://bugzilla.mozilla.org/show_bug.cgi?id=1471134 Parts 3-5. 2023-07-25 09:11:46 +08:00
Brian Smith
25ee810247 Issue #1240 - Part 5a - BigInt to Number conversion. https://bugzilla.mozilla.org/show_bug.cgi?id=1466893 2023-07-25 09:10:14 +08:00
Brian Smith
dc23241afb Issue #1240 - Part 4 - Implement parser support for BigInt literals. https://bugzilla.mozilla.org/show_bug.cgi?id=1505849 Partially based on https://bugzilla.mozilla.org/show_bug.cgi?id=1456568 Un-result-ified the BigInt XDR code, so we can enable it. https://bugzilla.mozilla.org/show_bug.cgi?id=1419094 Uninitialised memory read with BigInt right-shift https://bugzilla.mozilla.org/show_bug.cgi?id=1679003 2023-07-25 09:09:57 +08:00
Brian Smith
07b6c03dc7 Issue #1240 - Part 3c - Fast-forward to the V8 version of BigIntType. Disabling some sections temporarily since the dependencies are not there yet. Based on the following: https://bugzilla.mozilla.org/show_bug.cgi?id=1502797 https://bugzilla.mozilla.org/show_bug.cgi?id=1471134 https://bugzilla.mozilla.org/show_bug.cgi?id=1441098 Part 3 & 4 Add structured clone support for BigInt and Enable BigInt wrapping from DOM bindings. https://bugzilla.mozilla.org/show_bug.cgi?id=1522738 2023-07-25 09:09:18 +08:00
Brian Smith
d42d5ce138 Issue #1240 - Part 3b - Implement WrappingOperations.h for wraparound math operations & conversions. https://bugzilla.mozilla.org/show_bug.cgi?id=1441657 Implement mozilla::WrappingMultiply. Prerequisite for our V8 fast forward. 2023-07-25 09:08:56 +08:00
Brian Smith
ddd49121a6 Issue #1240 - Part 3a - Adjust mozilla::FloatingPoint<T>'s definition. So only the barest details are specified for floating-point encodings, with every other number, bit mask, &c. mathematically derived. Also add a bunch of documentation comments. https://bugzilla.mozilla.org/show_bug.cgi?id=1508725 Prerequisite for our V8 fast forward. 2023-07-25 09:08:39 +08:00
Brian Smith
13ac0d6483 Issue #1240 - Part 2 - Define the BigIntObject class for BigInt wrapper objects. Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1366287 Part 3. In our Part 3 we will fast forward to the V8 implementation skipping GMP. 2023-07-25 09:08:22 +08:00
Brian Smith
f041afc61d Issue #1240 - Part 1 - Define a new BigInt primitive type. Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1366287 Part 1.0. However leaving out the --enable-bigint changes. 2023-07-25 09:08:03 +08:00
Martok
76052fcda8 Issue #2271 - Use declared names of self-hosted functions for cloning
Ensure that cloning a self-hosted function always has access to the declared
name from the source and that it doesn't get lost on successive clones.
This is done by storing the declared name in an extended slot on rename, and
cloning it with the function.

Based-on: m-c 1546232
2023-07-14 10:20:43 +08:00
Martok
3eb7729d04 Issue #2271 - Separate cloning of native and interpreted functions
Separate code paths make it easier to follow and specialize than a single
one-size-fits-all function.

Based-on: m-c 1405766, 1411954
2023-07-14 10:20:28 +08:00
Brian Smith
2c0384c4a2 Issue #2255 & #1240 - Simplify and enhance Maybe and Some(). https://bugzilla.mozilla.org/show_bug.cgi?id=1325351 This is a prerequisite for our BigInt V8 fast forward and potential #2255 fix. 2023-07-06 10:24:34 +08:00
Moonchild
81a3a92b04 [multiple] Update Intl tests. 2023-07-03 15:12:46 +08:00
Moonchild
f9c39acaa6 Issue #1656 - Follow-up: Re-nuke the vim lines introduced in #2265 2023-07-03 15:12:01 +08:00
Martok
4400677afe Issue #2046 - Implement Intl.DateTimeFormat's date-/timeStyle and hourCycle options
- remove mozExtensions flag and expose to client code

Based-on: m-c 1557718
2023-07-03 15:11:41 +08:00
Martok
e01ff1c5f9 Issue #1819 - Further align Intl.Locale to spec
- Reference updates (UTS 35)
- variant subtag and transform extension canonicalisation
2023-07-03 15:11:09 +08:00
Martok
0b3079d8e6 Issue #2259 - Performance improvements for LanguageTag parsing
- parsing: dont normalise things that don't need to be normalised anymore:
  extension, private-use, variant, language, script, and region subtags
- Add missing() and present() methods to LanguageSubtag
- Change mozilla::Range to mozilla::Span for slightly better code

Based-on: m-c 1592588
2023-07-03 15:10:37 +08:00
Martok
4ad4a82a10 Issue #2259 - Performance improvements in Locale
- Move BestAvailableLocale function to C++
- Move default locale computation to C++
- Add available-locales set to SharedIntlData
- Remove separate sets for DateFormat and NumberFormat available locales.

Based-on: m-c 1373089
2023-07-03 15:10:02 +08:00
Martok
c10a29d96f Issue #1819 - Implement Intl.Locale proposal
This is according to spec for the mozilla71 cycle, a follow-up will further adjust to spec.

- Add Intl.Locale as native C++
- Port Unicode BCP 47 locale identifier parser to C++
- Port language tag parser to C++
- adjust make_intl_data to generate the data

Based-on: m-c 1433303, 1570370
2023-07-03 15:09:21 +08:00
Martok
3ee2c9dcf1 Issue #2259 - process Unicode langtags and locale identifiers according to BCP 47
Major spec change: text references are to BCP47 (not the implementing RFCs) and
the single source of truth is now Unicode CLDR.

- Switch from IANA to CLDR for make_unicode
- Update grandfathered tag handling directly in the parser
- Don't support extlang, irregular, privateuse or 4-letter subtags
- Adjust comments to refer to Unicode BCP 47 locale identifiers, remove RFC 5646
- Canonicalize/order langtags correctly
- Tokenize BCP47 in reusable class

Based-on: m-c 1407674(partial), 1451082, 1530320, 1522070, 1531091
2023-07-03 15:08:53 +08:00
Martok
cf7bd82328 Issue #2195 - Add support for hourCycle to Intl.DateTimeFormat
Based-on: m-c 1386146, 1430809
2023-07-03 15:08:24 +08:00
Martok
e923c48f4f Issue #2259 - Improve ResolveLocale performance when initializing the default Intl objects
Based-on: m-c 1365650
2023-07-03 15:08:00 +08:00
Martok
e3dbf7c5e7 Issue #2259 - Support Unicode extensions with multiple value subtags in BCP47 language tags
Based-on: m-c 1321789
2023-07-03 15:07:26 +08:00
Martok
8d97bd437a Issue #2259 - Reimplement String.prototype.toLocale{Lower,Upper}Case per ECMAScript Intl specification
- Update make_unicode to output SpecialCasing
- Handle special casing
- Use realloc instead of malloc when resizing a newly created string buffer

Based-on: m-c 1318403, 1431957
2023-07-03 15:07:03 +08:00
Martok
949f69ef4b Issue #2259 - Implement caseFirst option in Intl.Collator
Based-on: m-c 866473
2023-07-03 15:06:40 +08:00
Martok
85612accf2 Issue #2046 - Introduce mozIntl.DateTimeFormat with mozExtensions
Based-on: m-c 1329904
2023-07-03 15:06:04 +08:00
Martok
30157344fe Issue #2259 - Update Intl.* Object-ness to ECMA-402, 4th edition
- turn each Intl object into a NativeObject subclass
- create them as PlainObject
- ensure correct type is passed in self-hosted code
- implement legacy constructor semantics for DateTime&NumberFormat
- store internals on object slot instead of JS WeakMap

Based-on: m-c 1328386, 1332604
2023-07-03 15:05:30 +08:00
Martok
adffcb127a Issue #2259 - Introduce helper for self-hosted hasOwnProperty calls in intl 2023-07-03 15:04:42 +08:00
Martok
a7d752deff Issue #2259 - Adjust self-hosted Array.prototype.sort to ES2018
The comparator to ArraySort must be optional also in self-hosted code, where calling the
implementation directly is generally faster than calling between JS and C++ multiple times.
2023-07-03 15:04:14 +08:00
Martok
f8f7aed528 Issue #2259 - Add JS::StackGCVector and JS::RootedVector
Based-on: m-c 1521732/{1,3}, 1527881
2023-07-03 15:03:45 +08:00
Martok
4c2e378613 Issue #2259 - Add mozilla::Result<V, E> and JS::Result<> for fallible return values
Based-on: m-c 1283562, 1277368/1, 1324828
2023-07-03 15:03:29 +08:00
Martok
5a531ea80c Issue #1969 Follow-Up: Error reporting arguments in RelativeTimeFormat/DateTimeFormat 2023-07-03 15:02:30 +08:00
Moonchild
890e1eb84d Fix debug builds 2023-07-03 14:59:18 +08:00
Moonchild
24b1a0f166 Avoid TLS lookups when checking if zones need to be marked for GC.
This converts the fromPointer() calls to an object cast to (hopefully)
avoid the GC crashes. Logic is reversed from MustSkipMarking to
ShouldMark with appropriate renames.
2023-07-03 14:59:02 +08:00
Moonchild
95a1e4b7a3 Simplify incremental GC sweeping
Splitting several parts of `SweepPhase` into constituent parts to
separate out sweeping code from code that handles yielding to the
mutator and resuming.
2023-07-03 14:58:44 +08:00
Moonchild
2a7ff7ce1a Issue #2257 - Remove rematerialized frames after bailouts and exceptions.
This ensures that rematerialized frames used by the devtools debugger
are properly removed so that no stale data is used during bailouts.
2023-06-02 10:35:31 +08:00