Bug 884562 - Allow root analysis to be enabled when using generational GC; r=sfink DONTBUILD

--HG--
extra : rebase_source : 6438eec44aa7de79bf78c8f84fb4b971e1e83296
This commit is contained in:
Terrence Cole 2013-06-19 09:20:46 -07:00
parent 18d8acd4f5
commit 74452ff20c

View File

@ -36,6 +36,19 @@ js::Nursery::init()
fallbackBitmap.clear(false);
void *heap = MapAlignedPages(NurserySize, Alignment);
#ifdef JSGC_ROOT_ANALYSIS
// Our poison pointers are not guaranteed to be invalid on 64-bit
// architectures, and often are valid. We can't just reserve the full
// poison range, because it might already have been taken up by something
// else (shared library, previous allocation). So we'll just loop and
// discard poison pointers until we get something valid.
//
// This leaks all of these poisoned pointers. It would be better if they
// were marked as uncommitted, but it's a little complicated to avoid
// clobbering pre-existing unrelated mappings.
while (IsPoisonedPtr(heap) || IsPoisonedPtr((void*)(uintptr_t(heap) + NurserySize)))
heap = MapAlignedPages(NurserySize, Alignment);
#endif
if (!heap)
return false;