mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:17:36 +00:00
LibJS: Segregate GC-allocated objects by type
This patch adds two macros to declare per-type allocators: - JS_DECLARE_ALLOCATOR(TypeName) - JS_DEFINE_ALLOCATOR(TypeName) When used, they add a type-specific CellAllocator that the Heap will delegate allocation requests to. The result of this is that GC objects of the same type always end up within the same HeapBlock, drastically reducing the ability to perform type confusion attacks. It also improves HeapBlock utilization, since each block now has cells sized exactly to the type used within that block. (Previously we only had a handful of block sizes available, and most GC allocations ended up with a large amount of slack in their tails.) There is a small performance hit from this, but I'm sure we can make up for it elsewhere. Note that the old size-based allocators still exist, and we fall back to them for any type that doesn't have its own CellAllocator.
This commit is contained in:
parent
84a8ee01e1
commit
3c74dc9f4d
428 changed files with 723 additions and 22 deletions
|
@ -27,6 +27,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Calendar);
|
||||
|
||||
// 12 Temporal.Calendar Objects, https://tc39.es/proposal-temporal/#sec-temporal-calendar-objects
|
||||
Calendar::Calendar(String identifier, Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace JS::Temporal {
|
|||
|
||||
class Calendar final : public Object {
|
||||
JS_OBJECT(Calendar, Object);
|
||||
JS_DECLARE_ALLOCATOR(Calendar);
|
||||
|
||||
public:
|
||||
virtual ~Calendar() override = default;
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(CalendarConstructor);
|
||||
|
||||
// 12.2 The Temporal.Calendar Constructor, https://tc39.es/proposal-temporal/#sec-temporal-calendar-constructor
|
||||
CalendarConstructor::CalendarConstructor(Realm& realm)
|
||||
: NativeFunction(realm.vm().names.Calendar.as_string(), realm.intrinsics().function_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Temporal {
|
|||
|
||||
class CalendarConstructor final : public NativeFunction {
|
||||
JS_OBJECT(CalendarConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(CalendarConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(CalendarPrototype);
|
||||
|
||||
[[nodiscard]] static i32 iso_year(Object& temporal_object);
|
||||
[[nodiscard]] static u8 iso_month(Object& temporal_object);
|
||||
[[nodiscard]] static u8 iso_day(Object& temporal_object);
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Temporal {
|
|||
|
||||
class CalendarPrototype final : public PrototypeObject<CalendarPrototype, Calendar> {
|
||||
JS_PROTOTYPE_OBJECT(CalendarPrototype, Calendar, Temporal.Calendar);
|
||||
JS_DECLARE_ALLOCATOR(CalendarPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Duration);
|
||||
|
||||
// 7 Temporal.Duration Objects, https://tc39.es/proposal-temporal/#sec-temporal-duration-objects
|
||||
Duration::Duration(double years, double months, double weeks, double days, double hours, double minutes, double seconds, double milliseconds, double microseconds, double nanoseconds, Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace JS::Temporal {
|
|||
|
||||
class Duration final : public Object {
|
||||
JS_OBJECT(Duration, Object);
|
||||
JS_DECLARE_ALLOCATOR(Duration);
|
||||
|
||||
public:
|
||||
virtual ~Duration() override = default;
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Temporal {
|
|||
|
||||
class DurationConstructor final : public NativeFunction {
|
||||
JS_OBJECT(DurationConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(DurationConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DurationPrototype);
|
||||
|
||||
// 7.3 Properties of the Temporal.Duration Prototype Object, https://tc39.es/proposal-temporal/#sec-properties-of-the-temporal-duration-prototype-object
|
||||
DurationPrototype::DurationPrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Temporal {
|
|||
|
||||
class DurationPrototype final : public PrototypeObject<DurationPrototype, Duration> {
|
||||
JS_PROTOTYPE_OBJECT(DurationPrototype, Duration, Temporal.Duration);
|
||||
JS_DECLARE_ALLOCATOR(DurationPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Instant);
|
||||
|
||||
// 8 Temporal.Instant Objects, https://tc39.es/proposal-temporal/#sec-temporal-instant-objects
|
||||
Instant::Instant(BigInt const& nanoseconds, Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace JS::Temporal {
|
|||
|
||||
class Instant final : public Object {
|
||||
JS_OBJECT(Instant, Object);
|
||||
JS_DECLARE_ALLOCATOR(Instant);
|
||||
|
||||
public:
|
||||
virtual ~Instant() override = default;
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(InstantConstructor);
|
||||
|
||||
// 8.1 The Temporal.Instant Constructor, https://tc39.es/proposal-temporal/#sec-temporal-instant-constructor
|
||||
InstantConstructor::InstantConstructor(Realm& realm)
|
||||
: NativeFunction(realm.vm().names.Instant.as_string(), realm.intrinsics().function_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Temporal {
|
|||
|
||||
class InstantConstructor final : public NativeFunction {
|
||||
JS_OBJECT(InstantConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(InstantConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(InstantPrototype);
|
||||
|
||||
// 8.3 Properties of the Temporal.Instant Prototype Object, https://tc39.es/proposal-temporal/#sec-properties-of-the-temporal-instant-prototype-object
|
||||
InstantPrototype::InstantPrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Temporal {
|
|||
|
||||
class InstantPrototype final : public PrototypeObject<InstantPrototype, Instant> {
|
||||
JS_PROTOTYPE_OBJECT(InstantPrototype, Instant, Temporal.Instant);
|
||||
JS_DECLARE_ALLOCATOR(InstantPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Now);
|
||||
|
||||
// 2 The Temporal.Now Object, https://tc39.es/proposal-temporal/#sec-temporal-now-object
|
||||
Now::Now(Realm& realm)
|
||||
: Object(ConstructWithPrototypeTag::Tag, realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Temporal {
|
|||
|
||||
class Now final : public Object {
|
||||
JS_OBJECT(Now, Object);
|
||||
JS_DECLARE_ALLOCATOR(Now);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PlainDate);
|
||||
|
||||
// 3 Temporal.PlainDate Objects, https://tc39.es/proposal-temporal/#sec-temporal-plaindate-objects
|
||||
PlainDate::PlainDate(i32 year, u8 month, u8 day, Object& calendar, Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace JS::Temporal {
|
|||
|
||||
class PlainDate final : public Object {
|
||||
JS_OBJECT(PlainDate, Object);
|
||||
JS_DECLARE_ALLOCATOR(PlainDate);
|
||||
|
||||
public:
|
||||
virtual ~PlainDate() override = default;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PlainDateConstructor);
|
||||
|
||||
// 3.1 The Temporal.PlainDate Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plaindate-constructor
|
||||
PlainDateConstructor::PlainDateConstructor(Realm& realm)
|
||||
: NativeFunction(realm.vm().names.PlainDate.as_string(), realm.intrinsics().function_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Temporal {
|
|||
|
||||
class PlainDateConstructor final : public NativeFunction {
|
||||
JS_OBJECT(PlainDateConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(PlainDateConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PlainDatePrototype);
|
||||
|
||||
// 3.3 Properties of the Temporal.PlainDate Prototype Object, https://tc39.es/proposal-temporal/#sec-properties-of-the-temporal-plaindate-prototype-object
|
||||
PlainDatePrototype::PlainDatePrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Temporal {
|
|||
|
||||
class PlainDatePrototype final : public PrototypeObject<PlainDatePrototype, PlainDate> {
|
||||
JS_PROTOTYPE_OBJECT(PlainDatePrototype, PlainDate, Temporal.PlainDate);
|
||||
JS_DECLARE_ALLOCATOR(PlainDatePrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PlainDateTime);
|
||||
|
||||
// 5 Temporal.PlainDateTime Objects, https://tc39.es/proposal-temporal/#sec-temporal-plaindatetime-objects
|
||||
PlainDateTime::PlainDateTime(i32 iso_year, u8 iso_month, u8 iso_day, u8 iso_hour, u8 iso_minute, u8 iso_second, u16 iso_millisecond, u16 iso_microsecond, u16 iso_nanosecond, Object& calendar, Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace JS::Temporal {
|
|||
|
||||
class PlainDateTime final : public Object {
|
||||
JS_OBJECT(PlainDateTime, Object);
|
||||
JS_DECLARE_ALLOCATOR(PlainDateTime);
|
||||
|
||||
public:
|
||||
virtual ~PlainDateTime() override = default;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PlainDateTimeConstructor);
|
||||
|
||||
// 5.1 The Temporal.PlainDateTime Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plaindatetime-constructor
|
||||
PlainDateTimeConstructor::PlainDateTimeConstructor(Realm& realm)
|
||||
: NativeFunction(realm.vm().names.PlainDateTime.as_string(), realm.intrinsics().function_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Temporal {
|
|||
|
||||
class PlainDateTimeConstructor final : public NativeFunction {
|
||||
JS_OBJECT(PlainDateTimeConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(PlainDateTimeConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PlainDateTimePrototype);
|
||||
|
||||
// 5.3 Properties of the Temporal.PlainDateTime Prototype Object, https://tc39.es/proposal-temporal/#sec-properties-of-the-temporal-plaindatetime-prototype-object
|
||||
PlainDateTimePrototype::PlainDateTimePrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Temporal {
|
|||
|
||||
class PlainDateTimePrototype final : public PrototypeObject<PlainDateTimePrototype, PlainDateTime> {
|
||||
JS_PROTOTYPE_OBJECT(PlainDateTimePrototype, PlainDateTime, Temporal.PlainDateTime);
|
||||
JS_DECLARE_ALLOCATOR(PlainDateTimePrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PlainMonthDay);
|
||||
|
||||
// 10 Temporal.PlainMonthDay Objects, https://tc39.es/proposal-temporal/#sec-temporal-plainmonthday-objects
|
||||
PlainMonthDay::PlainMonthDay(u8 iso_month, u8 iso_day, i32 iso_year, Object& calendar, Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Temporal {
|
|||
|
||||
class PlainMonthDay final : public Object {
|
||||
JS_OBJECT(PlainMonthDay, Object);
|
||||
JS_DECLARE_ALLOCATOR(PlainMonthDay);
|
||||
|
||||
public:
|
||||
virtual ~PlainMonthDay() override = default;
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PlainMonthDayConstructor);
|
||||
|
||||
// 10.1 The Temporal.PlainMonthDay Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plainmonthday-constructor
|
||||
PlainMonthDayConstructor::PlainMonthDayConstructor(Realm& realm)
|
||||
: NativeFunction(realm.vm().names.PlainMonthDay.as_string(), realm.intrinsics().function_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Temporal {
|
|||
|
||||
class PlainMonthDayConstructor final : public NativeFunction {
|
||||
JS_OBJECT(PlainMonthDayConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(PlainMonthDayConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PlainMonthDayPrototype);
|
||||
|
||||
// 10.3 Properties of the Temporal.PlainMonthDay Prototype Object, https://tc39.es/proposal-temporal/#sec-properties-of-the-temporal-plainmonthday-prototype-object
|
||||
PlainMonthDayPrototype::PlainMonthDayPrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Temporal {
|
|||
|
||||
class PlainMonthDayPrototype final : public PrototypeObject<PlainMonthDayPrototype, PlainMonthDay> {
|
||||
JS_PROTOTYPE_OBJECT(PlainMonthDayPrototype, PlainMonthDay, Temporal.PlainMonthDay);
|
||||
JS_DECLARE_ALLOCATOR(PlainMonthDayPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PlainTime);
|
||||
|
||||
// 4 Temporal.PlainTime Objects, https://tc39.es/proposal-temporal/#sec-temporal-plaintime-objects
|
||||
PlainTime::PlainTime(u8 iso_hour, u8 iso_minute, u8 iso_second, u16 iso_millisecond, u16 iso_microsecond, u16 iso_nanosecond, Calendar& calendar, Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace JS::Temporal {
|
|||
|
||||
class PlainTime final : public Object {
|
||||
JS_OBJECT(PlainDateTime, Object);
|
||||
JS_DECLARE_ALLOCATOR(PlainTime);
|
||||
|
||||
public:
|
||||
virtual ~PlainTime() override = default;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PlainTimeConstructor);
|
||||
|
||||
// 4.1 The Temporal.PlainTime Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plaintime-constructor
|
||||
PlainTimeConstructor::PlainTimeConstructor(Realm& realm)
|
||||
: NativeFunction(realm.vm().names.PlainTime.as_string(), realm.intrinsics().function_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Temporal {
|
|||
|
||||
class PlainTimeConstructor final : public NativeFunction {
|
||||
JS_OBJECT(PlainTimeConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(PlainTimeConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PlainTimePrototype);
|
||||
|
||||
// 4.3 Properties of the Temporal.PlainTime Prototype Object, https://tc39.es/proposal-temporal/#sec-properties-of-the-temporal-plaintime-prototype-object
|
||||
PlainTimePrototype::PlainTimePrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Temporal {
|
|||
|
||||
class PlainTimePrototype final : public PrototypeObject<PlainTimePrototype, PlainTime> {
|
||||
JS_PROTOTYPE_OBJECT(PlainTimePrototype, PlainTime, Temporal.PlainTime);
|
||||
JS_DECLARE_ALLOCATOR(PlainTimePrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PlainYearMonth);
|
||||
|
||||
// 9 Temporal.PlainYearMonth Objects, https://tc39.es/proposal-temporal/#sec-temporal-plainyearmonth-objects
|
||||
PlainYearMonth::PlainYearMonth(i32 iso_year, u8 iso_month, u8 iso_day, Object& calendar, Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Temporal {
|
|||
|
||||
class PlainYearMonth final : public Object {
|
||||
JS_OBJECT(PlainYearMonth, Object);
|
||||
JS_DECLARE_ALLOCATOR(PlainYearMonth);
|
||||
|
||||
public:
|
||||
virtual ~PlainYearMonth() override = default;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PlainYearMonthConstructor);
|
||||
|
||||
// 9.1 The Temporal.PlainYearMonth Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plainyearmonth-constructor
|
||||
PlainYearMonthConstructor::PlainYearMonthConstructor(Realm& realm)
|
||||
: NativeFunction(realm.vm().names.PlainYearMonth.as_string(), realm.intrinsics().function_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Temporal {
|
|||
|
||||
class PlainYearMonthConstructor final : public NativeFunction {
|
||||
JS_OBJECT(PlainYearMonthConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(PlainYearMonthConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PlainYearMonthPrototype);
|
||||
|
||||
// 9.3 Properties of the Temporal.PlainYearMonth Prototype Object, https://tc39.es/proposal-temporal/#sec-properties-of-the-temporal-plainyearmonth-prototype-object
|
||||
PlainYearMonthPrototype::PlainYearMonthPrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Temporal {
|
|||
|
||||
class PlainYearMonthPrototype final : public PrototypeObject<PlainYearMonthPrototype, PlainYearMonth> {
|
||||
JS_PROTOTYPE_OBJECT(PlainYearMonthPrototype, PlainYearMonth, Temporal.PlainYearMonth);
|
||||
JS_DECLARE_ALLOCATOR(PlainYearMonthPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Temporal);
|
||||
|
||||
// 1 The Temporal Object, https://tc39.es/proposal-temporal/#sec-temporal-objects
|
||||
Temporal::Temporal(Realm& realm)
|
||||
: Object(ConstructWithPrototypeTag::Tag, realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Temporal {
|
|||
|
||||
class Temporal final : public Object {
|
||||
JS_OBJECT(Temporal, Object);
|
||||
JS_DECLARE_ALLOCATOR(Temporal);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(TimeZone);
|
||||
|
||||
// 11 Temporal.TimeZone Objects, https://tc39.es/proposal-temporal/#sec-temporal-timezone-objects
|
||||
TimeZone::TimeZone(Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace JS::Temporal {
|
|||
|
||||
class TimeZone final : public Object {
|
||||
JS_OBJECT(TimeZone, Object);
|
||||
JS_DECLARE_ALLOCATOR(TimeZone);
|
||||
|
||||
public:
|
||||
// Needs to store values in the range -8.64 * 10^13 to 8.64 * 10^13
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(TimeZoneConstructor);
|
||||
|
||||
// 11.2 The Temporal.TimeZone Constructor, https://tc39.es/proposal-temporal/#sec-temporal-timezone-constructor
|
||||
TimeZoneConstructor::TimeZoneConstructor(Realm& realm)
|
||||
: NativeFunction(realm.vm().names.TimeZone.as_string(), realm.intrinsics().function_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Temporal {
|
|||
|
||||
class TimeZoneConstructor final : public NativeFunction {
|
||||
JS_OBJECT(TimeZoneConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(TimeZoneConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(TimeZonePrototype);
|
||||
|
||||
// 11.4 Properties of the Temporal.TimeZone Prototype Object, https://tc39.es/proposal-temporal/#sec-properties-of-the-temporal-timezone-prototype-object
|
||||
TimeZonePrototype::TimeZonePrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Temporal {
|
|||
|
||||
class TimeZonePrototype final : public PrototypeObject<TimeZonePrototype, TimeZone> {
|
||||
JS_PROTOTYPE_OBJECT(TimeZonePrototype, TimeZone, Temporal.TimeZone);
|
||||
JS_DECLARE_ALLOCATOR(TimeZonePrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ZonedDateTime);
|
||||
|
||||
// 6 Temporal.ZonedDateTime Objects, https://tc39.es/proposal-temporal/#sec-temporal-zoneddatetime-objects
|
||||
ZonedDateTime::ZonedDateTime(BigInt const& nanoseconds, Object& time_zone, Object& calendar, Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace JS::Temporal {
|
|||
|
||||
class ZonedDateTime final : public Object {
|
||||
JS_OBJECT(ZonedDateTime, Object);
|
||||
JS_DECLARE_ALLOCATOR(ZonedDateTime);
|
||||
|
||||
public:
|
||||
virtual ~ZonedDateTime() override = default;
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ZonedDateTimeConstructor);
|
||||
|
||||
// 6.1 The Temporal.ZonedDateTime Constructor, https://tc39.es/proposal-temporal/#sec-temporal-zoneddatetime-constructor
|
||||
ZonedDateTimeConstructor::ZonedDateTimeConstructor(Realm& realm)
|
||||
: NativeFunction(realm.vm().names.ZonedDateTime.as_string(), realm.intrinsics().function_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Temporal {
|
|||
|
||||
class ZonedDateTimeConstructor final : public NativeFunction {
|
||||
JS_OBJECT(ZonedDateTimeConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(ZonedDateTimeConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ZonedDateTimePrototype);
|
||||
|
||||
// 6.3 Properties of the Temporal.ZonedDateTime Prototype Object, https://tc39.es/proposal-temporal/#sec-properties-of-the-temporal-zoneddatetime-prototype-object
|
||||
ZonedDateTimePrototype::ZonedDateTimePrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Temporal {
|
|||
|
||||
class ZonedDateTimePrototype final : public PrototypeObject<ZonedDateTimePrototype, ZonedDateTime> {
|
||||
JS_PROTOTYPE_OBJECT(ZonedDateTimePrototype, ZonedDateTime, Temporal.ZonedDateTime);
|
||||
JS_DECLARE_ALLOCATOR(ZonedDateTimePrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue