1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:57:43 +00:00

LibJS/JIT: Resolve the GlobalVariableCache pointers at JIT time

This commit is contained in:
Andreas Kling 2023-11-05 14:37:54 +01:00
parent f03d4a1ffe
commit a616a682fe
4 changed files with 9 additions and 7 deletions

View file

@ -89,12 +89,11 @@ ThrowCompletionOr<Value> get_by_value(VM& vm, Value base_value, Value property_k
return TRY(object->internal_get(property_key, base_value));
}
ThrowCompletionOr<Value> get_global(Bytecode::Interpreter& interpreter, DeprecatedFlyString const& identifier, u32 cache_index)
ThrowCompletionOr<Value> get_global(Bytecode::Interpreter& interpreter, DeprecatedFlyString const& identifier, GlobalVariableCache& cache)
{
auto& vm = interpreter.vm();
auto& realm = *vm.current_realm();
auto& cache = interpreter.current_executable().global_variable_caches[cache_index];
auto& binding_object = realm.global_environment().object_record().binding_object();
auto& declarative_record = realm.global_environment().declarative_record();

View file

@ -15,7 +15,7 @@ namespace JS::Bytecode {
ThrowCompletionOr<NonnullGCPtr<Object>> base_object_for_get(VM&, Value base_value);
ThrowCompletionOr<Value> get_by_id(VM&, DeprecatedFlyString const& property, Value base_value, Value this_value, PropertyLookupCache&);
ThrowCompletionOr<Value> get_by_value(VM&, Value base_value, Value property_key_value);
ThrowCompletionOr<Value> get_global(Bytecode::Interpreter&, DeprecatedFlyString const& identifier, u32 cache_index);
ThrowCompletionOr<Value> get_global(Bytecode::Interpreter&, DeprecatedFlyString const& identifier, GlobalVariableCache&);
ThrowCompletionOr<void> put_by_property_key(VM&, Value base, Value this_value, Value value, PropertyKey name, Op::PropertyKind kind);
ThrowCompletionOr<Value> perform_call(Interpreter&, Value this_value, Op::CallType, Value callee, MarkedVector<Value> argument_values);
ThrowCompletionOr<void> throw_if_needed_for_call(Interpreter&, Value callee, Op::CallType, Optional<StringTableIndex> const& expression_string);

View file

@ -697,7 +697,10 @@ ThrowCompletionOr<void> GetCalleeAndThisFromEnvironment::execute_impl(Bytecode::
ThrowCompletionOr<void> GetGlobal::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.accumulator() = TRY(get_global(interpreter, interpreter.current_executable().get_identifier(m_identifier), m_cache_index));
interpreter.accumulator() = TRY(get_global(
interpreter,
interpreter.current_executable().get_identifier(m_identifier),
interpreter.current_executable().global_variable_caches[m_cache_index]));
return {};
}