From 7d44640c0fb1141f5c805431f2bc2bbf9eed0754 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Fri, 16 May 2025 12:37:15 +1200 Subject: [PATCH] LibJS: Assume is_strict_mode called with running execution context This should always be invoked when there is an execution context on the stack. --- Libraries/LibJS/Runtime/VM.cpp | 7 ------- Libraries/LibJS/Runtime/VM.h | 5 ++++- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Libraries/LibJS/Runtime/VM.cpp b/Libraries/LibJS/Runtime/VM.cpp index c6ff8bcbf30..19471a812df 100644 --- a/Libraries/LibJS/Runtime/VM.cpp +++ b/Libraries/LibJS/Runtime/VM.cpp @@ -407,13 +407,6 @@ Object& VM::get_global_object() return current_realm.global_object(); } -bool VM::in_strict_mode() const -{ - if (execution_context_stack().is_empty()) - return false; - return running_execution_context().is_strict_mode; -} - void VM::run_queued_promise_jobs_impl() { dbgln_if(PROMISE_DEBUG, "Running queued promise jobs"); diff --git a/Libraries/LibJS/Runtime/VM.h b/Libraries/LibJS/Runtime/VM.h index 698f74ca664..ebf903bd7a9 100644 --- a/Libraries/LibJS/Runtime/VM.h +++ b/Libraries/LibJS/Runtime/VM.h @@ -164,7 +164,10 @@ public: FunctionObject const* active_function_object() const { return running_execution_context().function; } FunctionObject* active_function_object() { return running_execution_context().function; } - bool in_strict_mode() const; + bool in_strict_mode() const + { + return running_execution_context().is_strict_mode; + } size_t argument_count() const {