1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:48:11 +00:00

LibJS: Remove Object(Object& prototype) footgun

This constructor was easily confused with a copy constructor, and it was
possible to accidentally copy-construct Objects in at least one way that
we dicovered (via generic ThrowCompletionOr construction).

This patch adds a mandatory ConstructWithPrototypeTag parameter to the
constructor to disambiguate it.
This commit is contained in:
Andreas Kling 2022-12-14 12:17:58 +01:00
parent 42b5c896e8
commit 4abdb68655
90 changed files with 100 additions and 99 deletions

View file

@ -2436,15 +2436,15 @@ namespace Web::Bindings {
// https://webidl.spec.whatwg.org/#es-DOMException-specialness // https://webidl.spec.whatwg.org/#es-DOMException-specialness
// Object.getPrototypeOf(DOMException.prototype) === Error.prototype // Object.getPrototypeOf(DOMException.prototype) === Error.prototype
generator.append(R"~~~( generator.append(R"~~~(
: Object(*realm.intrinsics().error_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().error_prototype())
)~~~"); )~~~");
} else if (!interface.parent_name.is_empty()) { } else if (!interface.parent_name.is_empty()) {
generator.append(R"~~~( generator.append(R"~~~(
: Object(ensure_web_prototype<@prototype_base_class@>(realm, "@parent_name@")) : Object(ConstructWithPrototypeTag::Tag, ensure_web_prototype<@prototype_base_class@>(realm, "@parent_name@"))
)~~~"); )~~~");
} else { } else {
generator.append(R"~~~( generator.append(R"~~~(
: Object(*realm.intrinsics().object_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
)~~~"); )~~~");
} }
@ -2873,7 +2873,7 @@ using namespace Web::WebIDL;
namespace Web::Bindings { namespace Web::Bindings {
@prototype_class@::@prototype_class@(JS::Realm& realm) @prototype_class@::@prototype_class@(JS::Realm& realm)
: Object(*realm.intrinsics().iterator_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().iterator_prototype())
{ {
} }

View file

@ -38,7 +38,7 @@ class WebAssemblyModule final : public JS::Object {
public: public:
explicit WebAssemblyModule(JS::Object& prototype) explicit WebAssemblyModule(JS::Object& prototype)
: JS::Object(prototype) : JS::Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
m_machine.enable_instruction_count_limit(); m_machine.enable_instruction_count_limit();
} }

View file

@ -371,7 +371,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::get_column_bound)
} }
WorkbookObject::WorkbookObject(JS::Realm& realm, Workbook& workbook) WorkbookObject::WorkbookObject(JS::Realm& realm, Workbook& workbook)
: JS::Object(*realm.intrinsics().object_prototype()) : JS::Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
, m_workbook(workbook) , m_workbook(workbook)
{ {
} }

View file

