mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
LibJS+LibWeb: Replace GlobalObject with Realm in initialize() functions
This is a continuation of the previous commit. Calling initialize() is the first thing that's done after allocating a cell on the JS heap - and in the common case of allocating an object, that's where properties are assigned and intrinsics occasionally accessed. Since those are supposed to live on the realm eventually, this is another step into that direction.
This commit is contained in:
parent
ecd163bdf1
commit
5dd5896588
Notes:
sideshowbarker
2024-07-17 08:01:21 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/5dd5896588 Pull-request: https://github.com/SerenityOS/serenity/pull/14973 Reviewed-by: https://github.com/davidot ✅
304 changed files with 608 additions and 603 deletions
|
@ -1838,7 +1838,7 @@ public:
|
|||
static @wrapper_class@* create(JS::GlobalObject&, @fully_qualified_name@&);
|
||||
|
||||
@wrapper_class@(JS::Realm&, @fully_qualified_name@&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~@wrapper_class@() override;
|
||||
)~~~");
|
||||
|
||||
|
@ -2029,11 +2029,11 @@ namespace Web::Bindings {
|
|||
}
|
||||
|
||||
generator.append(R"~~~(
|
||||
void @wrapper_class@::initialize(JS::GlobalObject& global_object)
|
||||
void @wrapper_class@::initialize(JS::Realm& realm)
|
||||
{
|
||||
@wrapper_base_class@::initialize(global_object);
|
||||
@wrapper_base_class@::initialize(realm);
|
||||
|
||||
auto& vm = global_object.vm();
|
||||
auto& vm = this->vm();
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), JS::js_string(vm, "@name@"), JS::Attribute::Configurable);
|
||||
}
|
||||
|
||||
|
@ -2800,7 +2800,7 @@ class @constructor_class@ : public JS::NativeFunction {
|
|||
JS_OBJECT(@constructor_class@, JS::NativeFunction);
|
||||
public:
|
||||
explicit @constructor_class@(JS::Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~@constructor_class@() override;
|
||||
|
||||
virtual JS::ThrowCompletionOr<JS::Value> call() override;
|
||||
|
@ -2991,13 +2991,13 @@ JS::ThrowCompletionOr<JS::Object*> @constructor_class@::construct(FunctionObject
|
|||
generator.append(R"~~~(
|
||||
}
|
||||
|
||||
void @constructor_class@::initialize(JS::GlobalObject& global_object)
|
||||
void @constructor_class@::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
auto& window = static_cast<WindowObject&>(realm.global_object());
|
||||
[[maybe_unused]] u8 default_attributes = JS::Attribute::Enumerable;
|
||||
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
define_direct_property(vm.names.prototype, &window.ensure_web_prototype<@prototype_class@>("@name@"), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(@constructor.length@), JS::Attribute::Configurable);
|
||||
|
||||
|
@ -3067,7 +3067,7 @@ class @prototype_class@ : public JS::Object {
|
|||
JS_OBJECT(@prototype_class@, JS::Object);
|
||||
public:
|
||||
explicit @prototype_class@(JS::Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~@prototype_class@() override;
|
||||
private:
|
||||
)~~~");
|
||||
|
@ -3238,7 +3238,7 @@ namespace Web::Bindings {
|
|||
{
|
||||
}
|
||||
|
||||
void @prototype_class@::initialize(JS::GlobalObject& global_object)
|
||||
void @prototype_class@::initialize(JS::Realm& realm)
|
||||
{
|
||||
[[maybe_unused]] auto& vm = this->vm();
|
||||
[[maybe_unused]] u8 default_attributes = JS::Attribute::Enumerable | JS::Attribute::Configurable | JS::Attribute::Writable;
|
||||
|
@ -3247,7 +3247,7 @@ void @prototype_class@::initialize(JS::GlobalObject& global_object)
|
|||
|
||||
if (interface.has_unscopable_member) {
|
||||
generator.append(R"~~~(
|
||||
auto* unscopable_object = JS::Object::create(global_object, nullptr);
|
||||
auto* unscopable_object = JS::Object::create(realm.global_object(), nullptr);
|
||||
)~~~");
|
||||
}
|
||||
|
||||
|
@ -3320,15 +3320,15 @@ void @prototype_class@::initialize(JS::GlobalObject& global_object)
|
|||
if (interface.indexed_property_getter.has_value()) {
|
||||
auto iterator_generator = generator.fork();
|
||||
iterator_generator.append(R"~~~(
|
||||
define_direct_property(*vm.well_known_symbol_iterator(), global_object.array_prototype()->get_without_side_effects(vm.names.values), JS::Attribute::Configurable | JS::Attribute::Writable);
|
||||
define_direct_property(*vm.well_known_symbol_iterator(), realm.global_object().array_prototype()->get_without_side_effects(vm.names.values), JS::Attribute::Configurable | JS::Attribute::Writable);
|
||||
)~~~");
|
||||
|
||||
if (interface.value_iterator_type.has_value()) {
|
||||
iterator_generator.append(R"~~~(
|
||||
define_direct_property(vm.names.entries, global_object.array_prototype()->get_without_side_effects(vm.names.entries), default_attributes);
|
||||
define_direct_property(vm.names.keys, global_object.array_prototype()->get_without_side_effects(vm.names.keys), default_attributes);
|
||||
define_direct_property(vm.names.values, global_object.array_prototype()->get_without_side_effects(vm.names.values), default_attributes);
|
||||
define_direct_property(vm.names.forEach, global_object.array_prototype()->get_without_side_effects(vm.names.forEach), default_attributes);
|
||||
define_direct_property(vm.names.entries, realm.global_object().array_prototype()->get_without_side_effects(vm.names.entries), default_attributes);
|
||||
define_direct_property(vm.names.keys, realm.global_object().array_prototype()->get_without_side_effects(vm.names.keys), default_attributes);
|
||||
define_direct_property(vm.names.values, realm.global_object().array_prototype()->get_without_side_effects(vm.names.values), default_attributes);
|
||||
define_direct_property(vm.names.forEach, realm.global_object().array_prototype()->get_without_side_effects(vm.names.forEach), default_attributes);
|
||||
)~~~");
|
||||
}
|
||||
}
|
||||
|
@ -3354,7 +3354,7 @@ void @prototype_class@::initialize(JS::GlobalObject& global_object)
|
|||
}
|
||||
|
||||
generator.append(R"~~~(
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
}
|
||||
)~~~");
|
||||
|
||||
|
@ -3589,7 +3589,7 @@ public:
|
|||
static @wrapper_class@* create(JS::GlobalObject&, @fully_qualified_name@&);
|
||||
|
||||
@wrapper_class@(JS::Realm&, @fully_qualified_name@&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~@wrapper_class@() override;
|
||||
|
||||
@fully_qualified_name@& impl() { return *m_impl; }
|
||||
|
@ -3670,9 +3670,9 @@ namespace Web::Bindings {
|
|||
{
|
||||
}
|
||||
|
||||
void @wrapper_class@::initialize(JS::GlobalObject& global_object)
|
||||
void @wrapper_class@::initialize(JS::Realm& realm)
|
||||
{
|
||||
Wrapper::initialize(global_object);
|
||||
Wrapper::initialize(realm);
|
||||
}
|
||||
|
||||
@wrapper_class@::~@wrapper_class@()
|
||||
|
@ -3715,7 +3715,7 @@ class @prototype_class@ : public JS::Object {
|
|||
JS_OBJECT(@prototype_class@, JS::Object);
|
||||
public:
|
||||
explicit @prototype_class@(JS::Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~@prototype_class@() override;
|
||||
|
||||
private:
|
||||
|
@ -3787,10 +3787,10 @@ namespace Web::Bindings {
|
|||
{
|
||||
}
|
||||
|
||||
void @prototype_class@::initialize(JS::GlobalObject& global_object)
|
||||
void @prototype_class@::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
|
||||
define_native_function(vm.names.next, next, 0, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Iterator"), JS::Attribute::Configurable);
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
instance->m_module_instance = result.release_value();
|
||||
return instance;
|
||||
}
|
||||
void initialize(JS::GlobalObject&) override;
|
||||
void initialize(JS::Realm&) override;
|
||||
|
||||
~WebAssemblyModule() override = default;
|
||||
|
||||
|
@ -148,9 +148,9 @@ TESTJS_GLOBAL_FUNCTION(compare_typed_arrays, compareTypedArrays)
|
|||
return JS::Value(lhs_array.viewed_array_buffer()->buffer() == rhs_array.viewed_array_buffer()->buffer());
|
||||
}
|
||||
|
||||
void WebAssemblyModule::initialize(JS::GlobalObject& global_object)
|
||||
void WebAssemblyModule::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(global_object);
|
||||
Base::initialize(realm);
|
||||
define_native_function("getExport", get_export, 1, JS::default_attributes);
|
||||
define_native_function("invoke", wasm_invoke, 1, JS::default_attributes);
|
||||
}
|
||||
|
|
|
@ -371,9 +371,9 @@ WorkbookObject::WorkbookObject(JS::Realm& realm, Workbook& workbook)
|
|||
{
|
||||
}
|
||||
|
||||
void WorkbookObject::initialize(JS::GlobalObject& global_object)
|
||||
void WorkbookObject::initialize(JS::Realm& realm)
|
||||
{
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
define_native_function("sheet", sheet, 1, JS::default_attributes);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
|
||||
virtual ~WorkbookObject() override = default;
|
||||
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(sheet);
|
||||
|
||||
|
|
|
@ -23,13 +23,12 @@ $262Object::$262Object(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void $262Object::initialize(JS::GlobalObject& global_object)
|
||||
void $262Object::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(global_object);
|
||||
Base::initialize(realm);
|
||||
|
||||
auto& realm = *global_object.associated_realm();
|
||||
m_agent = vm().heap().allocate<AgentObject>(global_object, realm);
|
||||
m_is_htmldda = vm().heap().allocate<IsHTMLDDA>(global_object, realm);
|
||||
m_agent = vm().heap().allocate<AgentObject>(realm.global_object(), realm);
|
||||
m_is_htmldda = vm().heap().allocate<IsHTMLDDA>(realm.global_object(), realm);
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function("clearKeptObjects", clear_kept_objects, 0, attr);
|
||||
|
@ -38,8 +37,8 @@ void $262Object::initialize(JS::GlobalObject& global_object)
|
|||
define_native_function("evalScript", eval_script, 1, attr);
|
||||
|
||||
define_direct_property("agent", m_agent, attr);
|
||||
define_direct_property("gc", global_object.get_without_side_effects("gc"), attr);
|
||||
define_direct_property("global", &global_object, attr);
|
||||
define_direct_property("gc", realm.global_object().get_without_side_effects("gc"), attr);
|
||||
define_direct_property("global", &realm.global_object(), attr);
|
||||
define_direct_property("IsHTMLDDA", m_is_htmldda, attr);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class $262Object final : public Object {
|
|||
|
||||
public:
|
||||
explicit $262Object(Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~$262Object() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -17,9 +17,9 @@ AgentObject::AgentObject(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void AgentObject::initialize(JS::GlobalObject& global_object)
|
||||
void AgentObject::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(global_object);
|
||||
Base::initialize(realm);
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function("monotonicNow", monotonic_now, 0, attr);
|
||||
|
|
|
@ -16,7 +16,7 @@ class AgentObject final : public Object {
|
|||
|
||||
public:
|
||||
explicit AgentObject(Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~AgentObject() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -19,7 +19,7 @@ class Cell {
|
|||
AK_MAKE_NONMOVABLE(Cell);
|
||||
|
||||
public:
|
||||
virtual void initialize(GlobalObject&) { }
|
||||
virtual void initialize(Realm&) { }
|
||||
virtual ~Cell() = default;
|
||||
|
||||
bool is_marked() const { return m_mark; }
|
||||
|
|
|
@ -349,4 +349,11 @@ void Heap::uproot_cell(Cell* cell)
|
|||
m_uprooted_cells.append(cell);
|
||||
}
|
||||
|
||||
// Temporary helper function as we can't pass a realm directly until Heap::allocate<T>() receives one.
|
||||
// Heap.h only has a forward declaration of the GlobalObject, so no inlined member access possible.
|
||||
Realm& realm_from_global_object(GlobalObject& global_object)
|
||||
{
|
||||
return *global_object.associated_realm();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
Realm& realm_from_global_object(GlobalObject&);
|
||||
|
||||
class Heap {
|
||||
AK_MAKE_NONCOPYABLE(Heap);
|
||||
AK_MAKE_NONMOVABLE(Heap);
|
||||
|
@ -47,7 +49,8 @@ public:
|
|||
auto* memory = allocate_cell(sizeof(T));
|
||||
new (memory) T(forward<Args>(args)...);
|
||||
auto* cell = static_cast<T*>(memory);
|
||||
cell->initialize(global_object);
|
||||
auto& realm = realm_from_global_object(global_object);
|
||||
memory->initialize(realm);
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,13 +19,13 @@ AggregateErrorConstructor::AggregateErrorConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void AggregateErrorConstructor::initialize(GlobalObject& global_object)
|
||||
void AggregateErrorConstructor::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
// 20.5.7.2.1 AggregateError.prototype, https://tc39.es/ecma262/#sec-aggregate-error.prototype
|
||||
define_direct_property(vm.names.prototype, global_object.aggregate_error_prototype(), 0);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().aggregate_error_prototype(), 0);
|
||||
|
||||
define_direct_property(vm.names.length, Value(2), Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class AggregateErrorConstructor final : public NativeFunction {
|
|||
|
||||
public:
|
||||
explicit AggregateErrorConstructor(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~AggregateErrorConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -15,10 +15,10 @@ AggregateErrorPrototype::AggregateErrorPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void AggregateErrorPrototype::initialize(GlobalObject& global_object)
|
||||
void AggregateErrorPrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_direct_property(vm.names.name, js_string(vm, "AggregateError"), attr);
|
||||
define_direct_property(vm.names.message, js_string(vm, ""), attr);
|
||||
|
|
|
@ -15,7 +15,7 @@ class AggregateErrorPrototype final : public Object {
|
|||
|
||||
public:
|
||||
explicit AggregateErrorPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~AggregateErrorPrototype() override = default;
|
||||
};
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@ ArgumentsObject::ArgumentsObject(Realm& realm, Environment& environment)
|
|||
{
|
||||
}
|
||||
|
||||
void ArgumentsObject::initialize(GlobalObject& global_object)
|
||||
void ArgumentsObject::initialize(Realm& realm)
|
||||
{
|
||||
Base::initialize(global_object);
|
||||
Base::initialize(realm);
|
||||
set_has_parameter_map();
|
||||
m_parameter_map = Object::create(global_object, nullptr);
|
||||
m_parameter_map = Object::create(realm.global_object(), nullptr);
|
||||
}
|
||||
|
||||
void ArgumentsObject::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -18,7 +18,7 @@ class ArgumentsObject final : public Object {
|
|||
public:
|
||||
ArgumentsObject(Realm&, Environment&);
|
||||
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~ArgumentsObject() override = default;
|
||||
|
||||
Environment& environment() { return m_environment; }
|
||||
|
|
|
@ -18,13 +18,13 @@ ArrayBufferConstructor::ArrayBufferConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void ArrayBufferConstructor::initialize(GlobalObject& global_object)
|
||||
void ArrayBufferConstructor::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
// 25.1.4.2 ArrayBuffer.prototype, https://tc39.es/ecma262/#sec-arraybuffer.prototype
|
||||
define_direct_property(vm.names.prototype, global_object.array_buffer_prototype(), 0);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().array_buffer_prototype(), 0);
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(vm.names.isView, is_view, 1, attr);
|
||||
|
|
|
@ -15,7 +15,7 @@ class ArrayBufferConstructor final : public NativeFunction {
|
|||
|
||||
public:
|
||||
explicit ArrayBufferConstructor(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~ArrayBufferConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -19,10 +19,10 @@ ArrayBufferPrototype::ArrayBufferPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void ArrayBufferPrototype::initialize(GlobalObject& global_object)
|
||||
void ArrayBufferPrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(vm.names.slice, slice, 2, attr);
|
||||
define_native_accessor(vm.names.byteLength, byte_length_getter, {}, Attribute::Configurable);
|
||||
|
|
|
@ -16,7 +16,7 @@ class ArrayBufferPrototype final : public PrototypeObject<ArrayBufferPrototype,
|
|||
|
||||
public:
|
||||
explicit ArrayBufferPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~ArrayBufferPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -21,13 +21,13 @@ ArrayConstructor::ArrayConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void ArrayConstructor::initialize(GlobalObject& global_object)
|
||||
void ArrayConstructor::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
// 23.1.2.4 Array.prototype, https://tc39.es/ecma262/#sec-array.prototype
|
||||
define_direct_property(vm.names.prototype, global_object.array_prototype(), 0);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().array_prototype(), 0);
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(vm.names.from, from, 1, attr);
|
||||
|
|
|
@ -15,7 +15,7 @@ class ArrayConstructor final : public NativeFunction {
|
|||
|
||||
public:
|
||||
explicit ArrayConstructor(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~ArrayConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -19,15 +19,15 @@ ArrayIteratorPrototype::ArrayIteratorPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void ArrayIteratorPrototype::initialize(GlobalObject& global_object)
|
||||
void ArrayIteratorPrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
|
||||
define_native_function(vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable);
|
||||
|
||||
// 23.1.5.2.2 %ArrayIteratorPrototype% [ @@toStringTag ], https://tc39.es/ecma262/#sec-%arrayiteratorprototype%-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), "Array Iterator"), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Array Iterator"), Attribute::Configurable);
|
||||
}
|
||||
|
||||
// 23.1.5.2.1 %ArrayIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
|
||||
|
|
|
@ -16,7 +16,7 @@ class ArrayIteratorPrototype final : public PrototypeObject<ArrayIteratorPrototy
|
|||
|
||||
public:
|
||||
ArrayIteratorPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~ArrayIteratorPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -33,10 +33,10 @@ ArrayPrototype::ArrayPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void ArrayPrototype::initialize(GlobalObject& global_object)
|
||||
void ArrayPrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Array::initialize(global_object);
|
||||
Array::initialize(realm);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
|
||||
define_native_function(vm.names.at, at, 1, attr);
|
||||
|
@ -89,7 +89,7 @@ void ArrayPrototype::initialize(GlobalObject& global_object)
|
|||
// 23.1.3.37 Array.prototype [ @@unscopables ], https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
||||
// With array grouping proposal, https://tc39.es/proposal-array-grouping/#sec-array.prototype-@@unscopables
|
||||
// With change array by copy proposal, https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype-@@unscopables
|
||||
auto* unscopable_list = Object::create(global_object, nullptr);
|
||||
auto* unscopable_list = Object::create(realm.global_object(), nullptr);
|
||||
MUST(unscopable_list->create_data_property_or_throw(vm.names.at, Value(true)));
|
||||
MUST(unscopable_list->create_data_property_or_throw(vm.names.copyWithin, Value(true)));
|
||||
MUST(unscopable_list->create_data_property_or_throw(vm.names.entries, Value(true)));
|
||||
|
|
|
@ -16,7 +16,7 @@ class ArrayPrototype final : public Array {
|
|||
|
||||
public:
|
||||
ArrayPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~ArrayPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -23,9 +23,9 @@ AsyncFromSyncIterator::AsyncFromSyncIterator(Realm& realm, Iterator sync_iterato
|
|||
{
|
||||
}
|
||||
|
||||
void AsyncFromSyncIterator::initialize(GlobalObject& global_object)
|
||||
void AsyncFromSyncIterator::initialize(Realm& realm)
|
||||
{
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
}
|
||||
|
||||
void AsyncFromSyncIterator::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
static AsyncFromSyncIterator* create(GlobalObject&, Iterator sync_iterator_record);
|
||||
|
||||
explicit AsyncFromSyncIterator(Realm&, Iterator sync_iterator_record);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~AsyncFromSyncIterator() override = default;
|
||||
|
||||
void visit_edges(Visitor& visitor) override;
|
||||
|
|
|
@ -19,10 +19,10 @@ AsyncFromSyncIteratorPrototype::AsyncFromSyncIteratorPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void AsyncFromSyncIteratorPrototype::initialize(GlobalObject& global_object)
|
||||
void AsyncFromSyncIteratorPrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
Object::initialize(global_object);
|
||||
auto& vm = this->vm();
|
||||
Object::initialize(realm);
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(vm.names.next, next, 1, attr);
|
||||
|
|
|
@ -20,7 +20,7 @@ class AsyncFromSyncIteratorPrototype final : public PrototypeObject<AsyncFromSyn
|
|||
|
||||
public:
|
||||
explicit AsyncFromSyncIteratorPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~AsyncFromSyncIteratorPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -17,13 +17,13 @@ AsyncFunctionConstructor::AsyncFunctionConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void AsyncFunctionConstructor::initialize(GlobalObject& global_object)
|
||||
void AsyncFunctionConstructor::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
// 27.7.2.2 AsyncFunction.prototype, https://tc39.es/ecma262/#sec-async-function-constructor-prototype
|
||||
define_direct_property(vm.names.prototype, global_object.async_function_prototype(), 0);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().async_function_prototype(), 0);
|
||||
|
||||
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class AsyncFunctionConstructor final : public NativeFunction {
|
|||
|
||||
public:
|
||||
explicit AsyncFunctionConstructor(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~AsyncFunctionConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -14,10 +14,10 @@ AsyncFunctionPrototype::AsyncFunctionPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void AsyncFunctionPrototype::initialize(GlobalObject& global_object)
|
||||
void AsyncFunctionPrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
|
||||
// 27.7.3.2 AsyncFunction.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-async-function-prototype-properties-toStringTag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.AsyncFunction.as_string()), Attribute::Configurable);
|
||||
|
|
|
@ -15,7 +15,7 @@ class AsyncFunctionPrototype final : public Object {
|
|||
|
||||
public:
|
||||
explicit AsyncFunctionPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~AsyncFunctionPrototype() override = default;
|
||||
};
|
||||
|
||||
|
|
|
@ -17,16 +17,16 @@ AsyncGeneratorFunctionConstructor::AsyncGeneratorFunctionConstructor(Realm& real
|
|||
{
|
||||
}
|
||||
|
||||
void AsyncGeneratorFunctionConstructor::initialize(GlobalObject& global_object)
|
||||
void AsyncGeneratorFunctionConstructor::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
// 27.4.2.1 AsyncGeneratorFunction.length, https://tc39.es/ecma262/#sec-asyncgeneratorfunction-length
|
||||
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
|
||||
|
||||
// 27.4.2.2 AsyncGeneratorFunction.prototype, https://tc39.es/ecma262/#sec-asyncgeneratorfunction-prototype
|
||||
define_direct_property(vm.names.prototype, global_object.async_generator_function_prototype(), 0);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().async_generator_function_prototype(), 0);
|
||||
}
|
||||
|
||||
// 27.4.1.1 AsyncGeneratorFunction ( p1, p2, … , pn, body ), https://tc39.es/ecma262/#sec-asyncgeneratorfunction
|
||||
|
|
|
@ -15,7 +15,7 @@ class AsyncGeneratorFunctionConstructor final : public NativeFunction {
|
|||
|
||||
public:
|
||||
explicit AsyncGeneratorFunctionConstructor(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~AsyncGeneratorFunctionConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -16,15 +16,15 @@ AsyncGeneratorFunctionPrototype::AsyncGeneratorFunctionPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void AsyncGeneratorFunctionPrototype::initialize(GlobalObject& global_object)
|
||||
void AsyncGeneratorFunctionPrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
|
||||
// The constructor cannot be set at this point since it has not been initialized.
|
||||
|
||||
// 27.4.3.2 AsyncGeneratorFunction.prototype.prototype, https://tc39.es/ecma262/#sec-asyncgeneratorfunction-prototype-prototype
|
||||
define_direct_property(vm.names.prototype, global_object.async_generator_prototype(), Attribute::Configurable);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().async_generator_prototype(), Attribute::Configurable);
|
||||
|
||||
// 27.4.3.3 AsyncGeneratorFunction.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-asyncgeneratorfunction-prototype-tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.AsyncGeneratorFunction.as_string()), Attribute::Configurable);
|
||||
|
|
|
@ -15,7 +15,7 @@ class AsyncGeneratorFunctionPrototype final : public PrototypeObject<AsyncGenera
|
|||
|
||||
public:
|
||||
explicit AsyncGeneratorFunctionPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~AsyncGeneratorFunctionPrototype() override = default;
|
||||
};
|
||||
|
||||
|
|
|
@ -14,10 +14,10 @@ AsyncGeneratorPrototype::AsyncGeneratorPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void AsyncGeneratorPrototype::initialize(GlobalObject& global_object)
|
||||
void AsyncGeneratorPrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
|
||||
// 27.6.1.5 AsyncGenerator.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-asyncgenerator-prototype-tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "AsyncGenerator"), Attribute::Configurable);
|
||||
|
|
|
@ -16,7 +16,7 @@ class AsyncGeneratorPrototype final : public PrototypeObject<AsyncGeneratorProto
|
|||
|
||||
public:
|
||||
explicit AsyncGeneratorPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~AsyncGeneratorPrototype() override = default;
|
||||
};
|
||||
|
||||
|
|
|
@ -13,10 +13,10 @@ AsyncIteratorPrototype::AsyncIteratorPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void AsyncIteratorPrototype::initialize(GlobalObject& global_object)
|
||||
void AsyncIteratorPrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(*vm.well_known_symbol_async_iterator(), symbol_async_iterator, 0, attr);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class AsyncIteratorPrototype final : public Object {
|
|||
|
||||
public:
|
||||
explicit AsyncIteratorPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~AsyncIteratorPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -134,9 +134,9 @@ AtomicsObject::AtomicsObject(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void AtomicsObject::initialize(GlobalObject& global_object)
|
||||
void AtomicsObject::initialize(Realm& realm)
|
||||
{
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
auto& vm = this->vm();
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
|
@ -152,7 +152,7 @@ void AtomicsObject::initialize(GlobalObject& global_object)
|
|||
define_native_function(vm.names.xor_, xor_, 3, attr);
|
||||
|
||||
// 25.4.15 Atomics [ @@toStringTag ], https://tc39.es/ecma262/#sec-atomics-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), "Atomics"), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Atomics"), Attribute::Configurable);
|
||||
}
|
||||
|
||||
// 25.4.3 Atomics.add ( typedArray, index, value ), https://tc39.es/ecma262/#sec-atomics.add
|
||||
|
|
|
@ -15,7 +15,7 @@ class AtomicsObject : public Object {
|
|||
|
||||
public:
|
||||
explicit AtomicsObject(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~AtomicsObject() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -22,13 +22,13 @@ BigIntConstructor::BigIntConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void BigIntConstructor::initialize(GlobalObject& global_object)
|
||||
void BigIntConstructor::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
// 21.2.2.3 BigInt.prototype, https://tc39.es/ecma262/#sec-bigint.prototype
|
||||
define_direct_property(vm.names.prototype, global_object.bigint_prototype(), 0);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().bigint_prototype(), 0);
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(vm.names.asIntN, as_int_n, 2, attr);
|
||||
|
|
|
@ -15,7 +15,7 @@ class BigIntConstructor final : public NativeFunction {
|
|||
|
||||
public:
|
||||
explicit BigIntConstructor(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~BigIntConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -22,17 +22,17 @@ BigIntPrototype::BigIntPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void BigIntPrototype::initialize(GlobalObject& global_object)
|
||||
void BigIntPrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(vm.names.toString, to_string, 0, attr);
|
||||
define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr);
|
||||
define_native_function(vm.names.valueOf, value_of, 0, attr);
|
||||
|
||||
// 21.2.3.5 BigInt.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-bigint.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), vm.names.BigInt.as_string()), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.BigInt.as_string()), Attribute::Configurable);
|
||||
}
|
||||
|
||||
// thisBigIntValue ( value ), https://tc39.es/ecma262/#thisbigintvalue
|
||||
|
|
|
@ -15,7 +15,7 @@ class BigIntPrototype final : public Object {
|
|||
|
||||
public:
|
||||
explicit BigIntPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~BigIntPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -16,13 +16,13 @@ BooleanConstructor::BooleanConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void BooleanConstructor::initialize(GlobalObject& global_object)
|
||||
void BooleanConstructor::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
// 20.3.2.1 Boolean.prototype, https://tc39.es/ecma262/#sec-boolean.prototype
|
||||
define_direct_property(vm.names.prototype, global_object.boolean_prototype(), 0);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().boolean_prototype(), 0);
|
||||
|
||||
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class BooleanConstructor final : public NativeFunction {
|
|||
|
||||
public:
|
||||
explicit BooleanConstructor(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~BooleanConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -17,10 +17,10 @@ BooleanPrototype::BooleanPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void BooleanPrototype::initialize(GlobalObject& global_object)
|
||||
void BooleanPrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
BooleanObject::initialize(global_object);
|
||||
BooleanObject::initialize(realm);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(vm.names.toString, to_string, 0, attr);
|
||||
define_native_function(vm.names.valueOf, value_of, 0, attr);
|
||||
|
|
|
@ -15,7 +15,7 @@ class BooleanPrototype final : public BooleanObject {
|
|||
|
||||
public:
|
||||
explicit BooleanPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~BooleanPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -17,10 +17,10 @@ ConsoleObject::ConsoleObject(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void ConsoleObject::initialize(GlobalObject& global_object)
|
||||
void ConsoleObject::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
u8 attr = Attribute::Writable | Attribute::Enumerable | Attribute::Configurable;
|
||||
define_native_function(vm.names.log, log, 0, attr);
|
||||
define_native_function(vm.names.debug, debug, 0, attr);
|
||||
|
|
|
@ -15,7 +15,7 @@ class ConsoleObject final : public Object {
|
|||
|
||||
public:
|
||||
explicit ConsoleObject(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~ConsoleObject() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -18,13 +18,13 @@ DataViewConstructor::DataViewConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void DataViewConstructor::initialize(GlobalObject& global_object)
|
||||
void DataViewConstructor::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
// 25.3.3.1 DataView.prototype, https://tc39.es/ecma262/#sec-dataview.prototype
|
||||
define_direct_property(vm.names.prototype, global_object.data_view_prototype(), 0);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().data_view_prototype(), 0);
|
||||
|
||||
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class DataViewConstructor final : public NativeFunction {
|
|||
|
||||
public:
|
||||
explicit DataViewConstructor(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~DataViewConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -15,10 +15,10 @@ DataViewPrototype::DataViewPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void DataViewPrototype::initialize(GlobalObject& global_object)
|
||||
void DataViewPrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
|
||||
define_native_function(vm.names.getBigInt64, get_big_int_64, 1, attr);
|
||||
|
@ -47,7 +47,7 @@ void DataViewPrototype::initialize(GlobalObject& global_object)
|
|||
define_native_accessor(vm.names.byteOffset, byte_offset_getter, {}, Attribute::Configurable);
|
||||
|
||||
// 25.3.4.25 DataView.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-dataview.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), vm.names.DataView.as_string()), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.DataView.as_string()), Attribute::Configurable);
|
||||
}
|
||||
|
||||
// 25.3.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type ), https://tc39.es/ecma262/#sec-getviewvalue
|
||||
|
|
|
@ -16,7 +16,7 @@ class DataViewPrototype final : public PrototypeObject<DataViewPrototype, DataVi
|
|||
|
||||
public:
|
||||
DataViewPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~DataViewPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -167,13 +167,13 @@ DateConstructor::DateConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void DateConstructor::initialize(GlobalObject& global_object)
|
||||
void DateConstructor::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
// 21.4.3.3 Date.prototype, https://tc39.es/ecma262/#sec-date.prototype
|
||||
define_direct_property(vm.names.prototype, global_object.date_prototype(), 0);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().date_prototype(), 0);
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(vm.names.now, now, 0, attr);
|
||||
|
|
|
@ -15,7 +15,7 @@ class DateConstructor final : public NativeFunction {
|
|||
|
||||
public:
|
||||
explicit DateConstructor(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~DateConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -35,10 +35,10 @@ DatePrototype::DatePrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void DatePrototype::initialize(GlobalObject& global_object)
|
||||
void DatePrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(vm.names.getDate, get_date, 0, attr);
|
||||
define_native_function(vm.names.getDay, get_day, 0, attr);
|
||||
|
|
|
@ -16,7 +16,7 @@ class DatePrototype final : public PrototypeObject<DatePrototype, Date> {
|
|||
|
||||
public:
|
||||
explicit DatePrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~DatePrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -97,10 +97,10 @@ ECMAScriptFunctionObject::ECMAScriptFunctionObject(FlyString name, String source
|
|||
});
|
||||
}
|
||||
|
||||
void ECMAScriptFunctionObject::initialize(GlobalObject& global_object)
|
||||
void ECMAScriptFunctionObject::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Base::initialize(global_object);
|
||||
Base::initialize(realm);
|
||||
// Note: The ordering of these properties must be: length, name, prototype which is the order
|
||||
// they are defined in the spec: https://tc39.es/ecma262/#sec-function-instances .
|
||||
// This is observable through something like: https://tc39.es/ecma262/#sec-ordinaryownpropertykeys
|
||||
|
@ -114,17 +114,17 @@ void ECMAScriptFunctionObject::initialize(GlobalObject& global_object)
|
|||
Object* prototype = nullptr;
|
||||
switch (m_kind) {
|
||||
case FunctionKind::Normal:
|
||||
prototype = vm.heap().allocate<Object>(global_object, *global_object.new_ordinary_function_prototype_object_shape());
|
||||
prototype = vm.heap().allocate<Object>(realm.global_object(), *realm.global_object().new_ordinary_function_prototype_object_shape());
|
||||
MUST(prototype->define_property_or_throw(vm.names.constructor, { .value = this, .writable = true, .enumerable = false, .configurable = true }));
|
||||
break;
|
||||
case FunctionKind::Generator:
|
||||
// prototype is "g1.prototype" in figure-2 (https://tc39.es/ecma262/img/figure-2.png)
|
||||
prototype = Object::create(global_object, global_object.generator_function_prototype_prototype());
|
||||
prototype = Object::create(realm.global_object(), realm.global_object().generator_function_prototype_prototype());
|
||||
break;
|
||||
case FunctionKind::Async:
|
||||
break;
|
||||
case FunctionKind::AsyncGenerator:
|
||||
prototype = Object::create(global_object, global_object.async_generator_function_prototype_prototype());
|
||||
prototype = Object::create(realm.global_object(), realm.global_object().async_generator_function_prototype_prototype());
|
||||
break;
|
||||
}
|
||||
// 27.7.4 AsyncFunction Instances, https://tc39.es/ecma262/#sec-async-function-instances
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
static ECMAScriptFunctionObject* create(GlobalObject&, FlyString name, Object& prototype, String source_text, Statement const& ecmascript_code, Vector<FunctionNode::Parameter> parameters, i32 m_function_length, Environment* parent_environment, PrivateEnvironment* private_environment, FunctionKind, bool is_strict, bool might_need_arguments_object = true, bool contains_direct_call_to_eval = true, bool is_arrow_function = false, Variant<PropertyKey, PrivateName, Empty> class_field_initializer_name = {});
|
||||
|
||||
ECMAScriptFunctionObject(FlyString name, String source_text, Statement const& ecmascript_code, Vector<FunctionNode::Parameter> parameters, i32 m_function_length, Environment* parent_environment, PrivateEnvironment* private_environment, Object& prototype, FunctionKind, bool is_strict, bool might_need_arguments_object, bool contains_direct_call_to_eval, bool is_arrow_function, Variant<PropertyKey, PrivateName, Empty> class_field_initializer_name);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~ECMAScriptFunctionObject() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override;
|
||||
|
|
|
@ -16,13 +16,13 @@ ErrorConstructor::ErrorConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void ErrorConstructor::initialize(GlobalObject& global_object)
|
||||
void ErrorConstructor::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
// 20.5.2.1 Error.prototype, https://tc39.es/ecma262/#sec-error.prototype
|
||||
define_direct_property(vm.names.prototype, global_object.error_prototype(), 0);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().error_prototype(), 0);
|
||||
|
||||
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
|
||||
}
|
||||
|
@ -68,13 +68,13 @@ ThrowCompletionOr<Object*> ErrorConstructor::construct(FunctionObject& new_targe
|
|||
{ \
|
||||
} \
|
||||
\
|
||||
void ConstructorName::initialize(GlobalObject& global_object) \
|
||||
void ConstructorName::initialize(Realm& realm) \
|
||||
{ \
|
||||
auto& vm = this->vm(); \
|
||||
NativeFunction::initialize(global_object); \
|
||||
NativeFunction::initialize(realm); \
|
||||
\
|
||||
/* 20.5.6.2.1 NativeError.prototype, https://tc39.es/ecma262/#sec-nativeerror.prototype */ \
|
||||
define_direct_property(vm.names.prototype, global_object.snake_name##_prototype(), 0); \
|
||||
define_direct_property(vm.names.prototype, realm.global_object().snake_name##_prototype(), 0); \
|
||||
\
|
||||
define_direct_property(vm.names.length, Value(1), Attribute::Configurable); \
|
||||
} \
|
||||
|
|
|
@ -16,7 +16,7 @@ class ErrorConstructor final : public NativeFunction {
|
|||
|
||||
public:
|
||||
explicit ErrorConstructor(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~ErrorConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
@ -32,7 +32,7 @@ private:
|
|||
\
|
||||
public: \
|
||||
explicit ConstructorName(Realm&); \
|
||||
virtual void initialize(GlobalObject&) override; \
|
||||
virtual void initialize(Realm&) override; \
|
||||
virtual ~ConstructorName() override; \
|
||||
virtual ThrowCompletionOr<Value> call() override; \
|
||||
virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override; \
|
||||
|
|
|
@ -20,10 +20,10 @@ ErrorPrototype::ErrorPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void ErrorPrototype::initialize(GlobalObject& global_object)
|
||||
void ErrorPrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_direct_property(vm.names.name, js_string(vm, "Error"), attr);
|
||||
define_direct_property(vm.names.message, js_string(vm, ""), attr);
|
||||
|
@ -129,10 +129,10 @@ JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::stack_setter)
|
|||
{ \
|
||||
} \
|
||||
\
|
||||
void PrototypeName::initialize(GlobalObject& global_object) \
|
||||
void PrototypeName::initialize(Realm& realm) \
|
||||
{ \
|
||||
auto& vm = this->vm(); \
|
||||
Object::initialize(global_object); \
|
||||
Object::initialize(realm); \
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable; \
|
||||
define_direct_property(vm.names.name, js_string(vm, #ClassName), attr); \
|
||||
define_direct_property(vm.names.message, js_string(vm, ""), attr); \
|
||||
|
|
|
@ -17,7 +17,7 @@ class ErrorPrototype final : public PrototypeObject<ErrorPrototype, Error> {
|
|||
|
||||
public:
|
||||
explicit ErrorPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~ErrorPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
@ -32,7 +32,7 @@ private:
|
|||
\
|
||||
public: \
|
||||
explicit PrototypeName(Realm&); \
|
||||
virtual void initialize(GlobalObject&) override; \
|
||||
virtual void initialize(Realm&) override; \
|
||||
virtual ~PrototypeName() override = default; \
|
||||
};
|
||||
|
||||
|
|
|
@ -18,13 +18,13 @@ FinalizationRegistryConstructor::FinalizationRegistryConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void FinalizationRegistryConstructor::initialize(GlobalObject& global_object)
|
||||
void FinalizationRegistryConstructor::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
// 26.2.2.1 FinalizationRegistry.prototype, https://tc39.es/ecma262/#sec-finalization-registry.prototype
|
||||
define_direct_property(vm.names.prototype, global_object.finalization_registry_prototype(), 0);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().finalization_registry_prototype(), 0);
|
||||
|
||||
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class FinalizationRegistryConstructor final : public NativeFunction {
|
|||
|
||||
public:
|
||||
explicit FinalizationRegistryConstructor(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~FinalizationRegistryConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -14,10 +14,10 @@ FinalizationRegistryPrototype::FinalizationRegistryPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void FinalizationRegistryPrototype::initialize(GlobalObject& global_object)
|
||||
void FinalizationRegistryPrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
|
||||
define_native_function(vm.names.cleanupSome, cleanup_some, 0, attr);
|
||||
|
@ -25,7 +25,7 @@ void FinalizationRegistryPrototype::initialize(GlobalObject& global_object)
|
|||
define_native_function(vm.names.unregister, unregister, 1, attr);
|
||||
|
||||
// 26.2.3.4 FinalizationRegistry.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-finalization-registry.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), vm.names.FinalizationRegistry.as_string()), Attribute::Configurable);
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.FinalizationRegistry.as_string()), Attribute::Configurable);
|
||||
}
|
||||
|
||||
// @STAGE 2@ FinalizationRegistry.prototype.cleanupSome ( [ callback ] ), https://github.com/tc39/proposal-cleanup-some/blob/master/spec/finalization-registry.html
|
||||
|
|
|
@ -16,7 +16,7 @@ class FinalizationRegistryPrototype final : public PrototypeObject<FinalizationR
|
|||
|
||||
public:
|
||||
FinalizationRegistryPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~FinalizationRegistryPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -24,13 +24,13 @@ FunctionConstructor::FunctionConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void FunctionConstructor::initialize(GlobalObject& global_object)
|
||||
void FunctionConstructor::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
// 20.2.2.2 Function.prototype, https://tc39.es/ecma262/#sec-function.prototype
|
||||
define_direct_property(vm.names.prototype, global_object.function_prototype(), 0);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().function_prototype(), 0);
|
||||
|
||||
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
static ThrowCompletionOr<ECMAScriptFunctionObject*> create_dynamic_function(GlobalObject& global_object, FunctionObject& constructor, FunctionObject* new_target, FunctionKind kind, MarkedVector<Value> const& args);
|
||||
|
||||
explicit FunctionConstructor(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~FunctionConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -20,7 +20,7 @@ class FunctionObject : public Object {
|
|||
|
||||
public:
|
||||
virtual ~FunctionObject() = default;
|
||||
virtual void initialize(GlobalObject&) override { }
|
||||
virtual void initialize(Realm&) override { }
|
||||
|
||||
// Table 7: Additional Essential Internal Methods of Function Objects, https://tc39.es/ecma262/#table-additional-essential-internal-methods-of-function-objects
|
||||
|
||||
|
|
|
@ -25,10 +25,10 @@ FunctionPrototype::FunctionPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void FunctionPrototype::initialize(GlobalObject& global_object)
|
||||
void FunctionPrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Base::initialize(global_object);
|
||||
Base::initialize(realm);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(vm.names.apply, apply, 2, attr);
|
||||
define_native_function(vm.names.bind, bind, 1, attr);
|
||||
|
|
|
@ -15,7 +15,7 @@ class FunctionPrototype final : public FunctionObject {
|
|||
|
||||
public:
|
||||
explicit FunctionPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~FunctionPrototype() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override;
|
||||
|
|
|
@ -16,15 +16,15 @@ GeneratorFunctionConstructor::GeneratorFunctionConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void GeneratorFunctionConstructor::initialize(GlobalObject& global_object)
|
||||
void GeneratorFunctionConstructor::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
// 27.3.2.1 GeneratorFunction.length, https://tc39.es/ecma262/#sec-generatorfunction.length
|
||||
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
|
||||
// 27.3.2.2 GeneratorFunction.prototype, https://tc39.es/ecma262/#sec-generatorfunction.length
|
||||
define_direct_property(vm.names.prototype, global_object.generator_function_prototype(), 0);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().generator_function_prototype(), 0);
|
||||
}
|
||||
|
||||
// 27.3.1.1 GeneratorFunction ( p1, p2, … , pn, body ), https://tc39.es/ecma262/#sec-generatorfunction
|
||||
|
|
|
@ -16,7 +16,7 @@ class GeneratorFunctionConstructor final : public NativeFunction {
|
|||
|
||||
public:
|
||||
explicit GeneratorFunctionConstructor(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~GeneratorFunctionConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -15,13 +15,13 @@ GeneratorFunctionPrototype::GeneratorFunctionPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void GeneratorFunctionPrototype::initialize(GlobalObject& global_object)
|
||||
void GeneratorFunctionPrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
|
||||
// 27.3.3.2 GeneratorFunction.prototype.prototype, https://tc39.es/ecma262/#sec-generatorfunction.prototype.prototype
|
||||
define_direct_property(vm.names.prototype, global_object.generator_prototype(), Attribute::Configurable);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().generator_prototype(), Attribute::Configurable);
|
||||
// 27.3.3.3 GeneratorFunction.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-generatorfunction.prototype-@@tostringtag
|
||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "GeneratorFunction"), Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class GeneratorFunctionPrototype final : public Object {
|
|||
|
||||
public:
|
||||
explicit GeneratorFunctionPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~GeneratorFunctionPrototype() override = default;
|
||||
};
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ GeneratorObject::GeneratorObject(Realm&, Object& prototype, ExecutionContext con
|
|||
{
|
||||
}
|
||||
|
||||
void GeneratorObject::initialize(GlobalObject&)
|
||||
void GeneratorObject::initialize(Realm&)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class GeneratorObject final : public Object {
|
|||
public:
|
||||
static ThrowCompletionOr<GeneratorObject*> create(GlobalObject&, Value, ECMAScriptFunctionObject*, ExecutionContext, Bytecode::RegisterWindow);
|
||||
GeneratorObject(Realm&, Object& prototype, ExecutionContext);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~GeneratorObject() override = default;
|
||||
void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
|
|
|
@ -14,10 +14,10 @@ GeneratorPrototype::GeneratorPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void GeneratorPrototype::initialize(GlobalObject& global_object)
|
||||
void GeneratorPrototype::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(vm.names.next, next, 1, attr);
|
||||
define_native_function(vm.names.return_, return_, 1, attr);
|
||||
|
|
|
@ -17,7 +17,7 @@ class GeneratorPrototype final : public PrototypeObject<GeneratorPrototype, Gene
|
|||
|
||||
public:
|
||||
explicit GeneratorPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~GeneratorPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -166,10 +166,8 @@ void GlobalObject::initialize_global_object()
|
|||
m_new_ordinary_function_prototype_object_shape->add_property_without_transition(vm.names.constructor, Attribute::Writable | Attribute::Configurable);
|
||||
|
||||
// Normally Heap::allocate() takes care of this, but these are allocated via allocate_without_global_object().
|
||||
|
||||
static_cast<FunctionPrototype*>(m_function_prototype)->initialize(*this);
|
||||
|
||||
static_cast<ObjectPrototype*>(m_object_prototype)->initialize(*this);
|
||||
static_cast<FunctionPrototype*>(m_function_prototype)->initialize(realm);
|
||||
static_cast<ObjectPrototype*>(m_object_prototype)->initialize(realm);
|
||||
|
||||
Object::set_prototype(m_object_prototype);
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@ CollatorCompareFunction::CollatorCompareFunction(Realm& realm, Collator& collato
|
|||
{
|
||||
}
|
||||
|
||||
void CollatorCompareFunction::initialize(GlobalObject& global_object)
|
||||
void CollatorCompareFunction::initialize(Realm&)
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
auto& vm = this->vm();
|
||||
define_direct_property(vm.names.length, Value(2), Attribute::Configurable);
|
||||
define_direct_property(vm.names.name, js_string(vm, String::empty()), Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
static CollatorCompareFunction* create(GlobalObject&, Collator&);
|
||||
|
||||
CollatorCompareFunction(Realm&, Collator&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~CollatorCompareFunction() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -137,14 +137,14 @@ CollatorConstructor::CollatorConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void CollatorConstructor::initialize(GlobalObject& global_object)
|
||||
void CollatorConstructor::initialize(Realm& realm)
|
||||
{
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
// 10.2.1 Intl.Collator.prototype, https://tc39.es/ecma402/#sec-intl.collator.prototype
|
||||
define_direct_property(vm.names.prototype, global_object.intl_collator_prototype(), 0);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().intl_collator_prototype(), 0);
|
||||
define_direct_property(vm.names.length, Value(0), Attribute::Configurable);
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
|
|
|
@ -15,7 +15,7 @@ class CollatorConstructor final : public NativeFunction {
|
|||
|
||||
public:
|
||||
explicit CollatorConstructor(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~CollatorConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -17,9 +17,9 @@ CollatorPrototype::CollatorPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void CollatorPrototype::initialize(GlobalObject& global_object)
|
||||
void CollatorPrototype::initialize(Realm& realm)
|
||||
{
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class CollatorPrototype final : public PrototypeObject<CollatorPrototype, Collat
|
|||
|
||||
public:
|
||||
explicit CollatorPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~CollatorPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -22,14 +22,14 @@ DateTimeFormatConstructor::DateTimeFormatConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void DateTimeFormatConstructor::initialize(GlobalObject& global_object)
|
||||
void DateTimeFormatConstructor::initialize(Realm& realm)
|
||||
{
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
// 11.2.1 Intl.DateTimeFormat.prototype, https://tc39.es/ecma402/#sec-intl.datetimeformat.prototype
|
||||
define_direct_property(vm.names.prototype, global_object.intl_date_time_format_prototype(), 0);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().intl_date_time_format_prototype(), 0);
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(vm.names.supportedLocalesOf, supported_locales_of, 1, attr);
|
||||
|
|
|
@ -15,7 +15,7 @@ class DateTimeFormatConstructor final : public NativeFunction {
|
|||
|
||||
public:
|
||||
explicit DateTimeFormatConstructor(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~DateTimeFormatConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
|
|
@ -25,11 +25,11 @@ DateTimeFormatFunction::DateTimeFormatFunction(DateTimeFormat& date_time_format,
|
|||
{
|
||||
}
|
||||
|
||||
void DateTimeFormatFunction::initialize(GlobalObject& global_object)
|
||||
void DateTimeFormatFunction::initialize(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
Base::initialize(global_object);
|
||||
Base::initialize(realm);
|
||||
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
|
||||
define_direct_property(vm.names.name, js_string(vm, String::empty()), Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
|
||||
explicit DateTimeFormatFunction(DateTimeFormat&, Object& prototype);
|
||||
virtual ~DateTimeFormatFunction() override = default;
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ DateTimeFormatPrototype::DateTimeFormatPrototype(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void DateTimeFormatPrototype::initialize(GlobalObject& global_object)
|
||||
void DateTimeFormatPrototype::initialize(Realm& realm)
|
||||
{
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class DateTimeFormatPrototype final : public PrototypeObject<DateTimeFormatProto
|
|||
|
||||
public:
|
||||
explicit DateTimeFormatPrototype(Realm&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~DateTimeFormatPrototype() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -21,14 +21,14 @@ DisplayNamesConstructor::DisplayNamesConstructor(Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void DisplayNamesConstructor::initialize(GlobalObject& global_object)
|
||||
void DisplayNamesConstructor::initialize(Realm& realm)
|
||||
{
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
// 12.2.1 Intl.DisplayNames.prototype, https://tc39.es/ecma402/#sec-Intl.DisplayNames.prototype
|
||||
define_direct_property(vm.names.prototype, global_object.intl_display_names_prototype(), 0);
|
||||
define_direct_property(vm.names.prototype, realm.global_object().intl_display_names_prototype(), 0);
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(vm.names.supportedLocalesOf, supported_locales_of, 1, attr);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue