Truly independent web browser
LibJS: Build the realm fuses from watchpoint sets
Andreas Klingf9caf37a8cfc
diff --git a/Libraries/LibJS/Flap/src/hir/mod.rs b/Libraries/LibJS/Flap/src/hir/mod.rsindex 273a8c3b1e0..df91486ffa9 100644--- a/Libraries/LibJS/Flap/src/hir/mod.rs+++ b/Libraries/LibJS/Flap/src/hir/mod.rs@@ -3069,7 +3069,6 @@ fn field_width(ty: &Type, allow_pointer: bool) -> Option<FieldWidth> {| Type::ObjectPropertyIteratorCacheData| Type::ObjectPropertyIteratorCache| Type::WatchpointSet- | Type::Fuse| Type::FunctionObject| Type::ECMAScriptFunctionObject| Type::RawNativeFunctiondiff --git a/Libraries/LibJS/Flap/src/types.rs b/Libraries/LibJS/Flap/src/types.rsindex 321b1fdb8bc..34ddca5e0ed 100644--- a/Libraries/LibJS/Flap/src/types.rs+++ b/Libraries/LibJS/Flap/src/types.rs@@ -216,7 +216,6 @@ define_named_types! {ObjectPropertyIteratorCacheData => "ObjectPropertyIteratorCacheData", Some(8), true;ObjectPropertyIteratorCache => "ObjectPropertyIteratorCache", Some(8), true;WatchpointSet => "WatchpointSet", Some(8), true;- Fuse => "Fuse", Some(8), true;Accessor => "Accessor", Some(8), true;FunctionObject => "FunctionObject", Some(8), true;ECMAScriptFunctionObject => "ECMAScriptFunctionObject", Some(8), true;diff --git a/Libraries/LibJS/Flap/tests/interpreter-layout.conf b/Libraries/LibJS/Flap/tests/interpreter-layout.confindex d539c697206..4d9a45df871 100644--- a/Libraries/LibJS/Flap/tests/interpreter-layout.conf+++ b/Libraries/LibJS/Flap/tests/interpreter-layout.conf@@ -248,12 +248,8 @@ const REALM_GLOBAL_OBJECT = 16field Realm.global_object Object REALM_GLOBAL_OBJECT nullable cell global_stateconst REALM_GLOBAL_DECLARATIVE_ENVIRONMENT = 24field Realm.global_declarative_environment DeclarativeEnvironment REALM_GLOBAL_DECLARATIVE_ENVIRONMENT nullable cell global_state-const REALM_ARRAY_ITERATOR_RETURN_FUSE = 64-field Realm.array_iterator_return_fuse Fuse REALM_ARRAY_ITERATOR_RETURN_FUSE nullable cell--# Fuse layout-const FUSE_INTACT = 11-field Fuse.intact bool FUSE_INTACT nonnull scalar+const REALM_ARRAY_ITERATOR_RETURN_WATCHPOINT_SET = 64+field Realm.array_iterator_return_watchpoint_set WatchpointSet REALM_ARRAY_ITERATOR_RETURN_WATCHPOINT_SET nullable cell# VM layoutconst VM_RUNNING_EXECUTION_CONTEXT = 0diff --git a/Libraries/LibJS/Interpreter/interpreter.flap b/Libraries/LibJS/Interpreter/interpreter.flapindex f3413d3248a..989f7d54f87 100644--- a/Libraries/LibJS/Interpreter/interpreter.flap+++ b/Libraries/LibJS/Interpreter/interpreter.flap@@ -4564,12 +4564,12 @@ handler IteratorClose(# An iterator without a return method closes without doing anything, for every completion type: the# instruction that follows a close for a throw completion throws it again.- # In fast array mode, the iterator register holds a number. The return fuse of the realm tells if array+ # In fast array mode, the iterator register holds a number. A watchpoint set of the realm tells if array# iterators have a return method.if extract_tag(load(iterator_object)) == INT32_TAG {- let return_fuse = exec_ctx.realm.array_iterator_return_fuse;- guard return_fuse != 0 else slow;- guard return_fuse.intact else slow;+ let return_watchpoint_set = exec_ctx.realm.array_iterator_return_watchpoint_set;+ guard return_watchpoint_set != 0 else slow;+ guard return_watchpoint_set.valid else slow;dispatch_next;}diff --git a/Libraries/LibJS/JIT/ARCHITECTURE.md b/Libraries/LibJS/JIT/ARCHITECTURE.mdindex 94c5716e08f..7862ffeaa1c 100644--- a/Libraries/LibJS/JIT/ARCHITECTURE.md+++ b/Libraries/LibJS/JIT/ARCHITECTURE.md@@ -274,7 +274,9 @@ the prologue's resumption in the interpreter publishes it inline.Compiled code may assume facts that hold until a rare runtime event (`code::Dependency`): aprototype chain stays valid, a shape stays stable, a global binding or a property of the globalobject is never assigned, the global declarative environment gets no bindings, no `[[IsHTMLDDA]]`-object exists, a fuse of a realm stays intact (`runtime/realm_fuses.rs`).+object exists. Each of the first and the last kinds is a `WatchpointSet` that stays valid+(`runtime/watchpoint_set.rs`), such as one of a realm for the iterator protocol+(`runtime/realm_watchpoints.rs`).- The builder and check elimination record the dependencies they rely on in`Graph::dependencies`.diff --git a/Libraries/LibJS/JIT/Rust/src/builder/named.rs b/Libraries/LibJS/JIT/Rust/src/builder/named.rsindex 947b17fdc8b..ad1991d1447 100644--- a/Libraries/LibJS/JIT/Rust/src/builder/named.rs+++ b/Libraries/LibJS/JIT/Rust/src/builder/named.rs@@ -74,14 +74,14 @@ impl GraphBuilder<'_> {let iterator = self.read(iterator_object)?;// NB: In fast array mode, the iterator operand holds the index of the- // next element (see `try_build_get_iterator()`), and the return- // fuse tells if array iterators have a return method.- if let Some(return_fuse) = self.runtime.array_iterator_return_fuse {+ // next element (see `try_build_get_iterator()`), and a watchpoint+ // set of the realm tells if array iterators have a return method.+ if let Some(return_watchpoint_set) = self.runtime.array_iterator_return_watchpoint_set {let (fast_array_mode, iterator_object) =self.branch_both_ways(BranchCondition::NonNegativeInt32, vec![iterator]);self.block = fast_array_mode;- self.embed(return_fuse);- self.assume(Dependency::Fuse(return_fuse));+ self.embed(return_watchpoint_set);+ self.assume(Dependency::WatchpointSetValid(return_watchpoint_set));self.end_hot_path(&mut slow_paths, Vec::new());self.block = iterator_object;}diff --git a/Libraries/LibJS/JIT/Rust/src/code.rs b/Libraries/LibJS/JIT/Rust/src/code.rsindex b69fb1f3680..feaf104aa1f 100644--- a/Libraries/LibJS/JIT/Rust/src/code.rs+++ b/Libraries/LibJS/JIT/Rust/src/code.rs@@ -140,9 +140,6 @@ pub enum Dependency {/// The shape stays stable: no object leaves it, so objects that have it/// keep it while other code runs.StableShape(CellId),- /// The fuse cell stays intact: the properties of the intrinsics of its- /// realm that it watches do not change.- Fuse(CellId),}/// A point of compiled code where the runtime may translate its state intodiff --git a/Libraries/LibJS/JIT/Rust/src/ir/mod.rs b/Libraries/LibJS/JIT/Rust/src/ir/mod.rsindex 1368a8282ab..ee21aedfd06 100644--- a/Libraries/LibJS/JIT/Rust/src/ir/mod.rs+++ b/Libraries/LibJS/JIT/Rust/src/ir/mod.rs@@ -1472,8 +1472,10 @@ impl Op {allocates: true,..P::PURE},+ // NB: The runtime watches the intrinsics anew with new watchpoint sets once the old ones fired.Op::OpenArrayIteration => P {reads: Locations::ALL,+ allocates: true,..P::PURE},Op::LoadArrayIteratorArray | Op::LoadArrayIteratorIndex => P {diff --git a/Libraries/LibJS/JIT/Rust/src/snapshot.rs b/Libraries/LibJS/JIT/Rust/src/snapshot.rsindex 45a706c71a4..07a8d0f1a28 100644--- a/Libraries/LibJS/JIT/Rust/src/snapshot.rs+++ b/Libraries/LibJS/JIT/Rust/src/snapshot.rs@@ -987,10 +987,11 @@ pub struct RuntimeInfo {/// compiled code, if `%ArrayIteratorPrototype%` holds it. Code that/// embeds it must list it in `CompiledCode::embedded_cells`.pub array_iterator_next: Option<CellId>,- /// The fuse of the realm of the compiled code that stays intact while- /// its array iterators have no `return` method, if it was intact. Code- /// that depends on it must list it in `CompiledCode::embedded_cells`.- pub array_iterator_return_fuse: Option<CellId>,+ /// The watchpoint set of the realm of the compiled code that stays valid+ /// while its array iterators have no `return` method, if it was valid.+ /// Code that depends on it must list it in+ /// `CompiledCode::embedded_cells`.+ pub array_iterator_return_watchpoint_set: Option<CellId>,/// The realm of the compiled code.pub realm: CellId,/// `%Array.prototype%` and `%Object.prototype%` of the realm of thediff --git a/Libraries/LibJS/Rust/generate/layout_table.rs b/Libraries/LibJS/Rust/generate/layout_table.rsindex c50e47c374a..b2efd1d36b8 100644--- a/Libraries/LibJS/Rust/generate/layout_table.rs+++ b/Libraries/LibJS/Rust/generate/layout_table.rs@@ -377,10 +377,7 @@ pub fn generate(configuration: &LayoutConfiguration) -> LayoutWriter {field!(w, "REALM_GLOBAL_ENVIRONMENT", "Realm.global_environment", "GlobalEnvironment", Realm, global_environment, 8, "nonnull", "cell");field!(w, "REALM_GLOBAL_OBJECT", "Realm.global_object", "Object", Realm, global_object, 8, "nullable", "cell", "global_state");field!(w, "REALM_GLOBAL_DECLARATIVE_ENVIRONMENT", "Realm.global_declarative_environment", "DeclarativeEnvironment", Realm, global_declarative_environment, 8, "nullable", "cell", "global_state");- field!(w, "REALM_ARRAY_ITERATOR_RETURN_FUSE", "Realm.array_iterator_return_fuse", "Fuse", Realm, array_iterator_return_fuse, 8, "nullable", "cell");-- w.section("Fuse layout");- field!(w, "FUSE_INTACT", "Fuse.intact", "bool", Fuse, intact, 1, "nonnull", "scalar");+ field!(w, "REALM_ARRAY_ITERATOR_RETURN_WATCHPOINT_SET", "Realm.array_iterator_return_watchpoint_set", "WatchpointSet", Realm, array_iterator_return_watchpoint_set, 8, "nullable", "cell");w.section("VM layout");offset!(w, "VM_RUNNING_EXECUTION_CONTEXT", VmHead, running_execution_context);diff --git a/Libraries/LibJS/Rust/src/gc/class_id.rs b/Libraries/LibJS/Rust/src/gc/class_id.rsindex da00e31728c..b603e275715 100644--- a/Libraries/LibJS/Rust/src/gc/class_id.rs+++ b/Libraries/LibJS/Rust/src/gc/class_id.rs@@ -32,7 +32,6 @@ define_class_ids! {Accessor,Shape,WatchpointSet,- Fuse,SpecialPropertyCache,DescriptorArray,ValueStorage,diff --git a/Libraries/LibJS/Rust/src/interpreter/slow_paths/control.rs b/Libraries/LibJS/Rust/src/interpreter/slow_paths/control.rsindex 744be8f4b8e..0d243cb4acf 100644--- a/Libraries/LibJS/Rust/src/interpreter/slow_paths/control.rs+++ b/Libraries/LibJS/Rust/src/interpreter/slow_paths/control.rs@@ -37,7 +37,7 @@ use crate::runtime::object::{IndexedStorageKind, IntegrityLevel, PropertyKind};use crate::runtime::property_attributes::{Attribute, DEFAULT_ATTRIBUTES, PropertyAttributes};use crate::runtime::property_key::PropertyKey;use crate::runtime::realm::Realm;-use crate::runtime::realm_fuses;+use crate::runtime::realm_watchpoints;use crate::runtime::regexp_object::RegExpObject;use crate::runtime::set::Set;use crate::runtime::set_iterator::set_iteration_is_unobservable;@@ -221,7 +221,7 @@ pub fn array_append(if let Some(rhs_array) = rhs_array&& iterator_method == realm.array_prototype_values_function()&& rhs_array.is_simple_packed_array()- && realm_fuses::array_iterators_have_builtin_next(&realm)+ && realm_watchpoints::array_iterators_have_builtin_next(vm, realm)&& rhs_array.indexed_packed_element_count() <= u32::MAX - lhs_size{lhs_array.indexed_append_packed_elements_of(&rhs_array);@@ -396,7 +396,9 @@ fn fast_array_mode_array(vm: &Vm, iterable: Value, method: Gc<FunctionObject>) -return None;}let realm = current_realm(vm);- if method != realm.array_prototype_values_function() || !realm_fuses::array_iterators_have_builtin_next(&realm) {+ if method != realm.array_prototype_values_function()+ || !realm_watchpoints::array_iterators_have_builtin_next(vm, realm)+ {return None;}let array = iterable.as_object();@@ -467,7 +469,7 @@ pub fn iterator_close_slow_path(let iterator_record = if let Some(index) = fast_array_mode_index(values.iterator_object) {// NB: Without a return method, closing an array iterator does nothing.let realm = current_realm(vm);- if realm_fuses::array_iterators_have_no_return(&realm) {+ if realm_watchpoints::array_iterators_have_no_return(vm, realm) {return SlowPathControl::continue_at(pc + op::IteratorClose::LENGTH);}diff --git a/Libraries/LibJS/Rust/src/jit/dependencies.rs b/Libraries/LibJS/Rust/src/jit/dependencies.rsindex d5c7f063696..daf3d9eef6e 100644--- a/Libraries/LibJS/Rust/src/jit/dependencies.rs+++ b/Libraries/LibJS/Rust/src/jit/dependencies.rs@@ -29,7 +29,6 @@ use crate::layout::cell::Gc;use crate::layout::environment::DeclarativeEnvironment;use crate::layout::object::Object;use crate::layout::shape::WatchpointSet;-use crate::runtime::realm_fuses::Fuse;use crate::runtime::shape::Shape;/// Installed code that depends on something, as its executable and its id. Once the executable died or has other@@ -78,8 +77,7 @@ impl Dependents {Dependency::StableShape(shape) => shape_of(*shape).set_has_dependent_code(),Dependency::WatchpointSetValid(_)| Dependency::GlobalPropertyUnassigned { .. }- | Dependency::NoHtmlDdaObjects- | Dependency::Fuse(_) => {}+ | Dependency::NoHtmlDdaObjects => {}}code.entry(*dependency).or_default().push(DependentCode {executable: weak_executable.clone(),@@ -170,10 +168,6 @@ pub fn holds(vm: &Vm, dependency: &Dependency) -> bool {}Dependency::NoHtmlDdaObjects => !vm.jit.htmldda_objects_exist(),Dependency::StableShape(shape) => shape_of(*shape).is_stable(),- Dependency::Fuse(fuse) => {- // SAFETY: Code that depends on the cell embeds it, which keeps it alive.- unsafe { &*(fuse.0 as *const Fuse) }.is_intact()- }}}diff --git a/Libraries/LibJS/Rust/src/jit/disabled.rs b/Libraries/LibJS/Rust/src/jit/disabled.rsindex cbe9bb41011..50e867742b5 100644--- a/Libraries/LibJS/Rust/src/jit/disabled.rs+++ b/Libraries/LibJS/Rust/src/jit/disabled.rs@@ -228,7 +228,6 @@ pub mod dependencies {GlobalDeclarations { environment: CellId, serial: u64 },GlobalBindingUnassigned { environment: CellId, index: u32 },StableShape(CellId),- Fuse(CellId),}pub struct Dependents;diff --git a/Libraries/LibJS/Rust/src/jit/intrinsics.rs b/Libraries/LibJS/Rust/src/jit/intrinsics.rsindex bb19560ca4b..4a8168dd880 100644--- a/Libraries/LibJS/Rust/src/jit/intrinsics.rs+++ b/Libraries/LibJS/Rust/src/jit/intrinsics.rs@@ -23,7 +23,7 @@ use crate::runtime::array::Array;use crate::runtime::module_namespace_object::ModuleNamespaceObject;use crate::runtime::property_key::{PropertyKey, StringMayBeNumber};use crate::runtime::proxy_object::ProxyObject;-use crate::runtime::realm_fuses;+use crate::runtime::realm_watchpoints;use crate::runtime::string_object::StringObject;use crate::runtime::typed_array::{ContentType, TypedArrayBase};use crate::utf16::{has_fly_string_storage, to_utf16_fly_string};@@ -224,7 +224,7 @@ pub extern "C" fn libjs_jit_open_array_iteration(vm: &Vm, iterable: u64) -> u64// NB: The array inherits the iterator method from %Array.prototype%, which holds it as a data property. The cached// lookups of own properties run no code.let realm = vm.current_realm().expect("JIT code runs in a realm");- if !realm_fuses::array_iterators_have_builtin_next(&realm) {+ if !realm_watchpoints::array_iterators_have_builtin_next(vm, realm) {return Value::EMPTY.0;}let array_prototype = realm.array_prototype();diff --git a/Libraries/LibJS/Rust/src/jit/runtime_info.rs b/Libraries/LibJS/Rust/src/jit/runtime_info.rsindex f3bdffe4b1d..0c75d9742e3 100644--- a/Libraries/LibJS/Rust/src/jit/runtime_info.rs+++ b/Libraries/LibJS/Rust/src/jit/runtime_info.rs@@ -457,7 +457,7 @@ pub fn runtime_info(vm: &Vm, realm: Gc<Realm>, allocation: AllocationInfos) -> Ropen_array_iteration: super::intrinsics::libjs_jit_open_array_iteration as *const () as u64,// NB: Filled in by capture_snapshot(), which lists it as an embedded cell.array_iterator_next: None,- array_iterator_return_fuse: None,+ array_iterator_return_watchpoint_set: None,jit_exit: super::entry_exit::libjs_jit_exit as *const () as u64,to_boolean: addresses.to_boolean,primitive_to_string: super::calls::libjs_jit_primitive_to_string as *const () as u64,diff --git a/Libraries/LibJS/Rust/src/jit/snapshot.rs b/Libraries/LibJS/Rust/src/jit/snapshot.rsindex 596a36bd9c0..755aa0bae0d 100644--- a/Libraries/LibJS/Rust/src/jit/snapshot.rs+++ b/Libraries/LibJS/Rust/src/jit/snapshot.rs@@ -1170,8 +1170,12 @@ pub fn capture_snapshot(builder.cell(realm.array_prototype());builder.cell(realm.object_prototype());runtime.array_iterator_next = builder.optional_cell(array_iterator_next(vm, realm));- runtime.array_iterator_return_fuse =- builder.optional_cell(realm.array_iterator_return_fuse.get().filter(|fuse| fuse.is_intact()));+ runtime.array_iterator_return_watchpoint_set = builder.optional_cell(+ realm+ .array_iterator_return_watchpoint_set+ .get()+ .filter(|set| set.is_valid()),+ );let options = &vm.jit.options;let snapshot = Snapshot {executables,diff --git a/Libraries/LibJS/Rust/src/jit/tier_up.rs b/Libraries/LibJS/Rust/src/jit/tier_up.rsindex 9300a1cedef..8183ccb334b 100644--- a/Libraries/LibJS/Rust/src/jit/tier_up.rs+++ b/Libraries/LibJS/Rust/src/jit/tier_up.rs@@ -25,6 +25,7 @@ use crate::layout::function_object::EcmascriptFunctionObject;use crate::layout::value::Value;use crate::runtime::ecmascript_function_object::as_ecmascript_function_object;use crate::runtime::native_javascript_backed_function::NativeJavaScriptBackedFunction;+use crate::runtime::realm_watchpoints;use crate::runtime::shared_function_instance_data::FunctionKind;/// `threshold` invocations.@@ -380,6 +381,10 @@ fn compile(assert_eq!(executable.jit_compile_state(), CompileState::None);executable.set_jit_compile_state(CompileState::Queued);+ // NB: The snapshot captures the set only while it is valid, and capturing it may not allocate a new one.+ let realm = function.realm().expect("an ECMAScript function has a realm");+ realm_watchpoints::array_iterators_have_no_return(vm, realm);+// NB: Nothing may collect the cells the snapshot captured before something keeps them alive.let defer_gc = DeferGc::new(vm);let captured = capture_snapshot(vm, executable, function, osr_pc);diff --git a/Libraries/LibJS/Rust/src/layout/realm.rs b/Libraries/LibJS/Rust/src/layout/realm.rsindex f1353ab443d..c58aef0639d 100644--- a/Libraries/LibJS/Rust/src/layout/realm.rs+++ b/Libraries/LibJS/Rust/src/layout/realm.rs@@ -9,6 +9,7 @@ use core::cell::Cell;use super::cell::{CellHeader, Gc};use super::environment::{DeclarativeEnvironment, GlobalEnvironment};use super::object::Object;+use super::shape::WatchpointSet;use crate::layout_forward::{ForeignCellSlot, Intrinsics, RealmStorage};#[repr(C)]@@ -21,18 +22,9 @@ pub struct Realm {pub intrinsics: Cell<Option<Gc<Intrinsics>>>,/// [[HostDefined]]: a cell of the embedder, such as the settings object of a web realm.pub host_defined: ForeignCellSlot,- /// Intact while %ArrayIteratorPrototype% has its original `next` (see `runtime::realm_fuses`).- pub array_iterator_next_fuse: Cell<Option<Gc<Fuse>>>,- /// Intact while array iterators of the realm have no `return` method (see `runtime::realm_fuses`).- pub array_iterator_return_fuse: Cell<Option<Gc<Fuse>>>,+ /// Valid while %ArrayIteratorPrototype% has its original `next` (see `runtime::realm_watchpoints`).+ pub array_iterator_next_watchpoint_set: Cell<Option<Gc<WatchpointSet>>>,+ /// Valid while array iterators of the realm have no `return` method (see `runtime::realm_watchpoints`).+ pub array_iterator_return_watchpoint_set: Cell<Option<Gc<WatchpointSet>>>,pub storage: RealmStorage,}--/// A flag that stays set until a property of an intrinsic that it watches changes (see `runtime::realm_fuses`).-#[repr(C)]-pub struct Fuse {- pub header: CellHeader,- pub intact: Cell<bool>,- /// Keeps the cell at the minimum cell size.- pub padding: usize,-}diff --git a/Libraries/LibJS/Rust/src/runtime/intrinsics.rs b/Libraries/LibJS/Rust/src/runtime/intrinsics.rsindex a0e4c00aa39..b515acc55b9 100644--- a/Libraries/LibJS/Rust/src/runtime/intrinsics.rs+++ b/Libraries/LibJS/Rust/src/runtime/intrinsics.rs@@ -111,7 +111,7 @@ use crate::runtime::property_attributes::{Attribute, PropertyAttributes};use crate::runtime::property_key::{PropertyKey, StringMayBeNumber};use crate::runtime::proxy_constructor::ProxyConstructor;use crate::runtime::realm::Realm;-use crate::runtime::realm_fuses;+use crate::runtime::realm_watchpoints;use crate::runtime::reflect_object::ReflectObject;use crate::runtime::regexp_constructor::RegExpConstructor;use crate::runtime::regexp_prototype::RegExpPrototype;@@ -1090,7 +1090,7 @@ impl Intrinsics {// 3. Perform AddRestrictedFunctionProperties(realmRec.[[Intrinsics]].[[%Function.prototype%]], realmRec).add_restricted_function_properties(vm, &realm.intrinsics().function_prototype(vm), realm);- realm_fuses::arm(vm, realm);+ realm_watchpoints::arm(vm, realm);// 4. Return unused.intrinsicsdiff --git a/Libraries/LibJS/Rust/src/runtime/mod.rs b/Libraries/LibJS/Rust/src/runtime/mod.rsindex 784d14f24ef..33e403acd97 100644--- a/Libraries/LibJS/Rust/src/runtime/mod.rs+++ b/Libraries/LibJS/Rust/src/runtime/mod.rs@@ -143,7 +143,7 @@ pub mod proxy_constructor;pub mod proxy_object;pub mod raw_json_object;pub mod realm;-pub mod realm_fuses;+pub mod realm_watchpoints;pub mod reference;pub mod reflect_object;pub mod regexp_constructor;diff --git a/Libraries/LibJS/Rust/src/runtime/object.rs b/Libraries/LibJS/Rust/src/runtime/object.rsindex 601cf478397..800ad29d7e1 100644--- a/Libraries/LibJS/Rust/src/runtime/object.rs+++ b/Libraries/LibJS/Rust/src/runtime/object.rs@@ -53,7 +53,6 @@ use crate::runtime::property_attributes::{DEFAULT_ATTRIBUTES, PropertyAttributesuse crate::runtime::property_descriptor::{PropertyDescriptor, to_property_descriptor};use crate::runtime::property_key::PropertyKey;use crate::runtime::realm::Realm;-use crate::runtime::realm_fuses;use crate::runtime::shape::{AssignCopy, Shape};use crate::runtime::special_property_cache::{self, SpecialPropertyKey};use crate::runtime::symbol::Symbol;@@ -2839,8 +2838,6 @@ impl Object {remove_intrinsic_accessor(vm, self, property_key);}- realm_fuses::note_property_change(vm, self, property_key);-if attributes != metadata.attributes {let shape = self.shape();if shape.is_dictionary() {@@ -2869,8 +2866,6 @@ impl Object {return None;}- realm_fuses::note_property_change(vm, self, property_key);-if !self.shape().is_dictionary()&& self.shape().property_count() >= MAX_TRANSITIONS_BEFORE_CONVERTING_TO_DICTIONARY{@@ -2904,8 +2899,6 @@ impl Object {let metadata = self.shape().lookup(property_key).expect("the object has the property");- realm_fuses::note_property_change(vm, self, property_key);-// NB: Deleting the property moves those after it to the slots before them.if self.has_global_object_flag() {crate::jit::dependencies::note_global_object_slot_assignments(@@ -2941,7 +2934,6 @@ impl Object {if self.prototype() == new_prototype {return;}- realm_fuses::note_prototype_change(vm, self);self.shape.set(self.shape().create_prototype_transition(vm, new_prototype));}diff --git a/Libraries/LibJS/Rust/src/runtime/object_constructor.rs b/Libraries/LibJS/Rust/src/runtime/object_constructor.rsindex 5ccc0abb86e..caf1486497a 100644--- a/Libraries/LibJS/Rust/src/runtime/object_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/object_constructor.rs@@ -30,7 +30,6 @@ use crate::runtime::property_attributes::{Attribute, PropertyAttributes};use crate::runtime::property_descriptor::{from_property_descriptor, to_property_descriptor};use crate::runtime::property_key::PropertyKey;use crate::runtime::realm::Realm;-use crate::runtime::realm_fuses;use crate::runtime::value::same_value;use crate::utf16::utf16_formatted;@@ -787,7 +786,6 @@ fn try_assign_from_shape(vm: &Vm, target: &Object, source: &Object) -> ThrowComp&& metadata.attributes.is_writable()&& !target.get_direct(metadata.offset).is_accessor(){- realm_fuses::note_property_change(vm, target, &property_key);target.replace_direct(vm, metadata.offset, value);continue;}diff --git a/Libraries/LibJS/Rust/src/runtime/realm.rs b/Libraries/LibJS/Rust/src/runtime/realm.rsindex 85defae88fc..5087117af0f 100644--- a/Libraries/LibJS/Rust/src/runtime/realm.rs+++ b/Libraries/LibJS/Rust/src/runtime/realm.rs@@ -46,8 +46,8 @@ unsafe impl Trace for Realm {self.global_declarative_environment.trace(visitor);self.host_defined.trace(visitor);self.storage.embedder_data.trace(visitor);- self.array_iterator_next_fuse.trace(visitor);- self.array_iterator_return_fuse.trace(visitor);+ self.array_iterator_next_watchpoint_set.trace(visitor);+ self.array_iterator_return_watchpoint_set.trace(visitor);}}@@ -122,8 +122,8 @@ impl Realm {global_environment: Cell::new(None),intrinsics: Cell::new(None),host_defined: ForeignCellSlot::empty(),- array_iterator_next_fuse: Cell::new(None),- array_iterator_return_fuse: Cell::new(None),+ array_iterator_next_watchpoint_set: Cell::new(None),+ array_iterator_return_watchpoint_set: Cell::new(None),storage: RealmStorage::default(),})}diff --git a/Libraries/LibJS/Rust/src/runtime/realm_fuses.rs b/Libraries/LibJS/Rust/src/runtime/realm_fuses.rsdeleted file mode 100644index 0b7eb3a5dd2..00000000000--- a/Libraries/LibJS/Rust/src/runtime/realm_fuses.rs+++ /dev/null@@ -1,137 +0,0 @@-/*- * Copyright (c) 2026-present, the Ladybird developers.- *- * SPDX-License-Identifier: BSD-2-Clause- */--//! Fuses: flags of a realm that stay set while some properties of its intrinsics are as the realm made them. Fast-//! paths that skip steps of the iterator protocol rely on them instead of looking up those properties every time.-//!-//! - `array_iterator_next_fuse`: %ArrayIteratorPrototype% has its own `next`, the builtin of the realm. Any change of-//! that property pops it, also a write of the same value: caches write only to slots that the runtime wrote to-//! before, so the first write pops the fuse before a cache can write to the slot.-//! - `array_iterator_return_fuse`: array iterators have no `return` method. A `return` property on-//! %ArrayIteratorPrototype%, %IteratorPrototype% or %Object.prototype%, or a new prototype of one of the first two,-//! pops it. %Object.prototype% has an immutable prototype.-//!-//! A fuse never becomes intact again. Popping it invalidates the JIT code that depends on it.--use core::cell::Cell;--use crate::gc::class::{GcCell, define_cell};-use crate::gc::visitor::{Trace, Visitor};-use crate::interpreter::vm::Vm;-use crate::jit::dependencies::{CellId, Dependency};-use crate::layout::cell::{CellHeader, Gc};-use crate::layout::object::Object;-use crate::runtime::property_key::PropertyKey;-use crate::runtime::realm::Realm;--pub use crate::layout::realm::Fuse;--define_cell!(Fuse, Other);--// SAFETY: A fuse holds no cells.-unsafe impl Trace for Fuse {- fn trace(&self, _: &mut Visitor) {}-}--impl Fuse {- fn create(vm: &Vm) -> Gc<Fuse> {- vm.heap().allocate(Fuse {- header: CellHeader::for_class(Self::CLASS),- intact: Cell::new(true),- padding: 0,- })- }-- pub fn is_intact(&self) -> bool {- self.intact.get()- }-- fn pop(&self, vm: &Vm) {- if !self.is_intact() {- return;- }- self.intact.set(false);- crate::jit::dependencies::invalidate_dependents(vm, Dependency::Fuse(CellId(core::ptr::from_ref(self) as u64)));- }-}--/// Sets the fuses of a realm whose intrinsics were just created. Until then, changes of the watched properties do not-/// pop anything, since creating the intrinsics defines them.-pub fn arm(vm: &Vm, realm: Gc<Realm>) {- // NB: Prototype shapes belong to one object each, so that caches of other objects never write to the slots of- // the watched objects.- realm.array_iterator_prototype().convert_to_prototype_if_needed(vm);- realm- .intrinsics()- .iterator_prototype(vm)- .convert_to_prototype_if_needed(vm);- realm.object_prototype().convert_to_prototype_if_needed(vm);-- realm.array_iterator_next_fuse.set(Some(Fuse::create(vm)));- realm.array_iterator_return_fuse.set(Some(Fuse::create(vm)));-}--/// Whether array iterators of the realm have its builtin `next` method.-pub fn array_iterators_have_builtin_next(realm: &Realm) -> bool {- realm- .array_iterator_next_fuse- .get()- .is_some_and(|fuse| fuse.is_intact())-}--/// Whether array iterators of the realm have no `return` method.-pub fn array_iterators_have_no_return(realm: &Realm) -> bool {- realm- .array_iterator_return_fuse- .get()- .is_some_and(|fuse| fuse.is_intact())-}--/// Notes that property `key` of `object` changes: it is added, written, deleted or gets other attributes.-#[inline(always)]-pub fn note_property_change(vm: &Vm, object: &Object, key: &PropertyKey) {- if *key == vm.names.next || *key == vm.names.return_ {- note_watched_property_change(vm, object, key);- }-}--#[cold]-fn note_watched_property_change(vm: &Vm, object: &Object, key: &PropertyKey) {- let realm = object.shape().realm();- if *key == vm.names.next {- if let Some(fuse) = realm.array_iterator_next_fuse.get()- && is(object, realm.array_iterator_prototype())- {- fuse.pop(vm);- }- return;- }- if let Some(fuse) = realm.array_iterator_return_fuse.get()- && (is_prototype_of_array_iterators(vm, &realm, object) || is(object, realm.object_prototype()))- {- fuse.pop(vm);- }-}--/// Notes that the prototype of `object` changes.-pub fn note_prototype_change(vm: &Vm, object: &Object) {- let realm = object.shape().realm();- if let Some(fuse) = realm.array_iterator_return_fuse.get()- && is_prototype_of_array_iterators(vm, &realm, object)- {- fuse.pop(vm);- }-}--/// Whether `object` is %ArrayIteratorPrototype% or %IteratorPrototype% of the realm, whose fuses are armed.-fn is_prototype_of_array_iterators(vm: &Vm, realm: &Realm, object: &Object) -> bool {- is(object, realm.array_iterator_prototype()) || is(object, realm.intrinsics().iterator_prototype(vm))-}--/// Whether `object` is `intrinsic`. NB: The hooks also see objects that are not allocated yet.-fn is(object: &Object, intrinsic: Gc<Object>) -> bool {- core::ptr::eq(object, intrinsic.as_ptr())-}diff --git a/Libraries/LibJS/Rust/src/runtime/realm_watchpoints.rs b/Libraries/LibJS/Rust/src/runtime/realm_watchpoints.rsnew file mode 100644index 00000000000..51e60b600c5--- /dev/null+++ b/Libraries/LibJS/Rust/src/runtime/realm_watchpoints.rs@@ -0,0 +1,122 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++//! Watchpoint sets of a realm that stay valid while some properties of its intrinsics are as the realm made them. Fast+//! paths that skip steps of the iterator protocol rely on them instead of looking up those properties every time.+//!+//! - `array_iterator_next_watchpoint_set`: %ArrayIteratorPrototype% has its own `next`, the builtin of the realm. It+//! depends on the set that fires when the value of the property changes (see `Shape::watch_slot_for_replacements()`).+//! - `array_iterator_return_watchpoint_set`: array iterators have no `return` method. %ArrayIteratorPrototype%,+//! %IteratorPrototype% and %Object.prototype% have no `return` property, and the first two keep their prototypes. It+//! depends on the set that fires when an object of that prototype chain changes (see+//! `Shape::prototype_chain_validity()`).+//!+//! A change of an intrinsic fires the sets that depend on it, also one that leaves what they stand for in place, such+//! as a new property of %Object.prototype%. The next query of a fired set checks whether what it stands for still+//! holds, and if so, watches the intrinsics anew with a new set. Once it does not hold, the realm has no set anymore.++use crate::interpreter::vm::Vm;+use crate::layout::cell::Gc;+use crate::layout::object::Object;+use crate::runtime::realm::Realm;+use crate::runtime::watchpoint_set::WatchpointSet;++/// Starts watching the intrinsics of a realm whose intrinsics were just created. Until then, changes of the watched+/// properties do not matter, since creating the intrinsics defines them.+pub fn arm(vm: &Vm, realm: Gc<Realm>) {+ // NB: Prototype shapes belong to one object each, and have the watchpoint sets of their slots and prototype chains.+ realm.array_iterator_prototype().convert_to_prototype_if_needed(vm);+ realm+ .intrinsics()+ .iterator_prototype(vm)+ .convert_to_prototype_if_needed(vm);+ realm.object_prototype().convert_to_prototype_if_needed(vm);++ realm+ .array_iterator_next_watchpoint_set+ .set(watch_array_iterator_next(vm, realm));+ realm+ .array_iterator_return_watchpoint_set+ .set(watch_array_iterator_return(vm, realm));+}++/// Whether array iterators of the realm have its builtin `next` method.+pub fn array_iterators_have_builtin_next(vm: &Vm, realm: Gc<Realm>) -> bool {+ let Some(set) = realm.array_iterator_next_watchpoint_set.get() else {+ return false;+ };+ if set.is_valid() {+ return true;+ }+ let set = watch_array_iterator_next(vm, realm);+ realm.array_iterator_next_watchpoint_set.set(set);+ set.is_some()+}++/// Whether array iterators of the realm have no `return` method.+pub fn array_iterators_have_no_return(vm: &Vm, realm: Gc<Realm>) -> bool {+ let Some(set) = realm.array_iterator_return_watchpoint_set.get() else {+ return false;+ };+ if set.is_valid() {+ return true;+ }+ let set = watch_array_iterator_return(vm, realm);+ realm.array_iterator_return_watchpoint_set.set(set);+ set.is_some()+}++/// The set that stays valid while %ArrayIteratorPrototype% has its own `next`, the builtin of the realm, if it has.+fn watch_array_iterator_next(vm: &Vm, realm: Gc<Realm>) -> Option<Gc<WatchpointSet>> {+ let array_iterator_prototype = realm.array_iterator_prototype();+ let metadata = array_iterator_prototype.shape().lookup(&vm.names.next)?;+ let next = array_iterator_prototype.get_direct(metadata.offset);+ if next.is_accessor() || !next.is_function() {+ return None;+ }+ let next = next.as_function();+ if !next.is_array_prototype_next_builtin() || next.realm() != Some(realm) {+ return None;+ }+ // NB: A slot that property lookup caches may write to has no replacement watchpoint set. Caches write only to slots+ // that the runtime wrote to before, so the realm stops watching once the property is written.+ let replacement_watchpoint_set = array_iterator_prototype+ .shape()+ .watch_slot_for_replacements(vm, metadata.offset)?;+ let set = WatchpointSet::create(vm);+ replacement_watchpoint_set.add_dependent_set(vm, set);+ Some(set)+}++/// The set that stays valid while array iterators of the realm have no `return` method, if they have none.+fn watch_array_iterator_return(vm: &Vm, realm: Gc<Realm>) -> Option<Gc<WatchpointSet>> {+ let array_iterator_prototype = realm.array_iterator_prototype();+ let iterator_prototype = realm.intrinsics().iterator_prototype(vm);+ let object_prototype = realm.object_prototype();+ // NB: %Object.prototype% has an immutable prototype.+ let chain: [(Gc<Object>, Option<Gc<Object>>); 3] = [+ (array_iterator_prototype, Some(iterator_prototype)),+ (iterator_prototype, Some(object_prototype)),+ (object_prototype, None),+ ];+ for (object, expected_prototype) in chain {+ if expected_prototype.is_some() && object.shape().prototype() != expected_prototype {+ return None;+ }+ if object.shape().lookup(&vm.names.return_).is_some() {+ return None;+ }+ }+ // NB: The validity of the prototype chain of a prototype shape fires when the object or one of its prototypes+ // changes its properties or its prototype.+ let prototype_chain_validity = array_iterator_prototype.shape().prototype_chain_validity()?;+ if !prototype_chain_validity.is_valid() {+ return None;+ }+ let set = WatchpointSet::create(vm);+ prototype_chain_validity.add_dependent_set(vm, set);+ Some(set)+}diff --git a/Libraries/LibJS/Rust/src/runtime/watchpoint_set.rs b/Libraries/LibJS/Rust/src/runtime/watchpoint_set.rsindex 3b2f19b7452..6f930ddec79 100644--- a/Libraries/LibJS/Rust/src/runtime/watchpoint_set.rs+++ b/Libraries/LibJS/Rust/src/runtime/watchpoint_set.rs@@ -17,18 +17,32 @@ use crate::layout::cell::{CellHeader, Gc};pub use crate::layout::shape::WatchpointSet;use crate::runtime::special_property_cache::SpecialPropertyCache;-/// A cache that relies on a watchpoint set, and forgets what it knows when the set fires.-struct Watcher {- cache: GcWeak<SpecialPropertyCache>,- /// The generation of the cache when it started to rely on the set. Once the cache forgot what it knew, it relies- /// on the sets it watches anew, and the watchers of its earlier generations are stale.- generation: u32,+/// What relies on a watchpoint set, and stops relying on it when the set fires.+enum Watcher {+ /// A cache that forgets what it knows.+ Cache {+ cache: GcWeak<SpecialPropertyCache>,+ /// The generation of the cache when it started to rely on the set. Once the cache forgot what it knew, it+ /// relies on the sets it watches anew, and the watchers of its earlier generations are stale.+ generation: u32,+ },+ /// A set that stands for something that holds only while this set is valid, and fires with it.+ Set(GcWeak<WatchpointSet>),+}++impl Watcher {+ fn is_stale(&self) -> bool {+ match self {+ Watcher::Cache { cache, generation } => cache.get().is_none_or(|cache| cache.generation() != *generation),+ Watcher::Set(set) => set.get().is_none_or(|set| !set.is_valid()),+ }+ }}/// The fewest watchers a set prunes.const MIN_WATCHERS_TO_PRUNE: usize = 8;-/// What a watchpoint set keeps besides whether it is valid: the caches that rely on it.+/// What a watchpoint set keeps besides whether it is valid: what relies on it.pub struct WatchpointSetStorage {watchers: RefCell<Vec<Watcher>>,/// How many watchers the set has when it next prunes those that are stale.@@ -46,7 +60,7 @@ impl Default for WatchpointSetStorage {define_cell!(WatchpointSet, Other);-// SAFETY: A watchpoint set only holds weak references to the caches that watch it.+// SAFETY: A watchpoint set only holds weak references to what watches it.unsafe impl Trace for WatchpointSet {fn trace(&self, _: &mut Visitor) {}}@@ -66,35 +80,44 @@ impl WatchpointSet {/// Has `cache` forget what it knows of its generation `generation` when the set fires.pub(crate) fn add_watcher(&self, vm: &Vm, cache: Gc<SpecialPropertyCache>, generation: u32) {- assert!(self.is_valid());- let mut watchers = self.storage.watchers.borrow_mut();- if watchers+ if self+ .storage+ .watchers+ .borrow().last()- .is_some_and(|watcher| watcher.generation == generation && watcher.cache.get() == Some(cache))+ .is_some_and(|watcher| matches!(watcher, Watcher::Cache { cache: last, generation: last_generation } if *last_generation == generation && last.get() == Some(cache))){return;}+ self.push_watcher(Watcher::Cache {+ cache: GcWeak::new(vm.heap(), cache),+ generation,+ });+ }++ /// Has `set` fire when this set fires.+ pub fn add_dependent_set(&self, vm: &Vm, set: Gc<WatchpointSet>) {+ assert!(set.is_valid());+ self.push_watcher(Watcher::Set(GcWeak::new(vm.heap(), set)));+ }++ fn push_watcher(&self, watcher: Watcher) {+ assert!(self.is_valid());+ let mut watchers = self.storage.watchers.borrow_mut();// NB: A set that never fires keeps the watchers of caches that died with their shapes, or that forgot what they- // knew. Pruning them each time the number of watchers doubled since it last pruned keeps them in check.+ // knew, and of sets that fired. Pruning them each time the number of watchers doubled since it last pruned+ // keeps them in check.if watchers.len() >= self.storage.prune_at.get() {- watchers.retain(|watcher| {- watcher- .cache- .get()- .is_some_and(|cache| cache.generation() == watcher.generation)- });+ watchers.retain(|watcher| !watcher.is_stale());self.storage.prune_at.set((watchers.len() * 2).max(MIN_WATCHERS_TO_PRUNE));}- watchers.push(Watcher {- cache: GcWeak::new(vm.heap(), cache),- generation,- });+ watchers.push(watcher);}/// Notes that what the set stands for stopped holding, which has the caches that rely on it forget what they know,- /// and invalidates the JIT code that depends on it.+ /// fires the sets that depend on it, and invalidates the JIT code that depends on it.pub fn fire(&self, vm: &Vm) {if !self.is_valid() {return;@@ -102,8 +125,17 @@ impl WatchpointSet {self.valid.set(false);let watchers = core::mem::take(&mut *self.storage.watchers.borrow_mut());for watcher in watchers {- if let Some(cache) = watcher.cache.get() {- cache.forget(watcher.generation);+ match watcher {+ Watcher::Cache { cache, generation } => {+ if let Some(cache) = cache.get() {+ cache.forget(generation);+ }+ }+ Watcher::Set(set) => {+ if let Some(set) = set.get() {+ set.fire(vm);+ }+ }}}crate::jit::dependencies::invalidate_dependents(diff --git a/Tests/LibJS/Runtime/iterators/watchpoints/changes-after-unrelated-changes.js b/Tests/LibJS/Runtime/iterators/watchpoints/changes-after-unrelated-changes.jsnew file mode 100644index 00000000000..1e815cb19e2--- /dev/null+++ b/Tests/LibJS/Runtime/iterators/watchpoints/changes-after-unrelated-changes.js@@ -0,0 +1,84 @@+const ArrayIteratorPrototype = Object.getPrototypeOf([][Symbol.iterator]());+const IteratorPrototype = Object.getPrototypeOf(ArrayIteratorPrototype);+const originalNext = ArrayIteratorPrototype.next;++function spread(array) {+ return [...array];+}++function destructure(array) {+ const [first] = array;+ return first;+}++function breakAfterFirst(array) {+ for (const value of array) return value;+}++function compileIteration() {+ for (const f of [spread, destructure, breakAfterFirst]) {+ if (typeof jit !== "undefined") jit.prepare(f);+ for (let i = 0; i < 10; ++i) f([1, 2, 3]);+ if (typeof jit !== "undefined") expect(jit.compile(f)).toBe(jit.enabled);+ }+}++function changeUnrelatedProperties() {+ for (const object of [ArrayIteratorPrototype, IteratorPrototype, Object.prototype]) {+ Object.defineProperty(object, "unrelated", { value: 1, configurable: true, writable: true });+ expect(spread([1, 2, 3])).toEqual([1, 2, 3]);+ expect(destructure([1, 2, 3])).toBe(1);+ expect(breakAfterFirst([1, 2, 3])).toBe(1);+ delete object.unrelated;+ expect(spread([1, 2, 3])).toEqual([1, 2, 3]);+ }+}++test("array iteration calls a return method defined after unrelated properties changed", () => {+ compileIteration();+ changeUnrelatedProperties();+ compileIteration();++ let returnCalls = 0;+ Object.defineProperty(Object.prototype, "return", {+ value() {+ ++returnCalls;+ return {};+ },+ configurable: true,+ writable: true,+ });+ try {+ expect(destructure([1, 2, 3])).toBe(1);+ expect(breakAfterFirst([1, 2, 3])).toBe(1);+ expect(returnCalls).toBe(2);+ } finally {+ delete Object.prototype.return;+ }+ expect(breakAfterFirst([1, 2, 3])).toBe(1);+ expect(returnCalls).toBe(2);+});++test("array iteration calls a next method defined after unrelated properties changed", () => {+ compileIteration();+ changeUnrelatedProperties();+ compileIteration();++ let nextCalls = 0;+ Object.defineProperty(ArrayIteratorPrototype, "next", {+ value() {+ ++nextCalls;+ return originalNext.call(this);+ },+ configurable: true,+ writable: true,+ });+ try {+ expect(spread([1, 2, 3])).toEqual([1, 2, 3]);+ expect(nextCalls).toBe(4);+ } finally {+ Object.defineProperty(ArrayIteratorPrototype, "next", { value: originalNext });+ }+ expect(spread([1, 2, 3])).toEqual([1, 2, 3]);+ expect(nextCalls).toBe(4);+});diff --git a/Tests/LibJS/Runtime/iterators/fuses/next-accessor.js b/Tests/LibJS/Runtime/iterators/watchpoints/next-accessor.jssimilarity index 100%rename from Tests/LibJS/Runtime/iterators/fuses/next-accessor.jsrename to Tests/LibJS/Runtime/iterators/watchpoints/next-accessor.jsdiff --git a/Tests/LibJS/Runtime/iterators/fuses/next-assignment-of-same-value.js b/Tests/LibJS/Runtime/iterators/watchpoints/next-assignment-of-same-value.jssimilarity index 100%rename from Tests/LibJS/Runtime/iterators/fuses/next-assignment-of-same-value.jsrename to Tests/LibJS/Runtime/iterators/watchpoints/next-assignment-of-same-value.jsdiff --git a/Tests/LibJS/Runtime/iterators/fuses/next-assignment.js b/Tests/LibJS/Runtime/iterators/watchpoints/next-assignment.jssimilarity index 100%rename from Tests/LibJS/Runtime/iterators/fuses/next-assignment.jsrename to Tests/LibJS/Runtime/iterators/watchpoints/next-assignment.jsdiff --git a/Tests/LibJS/Runtime/iterators/fuses/next-deletion.js b/Tests/LibJS/Runtime/iterators/watchpoints/next-deletion.jssimilarity index 100%rename from Tests/LibJS/Runtime/iterators/fuses/next-deletion.jsrename to Tests/LibJS/Runtime/iterators/watchpoints/next-deletion.jsdiff --git a/Tests/LibJS/Runtime/iterators/fuses/next-object-assign.js b/Tests/LibJS/Runtime/iterators/watchpoints/next-object-assign.jssimilarity index 100%rename from Tests/LibJS/Runtime/iterators/fuses/next-object-assign.jsrename to Tests/LibJS/Runtime/iterators/watchpoints/next-object-assign.jsdiff --git a/Tests/LibJS/Runtime/iterators/fuses/return-from-new-prototype-of-array-iterator-prototype.js b/Tests/LibJS/Runtime/iterators/watchpoints/return-from-new-prototype-of-array-iterator-prototype.jssimilarity index 100%rename from Tests/LibJS/Runtime/iterators/fuses/return-from-new-prototype-of-array-iterator-prototype.jsrename to Tests/LibJS/Runtime/iterators/watchpoints/return-from-new-prototype-of-array-iterator-prototype.jsdiff --git a/Tests/LibJS/Runtime/iterators/fuses/return-from-new-prototype-of-iterator-prototype.js b/Tests/LibJS/Runtime/iterators/watchpoints/return-from-new-prototype-of-iterator-prototype.jssimilarity index 100%rename from Tests/LibJS/Runtime/iterators/fuses/return-from-new-prototype-of-iterator-prototype.jsrename to Tests/LibJS/Runtime/iterators/watchpoints/return-from-new-prototype-of-iterator-prototype.jsdiff --git a/Tests/LibJS/Runtime/iterators/fuses/return-getter.js b/Tests/LibJS/Runtime/iterators/watchpoints/return-getter.jssimilarity index 100%rename from Tests/LibJS/Runtime/iterators/fuses/return-getter.jsrename to Tests/LibJS/Runtime/iterators/watchpoints/return-getter.jsdiff --git a/Tests/LibJS/Runtime/iterators/fuses/return-on-array-iterator-prototype.js b/Tests/LibJS/Runtime/iterators/watchpoints/return-on-array-iterator-prototype.jssimilarity index 100%rename from Tests/LibJS/Runtime/iterators/fuses/return-on-array-iterator-prototype.jsrename to Tests/LibJS/Runtime/iterators/watchpoints/return-on-array-iterator-prototype.jsdiff --git a/Tests/LibJS/Runtime/iterators/fuses/return-on-iterator-prototype.js b/Tests/LibJS/Runtime/iterators/watchpoints/return-on-iterator-prototype.jssimilarity index 100%rename from Tests/LibJS/Runtime/iterators/fuses/return-on-iterator-prototype.jsrename to Tests/LibJS/Runtime/iterators/watchpoints/return-on-iterator-prototype.jsdiff --git a/Tests/LibJS/Runtime/iterators/fuses/return-on-object-prototype.js b/Tests/LibJS/Runtime/iterators/watchpoints/return-on-object-prototype.jssimilarity index 100%rename from Tests/LibJS/Runtime/iterators/fuses/return-on-object-prototype.jsrename to Tests/LibJS/Runtime/iterators/watchpoints/return-on-object-prototype.js