mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
LibJS/JIT: Add fast path for cached GetVariable accesses
We can now stay in machine code for environment variable read accesses as long as they are cached and initialized. 20% speed-up on Octane/zlib.js :^)
This commit is contained in:
parent
7826c006c1
commit
1d8ec677a3
6 changed files with 147 additions and 3 deletions
|
@ -19,6 +19,9 @@ class DeclarativeEnvironment : public Environment {
|
|||
JS_ENVIRONMENT(DeclarativeEnvironment, Environment);
|
||||
|
||||
struct Binding {
|
||||
static FlatPtr value_offset() { return OFFSET_OF(Binding, value); }
|
||||
static FlatPtr initialized_offset() { return OFFSET_OF(Binding, initialized); }
|
||||
|
||||
DeprecatedFlyString name;
|
||||
Value value;
|
||||
bool strict { false };
|
||||
|
@ -67,6 +70,8 @@ public:
|
|||
|
||||
[[nodiscard]] u64 environment_serial_number() const { return m_environment_serial_number; }
|
||||
|
||||
static FlatPtr bindings_offset() { return OFFSET_OF(DeclarativeEnvironment, m_bindings); }
|
||||
|
||||
private:
|
||||
ThrowCompletionOr<Value> get_binding_value_direct(VM&, Binding&, bool strict);
|
||||
ThrowCompletionOr<void> set_mutable_binding_direct(VM&, Binding&, Value, bool strict);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue