diff options
author | Linus Groh <mail@linusgroh.de> | 2020-05-17 21:38:47 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-18 09:39:55 +0200 |
commit | 1a1394f7a2f17bb0631cc4aaaa9c78f0cf700312 (patch) | |
tree | 0bdc66af107764ec738edfebd115f40cd580937e /Libraries | |
parent | b8b7f84547a1854a265cd94fe8037b039eb428e7 (diff) | |
download | serenity-1a1394f7a2f17bb0631cc4aaaa9c78f0cf700312.zip |
LibJS: Change Value::to_object(Heap& -> Interpreter&)
Passing a Heap& to it only to then call interpreter() on that is weird.
Let's just give it the Interpreter& directly, like some of the other
to_something() functions.
Diffstat (limited to 'Libraries')
25 files changed, 55 insertions, 56 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp index 35175f38ae..9e7ef87923 100644 --- a/Libraries/LibJS/AST.cpp +++ b/Libraries/LibJS/AST.cpp @@ -96,7 +96,7 @@ CallExpression::ThisAndCallee CallExpression::compute_this_and_callee(Interprete auto object_value = member_expression.object().execute(interpreter); if (interpreter.exception()) return {}; - auto* this_value = object_value.to_object(interpreter.heap()); + auto* this_value = object_value.to_object(interpreter); if (interpreter.exception()) return {}; auto callee = this_value->get(member_expression.computed_property_name(interpreter)).value_or(js_undefined()); @@ -431,7 +431,7 @@ Reference MemberExpression::to_reference(Interpreter& interpreter) const auto object_value = m_object->execute(interpreter); if (object_value.is_empty()) return {}; - auto* object = object_value.to_object(interpreter.heap()); + auto* object = object_value.to_object(interpreter); if (!object) return {}; auto property_name = computed_property_name(interpreter); @@ -452,7 +452,7 @@ Value UnaryExpression::execute(Interpreter& interpreter) const ASSERT(!reference.is_local_variable()); if (reference.is_global_variable()) return interpreter.global_object().delete_property(reference.name()); - auto* base_object = reference.base().to_object(interpreter.heap()); + auto* base_object = reference.base().to_object(interpreter); if (!base_object) return {}; return base_object->delete_property(reference.name()); @@ -1213,7 +1213,7 @@ Value MemberExpression::execute(Interpreter& interpreter) const auto object_value = m_object->execute(interpreter); if (interpreter.exception()) return {}; - auto* object_result = object_value.to_object(interpreter.heap()); + auto* object_result = object_value.to_object(interpreter); if (interpreter.exception()) return {}; return object_result->get(computed_property_name(interpreter)).value_or(js_undefined()); diff --git a/Libraries/LibJS/Runtime/Array.cpp b/Libraries/LibJS/Runtime/Array.cpp index 42186508fc..2b1d0eae59 100644 --- a/Libraries/LibJS/Runtime/Array.cpp +++ b/Libraries/LibJS/Runtime/Array.cpp @@ -51,7 +51,7 @@ Array::~Array() Array* array_from(Interpreter& interpreter) { - auto* this_object = interpreter.this_value().to_object(interpreter.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return {}; if (!this_object->is_array()) { diff --git a/Libraries/LibJS/Runtime/DatePrototype.cpp b/Libraries/LibJS/Runtime/DatePrototype.cpp index dc115c5a19..ee4bc9c095 100644 --- a/Libraries/LibJS/Runtime/DatePrototype.cpp +++ b/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.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return nullptr; if (!this_object->is_date()) { diff --git a/Libraries/LibJS/Runtime/ErrorPrototype.cpp b/Libraries/LibJS/Runtime/ErrorPrototype.cpp index c5e49f634b..b1f2afe684 100644 --- a/Libraries/LibJS/Runtime/ErrorPrototype.cpp +++ b/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.heap()); + auto* this_object = interpreter.this_value().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.heap()); + auto* this_object = interpreter.this_value().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.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return {}; if (!this_object->is_error()) diff --git a/Libraries/LibJS/Runtime/Function.cpp b/Libraries/LibJS/Runtime/Function.cpp index a698aba6ef..24ce9dc26f 100644 --- a/Libraries/LibJS/Runtime/Function.cpp +++ b/Libraries/LibJS/Runtime/Function.cpp @@ -60,7 +60,7 @@ BoundFunction* Function::bind(Value bound_this_value, Vector<Value> arguments) // FIXME: Null or undefined should be passed through in strict mode. return &interpreter().global_object(); default: - return bound_this_value.to_object(interpreter().heap()); + return bound_this_value.to_object(interpreter()); } }(); diff --git a/Libraries/LibJS/Runtime/FunctionPrototype.cpp b/Libraries/LibJS/Runtime/FunctionPrototype.cpp index d6f5d3a5fa..e499e4003c 100644 --- a/Libraries/LibJS/Runtime/FunctionPrototype.cpp +++ b/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.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return {}; if (!this_object->is_function()) @@ -86,7 +86,7 @@ Value FunctionPrototype::apply(Interpreter& interpreter) Value FunctionPrototype::bind(Interpreter& interpreter) { - auto* this_object = interpreter.this_value().to_object(interpreter.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return {}; if (!this_object->is_function()) @@ -106,7 +106,7 @@ Value FunctionPrototype::bind(Interpreter& interpreter) Value FunctionPrototype::call(Interpreter& interpreter) { - auto* this_object = interpreter.this_value().to_object(interpreter.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return {}; if (!this_object->is_function()) @@ -123,7 +123,7 @@ Value FunctionPrototype::call(Interpreter& interpreter) Value FunctionPrototype::to_string(Interpreter& interpreter) { - auto* this_object = interpreter.this_value().to_object(interpreter.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return {}; if (!this_object->is_function()) diff --git a/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Libraries/LibJS/Runtime/ObjectConstructor.cpp index 1b64521258..5753046be6 100644 --- a/Libraries/LibJS/Runtime/ObjectConstructor.cpp +++ b/Libraries/LibJS/Runtime/ObjectConstructor.cpp @@ -71,7 +71,7 @@ Value ObjectConstructor::get_own_property_names(Interpreter& interpreter) { if (!interpreter.argument_count()) return {}; - auto* object = interpreter.argument(0).to_object(interpreter.heap()); + auto* object = interpreter.argument(0).to_object(interpreter); if (interpreter.exception()) return {}; auto* result = Array::create(interpreter.global_object()); @@ -90,7 +90,7 @@ Value ObjectConstructor::get_prototype_of(Interpreter& interpreter) { if (!interpreter.argument_count()) return {}; - auto* object = interpreter.argument(0).to_object(interpreter.heap()); + auto* object = interpreter.argument(0).to_object(interpreter); if (interpreter.exception()) return {}; return object->prototype(); @@ -100,7 +100,7 @@ Value ObjectConstructor::set_prototype_of(Interpreter& interpreter) { if (interpreter.argument_count() < 2) return {}; - auto* object = interpreter.argument(0).to_object(interpreter.heap()); + auto* object = interpreter.argument(0).to_object(interpreter); if (interpreter.exception()) return {}; object->set_prototype(&const_cast<Object&>(interpreter.argument(1).as_object())); @@ -109,7 +109,7 @@ Value ObjectConstructor::set_prototype_of(Interpreter& interpreter) Value ObjectConstructor::get_own_property_descriptor(Interpreter& interpreter) { - auto* object = interpreter.argument(0).to_object(interpreter.heap()); + auto* object = interpreter.argument(0).to_object(interpreter); if (interpreter.exception()) return {}; auto property_key = interpreter.argument(1).to_string(interpreter); @@ -143,7 +143,7 @@ Value ObjectConstructor::keys(Interpreter& interpreter) if (!interpreter.argument_count()) return interpreter.throw_exception<TypeError>("Can't convert undefined to object"); - auto* obj_arg = interpreter.argument(0).to_object(interpreter.heap()); + auto* obj_arg = interpreter.argument(0).to_object(interpreter); if (interpreter.exception()) return {}; @@ -155,7 +155,7 @@ Value ObjectConstructor::values(Interpreter& interpreter) if (!interpreter.argument_count()) return interpreter.throw_exception<TypeError>("Can't convert undefined to object"); - auto* obj_arg = interpreter.argument(0).to_object(interpreter.heap()); + auto* obj_arg = interpreter.argument(0).to_object(interpreter); if (interpreter.exception()) return {}; @@ -167,7 +167,7 @@ Value ObjectConstructor::entries(Interpreter& interpreter) if (!interpreter.argument_count()) return interpreter.throw_exception<TypeError>("Can't convert undefined to object"); - auto* obj_arg = interpreter.argument(0).to_object(interpreter.heap()); + auto* obj_arg = interpreter.argument(0).to_object(interpreter); if (interpreter.exception()) return {}; diff --git a/Libraries/LibJS/Runtime/ObjectPrototype.cpp b/Libraries/LibJS/Runtime/ObjectPrototype.cpp index 2c06d325b0..966c43241e 100644 --- a/Libraries/LibJS/Runtime/ObjectPrototype.cpp +++ b/Libraries/LibJS/Runtime/ObjectPrototype.cpp @@ -54,7 +54,7 @@ ObjectPrototype::~ObjectPrototype() Value ObjectPrototype::has_own_property(Interpreter& interpreter) { - auto* this_object = interpreter.this_value().to_object(interpreter.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return {}; auto name = interpreter.argument(0).to_string(interpreter); @@ -65,7 +65,7 @@ Value ObjectPrototype::has_own_property(Interpreter& interpreter) Value ObjectPrototype::to_string(Interpreter& interpreter) { - auto* this_object = interpreter.this_value().to_object(interpreter.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return {}; return js_string(interpreter, String::format("[object %s]", this_object->class_name())); @@ -73,7 +73,7 @@ Value ObjectPrototype::to_string(Interpreter& interpreter) Value ObjectPrototype::value_of(Interpreter& interpreter) { - auto* this_object = interpreter.this_value().to_object(interpreter.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return {}; return this_object->value_of(); diff --git a/Libraries/LibJS/Runtime/Reference.cpp b/Libraries/LibJS/Runtime/Reference.cpp index 945e671263..aa2d1ac96d 100644 --- a/Libraries/LibJS/Runtime/Reference.cpp +++ b/Libraries/LibJS/Runtime/Reference.cpp @@ -50,7 +50,7 @@ void Reference::put(Interpreter& interpreter, Value value) return; } - auto* object = base().to_object(interpreter.heap()); + auto* object = base().to_object(interpreter); if (!object) return; @@ -92,7 +92,7 @@ Value Reference::get(Interpreter& interpreter) return value; } - auto* object = base().to_object(interpreter.heap()); + auto* object = base().to_object(interpreter); if (!object) return {}; diff --git a/Libraries/LibJS/Runtime/ScriptFunction.cpp b/Libraries/LibJS/Runtime/ScriptFunction.cpp index 2d713bef0f..4eb5f5549b 100644 --- a/Libraries/LibJS/Runtime/ScriptFunction.cpp +++ b/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.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return nullptr; if (!this_object->is_function()) { diff --git a/Libraries/LibJS/Runtime/StringConstructor.cpp b/Libraries/LibJS/Runtime/StringConstructor.cpp index dde7015348..9f51d3831a 100644 --- a/Libraries/LibJS/Runtime/StringConstructor.cpp +++ b/Libraries/LibJS/Runtime/StringConstructor.cpp @@ -71,7 +71,7 @@ Value StringConstructor::construct(Interpreter& interpreter) Value StringConstructor::raw(Interpreter& interpreter) { - auto* template_object = interpreter.argument(0).to_object(interpreter.heap()); + auto* template_object = interpreter.argument(0).to_object(interpreter); if (interpreter.exception()) return {}; @@ -83,7 +83,7 @@ Value StringConstructor::raw(Interpreter& interpreter) if (!raw.is_array()) return js_string(interpreter, ""); - auto& raw_array_elements = static_cast<Array*>(raw.to_object(interpreter.heap()))->elements(); + auto& raw_array_elements = static_cast<Array*>(raw.to_object(interpreter))->elements(); StringBuilder builder; for (size_t i = 0; i < raw_array_elements.size(); ++i) { diff --git a/Libraries/LibJS/Runtime/StringPrototype.cpp b/Libraries/LibJS/Runtime/StringPrototype.cpp index bc54c5823d..10e8b96830 100644 --- a/Libraries/LibJS/Runtime/StringPrototype.cpp +++ b/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.heap()); + auto* this_object = interpreter.this_value().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.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return {}; return Value(this_object).to_string(interpreter); diff --git a/Libraries/LibJS/Runtime/SymbolPrototype.cpp b/Libraries/LibJS/Runtime/SymbolPrototype.cpp index 8512a8fa85..7f8a7b923f 100644 --- a/Libraries/LibJS/Runtime/SymbolPrototype.cpp +++ b/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.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return nullptr; if (!this_object->is_symbol_object()) { diff --git a/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp b/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp index 9ccbada203..74cc674a49 100644 --- a/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp +++ b/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp @@ -57,7 +57,7 @@ Uint8ClampedArray::~Uint8ClampedArray() Value Uint8ClampedArray::length_getter(Interpreter& interpreter) { - auto* this_object = interpreter.this_value().to_object(interpreter.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return {}; if (StringView(this_object->class_name()) != "Uint8ClampedArray") diff --git a/Libraries/LibJS/Runtime/Value.cpp b/Libraries/LibJS/Runtime/Value.cpp index 8055331c02..46c19bc49b 100644 --- a/Libraries/LibJS/Runtime/Value.cpp +++ b/Libraries/LibJS/Runtime/Value.cpp @@ -176,25 +176,25 @@ Value Value::to_primitive(Interpreter&) const return *this; } -Object* Value::to_object(Heap& heap) const +Object* Value::to_object(Interpreter& interpreter) const { if (is_object()) return &const_cast<Object&>(as_object()); if (is_string()) - return StringObject::create(heap.interpreter().global_object(), *m_value.as_string); + return StringObject::create(interpreter.global_object(), *m_value.as_string); if (is_symbol()) - return SymbolObject::create(heap.interpreter().global_object(), *m_value.as_symbol); + return SymbolObject::create(interpreter.global_object(), *m_value.as_symbol); if (is_number()) - return NumberObject::create(heap.interpreter().global_object(), m_value.as_double); + return NumberObject::create(interpreter.global_object(), m_value.as_double); if (is_boolean()) - return BooleanObject::create(heap.interpreter().global_object(), m_value.as_bool); + return BooleanObject::create(interpreter.global_object(), m_value.as_bool); if (is_null() || is_undefined()) { - heap.interpreter().throw_exception<TypeError>("ToObject on null or undefined."); + interpreter.throw_exception<TypeError>("ToObject on null or undefined."); return nullptr; } diff --git a/Libraries/LibJS/Runtime/Value.h b/Libraries/LibJS/Runtime/Value.h index e798f2646e..ee1d3bbb90 100644 --- a/Libraries/LibJS/Runtime/Value.h +++ b/Libraries/LibJS/Runtime/Value.h @@ -186,14 +186,13 @@ public: String to_string(Interpreter&) const; PrimitiveString* to_primitive_string(Interpreter&); + Value to_primitive(Interpreter&) const; + Object* to_object(Interpreter&) const; bool to_boolean() const; Value to_number() const; i32 to_i32() const; double to_double() const; size_t to_size_t() const; - Value to_primitive(Interpreter&) const; - - Object* to_object(Heap&) const; Value value_or(Value fallback) const { diff --git a/Libraries/LibWeb/Bindings/CanvasRenderingContext2DWrapper.cpp b/Libraries/LibWeb/Bindings/CanvasRenderingContext2DWrapper.cpp index 4fc1ac7238..34e8dd7b18 100644 --- a/Libraries/LibWeb/Bindings/CanvasRenderingContext2DWrapper.cpp +++ b/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.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return nullptr; // FIXME: Verify that it's a CanvasRenderingContext2DWrapper somehow! @@ -116,7 +116,7 @@ JS::Value CanvasRenderingContext2DWrapper::draw_image(JS::Interpreter& interpret if (arguments.size() < 3) return interpreter.throw_exception<JS::TypeError>("drawImage() needs more arguments"); - auto* image_argument = arguments[0].to_object(interpreter.heap()); + auto* image_argument = arguments[0].to_object(interpreter); if (!image_argument) return {}; if (StringView(image_argument->class_name()) != "HTMLImageElementWrapper") @@ -307,7 +307,7 @@ JS::Value CanvasRenderingContext2DWrapper::put_image_data(JS::Interpreter& inter if (!impl) return {}; - auto* image_data_object = interpreter.argument(0).to_object(interpreter.heap()); + auto* image_data_object = interpreter.argument(0).to_object(interpreter); if (!image_data_object) return {}; diff --git a/Libraries/LibWeb/Bindings/DocumentWrapper.cpp b/Libraries/LibWeb/Bindings/DocumentWrapper.cpp index aab6b105bd..fc47502bc1 100644 --- a/Libraries/LibWeb/Bindings/DocumentWrapper.cpp +++ b/Libraries/LibWeb/Bindings/DocumentWrapper.cpp @@ -60,7 +60,7 @@ const Document& DocumentWrapper::node() const static Document* document_from(JS::Interpreter& interpreter) { - auto* this_object = interpreter.this_value().to_object(interpreter.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return {}; if (StringView("DocumentWrapper") != this_object->class_name()) { diff --git a/Libraries/LibWeb/Bindings/ElementWrapper.cpp b/Libraries/LibWeb/Bindings/ElementWrapper.cpp index 7907619ad4..517e39e8b9 100644 --- a/Libraries/LibWeb/Bindings/ElementWrapper.cpp +++ b/Libraries/LibWeb/Bindings/ElementWrapper.cpp @@ -58,7 +58,7 @@ const Element& ElementWrapper::node() const static Element* impl_from(JS::Interpreter& interpreter) { - auto* this_object = interpreter.this_value().to_object(interpreter.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return nullptr; // FIXME: Verify that it's an ElementWrapper somehow! diff --git a/Libraries/LibWeb/Bindings/EventTargetWrapper.cpp b/Libraries/LibWeb/Bindings/EventTargetWrapper.cpp index 50c91d7622..879c03dbb6 100644 --- a/Libraries/LibWeb/Bindings/EventTargetWrapper.cpp +++ b/Libraries/LibWeb/Bindings/EventTargetWrapper.cpp @@ -50,7 +50,7 @@ EventTargetWrapper::~EventTargetWrapper() JS::Value EventTargetWrapper::add_event_listener(JS::Interpreter& interpreter) { - auto* this_object = interpreter.this_value().to_object(interpreter.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return {}; auto& arguments = interpreter.call_frame().arguments; diff --git a/Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.cpp b/Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.cpp index 74f196b645..8479601ad6 100644 --- a/Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.cpp +++ b/Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.cpp @@ -62,7 +62,7 @@ const HTMLCanvasElement& HTMLCanvasElementWrapper::node() const static HTMLCanvasElement* impl_from(JS::Interpreter& interpreter) { - auto* this_object = interpreter.this_value().to_object(interpreter.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return nullptr; // FIXME: Verify that it's a HTMLCanvasElementWrapper somehow! diff --git a/Libraries/LibWeb/Bindings/ImageDataWrapper.cpp b/Libraries/LibWeb/Bindings/ImageDataWrapper.cpp index c57b96be6f..fe7bb3708b 100644 --- a/Libraries/LibWeb/Bindings/ImageDataWrapper.cpp +++ b/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.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) { ASSERT_NOT_REACHED(); return nullptr; diff --git a/Libraries/LibWeb/Bindings/MouseEventWrapper.cpp b/Libraries/LibWeb/Bindings/MouseEventWrapper.cpp index 51949df663..c369c26d52 100644 --- a/Libraries/LibWeb/Bindings/MouseEventWrapper.cpp +++ b/Libraries/LibWeb/Bindings/MouseEventWrapper.cpp @@ -57,7 +57,7 @@ MouseEvent& MouseEventWrapper::event() static MouseEvent* impl_from(JS::Interpreter& interpreter) { - auto* this_object = interpreter.this_value().to_object(interpreter.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return nullptr; // FIXME: Verify that it's a CanvasRenderingContext2DWrapper somehow! diff --git a/Libraries/LibWeb/Bindings/WindowObject.cpp b/Libraries/LibWeb/Bindings/WindowObject.cpp index 1c1dcedce4..7a680cdafe 100644 --- a/Libraries/LibWeb/Bindings/WindowObject.cpp +++ b/Libraries/LibWeb/Bindings/WindowObject.cpp @@ -80,7 +80,7 @@ void WindowObject::visit_children(Visitor& visitor) static Window* impl_from(JS::Interpreter& interpreter) { - auto* this_object = interpreter.this_value().to_object(interpreter.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) { ASSERT_NOT_REACHED(); return nullptr; @@ -129,7 +129,7 @@ JS::Value WindowObject::set_interval(JS::Interpreter& interpreter) auto& arguments = interpreter.call_frame().arguments; if (arguments.size() < 2) return {}; - auto* callback_object = arguments[0].to_object(interpreter.heap()); + auto* callback_object = arguments[0].to_object(interpreter); if (!callback_object) return {}; if (!callback_object->is_function()) @@ -146,7 +146,7 @@ JS::Value WindowObject::set_timeout(JS::Interpreter& interpreter) auto& arguments = interpreter.call_frame().arguments; if (arguments.size() < 1) return {}; - auto* callback_object = arguments[0].to_object(interpreter.heap()); + auto* callback_object = arguments[0].to_object(interpreter); if (!callback_object) return {}; if (!callback_object->is_function()) @@ -168,7 +168,7 @@ JS::Value WindowObject::request_animation_frame(JS::Interpreter& interpreter) auto& arguments = interpreter.call_frame().arguments; if (arguments.size() < 1) return {}; - auto* callback_object = arguments[0].to_object(interpreter.heap()); + auto* callback_object = arguments[0].to_object(interpreter); if (!callback_object) return {}; if (!callback_object->is_function()) diff --git a/Libraries/LibWeb/Bindings/XMLHttpRequestPrototype.cpp b/Libraries/LibWeb/Bindings/XMLHttpRequestPrototype.cpp index 48e82fac1a..43d9cdae1c 100644 --- a/Libraries/LibWeb/Bindings/XMLHttpRequestPrototype.cpp +++ b/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.heap()); + auto* this_object = interpreter.this_value().to_object(interpreter); if (!this_object) return nullptr; if (StringView("XMLHttpRequestWrapper") != this_object->class_name()) { |