diff --git a/Libraries/LibJS/Runtime/Array.cpp b/Libraries/LibJS/Runtime/Array.cpp index ac915891da..a5b5c24197 100644 --- a/Libraries/LibJS/Runtime/Array.cpp +++ b/Libraries/LibJS/Runtime/Array.cpp @@ -25,7 +25,6 @@ */ #include -#include #include #include #include @@ -35,8 +34,7 @@ namespace JS { Array* Array::create(GlobalObject& global_object) { - auto& interpreter = global_object.interpreter(); - return interpreter.heap().allocate(global_object, *global_object.array_prototype()); + return global_object.heap().allocate(global_object, *global_object.array_prototype()); } Array::Array(Object& prototype) diff --git a/Libraries/LibJS/Runtime/BooleanObject.cpp b/Libraries/LibJS/Runtime/BooleanObject.cpp index 14076c3861..b6a4cef400 100644 --- a/Libraries/LibJS/Runtime/BooleanObject.cpp +++ b/Libraries/LibJS/Runtime/BooleanObject.cpp @@ -24,7 +24,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include #include @@ -32,8 +31,7 @@ namespace JS { BooleanObject* BooleanObject::create(GlobalObject& global_object, bool value) { - auto& interpreter = global_object.interpreter(); - return interpreter.heap().allocate(global_object, value, *global_object.boolean_prototype()); + return global_object.heap().allocate(global_object, value, *global_object.boolean_prototype()); } BooleanObject::BooleanObject(bool value, Object& prototype) diff --git a/Libraries/LibJS/Runtime/Error.cpp b/Libraries/LibJS/Runtime/Error.cpp index 1a6123aee5..ce17bbed9f 100644 --- a/Libraries/LibJS/Runtime/Error.cpp +++ b/Libraries/LibJS/Runtime/Error.cpp @@ -24,7 +24,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include #include @@ -32,8 +31,7 @@ namespace JS { Error* Error::create(GlobalObject& global_object, const FlyString& name, const String& message) { - auto& interpreter = global_object.interpreter(); - return interpreter.heap().allocate(global_object, name, message, *global_object.error_prototype()); + return global_object.heap().allocate(global_object, name, message, *global_object.error_prototype()); } Error::Error(const FlyString& name, const String& message, Object& prototype) diff --git a/Libraries/LibJS/Runtime/Function.cpp b/Libraries/LibJS/Runtime/Function.cpp index 86851e1603..f7e5e66c26 100644 --- a/Libraries/LibJS/Runtime/Function.cpp +++ b/Libraries/LibJS/Runtime/Function.cpp @@ -67,14 +67,14 @@ BoundFunction* Function::bind(Value bound_this_value, Vector arguments) i32 computed_length = 0; auto length_property = get("length"); - if (interpreter().exception()) + if (vm().exception()) return nullptr; if (length_property.is_number()) computed_length = max(0, length_property.as_i32() - static_cast(arguments.size())); Object* constructor_prototype = nullptr; auto prototype_property = target_function.get("prototype"); - if (interpreter().exception()) + if (vm().exception()) return nullptr; if (prototype_property.is_object()) constructor_prototype = &prototype_property.as_object(); @@ -82,7 +82,7 @@ BoundFunction* Function::bind(Value bound_this_value, Vector arguments) auto all_bound_arguments = bound_arguments(); all_bound_arguments.append(move(arguments)); - return interpreter().heap().allocate(global_object(), global_object(), target_function, bound_this_object, move(all_bound_arguments), computed_length, constructor_prototype); + return heap().allocate(global_object(), global_object(), target_function, bound_this_object, move(all_bound_arguments), computed_length, constructor_prototype); } void Function::visit_children(Visitor& visitor) diff --git a/Libraries/LibJS/Runtime/LexicalEnvironment.cpp b/Libraries/LibJS/Runtime/LexicalEnvironment.cpp index 470f8ba6ee..47a78e0d44 100644 --- a/Libraries/LibJS/Runtime/LexicalEnvironment.cpp +++ b/Libraries/LibJS/Runtime/LexicalEnvironment.cpp @@ -118,7 +118,7 @@ Value LexicalEnvironment::get_this_binding() const { ASSERT(has_this_binding()); if (this_binding_status() == ThisBindingStatus::Uninitialized) { - interpreter().vm().throw_exception(interpreter().global_object(), ErrorType::ThisHasNotBeenInitialized); + vm().throw_exception(interpreter().global_object(), ErrorType::ThisHasNotBeenInitialized); return {}; } return m_this_value; @@ -128,7 +128,7 @@ void LexicalEnvironment::bind_this_value(Value this_value) { ASSERT(has_this_binding()); if (m_this_binding_status == ThisBindingStatus::Initialized) { - interpreter().vm().throw_exception(interpreter().global_object(), ErrorType::ThisIsAlreadyInitialized); + vm().throw_exception(interpreter().global_object(), ErrorType::ThisIsAlreadyInitialized); return; } m_this_value = this_value; diff --git a/Libraries/LibJS/Runtime/NativeFunction.cpp b/Libraries/LibJS/Runtime/NativeFunction.cpp index caa77e3801..da8aa772a1 100644 --- a/Libraries/LibJS/Runtime/NativeFunction.cpp +++ b/Libraries/LibJS/Runtime/NativeFunction.cpp @@ -70,7 +70,7 @@ Value NativeFunction::construct(Function&) LexicalEnvironment* NativeFunction::create_environment() { - return interpreter().heap().allocate(global_object(), LexicalEnvironment::EnvironmentRecordType::Function); + return heap().allocate(global_object(), LexicalEnvironment::EnvironmentRecordType::Function); } } diff --git a/Libraries/LibJS/Runtime/Object.cpp b/Libraries/LibJS/Runtime/Object.cpp index 1f30517d9f..19ffdcea20 100644 --- a/Libraries/LibJS/Runtime/Object.cpp +++ b/Libraries/LibJS/Runtime/Object.cpp @@ -547,7 +547,7 @@ bool Object::put_own_property_by_index(Object& this_object, u32 property_index, dbg() << "Disallow define_property of non-extensible object"; #endif if (throw_exceptions && interpreter().in_strict_mode()) - interpreter().vm().throw_exception(global_object(), ErrorType::NonExtensibleDefine, property_index); + vm().throw_exception(global_object(), ErrorType::NonExtensibleDefine, property_index); return false; } @@ -566,7 +566,7 @@ bool Object::put_own_property_by_index(Object& this_object, u32 property_index, dbg() << "Disallow reconfig of non-configurable property"; #endif if (throw_exceptions) - interpreter().vm().throw_exception(global_object(), ErrorType::DescChangeNonConfigurable, property_index); + vm().throw_exception(global_object(), ErrorType::DescChangeNonConfigurable, property_index); return false; } diff --git a/Libraries/LibJS/Runtime/ScriptFunction.cpp b/Libraries/LibJS/Runtime/ScriptFunction.cpp index 8d61815130..879b9f64a3 100644 --- a/Libraries/LibJS/Runtime/ScriptFunction.cpp +++ b/Libraries/LibJS/Runtime/ScriptFunction.cpp @@ -53,7 +53,7 @@ ScriptFunction* ScriptFunction::create(GlobalObject& global_object, const FlyStr } ScriptFunction::ScriptFunction(GlobalObject& global_object, const FlyString& name, const Statement& body, Vector parameters, i32 m_function_length, LexicalEnvironment* parent_environment, Object& prototype, bool is_arrow_function) - : Function(prototype, is_arrow_function ? interpreter().this_value(global_object) : Value(), {}) + : Function(prototype, is_arrow_function ? vm().this_value(global_object) : Value(), {}) , m_name(name) , m_body(body) , m_parameters(move(parameters)) diff --git a/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp b/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp index ba8b8ba2b0..54194a2580 100644 --- a/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp +++ b/Libraries/LibJS/Runtime/Uint8ClampedArray.cpp @@ -25,7 +25,6 @@ */ #include -#include #include #include #include @@ -34,8 +33,7 @@ namespace JS { Uint8ClampedArray* Uint8ClampedArray::create(GlobalObject& global_object, u32 length) { - auto& interpreter = global_object.interpreter(); - return interpreter.heap().allocate(global_object, length, *global_object.array_prototype()); + return global_object.heap().allocate(global_object, length, *global_object.array_prototype()); } Uint8ClampedArray::Uint8ClampedArray(u32 length, Object& prototype)