mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
b22848cd46
Prior to this patch, the code marked a Debugger if any of its debuggee globals were marked, and it had breakpoints set in JSScripts/Instances that were marked. It cleaned up breakpoints by scanning all JSScripts and wasm::Instances in the zones being collected, looking for breakpoints set in them, and deleting them if either the JSScript/Instance or the owning Debugger was about to be finalized. That byzantine approach is equivalent to having owning edges from JSScripts/Instances to the breakpoints set in them, and from those breakpoints to the Debuggers they belong to. Proof: if a script is live, then its global must be live. If the script has a breakpoint set in it, and its global is live, then its Debugger will be marked, and hence neither the Debugger nor the script will be finalized, and hence the breakpoints will be retained. That second approach handles the situation with a much more traditional tracing process, wherein tracing a script traces its breakpoints, which traces their owning Debuggers. We can simply use cross-compartment wrappers for the edges from the breakpoints to their handlers and Debuggers, which removes a bunch of special cases for the GC to worry about. This patch changes things to use the second approach. - js::DebugScript and js::wasm::DebugState get `trace` and `finalize`/`delete_` methods, which get called from the right places. DebugScript and DebugState become the owners of their `BreakpointSite`s. - `BreakpointSite`s get `trace` and `finalize` methods that visit their `Breakpoint`s. `JSBreakpointSite`s also trace their scripts, and `WasmBreakpointSite`s trace their wasm::Instances. - `Breakpoint`s get a `trace` method that traces their owning `Debugger` and their handler object. They hold these as cross-compartment references, since the `Breakpoint` logically belongs to its code's compartment. Code that uses these fields wraps/unwraps as appropriate. - All the specialized breakpoint sweeping code is deleted: - `Zone::sweepBreakpoints` and its supporting `DebugAPI` functions are deleted. - `Debugger::hasAnyLiveHooks` no longer considers breakpoints. - `DebugAPI::markIteratively` no longer searches for breakpoints to mark. - `DebugAPI::traceAllForMovingGC` no longer traverses breakpoints. Differential Revision: https://phabricator.services.mozilla.com/D49858 --HG-- extra : moz-landing-system : lando |
||
---|---|---|
.. | ||
ductwork/debugger | ||
examples | ||
ipc | ||
public | ||
rust | ||
src | ||
xpconnect | ||
app.mozbuild | ||
ffi.configure | ||
moz.build | ||
moz.configure | ||
sub.configure |