Преглед на файлове

LibJS: Interpreter::this_value() => this_value(GlobalObject&)

Once the Interpreter has no global object attached to it, we have to
provide it everywhere.
Andreas Kling преди 5 години
родител
ревизия
053863f35e

+ 2 - 2
Libraries/LibJS/AST.cpp

@@ -1006,9 +1006,9 @@ Value SpreadExpression::execute(Interpreter& interpreter, GlobalObject& global_o
     return m_target->execute(interpreter, global_object);
 }
 
-Value ThisExpression::execute(Interpreter& interpreter, GlobalObject&) const
+Value ThisExpression::execute(Interpreter& interpreter, GlobalObject& global_object) const
 {
-    return interpreter.this_value();
+    return interpreter.this_value(global_object);
 }
 
 void ThisExpression::dump(int indent) const

+ 2 - 2
Libraries/LibJS/Interpreter.h

@@ -150,10 +150,10 @@ public:
         return index < arguments.size() ? arguments[index] : js_undefined();
     }
 
-    Value this_value() const
+    Value this_value(Object& global_object) const
     {
         if (m_call_stack.is_empty())
-            return m_global_object;
+            return &global_object;
         return m_call_stack.last().this_value;
     }
 

+ 4 - 4
Libraries/LibJS/Runtime/Array.cpp

@@ -49,9 +49,9 @@ Array::~Array()
 {
 }
 
