Commit graph

66 commits

Author SHA1 Message Date
Linus Groh
2401e45720 LibJS: Implement Temporal.Instant.fromEpochSeconds() 2021-07-09 13:20:51 +01:00
Linus Groh
117323f2d9 LibJS: Implement Temporal.Instant.prototype.epochNanoseconds 2021-07-08 23:08:27 +01:00
Linus Groh
b5d0cdc97e LibJS: Implement Temporal.Instant.prototype.epochMicroseconds 2021-07-08 23:08:27 +01:00
Linus Groh
b157ab3f12 LibJS: Implement Temporal.Instant.prototype.epochMilliseconds 2021-07-08 23:08:27 +01:00
Linus Groh
5010e01223 LibJS: Implement Temporal.Instant.prototype.epochSeconds 2021-07-08 23:08:27 +01:00
Linus Groh
51c581f604 LibJS: Implement Temporal.TimeZone.prototype.id 2021-07-08 23:08:27 +01:00
Linus Groh
7e4b0681e1 LibJS: Implement Date.prototype.toTemporalInstant() 2021-07-08 01:25:49 +01:00
Linus Groh
3a39ff8f40 LibJS: Implement Temporal.now.instant() 2021-07-07 19:00:42 +01:00
Linus Groh
6cd16eceb3 LibJS: Implement Temporal.now.timeZone() 2021-07-07 00:42:01 +01:00
Linus Groh
6735353b96 LibJS: Add preparation for Temporal constructors and prototypes
Add a JS_ENUMERATE_TEMPORAL_OBJECTS macro and use it to generate:

- Forward declarations
- CommonPropertyNames class name members
- Constructor and prototype GlobalObject members, getters, visitors,
  and initialize_constructor() calls
2021-07-07 00:42:01 +01:00
Linus Groh
8269921212 LibJS: Add the Temporal namespace object :^)
Currently empty, but we gotta start somewhere! This is the start of
implementing the Temporal proposal (currently stage 3).

I have decided to start a new subdirectory (Runtime/Temporal/) as well
as a new C++ namespace (JS::Temporal) for this so we don't have to
prefix all the files and classes with "Temporal" - there will be a lot.

https://tc39.es/proposal-temporal/
2021-07-07 00:42:01 +01:00
Idan Horowitz
5e621e494f LibJS: Implement Object.getOwnPropertyDescriptors() 2021-07-06 18:41:15 +01:00
Idan Horowitz
e2e695bc9f LibJS: Add and use the %ThrowTypeError% intrinsic 2021-06-28 08:55:14 +01:00
Andreas Kling
ba9d5c4d54 LibJS: Rename Function => FunctionObject 2021-06-27 22:36:04 +02:00
Idan Horowitz
c31392510a LibJS: Add the Number.prototype.toFixed method 2021-06-19 16:13:59 +01:00
Idan Horowitz
1cf5663e38 LibJS: Add the Object.prototype.__lookup{Getter, Setter}__ methods
These are a part of the Annex B extension of the specification.
2021-06-17 13:20:18 +01:00
Idan Horowitz
f98c0ca528 LibJS: Add the Object.prototype.__define{Getter, Setter}__ methods
These are a part of the Annex B extension of the specification.
2021-06-17 13:20:18 +01:00
Idan Horowitz
37340aa599 LibJS: Add the Object.prototype.__proto__ native accessor property
This is part of the Annex B extension of the specification.
2021-06-17 13:20:18 +01:00
Idan Horowitz
8e05b49089 LibJS: Add the String.prototype.codePointAt() method
This commit also brings charAt & charCodeAt closer to the specification
2021-06-16 20:05:18 +01:00
Idan Horowitz
2299be474b LibJS: Add the String.fromCodePoint() method 2021-06-16 10:29:10 +01:00
Idan Horowitz
e1b0719435 LibJS: Add all of the FinalizationRegistry.prototype methods
More specifically: cleanupSome, register & unregister.

FinalizationRegistery.prototype.cleanupSome is actually still a stage 2
proposal, but since test262 test cases already exist for it, i decided
to go for it :)
2021-06-15 23:59:21 +01:00
Idan Horowitz
9a0cbcc3d1 LibJS: Add the Object.fromEntries method 2021-06-15 12:15:18 +01:00
davidot
6c13cc67c6 LibJS: Implement Array.prototype.copyWithin generically 2021-06-14 09:57:06 +01:00
davidot
910b803d8d LibJS: Implement Array.prototype.flatMap
Also made recursive_array_flat more compliant with the spec
So renamed it to flatten_into_array
2021-06-14 09:57:06 +01:00
Idan Horowitz
d7a70eb77c LibJS: Add all of the DataView.prototype.set* methods 2021-06-14 01:45:04 +01:00
Idan Horowitz
c54b9a6920 LibJS: Add all of the DataView.prototype.get* methods 2021-06-14 01:45:04 +01:00
Andreas Kling
5eef07d232 LibJS: Avoid lots of string-to-int during global object construction
We were doing a *lot* of string-to-int conversion while creating a new
global object. This happened because Object::put() would try to convert
the property name (string) to an integer to see if it refers to an
indexed property.

