Truly independent web browser
LibJS: Rename PrototypeChainValidity to WatchpointSet
Andreas Klingded080ae52f4
diff --git a/Libraries/LibJS/Flap/src/hir/mod.rs b/Libraries/LibJS/Flap/src/hir/mod.rsindex 48a5d8419bb..273a8c3b1e0 100644--- a/Libraries/LibJS/Flap/src/hir/mod.rs+++ b/Libraries/LibJS/Flap/src/hir/mod.rs@@ -3068,7 +3068,7 @@ fn field_width(ty: &Type, allow_pointer: bool) -> Option<FieldWidth> {| Type::PropertyLookupCache| Type::ObjectPropertyIteratorCacheData| Type::ObjectPropertyIteratorCache- | Type::PrototypeChainValidity+ | Type::WatchpointSet| Type::Fuse| Type::FunctionObject| Type::ECMAScriptFunctionObjectdiff --git a/Libraries/LibJS/Flap/src/types.rs b/Libraries/LibJS/Flap/src/types.rsindex 549861231b7..321b1fdb8bc 100644--- a/Libraries/LibJS/Flap/src/types.rs+++ b/Libraries/LibJS/Flap/src/types.rs@@ -215,7 +215,7 @@ define_named_types! {KeyedFeedback => "KeyedFeedback", Some(8), true;ObjectPropertyIteratorCacheData => "ObjectPropertyIteratorCacheData", Some(8), true;ObjectPropertyIteratorCache => "ObjectPropertyIteratorCache", Some(8), true;- PrototypeChainValidity => "PrototypeChainValidity", Some(8), true;+ WatchpointSet => "WatchpointSet", Some(8), true;Fuse => "Fuse", Some(8), true;Accessor => "Accessor", Some(8), true;FunctionObject => "FunctionObject", Some(8), true;diff --git a/Libraries/LibJS/Flap/tests/interpreter-layout.conf b/Libraries/LibJS/Flap/tests/interpreter-layout.confindex 159727d53cb..d539c697206 100644--- a/Libraries/LibJS/Flap/tests/interpreter-layout.conf+++ b/Libraries/LibJS/Flap/tests/interpreter-layout.conf@@ -65,7 +65,7 @@ field PropertyLookupCache.shape Shape PROPERTY_LOOKUP_CACHE_ENTRY_SHAPE nullableconst PROPERTY_LOOKUP_CACHE_ENTRY_PROTOTYPE = 32field PropertyLookupCache.prototype Object PROPERTY_LOOKUP_CACHE_ENTRY_PROTOTYPE nullable cell cache_targetconst PROPERTY_LOOKUP_CACHE_ENTRY_PROTOTYPE_CHAIN_VALIDITY = 40-field PropertyLookupCache.prototype_chain_validity PrototypeChainValidity PROPERTY_LOOKUP_CACHE_ENTRY_PROTOTYPE_CHAIN_VALIDITY nullable cell+field PropertyLookupCache.prototype_chain_validity WatchpointSet PROPERTY_LOOKUP_CACHE_ENTRY_PROTOTYPE_CHAIN_VALIDITY nullable cellconst PROPERTY_LOOKUP_CACHE_ENTRY_KEY = 48field PropertyLookupCache.key Value PROPERTY_LOOKUP_CACHE_ENTRY_KEY nullable scalarconst PROPERTY_LOOKUP_CACHE_ENTRY_SIZE = 64@@ -92,7 +92,7 @@ const OBJECT_PROPERTY_ITERATOR_CACHE_DATA_PROPERTY_VALUES = 40const OBJECT_PROPERTY_ITERATOR_CACHE_DATA_SHAPE = 24field ObjectPropertyIteratorCacheData.shape Shape OBJECT_PROPERTY_ITERATOR_CACHE_DATA_SHAPE nullable cellconst OBJECT_PROPERTY_ITERATOR_CACHE_DATA_PROTOTYPE_CHAIN_VALIDITY = 32-field ObjectPropertyIteratorCacheData.prototype_chain_validity PrototypeChainValidity OBJECT_PROPERTY_ITERATOR_CACHE_DATA_PROTOTYPE_CHAIN_VALIDITY nullable cell+field ObjectPropertyIteratorCacheData.prototype_chain_validity WatchpointSet OBJECT_PROPERTY_ITERATOR_CACHE_DATA_PROTOTYPE_CHAIN_VALIDITY nullable cellconst OBJECT_PROPERTY_ITERATOR_CACHE_DATA_INDEXED_PROPERTY_COUNT = 16field ObjectPropertyIteratorCacheData.indexed_property_count u32 OBJECT_PROPERTY_ITERATOR_CACHE_DATA_INDEXED_PROPERTY_COUNT nullable scalarconst OBJECT_PROPERTY_ITERATOR_CACHE_DATA_SHAPE_DICTIONARY_GENERATION = 20@@ -322,9 +322,9 @@ field ObjectPropertyIteratorCacheData.property_value_count u64 OBJECT_PROPERTY_I# PutKind enumconst PUT_KIND_NORMAL = 0-# PrototypeChainValidity layout-const PROTOTYPE_CHAIN_VALIDITY_VALID = 11-field PrototypeChainValidity.valid bool PROTOTYPE_CHAIN_VALIDITY_VALID nonnull scalar+# WatchpointSet layout+const WATCHPOINT_SET_VALID = 11+field WatchpointSet.valid bool WATCHPOINT_SET_VALID nonnull scalar# DeclarativeEnvironment layoutconst DECLARATIVE_ENVIRONMENT_RARE_DATA = 56diff --git a/Libraries/LibJS/JIT/Rust/src/builder/caches.rs b/Libraries/LibJS/JIT/Rust/src/builder/caches.rsindex 6bfcaa3eb35..b3e14d5514b 100644--- a/Libraries/LibJS/JIT/Rust/src/builder/caches.rs+++ b/Libraries/LibJS/JIT/Rust/src/builder/caches.rs@@ -37,7 +37,7 @@ use crate::snapshot::PropertyCacheKind;pub(super) enum Holder {/// In the object the access is on.Receiver,- /// In `prototype`, while the `PrototypeChainValidity` cell `validity` is+ /// In `prototype`, while the `WatchpointSet` cell `validity` is/// valid (and it was valid when the snapshot was taken if `valid`).Prototype {prototype: CellId,diff --git a/Libraries/LibJS/JIT/Rust/src/builder/property_access.rs b/Libraries/LibJS/JIT/Rust/src/builder/property_access.rsindex 23db44e4a55..6530b91420c 100644--- a/Libraries/LibJS/JIT/Rust/src/builder/property_access.rs+++ b/Libraries/LibJS/JIT/Rust/src/builder/property_access.rs@@ -111,13 +111,13 @@ impl GraphBuilder<'_> {)}- /// Makes sure that the `PrototypeChainValidity` cell `validity` is still+ /// Makes sure that the `WatchpointSet` cell `validity` is still/// valid: the code depends on it staying valid if it was when the/// snapshot was taken (`valid`), and checks it otherwise.pub(super) fn check_prototype_chain(&mut self, validity: CellId, valid: bool) {self.embed(validity);if valid {- self.assume(Dependency::PrototypeChainValid(validity));+ self.assume(Dependency::WatchpointSetValid(validity));return;}self.emit_checked(Op::CheckPrototypeChainValid { validity }, Vec::new(), None);diff --git a/Libraries/LibJS/JIT/Rust/src/builder/tests.rs b/Libraries/LibJS/JIT/Rust/src/builder/tests.rsindex 90fd4989b9b..9412bf40f6f 100644--- a/Libraries/LibJS/JIT/Rust/src/builder/tests.rs+++ b/Libraries/LibJS/JIT/Rust/src/builder/tests.rs@@ -1103,7 +1103,7 @@ pub(crate) mod property_access {assert_eq!(text.matches("AssumeValid").count(), 1, "{text}");assert_eq!(graph.dependencies,- vec![crate::code::Dependency::PrototypeChainValid(CellId(0x8000))]+ vec![crate::code::Dependency::WatchpointSetValid(CellId(0x8000))]);}diff --git a/Libraries/LibJS/JIT/Rust/src/code.rs b/Libraries/LibJS/JIT/Rust/src/code.rsindex c274f9ebf38..b69fb1f3680 100644--- a/Libraries/LibJS/JIT/Rust/src/code.rs+++ b/Libraries/LibJS/JIT/Rust/src/code.rs@@ -119,8 +119,8 @@ pub enum ExitKind {/// path breaking it needs first, so fast paths never break it unnoticed.#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]pub enum Dependency {- /// The `PrototypeChainValidity` cell stays valid.- PrototypeChainValid(CellId),+ /// The `WatchpointSet` cell stays valid.+ WatchpointSetValid(CellId),/// The global declarative environment `environment` keeps the serial/// number `serial`: it gets no bindings, which could shadow properties of/// the global object.diff --git a/Libraries/LibJS/JIT/Rust/src/ir/mod.rs b/Libraries/LibJS/JIT/Rust/src/ir/mod.rsindex d0ba9226ec6..1368a8282ab 100644--- a/Libraries/LibJS/JIT/Rust/src/ir/mod.rs+++ b/Libraries/LibJS/JIT/Rust/src/ir/mod.rs@@ -742,7 +742,7 @@ pub enum Op {CheckShape {shapes: Vec<ShapeCheck>,},- /// Exits unless the `PrototypeChainValidity` cell `validity` is still valid.+ /// Exits unless the `WatchpointSet` cell `validity` is still valid.CheckPrototypeChainValid {validity: CellId,},diff --git a/Libraries/LibJS/JIT/Rust/src/snapshot.rs b/Libraries/LibJS/JIT/Rust/src/snapshot.rsindex 1247a4e03bc..45a706c71a4 100644--- a/Libraries/LibJS/JIT/Rust/src/snapshot.rs+++ b/Libraries/LibJS/JIT/Rust/src/snapshot.rs@@ -1355,7 +1355,7 @@ pub struct RuntimeOffsets {pub object_named_properties: u32,/// `Shape::dictionary_generation` (u32).pub shape_dictionary_generation: u32,- /// `PrototypeChainValidity::valid` (bool).+ /// `WatchpointSet::valid` (bool).pub prototype_chain_validity_valid: u32,/// `Accessor::getter` and `Accessor::setter` (cell pointers, null if/// none).diff --git a/Libraries/LibJS/Rust/generate/layout_table.rs b/Libraries/LibJS/Rust/generate/layout_table.rsindex 203b93c9f3c..c50e47c374a 100644--- a/Libraries/LibJS/Rust/generate/layout_table.rs+++ b/Libraries/LibJS/Rust/generate/layout_table.rs@@ -221,7 +221,7 @@ pub fn generate(configuration: &LayoutConfiguration) -> LayoutWriter {offset!(w, "PROPERTY_LOOKUP_CACHE_ENTRY_FROM_SHAPE", PropertyLookupCacheEntry, from_shape);field!(w, "PROPERTY_LOOKUP_CACHE_ENTRY_SHAPE", "PropertyLookupCache.shape", "Shape", PropertyLookupCacheEntry, shape, 8, "nullable", "cell", "cache_target");field!(w, "PROPERTY_LOOKUP_CACHE_ENTRY_PROTOTYPE", "PropertyLookupCache.prototype", "Object", PropertyLookupCacheEntry, prototype, 8, "nullable", "cell", "cache_target");- field!(w, "PROPERTY_LOOKUP_CACHE_ENTRY_PROTOTYPE_CHAIN_VALIDITY", "PropertyLookupCache.prototype_chain_validity", "PrototypeChainValidity", PropertyLookupCacheEntry, prototype_chain_validity, 8, "nullable", "cell");+ field!(w, "PROPERTY_LOOKUP_CACHE_ENTRY_PROTOTYPE_CHAIN_VALIDITY", "PropertyLookupCache.prototype_chain_validity", "WatchpointSet", PropertyLookupCacheEntry, prototype_chain_validity, 8, "nullable", "cell");field!(w, "PROPERTY_LOOKUP_CACHE_ENTRY_KEY", "PropertyLookupCache.key", "Value", PropertyLookupCacheEntry, key, 8, "nullable", "scalar");size!(w, "PROPERTY_LOOKUP_CACHE_ENTRY_SIZE", PropertyLookupCacheEntry);w.constant("PROPERTY_LOOKUP_CACHE_ENTRY_TYPE_GET_OWN_PROPERTY", PropertyLookupCacheEntryType::GetOwnProperty as u32);@@ -241,7 +241,7 @@ pub fn generate(configuration: &LayoutConfiguration) -> LayoutWriter {offset!(w, "OBJECT_PROPERTY_ITERATOR_CACHE_DATA_PROPERTIES", ObjectPropertyIteratorCacheData, storage);offset!(w, "OBJECT_PROPERTY_ITERATOR_CACHE_DATA_PROPERTY_VALUES", ObjectPropertyIteratorCacheData, property_values);field!(w, "OBJECT_PROPERTY_ITERATOR_CACHE_DATA_SHAPE", "ObjectPropertyIteratorCacheData.shape", "Shape", ObjectPropertyIteratorCacheData, shape, 8, "nullable", "cell");- field!(w, "OBJECT_PROPERTY_ITERATOR_CACHE_DATA_PROTOTYPE_CHAIN_VALIDITY", "ObjectPropertyIteratorCacheData.prototype_chain_validity", "PrototypeChainValidity", ObjectPropertyIteratorCacheData, prototype_chain_validity, 8, "nullable", "cell");+ field!(w, "OBJECT_PROPERTY_ITERATOR_CACHE_DATA_PROTOTYPE_CHAIN_VALIDITY", "ObjectPropertyIteratorCacheData.prototype_chain_validity", "WatchpointSet", ObjectPropertyIteratorCacheData, prototype_chain_validity, 8, "nullable", "cell");field!(w, "OBJECT_PROPERTY_ITERATOR_CACHE_DATA_INDEXED_PROPERTY_COUNT", "ObjectPropertyIteratorCacheData.indexed_property_count", "u32", ObjectPropertyIteratorCacheData, indexed_property_count, 4, "nullable", "scalar");field!(w, "OBJECT_PROPERTY_ITERATOR_CACHE_DATA_SHAPE_DICTIONARY_GENERATION", "ObjectPropertyIteratorCacheData.shape_dictionary_generation", "u32", ObjectPropertyIteratorCacheData, shape_dictionary_generation, 4, "nullable", "scalar");field!(w, "OBJECT_PROPERTY_ITERATOR_CACHE_DATA_SHAPE_IS_DICTIONARY", "ObjectPropertyIteratorCacheData.shape_is_dictionary", "bool", ObjectPropertyIteratorCacheData, shape_is_dictionary, 1, "nullable", "scalar");@@ -447,8 +447,8 @@ pub fn generate(configuration: &LayoutConfiguration) -> LayoutWriter {w.section("PutKind enum");w.constant("PUT_KIND_NORMAL", PutKind::Normal as u8);- w.section("PrototypeChainValidity layout");- field!(w, "PROTOTYPE_CHAIN_VALIDITY_VALID", "PrototypeChainValidity.valid", "bool", PrototypeChainValidity, valid, 1, "nonnull", "scalar");+ w.section("WatchpointSet layout");+ field!(w, "WATCHPOINT_SET_VALID", "WatchpointSet.valid", "bool", WatchpointSet, valid, 1, "nonnull", "scalar");w.section("DeclarativeEnvironment layout");field!(w, "DECLARATIVE_ENVIRONMENT_RARE_DATA", "DeclarativeEnvironment.rare_data", "DeclarativeEnvironmentRareData", DeclarativeEnvironment, rare_data, 8, "nullable", "scalar");diff --git a/Libraries/LibJS/Rust/src/bytecode/executable.rs b/Libraries/LibJS/Rust/src/bytecode/executable.rsindex d075fa4a973..1dd52f1145e 100644--- a/Libraries/LibJS/Rust/src/bytecode/executable.rs+++ b/Libraries/LibJS/Rust/src/bytecode/executable.rs@@ -42,7 +42,7 @@ pub use crate::layout::property_lookup_cache::{PROPERTY_LOOKUP_CACHE_POLYMORPHIC_DATA_TAG, PropertyLookupCache, PropertyLookupCacheEntry,PropertyLookupCacheEntryType,};-use crate::layout::shape::{PrototypeChainValidity, Shape};+use crate::layout::shape::{Shape, WatchpointSet};use crate::layout::value::Value;use crate::layout_forward::FlyStringSlot;use crate::runtime::array::Array;@@ -69,7 +69,7 @@ pub struct PropertyLookupCacheEntryData {pub from_shape: Option<Gc<Shape>>,pub shape: Option<Gc<Shape>>,pub prototype: Option<Gc<Object>>,- pub prototype_chain_validity: Option<Gc<PrototypeChainValidity>>,+ pub prototype_chain_validity: Option<Gc<WatchpointSet>>,/// See PropertyLookupCacheEntry::key.pub key: u64,}@@ -848,7 +848,7 @@ pub struct KeyedPropertyLookup {pub shape_dictionary_generation: u32,pub shape: Option<Gc<Shape>>,pub prototype: Option<Gc<Object>>,- pub prototype_chain_validity: Option<Gc<PrototypeChainValidity>>,+ pub prototype_chain_validity: Option<Gc<WatchpointSet>>,/// The shape that adding the property to an object of `shape` gives it, for `AddOwnProperty` entries of the/// keyed property store cache.pub new_shape: Option<Gc<Shape>>,@@ -1083,7 +1083,7 @@ impl ObjectPropertyIteratorCacheData {indexed_property_count: u32,receiver_has_magical_length_property: bool,shape: Gc<Shape>,- prototype_chain_validity: Option<Gc<PrototypeChainValidity>>,+ prototype_chain_validity: Option<Gc<WatchpointSet>>,) -> Gc<ObjectPropertyIteratorCacheData> {let (shape_is_dictionary, shape_dictionary_generation) = if shape.is_dictionary() {(true, shape.dictionary_generation())@@ -1167,7 +1167,7 @@ impl ObjectPropertyIteratorCacheData {self.shape.get()}- pub fn prototype_chain_validity(&self) -> Option<Gc<PrototypeChainValidity>> {+ pub fn prototype_chain_validity(&self) -> Option<Gc<WatchpointSet>> {self.prototype_chain_validity.get()}diff --git a/Libraries/LibJS/Rust/src/gc/class_id.rs b/Libraries/LibJS/Rust/src/gc/class_id.rsindex 6f352718731..fae032672c1 100644--- a/Libraries/LibJS/Rust/src/gc/class_id.rs+++ b/Libraries/LibJS/Rust/src/gc/class_id.rs@@ -31,7 +31,7 @@ define_class_ids! {BigInt,Accessor,Shape,- PrototypeChainValidity,+ WatchpointSet,Fuse,DescriptorArray,ValueStorage,diff --git a/Libraries/LibJS/Rust/src/interpreter/slow_paths/property_access.rs b/Libraries/LibJS/Rust/src/interpreter/slow_paths/property_access.rsindex 227557cb1f5..aecacba30c6 100644--- a/Libraries/LibJS/Rust/src/interpreter/slow_paths/property_access.rs+++ b/Libraries/LibJS/Rust/src/interpreter/slow_paths/property_access.rs@@ -30,7 +30,7 @@ use crate::gc::root::MarkedVec;use crate::interpreter::runtime_functions::{SlowPathControl, asm_try, handle_asm_exception};use crate::interpreter::vm::Vm;use crate::layout::cell::Gc;-use crate::layout::shape::{PrototypeChainValidity, Shape};+use crate::layout::shape::{Shape, WatchpointSet};use crate::layout::value::Value;use crate::runtime::abstract_operations::function_object_as_object;use crate::runtime::array::Array;@@ -905,7 +905,7 @@ struct FastPropertyNameIteratorData<'vm> {indexed_property_count: u32,receiver_has_magical_length_property: bool,shape: Gc<Shape>,- prototype_chain_validity: Option<Gc<PrototypeChainValidity>>,+ prototype_chain_validity: Option<Gc<WatchpointSet>>,}fn shape_has_enumerable_string_property(shape: &Shape) -> bool {diff --git a/Libraries/LibJS/Rust/src/jit/dependencies.rs b/Libraries/LibJS/Rust/src/jit/dependencies.rsindex f127d552f81..d5c7f063696 100644--- a/Libraries/LibJS/Rust/src/jit/dependencies.rs+++ b/Libraries/LibJS/Rust/src/jit/dependencies.rs@@ -28,7 +28,7 @@ use crate::interpreter::vm::Vm;use crate::layout::cell::Gc;use crate::layout::environment::DeclarativeEnvironment;use crate::layout::object::Object;-use crate::layout::shape::PrototypeChainValidity;+use crate::layout::shape::WatchpointSet;use crate::runtime::realm_fuses::Fuse;use crate::runtime::shape::Shape;@@ -76,7 +76,7 @@ impl Dependents {declarative_environment(*environment).set_has_dependent_code();}Dependency::StableShape(shape) => shape_of(*shape).set_has_dependent_code(),- Dependency::PrototypeChainValid(_)+ Dependency::WatchpointSetValid(_)| Dependency::GlobalPropertyUnassigned { .. }| Dependency::NoHtmlDdaObjects| Dependency::Fuse(_) => {}@@ -154,9 +154,9 @@ fn declarative_environment(environment: CellId) -> &'static DeclarativeEnvironme/// Whether `dependency` still holds.pub fn holds(vm: &Vm, dependency: &Dependency) -> bool {match dependency {- Dependency::PrototypeChainValid(validity) => {+ Dependency::WatchpointSetValid(validity) => {// SAFETY: Code that depends on the cell embeds it, which keeps it alive.- unsafe { &*(validity.0 as *const PrototypeChainValidity) }.is_valid()+ unsafe { &*(validity.0 as *const WatchpointSet) }.is_valid()}Dependency::GlobalDeclarations { environment, serial } => {declarative_environment(*environment).environment_serial_number() == *serialdiff --git a/Libraries/LibJS/Rust/src/jit/disabled.rs b/Libraries/LibJS/Rust/src/jit/disabled.rsindex 29f9421266e..cbe9bb41011 100644--- a/Libraries/LibJS/Rust/src/jit/disabled.rs+++ b/Libraries/LibJS/Rust/src/jit/disabled.rs@@ -224,7 +224,7 @@ pub mod dependencies {/// What JIT code may depend on, which the runtime notes when it stops holding.pub enum Dependency {- PrototypeChainValid(CellId),+ WatchpointSetValid(CellId),GlobalDeclarations { environment: CellId, serial: u64 },GlobalBindingUnassigned { environment: CellId, index: u32 },StableShape(CellId),diff --git a/Libraries/LibJS/Rust/src/jit/runtime_info.rs b/Libraries/LibJS/Rust/src/jit/runtime_info.rsindex 4ff3bab6997..f3bdffe4b1d 100644--- a/Libraries/LibJS/Rust/src/jit/runtime_info.rs+++ b/Libraries/LibJS/Rust/src/jit/runtime_info.rs@@ -54,7 +54,7 @@ use crate::layout::property_lookup_cache::{PropertyLookupCacheEntryType,};use crate::layout::realm::Realm;-use crate::layout::shape::{PrototypeChainValidity, Shape};+use crate::layout::shape::{Shape, WatchpointSet};use crate::layout::value::Value;use crate::layout::vm::VmHead;use crate::runtime::array::{ARRAY_IS_PROXY_TARGET_OFFSET, ARRAY_LENGTH_WRITABLE_OFFSET};@@ -122,7 +122,7 @@ fn runtime_offsets() -> RuntimeOffsets {object_shape: offset(offset_of!(Object, shape)),object_named_properties: offset(offset_of!(Object, named_properties)),shape_dictionary_generation: offset(offset_of!(Shape, dictionary_generation)),- prototype_chain_validity_valid: offset(offset_of!(PrototypeChainValidity, valid)),+ prototype_chain_validity_valid: offset(offset_of!(WatchpointSet, valid)),accessor_getter: offset(offset_of!(Accessor, getter)),accessor_setter: offset(offset_of!(Accessor, setter)),execution_context_function: offset(offset_of!(ExecutionContext, function)),diff --git a/Libraries/LibJS/Rust/src/layout/property_lookup_cache.rs b/Libraries/LibJS/Rust/src/layout/property_lookup_cache.rsindex b1bc867e127..abf2f92491d 100644--- a/Libraries/LibJS/Rust/src/layout/property_lookup_cache.rs+++ b/Libraries/LibJS/Rust/src/layout/property_lookup_cache.rs@@ -10,7 +10,7 @@ use super::accessor::Accessor;use super::buffer::InterpreterBuffer;use super::cell::{CellHeader, Gc};use super::object::Object;-use super::shape::{PrototypeChainValidity, Shape};+use super::shape::{Shape, WatchpointSet};use super::value::Value;use crate::layout_forward::ObjectPropertyIteratorCacheDataStorage;@@ -42,7 +42,7 @@ pub struct PropertyLookupCacheEntry {pub from_shape: Cell<Option<Gc<Shape>>>,pub shape: Cell<Option<Gc<Shape>>>,pub prototype: Cell<Option<Gc<Object>>>,- pub prototype_chain_validity: Cell<Option<Gc<PrototypeChainValidity>>>,+ pub prototype_chain_validity: Cell<Option<Gc<WatchpointSet>>>,/// The encoded string or symbol Value whose property this entry describes, for the caches of keyed accesses like/// GetByValue, or 0 for the caches of named accesses like GetById, whose instruction determines the property. Like/// the cells above, the key is not kept alive by the cache.@@ -65,7 +65,7 @@ pub struct KeyedPropertyLookupCacheEntryLayout {pub shape_dictionary_generation: u32,pub shape: Option<Gc<Shape>>,pub prototype: Option<Gc<Object>>,- pub prototype_chain_validity: Option<Gc<PrototypeChainValidity>>,+ pub prototype_chain_validity: Option<Gc<WatchpointSet>>,pub new_shape: Option<Gc<Shape>>,/// The identity of the name of the property, the word of a fly string, or 0.pub property_name: u64,@@ -118,7 +118,7 @@ pub struct ObjectPropertyIteratorCacheData {pub indexed_property_count: Cell<u32>,pub shape_dictionary_generation: Cell<u32>,pub shape: Cell<Option<Gc<Shape>>>,- pub prototype_chain_validity: Cell<Option<Gc<PrototypeChainValidity>>>,+ pub prototype_chain_validity: Cell<Option<Gc<WatchpointSet>>>,pub property_values: InterpreterBuffer<Value>,pub storage: ObjectPropertyIteratorCacheDataStorage,}diff --git a/Libraries/LibJS/Rust/src/layout/shape.rs b/Libraries/LibJS/Rust/src/layout/shape.rsindex 7761b3c8ce8..5eaf930ec8d 100644--- a/Libraries/LibJS/Rust/src/layout/shape.rs+++ b/Libraries/LibJS/Rust/src/layout/shape.rs@@ -18,15 +18,18 @@ pub struct Shape {pub flags: Cell<u8>,pub realm: Cell<Gc<Realm>>,pub prototype: Cell<Option<Gc<Object>>>,- pub prototype_chain_validity: Cell<Option<Gc<PrototypeChainValidity>>>,+ pub prototype_chain_validity: Cell<Option<Gc<WatchpointSet>>>,pub property_iterator_cache: Cell<Option<Gc<ObjectPropertyIteratorCacheData>>>,pub property_count: Cell<u32>,pub dictionary_generation: Cell<u32>,pub storage: ShapeStorage,}+/// Something the runtime and JIT code may rely on until it stops holding, when the set fires once and stays invalid.+/// The shape of each prototype has one, which fires when the properties or the prototype of that object or of one+/// above it on its prototype chain change (see `Shape::prototype_chain_validity`).#[repr(C)]-pub struct PrototypeChainValidity {+pub struct WatchpointSet {pub header: CellHeader,pub valid: Cell<bool>,/// Keeps the cell at the minimum cell size.diff --git a/Libraries/LibJS/Rust/src/runtime/json_object.rs b/Libraries/LibJS/Rust/src/runtime/json_object.rsindex 1fcedf5fa6f..972ba783c74 100644--- a/Libraries/LibJS/Rust/src/runtime/json_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/json_object.rs@@ -40,7 +40,7 @@ use crate::runtime::property_attributes::{Attribute, DEFAULT_ATTRIBUTES, Propertuse crate::runtime::property_key::PropertyKey;use crate::runtime::raw_json_object::RawJSONObject;use crate::runtime::realm::Realm;-use crate::runtime::shape::{PrototypeChainValidity, Shape};+use crate::runtime::shape::{Shape, WatchpointSet};use crate::runtime::string_conversions::parse_first_number_f64;use crate::runtime::string_object::StringObject;use crate::runtime::value::{DecimalDigits, append_number_to_string, same_value};@@ -193,7 +193,7 @@ struct StringifyShapeInfo {properties: Vec<StringifyCachedProperty>,/// The validity of the shape of the prototype of the objects when neither they nor their prototypes had a "toJSON"/// property, which stops being valid when a prototype changes its properties.- to_json_absence: Option<GcWeak<PrototypeChainValidity>>,+ to_json_absence: Option<GcWeak<WatchpointSet>>,}impl StringifyShapeInfo {@@ -222,7 +222,7 @@ impl StringifyShapeInfo {}}- fn to_json_absence(vm: &Vm, shape: Gc<Shape>) -> Option<GcWeak<PrototypeChainValidity>> {+ fn to_json_absence(vm: &Vm, shape: Gc<Shape>) -> Option<GcWeak<WatchpointSet>> {let to_json = &vm.names.toJSON;if shape.lookup(to_json).is_some() {return None;diff --git a/Libraries/LibJS/Rust/src/runtime/shape.rs b/Libraries/LibJS/Rust/src/runtime/shape.rsindex b9ceb460723..bac68132611 100644--- a/Libraries/LibJS/Rust/src/runtime/shape.rs+++ b/Libraries/LibJS/Rust/src/runtime/shape.rs@@ -21,7 +21,7 @@ use crate::jit::dependencies::{CellId, Dependency};use crate::layout::cell::{CellHeader, Gc};use crate::layout::object::Object;use crate::layout::property_lookup_cache::ObjectPropertyIteratorCacheData;-pub use crate::layout::shape::{PrototypeChainValidity, Shape};+pub use crate::layout::shape::{Shape, WatchpointSet};use crate::layout::value::Value;use crate::runtime::descriptor_array::{DescriptorArray, MAX_DESCRIPTOR_COUNT, PropertyMetadata};use crate::runtime::object::IntegrityLevel;@@ -37,16 +37,16 @@ pub struct TransitionKey {pub attributes: PropertyAttributes,}-define_cell!(PrototypeChainValidity, Other);+define_cell!(WatchpointSet, Other);-// SAFETY: A validity holds no cells.-unsafe impl Trace for PrototypeChainValidity {+// SAFETY: A watchpoint set holds no cells.+unsafe impl Trace for WatchpointSet {fn trace(&self, _: &mut Visitor) {}}-impl PrototypeChainValidity {- pub fn create(vm: &Vm) -> Gc<PrototypeChainValidity> {- vm.heap().allocate(PrototypeChainValidity {+impl WatchpointSet {+ pub fn create(vm: &Vm) -> Gc<WatchpointSet> {+ vm.heap().allocate(WatchpointSet {header: CellHeader::for_class(Self::CLASS),valid: Cell::new(true),padding: 0,@@ -57,15 +57,15 @@ impl PrototypeChainValidity {self.valid.get()}- /// Marks the prototype chain as changed, which invalidates the JIT code that depends on it staying as it was.- pub fn invalidate(&self, vm: &Vm) {+ /// Notes that what the set stands for stopped holding, which invalidates the JIT code that depends on it.+ pub fn fire(&self, vm: &Vm) {if !self.is_valid() {return;}self.valid.set(false);crate::jit::dependencies::invalidate_dependents(vm,- Dependency::PrototypeChainValid(CellId(core::ptr::from_ref(self) as u64)),+ Dependency::WatchpointSetValid(CellId(core::ptr::from_ref(self) as u64)),);}}@@ -131,7 +131,7 @@ struct RareData {pub struct AssignCopy {/// The validity of the shape of the prototype of the empty object when the copy was found to be right, which stops/// being valid when that prototype changes its properties.- pub prototype_validity: Gc<PrototypeChainValidity>,+ pub prototype_validity: Gc<WatchpointSet>,/// The shape the empty object ends up with.pub copy_shape: Gc<Shape>,}@@ -875,9 +875,7 @@ impl Shape {new_shape.set_descriptors(self.descriptors());new_shape.property_count.set(self.property_count());}- new_shape- .prototype_chain_validity- .set(Some(PrototypeChainValidity::create(vm)));+ new_shape.prototype_chain_validity.set(Some(WatchpointSet::create(vm)));if let Some(prototype) = new_shape.prototype() {prototype.shape().add_child_prototype_shape(vm, new_shape);}@@ -891,8 +889,7 @@ impl Shape {pub fn set_prototype_shape(&self, vm: &Vm) {assert!(!self.is_prototype_shape());- self.prototype_chain_validity- .set(Some(PrototypeChainValidity::create(vm)));+ self.prototype_chain_validity.set(Some(WatchpointSet::create(vm)));if let Some(prototype) = self.prototype() {prototype.shape().add_child_prototype_shape(vm, self.as_gc());}@@ -910,7 +907,7 @@ impl Shape {return;}new_prototype_shape.set_prototype_shape(vm);- self.prototype_shape_validity().invalidate(vm);+ self.prototype_shape_validity().fire(vm);self.invalidate_all_prototype_chains_leading_to_this(vm);@@ -932,14 +929,13 @@ impl Shape {if !self.is_prototype_shape() {return;}- self.prototype_shape_validity().invalidate(vm);- self.prototype_chain_validity- .set(Some(PrototypeChainValidity::create(vm)));+ self.prototype_shape_validity().fire(vm);+ self.prototype_chain_validity.set(Some(WatchpointSet::create(vm)));self.invalidate_all_prototype_chains_leading_to_this(vm);}- fn prototype_shape_validity(&self) -> Gc<PrototypeChainValidity> {+ fn prototype_shape_validity(&self) -> Gc<WatchpointSet> {self.prototype_chain_validity.get().expect("a prototype shape has a validity")@@ -983,10 +979,8 @@ impl Shape {for index in 0..shapes_to_invalidate.len() {let shape: Gc<Shape> = shapes_to_invalidate.get(index).expect("the index is in bounds");- shape.prototype_shape_validity().invalidate(vm);- shape- .prototype_chain_validity- .set(Some(PrototypeChainValidity::create(vm)));+ shape.prototype_shape_validity().fire(vm);+ shape.prototype_chain_validity.set(Some(WatchpointSet::create(vm)));}}@@ -1095,7 +1089,7 @@ impl Shape {self.prototype_chain_validity.get().is_some()}- pub fn prototype_chain_validity(&self) -> Option<Gc<PrototypeChainValidity>> {+ pub fn prototype_chain_validity(&self) -> Option<Gc<WatchpointSet>> {self.prototype_chain_validity.get()}