@ -11,7 +11,7 @@
namespace JS { namespace JS {
AggregateErrorPrototype::AggregateErrorPrototype(Realm& realm) AggregateErrorPrototype::AggregateErrorPrototype(Realm& realm)
: Object(*realm.intrinsics().error_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().error_prototype())
{ {
} }

View file

@ -11,7 +11,7 @@
namespace JS { namespace JS {
ArgumentsObject::ArgumentsObject(Realm& realm, Environment& environment) ArgumentsObject::ArgumentsObject(Realm& realm, Environment& environment)
: Object(*realm.intrinsics().object_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
, m_environment(environment) , m_environment(environment)
{ {
} }

View file

@ -61,7 +61,7 @@ NonnullGCPtr<Array> Array::create_from(Realm& realm, Vector<Value> const& elemen
} }
Array::Array(Object& prototype) Array::Array(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }

View file

@ -31,14 +31,14 @@ NonnullGCPtr<ArrayBuffer> ArrayBuffer::create(Realm& realm, ByteBuffer* buffer)
} }
ArrayBuffer::ArrayBuffer(ByteBuffer buffer, Object& prototype) ArrayBuffer::ArrayBuffer(ByteBuffer buffer, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_buffer(move(buffer)) , m_buffer(move(buffer))
, m_detach_key(js_undefined()) , m_detach_key(js_undefined())
{ {
} }
ArrayBuffer::ArrayBuffer(ByteBuffer* buffer, Object& prototype) ArrayBuffer::ArrayBuffer(ByteBuffer* buffer, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_buffer(buffer) , m_buffer(buffer)
, m_detach_key(js_undefined()) , m_detach_key(js_undefined())
{ {

View file

@ -15,7 +15,7 @@ NonnullGCPtr<ArrayIterator> ArrayIterator::create(Realm& realm, Value array, Obj
} }
ArrayIterator::ArrayIterator(Value array, Object::PropertyKind iteration_kind, Object& prototype) ArrayIterator::ArrayIterator(Value array, Object::PropertyKind iteration_kind, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_array(array) , m_array(array)
, m_iteration_kind(iteration_kind) , m_iteration_kind(iteration_kind)
{ {

View file

@ -17,7 +17,7 @@ NonnullGCPtr<AsyncFromSyncIterator> AsyncFromSyncIterator::create(Realm& realm,
} }
AsyncFromSyncIterator::AsyncFromSyncIterator(Realm& realm, Iterator sync_iterator_record) AsyncFromSyncIterator::AsyncFromSyncIterator(Realm& realm, Iterator sync_iterator_record)
: Object(*realm.intrinsics().async_from_sync_iterator_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().async_from_sync_iterator_prototype())
, m_sync_iterator_record(sync_iterator_record) , m_sync_iterator_record(sync_iterator_record)
{ {
} }

View file

@ -10,7 +10,7 @@
namespace JS { namespace JS {
AsyncFunctionPrototype::AsyncFunctionPrototype(Realm& realm) AsyncFunctionPrototype::AsyncFunctionPrototype(Realm& realm)
: Object(*realm.intrinsics().function_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().function_prototype())
{ {
} }

View file

@ -12,7 +12,7 @@
namespace JS { namespace JS {
AsyncGenerator::AsyncGenerator(Object& prototype) AsyncGenerator::AsyncGenerator(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }

View file

@ -9,7 +9,7 @@
namespace JS { namespace JS {
AsyncIteratorPrototype::AsyncIteratorPrototype(Realm& realm) AsyncIteratorPrototype::AsyncIteratorPrototype(Realm& realm)
: Object(*realm.intrinsics().object_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }

View file

@ -125,7 +125,7 @@ static ThrowCompletionOr<Value> perform_atomic_operation(VM& vm, TypedArrayBase&
} }
AtomicsObject::AtomicsObject(Realm& realm) AtomicsObject::AtomicsObject(Realm& realm)
: Object(*realm.intrinsics().object_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }

View file

@ -15,7 +15,7 @@ NonnullGCPtr<BigIntObject> BigIntObject::create(Realm& realm, BigInt& bigint)
} }
BigIntObject::BigIntObject(BigInt& bigint, Object& prototype) BigIntObject::BigIntObject(BigInt& bigint, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_bigint(bigint) , m_bigint(bigint)
{ {
} }

View file

@ -18,7 +18,7 @@
namespace JS { namespace JS {
BigIntPrototype::BigIntPrototype(Realm& realm) BigIntPrototype::BigIntPrototype(Realm& realm)
: Object(*realm.intrinsics().object_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }

View file

@ -15,7 +15,7 @@ NonnullGCPtr<BooleanObject> BooleanObject::create(Realm& realm, bool value)
} }
BooleanObject::BooleanObject(bool value, Object& prototype) BooleanObject::BooleanObject(bool value, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_value(value) , m_value(value)
{ {
} }

View file

@ -13,7 +13,7 @@
namespace JS { namespace JS {
ConsoleObject::ConsoleObject(Realm& realm) ConsoleObject::ConsoleObject(Realm& realm)
: Object(*realm.intrinsics().object_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
, m_console(make<Console>(realm)) , m_console(make<Console>(realm))
{ {
} }

View file

@ -14,7 +14,7 @@ NonnullGCPtr<DataView> DataView::create(Realm& realm, ArrayBuffer* viewed_buffer
} }
DataView::DataView(ArrayBuffer* viewed_buffer, size_t byte_length, size_t byte_offset, Object& prototype) DataView::DataView(ArrayBuffer* viewed_buffer, size_t byte_length, size_t byte_offset, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_viewed_array_buffer(viewed_buffer) , m_viewed_array_buffer(viewed_buffer)
, m_byte_length(byte_length) , m_byte_length(byte_length)
, m_byte_offset(byte_offset) , m_byte_offset(byte_offset)

View file

@ -27,7 +27,7 @@ NonnullGCPtr<Date> Date::create(Realm& realm, double date_value)
} }
Date::Date(double date_value, Object& prototype) Date::Date(double date_value, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_date_value(date_value) , m_date_value(date_value)
{ {
} }

View file

@ -208,7 +208,7 @@ ThrowCompletionOr<Object*> ECMAScriptFunctionObject::internal_construct(MarkedVe
// 3. If kind is base, then // 3. If kind is base, then
if (kind == ConstructorKind::Base) { if (kind == ConstructorKind::Base) {
// a. Let thisArgument be ? OrdinaryCreateFromConstructor(newTarget, "%Object.prototype%"). // a. Let thisArgument be ? OrdinaryCreateFromConstructor(newTarget, "%Object.prototype%").
this_argument = TRY(ordinary_create_from_constructor<Object>(vm, new_target, &Intrinsics::object_prototype)); this_argument = TRY(ordinary_create_from_constructor<Object>(vm, new_target, &Intrinsics::object_prototype, ConstructWithPrototypeTag::Tag));
} }
ExecutionContext callee_context(heap()); ExecutionContext callee_context(heap());

View file

@ -29,7 +29,7 @@ NonnullGCPtr<Error> Error::create(Realm& realm, DeprecatedString const& message)
} }
Error::Error(Object& prototype) Error::Error(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
populate_stack(); populate_stack();
} }

View file

@ -10,7 +10,7 @@
namespace JS { namespace JS {
FinalizationRegistry::FinalizationRegistry(Realm& realm, JobCallback cleanup_callback, Object& prototype) FinalizationRegistry::FinalizationRegistry(Realm& realm, JobCallback cleanup_callback, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, WeakContainer(heap()) , WeakContainer(heap())
, m_realm(realm) , m_realm(realm)
, m_cleanup_callback(move(cleanup_callback)) , m_cleanup_callback(move(cleanup_callback))

View file

@ -19,7 +19,7 @@ FunctionObject::FunctionObject(Realm& realm, Object* prototype)
} }
FunctionObject::FunctionObject(Object& prototype) FunctionObject::FunctionObject(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }

View file

@ -11,7 +11,7 @@
namespace JS { namespace JS {
GeneratorFunctionPrototype::GeneratorFunctionPrototype(Realm& realm) GeneratorFunctionPrototype::GeneratorFunctionPrototype(Realm& realm)
: Object(*realm.intrinsics().function_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().function_prototype())
{ {
} }

View file

@ -36,7 +36,7 @@ ThrowCompletionOr<NonnullGCPtr<GeneratorObject>> GeneratorObject::create(Realm&
} }
GeneratorObject::GeneratorObject(Realm&, Object& prototype, ExecutionContext context) GeneratorObject::GeneratorObject(Realm&, Object& prototype, ExecutionContext context)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_execution_context(move(context)) , m_execution_context(move(context))
{ {
} }

View file

@ -10,7 +10,7 @@ namespace JS::Intl {
// 10 Collator Objects, https://tc39.es/ecma402/#collator-objects // 10 Collator Objects, https://tc39.es/ecma402/#collator-objects
Collator::Collator(Object& prototype) Collator::Collator(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }

View file

@ -26,7 +26,7 @@ static Crypto::SignedBigInteger const s_one_million_bigint { 1'000'000 };
// 11 DateTimeFormat Objects, https://tc39.es/ecma402/#datetimeformat-objects // 11 DateTimeFormat Objects, https://tc39.es/ecma402/#datetimeformat-objects
DateTimeFormat::DateTimeFormat(Object& prototype) DateTimeFormat::DateTimeFormat(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }

View file

@ -12,7 +12,7 @@ namespace JS::Intl {
// 12 DisplayNames Objects, https://tc39.es/ecma402/#intl-displaynames-objects // 12 DisplayNames Objects, https://tc39.es/ecma402/#intl-displaynames-objects
DisplayNames::DisplayNames(Object& prototype) DisplayNames::DisplayNames(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }

View file

@ -20,7 +20,7 @@ namespace JS::Intl {
// 1 DurationFormat Objects, https://tc39.es/proposal-intl-duration-format/#durationformat-objects // 1 DurationFormat Objects, https://tc39.es/proposal-intl-duration-format/#durationformat-objects
DurationFormat::DurationFormat(Object& prototype) DurationFormat::DurationFormat(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }

View file

@ -28,7 +28,7 @@ namespace JS::Intl {
// 8 The Intl Object, https://tc39.es/ecma402/#intl-object // 8 The Intl Object, https://tc39.es/ecma402/#intl-object
Intl::Intl(Realm& realm) Intl::Intl(Realm& realm)
: Object(*realm.intrinsics().object_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }

View file

@ -14,7 +14,7 @@ namespace JS::Intl {
// 13 ListFormat Objects, https://tc39.es/ecma402/#listformat-objects // 13 ListFormat Objects, https://tc39.es/ecma402/#listformat-objects
ListFormat::ListFormat(Object& prototype) ListFormat::ListFormat(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }

View file

@ -21,12 +21,12 @@ NonnullGCPtr<Locale> Locale::create(Realm& realm, ::Locale::LocaleID const& loca
// 14 Locale Objects, https://tc39.es/ecma402/#locale-objects // 14 Locale Objects, https://tc39.es/ecma402/#locale-objects
Locale::Locale(Object& prototype) Locale::Locale(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }
Locale::Locale(::Locale::LocaleID const& locale_id, Object& prototype) Locale::Locale(::Locale::LocaleID const& locale_id, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
set_locale(locale_id.to_deprecated_string()); set_locale(locale_id.to_deprecated_string());

View file

@ -21,7 +21,7 @@
namespace JS::Intl { namespace JS::Intl {
NumberFormatBase::NumberFormatBase(Object& prototype) NumberFormatBase::NumberFormatBase(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }

View file

@ -17,7 +17,7 @@ namespace JS::Intl {
// 17 RelativeTimeFormat Objects, https://tc39.es/ecma402/#relativetimeformat-objects // 17 RelativeTimeFormat Objects, https://tc39.es/ecma402/#relativetimeformat-objects
RelativeTimeFormat::RelativeTimeFormat(Object& prototype) RelativeTimeFormat::RelativeTimeFormat(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }

View file

@ -24,7 +24,7 @@ NonnullGCPtr<SegmentIterator> SegmentIterator::create(Realm& realm, Segmenter& s
// 18.6 Segment Iterator Objects, https://tc39.es/ecma402/#sec-segment-iterator-objects // 18.6 Segment Iterator Objects, https://tc39.es/ecma402/#sec-segment-iterator-objects
SegmentIterator::SegmentIterator(Realm& realm, Segmenter& segmenter, Utf16View const& string, Segments const& segments) SegmentIterator::SegmentIterator(Realm& realm, Segmenter& segmenter, Utf16View const& string, Segments const& segments)
: Object(*realm.intrinsics().intl_segment_iterator_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().intl_segment_iterator_prototype())
, m_iterating_segmenter(segmenter) , m_iterating_segmenter(segmenter)
, m_iterated_string(string) , m_iterated_string(string)
, m_segments(segments) , m_segments(segments)

View file

@ -14,7 +14,7 @@ namespace JS::Intl {
// 18 Segmenter Objects, https://tc39.es/ecma402/#segmenter-objects // 18 Segmenter Objects, https://tc39.es/ecma402/#segmenter-objects
Segmenter::Segmenter(Object& prototype) Segmenter::Segmenter(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }

View file

@ -23,7 +23,7 @@ NonnullGCPtr<Segments> Segments::create(Realm& realm, Segmenter& segmenter, Utf1
// 18.5 Segments Objects, https://tc39.es/ecma402/#sec-segments-objects // 18.5 Segments Objects, https://tc39.es/ecma402/#sec-segments-objects
Segments::Segments(Realm& realm, Segmenter& segmenter, Utf16String string) Segments::Segments(Realm& realm, Segmenter& segmenter, Utf16String string)
: Object(*realm.intrinsics().intl_segments_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().intl_segments_prototype())
, m_segments_segmenter(segmenter) , m_segments_segmenter(segmenter)
, m_segments_string(move(string)) , m_segments_string(move(string))
{ {

View file

@ -12,7 +12,7 @@ namespace JS {
// 27.1.2 The %IteratorPrototype% Object, https://tc39.es/ecma262/#sec-%iteratorprototype%-object // 27.1.2 The %IteratorPrototype% Object, https://tc39.es/ecma262/#sec-%iteratorprototype%-object
IteratorPrototype::IteratorPrototype(Realm& realm) IteratorPrototype::IteratorPrototype(Realm& realm)
: Object(*realm.intrinsics().object_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }

View file

@ -27,7 +27,7 @@
namespace JS { namespace JS {
JSONObject::JSONObject(Realm& realm) JSONObject::JSONObject(Realm& realm)
: Object(*realm.intrinsics().object_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }

View file

@ -14,7 +14,7 @@ NonnullGCPtr<Map> Map::create(Realm& realm)
} }
Map::Map(Object& prototype) Map::Map(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }

View file

@ -15,7 +15,7 @@ NonnullGCPtr<MapIterator> MapIterator::create(Realm& realm, Map& map, Object::Pr
} }
MapIterator::MapIterator(Map& map, Object::PropertyKind iteration_kind, Object& prototype) MapIterator::MapIterator(Map& map, Object::PropertyKind iteration_kind, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_map(map) , m_map(map)
, m_iteration_kind(iteration_kind) , m_iteration_kind(iteration_kind)
, m_iterator(static_cast<Map const&>(map).begin()) , m_iterator(static_cast<Map const&>(map).begin())

View file

@ -16,7 +16,7 @@
namespace JS { namespace JS {
MathObject::MathObject(Realm& realm) MathObject::MathObject(Realm& realm)
: Object(*realm.intrinsics().object_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }

View file

@ -11,7 +11,7 @@
namespace JS { namespace JS {
ModuleNamespaceObject::ModuleNamespaceObject(Realm& realm, Module* module, Vector<FlyString> exports) ModuleNamespaceObject::ModuleNamespaceObject(Realm& realm, Module* module, Vector<FlyString> exports)
: Object(*realm.intrinsics().object_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
, m_module(module) , m_module(module)
, m_exports(move(exports)) , m_exports(move(exports))
{ {

View file

@ -15,7 +15,7 @@ NonnullGCPtr<NumberObject> NumberObject::create(Realm& realm, double value)
} }
NumberObject::NumberObject(double value, Object& prototype) NumberObject::NumberObject(double value, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_value(value) , m_value(value)
{ {
} }

View file

@ -34,7 +34,7 @@ NonnullGCPtr<Object> Object::create(Realm& realm, Object* prototype)
else if (prototype == realm.intrinsics().object_prototype()) else if (prototype == realm.intrinsics().object_prototype())
return *realm.heap().allocate<Object>(realm, *realm.intrinsics().new_object_shape()); return *realm.heap().allocate<Object>(realm, *realm.intrinsics().new_object_shape());
else else
return *realm.heap().allocate<Object>(realm, *prototype); return *realm.heap().allocate<Object>(realm, ConstructWithPrototypeTag::Tag, *prototype);
} }
Object::Object(GlobalObjectTag, Realm& realm) Object::Object(GlobalObjectTag, Realm& realm)
@ -56,7 +56,7 @@ Object::Object(Realm& realm, Object* prototype)
set_prototype(prototype); set_prototype(prototype);
} }
Object::Object(Object& prototype) Object::Object(ConstructWithPrototypeTag, Object& prototype)
{ {
m_shape = prototype.shape().realm().intrinsics().empty_object_shape(); m_shape = prototype.shape().realm().intrinsics().empty_object_shape();
VERIFY(m_shape); VERIFY(m_shape);

View file

@ -191,11 +191,12 @@ public:
protected: protected:
enum class GlobalObjectTag { Tag }; enum class GlobalObjectTag { Tag };
enum class ConstructWithoutPrototypeTag { Tag }; enum class ConstructWithoutPrototypeTag { Tag };
enum class ConstructWithPrototypeTag { Tag };
Object(GlobalObjectTag, Realm&); Object(GlobalObjectTag, Realm&);
Object(ConstructWithoutPrototypeTag, Realm&); Object(ConstructWithoutPrototypeTag, Realm&);
Object(Realm&, Object* prototype); Object(Realm&, Object* prototype);
explicit Object(Object& prototype); Object(ConstructWithPrototypeTag, Object& prototype);
explicit Object(Shape&); explicit Object(Shape&);
void set_prototype(Object*); void set_prototype(Object*);

View file

@ -70,7 +70,7 @@ ThrowCompletionOr<Object*> ObjectConstructor::construct(FunctionObject& new_targ
auto& realm = *vm.current_realm(); auto& realm = *vm.current_realm();
if (&new_target != this) if (&new_target != this)
return TRY(ordinary_create_from_constructor<Object>(vm, new_target, &Intrinsics::object_prototype)); return TRY(ordinary_create_from_constructor<Object>(vm, new_target, &Intrinsics::object_prototype, ConstructWithPrototypeTag::Tag));
auto value = vm.argument(0); auto value = vm.argument(0);
if (value.is_nullish()) if (value.is_nullish())
return Object::create(realm, realm.intrinsics().object_prototype()).ptr(); return Object::create(realm, realm.intrinsics().object_prototype()).ptr();

View file

@ -49,7 +49,7 @@ NonnullGCPtr<Promise> Promise::create(Realm& realm)
// 27.2 Promise Objects, https://tc39.es/ecma262/#sec-promise-objects // 27.2 Promise Objects, https://tc39.es/ecma262/#sec-promise-objects
Promise::Promise(Object& prototype) Promise::Promise(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }

View file

@ -57,7 +57,7 @@ public:
protected: protected:
explicit PrototypeObject(Object& prototype) explicit PrototypeObject(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }
}; };

View file

@ -16,7 +16,7 @@
namespace JS { namespace JS {
ReflectObject::ReflectObject(Realm& realm) ReflectObject::ReflectObject(Realm& realm)
: Object(*realm.intrinsics().object_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }

View file

@ -135,12 +135,12 @@ NonnullGCPtr<RegExpObject> RegExpObject::create(Realm& realm, Regex<ECMA262> reg
} }
RegExpObject::RegExpObject(Object& prototype) RegExpObject::RegExpObject(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }
RegExpObject::RegExpObject(Regex<ECMA262> regex, DeprecatedString pattern, DeprecatedString flags, Object& prototype) RegExpObject::RegExpObject(Regex<ECMA262> regex, DeprecatedString pattern, DeprecatedString flags, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_pattern(move(pattern)) , m_pattern(move(pattern))
, m_flags(move(flags)) , m_flags(move(flags))
, m_regex(move(regex)) , m_regex(move(regex))

View file

@ -16,7 +16,7 @@ NonnullGCPtr<RegExpStringIterator> RegExpStringIterator::create(Realm& realm, Ob
} }
RegExpStringIterator::RegExpStringIterator(Object& prototype, Object& regexp_object, Utf16String string, bool global, bool unicode) RegExpStringIterator::RegExpStringIterator(Object& prototype, Object& regexp_object, Utf16String string, bool global, bool unicode)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_regexp_object(regexp_object) , m_regexp_object(regexp_object)
, m_string(move(string)) , m_string(move(string))
, m_global(global) , m_global(global)

View file

@ -14,7 +14,7 @@ NonnullGCPtr<Set> Set::create(Realm& realm)
} }
Set::Set(Object& prototype) Set::Set(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }

View file

@ -15,7 +15,7 @@ NonnullGCPtr<SetIterator> SetIterator::create(Realm& realm, Set& set, Object::Pr
} }
SetIterator::SetIterator(Set& set, Object::PropertyKind iteration_kind, Object& prototype) SetIterator::SetIterator(Set& set, Object::PropertyKind iteration_kind, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_set(set) , m_set(set)
, m_iteration_kind(iteration_kind) , m_iteration_kind(iteration_kind)
, m_iterator(static_cast<Set const&>(set).begin()) , m_iterator(static_cast<Set const&>(set).begin())

View file

@ -20,7 +20,7 @@
namespace JS { namespace JS {
ShadowRealm::ShadowRealm(Realm& shadow_realm, ExecutionContext execution_context, Object& prototype) ShadowRealm::ShadowRealm(Realm& shadow_realm, ExecutionContext execution_context, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_shadow_realm(shadow_realm) , m_shadow_realm(shadow_realm)
, m_execution_context(move(execution_context)) , m_execution_context(move(execution_context))
{ {

View file

@ -16,7 +16,7 @@ NonnullGCPtr<StringIterator> StringIterator::create(Realm& realm, DeprecatedStri
} }
StringIterator::StringIterator(DeprecatedString string, Object& prototype) StringIterator::StringIterator(DeprecatedString string, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_string(move(string)) , m_string(move(string))
, m_iterator(Utf8View(m_string).begin()) , m_iterator(Utf8View(m_string).begin())
{ {

View file

@ -21,7 +21,7 @@ NonnullGCPtr<StringObject> StringObject::create(Realm& realm, PrimitiveString& p
} }
StringObject::StringObject(PrimitiveString& string, Object& prototype) StringObject::StringObject(PrimitiveString& string, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_string(string) , m_string(string)
{ {
} }

View file

@ -16,7 +16,7 @@ NonnullGCPtr<SymbolObject> SymbolObject::create(Realm& realm, Symbol& primitive_
} }
SymbolObject::SymbolObject(Symbol& symbol, Object& prototype) SymbolObject::SymbolObject(Symbol& symbol, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_symbol(symbol) , m_symbol(symbol)
{ {
} }

View file

@ -19,7 +19,7 @@
namespace JS { namespace JS {
SymbolPrototype::SymbolPrototype(Realm& realm) SymbolPrototype::SymbolPrototype(Realm& realm)
: Object(*realm.intrinsics().object_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }

View file

@ -28,7 +28,7 @@ namespace JS::Temporal {
// 12 Temporal.Calendar Objects, https://tc39.es/proposal-temporal/#sec-temporal-calendar-objects // 12 Temporal.Calendar Objects, https://tc39.es/proposal-temporal/#sec-temporal-calendar-objects
Calendar::Calendar(DeprecatedString identifier, Object& prototype) Calendar::Calendar(DeprecatedString identifier, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_identifier(move(identifier)) , m_identifier(move(identifier))
{ {
} }

View file

@ -24,7 +24,7 @@ namespace JS::Temporal {
// 7 Temporal.Duration Objects, https://tc39.es/proposal-temporal/#sec-temporal-duration-objects // 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) 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(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_years(years) , m_years(years)
, m_months(months) , m_months(months)
, m_weeks(weeks) , m_weeks(weeks)

View file

@ -24,7 +24,7 @@ namespace JS::Temporal {
// 8 Temporal.Instant Objects, https://tc39.es/proposal-temporal/#sec-temporal-instant-objects // 8 Temporal.Instant Objects, https://tc39.es/proposal-temporal/#sec-temporal-instant-objects
Instant::Instant(BigInt const& nanoseconds, Object& prototype) Instant::Instant(BigInt const& nanoseconds, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_nanoseconds(nanoseconds) , m_nanoseconds(nanoseconds)
{ {
} }

View file

@ -22,7 +22,7 @@ namespace JS::Temporal {
// 2 The Temporal.Now Object, https://tc39.es/proposal-temporal/#sec-temporal-now-object // 2 The Temporal.Now Object, https://tc39.es/proposal-temporal/#sec-temporal-now-object
Now::Now(Realm& realm) Now::Now(Realm& realm)
: Object(*realm.intrinsics().object_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }

View file

@ -24,7 +24,7 @@ namespace JS::Temporal {
// 3 Temporal.PlainDate Objects, https://tc39.es/proposal-temporal/#sec-temporal-plaindate-objects // 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) PlainDate::PlainDate(i32 year, u8 month, u8 day, Object& calendar, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_iso_year(year) , m_iso_year(year)
, m_iso_month(month) , m_iso_month(month)
, m_iso_day(day) , m_iso_day(day)

View file

@ -25,7 +25,7 @@ namespace JS::Temporal {
// 5 Temporal.PlainDateTime Objects, https://tc39.es/proposal-temporal/#sec-temporal-plaindatetime-objects // 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) 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(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_iso_year(iso_year) , m_iso_year(iso_year)
, m_iso_month(iso_month) , m_iso_month(iso_month)
, m_iso_day(iso_day) , m_iso_day(iso_day)

View file

@ -20,7 +20,7 @@ namespace JS::Temporal {
// 10 Temporal.PlainMonthDay Objects, https://tc39.es/proposal-temporal/#sec-temporal-plainmonthday-objects // 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) PlainMonthDay::PlainMonthDay(u8 iso_month, u8 iso_day, i32 iso_year, Object& calendar, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_iso_year(iso_year) , m_iso_year(iso_year)
, m_iso_month(iso_month) , m_iso_month(iso_month)
, m_iso_day(iso_day) , m_iso_day(iso_day)

View file

@ -24,7 +24,7 @@ namespace JS::Temporal {
// 4 Temporal.PlainTime Objects, https://tc39.es/proposal-temporal/#sec-temporal-plaintime-objects // 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) 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(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_iso_hour(iso_hour) , m_iso_hour(iso_hour)
, m_iso_minute(iso_minute) , m_iso_minute(iso_minute)
, m_iso_second(iso_second) , m_iso_second(iso_second)

View file

@ -19,7 +19,7 @@ namespace JS::Temporal {
// 9 Temporal.PlainYearMonth Objects, https://tc39.es/proposal-temporal/#sec-temporal-plainyearmonth-objects // 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) PlainYearMonth::PlainYearMonth(i32 iso_year, u8 iso_month, u8 iso_day, Object& calendar, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_iso_year(iso_year) , m_iso_year(iso_year)
, m_iso_month(iso_month) , m_iso_month(iso_month)
, m_iso_day(iso_day) , m_iso_day(iso_day)

View file

@ -22,7 +22,7 @@ namespace JS::Temporal {
// 1 The Temporal Object, https://tc39.es/proposal-temporal/#sec-temporal-objects // 1 The Temporal Object, https://tc39.es/proposal-temporal/#sec-temporal-objects
Temporal::Temporal(Realm& realm) Temporal::Temporal(Realm& realm)
: Object(*realm.intrinsics().object_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }

View file

@ -25,7 +25,7 @@ namespace JS::Temporal {
// 11 Temporal.TimeZone Objects, https://tc39.es/proposal-temporal/#sec-temporal-timezone-objects // 11 Temporal.TimeZone Objects, https://tc39.es/proposal-temporal/#sec-temporal-timezone-objects
TimeZone::TimeZone(Object& prototype) TimeZone::TimeZone(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }

View file

@ -22,7 +22,7 @@ namespace JS::Temporal {
// 6 Temporal.ZonedDateTime Objects, https://tc39.es/proposal-temporal/#sec-temporal-zoneddatetime-objects // 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) ZonedDateTime::ZonedDateTime(BigInt const& nanoseconds, Object& time_zone, Object& calendar, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_nanoseconds(nanoseconds) , m_nanoseconds(nanoseconds)
, m_time_zone(time_zone) , m_time_zone(time_zone)
, m_calendar(calendar) , m_calendar(calendar)

View file

@ -459,7 +459,7 @@ void TypedArrayBase::visit_edges(Visitor& visitor)
} \ } \
\ \
PrototypeName::PrototypeName(Object& prototype) \ PrototypeName::PrototypeName(Object& prototype) \
: Object(prototype) \ : Object(ConstructWithPrototypeTag::Tag, prototype) \
{ \ { \
} \ } \
\ \

View file

@ -62,7 +62,7 @@ public:
protected: protected:
TypedArrayBase(Object& prototype, IntrinsicConstructor intrinsic_constructor) TypedArrayBase(Object& prototype, IntrinsicConstructor intrinsic_constructor)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, m_intrinsic_constructor(intrinsic_constructor) , m_intrinsic_constructor(intrinsic_constructor)
{ {
} }

View file

@ -17,7 +17,7 @@
namespace JS { namespace JS {
TypedArrayPrototype::TypedArrayPrototype(Realm& realm) TypedArrayPrototype::TypedArrayPrototype(Realm& realm)
: Object(*realm.intrinsics().object_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }

View file

@ -14,7 +14,7 @@ NonnullGCPtr<WeakMap> WeakMap::create(Realm& realm)
} }
WeakMap::WeakMap(Object& prototype) WeakMap::WeakMap(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, WeakContainer(heap()) , WeakContainer(heap())
{ {
} }

View file

@ -19,7 +19,7 @@ NonnullGCPtr<WeakRef> WeakRef::create(Realm& realm, Symbol& value)
} }
WeakRef::WeakRef(Object& value, Object& prototype) WeakRef::WeakRef(Object& value, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, WeakContainer(heap()) , WeakContainer(heap())
, m_value(&value) , m_value(&value)
, m_last_execution_generation(vm().execution_generation()) , m_last_execution_generation(vm().execution_generation())
@ -27,7 +27,7 @@ WeakRef::WeakRef(Object& value, Object& prototype)
} }
WeakRef::WeakRef(Symbol& value, Object& prototype) WeakRef::WeakRef(Symbol& value, Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, WeakContainer(heap()) , WeakContainer(heap())
, m_value(&value) , m_value(&value)
, m_last_execution_generation(vm().execution_generation()) , m_last_execution_generation(vm().execution_generation())

View file

@ -14,7 +14,7 @@ NonnullGCPtr<WeakSet> WeakSet::create(Realm& realm)
} }
WeakSet::WeakSet(Object& prototype) WeakSet::WeakSet(Object& prototype)
: Object(prototype) : Object(ConstructWithPrototypeTag::Tag, prototype)
, WeakContainer(heap()) , WeakContainer(heap())
{ {
} }

View file

@ -14,7 +14,7 @@
namespace Web::Bindings { namespace Web::Bindings {
CSSNamespace::CSSNamespace(JS::Realm& realm) CSSNamespace::CSSNamespace(JS::Realm& realm)
: JS::Object(*realm.intrinsics().object_prototype()) : JS::Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }

View file

@ -19,7 +19,7 @@ class LocationPrototype final : public JS::Object {
public: public:
explicit LocationPrototype(JS::Realm& realm) explicit LocationPrototype(JS::Realm& realm)
: JS::Object(*realm.intrinsics().object_prototype()) : JS::Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }
}; };

View file

@ -17,7 +17,7 @@ PlatformObject::PlatformObject(JS::Realm& realm)
} }
PlatformObject::PlatformObject(JS::Object& prototype) PlatformObject::PlatformObject(JS::Object& prototype)
: JS::Object(prototype) : JS::Object(ConstructWithPrototypeTag::Tag, prototype)
{ {
} }

View file

@ -17,7 +17,7 @@ class WindowPrototype final : public JS::Object {
public: public:
explicit WindowPrototype(JS::Realm& realm) explicit WindowPrototype(JS::Realm& realm)
: JS::Object(cached_web_prototype(realm, "EventTarget")) : JS::Object(ConstructWithPrototypeTag::Tag, cached_web_prototype(realm, "EventTarget"))
{ {
} }
}; };

View file

@ -14,7 +14,7 @@ JS::NonnullGCPtr<IDLEventListener> IDLEventListener::create(JS::Realm& realm, JS
} }
IDLEventListener::IDLEventListener(JS::Realm& realm, JS::NonnullGCPtr<WebIDL::CallbackType> callback) IDLEventListener::IDLEventListener(JS::Realm& realm, JS::NonnullGCPtr<WebIDL::CallbackType> callback)
: JS::Object(*realm.intrinsics().object_prototype()) : JS::Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
, m_callback(move(callback)) , m_callback(move(callback))
{ {
} }

View file

@ -19,7 +19,7 @@
namespace Web::Bindings { namespace Web::Bindings {
WebAssemblyInstanceObject::WebAssemblyInstanceObject(JS::Realm& realm, size_t index) WebAssemblyInstanceObject::WebAssemblyInstanceObject(JS::Realm& realm, size_t index)
: Object(Bindings::ensure_web_prototype<WebAssemblyInstancePrototype>(realm, "WebAssemblyInstancePrototype")) : Object(ConstructWithPrototypeTag::Tag, Bindings::ensure_web_prototype<WebAssemblyInstancePrototype>(realm, "WebAssemblyInstancePrototype"))
, m_index(index) , m_index(index)
{ {
} }

View file

@ -18,7 +18,7 @@ class WebAssemblyInstancePrototype final : public JS::Object {
public: public:
explicit WebAssemblyInstancePrototype(JS::Realm& realm) explicit WebAssemblyInstancePrototype(JS::Realm& realm)
: JS::Object(*realm.intrinsics().object_prototype()) : JS::Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }

View file

@ -18,7 +18,7 @@ class WebAssemblyMemoryPrototype final : public JS::Object {
public: public:
explicit WebAssemblyMemoryPrototype(JS::Realm& realm) explicit WebAssemblyMemoryPrototype(JS::Realm& realm)
: JS::Object(*realm.intrinsics().object_prototype()) : JS::Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }

View file

@ -11,7 +11,7 @@
namespace Web::Bindings { namespace Web::Bindings {
WebAssemblyModuleObject::WebAssemblyModuleObject(JS::Realm& realm, size_t index) WebAssemblyModuleObject::WebAssemblyModuleObject(JS::Realm& realm, size_t index)
: Object(Bindings::ensure_web_prototype<WebAssemblyModulePrototype>(realm, "WebAssemblyModulePrototype")) : Object(ConstructWithPrototypeTag::Tag, Bindings::ensure_web_prototype<WebAssemblyModulePrototype>(realm, "WebAssemblyModulePrototype"))
, m_index(index) , m_index(index)
{ {
} }

View file

@ -18,7 +18,7 @@ class WebAssemblyModulePrototype final : public JS::Object {
public: public:
explicit WebAssemblyModulePrototype(JS::Realm& realm) explicit WebAssemblyModulePrototype(JS::Realm& realm)
: JS::Object(*realm.intrinsics().object_prototype()) : JS::Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }
}; };

View file

@ -26,7 +26,7 @@
namespace Web::Bindings { namespace Web::Bindings {
WebAssemblyObject::WebAssemblyObject(JS::Realm& realm) WebAssemblyObject::WebAssemblyObject(JS::Realm& realm)
: Object(*realm.intrinsics().object_prototype()) : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
s_abstract_machine.enable_instruction_count_limit(); s_abstract_machine.enable_instruction_count_limit();
} }
@ -483,7 +483,7 @@ JS::NativeFunction* create_native_function(JS::VM& vm, Wasm::FunctionAddress add
} }
WebAssemblyMemoryObject::WebAssemblyMemoryObject(JS::Realm& realm, Wasm::MemoryAddress address) WebAssemblyMemoryObject::WebAssemblyMemoryObject(JS::Realm& realm, Wasm::MemoryAddress address)
: Object(Bindings::ensure_web_prototype<WebAssemblyMemoryPrototype>(realm, "WebAssemblyMemoryPrototype")) : Object(ConstructWithPrototypeTag::Tag, Bindings::ensure_web_prototype<WebAssemblyMemoryPrototype>(realm, "WebAssemblyMemoryPrototype"))
, m_address(address) , m_address(address)
{ {
} }

View file

@ -11,7 +11,7 @@
namespace Web::Bindings { namespace Web::Bindings {
WebAssemblyTableObject::WebAssemblyTableObject(JS::Realm& realm, Wasm::TableAddress address) WebAssemblyTableObject::WebAssemblyTableObject(JS::Realm& realm, Wasm::TableAddress address)
: Object(Bindings::ensure_web_prototype<WebAssemblyTablePrototype>(realm, "WebAssemblyTablePrototype")) : Object(ConstructWithPrototypeTag::Tag, Bindings::ensure_web_prototype<WebAssemblyTablePrototype>(realm, "WebAssemblyTablePrototype"))
, m_address(address) , m_address(address)
{ {
} }

View file

@ -18,7 +18,7 @@ class WebAssemblyTablePrototype final : public JS::Object {
public: public:
explicit WebAssemblyTablePrototype(JS::Realm& realm) explicit WebAssemblyTablePrototype(JS::Realm& realm)
: JS::Object(*realm.intrinsics().object_prototype()) : JS::Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype())
{ {
} }