mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:07: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
|
@ -8,6 +8,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Collator);
|
||||
|
||||
// 10 Collator Objects, https://tc39.es/ecma402/#collator-objects
|
||||
Collator::Collator(Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace JS::Intl {
|
|||
|
||||
class Collator final : public Object {
|
||||
JS_OBJECT(Collator, Object);
|
||||
JS_DECLARE_ALLOCATOR(Collator);
|
||||
|
||||
public:
|
||||
enum class Usage {
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(CollatorCompareFunction);
|
||||
|
||||
NonnullGCPtr<CollatorCompareFunction> CollatorCompareFunction::create(Realm& realm, Collator& collator)
|
||||
{
|
||||
return realm.heap().allocate<CollatorCompareFunction>(realm, realm, collator);
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Intl {
|
|||
|
||||
class CollatorCompareFunction : public NativeFunction {
|
||||
JS_OBJECT(CollatorCompareFunction, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(CollatorCompareFunction);
|
||||
|
||||
public:
|
||||
static NonnullGCPtr<CollatorCompareFunction> create(Realm&, Collator&);
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(CollatorConstructor);
|
||||
|
||||
// 10.1.2 InitializeCollator ( collator, locales, options ), https://tc39.es/ecma402/#sec-initializecollator
|
||||
static ThrowCompletionOr<NonnullGCPtr<Collator>> initialize_collator(VM& vm, Collator& collator, Value locales_value, Value options_value)
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Intl {
|
|||
|
||||
class CollatorConstructor final : public NativeFunction {
|
||||
JS_OBJECT(CollatorConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(CollatorConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(CollatorPrototype);
|
||||
|
||||
// 10.3 Properties of the Intl.Collator Prototype Object, https://tc39.es/ecma402/#sec-properties-of-the-intl-collator-prototype-object
|
||||
CollatorPrototype::CollatorPrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class CollatorPrototype final : public PrototypeObject<CollatorPrototype, Collator> {
|
||||
JS_PROTOTYPE_OBJECT(CollatorPrototype, Collator, Collator);
|
||||
JS_DECLARE_ALLOCATOR(CollatorPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DateTimeFormat);
|
||||
|
||||
static Crypto::SignedBigInteger const s_one_million_bigint { 1'000'000 };
|
||||
|
||||
// 11 DateTimeFormat Objects, https://tc39.es/ecma402/#datetimeformat-objects
|
||||
|
|
|
@ -23,6 +23,7 @@ class DateTimeFormat final
|
|||
: public Object
|
||||
, public ::Locale::CalendarPattern {
|
||||
JS_OBJECT(DateTimeFormat, Object);
|
||||
JS_DECLARE_ALLOCATOR(DateTimeFormat);
|
||||
|
||||
using Patterns = ::Locale::CalendarPattern;
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DateTimeFormatConstructor);
|
||||
|
||||
// 11.1 The Intl.DateTimeFormat Constructor, https://tc39.es/ecma402/#sec-intl-datetimeformat-constructor
|
||||
DateTimeFormatConstructor::DateTimeFormatConstructor(Realm& realm)
|
||||
: NativeFunction(realm.vm().names.DateTimeFormat.as_string(), realm.intrinsics().function_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Intl {
|
|||
|
||||
class DateTimeFormatConstructor final : public NativeFunction {
|
||||
JS_OBJECT(DateTimeFormatConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(DateTimeFormatConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DateTimeFormatFunction);
|
||||
|
||||
// 11.5.4 DateTime Format Functions, https://tc39.es/ecma402/#sec-datetime-format-functions
|
||||
NonnullGCPtr<DateTimeFormatFunction> DateTimeFormatFunction::create(Realm& realm, DateTimeFormat& date_time_format)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace JS::Intl {
|
|||
|
||||
class DateTimeFormatFunction final : public NativeFunction {
|
||||
JS_OBJECT(DateTimeFormatFunction, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(DateTimeFormatFunction);
|
||||
|
||||
public:
|
||||
static NonnullGCPtr<DateTimeFormatFunction> create(Realm&, DateTimeFormat&);
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DateTimeFormatPrototype);
|
||||
|
||||
// 11.3 Properties of the Intl.DateTimeFormat Prototype Object, https://tc39.es/ecma402/#sec-properties-of-intl-datetimeformat-prototype-object
|
||||
DateTimeFormatPrototype::DateTimeFormatPrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class DateTimeFormatPrototype final : public PrototypeObject<DateTimeFormatPrototype, DateTimeFormat> {
|
||||
JS_PROTOTYPE_OBJECT(DateTimeFormatPrototype, DateTimeFormat, Intl.DateTimeFormat);
|
||||
JS_DECLARE_ALLOCATOR(DateTimeFormatPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DisplayNames);
|
||||
|
||||
// 12 DisplayNames Objects, https://tc39.es/ecma402/#intl-displaynames-objects
|
||||
DisplayNames::DisplayNames(Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace JS::Intl {
|
|||
|
||||
class DisplayNames final : public Object {
|
||||
JS_OBJECT(DisplayNames, Object);
|
||||
JS_DECLARE_ALLOCATOR(DisplayNames);
|
||||
|
||||
enum class Type {
|
||||
Invalid,
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DisplayNamesConstructor);
|
||||
|
||||
// 12.1 The Intl.DisplayNames Constructor, https://tc39.es/ecma402/#sec-intl-displaynames-constructor
|
||||
DisplayNamesConstructor::DisplayNamesConstructor(Realm& realm)
|
||||
: NativeFunction(realm.vm().names.DisplayNames.as_string(), realm.intrinsics().function_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Intl {
|
|||
|
||||
class DisplayNamesConstructor final : public NativeFunction {
|
||||
JS_OBJECT(DisplayNamesConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(DisplayNamesConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DisplayNamesPrototype);
|
||||
|
||||
// 12.3 Properties of the Intl.DisplayNames Prototype Object, https://tc39.es/ecma402/#sec-properties-of-intl-displaynames-prototype-object
|
||||
DisplayNamesPrototype::DisplayNamesPrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class DisplayNamesPrototype final : public PrototypeObject<DisplayNamesPrototype, DisplayNames> {
|
||||
JS_PROTOTYPE_OBJECT(DisplayNamesPrototype, DisplayNames, Intl.DisplayNames);
|
||||
JS_DECLARE_ALLOCATOR(DisplayNamesPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DurationFormat);
|
||||
|
||||
// 1 DurationFormat Objects, https://tc39.es/proposal-intl-duration-format/#durationformat-objects
|
||||
DurationFormat::DurationFormat(Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace JS::Intl {
|
|||
|
||||
class DurationFormat final : public Object {
|
||||
JS_OBJECT(DurationFormat, Object);
|
||||
JS_DECLARE_ALLOCATOR(DurationFormat);
|
||||
|
||||
public:
|
||||
enum class Style {
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DurationFormatConstructor);
|
||||
|
||||
// 1.2 The Intl.DurationFormat Constructor, https://tc39.es/proposal-intl-duration-format/#sec-intl-durationformat-constructor
|
||||
DurationFormatConstructor::DurationFormatConstructor(Realm& realm)
|
||||
: NativeFunction(realm.vm().names.DurationFormat.as_string(), realm.intrinsics().function_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Intl {
|
|||
|
||||
class DurationFormatConstructor final : public NativeFunction {
|
||||
JS_OBJECT(DurationFormatConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(DurationFormatConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DurationFormatPrototype);
|
||||
|
||||
// 1.4 Properties of the Intl.DurationFormat Prototype Object, https://tc39.es/proposal-intl-duration-format/#sec-properties-of-intl-durationformat-prototype-object
|
||||
DurationFormatPrototype::DurationFormatPrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class DurationFormatPrototype final : public PrototypeObject<DurationFormatPrototype, DurationFormat> {
|
||||
JS_PROTOTYPE_OBJECT(DurationFormatPrototype, DurationFormat, Intl.DurationFormat);
|
||||
JS_DECLARE_ALLOCATOR(DurationFormatPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Intl);
|
||||
|
||||
// 8 The Intl Object, https://tc39.es/ecma402/#intl-object
|
||||
Intl::Intl(Realm& realm)
|
||||
: Object(ConstructWithPrototypeTag::Tag, realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Intl {
|
|||
|
||||
class Intl final : public Object {
|
||||
JS_OBJECT(Intl, Object);
|
||||
JS_DECLARE_ALLOCATOR(Intl);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ListFormat);
|
||||
|
||||
// 13 ListFormat Objects, https://tc39.es/ecma402/#listformat-objects
|
||||
ListFormat::ListFormat(Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace JS::Intl {
|
|||
|
||||
class ListFormat final : public Object {
|
||||
JS_OBJECT(ListFormat, Object);
|
||||
JS_DECLARE_ALLOCATOR(ListFormat);
|
||||
|
||||
public:
|
||||
enum class Type {
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ListFormatConstructor);
|
||||
|
||||
// 13.1 The Intl.ListFormat Constructor, https://tc39.es/ecma402/#sec-intl-listformat-constructor
|
||||
ListFormatConstructor::ListFormatConstructor(Realm& realm)
|
||||
: NativeFunction(realm.vm().names.ListFormat.as_string(), realm.intrinsics().function_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Intl {
|
|||
|
||||
class ListFormatConstructor final : public NativeFunction {
|
||||
JS_OBJECT(ListFormatConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(ListFormatConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ListFormatPrototype);
|
||||
|
||||
// 13.3 Properties of the Intl.ListFormat Prototype Object, https://tc39.es/ecma402/#sec-properties-of-intl-listformat-prototype-object
|
||||
ListFormatPrototype::ListFormatPrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class ListFormatPrototype final : public PrototypeObject<ListFormatPrototype, ListFormat> {
|
||||
JS_PROTOTYPE_OBJECT(ListFormatPrototype, ListFormat, Intl.ListFormat);
|
||||
JS_DECLARE_ALLOCATOR(ListFormatPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Locale);
|
||||
|
||||
NonnullGCPtr<Locale> Locale::create(Realm& realm, ::Locale::LocaleID locale_id)
|
||||
{
|
||||
auto locale = realm.heap().allocate<Locale>(realm, realm.intrinsics().intl_locale_prototype());
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace JS::Intl {
|
|||
|
||||
class Locale final : public Object {
|
||||
JS_OBJECT(Locale, Object);
|
||||
JS_DECLARE_ALLOCATOR(Locale);
|
||||
|
||||
public:
|
||||
static NonnullGCPtr<Locale> create(Realm&, ::Locale::LocaleID);
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(LocaleConstructor);
|
||||
|
||||
struct LocaleAndKeys {
|
||||
String locale;
|
||||
Optional<String> ca;
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Intl {
|
|||
|
||||
class LocaleConstructor final : public NativeFunction {
|
||||
JS_OBJECT(LocaleConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(LocaleConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(LocalePrototype);
|
||||
|
||||
// 14.3 Properties of the Intl.Locale Prototype Object, https://tc39.es/ecma402/#sec-properties-of-intl-locale-prototype-object
|
||||
LocalePrototype::LocalePrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class LocalePrototype final : public PrototypeObject<LocalePrototype, Locale> {
|
||||
JS_PROTOTYPE_OBJECT(LocalePrototype, Locale, Intl.Locale);
|
||||
JS_DECLARE_ALLOCATOR(LocalePrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(NumberFormatBase);
|
||||
JS_DEFINE_ALLOCATOR(NumberFormat);
|
||||
|
||||
NumberFormatBase::NumberFormatBase(Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
{
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace JS::Intl {
|
|||
|
||||
class NumberFormatBase : public Object {
|
||||
JS_OBJECT(NumberFormatBase, Object);
|
||||
JS_DECLARE_ALLOCATOR(NumberFormatBase);
|
||||
|
||||
public:
|
||||
enum class RoundingType {
|
||||
|
@ -129,6 +130,7 @@ private:
|
|||
|
||||
class NumberFormat final : public NumberFormatBase {
|
||||
JS_OBJECT(NumberFormat, NumberFormatBase);
|
||||
JS_DECLARE_ALLOCATOR(NumberFormat);
|
||||
|
||||
public:
|
||||
enum class Style {
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(NumberFormatConstructor);
|
||||
|
||||
// 15.1 The Intl.NumberFormat Constructor, https://tc39.es/ecma402/#sec-intl-numberformat-constructor
|
||||
NumberFormatConstructor::NumberFormatConstructor(Realm& realm)
|
||||
: NativeFunction(realm.vm().names.NumberFormat.as_string(), realm.intrinsics().function_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class NumberFormatConstructor final : public NativeFunction {
|
||||
JS_OBJECT(NumberFormatConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(NumberFormatConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(NumberFormatPrototype);
|
||||
|
||||
// 15.3 Properties of the Intl.NumberFormat Prototype Object, https://tc39.es/ecma402/#sec-properties-of-intl-numberformat-prototype-object
|
||||
NumberFormatPrototype::NumberFormatPrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class NumberFormatPrototype final : public PrototypeObject<NumberFormatPrototype, NumberFormat> {
|
||||
JS_PROTOTYPE_OBJECT(NumberFormatPrototype, NumberFormat, Intl.NumberFormat);
|
||||
JS_DECLARE_ALLOCATOR(NumberFormatPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PluralRules);
|
||||
|
||||
// 16 PluralRules Objects, https://tc39.es/ecma402/#pluralrules-objects
|
||||
PluralRules::PluralRules(Object& prototype)
|
||||
: NumberFormatBase(prototype)
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace JS::Intl {
|
|||
|
||||
class PluralRules final : public NumberFormatBase {
|
||||
JS_OBJECT(PluralRules, NumberFormatBase);
|
||||
JS_DECLARE_ALLOCATOR(PluralRules);
|
||||
|
||||
public:
|
||||
virtual ~PluralRules() override = default;
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PluralRulesConstructor);
|
||||
|
||||
// 16.1 The Intl.PluralRules Constructor, https://tc39.es/ecma402/#sec-intl-pluralrules-constructor
|
||||
PluralRulesConstructor::PluralRulesConstructor(Realm& realm)
|
||||
: NativeFunction(realm.vm().names.PluralRules.as_string(), realm.intrinsics().function_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Intl {
|
|||
|
||||
class PluralRulesConstructor final : public NativeFunction {
|
||||
JS_OBJECT(PluralRulesConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(PluralRulesConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PluralRulesPrototype);
|
||||
|
||||
// 16.3 Properties of the Intl.PluralRules Prototype Object, https://tc39.es/ecma402/#sec-properties-of-intl-pluralrules-prototype-object
|
||||
PluralRulesPrototype::PluralRulesPrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class PluralRulesPrototype final : public PrototypeObject<PluralRulesPrototype, PluralRules> {
|
||||
JS_PROTOTYPE_OBJECT(PluralRulesPrototype, PluralRules, Intl.PluralRules);
|
||||
JS_DECLARE_ALLOCATOR(PluralRulesPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(RelativeTimeFormat);
|
||||
|
||||
// 17 RelativeTimeFormat Objects, https://tc39.es/ecma402/#relativetimeformat-objects
|
||||
RelativeTimeFormat::RelativeTimeFormat(Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace JS::Intl {
|
|||
|
||||
class RelativeTimeFormat final : public Object {
|
||||
JS_OBJECT(RelativeTimeFormat, Object);
|
||||
JS_DECLARE_ALLOCATOR(RelativeTimeFormat);
|
||||
|
||||
public:
|
||||
enum class Numeric {
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(RelativeTimeFormatConstructor);
|
||||
|
||||
// 17.1 The Intl.RelativeTimeFormat Constructor, https://tc39.es/ecma402/#sec-intl-relativetimeformat-constructor
|
||||
RelativeTimeFormatConstructor::RelativeTimeFormatConstructor(Realm& realm)
|
||||
: NativeFunction(realm.vm().names.RelativeTimeFormat.as_string(), realm.intrinsics().function_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Intl {
|
|||
|
||||
class RelativeTimeFormatConstructor final : public NativeFunction {
|
||||
JS_OBJECT(RelativeTimeFormatConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(RelativeTimeFormatConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(RelativeTimeFormatPrototype);
|
||||
|
||||
// 17.3 Properties of the Intl.RelativeTimeFormat Prototype Object, https://tc39.es/ecma402/#sec-properties-of-intl-relativetimeformat-prototype-object
|
||||
RelativeTimeFormatPrototype::RelativeTimeFormatPrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class RelativeTimeFormatPrototype final : public PrototypeObject<RelativeTimeFormatPrototype, RelativeTimeFormat> {
|
||||
JS_PROTOTYPE_OBJECT(RelativeTimeFormatPrototype, RelativeTimeFormat, Intl.RelativeTimeFormat);
|
||||
JS_DECLARE_ALLOCATOR(RelativeTimeFormatPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SegmentIterator);
|
||||
|
||||
// 18.6.1 CreateSegmentIterator ( segmenter, string ), https://tc39.es/ecma402/#sec-createsegmentsobject
|
||||
NonnullGCPtr<SegmentIterator> SegmentIterator::create(Realm& realm, Segmenter& segmenter, Utf16View const& string, Segments const& segments)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace JS::Intl {
|
|||
|
||||
class SegmentIterator final : public Object {
|
||||
JS_OBJECT(SegmentIterator, Object);
|
||||
JS_DECLARE_ALLOCATOR(SegmentIterator);
|
||||
|
||||
public:
|
||||
static NonnullGCPtr<SegmentIterator> create(Realm&, Segmenter&, Utf16View const&, Segments const&);
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SegmentIteratorPrototype);
|
||||
|
||||
// 18.6.2 The %SegmentIteratorPrototype% Object, https://tc39.es/ecma402/#sec-%segmentiteratorprototype%-object
|
||||
SegmentIteratorPrototype::SegmentIteratorPrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().iterator_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class SegmentIteratorPrototype final : public PrototypeObject<SegmentIteratorPrototype, SegmentIterator> {
|
||||
JS_PROTOTYPE_OBJECT(SegmentIteratorPrototype, SegmentIterator, SegmentIterator);
|
||||
JS_DECLARE_ALLOCATOR(SegmentIteratorPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Segmenter);
|
||||
|
||||
// 18 Segmenter Objects, https://tc39.es/ecma402/#segmenter-objects
|
||||
Segmenter::Segmenter(Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace JS::Intl {
|
|||
|
||||
class Segmenter final : public Object {
|
||||
JS_OBJECT(Segmenter, Object);
|
||||
JS_DECLARE_ALLOCATOR(Segmenter);
|
||||
|
||||
public:
|
||||
enum class SegmenterGranularity {
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SegmenterConstructor);
|
||||
|
||||
// 18.1 The Intl.Segmenter Constructor, https://tc39.es/ecma402/#sec-intl-segmenter-constructor
|
||||
SegmenterConstructor::SegmenterConstructor(Realm& realm)
|
||||
: NativeFunction(realm.vm().names.Segmenter.as_string(), realm.intrinsics().function_prototype())
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace JS::Intl {
|
|||
|
||||
class SegmenterConstructor final : public NativeFunction {
|
||||
JS_OBJECT(SegmenterConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(SegmenterConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SegmenterPrototype);
|
||||
|
||||
// 18.3 Properties of the Intl.Segmenter Prototype Object, https://tc39.es/ecma402/#sec-properties-of-intl-segmenter-prototype-object
|
||||
SegmenterPrototype::SegmenterPrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class SegmenterPrototype final : public PrototypeObject<SegmenterPrototype, Segmenter> {
|
||||
JS_PROTOTYPE_OBJECT(SegmenterPrototype, Segmenter, Segmenter);
|
||||
JS_DECLARE_ALLOCATOR(SegmenterPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Segments);
|
||||
|
||||
// 18.5.1 CreateSegmentsObject ( segmenter, string ), https://tc39.es/ecma402/#sec-createsegmentsobject
|
||||
NonnullGCPtr<Segments> Segments::create(Realm& realm, Segmenter& segmenter, Utf16String string)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace JS::Intl {
|
|||
|
||||
class Segments final : public Object {
|
||||
JS_OBJECT(Segments, Object);
|
||||
JS_DECLARE_ALLOCATOR(Segments);
|
||||
|
||||
public:
|
||||
static NonnullGCPtr<Segments> create(Realm&, Segmenter&, Utf16String);
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SegmentsPrototype);
|
||||
|
||||
// 18.5.2 The %SegmentsPrototype% Object, https://tc39.es/ecma402/#sec-%segmentsprototype%-object
|
||||
SegmentsPrototype::SegmentsPrototype(Realm& realm)
|
||||
: PrototypeObject(realm.intrinsics().object_prototype())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class SegmentsPrototype final : public PrototypeObject<SegmentsPrototype, Segments> {
|
||||
JS_PROTOTYPE_OBJECT(SegmentsPrototype, Segments, Segments);
|
||||
JS_DECLARE_ALLOCATOR(SegmentsPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue