зеркало из https://github.com/mozilla/gecko-dev.git
Bug 949283 - Add a post-barrier to missingScopes for the JSObject* in ScopeKeyIter; r=jonco
This commit is contained in:
Родитель
8fa042c6ad
Коммит
774e6ed76a
|
@ -1570,6 +1570,37 @@ DebugScopes::proxiedScopesPostWriteBarrier(JSRuntime *rt, ObjectWeakMap *map,
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
class DebugScopes::MissingScopesRef : public BufferableRef
|
||||
{
|
||||
MissingScopeMap *map;
|
||||
ScopeIterKey key;
|
||||
|
||||
public:
|
||||
MissingScopesRef(MissingScopeMap *m, const ScopeIterKey &k) : map(m), key(k) {}
|
||||
|
||||
void mark(JSTracer *trc) {
|
||||
ScopeIterKey prior = key;
|
||||
MissingScopeMap::Ptr p = map->lookup(key);
|
||||
if (!p)
|
||||
return;
|
||||
JS_SET_TRACING_LOCATION(trc, &const_cast<ScopeIterKey &>(p->key()).enclosingScope());
|
||||
Mark(trc, &key.enclosingScope(), "MissingScopesRef");
|
||||
map->rekeyIfMoved(prior, key);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
/* static */ JS_ALWAYS_INLINE void
|
||||
DebugScopes::missingScopesPostWriteBarrier(JSRuntime *rt, MissingScopeMap *map,
|
||||
const ScopeIterKey &key)
|
||||
{
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
if (key.enclosingScope() && IsInsideNursery(rt, key.enclosingScope()))
|
||||
rt->gcStoreBuffer.putGeneric(MissingScopesRef(map, key));
|
||||
#endif
|
||||
}
|
||||
|
||||
/* static */ JS_ALWAYS_INLINE void
|
||||
DebugScopes::liveScopesPostWriteBarrier(JSRuntime *rt, LiveScopeMap *map, ScopeObject *key)
|
||||
{
|
||||
|
@ -1763,6 +1794,7 @@ DebugScopes::addDebugScope(JSContext *cx, const ScopeIter &si, DebugScopeObject
|
|||
js_ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
missingScopesPostWriteBarrier(cx->runtime(), &scopes->missingScopes, si);
|
||||
|
||||
JS_ASSERT(!scopes->liveScopes.has(&debugScope.scope()));
|
||||
if (!scopes->liveScopes.put(&debugScope.scope(), si)) {
|
||||
|
|
|
@ -597,11 +597,22 @@ class ScopeIterKey
|
|||
StaticBlockObject *block() const { return block_; }
|
||||
ScopeIter::Type type() const { return type_; }
|
||||
bool hasScopeObject() const { return hasScopeObject_; }
|
||||
JSObject *enclosingScope() const { return cur_; }
|
||||
JSObject *&enclosingScope() { return cur_; }
|
||||
|
||||
/* For use as hash policy */
|
||||
typedef ScopeIterKey Lookup;
|
||||
static HashNumber hash(ScopeIterKey si);
|
||||
static bool match(ScopeIterKey si1, ScopeIterKey si2);
|
||||
bool operator!=(const ScopeIterKey &other) const {
|
||||
return frame_ != other.frame_ ||
|
||||
cur_ != other.cur_ ||
|
||||
block_ != other.block_ ||
|
||||
type_ != other.type_;
|
||||
}
|
||||
static void rekey(ScopeIterKey &k, const ScopeIterKey& newKey) {
|
||||
k = newKey;
|
||||
}
|
||||
};
|
||||
|
||||
class ScopeIterVal
|
||||
|
@ -613,7 +624,7 @@ class ScopeIterVal
|
|||
RelocatablePtr<StaticBlockObject> block_;
|
||||
ScopeIter::Type type_;
|
||||
bool hasScopeObject_;
|
||||
|
||||
|
||||
static void staticAsserts();
|
||||
|
||||
public:
|
||||
|
@ -704,6 +715,9 @@ class DebugScopes
|
|||
ScopeIterKey,
|
||||
RuntimeAllocPolicy> MissingScopeMap;
|
||||
MissingScopeMap missingScopes;
|
||||
class MissingScopesRef;
|
||||
static JS_ALWAYS_INLINE void missingScopesPostWriteBarrier(JSRuntime *rt, MissingScopeMap *map,
|
||||
const ScopeIterKey &key);
|
||||
|
||||
/*
|
||||
* The map from scope objects of live frames to the live frame. This map
|
||||
|
|
Загрузка…
Ссылка в новой задаче