Skip to content

Instantly share code, notes, and snippets.

@jimblandy
Last active August 29, 2015 14:13
Show Gist options
  • Save jimblandy/136eaeb4d462e3009ab1 to your computer and use it in GitHub Desktop.
Save jimblandy/136eaeb4d462e3009ab1 to your computer and use it in GitHub Desktop.
Lazy Debugger.Frame invalidation

Lazy Debugger.Frame invalidation

I think there is a representation for Debugger.Frames that does not require frames to be removed from the Debugger::frames FrameMap when they are popped. It does still require prompt notification of:

  • frame pops for Debugger.Frame instances that have an onPop handler set, to report the pop to Debugger's users; and

  • changes of a frame's representation (on-stack replacement; bailouts; etc.), to update the key in the map.

Not needing to report pops comes at the cost of a more expensive validity check before using a Debugger.Frame. But even so, we should be able to skip this check in some circumstances.

js::DebuggerFrameShared

In the presence of multiple Debuggers, there may be many Debugger.Frame instances for a single JavaScript frame. We introduce a new structure, js::DebuggerFrameShared, that is one-to-one with JavaScript frames, and shared by all the Debugger.Frames that refer to it.

struct DebuggerFrameShared {

  // The number of Debugger.Frame instances referring to this DebuggerFrameShared.
  unsigned refCount;

  // Initialized from a running counter stored in perThreadData.
  unsigned generation;
  union { AbstractFramePtr, ScriptFrameIter } frame;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment