summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Runtime/GlobalObject.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-09-27 18:36:49 +0200
committerAndreas Kling <kling@serenityos.org>2020-09-27 20:26:58 +0200
commit340a115dfe9518eae3d76154fba9092c36526430 (patch)
treeced6db98e45ce6ac110db8e6a2a8ba7d95565cea /Libraries/LibJS/Runtime/GlobalObject.cpp
parent1ff9d33131921d97b5de99496f933bcebeb4faaa (diff)
downloadserenity-340a115dfe9518eae3d76154fba9092c36526430.zip
LibJS: Make native function/property callbacks take VM, not Interpreter
More work on decoupling the general runtime from Interpreter. The goal is becoming clearer. Interpreter should be one possible way to execute code inside a VM. In the future we might have other ways :^)
Diffstat (limited to 'Libraries/LibJS/Runtime/GlobalObject.cpp')
-rw-r--r--Libraries/LibJS/Runtime/GlobalObject.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/Libraries/LibJS/Runtime/GlobalObject.cpp b/Libraries/LibJS/Runtime/GlobalObject.cpp
index da2024b4a5..38d96ba86e 100644
--- a/Libraries/LibJS/Runtime/GlobalObject.cpp
+++ b/Libraries/LibJS/Runtime/GlobalObject.cpp
@@ -153,36 +153,36 @@ void GlobalObject::visit_children(Visitor& visitor)
JS_DEFINE_NATIVE_FUNCTION(GlobalObject::gc)
{
dbg() << "Forced garbage collection requested!";
- interpreter.heap().collect_garbage();
+ vm.heap().collect_garbage();
return js_undefined();
}
JS_DEFINE_NATIVE_FUNCTION(GlobalObject::is_nan)
{
- auto number = interpreter.argument(0).to_number(interpreter);
- if (interpreter.exception())
+ auto number = vm.argument(0).to_number(global_object);
+ if (vm.exception())
return {};
return Value(number.is_nan());
}
JS_DEFINE_NATIVE_FUNCTION(GlobalObject::is_finite)
{
- auto number = interpreter.argument(0).to_number(interpreter);
- if (interpreter.exception())
+ auto number = vm.argument(0).to_number(global_object);
+ if (vm.exception())
return {};
return Value(number.is_finite_number());
}
JS_DEFINE_NATIVE_FUNCTION(GlobalObject::parse_float)
{
- if (interpreter.argument(0).is_number())
- return interpreter.argument(0);
- auto string = interpreter.argument(0).to_string(interpreter);
- if (interpreter.exception())
+ if (vm.argument(0).is_number())
+ return vm.argument(0);
+ auto string = vm.argument(0).to_string(global_object);
+ if (vm.exception())
return {};
for (size_t length = string.length(); length > 0; --length) {
// This can't throw, so no exception check is fine.
- auto number = Value(js_string(interpreter, string.substring(0, length))).to_number(interpreter);
+ auto number = Value(js_string(vm, string.substring(0, length))).to_number(global_object);
if (!number.is_nan())
return number;
}