Backout d92d88957742 (Bug 1200732) for bustage on a CLOSED TREE.

This commit is contained in:
Terrence Cole 2015-09-02 11:07:27 -07:00
parent af27c436af
commit d15cc51b3c
2 changed files with 18 additions and 16 deletions

View File

@ -60,7 +60,7 @@ using mozilla::UniquePtr;
bool
js::AutoCycleDetector::init()
{
AutoCycleDetector::Set& set = cx->cycleDetectorSet;
ObjectSet& set = cx->cycleDetectorSet;
hashsetAddPointer = set.lookupForAdd(obj);
if (!hashsetAddPointer) {
if (!set.add(hashsetAddPointer, obj))
@ -82,10 +82,14 @@ js::AutoCycleDetector::~AutoCycleDetector()
}
void
js::TraceCycleDetectionSet(JSTracer* trc, AutoCycleDetector::Set& set)
js::TraceCycleDetectionSet(JSTracer* trc, js::ObjectSet& set)
{
for (AutoCycleDetector::Set::Enum e(set); !e.empty(); e.popFront())
TraceRoot(trc, &e.mutableFront(), "cycle detector table entry");
for (js::ObjectSet::Enum e(set); !e.empty(); e.popFront()) {
JSObject* key = e.front();
TraceRoot(trc, &key, "cycle detector table entry");
if (key != e.front())
e.rekeyFront(key);
}
}
JSContext*

View File

@ -29,14 +29,20 @@ class JitContext;
class DebugModeOSRVolatileJitFrameIterator;
} // namespace jit
typedef HashSet<JSObject*> ObjectSet;
typedef HashSet<Shape*> ShapeSet;
/* Detects cycles when traversing an object graph. */
class AutoCycleDetector
{
public:
using Set = HashSet<JSObject*, MovableCellHasher<JSObject*>>;
JSContext* cx;
RootedObject obj;
bool cyclic;
uint32_t hashsetGenerationAtInit;
ObjectSet::AddPtr hashsetAddPointer;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
AutoCycleDetector(JSContext* cx, HandleObject objArg
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: cx(cx), obj(cx, objArg), cyclic(true)
@ -49,19 +55,11 @@ class AutoCycleDetector
bool init();
bool foundCycle() { return cyclic; }
private:
JSContext* cx;
RootedObject obj;
bool cyclic;
uint32_t hashsetGenerationAtInit;
Set::AddPtr hashsetAddPointer;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/* Updates references in the cycle detection set if the GC moves them. */
extern void
TraceCycleDetectionSet(JSTracer* trc, AutoCycleDetector::Set& set);
TraceCycleDetectionSet(JSTracer* trc, ObjectSet& set);
struct AutoResolving;
@ -348,7 +346,7 @@ struct JSContext : public js::ExclusiveContext,
public:
/* State for object and array toSource conversion. */
js::AutoCycleDetector::Set cycleDetectorSet;
js::ObjectSet cycleDetectorSet;
/* Client opaque pointers. */
void* data;