gecko-dev/js
Jim Blandy b22848cd46 Bug 1586452: Let JSScripts and wasm::Instances own their BreakpointSites and Breakpoints. r=jonco
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
2019-10-23 19:50:02 +00:00
..
ductwork/debugger
examples
ipc Bug 1588231. Remove special-cased QI-for-DOM-objects handling in CPOWs, since no one uses it outside of one test. r=peterv 2019-10-14 10:31:28 +00:00
public Bug 1583251 - P3 - Check if it is okay to allow shared memory while deserializing; r=nika,lth 2019-10-23 07:20:18 +00:00
rust Bug 1448324 - Fix link in js/rust readme. r=jdm 2019-10-18 14:30:52 +00:00
src Bug 1586452: Let JSScripts and wasm::Instances own their BreakpointSites and Breakpoints. r=jonco 2019-10-23 19:50:02 +00:00
xpconnect Bug 1582531 - Re-enable some skipped tests, r=mccr8 2019-10-23 16:04:53 +00:00
app.mozbuild
ffi.configure
moz.build
moz.configure Bug 1577757 - Add a compile-time option for wasm multi-value r=luke 2019-10-01 14:30:35 +00:00
sub.configure