-Array* array_from(Interpreter& interpreter)
+Array* array_from(Interpreter& interpreter, GlobalObject& global_object)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
     if (!this_object)
         return {};
     if (!this_object->is_array()) {
@@ -63,7 +63,7 @@ Array* array_from(Interpreter& interpreter)
 
 Value Array::length_getter(Interpreter& interpreter)
 {
-    auto* array = array_from(interpreter);
+    auto* array = array_from(interpreter, interpreter.global_object());
     if (!array)
         return {};
     return Value(static_cast<i32>(array->indexed_properties().array_like_size()));
@@ -71,7 +71,7 @@ Value Array::length_getter(Interpreter& interpreter)
 
 void Array::length_setter(Interpreter& interpreter, Value value)
 {
-    auto* array = array_from(interpreter);
+    auto* array = array_from(interpreter, interpreter.global_object());
     if (!array)
         return;
     auto length = value.to_number(interpreter);

+ 1 - 1
Libraries/LibJS/Runtime/Array.h

@@ -30,7 +30,7 @@
 
 namespace JS {
 
-Array* array_from(Interpreter&);
+Array* array_from(Interpreter&, GlobalObject&);
 
 class Array final : public Object {
 public:

+ 28 - 28
Libraries/LibJS/Runtime/ArrayPrototype.cpp

@@ -99,9 +99,9 @@ static size_t get_length(Interpreter& interpreter, Object& object)
     return length_property.to_size_t(interpreter);
 }
 
-static void for_each_item(Interpreter& interpreter, const String& name, AK::Function<IterationDecision(size_t index, Value value, Value callback_result)> callback, bool skip_empty = true)
+static void for_each_item(Interpreter& interpreter, GlobalObject& global_object, const String& name, AK::Function<IterationDecision(size_t index, Value value, Value callback_result)> callback, bool skip_empty = true)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
     if (!this_object)
         return;
 
@@ -142,7 +142,7 @@ static void for_each_item(Interpreter& interpreter, const String& name, AK::Func
 Value ArrayPrototype::filter(Interpreter& interpreter)
 {
     auto* new_array = Array::create(interpreter.global_object());
-    for_each_item(interpreter, "filter", [&](auto, auto value, auto callback_result) {
+    for_each_item(interpreter, interpreter.global_object(), "filter", [&](auto, auto value, auto callback_result) {
         if (callback_result.to_boolean())
             new_array->indexed_properties().append(value);
         return IterationDecision::Continue;
@@ -152,7 +152,7 @@ Value ArrayPrototype::filter(Interpreter& interpreter)
 
 Value ArrayPrototype::for_each(Interpreter& interpreter)
 {
-    for_each_item(interpreter, "forEach", [](auto, auto, auto) {
+    for_each_item(interpreter, interpreter.global_object(), "forEach", [](auto, auto, auto) {
         return IterationDecision::Continue;
     });
     return js_undefined();
@@ -160,7 +160,7 @@ Value ArrayPrototype::for_each(Interpreter& interpreter)
 
 Value ArrayPrototype::map(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     auto initial_length = get_length(interpreter, *this_object);
@@ -168,7 +168,7 @@ Value ArrayPrototype::map(Interpreter& interpreter)
         return {};
     auto* new_array = Array::create(interpreter.global_object());
     new_array->indexed_properties().set_array_like_size(initial_length);
-    for_each_item(interpreter, "map", [&](auto index, auto, auto callback_result) {
+    for_each_item(interpreter, interpreter.global_object(), "map", [&](auto index, auto, auto callback_result) {
         new_array->put(index, callback_result);
         if (interpreter.exception())
             return IterationDecision::Break;
@@ -179,7 +179,7 @@ Value ArrayPrototype::map(Interpreter& interpreter)
 
 Value ArrayPrototype::push(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     if (this_object->is_array()) {
@@ -209,7 +209,7 @@ Value ArrayPrototype::push(Interpreter& interpreter)
 
 Value ArrayPrototype::unshift(Interpreter& interpreter)
 {
-    auto* array = array_from(interpreter);
+    auto* array = array_from(interpreter, interpreter.global_object());
     if (!array)
         return {};
     for (size_t i = 0; i < interpreter.argument_count(); ++i)
@@ -219,7 +219,7 @@ Value ArrayPrototype::unshift(Interpreter& interpreter)
 
 Value ArrayPrototype::pop(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     if (this_object->is_array()) {
@@ -248,7 +248,7 @@ Value ArrayPrototype::pop(Interpreter& interpreter)
 
 Value ArrayPrototype::shift(Interpreter& interpreter)
 {
-    auto* array = array_from(interpreter);
+    auto* array = array_from(interpreter, interpreter.global_object());
     if (!array)
         return {};
     if (array->indexed_properties().is_empty())
@@ -261,7 +261,7 @@ Value ArrayPrototype::shift(Interpreter& interpreter)
 
 Value ArrayPrototype::to_string(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     auto join_function = this_object->get("join");
@@ -274,10 +274,10 @@ Value ArrayPrototype::to_string(Interpreter& interpreter)
 
 Value ArrayPrototype::to_locale_string(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
-    String separator = ",";  // NOTE: This is implementation-specific.
+    String separator = ","; // NOTE: This is implementation-specific.
     auto length = get_length(interpreter, *this_object);
     if (interpreter.exception())
         return {};
@@ -305,7 +305,7 @@ Value ArrayPrototype::to_locale_string(Interpreter& interpreter)
 
 Value ArrayPrototype::join(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     String separator = ",";
@@ -336,7 +336,7 @@ Value ArrayPrototype::join(Interpreter& interpreter)
 
 Value ArrayPrototype::concat(Interpreter& interpreter)
 {
-    auto* array = array_from(interpreter);
+    auto* array = array_from(interpreter, interpreter.global_object());
     if (!array)
         return {};
 
@@ -362,7 +362,7 @@ Value ArrayPrototype::concat(Interpreter& interpreter)
 
 Value ArrayPrototype::slice(Interpreter& interpreter)
 {
-    auto* array = array_from(interpreter);
+    auto* array = array_from(interpreter, interpreter.global_object());
     if (!array)
         return {};
 
@@ -407,7 +407,7 @@ Value ArrayPrototype::slice(Interpreter& interpreter)
 
 Value ArrayPrototype::index_of(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     i32 length = get_length(interpreter, *this_object);
@@ -438,7 +438,7 @@ Value ArrayPrototype::index_of(Interpreter& interpreter)
 
 Value ArrayPrototype::reduce(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
 
@@ -497,7 +497,7 @@ Value ArrayPrototype::reduce(Interpreter& interpreter)
 
 Value ArrayPrototype::reduce_right(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
 
@@ -556,7 +556,7 @@ Value ArrayPrototype::reduce_right(Interpreter& interpreter)
 
 Value ArrayPrototype::reverse(Interpreter& interpreter)
 {
-    auto* array = array_from(interpreter);
+    auto* array = array_from(interpreter, interpreter.global_object());
     if (!array)
         return {};
 
@@ -580,7 +580,7 @@ Value ArrayPrototype::reverse(Interpreter& interpreter)
 
 Value ArrayPrototype::last_index_of(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     i32 length = get_length(interpreter, *this_object);
@@ -611,7 +611,7 @@ Value ArrayPrototype::last_index_of(Interpreter& interpreter)
 
 Value ArrayPrototype::includes(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     i32 length = get_length(interpreter, *this_object);
@@ -644,7 +644,7 @@ Value ArrayPrototype::find(Interpreter& interpreter)
 {
     auto result = js_undefined();
     for_each_item(
-        interpreter, "find", [&](auto, auto value, auto callback_result) {
+        interpreter, interpreter.global_object(), "find", [&](auto, auto value, auto callback_result) {
             if (callback_result.to_boolean()) {
                 result = value;
                 return IterationDecision::Break;
@@ -659,7 +659,7 @@ Value ArrayPrototype::find_index(Interpreter& interpreter)
 {
     auto result_index = -1;
     for_each_item(
-        interpreter, "findIndex", [&](auto index, auto, auto callback_result) {
+        interpreter, interpreter.global_object(), "findIndex", [&](auto index, auto, auto callback_result) {
             if (callback_result.to_boolean()) {
                 result_index = index;
                 return IterationDecision::Break;
@@ -673,7 +673,7 @@ Value ArrayPrototype::find_index(Interpreter& interpreter)
 Value ArrayPrototype::some(Interpreter& interpreter)
 {
     auto result = false;
-    for_each_item(interpreter, "some", [&](auto, auto, auto callback_result) {
+    for_each_item(interpreter, interpreter.global_object(), "some", [&](auto, auto, auto callback_result) {
         if (callback_result.to_boolean()) {
             result = true;
             return IterationDecision::Break;
@@ -686,7 +686,7 @@ Value ArrayPrototype::some(Interpreter& interpreter)
 Value ArrayPrototype::every(Interpreter& interpreter)
 {
     auto result = true;
-    for_each_item(interpreter, "every", [&](auto, auto, auto callback_result) {
+    for_each_item(interpreter, interpreter.global_object(), "every", [&](auto, auto, auto callback_result) {
         if (!callback_result.to_boolean()) {
             result = false;
             return IterationDecision::Break;
@@ -698,7 +698,7 @@ Value ArrayPrototype::every(Interpreter& interpreter)
 
 Value ArrayPrototype::splice(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
 
@@ -801,7 +801,7 @@ Value ArrayPrototype::splice(Interpreter& interpreter)
 
 Value ArrayPrototype::fill(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
 

+ 4 - 4
Libraries/LibJS/Runtime/BigIntPrototype.cpp

@@ -45,9 +45,9 @@ BigIntPrototype::~BigIntPrototype()
 {
 }
 
-static BigIntObject* bigint_object_from(Interpreter& interpreter)
+static BigIntObject* bigint_object_from(Interpreter& interpreter, GlobalObject& global_object)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
     if (!this_object)
         return nullptr;
     if (!this_object->is_bigint_object()) {
@@ -59,7 +59,7 @@ static BigIntObject* bigint_object_from(Interpreter& interpreter)
 
 Value BigIntPrototype::to_string(Interpreter& interpreter)
 {
-    auto* bigint_object = bigint_object_from(interpreter);
+    auto* bigint_object = bigint_object_from(interpreter, interpreter.global_object());
     if (!bigint_object)
         return {};
     return js_string(interpreter, bigint_object->bigint().big_integer().to_base10());
@@ -72,7 +72,7 @@ Value BigIntPrototype::to_locale_string(Interpreter& interpreter)
 
 Value BigIntPrototype::value_of(Interpreter& interpreter)
 {
-    auto* bigint_object = bigint_object_from(interpreter);
+    auto* bigint_object = bigint_object_from(interpreter, interpreter.global_object());
     if (!bigint_object)
         return {};
     return bigint_object->value_of();

+ 2 - 2
Libraries/LibJS/Runtime/BooleanPrototype.cpp

@@ -43,7 +43,7 @@ BooleanPrototype::~BooleanPrototype() { }
 
 Value BooleanPrototype::to_string(Interpreter& interpreter)
 {
-    auto this_object = interpreter.this_value();
+    auto this_object = interpreter.this_value(interpreter.global_object());
     if (this_object.is_boolean()) {
         return js_string(interpreter.heap(), this_object.as_bool() ? "true" : "false");
     }
@@ -58,7 +58,7 @@ Value BooleanPrototype::to_string(Interpreter& interpreter)
 
 Value BooleanPrototype::value_of(Interpreter& interpreter)
 {
-    auto this_object = interpreter.this_value();
+    auto this_object = interpreter.this_value(interpreter.global_object());
     if (this_object.is_boolean()) {
         return this_object;
     }

+ 1 - 1
Libraries/LibJS/Runtime/BoundFunction.cpp

@@ -50,7 +50,7 @@ Value BoundFunction::call(Interpreter& interpreter)
 
 Value BoundFunction::construct(Interpreter& interpreter)
 {
-    if (auto this_value = interpreter.this_value(); m_constructor_prototype && this_value.is_object()) {
+    if (auto this_value = interpreter.this_value(global_object()); m_constructor_prototype && this_value.is_object()) {
         this_value.as_object().set_prototype(m_constructor_prototype);
         if (interpreter.exception())
             return {};

+ 1 - 1
Libraries/LibJS/Runtime/DatePrototype.cpp

@@ -38,7 +38,7 @@ namespace JS {
 
 static Date* this_date_from_interpreter(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return nullptr;
     if (!this_object->is_date()) {

+ 5 - 5
Libraries/LibJS/Runtime/ErrorPrototype.cpp

@@ -50,7 +50,7 @@ ErrorPrototype::~ErrorPrototype()
 
 Value ErrorPrototype::name_getter(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     if (!this_object->is_error())
@@ -60,7 +60,7 @@ Value ErrorPrototype::name_getter(Interpreter& interpreter)
 
 void ErrorPrototype::name_setter(Interpreter& interpreter, Value value)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return;
     if (!this_object->is_error()) {
@@ -75,7 +75,7 @@ void ErrorPrototype::name_setter(Interpreter& interpreter, Value value)
 
 Value ErrorPrototype::message_getter(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     if (!this_object->is_error())
@@ -85,9 +85,9 @@ Value ErrorPrototype::message_getter(Interpreter& interpreter)
 
 Value ErrorPrototype::to_string(Interpreter& interpreter)
 {
-    if (!interpreter.this_value().is_object())
+    if (!interpreter.this_value(interpreter.global_object()).is_object())
         return interpreter.throw_exception<TypeError>("Not an object");
-    auto& this_object = interpreter.this_value().as_object();
+    auto& this_object = interpreter.this_value(interpreter.global_object()).as_object();
 
     String name = "Error";
     auto name_property = this_object.get("name");

+ 4 - 4
Libraries/LibJS/Runtime/FunctionPrototype.cpp

@@ -60,7 +60,7 @@ FunctionPrototype::~FunctionPrototype()
 
 Value FunctionPrototype::apply(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     if (!this_object->is_function())
@@ -90,7 +90,7 @@ Value FunctionPrototype::apply(Interpreter& interpreter)
 
 Value FunctionPrototype::bind(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     if (!this_object->is_function())
@@ -110,7 +110,7 @@ Value FunctionPrototype::bind(Interpreter& interpreter)
 
 Value FunctionPrototype::call(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     if (!this_object->is_function())
@@ -127,7 +127,7 @@ Value FunctionPrototype::call(Interpreter& interpreter)
 
 Value FunctionPrototype::to_string(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     if (!this_object->is_function())

+ 5 - 4
Libraries/LibJS/Runtime/ObjectPrototype.cpp

@@ -28,6 +28,7 @@
 #include <AK/String.h>
 #include <LibJS/Heap/Heap.h>
 #include <LibJS/Interpreter.h>
+#include <LibJS/Runtime/GlobalObject.h>
 #include <LibJS/Runtime/ObjectPrototype.h>
 #include <LibJS/Runtime/Value.h>
 
@@ -55,7 +56,7 @@ ObjectPrototype::~ObjectPrototype()
 
 Value ObjectPrototype::has_own_property(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     auto name = interpreter.argument(0).to_string(interpreter);
@@ -66,7 +67,7 @@ Value ObjectPrototype::has_own_property(Interpreter& interpreter)
 
 Value ObjectPrototype::to_string(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     return js_string(interpreter, String::format("[object %s]", this_object->class_name()));
@@ -74,7 +75,7 @@ Value ObjectPrototype::to_string(Interpreter& interpreter)
 
 Value ObjectPrototype::to_locale_string(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     return this_object->invoke("toString");
@@ -82,7 +83,7 @@ Value ObjectPrototype::to_locale_string(Interpreter& interpreter)
 
 Value ObjectPrototype::value_of(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     return this_object->value_of();

+ 2 - 2
Libraries/LibJS/Runtime/ScriptFunction.cpp

@@ -37,7 +37,7 @@ namespace JS {
 
 static ScriptFunction* script_function_from(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return nullptr;
     if (!this_object->is_function()) {
@@ -53,7 +53,7 @@ ScriptFunction* ScriptFunction::create(GlobalObject& global_object, const FlyStr
 }
 
 ScriptFunction::ScriptFunction(const FlyString& name, const Statement& body, Vector<FunctionNode::Parameter> parameters, i32 m_function_length, LexicalEnvironment* parent_environment, Object& prototype, bool is_arrow_function)
-    : Function(prototype, is_arrow_function ? interpreter().this_value() : Value(), {})
+    : Function(prototype, is_arrow_function ? interpreter().this_value(interpreter().global_object()) : Value(), {})
     , m_name(name)
     , m_body(body)
     , m_parameters(move(parameters))

+ 2 - 2
Libraries/LibJS/Runtime/StringPrototype.cpp

@@ -41,7 +41,7 @@ namespace JS {
 
 static StringObject* string_object_from(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return nullptr;
     if (!this_object->is_string_object()) {
@@ -53,7 +53,7 @@ static StringObject* string_object_from(Interpreter& interpreter)
 
 static String string_from(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     return Value(this_object).to_string(interpreter);

+ 1 - 1
Libraries/LibJS/Runtime/SymbolPrototype.cpp

@@ -54,7 +54,7 @@ SymbolPrototype::~SymbolPrototype()
 
 static SymbolObject* this_symbol_from_interpreter(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return nullptr;
     if (!this_object->is_symbol_object()) {

+ 1 - 1
Libraries/LibJS/Runtime/Uint8ClampedArray.cpp

@@ -55,7 +55,7 @@ Uint8ClampedArray::~Uint8ClampedArray()
 
 Value Uint8ClampedArray::length_getter(Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     if (StringView(this_object->class_name()) != "Uint8ClampedArray")

+ 1 - 1
Libraries/LibWeb/Bindings/CanvasRenderingContext2DWrapper.cpp

@@ -78,7 +78,7 @@ CanvasRenderingContext2DWrapper::~CanvasRenderingContext2DWrapper()
 
 static CanvasRenderingContext2D* impl_from(JS::Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return nullptr;
     // FIXME: Verify that it's a CanvasRenderingContext2DWrapper somehow!

+ 2 - 1
Libraries/LibWeb/Bindings/DocumentWrapper.cpp

@@ -28,6 +28,7 @@
 #include <LibJS/Interpreter.h>
 #include <LibJS/Runtime/Array.h>
 #include <LibJS/Runtime/Error.h>
+#include <LibJS/Runtime/GlobalObject.h>
 #include <LibJS/Runtime/PrimitiveString.h>
 #include <LibJS/Runtime/Value.h>
 #include <LibWeb/Bindings/DocumentWrapper.h>
@@ -61,7 +62,7 @@ const Document& DocumentWrapper::node() const
 
 static Document* document_from(JS::Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     if (StringView("DocumentWrapper") != this_object->class_name()) {

+ 2 - 1
Libraries/LibWeb/Bindings/ElementWrapper.cpp

@@ -28,6 +28,7 @@
 #include <AK/Function.h>
 #include <LibJS/Interpreter.h>
 #include <LibJS/Runtime/Error.h>
+#include <LibJS/Runtime/GlobalObject.h>
 #include <LibJS/Runtime/PrimitiveString.h>
 #include <LibJS/Runtime/Value.h>
 #include <LibWeb/Bindings/ElementWrapper.h>
@@ -64,7 +65,7 @@ const Element& ElementWrapper::node() const
 
 static Element* impl_from(JS::Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return nullptr;
     // FIXME: Verify that it's an ElementWrapper somehow!

+ 1 - 1
Libraries/LibWeb/Bindings/EventTargetWrapper.cpp

@@ -51,7 +51,7 @@ EventTargetWrapper::~EventTargetWrapper()
 
 JS::Value EventTargetWrapper::add_event_listener(JS::Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return {};
     if (interpreter.argument_count() < 2)

+ 2 - 1
Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.cpp

@@ -27,6 +27,7 @@
 #include <AK/FlyString.h>
 #include <AK/Function.h>
 #include <LibJS/Interpreter.h>
+#include <LibJS/Runtime/GlobalObject.h>
 #include <LibJS/Runtime/PrimitiveString.h>
 #include <LibJS/Runtime/Value.h>
 #include <LibWeb/Bindings/CanvasRenderingContext2DWrapper.h>
@@ -62,7 +63,7 @@ const HTMLCanvasElement& HTMLCanvasElementWrapper::node() const
 
 static HTMLCanvasElement* impl_from(JS::Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return nullptr;
     // FIXME: Verify that it's a HTMLCanvasElementWrapper somehow!

+ 1 - 1
Libraries/LibWeb/Bindings/ImageDataWrapper.cpp

@@ -55,7 +55,7 @@ ImageDataWrapper::~ImageDataWrapper()
 
 static ImageData* impl_from(JS::Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object) {
         ASSERT_NOT_REACHED();
         return nullptr;

+ 2 - 1
Libraries/LibWeb/Bindings/MouseEventWrapper.cpp

@@ -28,6 +28,7 @@
 #include <AK/Function.h>
 #include <LibJS/Interpreter.h>
 #include <LibJS/Runtime/Function.h>
+#include <LibJS/Runtime/GlobalObject.h>
 #include <LibWeb/Bindings/MouseEventWrapper.h>
 #include <LibWeb/DOM/MouseEvent.h>
 
@@ -57,7 +58,7 @@ MouseEvent& MouseEventWrapper::event()
 
 static MouseEvent* impl_from(JS::Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return nullptr;
     // FIXME: Verify that it's a CanvasRenderingContext2DWrapper somehow!

+ 1 - 1
Libraries/LibWeb/Bindings/WindowObject.cpp

@@ -82,7 +82,7 @@ void WindowObject::visit_children(Visitor& visitor)
 
 static Window* impl_from(JS::Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object) {
         ASSERT_NOT_REACHED();
         return nullptr;

+ 1 - 1
Libraries/LibWeb/Bindings/XMLHttpRequestPrototype.cpp

@@ -56,7 +56,7 @@ XMLHttpRequestPrototype::~XMLHttpRequestPrototype()
 
 static XMLHttpRequest* impl_from(JS::Interpreter& interpreter)
 {
-    auto* this_object = interpreter.this_value().to_object(interpreter);
+    auto* this_object = interpreter.this_value(interpreter.global_object()).to_object(interpreter);
     if (!this_object)
         return nullptr;
     if (StringView("XMLHttpRequestWrapper") != this_object->class_name()) {