mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-31 13:48:25 +00:00
LibJS: Add basic monomorphic caching for PutById property access
This patch makes it possible for JS::Object::internal_set() to populate a CacheablePropertyMetadata, and uses this to implement a basic monomorphic cache for the most common form of property write access.
This commit is contained in:
@@ -811,7 +811,8 @@ ThrowCompletionOr<void> PutById::execute_impl(Bytecode::Interpreter& interpreter
|
||||
auto value = interpreter.accumulator();
|
||||
auto base = interpreter.reg(m_base);
|
||||
PropertyKey name = interpreter.current_executable().get_identifier(m_property);
|
||||
TRY(put_by_property_key(vm, base, base, value, name, m_kind));
|
||||
auto& cache = interpreter.current_executable().property_lookup_caches[m_cache_index];
|
||||
TRY(put_by_property_key(vm, base, base, value, name, m_kind, &cache));
|
||||
interpreter.accumulator() = value;
|
||||
return {};
|
||||
}
|
||||
@@ -823,7 +824,8 @@ ThrowCompletionOr<void> PutByIdWithThis::execute_impl(Bytecode::Interpreter& int
|
||||
auto value = interpreter.accumulator();
|
||||
auto base = interpreter.reg(m_base);
|
||||
PropertyKey name = interpreter.current_executable().get_identifier(m_property);
|
||||
TRY(put_by_property_key(vm, base, interpreter.reg(m_this_value), value, name, m_kind));
|
||||
auto& cache = interpreter.current_executable().property_lookup_caches[m_cache_index];
|
||||
TRY(put_by_property_key(vm, base, interpreter.reg(m_this_value), value, name, m_kind, &cache));
|
||||
interpreter.accumulator() = value;
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user