Bug 817812 - Fix --enable-root-analysis compile. r=terrence

The recent jsgc.cpp splitup removed some functions that my rooting analysis optimization depended on. This patch exposes a simplified IsAddressableGCThing overload and uses it.

--HG--
extra : rebase_source : a9295ec574824462d3b8c0c9f7bca3a4baec1300
This commit is contained in:
Steve Fink 2012-11-30 16:04:42 -08:00
parent a9b0c5da84
commit dcb8d01afc
3 changed files with 26 additions and 9 deletions

View File

@ -83,6 +83,11 @@ class IncrementalSafety
IncrementalSafety
IsIncrementalGCSafe(JSRuntime *rt);
#ifdef JSGC_ROOT_ANALYSIS
bool
IsAddressableGCThing(JSRuntime *rt, uintptr_t w);
#endif
#ifdef JS_GC_ZEAL
void
StartVerifyPreBarriers(JSRuntime *rt);

View File

@ -205,6 +205,19 @@ IsAddressableGCThing(JSRuntime *rt, uintptr_t w,
return CGCT_VALID;
}
#ifdef JSGC_ROOT_ANALYSIS
bool
js::gc::IsAddressableGCThing(JSRuntime *rt, uintptr_t w)
{
void *thing;
ArenaHeader *aheader;
AllocKind thingKind;
ConservativeGCTest status =
IsAddressableGCThing(rt, w, false, &thingKind, &aheader, &thing);
return status == CGCT_VALID;
}
#endif
/*
* Returns CGCT_VALID and mark it if the w can be a live GC thing and sets
* thingKind accordingly. Otherwise returns the reason for rejection.

View File

@ -11,6 +11,8 @@
#include "jsprf.h"
#include "jsutil.h"
#include "mozilla/Util.h"
#include "js/HashTable.h"
#include "gc/GCInternals.h"
@ -22,6 +24,7 @@
using namespace js;
using namespace js::gc;
using namespace mozilla;
#if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
@ -48,12 +51,7 @@ CheckStackRoot(JSRuntime *rt, uintptr_t *w, Rooter *begin, Rooter *end)
VALGRIND_MAKE_MEM_DEFINED(&w, sizeof(w));
#endif
void *thing;
ArenaHeader *aheader;
AllocKind thingKind;
ConservativeGCTest status =
IsAddressableGCThing(rt, *w, false, &thingKind, &aheader, &thing);
if (status != CGCT_VALID)
if (!IsAddressableGCThing(rt, *w))
return;
/*
* Note that |thing| may be in a free list (InFreeList(aheader, thing)),
@ -161,9 +159,9 @@ SuppressCheckRoots(Vector<Rooter, 0, SystemAllocPolicy> &rooters)
unsigned int pos;
// Compute the hash of the current stack
uint32_t hash = mozilla::HashGeneric(&pos);
uint32_t hash = HashGeneric(&pos);
for (unsigned int i = 0; i < Min(StackCheckDepth, rooters.length()); i++)
hash = mozilla::AddToHash(hash, rooters[rooters.length() - i - 1].rooter);
hash = AddToHash(hash, rooters[rooters.length() - i - 1].rooter);
// Scan through the remembered stacks to find the current stack
for (pos = 0; pos < numMemories; pos++) {
@ -291,7 +289,8 @@ JS::CheckStackRoots(JSContext *cx)
JS_ASSERT(stackMin <= stackEnd);
CheckStackRootsRangeAndSkipIon(rt, stackMin, stackEnd, firstToScan, rooters.end());
CheckStackRootsRange(rt, cgcd->registerSnapshot.words,
ArrayEnd(cgcd->registerSnapshot.words), firstToScan, rooters.end());
ArrayEnd(cgcd->registerSnapshot.words),
firstToScan, rooters.end());
// Mark all rooters as scanned
for (Rooter *p = rooters.begin(); p != rooters.end(); p++)