summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Runtime/VM.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibJS/Runtime/VM.cpp')
-rw-r--r--Libraries/LibJS/Runtime/VM.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/Libraries/LibJS/Runtime/VM.cpp b/Libraries/LibJS/Runtime/VM.cpp
index 41919e2fbd..40c48102fd 100644
--- a/Libraries/LibJS/Runtime/VM.cpp
+++ b/Libraries/LibJS/Runtime/VM.cpp
@@ -187,7 +187,7 @@ Reference VM::get_reference(const FlyString& name)
Value VM::construct(Function& function, Function& new_target, Optional<MarkedValueList> arguments, GlobalObject& global_object)
{
- auto& call_frame = push_call_frame();
+ auto& call_frame = push_call_frame(function.is_strict_mode());
ArmedScopeGuard call_frame_popper = [&] {
pop_call_frame();
@@ -304,7 +304,7 @@ Value VM::call_internal(Function& function, Value this_value, Optional<MarkedVal
{
ASSERT(!exception());
- auto& call_frame = push_call_frame();
+ auto& call_frame = push_call_frame(function.is_strict_mode());
call_frame.function_name = function.name();
call_frame.this_value = function.bound_this().value_or(this_value);
call_frame.arguments = function.bound_arguments();
@@ -320,4 +320,11 @@ Value VM::call_internal(Function& function, Value this_value, Optional<MarkedVal
return result;
}
+bool VM::in_strict_mode() const
+{
+ if (call_stack().is_empty())
+ return false;
+ return call_frame().is_strict_mode;
+}
+
}