mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:38:12 +00:00
LibJS+LibWeb: Replace GlobalObject with Realm in object constructors
No functional changes - we can still very easily get to the global object via `Realm::global_object()`. This is in preparation of moving the intrinsics to the realm and no longer having to pass a global object when allocating any object. In a few (now, and many more in subsequent commits) places we get a realm using `GlobalObject::associated_realm()`, this is intended to be temporary. For example, create() functions will later receive the same treatment and are passed a realm instead of a global object.
This commit is contained in:
parent
4c300cc5e8
commit
ecd163bdf1
315 changed files with 592 additions and 554 deletions
|
@ -1837,7 +1837,7 @@ class @wrapper_class@ : public @wrapper_base_class@ {
|
||||||
public:
|
public:
|
||||||
static @wrapper_class@* create(JS::GlobalObject&, @fully_qualified_name@&);
|
static @wrapper_class@* create(JS::GlobalObject&, @fully_qualified_name@&);
|
||||||
|
|
||||||
@wrapper_class@(JS::GlobalObject&, @fully_qualified_name@&);
|
@wrapper_class@(JS::Realm&, @fully_qualified_name@&);
|
||||||
virtual void initialize(JS::GlobalObject&) override;
|
virtual void initialize(JS::GlobalObject&) override;
|
||||||
virtual ~@wrapper_class@() override;
|
virtual ~@wrapper_class@() override;
|
||||||
)~~~");
|
)~~~");
|
||||||
|
@ -2004,25 +2004,26 @@ namespace Web::Bindings {
|
||||||
|
|
||||||
@wrapper_class@* @wrapper_class@::create(JS::GlobalObject& global_object, @fully_qualified_name@& impl)
|
@wrapper_class@* @wrapper_class@::create(JS::GlobalObject& global_object, @fully_qualified_name@& impl)
|
||||||
{
|
{
|
||||||
return global_object.heap().allocate<@wrapper_class@>(global_object, global_object, impl);
|
auto& realm = *global_object.associated_realm();
|
||||||
|
return global_object.heap().allocate<@wrapper_class@>(global_object, realm, impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
)~~~");
|
)~~~");
|
||||||
|
|
||||||
if (interface.wrapper_base_class == "Wrapper") {
|
if (interface.wrapper_base_class == "Wrapper") {
|
||||||
generator.append(R"~~~(
|
generator.append(R"~~~(
|
||||||
@wrapper_class@::@wrapper_class@(JS::GlobalObject& global_object, @fully_qualified_name@& impl)
|
@wrapper_class@::@wrapper_class@(JS::Realm& realm, @fully_qualified_name@& impl)
|
||||||
: Wrapper(static_cast<WindowObject&>(global_object).ensure_web_prototype<@prototype_class@>("@name@"))
|
: Wrapper(static_cast<WindowObject&>(realm.global_object()).ensure_web_prototype<@prototype_class@>("@name@"))
|
||||||
, m_impl(impl)
|
, m_impl(impl)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
)~~~");
|
)~~~");
|
||||||
} else {
|
} else {
|
||||||
generator.append(R"~~~(
|
generator.append(R"~~~(
|
||||||
@wrapper_class@::@wrapper_class@(JS::GlobalObject& global_object, @fully_qualified_name@& impl)
|
@wrapper_class@::@wrapper_class@(JS::Realm& realm, @fully_qualified_name@& impl)
|
||||||
: @wrapper_base_class@(global_object, impl)
|
: @wrapper_base_class@(realm, impl)
|
||||||
{
|
{
|
||||||
set_prototype(&static_cast<WindowObject&>(global_object).ensure_web_prototype<@prototype_class@>("@name@"));
|
set_prototype(&static_cast<WindowObject&>(realm.global_object()).ensure_web_prototype<@prototype_class@>("@name@"));
|
||||||
}
|
}
|
||||||
)~~~");
|
)~~~");
|
||||||
}
|
}
|
||||||
|
@ -2798,7 +2799,7 @@ namespace Web::Bindings {
|
||||||
class @constructor_class@ : public JS::NativeFunction {
|
class @constructor_class@ : public JS::NativeFunction {
|
||||||
JS_OBJECT(@constructor_class@, JS::NativeFunction);
|
JS_OBJECT(@constructor_class@, JS::NativeFunction);
|
||||||
public:
|
public:
|
||||||
explicit @constructor_class@(JS::GlobalObject&);
|
explicit @constructor_class@(JS::Realm&);
|
||||||
virtual void initialize(JS::GlobalObject&) override;
|
virtual void initialize(JS::GlobalObject&) override;
|
||||||
virtual ~@constructor_class@() override;
|
virtual ~@constructor_class@() override;
|
||||||
|
|
||||||
|
@ -2927,8 +2928,8 @@ using namespace Web::WebGL;
|
||||||
|
|
||||||
namespace Web::Bindings {
|
namespace Web::Bindings {
|
||||||
|
|
||||||
@constructor_class@::@constructor_class@(JS::GlobalObject& global_object)
|
@constructor_class@::@constructor_class@(JS::Realm& realm)
|
||||||
: NativeFunction(*global_object.function_prototype())
|
: NativeFunction(*realm.global_object().function_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3065,7 +3066,7 @@ namespace Web::Bindings {
|
||||||
class @prototype_class@ : public JS::Object {
|
class @prototype_class@ : public JS::Object {
|
||||||
JS_OBJECT(@prototype_class@, JS::Object);
|
JS_OBJECT(@prototype_class@, JS::Object);
|
||||||
public:
|
public:
|
||||||
explicit @prototype_class@(JS::GlobalObject&);
|
explicit @prototype_class@(JS::Realm&);
|
||||||
virtual void initialize(JS::GlobalObject&) override;
|
virtual void initialize(JS::GlobalObject&) override;
|
||||||
virtual ~@prototype_class@() override;
|
virtual ~@prototype_class@() override;
|
||||||
private:
|
private:
|
||||||
|
@ -3210,20 +3211,20 @@ using namespace Web::WebGL;
|
||||||
|
|
||||||
namespace Web::Bindings {
|
namespace Web::Bindings {
|
||||||
|
|
||||||
@prototype_class@::@prototype_class@([[maybe_unused]] JS::GlobalObject& global_object))~~~");
|
@prototype_class@::@prototype_class@([[maybe_unused]] JS::Realm& realm))~~~");
|
||||||
if (interface.name == "DOMException") {
|
if (interface.name == "DOMException") {
|
||||||
// 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(*global_object.error_prototype())
|
: Object(*realm.global_object().error_prototype())
|
||||||
)~~~");
|
)~~~");
|
||||||
} else if (!interface.parent_name.is_empty()) {
|
} else if (!interface.parent_name.is_empty()) {
|
||||||
generator.append(R"~~~(
|
generator.append(R"~~~(
|
||||||
: Object(static_cast<WindowObject&>(global_object).ensure_web_prototype<@prototype_base_class@>("@parent_name@"))
|
: Object(static_cast<WindowObject&>(realm.global_object()).ensure_web_prototype<@prototype_base_class@>("@parent_name@"))
|
||||||
)~~~");
|
)~~~");
|
||||||
} else {
|
} else {
|
||||||
generator.append(R"~~~(
|
generator.append(R"~~~(
|
||||||
: Object(*global_object.object_prototype())
|
: Object(*realm.global_object().object_prototype())
|
||||||
)~~~");
|
)~~~");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3587,7 +3588,7 @@ class @wrapper_class@ : public Wrapper {
|
||||||
public:
|
public:
|
||||||
static @wrapper_class@* create(JS::GlobalObject&, @fully_qualified_name@&);
|
static @wrapper_class@* create(JS::GlobalObject&, @fully_qualified_name@&);
|
||||||
|
|
||||||
@wrapper_class@(JS::GlobalObject&, @fully_qualified_name@&);
|
@wrapper_class@(JS::Realm&, @fully_qualified_name@&);
|
||||||
virtual void initialize(JS::GlobalObject&) override;
|
virtual void initialize(JS::GlobalObject&) override;
|
||||||
virtual ~@wrapper_class@() override;
|
virtual ~@wrapper_class@() override;
|
||||||
|
|
||||||
|
@ -3659,11 +3660,12 @@ namespace Web::Bindings {
|
||||||
|
|
||||||
@wrapper_class@* @wrapper_class@::create(JS::GlobalObject& global_object, @fully_qualified_name@& impl)
|
@wrapper_class@* @wrapper_class@::create(JS::GlobalObject& global_object, @fully_qualified_name@& impl)
|
||||||
{
|
{
|
||||||
return global_object.heap().allocate<@wrapper_class@>(global_object, global_object, impl);
|
auto& realm = *global_object.associated_realm();
|
||||||
|
return global_object.heap().allocate<@wrapper_class@>(global_object, realm, impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@wrapper_class@::@wrapper_class@(JS::GlobalObject& global_object, @fully_qualified_name@& impl)
|
@wrapper_class@::@wrapper_class@(JS::Realm& realm, @fully_qualified_name@& impl)
|
||||||
: Wrapper(static_cast<WindowObject&>(global_object).ensure_web_prototype<@prototype_class@>("@name@"))
|
: Wrapper(static_cast<WindowObject&>(realm.global_object()).ensure_web_prototype<@prototype_class@>("@name@"))
|
||||||
, m_impl(impl)
|
, m_impl(impl)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -3712,7 +3714,7 @@ namespace Web::Bindings {
|
||||||
class @prototype_class@ : public JS::Object {
|
class @prototype_class@ : public JS::Object {
|
||||||
JS_OBJECT(@prototype_class@, JS::Object);
|
JS_OBJECT(@prototype_class@, JS::Object);
|
||||||
public:
|
public:
|
||||||
explicit @prototype_class@(JS::GlobalObject&);
|
explicit @prototype_class@(JS::Realm&);
|
||||||
virtual void initialize(JS::GlobalObject&) override;
|
virtual void initialize(JS::GlobalObject&) override;
|
||||||
virtual ~@prototype_class@() override;
|
virtual ~@prototype_class@() override;
|
||||||
|
|
||||||
|
@ -3776,8 +3778,8 @@ using namespace Web::WebGL;
|
||||||
|
|
||||||
namespace Web::Bindings {
|
namespace Web::Bindings {
|
||||||
|
|
||||||
@prototype_class@::@prototype_class@(JS::GlobalObject& global_object)
|
@prototype_class@::@prototype_class@(JS::Realm& realm)
|
||||||
: Object(*global_object.iterator_prototype())
|
: Object(*realm.global_object().iterator_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -365,8 +365,8 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::get_column_bound)
|
||||||
return JS::Value(bounds.row);
|
return JS::Value(bounds.row);
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkbookObject::WorkbookObject(Workbook& workbook, JS::GlobalObject& global_object)
|
WorkbookObject::WorkbookObject(JS::Realm& realm, Workbook& workbook)
|
||||||
: JS::Object(*JS::Object::create(global_object, global_object.object_prototype()))
|
: JS::Object(*realm.global_object().object_prototype())
|
||||||
, m_workbook(workbook)
|
, m_workbook(workbook)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ class WorkbookObject final : public JS::Object {
|
||||||
JS_OBJECT(WorkbookObject, JS::Object);
|
JS_OBJECT(WorkbookObject, JS::Object);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WorkbookObject(Workbook&, JS::GlobalObject&);
|
WorkbookObject(JS::Realm&, Workbook&);
|
||||||
|
|
||||||
virtual ~WorkbookObject() override = default;
|
virtual ~WorkbookObject() override = default;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ Workbook::Workbook(NonnullRefPtrVector<Sheet>&& sheets, GUI::Window& parent_wind
|
||||||
, m_main_execution_context(m_vm->heap())
|
, m_main_execution_context(m_vm->heap())
|
||||||
, m_parent_window(parent_window)
|
, m_parent_window(parent_window)
|
||||||
{
|
{
|
||||||
m_workbook_object = m_vm->heap().allocate<WorkbookObject>(m_interpreter->global_object(), *this, m_interpreter->global_object());
|
m_workbook_object = m_vm->heap().allocate<WorkbookObject>(m_interpreter->global_object(), m_interpreter->realm(), *this);
|
||||||
m_interpreter->global_object().define_direct_property("workbook", workbook_object(), JS::default_attributes);
|
m_interpreter->global_object().define_direct_property("workbook", workbook_object(), JS::default_attributes);
|
||||||
|
|
||||||
m_main_execution_context.current_node = nullptr;
|
m_main_execution_context.current_node = nullptr;
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
|
|
||||||
namespace JS::Test262 {
|
namespace JS::Test262 {
|
||||||
|
|
||||||
$262Object::$262Object(JS::GlobalObject& global_object)
|
$262Object::$262Object(Realm& realm)
|
||||||
: Object(Object::ConstructWithoutPrototypeTag::Tag, global_object)
|
: Object(Object::ConstructWithoutPrototypeTag::Tag, realm)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,8 +27,9 @@ void $262Object::initialize(JS::GlobalObject& global_object)
|
||||||
{
|
{
|
||||||
Base::initialize(global_object);
|
Base::initialize(global_object);
|
||||||
|
|
||||||
m_agent = vm().heap().allocate<AgentObject>(global_object, global_object);
|
auto& realm = *global_object.associated_realm();
|
||||||
m_is_htmldda = vm().heap().allocate<IsHTMLDDA>(global_object, global_object);
|
m_agent = vm().heap().allocate<AgentObject>(global_object, realm);
|
||||||
|
m_is_htmldda = vm().heap().allocate<IsHTMLDDA>(global_object, realm);
|
||||||
|
|
||||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||||
define_native_function("clearKeptObjects", clear_kept_objects, 0, attr);
|
define_native_function("clearKeptObjects", clear_kept_objects, 0, attr);
|
||||||
|
|
|
@ -17,7 +17,7 @@ class $262Object final : public Object {
|
||||||
JS_OBJECT($262Object, Object);
|
JS_OBJECT($262Object, Object);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
$262Object(JS::GlobalObject&);
|
explicit $262Object(Realm&);
|
||||||
virtual void initialize(JS::GlobalObject&) override;
|
virtual void initialize(JS::GlobalObject&) override;
|
||||||
virtual ~$262Object() override = default;
|
virtual ~$262Object() override = default;
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
namespace JS::Test262 {
|
namespace JS::Test262 {
|
||||||
|
|
||||||
AgentObject::AgentObject(JS::GlobalObject& global_object)
|
AgentObject::AgentObject(Realm& realm)
|
||||||
: Object(Object::ConstructWithoutPrototypeTag::Tag, global_object)
|
: Object(Object::ConstructWithoutPrototypeTag::Tag, realm)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class AgentObject final : public Object {
|
||||||
JS_OBJECT(AgentObject, Object);
|
JS_OBJECT(AgentObject, Object);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AgentObject(JS::GlobalObject&);
|
explicit AgentObject(Realm&);
|
||||||
virtual void initialize(JS::GlobalObject&) override;
|
virtual void initialize(JS::GlobalObject&) override;
|
||||||
virtual ~AgentObject() override = default;
|
virtual ~AgentObject() override = default;
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,8 @@ void GlobalObject::initialize_global_object()
|
||||||
{
|
{
|
||||||
Base::initialize_global_object();
|
Base::initialize_global_object();
|
||||||
|
|
||||||
m_$262 = vm().heap().allocate<$262Object>(*this, *this);
|
auto& realm = *associated_realm();
|
||||||
|
m_$262 = vm().heap().allocate<$262Object>(*this, realm);
|
||||||
|
|
||||||
// https://github.com/tc39/test262/blob/master/INTERPRETING.md#host-defined-functions
|
// https://github.com/tc39/test262/blob/master/INTERPRETING.md#host-defined-functions
|
||||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
|
|
||||||
namespace JS::Test262 {
|
namespace JS::Test262 {
|
||||||
|
|
||||||
IsHTMLDDA::IsHTMLDDA(JS::GlobalObject& global_object)
|
IsHTMLDDA::IsHTMLDDA(Realm& realm)
|
||||||
// NativeFunction without prototype is currently not possible (only due to the lack of a ctor that supports it)
|
// NativeFunction without prototype is currently not possible (only due to the lack of a ctor that supports it)
|
||||||
: NativeFunction("IsHTMLDDA", *global_object.function_prototype())
|
: NativeFunction("IsHTMLDDA", *realm.global_object().function_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class IsHTMLDDA final : public NativeFunction {
|
||||||
JS_OBJECT(IsHTMLDDA, NativeFunction);
|
JS_OBJECT(IsHTMLDDA, NativeFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit IsHTMLDDA(JS::GlobalObject&);
|
explicit IsHTMLDDA(Realm&);
|
||||||
virtual ~IsHTMLDDA() override = default;
|
virtual ~IsHTMLDDA() override = default;
|
||||||
|
|
||||||
virtual ThrowCompletionOr<Value> call() override;
|
virtual ThrowCompletionOr<Value> call() override;
|
||||||
|
|
|
@ -97,7 +97,7 @@ Object* Module::module_namespace_create(VM& vm, Vector<FlyString> unambiguous_na
|
||||||
// 6. Let sortedExports be a List whose elements are the elements of exports ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using undefined as comparefn.
|
// 6. Let sortedExports be a List whose elements are the elements of exports ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using undefined as comparefn.
|
||||||
// 7. Set M.[[Exports]] to sortedExports.
|
// 7. Set M.[[Exports]] to sortedExports.
|
||||||
// 8. Create own properties of M corresponding to the definitions in 28.3.
|
// 8. Create own properties of M corresponding to the definitions in 28.3.
|
||||||
Object* module_namespace = vm.heap().allocate<ModuleNamespaceObject>(realm().global_object(), realm().global_object(), this, move(unambiguous_names));
|
Object* module_namespace = vm.heap().allocate<ModuleNamespaceObject>(realm().global_object(), realm(), this, move(unambiguous_names));
|
||||||
|
|
||||||
// 9. Set module.[[Namespace]] to M.
|
// 9. Set module.[[Namespace]] to M.
|
||||||
m_namespace = make_handle(module_namespace);
|
m_namespace = make_handle(module_namespace);
|
||||||
|
|
|
@ -1076,6 +1076,7 @@ Object* create_unmapped_arguments_object(GlobalObject& global_object, Span<Value
|
||||||
Object* create_mapped_arguments_object(GlobalObject& global_object, FunctionObject& function, Vector<FunctionNode::Parameter> const& formals, Span<Value> arguments, Environment& environment)
|
Object* create_mapped_arguments_object(GlobalObject& global_object, FunctionObject& function, Vector<FunctionNode::Parameter> const& formals, Span<Value> arguments, Environment& environment)
|
||||||
{
|
{
|
||||||
auto& vm = global_object.vm();
|
auto& vm = global_object.vm();
|
||||||
|
auto& realm = *global_object.associated_realm();
|
||||||
|
|
||||||
// 1. Assert: formals does not contain a rest parameter, any binding patterns, or any initializers. It may contain duplicate identifiers.
|
// 1. Assert: formals does not contain a rest parameter, any binding patterns, or any initializers. It may contain duplicate identifiers.
|
||||||
|
|
||||||
|
@ -1090,7 +1091,7 @@ Object* create_mapped_arguments_object(GlobalObject& global_object, FunctionObje
|
||||||
// 7. Set obj.[[Set]] as specified in 10.4.4.4.
|
// 7. Set obj.[[Set]] as specified in 10.4.4.4.
|
||||||
// 8. Set obj.[[Delete]] as specified in 10.4.4.5.
|
// 8. Set obj.[[Delete]] as specified in 10.4.4.5.
|
||||||
// 9. Set obj.[[Prototype]] to %Object.prototype%.
|
// 9. Set obj.[[Prototype]] to %Object.prototype%.
|
||||||
auto* object = vm.heap().allocate<ArgumentsObject>(global_object, global_object, environment);
|
auto* object = vm.heap().allocate<ArgumentsObject>(global_object, realm, environment);
|
||||||
|
|
||||||
// 14. Let index be 0.
|
// 14. Let index be 0.
|
||||||
// 15. Repeat, while index < len,
|
// 15. Repeat, while index < len,
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
AggregateErrorConstructor::AggregateErrorConstructor(GlobalObject& global_object)
|
AggregateErrorConstructor::AggregateErrorConstructor(Realm& realm)
|
||||||
: NativeFunction(*static_cast<Object*>(global_object.error_constructor()))
|
: NativeFunction(static_cast<Object&>(*realm.global_object().error_constructor()))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class AggregateErrorConstructor final : public NativeFunction {
|
||||||
JS_OBJECT(AggregateErrorConstructor, NativeFunction);
|
JS_OBJECT(AggregateErrorConstructor, NativeFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AggregateErrorConstructor(GlobalObject&);
|
explicit AggregateErrorConstructor(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~AggregateErrorConstructor() override = default;
|
virtual ~AggregateErrorConstructor() override = default;
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
AggregateErrorPrototype::AggregateErrorPrototype(GlobalObject& global_object)
|
AggregateErrorPrototype::AggregateErrorPrototype(Realm& realm)
|
||||||
: Object(*global_object.error_prototype())
|
: Object(*realm.global_object().error_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class AggregateErrorPrototype final : public Object {
|
||||||
JS_OBJECT(AggregateErrorPrototype, Object);
|
JS_OBJECT(AggregateErrorPrototype, Object);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AggregateErrorPrototype(GlobalObject&);
|
explicit AggregateErrorPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~AggregateErrorPrototype() override = default;
|
virtual ~AggregateErrorPrototype() override = default;
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
ArgumentsObject::ArgumentsObject(GlobalObject& global_object, Environment& environment)
|
ArgumentsObject::ArgumentsObject(Realm& realm, Environment& environment)
|
||||||
: Object(*global_object.object_prototype())
|
: Object(*realm.global_object().object_prototype())
|
||||||
, m_environment(environment)
|
, m_environment(environment)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ class ArgumentsObject final : public Object {
|
||||||
JS_OBJECT(ArgumentsObject, Object);
|
JS_OBJECT(ArgumentsObject, Object);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ArgumentsObject(GlobalObject&, Environment&);
|
ArgumentsObject(Realm&, Environment&);
|
||||||
|
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~ArgumentsObject() override = default;
|
virtual ~ArgumentsObject() override = default;
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
ArrayBufferConstructor::ArrayBufferConstructor(GlobalObject& global_object)
|
ArrayBufferConstructor::ArrayBufferConstructor(Realm& realm)
|
||||||
: NativeFunction(vm().names.ArrayBuffer.as_string(), *global_object.function_prototype())
|
: NativeFunction(vm().names.ArrayBuffer.as_string(), *realm.global_object().function_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class ArrayBufferConstructor final : public NativeFunction {
|
||||||
JS_OBJECT(ArrayBufferConstructor, NativeFunction);
|
JS_OBJECT(ArrayBufferConstructor, NativeFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ArrayBufferConstructor(GlobalObject&);
|
explicit ArrayBufferConstructor(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~ArrayBufferConstructor() override = default;
|
virtual ~ArrayBufferConstructor() override = default;
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
ArrayBufferPrototype::ArrayBufferPrototype(GlobalObject& global_object)
|
ArrayBufferPrototype::ArrayBufferPrototype(Realm& realm)
|
||||||
: PrototypeObject(*global_object.object_prototype())
|
: PrototypeObject(*realm.global_object().object_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class ArrayBufferPrototype final : public PrototypeObject<ArrayBufferPrototype,
|
||||||
JS_PROTOTYPE_OBJECT(ArrayBufferPrototype, ArrayBuffer, ArrayBuffer);
|
JS_PROTOTYPE_OBJECT(ArrayBufferPrototype, ArrayBuffer, ArrayBuffer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ArrayBufferPrototype(GlobalObject&);
|
explicit ArrayBufferPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~ArrayBufferPrototype() override = default;
|
virtual ~ArrayBufferPrototype() override = default;
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
ArrayConstructor::ArrayConstructor(GlobalObject& global_object)
|
ArrayConstructor::ArrayConstructor(Realm& realm)
|
||||||
: NativeFunction(vm().names.Array.as_string(), *global_object.function_prototype())
|
: NativeFunction(vm().names.Array.as_string(), *realm.global_object().function_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class ArrayConstructor final : public NativeFunction {
|
||||||
JS_OBJECT(ArrayConstructor, NativeFunction);
|
JS_OBJECT(ArrayConstructor, NativeFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ArrayConstructor(GlobalObject&);
|
explicit ArrayConstructor(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~ArrayConstructor() override = default;
|
virtual ~ArrayConstructor() override = default;
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
ArrayIteratorPrototype::ArrayIteratorPrototype(GlobalObject& global_object)
|
ArrayIteratorPrototype::ArrayIteratorPrototype(Realm& realm)
|
||||||
: PrototypeObject(*global_object.iterator_prototype())
|
: PrototypeObject(*realm.global_object().iterator_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class ArrayIteratorPrototype final : public PrototypeObject<ArrayIteratorPrototy
|
||||||
JS_PROTOTYPE_OBJECT(ArrayIteratorPrototype, ArrayIterator, ArrayIterator);
|
JS_PROTOTYPE_OBJECT(ArrayIteratorPrototype, ArrayIterator, ArrayIterator);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ArrayIteratorPrototype(GlobalObject&);
|
ArrayIteratorPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~ArrayIteratorPrototype() override = default;
|
virtual ~ArrayIteratorPrototype() override = default;
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,8 @@ namespace JS {
|
||||||
|
|
||||||
static HashTable<Object*> s_array_join_seen_objects;
|
static HashTable<Object*> s_array_join_seen_objects;
|
||||||
|
|
||||||
ArrayPrototype::ArrayPrototype(GlobalObject& global_object)
|
ArrayPrototype::ArrayPrototype(Realm& realm)
|
||||||
: Array(*global_object.object_prototype())
|
: Array(*realm.global_object().object_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class ArrayPrototype final : public Array {
|
||||||
JS_OBJECT(ArrayPrototype, Array);
|
JS_OBJECT(ArrayPrototype, Array);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ArrayPrototype(GlobalObject&);
|
ArrayPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~ArrayPrototype() override = default;
|
virtual ~ArrayPrototype() override = default;
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,12 @@ namespace JS {
|
||||||
|
|
||||||
AsyncFromSyncIterator* AsyncFromSyncIterator::create(GlobalObject& global_object, Iterator sync_iterator_record)
|
AsyncFromSyncIterator* AsyncFromSyncIterator::create(GlobalObject& global_object, Iterator sync_iterator_record)
|
||||||
{
|
{
|
||||||
return global_object.heap().allocate<AsyncFromSyncIterator>(global_object, global_object, sync_iterator_record);
|
auto& realm = *global_object.associated_realm();
|
||||||
|
return global_object.heap().allocate<AsyncFromSyncIterator>(global_object, realm, sync_iterator_record);
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncFromSyncIterator::AsyncFromSyncIterator(GlobalObject& global_object, Iterator sync_iterator_record)
|
AsyncFromSyncIterator::AsyncFromSyncIterator(Realm& realm, Iterator sync_iterator_record)
|
||||||
: Object(*global_object.async_from_sync_iterator_prototype())
|
: Object(*realm.global_object().async_from_sync_iterator_prototype())
|
||||||
, m_sync_iterator_record(sync_iterator_record)
|
, m_sync_iterator_record(sync_iterator_record)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ class AsyncFromSyncIterator final : public Object {
|
||||||
public:
|
public:
|
||||||
static AsyncFromSyncIterator* create(GlobalObject&, Iterator sync_iterator_record);
|
static AsyncFromSyncIterator* create(GlobalObject&, Iterator sync_iterator_record);
|
||||||
|
|
||||||
explicit AsyncFromSyncIterator(GlobalObject&, Iterator sync_iterator_record);
|
explicit AsyncFromSyncIterator(Realm&, Iterator sync_iterator_record);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~AsyncFromSyncIterator() override = default;
|
virtual ~AsyncFromSyncIterator() override = default;
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
AsyncFromSyncIteratorPrototype::AsyncFromSyncIteratorPrototype(GlobalObject& global_object)
|
AsyncFromSyncIteratorPrototype::AsyncFromSyncIteratorPrototype(Realm& realm)
|
||||||
: PrototypeObject(*global_object.async_iterator_prototype())
|
: PrototypeObject(*realm.global_object().async_iterator_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ class AsyncFromSyncIteratorPrototype final : public PrototypeObject<AsyncFromSyn
|
||||||
JS_PROTOTYPE_OBJECT(AsyncFromSyncIteratorPrototype, AsyncFromSyncIterator, AsyncFromSyncIterator);
|
JS_PROTOTYPE_OBJECT(AsyncFromSyncIteratorPrototype, AsyncFromSyncIterator, AsyncFromSyncIterator);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AsyncFromSyncIteratorPrototype(GlobalObject&);
|
explicit AsyncFromSyncIteratorPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~AsyncFromSyncIteratorPrototype() override = default;
|
virtual ~AsyncFromSyncIteratorPrototype() override = default;
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
AsyncFunctionConstructor::AsyncFunctionConstructor(GlobalObject& global_object)
|
AsyncFunctionConstructor::AsyncFunctionConstructor(Realm& realm)
|
||||||
: NativeFunction(vm().names.AsyncFunction.as_string(), *global_object.function_constructor())
|
: NativeFunction(vm().names.AsyncFunction.as_string(), *realm.global_object().function_constructor())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class AsyncFunctionConstructor final : public NativeFunction {
|
||||||
JS_OBJECT(AsyncFunctionConstructor, NativeFunction);
|
JS_OBJECT(AsyncFunctionConstructor, NativeFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AsyncFunctionConstructor(GlobalObject&);
|
explicit AsyncFunctionConstructor(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~AsyncFunctionConstructor() override = default;
|
virtual ~AsyncFunctionConstructor() override = default;
|
||||||
|
|
||||||
|
|
|
@ -14,17 +14,18 @@ namespace JS {
|
||||||
|
|
||||||
ThrowCompletionOr<Value> AsyncFunctionDriverWrapper::create(GlobalObject& global_object, GeneratorObject* generator_object)
|
ThrowCompletionOr<Value> AsyncFunctionDriverWrapper::create(GlobalObject& global_object, GeneratorObject* generator_object)
|
||||||
{
|
{
|
||||||
auto wrapper = global_object.heap().allocate<AsyncFunctionDriverWrapper>(global_object, global_object, generator_object);
|
auto& realm = *global_object.associated_realm();
|
||||||
|
auto wrapper = global_object.heap().allocate<AsyncFunctionDriverWrapper>(global_object, realm, generator_object);
|
||||||
return wrapper->react_to_async_task_completion(global_object.vm(), global_object, js_undefined(), true);
|
return wrapper->react_to_async_task_completion(global_object.vm(), global_object, js_undefined(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncFunctionDriverWrapper::AsyncFunctionDriverWrapper(GlobalObject& global_object, GeneratorObject* generator_object)
|
AsyncFunctionDriverWrapper::AsyncFunctionDriverWrapper(Realm& realm, GeneratorObject* generator_object)
|
||||||
: Promise(*global_object.promise_prototype())
|
: Promise(*realm.global_object().promise_prototype())
|
||||||
, m_generator_object(generator_object)
|
, m_generator_object(generator_object)
|
||||||
, m_on_fulfillment(NativeFunction::create(global_object, "async.on_fulfillment"sv, [this](VM& vm, GlobalObject& global_object) {
|
, m_on_fulfillment(NativeFunction::create(realm.global_object(), "async.on_fulfillment"sv, [this](VM& vm, GlobalObject& global_object) {
|
||||||
return react_to_async_task_completion(vm, global_object, vm.argument(0), true);
|
return react_to_async_task_completion(vm, global_object, vm.argument(0), true);
|
||||||
}))
|
}))
|
||||||
, m_on_rejection(NativeFunction::create(global_object, "async.on_rejection"sv, [this](VM& vm, GlobalObject& global_object) {
|
, m_on_rejection(NativeFunction::create(realm.global_object(), "async.on_rejection"sv, [this](VM& vm, GlobalObject& global_object) {
|
||||||
return react_to_async_task_completion(vm, global_object, vm.argument(0), false);
|
return react_to_async_task_completion(vm, global_object, vm.argument(0), false);
|
||||||
}))
|
}))
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@ class AsyncFunctionDriverWrapper final : public Promise {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static ThrowCompletionOr<Value> create(GlobalObject&, GeneratorObject*);
|
static ThrowCompletionOr<Value> create(GlobalObject&, GeneratorObject*);
|
||||||
explicit AsyncFunctionDriverWrapper(GlobalObject&, GeneratorObject*);
|
explicit AsyncFunctionDriverWrapper(Realm&, GeneratorObject*);
|
||||||
|
|
||||||
virtual ~AsyncFunctionDriverWrapper() override = default;
|
virtual ~AsyncFunctionDriverWrapper() override = default;
|
||||||
void visit_edges(Cell::Visitor&) override;
|
void visit_edges(Cell::Visitor&) override;
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
AsyncFunctionPrototype::AsyncFunctionPrototype(GlobalObject& global_object)
|
AsyncFunctionPrototype::AsyncFunctionPrototype(Realm& realm)
|
||||||
: Object(*global_object.function_prototype())
|
: Object(*realm.global_object().function_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class AsyncFunctionPrototype final : public Object {
|
||||||
JS_OBJECT(AsyncFunctionPrototype, Object);
|
JS_OBJECT(AsyncFunctionPrototype, Object);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AsyncFunctionPrototype(GlobalObject&);
|
explicit AsyncFunctionPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~AsyncFunctionPrototype() override = default;
|
virtual ~AsyncFunctionPrototype() override = default;
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
AsyncGeneratorFunctionConstructor::AsyncGeneratorFunctionConstructor(GlobalObject& global_object)
|
AsyncGeneratorFunctionConstructor::AsyncGeneratorFunctionConstructor(Realm& realm)
|
||||||
: NativeFunction(vm().names.AsyncGeneratorFunction.as_string(), *global_object.function_prototype())
|
: NativeFunction(vm().names.AsyncGeneratorFunction.as_string(), *realm.global_object().function_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class AsyncGeneratorFunctionConstructor final : public NativeFunction {
|
||||||
JS_OBJECT(AsyncGeneratorFunctionConstructor, NativeFunction);
|
JS_OBJECT(AsyncGeneratorFunctionConstructor, NativeFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AsyncGeneratorFunctionConstructor(GlobalObject&);
|
explicit AsyncGeneratorFunctionConstructor(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~AsyncGeneratorFunctionConstructor() override = default;
|
virtual ~AsyncGeneratorFunctionConstructor() override = default;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
AsyncGeneratorFunctionPrototype::AsyncGeneratorFunctionPrototype(GlobalObject& global_object)
|
AsyncGeneratorFunctionPrototype::AsyncGeneratorFunctionPrototype(Realm& realm)
|
||||||
: PrototypeObject(*global_object.function_prototype())
|
: PrototypeObject(*realm.global_object().function_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class AsyncGeneratorFunctionPrototype final : public PrototypeObject<AsyncGenera
|
||||||
JS_PROTOTYPE_OBJECT(AsyncGeneratorFunctionPrototype, AsyncGeneratorFunction, AsyncGeneratorFunction);
|
JS_PROTOTYPE_OBJECT(AsyncGeneratorFunctionPrototype, AsyncGeneratorFunction, AsyncGeneratorFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AsyncGeneratorFunctionPrototype(GlobalObject&);
|
explicit AsyncGeneratorFunctionPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~AsyncGeneratorFunctionPrototype() override = default;
|
virtual ~AsyncGeneratorFunctionPrototype() override = default;
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
// 27.6.1 Properties of the AsyncGenerator Prototype Object, https://tc39.es/ecma262/#sec-properties-of-asyncgenerator-prototype
|
// 27.6.1 Properties of the AsyncGenerator Prototype Object, https://tc39.es/ecma262/#sec-properties-of-asyncgenerator-prototype
|
||||||
AsyncGeneratorPrototype::AsyncGeneratorPrototype(GlobalObject& global_object)
|
AsyncGeneratorPrototype::AsyncGeneratorPrototype(Realm& realm)
|
||||||
: PrototypeObject(*global_object.async_iterator_prototype())
|
: PrototypeObject(*realm.global_object().async_iterator_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class AsyncGeneratorPrototype final : public PrototypeObject<AsyncGeneratorProto
|
||||||
JS_PROTOTYPE_OBJECT(AsyncGeneratorPrototype, AsyncGenerator, AsyncGenerator)
|
JS_PROTOTYPE_OBJECT(AsyncGeneratorPrototype, AsyncGenerator, AsyncGenerator)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AsyncGeneratorPrototype(GlobalObject&);
|
explicit AsyncGeneratorPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~AsyncGeneratorPrototype() override = default;
|
virtual ~AsyncGeneratorPrototype() override = default;
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
AsyncIteratorPrototype::AsyncIteratorPrototype(GlobalObject& global_object)
|
AsyncIteratorPrototype::AsyncIteratorPrototype(Realm& realm)
|
||||||
: Object(*global_object.object_prototype())
|
: Object(*realm.global_object().object_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class AsyncIteratorPrototype final : public Object {
|
||||||
JS_OBJECT(AsyncIteratorPrototype, Object)
|
JS_OBJECT(AsyncIteratorPrototype, Object)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AsyncIteratorPrototype(GlobalObject&);
|
explicit AsyncIteratorPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~AsyncIteratorPrototype() override = default;
|
virtual ~AsyncIteratorPrototype() override = default;
|
||||||
|
|
||||||
|
|
|
@ -129,8 +129,8 @@ static ThrowCompletionOr<Value> perform_atomic_operation(GlobalObject& global_ob
|
||||||
return atomic_read_modify_write(global_object, typed_array, index, value, move(operation_wrapper));
|
return atomic_read_modify_write(global_object, typed_array, index, value, move(operation_wrapper));
|
||||||
}
|
}
|
||||||
|
|
||||||
AtomicsObject::AtomicsObject(GlobalObject& global_object)
|
AtomicsObject::AtomicsObject(Realm& realm)
|
||||||
: Object(*global_object.object_prototype())
|
: Object(*realm.global_object().object_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class AtomicsObject : public Object {
|
||||||
JS_OBJECT(AtomicsObject, Object);
|
JS_OBJECT(AtomicsObject, Object);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AtomicsObject(GlobalObject&);
|
explicit AtomicsObject(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~AtomicsObject() override = default;
|
virtual ~AtomicsObject() override = default;
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ namespace JS {
|
||||||
|
|
||||||
static const Crypto::SignedBigInteger BIGINT_ONE { 1 };
|
static const Crypto::SignedBigInteger BIGINT_ONE { 1 };
|
||||||
|
|
||||||
BigIntConstructor::BigIntConstructor(GlobalObject& global_object)
|
BigIntConstructor::BigIntConstructor(Realm& realm)
|
||||||
: NativeFunction(vm().names.BigInt.as_string(), *global_object.function_prototype())
|
: NativeFunction(vm().names.BigInt.as_string(), *realm.global_object().function_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class BigIntConstructor final : public NativeFunction {
|
||||||
JS_OBJECT(BigIntConstructor, NativeFunction);
|
JS_OBJECT(BigIntConstructor, NativeFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BigIntConstructor(GlobalObject&);
|
explicit BigIntConstructor(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~BigIntConstructor() override = default;
|
virtual ~BigIntConstructor() override = default;
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
BigIntPrototype::BigIntPrototype(GlobalObject& global_object)
|
BigIntPrototype::BigIntPrototype(Realm& realm)
|
||||||
: Object(*global_object.object_prototype())
|
: Object(*realm.global_object().object_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class BigIntPrototype final : public Object {
|
||||||
JS_OBJECT(BigIntPrototype, Object);
|
JS_OBJECT(BigIntPrototype, Object);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BigIntPrototype(GlobalObject&);
|
explicit BigIntPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~BigIntPrototype() override = default;
|
virtual ~BigIntPrototype() override = default;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
BooleanConstructor::BooleanConstructor(GlobalObject& global_object)
|
BooleanConstructor::BooleanConstructor(Realm& realm)
|
||||||
: NativeFunction(vm().names.Boolean.as_string(), *global_object.function_prototype())
|
: NativeFunction(vm().names.Boolean.as_string(), *realm.global_object().function_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class BooleanConstructor final : public NativeFunction {
|
||||||
JS_OBJECT(BooleanConstructor, NativeFunction);
|
JS_OBJECT(BooleanConstructor, NativeFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BooleanConstructor(GlobalObject&);
|
explicit BooleanConstructor(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~BooleanConstructor() override = default;
|
virtual ~BooleanConstructor() override = default;
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
BooleanPrototype::BooleanPrototype(GlobalObject& global_object)
|
BooleanPrototype::BooleanPrototype(Realm& realm)
|
||||||
: BooleanObject(false, *global_object.object_prototype())
|
: BooleanObject(false, *realm.global_object().object_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class BooleanPrototype final : public BooleanObject {
|
||||||
JS_OBJECT(BooleanPrototype, BooleanObject);
|
JS_OBJECT(BooleanPrototype, BooleanObject);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BooleanPrototype(GlobalObject&);
|
explicit BooleanPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~BooleanPrototype() override = default;
|
virtual ~BooleanPrototype() override = default;
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@ namespace JS {
|
||||||
// 10.4.1.3 BoundFunctionCreate ( targetFunction, boundThis, boundArgs ), https://tc39.es/ecma262/#sec-boundfunctioncreate
|
// 10.4.1.3 BoundFunctionCreate ( targetFunction, boundThis, boundArgs ), https://tc39.es/ecma262/#sec-boundfunctioncreate
|
||||||
ThrowCompletionOr<BoundFunction*> BoundFunction::create(GlobalObject& global_object, FunctionObject& target_function, Value bound_this, Vector<Value> bound_arguments)
|
ThrowCompletionOr<BoundFunction*> BoundFunction::create(GlobalObject& global_object, FunctionObject& target_function, Value bound_this, Vector<Value> bound_arguments)
|
||||||
{
|
{
|
||||||
|
auto& realm = *global_object.associated_realm();
|
||||||
|
|
||||||
// 1. Let proto be ? targetFunction.[[GetPrototypeOf]]().
|
// 1. Let proto be ? targetFunction.[[GetPrototypeOf]]().
|
||||||
auto* prototype = TRY(target_function.internal_get_prototype_of());
|
auto* prototype = TRY(target_function.internal_get_prototype_of());
|
||||||
|
|
||||||
|
@ -26,14 +28,14 @@ ThrowCompletionOr<BoundFunction*> BoundFunction::create(GlobalObject& global_obj
|
||||||
// 7. Set obj.[[BoundTargetFunction]] to targetFunction.
|
// 7. Set obj.[[BoundTargetFunction]] to targetFunction.
|
||||||
// 8. Set obj.[[BoundThis]] to boundThis.
|
// 8. Set obj.[[BoundThis]] to boundThis.
|
||||||
// 9. Set obj.[[BoundArguments]] to boundArgs.
|
// 9. Set obj.[[BoundArguments]] to boundArgs.
|
||||||
auto* object = global_object.heap().allocate<BoundFunction>(global_object, global_object, target_function, bound_this, move(bound_arguments), prototype);
|
auto* object = global_object.heap().allocate<BoundFunction>(global_object, realm, target_function, bound_this, move(bound_arguments), prototype);
|
||||||
|
|
||||||
// 10. Return obj.
|
// 10. Return obj.
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
BoundFunction::BoundFunction(GlobalObject& global_object, FunctionObject& bound_target_function, Value bound_this, Vector<Value> bound_arguments, Object* prototype)
|
BoundFunction::BoundFunction(Realm& realm, FunctionObject& bound_target_function, Value bound_this, Vector<Value> bound_arguments, Object* prototype)
|
||||||
: FunctionObject(global_object, prototype)
|
: FunctionObject(realm, prototype)
|
||||||
, m_bound_target_function(&bound_target_function)
|
, m_bound_target_function(&bound_target_function)
|
||||||
, m_bound_this(bound_this)
|
, m_bound_this(bound_this)
|
||||||
, m_bound_arguments(move(bound_arguments))
|
, m_bound_arguments(move(bound_arguments))
|
||||||
|
|
|
@ -17,7 +17,7 @@ class BoundFunction final : public FunctionObject {
|
||||||
public:
|
public:
|
||||||
static ThrowCompletionOr<BoundFunction*> create(GlobalObject&, FunctionObject& target_function, Value bound_this, Vector<Value> bound_arguments);
|
static ThrowCompletionOr<BoundFunction*> create(GlobalObject&, FunctionObject& target_function, Value bound_this, Vector<Value> bound_arguments);
|
||||||
|
|
||||||
BoundFunction(GlobalObject&, FunctionObject& target_function, Value bound_this, Vector<Value> bound_arguments, Object* prototype);
|
BoundFunction(Realm&, FunctionObject& target_function, Value bound_this, Vector<Value> bound_arguments, Object* prototype);
|
||||||
virtual ~BoundFunction() override = default;
|
virtual ~BoundFunction() override = default;
|
||||||
|
|
||||||
virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override;
|
virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override;
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
ConsoleObject::ConsoleObject(GlobalObject& global_object)
|
ConsoleObject::ConsoleObject(Realm& realm)
|
||||||
: Object(*global_object.object_prototype())
|
: Object(*realm.global_object().object_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class ConsoleObject final : public Object {
|
||||||
JS_OBJECT(ConsoleObject, Object);
|
JS_OBJECT(ConsoleObject, Object);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ConsoleObject(GlobalObject&);
|
explicit ConsoleObject(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~ConsoleObject() override = default;
|
virtual ~ConsoleObject() override = default;
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
DataViewConstructor::DataViewConstructor(GlobalObject& global_object)
|
DataViewConstructor::DataViewConstructor(Realm& realm)
|
||||||
: NativeFunction(vm().names.DataView.as_string(), *global_object.function_prototype())
|
: NativeFunction(vm().names.DataView.as_string(), *realm.global_object().function_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class DataViewConstructor final : public NativeFunction {
|
||||||
JS_OBJECT(DataViewConstructor, NativeFunction);
|
JS_OBJECT(DataViewConstructor, NativeFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DataViewConstructor(GlobalObject&);
|
explicit DataViewConstructor(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~DataViewConstructor() override = default;
|
virtual ~DataViewConstructor() override = default;
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
DataViewPrototype::DataViewPrototype(GlobalObject& global_object)
|
DataViewPrototype::DataViewPrototype(Realm& realm)
|
||||||
: PrototypeObject(*global_object.object_prototype())
|
: PrototypeObject(*realm.global_object().object_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class DataViewPrototype final : public PrototypeObject<DataViewPrototype, DataVi
|
||||||
JS_PROTOTYPE_OBJECT(DataViewPrototype, DataView, DataView);
|
JS_PROTOTYPE_OBJECT(DataViewPrototype, DataView, DataView);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DataViewPrototype(GlobalObject&);
|
DataViewPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~DataViewPrototype() override = default;
|
virtual ~DataViewPrototype() override = default;
|
||||||
|
|
||||||
|
|
|
@ -162,8 +162,8 @@ static double parse_date_string(String const& date_string)
|
||||||
return NAN;
|
return NAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
DateConstructor::DateConstructor(GlobalObject& global_object)
|
DateConstructor::DateConstructor(Realm& realm)
|
||||||
: NativeFunction(vm().names.Date.as_string(), *global_object.function_prototype())
|
: NativeFunction(vm().names.Date.as_string(), *realm.global_object().function_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class DateConstructor final : public NativeFunction {
|
||||||
JS_OBJECT(DateConstructor, NativeFunction);
|
JS_OBJECT(DateConstructor, NativeFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DateConstructor(GlobalObject&);
|
explicit DateConstructor(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~DateConstructor() override = default;
|
virtual ~DateConstructor() override = default;
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
DatePrototype::DatePrototype(GlobalObject& global_object)
|
DatePrototype::DatePrototype(Realm& realm)
|
||||||
: PrototypeObject(*global_object.object_prototype())
|
: PrototypeObject(*realm.global_object().object_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class DatePrototype final : public PrototypeObject<DatePrototype, Date> {
|
||||||
JS_PROTOTYPE_OBJECT(DatePrototype, Date, Date);
|
JS_PROTOTYPE_OBJECT(DatePrototype, Date, Date);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DatePrototype(GlobalObject&);
|
explicit DatePrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~DatePrototype() override = default;
|
virtual ~DatePrototype() override = default;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
ErrorConstructor::ErrorConstructor(GlobalObject& global_object)
|
ErrorConstructor::ErrorConstructor(Realm& realm)
|
||||||
: NativeFunction(vm().names.Error.as_string(), *global_object.function_prototype())
|
: NativeFunction(vm().names.Error.as_string(), *realm.global_object().function_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,8 +63,8 @@ ThrowCompletionOr<Object*> ErrorConstructor::construct(FunctionObject& new_targe
|
||||||
}
|
}
|
||||||
|
|
||||||
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \
|
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \
|
||||||
ConstructorName::ConstructorName(GlobalObject& global_object) \
|
ConstructorName::ConstructorName(Realm& realm) \
|
||||||
: NativeFunction(vm().names.ClassName.as_string(), *static_cast<Object*>(global_object.error_constructor())) \
|
: NativeFunction(vm().names.ClassName.as_string(), *static_cast<Object*>(realm.global_object().error_constructor())) \
|
||||||
{ \
|
{ \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
|
|
|
@ -15,7 +15,7 @@ class ErrorConstructor final : public NativeFunction {
|
||||||
JS_OBJECT(ErrorConstructor, NativeFunction);
|
JS_OBJECT(ErrorConstructor, NativeFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ErrorConstructor(GlobalObject&);
|
explicit ErrorConstructor(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~ErrorConstructor() override = default;
|
virtual ~ErrorConstructor() override = default;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ private:
|
||||||
JS_OBJECT(ConstructorName, NativeFunction); \
|
JS_OBJECT(ConstructorName, NativeFunction); \
|
||||||
\
|
\
|
||||||
public: \
|
public: \
|
||||||
explicit ConstructorName(GlobalObject&); \
|
explicit ConstructorName(Realm&); \
|
||||||
virtual void initialize(GlobalObject&) override; \
|
virtual void initialize(GlobalObject&) override; \
|
||||||
virtual ~ConstructorName() override; \
|
virtual ~ConstructorName() override; \
|
||||||
virtual ThrowCompletionOr<Value> call() override; \
|
virtual ThrowCompletionOr<Value> call() override; \
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
ErrorPrototype::ErrorPrototype(GlobalObject& global_object)
|
ErrorPrototype::ErrorPrototype(Realm& realm)
|
||||||
: PrototypeObject(*global_object.object_prototype())
|
: PrototypeObject(*realm.global_object().object_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,8 +124,8 @@ JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::stack_setter)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \
|
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \
|
||||||
PrototypeName::PrototypeName(GlobalObject& global_object) \
|
PrototypeName::PrototypeName(Realm& realm) \
|
||||||
: PrototypeObject(*global_object.error_prototype()) \
|
: PrototypeObject(*realm.global_object().error_prototype()) \
|
||||||
{ \
|
{ \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
|
|
|
@ -16,7 +16,7 @@ class ErrorPrototype final : public PrototypeObject<ErrorPrototype, Error> {
|
||||||
JS_PROTOTYPE_OBJECT(ErrorPrototype, Error, Error);
|
JS_PROTOTYPE_OBJECT(ErrorPrototype, Error, Error);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ErrorPrototype(GlobalObject&);
|
explicit ErrorPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~ErrorPrototype() override = default;
|
virtual ~ErrorPrototype() override = default;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ private:
|
||||||
JS_PROTOTYPE_OBJECT(PrototypeName, ClassName, ClassName); \
|
JS_PROTOTYPE_OBJECT(PrototypeName, ClassName, ClassName); \
|
||||||
\
|
\
|
||||||
public: \
|
public: \
|
||||||
explicit PrototypeName(GlobalObject&); \
|
explicit PrototypeName(Realm&); \
|
||||||
virtual void initialize(GlobalObject&) override; \
|
virtual void initialize(GlobalObject&) override; \
|
||||||
virtual ~PrototypeName() override = default; \
|
virtual ~PrototypeName() override = default; \
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
FinalizationRegistryConstructor::FinalizationRegistryConstructor(GlobalObject& global_object)
|
FinalizationRegistryConstructor::FinalizationRegistryConstructor(Realm& realm)
|
||||||
: NativeFunction(vm().names.FinalizationRegistry.as_string(), *global_object.function_prototype())
|
: NativeFunction(vm().names.FinalizationRegistry.as_string(), *realm.global_object().function_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class FinalizationRegistryConstructor final : public NativeFunction {
|
||||||
JS_OBJECT(FinalizationRegistryConstructor, NativeFunction);
|
JS_OBJECT(FinalizationRegistryConstructor, NativeFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FinalizationRegistryConstructor(GlobalObject&);
|
explicit FinalizationRegistryConstructor(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~FinalizationRegistryConstructor() override = default;
|
virtual ~FinalizationRegistryConstructor() override = default;
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
FinalizationRegistryPrototype::FinalizationRegistryPrototype(GlobalObject& global_object)
|
FinalizationRegistryPrototype::FinalizationRegistryPrototype(Realm& realm)
|
||||||
: PrototypeObject(*global_object.object_prototype())
|
: PrototypeObject(*realm.global_object().object_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class FinalizationRegistryPrototype final : public PrototypeObject<FinalizationR
|
||||||
JS_PROTOTYPE_OBJECT(FinalizationRegistryPrototype, FinalizationRegistry, FinalizationRegistry);
|
JS_PROTOTYPE_OBJECT(FinalizationRegistryPrototype, FinalizationRegistry, FinalizationRegistry);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FinalizationRegistryPrototype(GlobalObject&);
|
FinalizationRegistryPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~FinalizationRegistryPrototype() override = default;
|
virtual ~FinalizationRegistryPrototype() override = default;
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
FunctionConstructor::FunctionConstructor(GlobalObject& global_object)
|
FunctionConstructor::FunctionConstructor(Realm& realm)
|
||||||
: NativeFunction(vm().names.Function.as_string(), *global_object.function_prototype())
|
: NativeFunction(vm().names.Function.as_string(), *realm.global_object().function_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ class FunctionConstructor final : public NativeFunction {
|
||||||
public:
|
public:
|
||||||
static ThrowCompletionOr<ECMAScriptFunctionObject*> create_dynamic_function(GlobalObject& global_object, FunctionObject& constructor, FunctionObject* new_target, FunctionKind kind, MarkedVector<Value> const& args);
|
static ThrowCompletionOr<ECMAScriptFunctionObject*> create_dynamic_function(GlobalObject& global_object, FunctionObject& constructor, FunctionObject* new_target, FunctionKind kind, MarkedVector<Value> const& args);
|
||||||
|
|
||||||
explicit FunctionConstructor(GlobalObject&);
|
explicit FunctionConstructor(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~FunctionConstructor() override = default;
|
virtual ~FunctionConstructor() override = default;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
FunctionObject::FunctionObject(GlobalObject& global_object, Object* prototype)
|
FunctionObject::FunctionObject(Realm& realm, Object* prototype)
|
||||||
: Object(global_object, prototype)
|
: Object(realm, prototype)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
virtual Realm* realm() const { return nullptr; }
|
virtual Realm* realm() const { return nullptr; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit FunctionObject(GlobalObject&, Object* prototype);
|
explicit FunctionObject(Realm&, Object* prototype);
|
||||||
explicit FunctionObject(Object& prototype);
|
explicit FunctionObject(Object& prototype);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
FunctionPrototype::FunctionPrototype(GlobalObject& global_object)
|
FunctionPrototype::FunctionPrototype(Realm& realm)
|
||||||
: FunctionObject(*global_object.object_prototype())
|
: FunctionObject(*realm.global_object().object_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class FunctionPrototype final : public FunctionObject {
|
||||||
JS_OBJECT(FunctionPrototype, FunctionObject);
|
JS_OBJECT(FunctionPrototype, FunctionObject);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FunctionPrototype(GlobalObject&);
|
explicit FunctionPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~FunctionPrototype() override = default;
|
virtual ~FunctionPrototype() override = default;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
GeneratorFunctionConstructor::GeneratorFunctionConstructor(GlobalObject& global_object)
|
GeneratorFunctionConstructor::GeneratorFunctionConstructor(Realm& realm)
|
||||||
: NativeFunction(*static_cast<Object*>(global_object.function_constructor()))
|
: NativeFunction(static_cast<Object&>(*realm.global_object().function_constructor()))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class GeneratorFunctionConstructor final : public NativeFunction {
|
||||||
JS_OBJECT(GeneratorFunctionConstructor, NativeFunction);
|
JS_OBJECT(GeneratorFunctionConstructor, NativeFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GeneratorFunctionConstructor(GlobalObject&);
|
explicit GeneratorFunctionConstructor(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~GeneratorFunctionConstructor() override = default;
|
virtual ~GeneratorFunctionConstructor() override = default;
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
GeneratorFunctionPrototype::GeneratorFunctionPrototype(GlobalObject& global_object)
|
GeneratorFunctionPrototype::GeneratorFunctionPrototype(Realm& realm)
|
||||||
: Object(*global_object.function_prototype())
|
: Object(*realm.global_object().function_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class GeneratorFunctionPrototype final : public Object {
|
||||||
JS_OBJECT(GeneratorFunctionPrototype, Object);
|
JS_OBJECT(GeneratorFunctionPrototype, Object);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GeneratorFunctionPrototype(GlobalObject&);
|
explicit GeneratorFunctionPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~GeneratorFunctionPrototype() override = default;
|
virtual ~GeneratorFunctionPrototype() override = default;
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,6 +15,8 @@ namespace JS {
|
||||||
|
|
||||||
ThrowCompletionOr<GeneratorObject*> GeneratorObject::create(GlobalObject& global_object, Value initial_value, ECMAScriptFunctionObject* generating_function, ExecutionContext execution_context, Bytecode::RegisterWindow frame)
|
ThrowCompletionOr<GeneratorObject*> GeneratorObject::create(GlobalObject& global_object, Value initial_value, ECMAScriptFunctionObject* generating_function, ExecutionContext execution_context, Bytecode::RegisterWindow frame)
|
||||||
{
|
{
|
||||||
|
auto& realm = *global_object.associated_realm();
|
||||||
|
|
||||||
// This is "g1.prototype" in figure-2 (https://tc39.es/ecma262/img/figure-2.png)
|
// This is "g1.prototype" in figure-2 (https://tc39.es/ecma262/img/figure-2.png)
|
||||||
Value generating_function_prototype;
|
Value generating_function_prototype;
|
||||||
if (generating_function->kind() == FunctionKind::Async) {
|
if (generating_function->kind() == FunctionKind::Async) {
|
||||||
|
@ -26,14 +28,14 @@ ThrowCompletionOr<GeneratorObject*> GeneratorObject::create(GlobalObject& global
|
||||||
generating_function_prototype = TRY(generating_function->get(global_object.vm().names.prototype));
|
generating_function_prototype = TRY(generating_function->get(global_object.vm().names.prototype));
|
||||||
}
|
}
|
||||||
auto* generating_function_prototype_object = TRY(generating_function_prototype.to_object(global_object));
|
auto* generating_function_prototype_object = TRY(generating_function_prototype.to_object(global_object));
|
||||||
auto object = global_object.heap().allocate<GeneratorObject>(global_object, global_object, *generating_function_prototype_object, move(execution_context));
|
auto object = global_object.heap().allocate<GeneratorObject>(global_object, realm, *generating_function_prototype_object, move(execution_context));
|
||||||
object->m_generating_function = generating_function;
|
object->m_generating_function = generating_function;
|
||||||
object->m_frame = move(frame);
|
object->m_frame = move(frame);
|
||||||
object->m_previous_value = initial_value;
|
object->m_previous_value = initial_value;
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneratorObject::GeneratorObject(GlobalObject&, Object& prototype, ExecutionContext context)
|
GeneratorObject::GeneratorObject(Realm&, Object& prototype, ExecutionContext context)
|
||||||
: Object(prototype)
|
: Object(prototype)
|
||||||
, m_execution_context(move(context))
|
, m_execution_context(move(context))
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,7 @@ class GeneratorObject final : public Object {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static ThrowCompletionOr<GeneratorObject*> create(GlobalObject&, Value, ECMAScriptFunctionObject*, ExecutionContext, Bytecode::RegisterWindow);
|
static ThrowCompletionOr<GeneratorObject*> create(GlobalObject&, Value, ECMAScriptFunctionObject*, ExecutionContext, Bytecode::RegisterWindow);
|
||||||
GeneratorObject(GlobalObject&, Object& prototype, ExecutionContext);
|
GeneratorObject(Realm&, Object& prototype, ExecutionContext);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~GeneratorObject() override = default;
|
virtual ~GeneratorObject() override = default;
|
||||||
void visit_edges(Cell::Visitor&) override;
|
void visit_edges(Cell::Visitor&) override;
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
GeneratorPrototype::GeneratorPrototype(GlobalObject& global_object)
|
GeneratorPrototype::GeneratorPrototype(Realm& realm)
|
||||||
: PrototypeObject(*global_object.iterator_prototype())
|
: PrototypeObject(*realm.global_object().iterator_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class GeneratorPrototype final : public PrototypeObject<GeneratorPrototype, Gene
|
||||||
JS_PROTOTYPE_OBJECT(GeneratorPrototype, GeneratorObject, Generator);
|
JS_PROTOTYPE_OBJECT(GeneratorPrototype, GeneratorObject, Generator);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GeneratorPrototype(GlobalObject&);
|
explicit GeneratorPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~GeneratorPrototype() override = default;
|
virtual ~GeneratorPrototype() override = default;
|
||||||
|
|
||||||
|
|
|
@ -155,8 +155,8 @@ void GlobalObject::initialize_global_object()
|
||||||
VERIFY(associated_realm());
|
VERIFY(associated_realm());
|
||||||
auto& realm = *associated_realm();
|
auto& realm = *associated_realm();
|
||||||
m_empty_object_shape = heap().allocate_without_global_object<Shape>(realm);
|
m_empty_object_shape = heap().allocate_without_global_object<Shape>(realm);
|
||||||
m_object_prototype = heap().allocate_without_global_object<ObjectPrototype>(*this);
|
m_object_prototype = heap().allocate_without_global_object<ObjectPrototype>(realm);
|
||||||
m_function_prototype = heap().allocate_without_global_object<FunctionPrototype>(*this);
|
m_function_prototype = heap().allocate_without_global_object<FunctionPrototype>(realm);
|
||||||
|
|
||||||
m_new_object_shape = vm.heap().allocate_without_global_object<Shape>(realm);
|
m_new_object_shape = vm.heap().allocate_without_global_object<Shape>(realm);
|
||||||
m_new_object_shape->set_prototype_without_transition(m_object_prototype);
|
m_new_object_shape->set_prototype_without_transition(m_object_prototype);
|
||||||
|
@ -174,29 +174,29 @@ void GlobalObject::initialize_global_object()
|
||||||
Object::set_prototype(m_object_prototype);
|
Object::set_prototype(m_object_prototype);
|
||||||
|
|
||||||
// This must be initialized before allocating AggregateErrorPrototype, which uses ErrorPrototype as its prototype.
|
// This must be initialized before allocating AggregateErrorPrototype, which uses ErrorPrototype as its prototype.
|
||||||
m_error_prototype = heap().allocate<ErrorPrototype>(*this, *this);
|
m_error_prototype = heap().allocate<ErrorPrototype>(*this, realm);
|
||||||
|
|
||||||
#define __JS_ENUMERATE(ClassName, snake_name) \
|
#define __JS_ENUMERATE(ClassName, snake_name) \
|
||||||
if (!m_##snake_name##_prototype) \
|
if (!m_##snake_name##_prototype) \
|
||||||
m_##snake_name##_prototype = heap().allocate<ClassName##Prototype>(*this, *this);
|
m_##snake_name##_prototype = heap().allocate<ClassName##Prototype>(*this, realm);
|
||||||
JS_ENUMERATE_ITERATOR_PROTOTYPES
|
JS_ENUMERATE_ITERATOR_PROTOTYPES
|
||||||
#undef __JS_ENUMERATE
|
#undef __JS_ENUMERATE
|
||||||
|
|
||||||
// These must be initialized separately as they have no companion constructor
|
// These must be initialized separately as they have no companion constructor
|
||||||
m_async_from_sync_iterator_prototype = heap().allocate<AsyncFromSyncIteratorPrototype>(*this, *this);
|
m_async_from_sync_iterator_prototype = heap().allocate<AsyncFromSyncIteratorPrototype>(*this, realm);
|
||||||
m_async_generator_prototype = heap().allocate<AsyncGeneratorPrototype>(*this, *this);
|
m_async_generator_prototype = heap().allocate<AsyncGeneratorPrototype>(*this, realm);
|
||||||
m_generator_prototype = heap().allocate<GeneratorPrototype>(*this, *this);
|
m_generator_prototype = heap().allocate<GeneratorPrototype>(*this, realm);
|
||||||
m_intl_segments_prototype = heap().allocate<Intl::SegmentsPrototype>(*this, *this);
|
m_intl_segments_prototype = heap().allocate<Intl::SegmentsPrototype>(*this, realm);
|
||||||
|
|
||||||
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \
|
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \
|
||||||
if (!m_##snake_name##_prototype) \
|
if (!m_##snake_name##_prototype) \
|
||||||
m_##snake_name##_prototype = heap().allocate<PrototypeName>(*this, *this);
|
m_##snake_name##_prototype = heap().allocate<PrototypeName>(*this, realm);
|
||||||
JS_ENUMERATE_BUILTIN_TYPES
|
JS_ENUMERATE_BUILTIN_TYPES
|
||||||
#undef __JS_ENUMERATE
|
#undef __JS_ENUMERATE
|
||||||
|
|
||||||
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName) \
|
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName) \
|
||||||
if (!m_intl_##snake_name##_prototype) \
|
if (!m_intl_##snake_name##_prototype) \
|
||||||
m_intl_##snake_name##_prototype = heap().allocate<Intl::PrototypeName>(*this, *this);
|
m_intl_##snake_name##_prototype = heap().allocate<Intl::PrototypeName>(*this, realm);
|
||||||
JS_ENUMERATE_INTL_OBJECTS
|
JS_ENUMERATE_INTL_OBJECTS
|
||||||
#undef __JS_ENUMERATE
|
#undef __JS_ENUMERATE
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ void GlobalObject::initialize_global_object()
|
||||||
|
|
||||||
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName) \
|
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName) \
|
||||||
if (!m_temporal_##snake_name##_prototype) \
|
if (!m_temporal_##snake_name##_prototype) \
|
||||||
m_temporal_##snake_name##_prototype = heap().allocate<Temporal::PrototypeName>(*this, *this);
|
m_temporal_##snake_name##_prototype = heap().allocate<Temporal::PrototypeName>(*this, realm);
|
||||||
JS_ENUMERATE_TEMPORAL_OBJECTS
|
JS_ENUMERATE_TEMPORAL_OBJECTS
|
||||||
#undef __JS_ENUMERATE
|
#undef __JS_ENUMERATE
|
||||||
|
|
||||||
|
@ -250,13 +250,13 @@ void GlobalObject::initialize_global_object()
|
||||||
define_direct_property(vm.names.undefined, js_undefined(), 0);
|
define_direct_property(vm.names.undefined, js_undefined(), 0);
|
||||||
|
|
||||||
define_direct_property(vm.names.globalThis, this, attr);
|
define_direct_property(vm.names.globalThis, this, attr);
|
||||||
define_direct_property(vm.names.console, heap().allocate<ConsoleObject>(*this, *this), attr);
|
define_direct_property(vm.names.console, heap().allocate<ConsoleObject>(*this, realm), attr);
|
||||||
define_direct_property(vm.names.Atomics, heap().allocate<AtomicsObject>(*this, *this), attr);
|
define_direct_property(vm.names.Atomics, heap().allocate<AtomicsObject>(*this, realm), attr);
|
||||||
define_direct_property(vm.names.Math, heap().allocate<MathObject>(*this, *this), attr);
|
define_direct_property(vm.names.Math, heap().allocate<MathObject>(*this, realm), attr);
|
||||||
define_direct_property(vm.names.JSON, heap().allocate<JSONObject>(*this, *this), attr);
|
define_direct_property(vm.names.JSON, heap().allocate<JSONObject>(*this, realm), attr);
|
||||||
define_direct_property(vm.names.Reflect, heap().allocate<ReflectObject>(*this, *this), attr);
|
define_direct_property(vm.names.Reflect, heap().allocate<ReflectObject>(*this, realm), attr);
|
||||||
define_direct_property(vm.names.Intl, heap().allocate<Intl::Intl>(*this, *this), attr);
|
define_direct_property(vm.names.Intl, heap().allocate<Intl::Intl>(*this, realm), attr);
|
||||||
define_direct_property(vm.names.Temporal, heap().allocate<Temporal::Temporal>(*this, *this), attr);
|
define_direct_property(vm.names.Temporal, heap().allocate<Temporal::Temporal>(*this, realm), attr);
|
||||||
|
|
||||||
// This must be initialized before allocating AggregateErrorConstructor, which uses ErrorConstructor as its prototype.
|
// This must be initialized before allocating AggregateErrorConstructor, which uses ErrorConstructor as its prototype.
|
||||||
initialize_constructor(vm.names.Error, m_error_constructor, m_error_prototype);
|
initialize_constructor(vm.names.Error, m_error_constructor, m_error_prototype);
|
||||||
|
|
|
@ -177,7 +177,8 @@ template<typename ConstructorType>
|
||||||
inline void GlobalObject::initialize_constructor(PropertyKey const& property_key, ConstructorType*& constructor, Object* prototype, PropertyAttributes attributes)
|
inline void GlobalObject::initialize_constructor(PropertyKey const& property_key, ConstructorType*& constructor, Object* prototype, PropertyAttributes attributes)
|
||||||
{
|
{
|
||||||
auto& vm = this->vm();
|
auto& vm = this->vm();
|
||||||
constructor = heap().allocate<ConstructorType>(*this, *this);
|
auto& realm = *associated_realm();
|
||||||
|
constructor = heap().allocate<ConstructorType>(*this, realm);
|
||||||
constructor->define_direct_property(vm.names.name, js_string(heap(), property_key.as_string()), Attribute::Configurable);
|
constructor->define_direct_property(vm.names.name, js_string(heap(), property_key.as_string()), Attribute::Configurable);
|
||||||
if (prototype)
|
if (prototype)
|
||||||
prototype->define_direct_property(vm.names.constructor, constructor, attributes);
|
prototype->define_direct_property(vm.names.constructor, constructor, attributes);
|
||||||
|
|
|
@ -13,11 +13,12 @@ namespace JS::Intl {
|
||||||
|
|
||||||
CollatorCompareFunction* CollatorCompareFunction::create(GlobalObject& global_object, Collator& collator)
|
CollatorCompareFunction* CollatorCompareFunction::create(GlobalObject& global_object, Collator& collator)
|
||||||
{
|
{
|
||||||
return global_object.heap().allocate<CollatorCompareFunction>(global_object, global_object, collator);
|
auto& realm = *global_object.associated_realm();
|
||||||
|
return global_object.heap().allocate<CollatorCompareFunction>(global_object, realm, collator);
|
||||||
}
|
}
|
||||||
|
|
||||||
CollatorCompareFunction::CollatorCompareFunction(GlobalObject& global_object, Collator& collator)
|
CollatorCompareFunction::CollatorCompareFunction(Realm& realm, Collator& collator)
|
||||||
: NativeFunction(*global_object.function_prototype())
|
: NativeFunction(*realm.global_object().function_prototype())
|
||||||
, m_collator(collator)
|
, m_collator(collator)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ class CollatorCompareFunction : public NativeFunction {
|
||||||
public:
|
public:
|
||||||
static CollatorCompareFunction* create(GlobalObject&, Collator&);
|
static CollatorCompareFunction* create(GlobalObject&, Collator&);
|
||||||
|
|
||||||
explicit CollatorCompareFunction(GlobalObject&, Collator&);
|
CollatorCompareFunction(Realm&, Collator&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~CollatorCompareFunction() override = default;
|
virtual ~CollatorCompareFunction() override = default;
|
||||||
|
|
||||||
|
|
|
@ -132,8 +132,8 @@ static ThrowCompletionOr<Collator*> initialize_collator(GlobalObject& global_obj
|
||||||
}
|
}
|
||||||
|
|
||||||
// 10.1 The Intl.Collator Constructor, https://tc39.es/ecma402/#sec-the-intl-collator-constructor
|
// 10.1 The Intl.Collator Constructor, https://tc39.es/ecma402/#sec-the-intl-collator-constructor
|
||||||
CollatorConstructor::CollatorConstructor(GlobalObject& global_object)
|
CollatorConstructor::CollatorConstructor(Realm& realm)
|
||||||
: NativeFunction(vm().names.Collator.as_string(), *global_object.function_prototype())
|
: NativeFunction(vm().names.Collator.as_string(), *realm.global_object().function_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class CollatorConstructor final : public NativeFunction {
|
||||||
JS_OBJECT(CollatorConstructor, NativeFunction);
|
JS_OBJECT(CollatorConstructor, NativeFunction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CollatorConstructor(GlobalObject&);
|
explicit CollatorConstructor(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~CollatorConstructor() override = default;
|
virtual ~CollatorConstructor() override = default;
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
namespace JS::Intl {
|
namespace JS::Intl {
|
||||||
|
|
||||||
// 10.3 Properties of the Intl.Collator Prototype Object, https://tc39.es/ecma402/#sec-properties-of-the-intl-collator-prototype-object
|
// 10.3 Properties of the Intl.Collator Prototype Object, https://tc39.es/ecma402/#sec-properties-of-the-intl-collator-prototype-object
|
||||||
CollatorPrototype::CollatorPrototype(GlobalObject& global_object)
|
CollatorPrototype::CollatorPrototype(Realm& realm)
|
||||||
: PrototypeObject(*global_object.object_prototype())
|
: PrototypeObject(*realm.global_object().object_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class CollatorPrototype final : public PrototypeObject<CollatorPrototype, Collat
|
||||||
JS_PROTOTYPE_OBJECT(CollatorPrototype, Collator, Collator);
|
JS_PROTOTYPE_OBJECT(CollatorPrototype, Collator, Collator);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CollatorPrototype(GlobalObject&);
|
explicit CollatorPrototype(Realm&);
|
||||||
virtual void initialize(GlobalObject&) override;
|
virtual void initialize(GlobalObject&) override;
|
||||||
virtual ~CollatorPrototype() override = default;
|
virtual ~CollatorPrototype() override = default;
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
namespace JS::Intl {
|
namespace JS::Intl {
|
||||||
|
|
||||||
// 11.1 The Intl.DateTimeFormat Constructor, https://tc39.es/ecma402/#sec-intl-datetimeformat-constructor
|
// 11.1 The Intl.DateTimeFormat Constructor, https://tc39.es/ecma402/#sec-intl-datetimeformat-constructor
|
||||||
DateTimeFormatConstructor::DateTimeFormatConstructor(GlobalObject& global_object)
|
DateTimeFormatConstructor::DateTimeFormatConstructor(Realm& realm)
|
||||||
: NativeFunction(vm().names.DateTimeFormat.as_string(), *global_object.function_prototype())
|
: NativeFunction(vm().names.DateTimeFormat.as_string(), *realm.global_object().function_prototype())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue