summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
AgeCommit message (Collapse)Author
2022-11-11LibJS: Teach GetVariable bytecode op to deal with global variable cacheAndreas Kling
This mirrors the behavior of Identifer::to_reference() in the AST interpreter.
2022-11-11AK+Everywhere: Replace DistinctNumeric bool parameters with named onesSam Atkins
This means that rather than this: ``` AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, true, true, false, false, false, true, FunctionAddress); ``` We now have this: ``` AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, FunctionAddress, Arithmetic, Comparison, Increment); ``` Which is a lot more readable. :^) Co-authored-by: Ali Mohammad Pur <mpfard@serenityos.org>
2022-11-11Revert "LibJS: Add explicit assertion for days"Linus Groh
This reverts commit 56abb01ee3be7213f67ba7024881e3a0c7baf941. Unfortunately, the assertion doesn't work out as expected and crashes test-js.
2022-11-11LibJS: Make Identifier::execute() actually use the lookup cacheAndreas Kling
If we have cached environment coordinates for an Identifier, we have to call to_reference() to actually make use of them. :^)
2022-11-11LibJS: Cache access to bindings in the global environmentAndreas Kling
This patch adds a special EnvironmentCoordinate::global_marker value that signifies that a binding lookup ended up searching the global environment. It doesn't matter if we find it there or not, the global marker is always returned. This allows us to bypass other environments on subsequent access, going directly to the global environment.
2022-11-11LibJS: Make ObjectEnvironment::set_mutable_binding() faster as wellAndreas Kling
We can combine HasProperty and Set into just Set in non-strict mode for non-with object environments.
2022-11-11LibJS: Make ObjectEnvironment::get_binding_value() faster in sloppy modeAndreas Kling
We can combine HasProperty and Get into just Get in non-strict mode for non-with object environments.
2022-11-11LibJS: Add explicit assertion for daysSmrtnyk
This is an editorial change in Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/15b7293b38956a99805a48ab042a780a343cb5e2
2022-11-09Everywhere: Fix a few comment typosNico Weber
2022-11-09LibJS: Move throw_completion(Value) out of lineAndreas Kling
This allows us to instrument this function locally without rebuilding 1000+ files.
2022-11-08LibJS: Add thorough tests for try/finally using continue and breakLuke Wilde
I wrote these tests a while ago while trying to improve the bytecode, but didn't end up making them pass and gave up. They work in AST interpreter mode, so we can have them in now to have them around for anyone who wants to try and make them pass in bytecode.
2022-11-06Everywhere: Remove redundant inequality comparison operatorsDaniel Bertalan
C++20 can automatically synthesize `operator!=` from `operator==`, so there is no point in writing such functions by hand if all they do is call through to `operator==`. This fixes a compile error with compilers that implement P2468 (Clang 16 currently). This paper restores the C++17 behavior that if both `T::operator==(U)` and `T::operator!=(U)` exist, `U == T` won't be rewritten in reverse to call `T::operator==(U)`. Removing `!=` operators makes the rewriting possible again. See https://reviews.llvm.org/D134529#3853062
2022-11-06LibJS: Remove the now-unused LocalTZA AOTimothy Flynn
2022-11-06LibJS: Change ToLocalTime to use epoch nanosecondsTimothy Flynn
This is an editorial change to the ECMA-402 spec. See: https://github.com/tc39/ecma402/commit/b3f9a1b
2022-11-06LibJS: Remove infallibility marker from DefaultTimeZone invocationTimothy Flynn
This is an editorial change to the ECMA-402 spec. See: https://github.com/tc39/ecma402/commit/46aa5cc Also add an ECMA-402 spec link to the DefaultTimeZone implementation, as that definition supersedes ECMA-262.
2022-11-05LibJS: Rename ToShowTimeZoneNameOption to ToTimeZoneNameOptionSmrtnyk
This is an editorial change in Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/ab5b1ba91054a921e2ae129e3fe024bd1c6e7f2f
2022-11-04LibJS: Use more accurate number-to-string method in Number toExponentialTimothy Flynn
2022-11-04LibJS: Use more accurate number-to-string method in Number toPrecisionTimothy Flynn
2022-11-04LibJS: Use more accurate number-to-string method in Intl.NumberFormatTimothy Flynn
Intl.NumberFormat only ever wants literal number-to-digits here, without extra exponential formatting.
2022-11-04LibJS: Publicly expose double_to_string and rename it number_to_stringTimothy Flynn
Rename it to match the name used by the spec. Add an override mode to skip formatting numbers with an exponential sign (e.g. 1e23). This mode is needed by Number and Intl.NumberFormat, who don't call out a specific number-to-string method to use (they just say to make "the String consisting of the digits of n").
2022-11-04LibJS: Rename ToShowCalendarOption to ToCalendarNameOptionSmrtnyk
This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/2c9e2615f74a5ff15a812dac5cc2c3fa0c4a5922
2022-11-03LibJS: Implement precise double_to_stringDan Klishch
2022-11-03LibJS: Fix length of PlainDateTime.withPlainTimeLuke Wilde
withPlainTime's argument is optional, so the length of the function is actually 0.
2022-11-03LibJS: Add timeZoneName: "critical" option to ZonedDateTime.toString()Luke Wilde
This is a normative change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/d84937f
2022-11-03LibJS: Add calendarName: "critical" option to toString() methods Luke Wilde
This is a normative change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/e715a50
2022-11-03LibJS: Align ISO 8601 grammar with annotations from IXDTFLuke Wilde
This is a normative change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/c64b844
2022-11-03LibJS: Delegate to NumberFormat for DurationFormat unit formattingTimothy Flynn
This is a normative change in the Intl.DurationFormat proposal. See: https://github.com/tc39/proposal-intl-duration-format/commit/12ba9df
2022-11-03LibJS+LibUnicode: Add "microsecond" and "nanosecond" as sanctioned unitsTimothy Flynn
This is a normative change in the ECMA-402 spec. See: https://github.com/tc39/ecma402/commit/f627573
2022-11-03LibJS: Format sanctioned units such that there is one unit per lineTimothy Flynn
Much easier to manage and view diffs this way, rather than one large single line. This will soon be the only method in this file, so there's no concern over taking up too much vertical space here.
2022-11-03Everywhere: Clean up "the the" comment typosNico Weber
2022-11-03LibJS: Rename the Intl Enumeration Available* AOs to AvailableCanonical*Timothy Flynn
This is an editorial change to the Intl Enumeration API proposal. See: https://github.com/tc39/proposal-intl-enumeration/commit/807b444 Note that this was followed by a normative change to actually ensure the returned values are canonical: https://github.com/tc39/proposal-intl-enumeration/commit/075a6dc But the values we return are already canonical.
2022-11-02LibJS: Use the UnsignedBigInteger compare_to_double algorithmMoustafa Raafat
This also avoids an unnecessary copy
2022-11-02LibCrypto: Add a way to compare UnsignedBigInteger with doubleMoustafa Raafat
This patch also make SignedBigInteger::compare_to_double make use of the new function.
2022-11-01Everywhere: Mark dependencies of most targets as PRIVATETim Schumacher
Otherwise, we end up propagating those dependencies into targets that link against that library, which creates unnecessary link-time dependencies. Also included are changes to readd now missing dependencies to tools that actually need them.
2022-11-01LibJS: Map DurationFormat's list style to "short" when it is "digital"Timothy Flynn
This is a normative change in the Intl.DurationFormat proposal. See: https://github.com/tc39/proposal-intl-duration-format/commit/7495e32
2022-11-01LibJS: Alphabetically sort the collations returned by CollationsOfLocaleTimothy Flynn
This is a normative change in the Intl Locale Info proposal. See: https://github.com/tc39/proposal-intl-locale-info/commit/171d3ad Note this doesn't affect us because we don't have collation info from the CLDR; we just return ["default"] here.
2022-11-01LibJS: Disable bytecode optimizations againAndreas Kling
Bytecode optimizations still break test262, so let's not enable this until they have been confirmed to work there.
2022-11-01LibJS: Set default bytecode optimization level to OptimizeHendiadyoin1
2022-11-01LibJS: Add a sanity check to bytecodes argument_list_evaluationHendiadyoin1
2022-11-01LibJS: Add a note about inaccuracies to UnifySameBlocksHendiadyoin1
2022-11-01LibJS: Fix MergeBlocks emitting some blocks twiceHendiadyoin1
2022-11-01LibJS: Minor cleanups in MergeBlocksHendiadyoin1
2022-11-01LibJS: Don't memcpy NewBigInt instructionHendiadyoin1
These aren't trivially copyable, so we have to be a bit more careful
2022-11-01LibJS: Expose some information about the bytecode interpreters stateHendiadyoin1
This is quite helpful, when reporting internal errors.
2022-10-25LibLocale+LibJS: Update to CLDR version 42.0.0Timothy Flynn
There were some notable changes to the CLDR JSON format and data in this release. The patterns for a date at a specific time, i.e. "{date} at {time}", now appear under the "atTime" attribute of the "dateTimeFormats" object. Locale specific changes that affected test-js: All locales: * In many patterns, the code points U+00A0 (NO-BREAK SPACE) and U+202F (NARROW NO-BREAK SPACE) are now used in place of an ASCII space. For example, before the "dayPeriod" fields AM and PM. * Separators such as U+2013 (EN DASH) are now surrounded by U+2009 (THIN SPACE) in place of an ASCII space character. Locale "en": * Narrow localizations of time formats are even more narrow. For example, the abbreviation "wk." for "week" is now just "wk". Locale "ar": * The code point U+060C (ARABIC COMMA) is now used in place of an ASCII comma. * The code point U+200F (RIGHT-TO-LEFT MARK) now appears at the beginning of many localizations. * When the "latn" numbering system is used for currency formatting, the currency symbol more consistently is placed at the end of the pattern. Locale "he": * The "many" plural rules category has been removed. Locales "zh" and "es-419": * Several display-name localizations were changed.
2022-10-24AK+Everywhere: Turn bool keep_empty to an enum in split* functionsdemostanis
2022-10-24LibJS: Accept calendar names case-insensitivelyYedaya Katsman
This is a normative change in the Temporal spec See tc39/proposal-temporal@03101c6
2022-10-24LibJS: Only use 1 bit for Cell boolean flagAndreas Kling
2022-10-24LibJS: Add Cell::must_survive_garbage_collection() mechanismAndreas Kling
This allows cells to prevent themselves from being garbage collected, even when there are no references to them.
2022-10-23LibJS: Make parseFloat use the new double parserdavidot
This means it no longer is locale dependent and doesn't incorrectly accept hex floats anymore.