summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/CMakeLists.txt
AgeCommit message (Collapse)Author
2022-03-29LibJS: Import C++ sources from libjs-test262 :^)Linus Groh
This commit upstreams most of the C++ bits of the LibJS test262 runner at https://github.com/linusg/libjs-test262/, specifically everything but the main.cpp file serving as the actual executable. Since all of these are just regular JS objects, I opted to put them in LibJS itself, in a new Contrib/ directory like many other projects have one. Other code that can end up there in the future is the runtime for esvu, which might even share some functionality with test262's $262 object. The code has been copied verbatim, and only a small number of changes have been made: - Putting everything into the JS::Test262 namespace - Removing now redundant JS namespace prefixes - Updating includes to use absolute <LibJS/...> paths - Updating the SPDX-License-Identifier comments from MIT to BSD-2-Clause I gained permission to change the license and upstream these changes from all the major contributors to this code: Ali, Andrew, David, Idan. The removal of the code from the source repository is here: https://github.com/linusg/libjs-test262/pull/54 This is only the first step, the goal is to eventually upstream the actual libjs-test262-runner executable and supporting Python scripts into SerenityOS as well.
2022-02-20LibJS: Add an initial implementation of Collator Compare FunctionsIdan Horowitz
This commit adds an initial implementation (without any real locale support) of Collator Compare Functions, as well as the matching CompareStrings AO. These two are used to implement the ECMA402 version of String.localeCompare() and Int.Collator.compare().
2022-02-09LibJS: Remove MarkedValueList in favor of MarkedVector<Value> :^)Linus Groh
2022-02-08LibJS+Everywhere: Remove VM::exception() and most related functionsdavidot
This commit removes all exception related code: Remove VM::exception(), VM::throw_exception() etc. Any leftover throw_exception calls are moved to throw_completion. The one method left is clear_exception() which is now a no-op. Most of these calls are just to clear whatever exception might have been thrown when handling a Completion. So to have a cleaner commit this will be removed in a next commit. It also removes the actual Exception and TemporaryClearException classes since these are no longer used. In any spot where the exception was actually used an attempt was made to preserve that behavior. However since it is no longer tracked by the VM we cannot access exceptions which were thrown in previous calls. There are two such cases which might have different behavior: - In Web::DOM::Document::interpreter() the on_call_stack_emptied hook used to print any uncaught exception but this is now no longer possible as the VM does not store uncaught exceptions. - In js the code used to be interruptable by throwing an exception on the VM. This is no longer possible but was already somewhat fragile before as you could happen to throw an exception just before a VERIFY.
2022-01-30LibJS: Start implementing Intl Segment Iterator objectsIdan Horowitz
2022-01-30LibJS: Start implementing Intl Segments objectsIdan Horowitz
2022-01-30LibJS: Start implementing Intl.SegmenterIdan Horowitz
2022-01-30LibJS: Add support for JSON modulesdavidot
We now have one supported assertion: 'type' if that is 'json' we attempt to parse the module as JSON.
2022-01-29LibJS: Implement a nearly empty Intl.Collator objectTimothy Flynn
This adds plumbing for the Intl.Collator object, constructor, and prototype.
2022-01-28LibJS: Implement a nearly empty Intl.PluralRules objectTimothy Flynn
This adds plumbing for the Intl.PluralRules object, constructor, and prototype.
2022-01-25LibJS: Implement a nearly empty Intl.RelativeTimeFormat objectTimothy Flynn
This adds plumbing for the Intl.RelativeTimeFormat object, constructor, and prototype.
2022-01-23LibJS+LibTimeZone+LibUnicode: Remove direct linkage to LibTimeZoneTimothy Flynn
This is no longer needed now that LibTimeZone is included within LibC. Remove the direct linkage so that others do not mistakenly copy-paste the CMakeLists text elsewhere.
2022-01-22LibJS: Implement Module linking and evaluatingdavidot
2022-01-22LibJS: Add Module Namespace Exotic Objectdavidot
2022-01-22LibJS: Add ModuleEnvironmentdavidot
2022-01-16LibJS: Rename GeneratorObjectPrototype to GeneratorPrototypeLinus Groh
Given we usually call objects Foo{Object,Constructor,Prototype} or Foo{,Constructor,Prototype}, this name was an odd choice. The new one matches the spec better, which calls it the "Generator Prototype Object", so we simply omit the Object suffix as usual as it's implied.
2022-01-11LibJS: Support non-UTC time zones in Temporal :^)Linus Groh
We can now recognize & normalize all time zones from the IANA time zone database and not just 'UTC', which makes the LibJS Temporal implementation a lot more useful! Thanks to the newly added LibTimeZone, this was incredibly easy to implement :^) This already includes these recent editorial changes in the Temporal spec: https://github.com/tc39/proposal-temporal/commit/27bffe1
2021-12-16LibJS: Add MarkedVector<T>Andreas Kling
This abstracts a vector of Cell* with a strongly typed span() accessor that gives you Span<T*> instead of Span<Cell*>. It is intended to replace MarkedValueList in situations where you only need to store pointers to Cell (or an even more specific type of Cell). The API can definitely be improved, it's just the bare basics for now.
2021-12-08LibJS: Implement (most of) Intl.DateTimeFormat.prototype.formatTimothy Flynn
There are a few FIXMEs that will need to be addressed, but this implements most of the prototype method. The FIXMEs are mostly related to range formatting, which has been entirely ignored so far. But other than that, the following will need to be addressed: * Determining flexible day periods must be made locale-aware. * DST will need to be determined and acted upon. * Time zones other than UTC and calendars other than Gregorian are ignored. * Some of our results differ from other engines as they have some format patterns we do not. For example, they seem to have a lonely {dayPeriod} pattern, whereas our closest pattern is "{hour} {dayPeriod}".
2021-11-29LibJS: Implement a nearly empty Intl.DateTimeFormat objectTimothy Flynn
This adds plumbing for the Intl.DateTimeFormat object, constructor, and prototype. Note that unlike other Intl objects, the Intl.DateTimeFormat object has a LibUnicode structure as a base. This is to prevent wild amounts of code duplication between LibUnicode, Intl.DateTimeFormat, and other not-yet-defined Intl structures, because there's 12 fields shared between them.
2021-11-29LibJS: Add AsyncFromSyncIteratorPrototype and Async-From-Sync instancesdavidot
Until we have actual iterator records we have to store the sync iterator as the raw object.
2021-11-29LibJS: Add AsyncIteratorPrototypedavidot
2021-11-21LibJS: Parse async generator functionsdavidot
2021-11-20LibJS: Start fleshing out an ISO 8601 parser for TemporalLinus Groh
This is the start of a parser for the ISO 8601 grammar used in the Temporal spec: https://tc39.es/proposal-temporal/#sec-temporal-iso8601grammar We will, on purpose, not use a generic ISO 8601 parser from AK or similar for two reasons: - Many AOs make specific assumptions about which productions exist and access them directly, even when they're part of a larger production. - The spec says "The grammar deviates from the standard given in ISO 8601 in the following ways:" and then lists 17 of such deviations. Making that work with a general purpose parser is not worth it. The public API is not being used anywhere yet, but will be in the next couple of commits. Likewise, the Production enum will be populated with all the productions accessed directly (e.g. TemporalDateString). Many thanks to Ali for showing me how to improve my initial approach full of macros with a nice RAII helper - it's much nicer :^) Co-Authored-By: Ali Mohammad Pur <mpfard@serenityos.org>
2021-11-12LibJS: Implement async functions as generator functions in BC modeAli Mohammad Pur
This applies a simple transformation, and adds a simple wrapper that translates the generator interface to the async function interface.
2021-11-12LibJS: Begin implementing Intl.NumberFormat.prototype.formatTimothy Flynn
There is quite a lot to be done here so this is just a first pass at number formatting. Decimal and percent formatting are mostly working, but only for standard and compact notation (engineering and scientific notation are not implemented here). Currency formatting is parsed, but there is more work to be done to handle e.g. using symbols instead of currency codes ("$" instead of "USD"), and putting spaces around the currency symbol ("USD 2.00" instead of "USD2.00").
2021-11-10LibJS: Add support for await expressionsIdan Horowitz
2021-11-10LibJS: Add support for async functionsIdan Horowitz
This commit adds support for the most bare bones version of async functions, support for async generator functions, async arrow functions and await expressions are TODO.
2021-10-24LibJS: Add a separate "identifier table" to bytecode executablesAndreas Kling
This is a specialized string table for storing identifiers only. Identifiers are always FlyStrings, which makes many common operations faster by allowing O(1) comparison.
2021-10-24LibJS: Add Bytecode::Executable::dump()Andreas Kling
Let's have a helper for producing a consistent executable dump instead of repeating the logic in multiple places.
2021-10-20LibJS: Add PrivateEnvironmentdavidot
2021-10-14LibJS: Start implementing ShadowRealmLinus Groh
This commit adds the ShadowRealm object itself, its constructor, and prototype (currently empty).
2021-10-14LibJS: Implement Wrapped Function Exotic ObjectsLinus Groh
This is a new concept from the ShadowRealm API stage 3 proposal: https://tc39.es/proposal-shadowrealm/#sec-wrapped-function-exotic-objects
2021-09-25LibJS: Rename OrdinaryFunctionObject to ECMAScriptFunctionObjectLinus Groh
The old name is the result of the perhaps somewhat confusingly named abstract operation OrdinaryFunctionCreate(), which creates an "ordinary object" (https://tc39.es/ecma262/#ordinary-object) in contrast to an "exotic object" (https://tc39.es/ecma262/#exotic-object). However, the term "Ordinary Function" is not used anywhere in the spec, instead the created object is referred to as an "ECMAScript Function Object" (https://tc39.es/ecma262/#sec-ecmascript-function-objects), so let's call it that. The "ordinary" vs. "exotic" distinction is important because there are also "Built-in Function Objects", which can be either implemented as ordinary ECMAScript function objects, or as exotic objects (our NativeFunction). More work needs to be done to move a lot of infrastructure to ECMAScriptFunctionObject in order to make FunctionObject nothing more than an interface for objects that implement [[Call]] and optionally [[Construct]].
2021-09-14LibJS: Add a barebones SourceTextModule classAndreas Kling
This corresponds to "Source Text Module Record" from the spec.
2021-09-14LibJS: Add a barebones Module classAndreas Kling
This corresponds to the "Abstract Module Record" from the spec.
2021-09-12LibJS: Start adding a JS::Realm class (spec's "Realm Record")Linus Groh
2021-09-11LibJS: Implement a nearly empty Intl.NumberFormat objectTimothy Flynn
This adds plumbing for the Intl.NumberFormat object, constructor, and prototype.
2021-09-09LibJS: Start adding a JS::Script class (spec's "Script Record")Andreas Kling
2021-09-06LibJS: Implement a nearly empty Intl.ListFormat objectTimothy Flynn
This adds plumbing for the Intl.ListFormat object, constructor, and prototype.
2021-09-02LibJS: Implement a nearly empty Intl.Locale objectTimothy Flynn
This adds plumbing for the Intl.Locale object, constructor, and prototype.
2021-08-26LibJS: Implement the Intl.DisplayNames constructorTimothy Flynn
There is notably FIXME notations in this commit regarding Unicode locale extensions. We are not parsing extensions (or private use extensions) at all yet.
2021-08-26LibJS: Implement a nearly empty Intl.DisplayNames objectTimothy Flynn
This adds plumbing for the Intl.DisplayNames object, constructor, and prototype.
2021-08-23LibJS: Generalize PromiseAllResolveElementFunction common functionalityTimothy Flynn
The element-resolving functions on the Promise constructor are all very similar. To prepare for more of these functions to be implemented, break out common parts into a base class.
2021-08-21LibJS: Implement Promise.all on the Promise constructorTimothy Flynn
2021-08-15LibJS: Start implementing Temporal.PlainMonthDayLinus Groh
This commit adds the PlainMonthDay object itself, its constructor and prototype (currently empty), and the CreateTemporalMonthDay abstract operations.
2021-08-10LibJS: Add a simple reference-counted UTF-16 stringTimothy Flynn
To help alleviate memory usage when creating and copying large strings, create a simple wrapper around a Vector<u16> to reference count UTF-16 strings.
2021-08-08LibJS: Add the Intl namespace object :^)Linus Groh
This is the start of implementing ECMA-402 in LibJS, better known as the ECMAScript Internationalization API. Much like Temporal this gets its own subdirectory (Runtime/Intl/) as well as a new C++ namespace (JS::Intl) so we don't have to prefix all the files and classes with "Intl". https://tc39.es/ecma402/
2021-08-08LibJS: Start implementing Temporal.PlainYearMonthLinus Groh
This commit adds the PlainYearMonth object itself, its constructor and prototype (currently empty), and the CreateTemporalYearMonth and ISOYearMonthWithinLimits abstract operations.
2021-08-01LibJS: Start implementing Temporal.ZonedDateTimeLinus Groh
This commit adds the ZonedDateTime object itself, its constructor and prototype (currently empty), and the CreateTemporalZonedDateTime abstract operation.