Bug 848592 - Fix some dynamic rooting analysis failures; r=sfink

This commit is contained in:
Terrence Cole 2013-06-14 13:48:39 -07:00
parent 89cd9674cd
commit 6e68d997b8
6 changed files with 29 additions and 4 deletions

View File

@ -628,6 +628,9 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
private:
void commonInit(Rooted<void*> **thingGCRooters) {
#if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
scanned = false;
#endif
#if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
js::ThingRootKind kind = js::GCMethods<T>::kind();
this->stack = &thingGCRooters[kind];

View File

@ -36,7 +36,6 @@ typedef HashSet<JSAtom *> FuncStmtSet;
class SharedContext;
typedef Vector<Definition *, 16> DeclVector;
typedef Vector<JSFunction *, 4> FunctionVector;
struct GenericParseContext
{
@ -201,7 +200,7 @@ struct ParseContext : public GenericParseContext
the same name. */
// All inner functions in this context. Only filled in when parsing syntax.
FunctionVector innerFunctions;
AutoFunctionVector innerFunctions;
// Set when parsing a declaration-like destructuring pattern. This flag
// causes PrimaryExpr to create PN_NAME parse nodes for variable references

View File

@ -449,6 +449,12 @@ AutoGCRooter::trace(JSTracer *trc)
return;
}
case FUNVECTOR: {
AutoFunctionVector::VectorImpl &vector = static_cast<AutoFunctionVector *>(this)->vector;
MarkObjectRootRange(trc, vector.length(), vector.begin(), "js::AutoFunctionVector.vector");
return;
}
case STRINGVECTOR: {
AutoStringVector::VectorImpl &vector = static_cast<AutoStringVector *>(this)->vector;
MarkStringRootRange(trc, vector.length(), vector.begin(), "js::AutoStringVector.vector");

View File

@ -130,7 +130,8 @@ class JS_PUBLIC_API(AutoGCRooter) {
OBJU32HASHMAP=-24, /* js::AutoObjectUnsigned32HashMap */
OBJHASHSET = -25, /* js::AutoObjectHashSet */
JSONPARSER = -26, /* js::JSONParser */
CUSTOM = -27 /* js::CustomAutoRooter */
CUSTOM = -27, /* js::CustomAutoRooter */
FUNVECTOR = -28 /* js::AutoFunctionVector */
};
private:
@ -572,6 +573,19 @@ class AutoObjectVector : public AutoVectorRooter<JSObject *>
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class AutoFunctionVector : public AutoVectorRooter<JSFunction *>
{
public:
explicit AutoFunctionVector(JSContext *cx
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: AutoVectorRooter<JSFunction *>(cx, FUNVECTOR)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class AutoScriptVector : public AutoVectorRooter<JSScript *>
{
public:
@ -5077,6 +5091,7 @@ using JS::Latin1CharsZ;
using JS::AutoIdVector;
using JS::AutoValueVector;
using JS::AutoObjectVector;
using JS::AutoFunctionVector;
using JS::AutoScriptVector;
using JS::AutoIdArray;

View File

@ -1336,6 +1336,8 @@ JSAbstractFramePtr::evaluateUCInStackFrame(JSContext *cx,
const char *filename, unsigned lineno,
MutableHandleValue rval)
{
SkipRoot skipChars(cx, &chars);
if (!CheckDebugMode(cx))
return false;

View File

@ -1519,7 +1519,7 @@ static JSTrapStatus
TrapHandler(JSContext *cx, JSScript *, jsbytecode *pc, jsval *rvalArg,
jsval closure)
{
JSString *str = JSVAL_TO_STRING(closure);
RootedString str(cx, JSVAL_TO_STRING(closure));
RootedValue rval(cx, *rvalArg);
ScriptFrameIter iter(cx);