ladybird/Userland/Libraries/LibJS/CMakeLists.txt

156 lines
4.7 KiB
Text
Raw Normal View History

set(SOURCES
2021-06-08 21:08:47 +00:00
AST.cpp
Bytecode/ASTCodegen.cpp
Bytecode/BasicBlock.cpp
Bytecode/Generator.cpp
Bytecode/Instruction.cpp
Bytecode/Interpreter.cpp
Bytecode/Op.cpp
Bytecode/Pass/DumpCFG.cpp
Bytecode/Pass/GenerateCFG.cpp
Bytecode/Pass/MergeBlocks.cpp
Bytecode/Pass/PlaceBlocks.cpp
Bytecode/Pass/UnifySameBlocks.cpp
Bytecode/StringTable.cpp
2021-06-08 21:08:47 +00:00
Console.cpp
Heap/CellAllocator.cpp
Heap/BlockAllocator.cpp
Heap/Handle.cpp
Heap/HeapBlock.cpp
Heap/Heap.cpp
Interpreter.cpp
Lexer.cpp
MarkupGenerator.cpp
Parser.cpp
Runtime/AbstractOperations.cpp
2021-06-11 17:06:20 +00:00
Runtime/AggregateError.cpp
Runtime/AggregateErrorConstructor.cpp
Runtime/AggregateErrorPrototype.cpp
Runtime/ArgumentsObject.cpp
2021-06-08 21:08:47 +00:00
Runtime/Array.cpp
Runtime/ArrayBuffer.cpp
Runtime/ArrayBufferConstructor.cpp
Runtime/ArrayBufferPrototype.cpp
Runtime/ArrayConstructor.cpp
Runtime/ArrayIterator.cpp
Runtime/ArrayIteratorPrototype.cpp
Runtime/ArrayPrototype.cpp
Runtime/BigInt.cpp
Runtime/BigIntConstructor.cpp
2020-06-06 00:14:10 +00:00
Runtime/BigIntObject.cpp
Runtime/BigIntPrototype.cpp
Runtime/BooleanConstructor.cpp
Runtime/BooleanObject.cpp
Runtime/BooleanPrototype.cpp
Runtime/BoundFunction.cpp
Runtime/ConsoleObject.cpp
Runtime/DataView.cpp
Runtime/DataViewConstructor.cpp
Runtime/DataViewPrototype.cpp
Runtime/DateConstructor.cpp
Runtime/Date.cpp
Runtime/DatePrototype.cpp
Runtime/DeclarativeEnvironment.cpp
Runtime/Environment.cpp
Runtime/ErrorConstructor.cpp
Runtime/Error.cpp
Runtime/ErrorPrototype.cpp
Runtime/ErrorTypes.cpp
Runtime/Exception.cpp
Runtime/FinalizationRegistry.cpp
Runtime/FinalizationRegistryConstructor.cpp
Runtime/FinalizationRegistryPrototype.cpp
Runtime/FunctionConstructor.cpp
Runtime/FunctionEnvironment.cpp
Runtime/FunctionObject.cpp
Runtime/FunctionPrototype.cpp
Runtime/GeneratorFunctionConstructor.cpp
Runtime/GeneratorFunctionPrototype.cpp
Runtime/GeneratorObject.cpp
Runtime/GeneratorObjectPrototype.cpp
Runtime/GlobalEnvironment.cpp
Runtime/GlobalObject.cpp
Runtime/IndexedProperties.cpp
Runtime/IteratorOperations.cpp
Runtime/IteratorPrototype.cpp
2020-06-10 18:01:00 +00:00
Runtime/JSONObject.cpp
2021-06-12 20:54:40 +00:00
Runtime/Map.cpp
Runtime/MapConstructor.cpp
Runtime/MapIterator.cpp
Runtime/MapIteratorPrototype.cpp
2021-06-12 20:54:40 +00:00
Runtime/MapPrototype.cpp
Runtime/MarkedValueList.cpp
Runtime/MathObject.cpp
Runtime/NativeFunction.cpp
Runtime/NumberConstructor.cpp
Runtime/NumberObject.cpp
Runtime/NumberPrototype.cpp
Runtime/Object.cpp
Runtime/ObjectConstructor.cpp
Runtime/ObjectEnvironment.cpp
Runtime/ObjectPrototype.cpp
Runtime/PrimitiveString.cpp
LibJS: Add initial support for Promises Almost a year after first working on this, it's finally done: an implementation of Promises for LibJS! :^) The core functionality is working and closely following the spec [1]. I mostly took the pseudo code and transformed it into C++ - if you read and understand it, you will know how the spec implements Promises; and if you read the spec first, the code will look very familiar. Implemented functions are: - Promise() constructor - Promise.prototype.then() - Promise.prototype.catch() - Promise.prototype.finally() - Promise.resolve() - Promise.reject() For the tests I added a new function to test-js's global object, runQueuedPromiseJobs(), which calls vm.run_queued_promise_jobs(). By design, queued jobs normally only run after the script was fully executed, making it improssible to test handlers in individual test() calls by default [2]. Subsequent commits include integrations into LibWeb and js(1) - pretty-printing, running queued promise jobs when necessary. This has an unusual amount of dbgln() statements, all hidden behind the PROMISE_DEBUG flag - I'm leaving them in for now as they've been very useful while debugging this, things can get quite complex with so many asynchronously executed functions. I've not extensively explored use of these APIs for promise-based functionality in LibWeb (fetch(), Notification.requestPermission() etc.), but we'll get there in due time. [1]: https://tc39.es/ecma262/#sec-promise-objects [2]: https://tc39.es/ecma262/#sec-jobs-and-job-queues
2021-04-01 20:13:29 +00:00
Runtime/Promise.cpp
Runtime/PromiseConstructor.cpp
Runtime/PromiseJobs.cpp
Runtime/PromisePrototype.cpp
Runtime/PromiseReaction.cpp
Runtime/PromiseResolvingFunction.cpp
Runtime/PropertyDescriptor.cpp
Runtime/ProxyConstructor.cpp
Runtime/ProxyObject.cpp
Runtime/Reference.cpp
Runtime/ReflectObject.cpp
Runtime/RegExpConstructor.cpp
Runtime/RegExpObject.cpp
Runtime/RegExpPrototype.cpp
LibJS: Rewrite most of Object for spec compliance :^) This is a huge patch, I know. In hindsight this perhaps could've been done slightly more incremental, but I started and then fixed everything until it worked, and here we are. I tried splitting of some completely unrelated changes into separate commits, however. Anyway. This is a rewrite of most of Object, and by extension large parts of Array, Proxy, Reflect, String, TypedArray, and some other things. What we already had worked fine for about 90% of things, but getting the last 10% right proved to be increasingly difficult with the current code that sort of grew organically and is only very loosely based on the spec - this became especially obvious when we started fixing a large number of test262 failures. Key changes include: - 1:1 matching function names and parameters of all object-related functions, to avoid ambiguity. Previously we had things like put(), which the spec doesn't have - as a result it wasn't always clear which need to be used. - Better separation between object abstract operations and internal methods - the former are always the same, the latter can be overridden (and are therefore virtual). The internal methods (i.e. [[Foo]] in the spec) are now prefixed with 'internal_' for clarity - again, it was previously not always clear which AO a certain method represents, get() could've been both Get and [[Get]] (I don't know which one it was closer to right now). Note that some of the old names have been kept until all code relying on them is updated, but they are now simple wrappers around the closest matching standard abstract operation. - Simplifications of the storage layer: functions that write values to storage are now prefixed with 'storage_' to make their purpose clear, and as they are not part of the spec they should not contain any steps specified by it. Much functionality is now covered by the layers above it and was removed (e.g. handling of accessors, attribute checks). - PropertyAttributes has been greatly simplified, and is being replaced by PropertyDescriptor - a concept similar to the current implementation, but more aligned with the actual spec. See the commit message of the previous commit where it was introduced for details. - As a bonus, and since I had to look at the spec a whole lot anyway, I introduced more inline comments with the exact steps from the spec - this makes it super easy to verify correctness. - East-const all the things. As a result of all of this, things are much more correct but a bit slower now. Retaining speed wasn't a consideration at all, I have done no profiling of the new code - there might be low hanging fruits, which we can then harvest separately. Special thanks to Idan for helping me with this by tracking down bugs, updating everything outside of LibJS to work with these changes (LibWeb, Spreadsheet, HackStudio), as well as providing countless patches to fix regressions I introduced - there still are very few (we got it down to 5), but we also get many new passing test262 tests in return. :^) Co-authored-by: Idan Horowitz <idan.horowitz@gmail.com>
2021-07-04 17:14:16 +00:00
Runtime/OrdinaryFunctionObject.cpp
2021-06-08 21:08:47 +00:00
Runtime/Set.cpp
Runtime/SetConstructor.cpp
Runtime/SetIterator.cpp
Runtime/SetIteratorPrototype.cpp
2021-06-08 21:08:47 +00:00
Runtime/SetPrototype.cpp
Runtime/Shape.cpp
Runtime/StringConstructor.cpp
2020-07-12 03:23:01 +00:00
Runtime/StringIterator.cpp
Runtime/StringIteratorPrototype.cpp
Runtime/StringObject.cpp
Runtime/StringPrototype.cpp
Runtime/Symbol.cpp
Runtime/SymbolConstructor.cpp
Runtime/SymbolObject.cpp
Runtime/SymbolPrototype.cpp
Runtime/Temporal/AbstractOperations.cpp
Runtime/Temporal/Calendar.cpp
Runtime/Temporal/Instant.cpp
Runtime/Temporal/InstantConstructor.cpp
Runtime/Temporal/InstantPrototype.cpp
Runtime/Temporal/Now.cpp
Runtime/Temporal/PlainDate.cpp
Runtime/Temporal/PlainDateTime.cpp
Runtime/Temporal/PlainTime.cpp
Runtime/Temporal/Temporal.cpp
Runtime/Temporal/TimeZone.cpp
Runtime/Temporal/TimeZoneConstructor.cpp
Runtime/Temporal/TimeZonePrototype.cpp
Runtime/TypedArray.cpp
LibJS: Clean up TypedArray constructors and prototypes The current implementation is not entirely correct yet. Two classes have been added: - TypedArrayConstructor, which the various typed array constructors now inherit from. Calling or constructing this class (from JS, that is) directly is not possible, we might want to move this abstract class functionality to NativeFunction at a later point. - TypedArrayPrototype, which the various typed array prototypes now have as their own prototype. This will be the place where most of the functionality is being shared. Relevant parts from the spec: 22.2.1 The %TypedArray% Intrinsic Object The %TypedArray% intrinsic object: - is a constructor function object that all of the TypedArray constructor objects inherit from. - along with its corresponding prototype object, provides common properties that are inherited by all TypedArray constructors and their instances. 22.2.2 Properties of the %TypedArray% Intrinsic Object The %TypedArray% intrinsic object: - has a [[Prototype]] internal slot whose value is %Function.prototype%. 22.2.2.3 %TypedArray%.prototype The initial value of %TypedArray%.prototype is the %TypedArray% prototype object. 22.2.6 Properties of the TypedArray Constructors Each TypedArray constructor: - has a [[Prototype]] internal slot whose value is %TypedArray%. 22.2.6.2 TypedArray.prototype The initial value of TypedArray.prototype is the corresponding TypedArray prototype intrinsic object (22.2.7). 22.2.7 Properties of the TypedArray Prototype Objects Each TypedArray prototype object: - has a [[Prototype]] internal slot whose value is %TypedArray.prototype%. 22.2.7.2 TypedArray.prototype.constructor The initial value of a TypedArray.prototype.constructor is the corresponding %TypedArray% intrinsic object.
2020-12-02 00:23:40 +00:00
Runtime/TypedArrayConstructor.cpp
Runtime/TypedArrayPrototype.cpp
Runtime/VM.cpp
Runtime/Value.cpp
2021-06-12 02:28:30 +00:00
Runtime/WeakMap.cpp
Runtime/WeakMapConstructor.cpp
Runtime/WeakMapPrototype.cpp
2021-06-12 14:38:34 +00:00
Runtime/WeakRef.cpp
Runtime/WeakRefConstructor.cpp
Runtime/WeakRefPrototype.cpp
2021-06-09 16:23:04 +00:00
Runtime/WeakSet.cpp
Runtime/WeakSetConstructor.cpp
Runtime/WeakSetPrototype.cpp
SyntaxHighlighter.cpp
Token.cpp
)
serenity_lib(LibJS js)
target_link_libraries(LibJS LibM LibCore LibCrypto LibRegex LibSyntax)