Bug 1099446 - Rekey DebugScopes::missingScopes on debug mode OSR. (r=luke)

This commit is contained in:
Shu-yu Guo 2014-11-18 16:42:01 -08:00
Родитель c0911d9bae
Коммит f03f3e5894
3 изменённых файлов: 23 добавлений и 0 удалений

Просмотреть файл

@ -4475,6 +4475,7 @@ Debugger::observesScript(JSScript *script) const
Debugger::replaceFrameGuts(JSContext *cx, AbstractFramePtr from, AbstractFramePtr to,
ScriptFrameIter &iter)
{
// Forward live Debugger.Frame objects.
for (Debugger::FrameRange r(from); !r.empty(); r.popFront()) {
RootedNativeObject frameobj(cx, r.frontFrame());
Debugger *dbg = r.frontDebugger();
@ -4497,6 +4498,9 @@ Debugger::replaceFrameGuts(JSContext *cx, AbstractFramePtr from, AbstractFramePt
}
}
// Rekey missingScopes to maintain Debugger.Environment identity.
DebugScopes::rekeyMissingScopes(cx, from, to);
return true;
}

Просмотреть файл

@ -2380,6 +2380,22 @@ DebugScopes::hasLiveScope(ScopeObject &scope)
return nullptr;
}
/* static */ void
DebugScopes::rekeyMissingScopes(JSContext *cx, AbstractFramePtr from, AbstractFramePtr to)
{
DebugScopes *scopes = cx->compartment()->debugScopes;
if (!scopes)
return;
for (MissingScopeMap::Enum e(scopes->missingScopes); !e.empty(); e.popFront()) {
ScopeIterKey key = e.front().key();
if (key.frame() == from) {
key.updateFrame(to);
e.rekeyFront(key);
}
}
}
/*****************************************************************************/
static JSObject *

Просмотреть файл

@ -774,6 +774,7 @@ class ScopeIterKey
void updateCur(JSObject *obj) { cur_ = obj; }
void updateStaticScope(NestedScopeObject *obj) { staticScope_ = obj; }
void updateFrame(AbstractFramePtr frame) { frame_ = frame; }
/* For use as hash policy */
typedef ScopeIterKey Lookup;
@ -941,6 +942,8 @@ class DebugScopes
static bool updateLiveScopes(JSContext *cx);
static ScopeIterVal *hasLiveScope(ScopeObject &scope);
static void rekeyMissingScopes(JSContext *cx, AbstractFramePtr from, AbstractFramePtr to);
// In debug-mode, these must be called whenever exiting a scope that might
// have stack-allocated locals.
static void onPopCall(AbstractFramePtr frame, JSContext *cx);