mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 19:47:17 +02:00
LibJS: Convert Object bitfields to a flags byte
Replace individual bool bitfields in Object (m_is_extensible, m_has_parameter_map, m_has_magical_length_property, etc.) with a single u8 m_flags field and Flag:: constants. This consolidates 8 scattered bitfields into one byte with explicit bit positions, making them easy to access from generated assembly code at a known offset. It also converts the virtual is_function() and is_ecmascript_function_object() methods to flag-based checks, avoiding virtual dispatch for these hot queries. ProxyObject now explicitly clears the IsFunction flag in its constructor when wrapping a non-callable target, instead of relying on a virtual is_function() override.
This commit is contained in:
committed by
Andreas Kling
parent
643f2884cc
commit
c5427e5f4e
Notes:
github-actions[bot]
2026-03-07 12:12:35 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/c5427e5f4e1 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8299
@@ -68,7 +68,7 @@ Array::Array(Realm& realm, Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
, m_realm(realm)
|
||||
{
|
||||
m_has_magical_length_property = true;
|
||||
set_has_magical_length_property();
|
||||
}
|
||||
|
||||
void Array::visit_edges(Cell::Visitor& visitor)
|
||||
@@ -397,7 +397,7 @@ ThrowCompletionOr<bool> Array::internal_define_own_property(PropertyKey const& p
|
||||
auto attributes = property_descriptor.attributes();
|
||||
// OPTIMIZATION: Fast path for arrays with simple indexed properties storage.
|
||||
if (property_descriptor.is_data_descriptor() && attributes == default_attributes && storage && storage->is_simple_storage()) {
|
||||
if (!m_is_extensible) {
|
||||
if (!extensible()) {
|
||||
auto existing_descriptor = TRY(internal_get_own_property(property_key));
|
||||
if (!existing_descriptor.has_value())
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user