Backed out changeset 0064d8949f0c (bug 1102541) for build bustage on a CLOSED TREE

This commit is contained in:
Wes Kocher 2014-12-12 12:39:07 -08:00
Родитель 68f5a701c7
Коммит fb2134a71e
4 изменённых файлов: 26 добавлений и 51 удалений

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

@ -472,7 +472,7 @@ typedef mozilla::Vector<SimpleEdge, 8, js::TempAllocPolicy> SimpleEdgeVector;
//
// RootList::init itself causes a minor collection, but once the list of roots
// has been created, GC must not occur, as the referent ubi::Nodes are not
// stable across GC. The init calls emplace on |noGC|'s AutoCheckCannotGC, whose
// stable across GC. The init calls emplace |gcp|'s AutoCheckCannotGC, whose
// lifetime must extend at least as long as the RootList itself.
//
// Example usage:
@ -480,7 +480,7 @@ typedef mozilla::Vector<SimpleEdge, 8, js::TempAllocPolicy> SimpleEdgeVector;
// {
// mozilla::Maybe<JS::AutoCheckCannotGC> maybeNoGC;
// JS::ubi::RootList rootList(cx, maybeNoGC);
// if (!rootList.init())
// if (!rootList.init(cx))
// return false;
//
// // The AutoCheckCannotGC is guaranteed to exist if init returned true.
@ -492,7 +492,6 @@ typedef mozilla::Vector<SimpleEdge, 8, js::TempAllocPolicy> SimpleEdgeVector;
// }
class MOZ_STACK_CLASS RootList {
Maybe<AutoCheckCannotGC> &noGC;
JSContext *cx;
public:
SimpleEdgeVector edges;
@ -501,16 +500,11 @@ class MOZ_STACK_CLASS RootList {
RootList(JSContext *cx, Maybe<AutoCheckCannotGC> &noGC, bool wantNames = false);
// Find all GC roots.
bool init();
bool init(JSContext *cx);
// Find only GC roots in the provided set of |Zone|s.
bool init(ZoneSet &debuggees);
bool init(JSContext *cx, ZoneSet &debuggees);
// Find only GC roots in the given Debugger object's set of debuggee zones.
bool init(HandleObject debuggees);
// Explicitly add the given Node as a root in this RootList. If wantNames is
// true, you must pass an edgeName. The RootList does not take ownership of
// edgeName.
bool addRoot(Node node, const char16_t *edgeName = nullptr);
bool init(JSContext *cx, HandleObject debuggees);
};

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

@ -3559,6 +3559,14 @@ class MOZ_STACK_CLASS Debugger::ObjectQuery
if (!prepareQuery())
return false;
// Ensure that all of our debuggee globals are rooted so that they are
// visible in the RootList.
JS::AutoObjectVector debuggees(cx);
for (GlobalObjectSet::Range r = dbg->allDebuggees(); !r.empty(); r.popFront()) {
if (!debuggees.append(r.front()))
return false;
}
{
/*
* We can't tolerate the GC moving things around while we're
@ -3567,7 +3575,7 @@ class MOZ_STACK_CLASS Debugger::ObjectQuery
Maybe<JS::AutoCheckCannotGC> maybeNoGC;
RootedObject dbgObj(cx, dbg->object);
JS::ubi::RootList rootList(cx, maybeNoGC);
if (!rootList.init(dbgObj))
if (!rootList.init(cx, dbgObj))
return false;
Traversal traversal(cx, *this, maybeNoGC.ref());

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

@ -757,18 +757,22 @@ DebuggerMemory::takeCensus(JSContext *cx, unsigned argc, Value *vp)
return false;
Debugger *dbg = memory->getDebugger();
RootedObject dbgObj(cx, dbg->object);
// Populate our target set of debuggee zones.
// Populate census.debuggeeZones and ensure that all of our debuggee globals
// are rooted so that they are visible in the RootList.
JS::AutoObjectVector debuggees(cx);
for (GlobalObjectSet::Range r = dbg->allDebuggees(); !r.empty(); r.popFront()) {
if (!census.debuggeeZones.put(r.front()->zone()))
if (!census.debuggeeZones.put(r.front()->zone()) ||
!debuggees.append(static_cast<JSObject *>(r.front())))
{
return false;
}
}
{
Maybe<JS::AutoCheckCannotGC> maybeNoGC;
JS::ubi::RootList rootList(cx, maybeNoGC);
if (!rootList.init(dbgObj))
if (!rootList.init(cx, census.debuggeeZones))
return false;
dbg::DefaultCensusTraversal traversal(cx, handler, maybeNoGC.ref());

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

@ -9,13 +9,11 @@
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/Scoped.h"
#include "mozilla/UniquePtr.h"
#include "jscntxt.h"
#include "jsinfer.h"
#include "jsobj.h"
#include "jsscript.h"
#include "jsstr.h"
#include "jit/IonCode.h"
#include "js/Debug.h"
@ -265,14 +263,13 @@ namespace ubi {
RootList::RootList(JSContext *cx, Maybe<AutoCheckCannotGC> &noGC, bool wantNames /* = false */)
: noGC(noGC),
cx(cx),
edges(cx),
wantNames(wantNames)
{ }
bool
RootList::init()
RootList::init(JSContext *cx)
{
SimpleEdgeVectorTracer tracer(cx, &edges, wantNames);
JS_TraceRuntime(&tracer);
@ -283,7 +280,7 @@ RootList::init()
}
bool
RootList::init(ZoneSet &debuggees)
RootList::init(JSContext *cx, ZoneSet &debuggees)
{
SimpleEdgeVector allRootEdges(cx);
SimpleEdgeVectorTracer tracer(cx, &allRootEdges, wantNames);
@ -309,7 +306,7 @@ RootList::init(ZoneSet &debuggees)
}
bool
RootList::init(HandleObject debuggees)
RootList::init(JSContext *cx, HandleObject debuggees)
{
MOZ_ASSERT(debuggees && JS::dbg::IsDebugger(ObjectValue(*debuggees)));
js::Debugger *dbg = js::Debugger::fromJSObject(debuggees);
@ -323,35 +320,7 @@ RootList::init(HandleObject debuggees)
return false;
}
if (!init(debuggeeZones))
return false;
// Ensure that each of our debuggee globals are in the root list.
for (GlobalObjectSet::Range r = dbg->allDebuggees(); !r.empty(); r.popFront()) {
if (!addRoot(JS::ubi::Node(static_cast<JSObject *>(r.front())),
MOZ_UTF16("debuggee global")))
{
return false;
}
}
return true;
}
bool
RootList::addRoot(Node node, const char16_t *edgeName)
{
MOZ_ASSERT(noGC.isSome());
MOZ_ASSERT_IF(wantNames, edgeName);
mozilla::UniquePtr<char16_t[], JS::FreePolicy> name;
if (edgeName) {
name = DuplicateString(cx, edgeName);
if (!name)
return false;
}
return edges.append(mozilla::Move(SimpleEdge(name.release(), node)));
return init(cx, debuggeeZones);
}
// An EdgeRange concrete class that holds a pre-existing vector of SimpleEdges.