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

LibJS: Expose various offsets for GetGlobal JIT fast path

This commit is contained in:
iliadsh 2023-11-13 01:44:39 +00:00 committed by Andreas Kling
parent c739c931c1
commit ddea710933
6 changed files with 11 additions and 0 deletions

View file

@ -34,6 +34,8 @@ struct PropertyLookupCache {
};
struct GlobalVariableCache : public PropertyLookupCache {
static FlatPtr environment_serial_number_offset() { return OFFSET_OF(GlobalVariableCache, environment_serial_number); }
u64 environment_serial_number { 0 };
};

View file

@ -71,6 +71,7 @@ public:
[[nodiscard]] u64 environment_serial_number() const { return m_environment_serial_number; }
static FlatPtr bindings_offset() { return OFFSET_OF(DeclarativeEnvironment, m_bindings); }
static FlatPtr environment_serial_number_offset() { return OFFSET_OF(DeclarativeEnvironment, m_environment_serial_number); }
private:
ThrowCompletionOr<Value> get_binding_value_direct(VM&, Binding&, bool strict);

View file

@ -30,6 +30,7 @@ struct ExecutionContext {
void visit_edges(Cell::Visitor&);
static FlatPtr realm_offset() { return OFFSET_OF(ExecutionContext, realm); }
static FlatPtr lexical_environment_offset() { return OFFSET_OF(ExecutionContext, lexical_environment); }
private:

View file

@ -37,6 +37,9 @@ public:
ThrowCompletionOr<void> create_global_var_binding(DeprecatedFlyString const& name, bool can_be_deleted);
ThrowCompletionOr<void> create_global_function_binding(DeprecatedFlyString const& name, Value, bool can_be_deleted);
static FlatPtr object_record_offset() { return OFFSET_OF(GlobalEnvironment, m_object_record); }
static FlatPtr declarative_record_offset() { return OFFSET_OF(GlobalEnvironment, m_declarative_record); }
private:
GlobalEnvironment(Object&, Object& this_value);

View file

@ -41,6 +41,8 @@ public:
// [[IsWithEnvironment]], Indicates whether this Environment Record is created for a with statement.
bool is_with_environment() const { return m_with_environment; }
static FlatPtr binding_object_offset() { return OFFSET_OF(ObjectEnvironment, m_binding_object); }
private:
ObjectEnvironment(Object& binding_object, IsWithEnvironment, Environment* outer_environment);

View file

@ -48,6 +48,8 @@ public:
HostDefined* host_defined() { return m_host_defined; }
void set_host_defined(OwnPtr<HostDefined> host_defined) { m_host_defined = move(host_defined); }
static FlatPtr global_environment_offset() { return OFFSET_OF(Realm, m_global_environment); }
private:
Realm() = default;