Sidestep this issue by using PropertyName for the CommonPropertyNames
struct on VM (vm.names.foo), and giving PropertyName a flag that tells
us whether it's a string that *may be* a number.

All CommonPropertyNames are set up so they are known to not be numbers.
2021-06-13 19:11:29 +02:00
Idan Horowitz
bd9e20ef79 LibJS: Add the Object.getOwnPropertySymbols method 2021-06-12 18:39:23 +01:00
Idan Horowitz
7eba63a8a3 LibJS: Add the WeakRef built-in object 2021-06-12 18:39:23 +01:00
Linus Groh
7e1bffdeb8 LibJS: Implement Object.assign() 2021-06-12 11:36:17 +01:00
Linus Groh
862ba64037 LibJS: Implement the Error Cause proposal
Currently stage 3. https://github.com/tc39/proposal-error-cause
2021-06-11 21:34:05 +01:00
Linus Groh
cbd7437d40 LibJS: Implement AggregateError 2021-06-11 18:49:50 +01:00
Ali Mohammad Pur
3234697eca LibJS: Implement generator functions (only in bytecode mode) 2021-06-11 00:30:09 +02:00
Idan Horowitz
0b0f1eda05 LibJS: Add most of the Set.prototype methods
Specifically all aside from "values" and "entries" which require an
implementation of the SetIterator object.
2021-06-09 11:48:04 +01:00
Idan Horowitz
670be04c81 LibJS: Add the Set built-in object 2021-06-09 11:48:04 +01:00
Linus Groh
9b35231453 LibJS: Implement Proxy.revocable() 2021-06-08 23:53:13 +02:00
Idan Horowitz
60e70e5ee4 LibJS: Add Date.setUTC{Date, Month, Hours, ...}() aliases
These are a bit hacky, since they are supposed to be separate methods,
but since serenity only supports UTC currently, they are equivalent.
2021-06-06 19:14:11 +01:00
Idan Horowitz
17afe015a5 LibJS: Add Date.prototype.setTime() 2021-06-06 19:14:11 +01:00
Idan Horowitz
a93b1c7ea0 LibJS: Add Date.prototype.setMonth() 2021-06-06 19:14:11 +01:00
Idan Horowitz
b893963651 LibJS: Add Date.prototype.setDate() 2021-06-06 19:14:11 +01:00
Idan Horowitz
3eb05d9413 LibJS: Stub out Date.prototype.getTimezoneOffset()
We only support UTC currently, so this always returns 0 as long as the
date is not invalid.
2021-06-06 19:14:11 +01:00
Idan Horowitz
442ef63008 LibJS: Add the global escape() & unescape() methods 2021-06-05 18:55:08 +01:00
Idan Horowitz
0f8ed6183b LibJS: Add the Number.{MAX, MIN}_VALUE constants 2021-06-05 02:38:37 +01:00
Idan Horowitz
de8d081ca4 LibJS: Add the String.prototype.trim{Left, Right} aliases
These are the same as trim{Start, End} respectively.
2021-06-02 09:42:25 +02:00
Idan Horowitz
6bfeb87572 LibJS: Add String.prototype.anchor & friends
Adds an implementation of the following StringPrototype methods:
anchor, big, blink, bold, fixed, fontcolor, fontsize, italics, link,
small, strike, sub, sup.
2021-05-30 10:32:05 +01:00
Idan Horowitz
09233b9e41 LibJS: Add Date.prototype.{get, set}Year() 2021-05-29 23:42:08 +01:00
Luke
4d34802f74 LibJS: Expose TypedArray.prototype.byteOffset 2021-05-21 22:52:35 +01:00
Luke
8004a2dc77 LibJS: Expose TypedArray.prototype.buffer 2021-05-21 22:52:35 +01:00
Andreas Kling
3ee092cd0c LibJS: Implement Object.hasOwn() :^)
This is currently a TC39 Stage 2 proposal, but let's go for it!

https://github.com/tc39/proposal-accessible-object-hasownproperty

I wrote the C++, @linusg found bugs and wrote the test.
2021-05-18 11:18:19 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00