зеркало из https://github.com/mozilla/gecko-dev.git
Bug 868302 - Enable rooting LIFO assertions in DEBUG, r=terrence
This commit is contained in:
Родитель
6355b58d83
Коммит
12acfa2b71
|
@ -535,7 +535,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
|
|||
#ifdef JS_THREADSAFE
|
||||
MOZ_ASSERT(js::IsInRequest(cxArg));
|
||||
#endif
|
||||
#if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
|
||||
#ifdef JSGC_TRACK_EXACT_ROOTS
|
||||
js::ContextFriendFields *cx = js::ContextFriendFields::get(cxArg);
|
||||
commonInit(cx->thingGCRooters);
|
||||
#endif
|
||||
|
@ -543,7 +543,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
|
|||
|
||||
void init(js::PerThreadDataFriendFields *pt) {
|
||||
MOZ_ASSERT(pt);
|
||||
#if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
|
||||
#ifdef JSGC_TRACK_EXACT_ROOTS
|
||||
commonInit(pt->thingGCRooters);
|
||||
#endif
|
||||
}
|
||||
|
@ -598,13 +598,13 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
|
|||
}
|
||||
|
||||
~Rooted() {
|
||||
#if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
|
||||
#ifdef JSGC_TRACK_EXACT_ROOTS
|
||||
JS_ASSERT(*stack == reinterpret_cast<Rooted<void*>*>(this));
|
||||
*stack = prev;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
|
||||
#ifdef JSGC_TRACK_EXACT_ROOTS
|
||||
Rooted<T> *previous() { return prev; }
|
||||
#endif
|
||||
|
||||
|
@ -640,7 +640,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
|
|||
|
||||
private:
|
||||
void commonInit(Rooted<void*> **thingGCRooters) {
|
||||
#if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
|
||||
#ifdef JSGC_TRACK_EXACT_ROOTS
|
||||
js::ThingRootKind kind = js::GCMethods<T>::kind();
|
||||
this->stack = &thingGCRooters[kind];
|
||||
this->prev = *stack;
|
||||
|
@ -650,11 +650,11 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
|
|||
#endif
|
||||
}
|
||||
|
||||
#if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
|
||||
#ifdef JSGC_TRACK_EXACT_ROOTS
|
||||
Rooted<void*> **stack, *prev;
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
|
||||
#ifdef JSGC_ROOT_ANALYSIS
|
||||
/* Has the rooting analysis ever scanned this Rooted's stack location? */
|
||||
friend void JS::CheckStackRoots(JSContext*);
|
||||
bool scanned;
|
||||
|
|
|
@ -1203,7 +1203,7 @@ JSContext::JSContext(JSRuntime *rt)
|
|||
JS_ASSERT(static_cast<ContextFriendFields*>(this) ==
|
||||
ContextFriendFields::get(this));
|
||||
|
||||
#if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
|
||||
#ifdef JSGC_TRACK_EXACT_ROOTS
|
||||
PodArrayZero(thingGCRooters);
|
||||
#endif
|
||||
#if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
#include "jsprototypes.h"
|
||||
#include "jstypes.h"
|
||||
|
||||
#if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING) || defined(DEBUG)
|
||||
# define JSGC_TRACK_EXACT_ROOTS
|
||||
#endif
|
||||
|
||||
namespace JS {
|
||||
|
||||
/*
|
||||
|
@ -296,7 +300,7 @@ struct ContextFriendFields
|
|||
return reinterpret_cast<ContextFriendFields *>(cx);
|
||||
}
|
||||
|
||||
#if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
|
||||
#ifdef JSGC_TRACK_EXACT_ROOTS
|
||||
/*
|
||||
* Stack allocated GC roots for stack GC heap pointers, which may be
|
||||
* overwritten if moved during a GC.
|
||||
|
@ -344,7 +348,7 @@ struct PerThreadDataFriendFields
|
|||
|
||||
PerThreadDataFriendFields();
|
||||
|
||||
#if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
|
||||
#ifdef JSGC_TRACK_EXACT_ROOTS
|
||||
/*
|
||||
* Stack allocated GC roots for stack GC heap pointers, which may be
|
||||
* overwritten if moved during a GC.
|
||||
|
|
Загрузка…
Ссылка в новой задаче