1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:07:36 +00:00

LibJS: Remove GlobalObject from VM::this_value()

This is a continuation of the previous six commits.

The global object is only needed to return it if the execution context
stack is empty, but that doesn't seem like a useful thing to allow in
the first place - if you're not currently executing JS, and the
execution context stack is empty, there is no this value to retrieve.
This commit is contained in:
Linus Groh 2022-08-20 09:48:43 +01:00
parent f3117d46dc
commit 999da617c5
36 changed files with 208 additions and 206 deletions

View file

@ -63,8 +63,11 @@ public:
void gather_roots(HashTable<Cell*>&);
#define __JS_ENUMERATE(SymbolName, snake_name) \
Symbol* well_known_symbol_##snake_name() const { return m_well_known_symbol_##snake_name; }
#define __JS_ENUMERATE(SymbolName, snake_name) \
Symbol* well_known_symbol_##snake_name() const \
{ \
return m_well_known_symbol_##snake_name; \
}
JS_ENUMERATE_WELL_KNOWN_SYMBOLS
#undef __JS_ENUMERATE
@ -144,10 +147,9 @@ public:
return index < arguments.size() ? arguments[index] : js_undefined();
}
Value this_value(Object& global_object) const
Value this_value() const
{
if (m_execution_context_stack.is_empty())
return &global_object;
VERIFY(!m_execution_context_stack.is_empty());
return running_execution_context().this_value;
}