From aaf6014ae11adc246a212d7bb201c16549718b22 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 22 Jul 2020 17:50:18 +0200 Subject: LibJS: Simplify Cell::initialize() Remove the Interpreter& argument and pass only GlobalObject&. We can find everything we need via the global object anyway. --- Libraries/LibJS/Runtime/ArrayConstructor.cpp | 4 ++-- Libraries/LibJS/Runtime/ArrayConstructor.h | 2 +- Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp | 16 ++++++++-------- Libraries/LibJS/Runtime/ArrayIteratorPrototype.h | 2 +- Libraries/LibJS/Runtime/ArrayPrototype.cpp | 6 +++--- Libraries/LibJS/Runtime/ArrayPrototype.h | 2 +- Libraries/LibJS/Runtime/BigIntConstructor.cpp | 4 ++-- Libraries/LibJS/Runtime/BigIntConstructor.h | 2 +- Libraries/LibJS/Runtime/BigIntPrototype.cpp | 6 +++--- Libraries/LibJS/Runtime/BigIntPrototype.h | 2 +- Libraries/LibJS/Runtime/BooleanConstructor.cpp | 4 ++-- Libraries/LibJS/Runtime/BooleanConstructor.h | 2 +- Libraries/LibJS/Runtime/BooleanPrototype.cpp | 4 ++-- Libraries/LibJS/Runtime/BooleanPrototype.h | 2 +- Libraries/LibJS/Runtime/BoundFunction.cpp | 4 ++-- Libraries/LibJS/Runtime/BoundFunction.h | 2 +- Libraries/LibJS/Runtime/Cell.h | 2 +- Libraries/LibJS/Runtime/ConsoleObject.cpp | 4 ++-- Libraries/LibJS/Runtime/ConsoleObject.h | 2 +- Libraries/LibJS/Runtime/DateConstructor.cpp | 4 ++-- Libraries/LibJS/Runtime/DateConstructor.h | 2 +- Libraries/LibJS/Runtime/DatePrototype.cpp | 4 ++-- Libraries/LibJS/Runtime/DatePrototype.h | 2 +- Libraries/LibJS/Runtime/ErrorConstructor.cpp | 8 ++++---- Libraries/LibJS/Runtime/ErrorConstructor.h | 4 ++-- Libraries/LibJS/Runtime/ErrorPrototype.cpp | 4 ++-- Libraries/LibJS/Runtime/ErrorPrototype.h | 4 ++-- Libraries/LibJS/Runtime/Function.h | 2 +- Libraries/LibJS/Runtime/FunctionConstructor.cpp | 4 ++-- Libraries/LibJS/Runtime/FunctionConstructor.h | 2 +- Libraries/LibJS/Runtime/FunctionPrototype.cpp | 6 +++--- Libraries/LibJS/Runtime/FunctionPrototype.h | 2 +- Libraries/LibJS/Runtime/GlobalObject.cpp | 4 ++-- Libraries/LibJS/Runtime/IteratorOperations.cpp | 4 ++-- Libraries/LibJS/Runtime/IteratorOperations.h | 2 +- Libraries/LibJS/Runtime/IteratorPrototype.cpp | 6 +++--- Libraries/LibJS/Runtime/IteratorPrototype.h | 2 +- Libraries/LibJS/Runtime/JSONObject.cpp | 12 ++++++------ Libraries/LibJS/Runtime/JSONObject.h | 2 +- Libraries/LibJS/Runtime/MathObject.cpp | 6 +++--- Libraries/LibJS/Runtime/MathObject.h | 2 +- Libraries/LibJS/Runtime/NativeFunction.h | 2 +- Libraries/LibJS/Runtime/NumberConstructor.cpp | 4 ++-- Libraries/LibJS/Runtime/NumberConstructor.h | 2 +- Libraries/LibJS/Runtime/NumberPrototype.cpp | 4 ++-- Libraries/LibJS/Runtime/NumberPrototype.h | 2 +- Libraries/LibJS/Runtime/Object.cpp | 6 +++--- Libraries/LibJS/Runtime/Object.h | 4 ++-- Libraries/LibJS/Runtime/ObjectConstructor.cpp | 8 ++++---- Libraries/LibJS/Runtime/ObjectConstructor.h | 2 +- Libraries/LibJS/Runtime/ObjectPrototype.cpp | 6 +++--- Libraries/LibJS/Runtime/ObjectPrototype.h | 2 +- Libraries/LibJS/Runtime/ProxyConstructor.cpp | 4 ++-- Libraries/LibJS/Runtime/ProxyConstructor.h | 2 +- Libraries/LibJS/Runtime/ReflectObject.cpp | 4 ++-- Libraries/LibJS/Runtime/ReflectObject.h | 2 +- Libraries/LibJS/Runtime/RegExpConstructor.cpp | 4 ++-- Libraries/LibJS/Runtime/RegExpConstructor.h | 2 +- Libraries/LibJS/Runtime/ScriptFunction.cpp | 6 +++--- Libraries/LibJS/Runtime/ScriptFunction.h | 2 +- Libraries/LibJS/Runtime/StringConstructor.cpp | 4 ++-- Libraries/LibJS/Runtime/StringConstructor.h | 2 +- Libraries/LibJS/Runtime/StringIteratorPrototype.cpp | 12 ++++++------ Libraries/LibJS/Runtime/StringIteratorPrototype.h | 2 +- Libraries/LibJS/Runtime/StringPrototype.cpp | 6 +++--- Libraries/LibJS/Runtime/StringPrototype.h | 2 +- Libraries/LibJS/Runtime/SymbolConstructor.cpp | 6 +++--- Libraries/LibJS/Runtime/SymbolConstructor.h | 2 +- Libraries/LibJS/Runtime/SymbolPrototype.cpp | 6 +++--- Libraries/LibJS/Runtime/SymbolPrototype.h | 2 +- 70 files changed, 136 insertions(+), 136 deletions(-) (limited to 'Libraries/LibJS/Runtime') diff --git a/Libraries/LibJS/Runtime/ArrayConstructor.cpp b/Libraries/LibJS/Runtime/ArrayConstructor.cpp index b66d6ea417..0e4d4ce71a 100644 --- a/Libraries/LibJS/Runtime/ArrayConstructor.cpp +++ b/Libraries/LibJS/Runtime/ArrayConstructor.cpp @@ -45,9 +45,9 @@ ArrayConstructor::~ArrayConstructor() { } -void ArrayConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object) +void ArrayConstructor::initialize(GlobalObject& global_object) { - NativeFunction::initialize(interpreter, global_object); + NativeFunction::initialize(global_object); define_property("prototype", global_object.array_prototype(), 0); define_property("length", Value(1), Attribute::Configurable); diff --git a/Libraries/LibJS/Runtime/ArrayConstructor.h b/Libraries/LibJS/Runtime/ArrayConstructor.h index 89c7697ecc..91262d5122 100644 --- a/Libraries/LibJS/Runtime/ArrayConstructor.h +++ b/Libraries/LibJS/Runtime/ArrayConstructor.h @@ -35,7 +35,7 @@ class ArrayConstructor final : public NativeFunction { public: explicit ArrayConstructor(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~ArrayConstructor() override; virtual Value call(Interpreter&) override; diff --git a/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp b/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp index bf81141c87..1c7085fa89 100644 --- a/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp +++ b/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp @@ -38,12 +38,12 @@ ArrayIteratorPrototype::ArrayIteratorPrototype(GlobalObject& global_object) { } -void ArrayIteratorPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object) +void ArrayIteratorPrototype::initialize(GlobalObject& global_object) { - Object::initialize(interpreter, global_object); + Object::initialize(global_object); define_native_function("next", next, 0, Attribute::Configurable | Attribute::Writable); - define_property(interpreter.well_known_symbol_to_string_tag(), js_string(interpreter, "Array Iterator"), Attribute::Configurable); + define_property(global_object.interpreter().well_known_symbol_to_string_tag(), js_string(global_object.heap(), "Array Iterator"), Attribute::Configurable); } ArrayIteratorPrototype::~ArrayIteratorPrototype() @@ -61,7 +61,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayIteratorPrototype::next) auto& iterator = static_cast(this_object); auto target_array = iterator.array(); if (target_array.is_undefined()) - return create_iterator_result_object(interpreter, global_object, js_undefined(), true); + return create_iterator_result_object(global_object, js_undefined(), true); ASSERT(target_array.is_object()); auto& array = target_array.as_object(); @@ -72,23 +72,23 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayIteratorPrototype::next) if (index >= length) { iterator.m_array = js_undefined(); - return create_iterator_result_object(interpreter, global_object, js_undefined(), true); + return create_iterator_result_object(global_object, js_undefined(), true); } iterator.m_index++; if (iteration_kind == Object::PropertyKind::Key) - return create_iterator_result_object(interpreter, global_object, Value(static_cast(index)), false); + return create_iterator_result_object(global_object, Value(static_cast(index)), false); auto value = array.get(index); if (interpreter.exception()) return {}; if (iteration_kind == Object::PropertyKind::Value) - return create_iterator_result_object(interpreter, global_object, value, false); + return create_iterator_result_object(global_object, value, false); auto* entry_array = Array::create(global_object); entry_array->define_property(0, Value(static_cast(index))); entry_array->define_property(1, value); - return create_iterator_result_object(interpreter, global_object, entry_array, false); + return create_iterator_result_object(global_object, entry_array, false); } } diff --git a/Libraries/LibJS/Runtime/ArrayIteratorPrototype.h b/Libraries/LibJS/Runtime/ArrayIteratorPrototype.h index a04c9aae08..0e79a55ca5 100644 --- a/Libraries/LibJS/Runtime/ArrayIteratorPrototype.h +++ b/Libraries/LibJS/Runtime/ArrayIteratorPrototype.h @@ -35,7 +35,7 @@ class ArrayIteratorPrototype final : public Object { public: ArrayIteratorPrototype(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~ArrayIteratorPrototype() override; private: diff --git a/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Libraries/LibJS/Runtime/ArrayPrototype.cpp index f5408e5c79..c3bb9dac62 100644 --- a/Libraries/LibJS/Runtime/ArrayPrototype.cpp +++ b/Libraries/LibJS/Runtime/ArrayPrototype.cpp @@ -46,9 +46,9 @@ ArrayPrototype::ArrayPrototype(GlobalObject& global_object) { } -void ArrayPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object) +void ArrayPrototype::initialize(GlobalObject& global_object) { - Object::initialize(interpreter, global_object); + Object::initialize(global_object); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function("filter", filter, 1, attr); @@ -81,7 +81,7 @@ void ArrayPrototype::initialize(Interpreter& interpreter, GlobalObject& global_o // Use define_property here instead of define_native_function so that // Object.is(Array.prototype[Symbol.iterator], Array.prototype.values) // evaluates to true - define_property(interpreter.well_known_symbol_iterator(), get("values"), attr); + define_property(global_object.interpreter().well_known_symbol_iterator(), get("values"), attr); } ArrayPrototype::~ArrayPrototype() diff --git a/Libraries/LibJS/Runtime/ArrayPrototype.h b/Libraries/LibJS/Runtime/ArrayPrototype.h index a286725136..0632650481 100644 --- a/Libraries/LibJS/Runtime/ArrayPrototype.h +++ b/Libraries/LibJS/Runtime/ArrayPrototype.h @@ -36,7 +36,7 @@ class ArrayPrototype final : public Object { public: ArrayPrototype(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~ArrayPrototype() override; private: diff --git a/Libraries/LibJS/Runtime/BigIntConstructor.cpp b/Libraries/LibJS/Runtime/BigIntConstructor.cpp index ef9f35da55..8eed34a1a7 100644 --- a/Libraries/LibJS/Runtime/BigIntConstructor.cpp +++ b/Libraries/LibJS/Runtime/BigIntConstructor.cpp @@ -39,9 +39,9 @@ BigIntConstructor::BigIntConstructor(GlobalObject& global_object) { } -void BigIntConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object) +void BigIntConstructor::initialize(GlobalObject& global_object) { - NativeFunction::initialize(interpreter, global_object); + NativeFunction::initialize(global_object); define_property("prototype", global_object.bigint_prototype(), 0); define_property("length", Value(1), Attribute::Configurable); diff --git a/Libraries/LibJS/Runtime/BigIntConstructor.h b/Libraries/LibJS/Runtime/BigIntConstructor.h index 3f6245be7d..cc464deef2 100644 --- a/Libraries/LibJS/Runtime/BigIntConstructor.h +++ b/Libraries/LibJS/Runtime/BigIntConstructor.h @@ -35,7 +35,7 @@ class BigIntConstructor final : public NativeFunction { public: explicit BigIntConstructor(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~BigIntConstructor() override; virtual Value call(Interpreter&) override; diff --git a/Libraries/LibJS/Runtime/BigIntPrototype.cpp b/Libraries/LibJS/Runtime/BigIntPrototype.cpp index 6543e0e2ce..f2fc0f380d 100644 --- a/Libraries/LibJS/Runtime/BigIntPrototype.cpp +++ b/Libraries/LibJS/Runtime/BigIntPrototype.cpp @@ -37,15 +37,15 @@ BigIntPrototype::BigIntPrototype(GlobalObject& global_object) { } -void BigIntPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object) +void BigIntPrototype::initialize(GlobalObject& global_object) { - Object::initialize(interpreter, global_object); + Object::initialize(global_object); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function("toString", to_string, 0, attr); define_native_function("toLocaleString", to_locale_string, 0, attr); define_native_function("valueOf", value_of, 0, attr); - define_property(interpreter.well_known_symbol_to_string_tag(), js_string(interpreter, "BigInt"), Attribute::Configurable); + define_property(global_object.interpreter().well_known_symbol_to_string_tag(), js_string(global_object.heap(), "BigInt"), Attribute::Configurable); } BigIntPrototype::~BigIntPrototype() diff --git a/Libraries/LibJS/Runtime/BigIntPrototype.h b/Libraries/LibJS/Runtime/BigIntPrototype.h index 28e838fee3..c0e54a7c2a 100644 --- a/Libraries/LibJS/Runtime/BigIntPrototype.h +++ b/Libraries/LibJS/Runtime/BigIntPrototype.h @@ -35,7 +35,7 @@ class BigIntPrototype final : public Object { public: explicit BigIntPrototype(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~BigIntPrototype() override; private: diff --git a/Libraries/LibJS/Runtime/BooleanConstructor.cpp b/Libraries/LibJS/Runtime/BooleanConstructor.cpp index 6bb425b794..17f755aa34 100644 --- a/Libraries/LibJS/Runtime/BooleanConstructor.cpp +++ b/Libraries/LibJS/Runtime/BooleanConstructor.cpp @@ -38,9 +38,9 @@ BooleanConstructor::BooleanConstructor(GlobalObject& global_object) { } -void BooleanConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object) +void BooleanConstructor::initialize(GlobalObject& global_object) { - NativeFunction::initialize(interpreter, global_object); + NativeFunction::initialize(global_object); define_property("prototype", Value(global_object.boolean_prototype()), 0); define_property("length", Value(1), Attribute::Configurable); } diff --git a/Libraries/LibJS/Runtime/BooleanConstructor.h b/Libraries/LibJS/Runtime/BooleanConstructor.h index b7a6980bd6..1efc4a1022 100644 --- a/Libraries/LibJS/Runtime/BooleanConstructor.h +++ b/Libraries/LibJS/Runtime/BooleanConstructor.h @@ -35,7 +35,7 @@ class BooleanConstructor final : public NativeFunction { public: explicit BooleanConstructor(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~BooleanConstructor() override; virtual Value call(Interpreter&) override; diff --git a/Libraries/LibJS/Runtime/BooleanPrototype.cpp b/Libraries/LibJS/Runtime/BooleanPrototype.cpp index 96cfe96c5a..8d99679fd1 100644 --- a/Libraries/LibJS/Runtime/BooleanPrototype.cpp +++ b/Libraries/LibJS/Runtime/BooleanPrototype.cpp @@ -37,9 +37,9 @@ BooleanPrototype::BooleanPrototype(GlobalObject& global_object) { } -void BooleanPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object) +void BooleanPrototype::initialize(GlobalObject& global_object) { - BooleanObject::initialize(interpreter, global_object); + BooleanObject::initialize(global_object); define_native_function("toString", to_string, 0, Attribute::Writable | Attribute::Configurable); define_native_function("valueOf", value_of, 0, Attribute::Writable | Attribute::Configurable); } diff --git a/Libraries/LibJS/Runtime/BooleanPrototype.h b/Libraries/LibJS/Runtime/BooleanPrototype.h index 03367971ed..10b46f4efb 100644 --- a/Libraries/LibJS/Runtime/BooleanPrototype.h +++ b/Libraries/LibJS/Runtime/BooleanPrototype.h @@ -35,7 +35,7 @@ class BooleanPrototype final : public BooleanObject { public: explicit BooleanPrototype(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~BooleanPrototype() override; private: diff --git a/Libraries/LibJS/Runtime/BoundFunction.cpp b/Libraries/LibJS/Runtime/BoundFunction.cpp index c6027a901b..96e9100e7c 100644 --- a/Libraries/LibJS/Runtime/BoundFunction.cpp +++ b/Libraries/LibJS/Runtime/BoundFunction.cpp @@ -39,9 +39,9 @@ BoundFunction::BoundFunction(GlobalObject& global_object, Function& target_funct { } -void BoundFunction::initialize(Interpreter& interpreter, GlobalObject& global_object) +void BoundFunction::initialize(GlobalObject& global_object) { - Function::initialize(interpreter, global_object); + Function::initialize(global_object); define_property("length", Value(m_length), Attribute::Configurable); } diff --git a/Libraries/LibJS/Runtime/BoundFunction.h b/Libraries/LibJS/Runtime/BoundFunction.h index 16197eb7a8..0b04132480 100644 --- a/Libraries/LibJS/Runtime/BoundFunction.h +++ b/Libraries/LibJS/Runtime/BoundFunction.h @@ -35,7 +35,7 @@ class BoundFunction final : public Function { public: BoundFunction(GlobalObject&, Function& target_function, Value bound_this, Vector arguments, i32 length, Object* constructor_prototype); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~BoundFunction(); virtual Value call(Interpreter& interpreter) override; diff --git a/Libraries/LibJS/Runtime/Cell.h b/Libraries/LibJS/Runtime/Cell.h index 8bebdbf63c..70110f0d0d 100644 --- a/Libraries/LibJS/Runtime/Cell.h +++ b/Libraries/LibJS/Runtime/Cell.h @@ -37,7 +37,7 @@ class Cell { AK_MAKE_NONMOVABLE(Cell); public: - virtual void initialize(Interpreter&, GlobalObject&) { } + virtual void initialize(GlobalObject&) { } virtual ~Cell() { } bool is_marked() const { return m_mark; } diff --git a/Libraries/LibJS/Runtime/ConsoleObject.cpp b/Libraries/LibJS/Runtime/ConsoleObject.cpp index 77207062d5..3330f9d5e6 100644 --- a/Libraries/LibJS/Runtime/ConsoleObject.cpp +++ b/Libraries/LibJS/Runtime/ConsoleObject.cpp @@ -40,9 +40,9 @@ ConsoleObject::ConsoleObject(GlobalObject& global_object) { } -void ConsoleObject::initialize(Interpreter& interpreter, GlobalObject& global_object) +void ConsoleObject::initialize(GlobalObject& global_object) { - Object::initialize(interpreter, global_object); + Object::initialize(global_object); define_native_function("log", log); define_native_function("debug", debug); define_native_function("info", info); diff --git a/Libraries/LibJS/Runtime/ConsoleObject.h b/Libraries/LibJS/Runtime/ConsoleObject.h index 83a2b6bcd2..07848aa44f 100644 --- a/Libraries/LibJS/Runtime/ConsoleObject.h +++ b/Libraries/LibJS/Runtime/ConsoleObject.h @@ -35,7 +35,7 @@ class ConsoleObject final : public Object { public: explicit ConsoleObject(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~ConsoleObject() override; private: diff --git a/Libraries/LibJS/Runtime/DateConstructor.cpp b/Libraries/LibJS/Runtime/DateConstructor.cpp index fa7f7f8038..a0783b0eb7 100644 --- a/Libraries/LibJS/Runtime/DateConstructor.cpp +++ b/Libraries/LibJS/Runtime/DateConstructor.cpp @@ -39,9 +39,9 @@ DateConstructor::DateConstructor(GlobalObject& global_object) { } -void DateConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object) +void DateConstructor::initialize(GlobalObject& global_object) { - NativeFunction::initialize(interpreter, global_object); + NativeFunction::initialize(global_object); define_property("prototype", global_object.date_prototype(), 0); define_property("length", Value(7), Attribute::Configurable); diff --git a/Libraries/LibJS/Runtime/DateConstructor.h b/Libraries/LibJS/Runtime/DateConstructor.h index ed67b98ef0..779338cab2 100644 --- a/Libraries/LibJS/Runtime/DateConstructor.h +++ b/Libraries/LibJS/Runtime/DateConstructor.h @@ -35,7 +35,7 @@ class DateConstructor final : public NativeFunction { public: explicit DateConstructor(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~DateConstructor() override; virtual Value call(Interpreter&) override; diff --git a/Libraries/LibJS/Runtime/DatePrototype.cpp b/Libraries/LibJS/Runtime/DatePrototype.cpp index 4101d1d1fe..6aa8725eac 100644 --- a/Libraries/LibJS/Runtime/DatePrototype.cpp +++ b/Libraries/LibJS/Runtime/DatePrototype.cpp @@ -53,9 +53,9 @@ DatePrototype::DatePrototype(GlobalObject& global_object) { } -void DatePrototype::initialize(Interpreter& interpreter, GlobalObject& global_object) +void DatePrototype::initialize(GlobalObject& global_object) { - Object::initialize(interpreter, global_object); + Object::initialize(global_object); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function("getDate", get_date, 0, attr); define_native_function("getDay", get_day, 0, attr); diff --git a/Libraries/LibJS/Runtime/DatePrototype.h b/Libraries/LibJS/Runtime/DatePrototype.h index 40c6667d11..e74a445049 100644 --- a/Libraries/LibJS/Runtime/DatePrototype.h +++ b/Libraries/LibJS/Runtime/DatePrototype.h @@ -34,7 +34,7 @@ class DatePrototype final : public Object { JS_OBJECT(DatePrototype, Object); public: explicit DatePrototype(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~DatePrototype() override; private: diff --git a/Libraries/LibJS/Runtime/ErrorConstructor.cpp b/Libraries/LibJS/Runtime/ErrorConstructor.cpp index 994f28433b..01fe8ccc34 100644 --- a/Libraries/LibJS/Runtime/ErrorConstructor.cpp +++ b/Libraries/LibJS/Runtime/ErrorConstructor.cpp @@ -36,9 +36,9 @@ ErrorConstructor::ErrorConstructor(GlobalObject& global_object) { } -void ErrorConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object) +void ErrorConstructor::initialize(GlobalObject& global_object) { - NativeFunction::initialize(interpreter, global_object); + NativeFunction::initialize(global_object); define_property("prototype", global_object.error_prototype(), 0); define_property("length", Value(1), Attribute::Configurable); } @@ -68,9 +68,9 @@ Value ErrorConstructor::construct(Interpreter& interpreter, Function&) : NativeFunction(*global_object.function_prototype()) \ { \ } \ - void ConstructorName::initialize(Interpreter& interpreter, GlobalObject& global_object) \ + void ConstructorName::initialize(GlobalObject& global_object) \ { \ - NativeFunction::initialize(interpreter, global_object); \ + NativeFunction::initialize(global_object); \ define_property("prototype", global_object.snake_name##_prototype(), 0); \ define_property("length", Value(1), Attribute::Configurable); \ } \ diff --git a/Libraries/LibJS/Runtime/ErrorConstructor.h b/Libraries/LibJS/Runtime/ErrorConstructor.h index 9b2a124b17..4991b6b60c 100644 --- a/Libraries/LibJS/Runtime/ErrorConstructor.h +++ b/Libraries/LibJS/Runtime/ErrorConstructor.h @@ -36,7 +36,7 @@ class ErrorConstructor final : public NativeFunction { public: explicit ErrorConstructor(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~ErrorConstructor() override; virtual Value call(Interpreter&) override; @@ -52,7 +52,7 @@ private: \ public: \ explicit ConstructorName(GlobalObject&); \ - virtual void initialize(Interpreter&, GlobalObject&) override; \ + virtual void initialize(GlobalObject&) override; \ virtual ~ConstructorName() override; \ virtual Value call(Interpreter&) override; \ virtual Value construct(Interpreter&, Function& new_target) override; \ diff --git a/Libraries/LibJS/Runtime/ErrorPrototype.cpp b/Libraries/LibJS/Runtime/ErrorPrototype.cpp index 6fb0879315..785c65f1ef 100644 --- a/Libraries/LibJS/Runtime/ErrorPrototype.cpp +++ b/Libraries/LibJS/Runtime/ErrorPrototype.cpp @@ -40,9 +40,9 @@ ErrorPrototype::ErrorPrototype(GlobalObject& global_object) { } -void ErrorPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object) +void ErrorPrototype::initialize(GlobalObject& global_object) { - Object::initialize(interpreter, global_object); + Object::initialize(global_object); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_property("name", name_getter, name_setter, attr); define_native_property("message", message_getter, nullptr, attr); diff --git a/Libraries/LibJS/Runtime/ErrorPrototype.h b/Libraries/LibJS/Runtime/ErrorPrototype.h index 8dc6b88cdb..1686e6572b 100644 --- a/Libraries/LibJS/Runtime/ErrorPrototype.h +++ b/Libraries/LibJS/Runtime/ErrorPrototype.h @@ -35,7 +35,7 @@ class ErrorPrototype final : public Object { public: explicit ErrorPrototype(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~ErrorPrototype() override; private: @@ -53,7 +53,7 @@ private: \ public: \ explicit PrototypeName(GlobalObject&); \ - virtual void initialize(Interpreter&, GlobalObject&) override { } \ + virtual void initialize(GlobalObject&) override { } \ virtual ~PrototypeName() override; \ }; diff --git a/Libraries/LibJS/Runtime/Function.h b/Libraries/LibJS/Runtime/Function.h index 613d27957c..75565ef9fd 100644 --- a/Libraries/LibJS/Runtime/Function.h +++ b/Libraries/LibJS/Runtime/Function.h @@ -41,7 +41,7 @@ public: }; virtual ~Function(); - virtual void initialize(Interpreter&, GlobalObject&) override { } + virtual void initialize(GlobalObject&) override { } virtual Value call(Interpreter&) = 0; virtual Value construct(Interpreter&, Function& new_target) = 0; diff --git a/Libraries/LibJS/Runtime/FunctionConstructor.cpp b/Libraries/LibJS/Runtime/FunctionConstructor.cpp index 75e7249741..5af0bfd5a5 100644 --- a/Libraries/LibJS/Runtime/FunctionConstructor.cpp +++ b/Libraries/LibJS/Runtime/FunctionConstructor.cpp @@ -40,9 +40,9 @@ FunctionConstructor::FunctionConstructor(GlobalObject& global_object) { } -void FunctionConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object) +void FunctionConstructor::initialize(GlobalObject& global_object) { - NativeFunction::initialize(interpreter, global_object); + NativeFunction::initialize(global_object); define_property("prototype", global_object.function_prototype(), 0); define_property("length", Value(1), Attribute::Configurable); } diff --git a/Libraries/LibJS/Runtime/FunctionConstructor.h b/Libraries/LibJS/Runtime/FunctionConstructor.h index ba6eb8962d..b7891c5438 100644 --- a/Libraries/LibJS/Runtime/FunctionConstructor.h +++ b/Libraries/LibJS/Runtime/FunctionConstructor.h @@ -35,7 +35,7 @@ class FunctionConstructor final : public NativeFunction { public: explicit FunctionConstructor(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~FunctionConstructor() override; virtual Value call(Interpreter&) override; diff --git a/Libraries/LibJS/Runtime/FunctionPrototype.cpp b/Libraries/LibJS/Runtime/FunctionPrototype.cpp index 84a784059e..d3f7a1f935 100644 --- a/Libraries/LibJS/Runtime/FunctionPrototype.cpp +++ b/Libraries/LibJS/Runtime/FunctionPrototype.cpp @@ -43,15 +43,15 @@ FunctionPrototype::FunctionPrototype(GlobalObject& global_object) { } -void FunctionPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object) +void FunctionPrototype::initialize(GlobalObject& global_object) { - Object::initialize(interpreter, global_object); + Object::initialize(global_object); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function("apply", apply, 2, attr); define_native_function("bind", bind, 1, attr); define_native_function("call", call, 1, attr); define_native_function("toString", to_string, 0, attr); - define_native_function(interpreter.well_known_symbol_has_instance(), symbol_has_instance, 1, 0); + define_native_function(global_object.interpreter().well_known_symbol_has_instance(), symbol_has_instance, 1, 0); define_property("length", Value(0), Attribute::Configurable); define_property("name", js_string(heap(), ""), Attribute::Configurable); } diff --git a/Libraries/LibJS/Runtime/FunctionPrototype.h b/Libraries/LibJS/Runtime/FunctionPrototype.h index 809589778a..2cb74504ad 100644 --- a/Libraries/LibJS/Runtime/FunctionPrototype.h +++ b/Libraries/LibJS/Runtime/FunctionPrototype.h @@ -35,7 +35,7 @@ class FunctionPrototype final : public Object { public: explicit FunctionPrototype(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~FunctionPrototype() override; private: diff --git a/Libraries/LibJS/Runtime/GlobalObject.cpp b/Libraries/LibJS/Runtime/GlobalObject.cpp index 1aad9a5eb7..7f07d5f9c8 100644 --- a/Libraries/LibJS/Runtime/GlobalObject.cpp +++ b/Libraries/LibJS/Runtime/GlobalObject.cpp @@ -78,8 +78,8 @@ void GlobalObject::initialize() m_object_prototype = heap().allocate_without_global_object(*this); m_function_prototype = heap().allocate_without_global_object(*this); - static_cast(m_function_prototype)->initialize(heap().interpreter(), *this); - static_cast(m_object_prototype)->initialize(heap().interpreter(), *this); + static_cast(m_function_prototype)->initialize(*this); + static_cast(m_object_prototype)->initialize(*this); #define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName) \ if (!m_##snake_name##_prototype) \ diff --git a/Libraries/LibJS/Runtime/IteratorOperations.cpp b/Libraries/LibJS/Runtime/IteratorOperations.cpp index ab8659f108..64af1a3845 100644 --- a/Libraries/LibJS/Runtime/IteratorOperations.cpp +++ b/Libraries/LibJS/Runtime/IteratorOperations.cpp @@ -96,9 +96,9 @@ void iterator_close(Object& iterator) TODO(); } -Value create_iterator_result_object(Interpreter& interpreter, GlobalObject& global_object, Value value, bool done) +Value create_iterator_result_object(GlobalObject& global_object, Value value, bool done) { - auto* object = Object::create_empty(interpreter, global_object); + auto* object = Object::create_empty(global_object); object->define_property("value", value); object->define_property("done", Value(done)); return object; diff --git a/Libraries/LibJS/Runtime/IteratorOperations.h b/Libraries/LibJS/Runtime/IteratorOperations.h index 35280bceb9..7c39505bd5 100644 --- a/Libraries/LibJS/Runtime/IteratorOperations.h +++ b/Libraries/LibJS/Runtime/IteratorOperations.h @@ -36,7 +36,7 @@ namespace JS { Object* get_iterator(GlobalObject&, Value value, String hint = "sync", Value method = {}); bool is_iterator_complete(Object& iterator_result); -Value create_iterator_result_object(Interpreter&, GlobalObject&, Value value, bool done); +Value create_iterator_result_object(GlobalObject&, Value value, bool done); Object* iterator_next(Object& iterator, Value value = {}); void iterator_close(Object& iterator); diff --git a/Libraries/LibJS/Runtime/IteratorPrototype.cpp b/Libraries/LibJS/Runtime/IteratorPrototype.cpp index 277c955185..32a1ca89b6 100644 --- a/Libraries/LibJS/Runtime/IteratorPrototype.cpp +++ b/Libraries/LibJS/Runtime/IteratorPrototype.cpp @@ -34,10 +34,10 @@ IteratorPrototype::IteratorPrototype(GlobalObject& global_object) { } -void IteratorPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object) +void IteratorPrototype::initialize(GlobalObject& global_object) { - Object::initialize(interpreter, global_object); - define_native_function(interpreter.well_known_symbol_iterator(), symbol_iterator, 0, Attribute::Writable | Attribute::Enumerable); + Object::initialize(global_object); + define_native_function(global_object.interpreter().well_known_symbol_iterator(), symbol_iterator, 0, Attribute::Writable | Attribute::Enumerable); } IteratorPrototype::~IteratorPrototype() diff --git a/Libraries/LibJS/Runtime/IteratorPrototype.h b/Libraries/LibJS/Runtime/IteratorPrototype.h index 1cfd954632..72d37b2540 100644 --- a/Libraries/LibJS/Runtime/IteratorPrototype.h +++ b/Libraries/LibJS/Runtime/IteratorPrototype.h @@ -35,7 +35,7 @@ class IteratorPrototype : public Object { public: IteratorPrototype(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~IteratorPrototype() override; private: diff --git a/Libraries/LibJS/Runtime/JSONObject.cpp b/Libraries/LibJS/Runtime/JSONObject.cpp index 60d1fe7618..a1aadf1e42 100644 --- a/Libraries/LibJS/Runtime/JSONObject.cpp +++ b/Libraries/LibJS/Runtime/JSONObject.cpp @@ -42,14 +42,14 @@ JSONObject::JSONObject(GlobalObject& global_object) { } -void JSONObject::initialize(Interpreter& interpreter, GlobalObject& global_object) +void JSONObject::initialize(GlobalObject& global_object) { - Object::initialize(interpreter, global_object); + Object::initialize(global_object); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function("stringify", stringify, 3, attr); define_native_function("parse", parse, 2, attr); - define_property(interpreter.well_known_symbol_to_string_tag(), js_string(interpreter, "JSON"), Attribute::Configurable); + define_property(global_object.interpreter().well_known_symbol_to_string_tag(), js_string(global_object.heap(), "JSON"), Attribute::Configurable); } JSONObject::~JSONObject() @@ -117,7 +117,7 @@ String JSONObject::stringify_impl(Interpreter& interpreter, GlobalObject& global state.gap = String::empty(); } - auto* wrapper = Object::create_empty(interpreter, global_object); + auto* wrapper = Object::create_empty(global_object); wrapper->define_property(String::empty(), value); if (interpreter.exception()) return {}; @@ -401,7 +401,7 @@ JS_DEFINE_NATIVE_FUNCTION(JSONObject::parse) } Value result = parse_json_value(interpreter, global_object, json.value()); if (reviver.is_function()) { - auto* holder_object = Object::create_empty(interpreter, global_object); + auto* holder_object = Object::create_empty(global_object); holder_object->define_property(String::empty(), result); if (interpreter.exception()) return {}; @@ -433,7 +433,7 @@ Value JSONObject::parse_json_value(Interpreter& interpreter, GlobalObject& globa Object* JSONObject::parse_json_object(Interpreter& interpreter, GlobalObject& global_object, const JsonObject& json_object) { - auto* object = Object::create_empty(interpreter, global_object); + auto* object = Object::create_empty(global_object); json_object.for_each_member([&](auto& key, auto& value) { object->define_property(key, parse_json_value(interpreter, global_object, value)); }); diff --git a/Libraries/LibJS/Runtime/JSONObject.h b/Libraries/LibJS/Runtime/JSONObject.h index 51a718756c..18a32e8ef6 100644 --- a/Libraries/LibJS/Runtime/JSONObject.h +++ b/Libraries/LibJS/Runtime/JSONObject.h @@ -35,7 +35,7 @@ class JSONObject final : public Object { public: explicit JSONObject(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~JSONObject() override; // The base implementation of stringify is exposed because it is used by diff --git a/Libraries/LibJS/Runtime/MathObject.cpp b/Libraries/LibJS/Runtime/MathObject.cpp index 75db4eaa89..830d5f4567 100644 --- a/Libraries/LibJS/Runtime/MathObject.cpp +++ b/Libraries/LibJS/Runtime/MathObject.cpp @@ -39,9 +39,9 @@ MathObject::MathObject(GlobalObject& global_object) { } -void MathObject::initialize(Interpreter& interpreter, GlobalObject& global_object) +void MathObject::initialize(GlobalObject& global_object) { - Object::initialize(interpreter, global_object); + Object::initialize(global_object); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function("abs", abs, 1, attr); define_native_function("random", random, 0, attr); @@ -75,7 +75,7 @@ void MathObject::initialize(Interpreter& interpreter, GlobalObject& global_objec define_property("SQRT1_2", Value(M_SQRT1_2), 0); define_property("SQRT2", Value(M_SQRT2), 0); - define_property(interpreter.well_known_symbol_to_string_tag(), js_string(interpreter, "Math"), Attribute::Configurable); + define_property(global_object.interpreter().well_known_symbol_to_string_tag(), js_string(global_object.heap(), "Math"), Attribute::Configurable); } MathObject::~MathObject() diff --git a/Libraries/LibJS/Runtime/MathObject.h b/Libraries/LibJS/Runtime/MathObject.h index 3663235607..54e2544f4f 100644 --- a/Libraries/LibJS/Runtime/MathObject.h +++ b/Libraries/LibJS/Runtime/MathObject.h @@ -35,7 +35,7 @@ class MathObject final : public Object { public: explicit MathObject(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~MathObject() override; private: diff --git a/Libraries/LibJS/Runtime/NativeFunction.h b/Libraries/LibJS/Runtime/NativeFunction.h index 61fd88cc19..0730fa6307 100644 --- a/Libraries/LibJS/Runtime/NativeFunction.h +++ b/Libraries/LibJS/Runtime/NativeFunction.h @@ -38,7 +38,7 @@ public: static NativeFunction* create(Interpreter&, GlobalObject&, const FlyString& name, AK::Function); explicit NativeFunction(const FlyString& name, AK::Function, Object& prototype); - virtual void initialize(Interpreter&, GlobalObject&) override { } + virtual void initialize(GlobalObject&) override { } virtual ~NativeFunction() override; virtual Value call(Interpreter&) override; diff --git a/Libraries/LibJS/Runtime/NumberConstructor.cpp b/Libraries/LibJS/Runtime/NumberConstructor.cpp index aa64d31ee9..a96d710523 100644 --- a/Libraries/LibJS/Runtime/NumberConstructor.cpp +++ b/Libraries/LibJS/Runtime/NumberConstructor.cpp @@ -42,9 +42,9 @@ NumberConstructor::NumberConstructor(GlobalObject& global_object) { } -void NumberConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object) +void NumberConstructor::initialize(GlobalObject& global_object) { - NativeFunction::initialize(interpreter, global_object); + NativeFunction::initialize(global_object); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function("isFinite", is_finite, 1, attr); define_native_function("isInteger", is_integer, 1, attr); diff --git a/Libraries/LibJS/Runtime/NumberConstructor.h b/Libraries/LibJS/Runtime/NumberConstructor.h index c7ba5fefc8..70269a1bbd 100644 --- a/Libraries/LibJS/Runtime/NumberConstructor.h +++ b/Libraries/LibJS/Runtime/NumberConstructor.h @@ -35,7 +35,7 @@ class NumberConstructor final : public NativeFunction { public: explicit NumberConstructor(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~NumberConstructor() override; virtual Value call(Interpreter&) override; diff --git a/Libraries/LibJS/Runtime/NumberPrototype.cpp b/Libraries/LibJS/Runtime/NumberPrototype.cpp index aebc4b695c..121c16ba51 100644 --- a/Libraries/LibJS/Runtime/NumberPrototype.cpp +++ b/Libraries/LibJS/Runtime/NumberPrototype.cpp @@ -46,9 +46,9 @@ NumberPrototype::NumberPrototype(GlobalObject& global_object) { } -void NumberPrototype::initialize(Interpreter& interpreter, GlobalObject& object) +void NumberPrototype::initialize(GlobalObject& object) { - Object::initialize(interpreter, object); + Object::initialize(object); define_native_function("toString", to_string, 1, Attribute::Configurable | Attribute::Writable); } diff --git a/Libraries/LibJS/Runtime/NumberPrototype.h b/Libraries/LibJS/Runtime/NumberPrototype.h index 81ee707b3e..a2b94143f1 100644 --- a/Libraries/LibJS/Runtime/NumberPrototype.h +++ b/Libraries/LibJS/Runtime/NumberPrototype.h @@ -35,7 +35,7 @@ class NumberPrototype final : public NumberObject { public: explicit NumberPrototype(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~NumberPrototype() override; JS_DECLARE_NATIVE_FUNCTION(to_string); diff --git a/Libraries/LibJS/Runtime/Object.cpp b/Libraries/LibJS/Runtime/Object.cpp index e502c4e205..34f36bf2d0 100644 --- a/Libraries/LibJS/Runtime/Object.cpp +++ b/Libraries/LibJS/Runtime/Object.cpp @@ -82,7 +82,7 @@ PropertyDescriptor PropertyDescriptor::from_dictionary(Interpreter& interpreter, return descriptor; } -Object* Object::create_empty(Interpreter&, GlobalObject& global_object) +Object* Object::create_empty(GlobalObject& global_object) { return global_object.heap().allocate(global_object, *global_object.object_prototype()); } @@ -105,7 +105,7 @@ Object::Object(Object& prototype) set_prototype(&prototype); } -void Object::initialize(Interpreter&, GlobalObject&) +void Object::initialize(GlobalObject&) { } @@ -301,7 +301,7 @@ Value Object::get_own_property_descriptor_object(const PropertyName& property_na return js_undefined(); auto descriptor = descriptor_opt.value(); - auto* descriptor_object = Object::create_empty(interpreter(), global_object()); + auto* descriptor_object = Object::create_empty(global_object()); descriptor_object->define_property("enumerable", Value(descriptor.attributes.is_enumerable())); if (interpreter().exception()) return {}; diff --git a/Libraries/LibJS/Runtime/Object.h b/Libraries/LibJS/Runtime/Object.h index 79b5093940..35a7e00a1f 100644 --- a/Libraries/LibJS/Runtime/Object.h +++ b/Libraries/LibJS/Runtime/Object.h @@ -60,10 +60,10 @@ struct PropertyDescriptor { class Object : public Cell { public: - static Object* create_empty(Interpreter&, GlobalObject&); + static Object* create_empty(GlobalObject&); explicit Object(Object& prototype); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~Object(); virtual bool inherits(const StringView& class_name) const { return class_name == this->class_name(); } diff --git a/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Libraries/LibJS/Runtime/ObjectConstructor.cpp index cd158f87c1..5489714e36 100644 --- a/Libraries/LibJS/Runtime/ObjectConstructor.cpp +++ b/Libraries/LibJS/Runtime/ObjectConstructor.cpp @@ -40,9 +40,9 @@ ObjectConstructor::ObjectConstructor(GlobalObject& global_object) { } -void ObjectConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object) +void ObjectConstructor::initialize(GlobalObject& global_object) { - NativeFunction::initialize(interpreter, global_object); + NativeFunction::initialize(global_object); define_property("prototype", global_object.object_prototype(), 0); define_property("length", Value(1), Attribute::Configurable); @@ -64,9 +64,9 @@ ObjectConstructor::~ObjectConstructor() { } -Value ObjectConstructor::call(Interpreter& interpreter) +Value ObjectConstructor::call(Interpreter&) { - return Object::create_empty(interpreter, global_object()); + return Object::create_empty(global_object()); } Value ObjectConstructor::construct(Interpreter& interpreter, Function&) diff --git a/Libraries/LibJS/Runtime/ObjectConstructor.h b/Libraries/LibJS/Runtime/ObjectConstructor.h index ddfec2c889..7040c73b9f 100644 --- a/Libraries/LibJS/Runtime/ObjectConstructor.h +++ b/Libraries/LibJS/Runtime/ObjectConstructor.h @@ -35,7 +35,7 @@ class ObjectConstructor final : public NativeFunction { public: explicit ObjectConstructor(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~ObjectConstructor() override; virtual Value call(Interpreter&) override; diff --git a/Libraries/LibJS/Runtime/ObjectPrototype.cpp b/Libraries/LibJS/Runtime/ObjectPrototype.cpp index 051af847ec..a1ce65436d 100644 --- a/Libraries/LibJS/Runtime/ObjectPrototype.cpp +++ b/Libraries/LibJS/Runtime/ObjectPrototype.cpp @@ -39,9 +39,9 @@ ObjectPrototype::ObjectPrototype(GlobalObject& global_object) { } -void ObjectPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object) +void ObjectPrototype::initialize(GlobalObject& global_object) { - Object::initialize(interpreter, global_object); + Object::initialize(global_object); // This must be called after the constructor has returned, so that the below code // can find the ObjectPrototype through normal paths. u8 attr = Attribute::Writable | Attribute::Configurable; @@ -80,7 +80,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_string) return {}; String tag; - auto to_string_tag = this_object->get(interpreter.well_known_symbol_to_string_tag()); + auto to_string_tag = this_object->get(global_object.interpreter().well_known_symbol_to_string_tag()); if (to_string_tag.is_string()) { tag = to_string_tag.as_string().string(); diff --git a/Libraries/LibJS/Runtime/ObjectPrototype.h b/Libraries/LibJS/Runtime/ObjectPrototype.h index 2f9775dbcf..f16a133774 100644 --- a/Libraries/LibJS/Runtime/ObjectPrototype.h +++ b/Libraries/LibJS/Runtime/ObjectPrototype.h @@ -35,7 +35,7 @@ class ObjectPrototype final : public Object { public: explicit ObjectPrototype(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~ObjectPrototype() override; // public to serve as intrinsic function %Object.prototype.toString% diff --git a/Libraries/LibJS/Runtime/ProxyConstructor.cpp b/Libraries/LibJS/Runtime/ProxyConstructor.cpp index 152ea2ee88..299d1eac8d 100644 --- a/Libraries/LibJS/Runtime/ProxyConstructor.cpp +++ b/Libraries/LibJS/Runtime/ProxyConstructor.cpp @@ -38,9 +38,9 @@ ProxyConstructor::ProxyConstructor(GlobalObject& global_object) { } -void ProxyConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object) +void ProxyConstructor::initialize(GlobalObject& global_object) { - NativeFunction::initialize(interpreter, global_object); + NativeFunction::initialize(global_object); define_property("prototype", global_object.proxy_prototype(), 0); define_property("length", Value(2), Attribute::Configurable); } diff --git a/Libraries/LibJS/Runtime/ProxyConstructor.h b/Libraries/LibJS/Runtime/ProxyConstructor.h index adfe82215a..bf28b189e2 100644 --- a/Libraries/LibJS/Runtime/ProxyConstructor.h +++ b/Libraries/LibJS/Runtime/ProxyConstructor.h @@ -35,7 +35,7 @@ class ProxyConstructor final : public NativeFunction { public: explicit ProxyConstructor(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~ProxyConstructor() override; virtual Value call(Interpreter&) override; diff --git a/Libraries/LibJS/Runtime/ReflectObject.cpp b/Libraries/LibJS/Runtime/ReflectObject.cpp index 95357fe30c..12362c99e3 100644 --- a/Libraries/LibJS/Runtime/ReflectObject.cpp +++ b/Libraries/LibJS/Runtime/ReflectObject.cpp @@ -80,9 +80,9 @@ ReflectObject::ReflectObject(GlobalObject& global_object) { } -void ReflectObject::initialize(Interpreter& interpreter, GlobalObject& global_object) +void ReflectObject::initialize(GlobalObject& global_object) { - Object::initialize(interpreter, global_object); + Object::initialize(global_object); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function("apply", apply, 3, attr); define_native_function("construct", construct, 2, attr); diff --git a/Libraries/LibJS/Runtime/ReflectObject.h b/Libraries/LibJS/Runtime/ReflectObject.h index 8cc129fe83..68f2fd497e 100644 --- a/Libraries/LibJS/Runtime/ReflectObject.h +++ b/Libraries/LibJS/Runtime/ReflectObject.h @@ -35,7 +35,7 @@ class ReflectObject final : public Object { public: explicit ReflectObject(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~ReflectObject() override; private: diff --git a/Libraries/LibJS/Runtime/RegExpConstructor.cpp b/Libraries/LibJS/Runtime/RegExpConstructor.cpp index c461fda01a..1e1ee0d54e 100644 --- a/Libraries/LibJS/Runtime/RegExpConstructor.cpp +++ b/Libraries/LibJS/Runtime/RegExpConstructor.cpp @@ -37,9 +37,9 @@ RegExpConstructor::RegExpConstructor(GlobalObject& global_object) { } -void RegExpConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object) +void RegExpConstructor::initialize(GlobalObject& global_object) { - NativeFunction::initialize(interpreter, global_object); + NativeFunction::initialize(global_object); define_property("prototype", global_object.regexp_prototype(), 0); define_property("length", Value(2), Attribute::Configurable); } diff --git a/Libraries/LibJS/Runtime/RegExpConstructor.h b/Libraries/LibJS/Runtime/RegExpConstructor.h index ece1ff54d6..b8a78ceef4 100644 --- a/Libraries/LibJS/Runtime/RegExpConstructor.h +++ b/Libraries/LibJS/Runtime/RegExpConstructor.h @@ -35,7 +35,7 @@ class RegExpConstructor final : public NativeFunction { public: explicit RegExpConstructor(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~RegExpConstructor() override; virtual Value call(Interpreter&) override; diff --git a/Libraries/LibJS/Runtime/ScriptFunction.cpp b/Libraries/LibJS/Runtime/ScriptFunction.cpp index d18718dd53..7a7a78dc92 100644 --- a/Libraries/LibJS/Runtime/ScriptFunction.cpp +++ b/Libraries/LibJS/Runtime/ScriptFunction.cpp @@ -63,11 +63,11 @@ ScriptFunction::ScriptFunction(GlobalObject& global_object, const FlyString& nam { } -void ScriptFunction::initialize(Interpreter& interpreter, GlobalObject& global_object) +void ScriptFunction::initialize(GlobalObject& global_object) { - Function::initialize(interpreter, global_object); + Function::initialize(global_object); if (!m_is_arrow_function) { - Object* prototype = Object::create_empty(interpreter, global_object); + Object* prototype = Object::create_empty(global_object); prototype->define_property("constructor", this, Attribute::Writable | Attribute::Configurable); define_property("prototype", prototype, 0); } diff --git a/Libraries/LibJS/Runtime/ScriptFunction.h b/Libraries/LibJS/Runtime/ScriptFunction.h index 3bf6e71759..f4f0c9579d 100644 --- a/Libraries/LibJS/Runtime/ScriptFunction.h +++ b/Libraries/LibJS/Runtime/ScriptFunction.h @@ -38,7 +38,7 @@ public: static ScriptFunction* create(GlobalObject&, const FlyString& name, const Statement& body, Vector parameters, i32 m_function_length, LexicalEnvironment* parent_environment, bool is_arrow_function = false); ScriptFunction(GlobalObject&, const FlyString& name, const Statement& body, Vector parameters, i32 m_function_length, LexicalEnvironment* parent_environment, Object& prototype, bool is_arrow_function = false); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~ScriptFunction(); const Statement& body() const { return m_body; } diff --git a/Libraries/LibJS/Runtime/StringConstructor.cpp b/Libraries/LibJS/Runtime/StringConstructor.cpp index 1fc3d2f283..7ab381e257 100644 --- a/Libraries/LibJS/Runtime/StringConstructor.cpp +++ b/Libraries/LibJS/Runtime/StringConstructor.cpp @@ -40,9 +40,9 @@ StringConstructor::StringConstructor(GlobalObject& global_object) { } -void StringConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object) +void StringConstructor::initialize(GlobalObject& global_object) { - NativeFunction::initialize(interpreter, global_object); + NativeFunction::initialize(global_object); define_property("prototype", global_object.string_prototype(), 0); define_property("length", Value(1), Attribute::Configurable); diff --git a/Libraries/LibJS/Runtime/StringConstructor.h b/Libraries/LibJS/Runtime/StringConstructor.h index 8aa78f8adf..1af8d05f6d 100644 --- a/Libraries/LibJS/Runtime/StringConstructor.h +++ b/Libraries/LibJS/Runtime/StringConstructor.h @@ -35,7 +35,7 @@ class StringConstructor final : public NativeFunction { public: explicit StringConstructor(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~StringConstructor() override; virtual Value call(Interpreter&) override; diff --git a/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp b/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp index c0c3fd3dbf..39acbb25d7 100644 --- a/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp +++ b/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp @@ -38,12 +38,12 @@ StringIteratorPrototype::StringIteratorPrototype(GlobalObject& global_object) { } -void StringIteratorPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object) +void StringIteratorPrototype::initialize(GlobalObject& global_object) { - Object::initialize(interpreter, global_object); + Object::initialize(global_object); define_native_function("next", next, 0, Attribute::Configurable | Attribute::Writable); - define_property(interpreter.well_known_symbol_to_string_tag(), js_string(interpreter, "String Iterator"), Attribute::Configurable); + define_property(global_object.interpreter().well_known_symbol_to_string_tag(), js_string(global_object.heap(), "String Iterator"), Attribute::Configurable); } StringIteratorPrototype::~StringIteratorPrototype() @@ -59,20 +59,20 @@ JS_DEFINE_NATIVE_FUNCTION(StringIteratorPrototype::next) auto& this_object = this_value.as_object(); auto& iterator = static_cast(this_object); if (iterator.done()) - return create_iterator_result_object(interpreter, global_object, js_undefined(), true); + return create_iterator_result_object(global_object, js_undefined(), true); auto& utf8_iterator = iterator.iterator(); if (utf8_iterator.done()) { iterator.m_done = true; - return create_iterator_result_object(interpreter, global_object, js_undefined(), true); + return create_iterator_result_object(global_object, js_undefined(), true); } StringBuilder builder; builder.append_codepoint(*utf8_iterator); ++utf8_iterator; - return create_iterator_result_object(interpreter, global_object, js_string(interpreter, builder.to_string()), false); + return create_iterator_result_object(global_object, js_string(interpreter, builder.to_string()), false); } } diff --git a/Libraries/LibJS/Runtime/StringIteratorPrototype.h b/Libraries/LibJS/Runtime/StringIteratorPrototype.h index 03674909fb..a17e2507eb 100644 --- a/Libraries/LibJS/Runtime/StringIteratorPrototype.h +++ b/Libraries/LibJS/Runtime/StringIteratorPrototype.h @@ -35,7 +35,7 @@ class StringIteratorPrototype final : public Object { public: StringIteratorPrototype(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~StringIteratorPrototype() override; private: diff --git a/Libraries/LibJS/Runtime/StringPrototype.cpp b/Libraries/LibJS/Runtime/StringPrototype.cpp index 6f1e2bd5ec..529438baab 100644 --- a/Libraries/LibJS/Runtime/StringPrototype.cpp +++ b/Libraries/LibJS/Runtime/StringPrototype.cpp @@ -65,9 +65,9 @@ StringPrototype::StringPrototype(GlobalObject& global_object) { } -void StringPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object) +void StringPrototype::initialize(GlobalObject& global_object) { - StringObject::initialize(interpreter, global_object); + StringObject::initialize(global_object); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_property("length", length_getter, nullptr, 0); @@ -89,7 +89,7 @@ void StringPrototype::initialize(Interpreter& interpreter, GlobalObject& global_ define_native_function("includes", includes, 1, attr); define_native_function("slice", slice, 2, attr); define_native_function("lastIndexOf", last_index_of, 1, attr); - define_native_function(interpreter.well_known_symbol_iterator(), symbol_iterator, 0, attr); + define_native_function(global_object.interpreter().well_known_symbol_iterator(), symbol_iterator, 0, attr); } StringPrototype::~StringPrototype() diff --git a/Libraries/LibJS/Runtime/StringPrototype.h b/Libraries/LibJS/Runtime/StringPrototype.h index 8e505aba4f..bef8bb1aae 100644 --- a/Libraries/LibJS/Runtime/StringPrototype.h +++ b/Libraries/LibJS/Runtime/StringPrototype.h @@ -35,7 +35,7 @@ class StringPrototype final : public StringObject { public: explicit StringPrototype(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~StringPrototype() override; private: diff --git a/Libraries/LibJS/Runtime/SymbolConstructor.cpp b/Libraries/LibJS/Runtime/SymbolConstructor.cpp index 77822f76ef..7cb4693d9a 100644 --- a/Libraries/LibJS/Runtime/SymbolConstructor.cpp +++ b/Libraries/LibJS/Runtime/SymbolConstructor.cpp @@ -37,9 +37,9 @@ SymbolConstructor::SymbolConstructor(GlobalObject& global_object) { } -void SymbolConstructor::initialize(Interpreter& interpreter, GlobalObject& global_object) +void SymbolConstructor::initialize(GlobalObject& global_object) { - NativeFunction::initialize(interpreter, global_object); + NativeFunction::initialize(global_object); define_property("prototype", global_object.symbol_prototype(), 0); define_property("length", Value(0), Attribute::Configurable); @@ -47,7 +47,7 @@ void SymbolConstructor::initialize(Interpreter& interpreter, GlobalObject& globa define_native_function("keyFor", key_for, 1, Attribute::Writable | Attribute::Configurable); #define __JS_ENUMERATE(SymbolName, snake_name) \ - define_property(#SymbolName, interpreter.well_known_symbol_##snake_name(), 0); + define_property(#SymbolName, global_object.interpreter().well_known_symbol_##snake_name(), 0); JS_ENUMERATE_WELL_KNOWN_SYMBOLS #undef __JS_ENUMERATE } diff --git a/Libraries/LibJS/Runtime/SymbolConstructor.h b/Libraries/LibJS/Runtime/SymbolConstructor.h index 26c23c599c..87a50f1973 100644 --- a/Libraries/LibJS/Runtime/SymbolConstructor.h +++ b/Libraries/LibJS/Runtime/SymbolConstructor.h @@ -35,7 +35,7 @@ class SymbolConstructor final : public NativeFunction { public: explicit SymbolConstructor(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~SymbolConstructor() override; virtual Value call(Interpreter&) override; diff --git a/Libraries/LibJS/Runtime/SymbolPrototype.cpp b/Libraries/LibJS/Runtime/SymbolPrototype.cpp index 12d08adfe7..e28d6c7319 100644 --- a/Libraries/LibJS/Runtime/SymbolPrototype.cpp +++ b/Libraries/LibJS/Runtime/SymbolPrototype.cpp @@ -44,14 +44,14 @@ SymbolPrototype::SymbolPrototype(GlobalObject& global_object) { } -void SymbolPrototype::initialize(Interpreter& interpreter, GlobalObject& global_object) +void SymbolPrototype::initialize(GlobalObject& global_object) { - Object::initialize(interpreter, global_object); + Object::initialize(global_object); define_native_property("description", description_getter, nullptr, Attribute::Configurable); define_native_function("toString", to_string, 0, Attribute::Writable | Attribute::Configurable); define_native_function("valueOf", value_of, 0, Attribute::Writable | Attribute::Configurable); - define_property(interpreter.well_known_symbol_to_string_tag(), js_string(interpreter, "Symbol"), Attribute::Configurable); + define_property(global_object.interpreter().well_known_symbol_to_string_tag(), js_string(global_object.heap(), "Symbol"), Attribute::Configurable); } SymbolPrototype::~SymbolPrototype() diff --git a/Libraries/LibJS/Runtime/SymbolPrototype.h b/Libraries/LibJS/Runtime/SymbolPrototype.h index f8f5730b43..589b46e7a7 100644 --- a/Libraries/LibJS/Runtime/SymbolPrototype.h +++ b/Libraries/LibJS/Runtime/SymbolPrototype.h @@ -35,7 +35,7 @@ class SymbolPrototype final : public Object { public: explicit SymbolPrototype(GlobalObject&); - virtual void initialize(Interpreter&, GlobalObject&) override; + virtual void initialize(GlobalObject&) override; virtual ~SymbolPrototype() override; private: -- cgit v1.2.3