From e93128c9fcef0d78f1bd34383430bec42a9058e8 Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Wed, 6 Nov 2013 10:45:59 +0000 Subject: [PATCH] Bug 935022 - Fix the interaction between generational GC zeal mode and disabling generational collection r=terrence --- js/src/gc/Nursery.cpp | 5 +++++ js/src/gc/Nursery.h | 5 ++++- js/src/jit-test/tests/gc/bug-935022.js | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 js/src/jit-test/tests/gc/bug-935022.js diff --git a/js/src/gc/Nursery.cpp b/js/src/gc/Nursery.cpp index 89905262de4..cd2f2679df8 100644 --- a/js/src/gc/Nursery.cpp +++ b/js/src/gc/Nursery.cpp @@ -80,6 +80,10 @@ js::Nursery::enable() JS_ASSERT_IF(runtime()->gcZeal_ != ZealGenerationalGCValue, position_ == start()); numActiveChunks_ = 1; setCurrentChunk(0); +#ifdef JS_GC_ZEAL + if (runtime()->gcZeal_ == ZealGenerationalGCValue) + enterZealMode(); +#endif } void @@ -95,6 +99,7 @@ js::Nursery::disable() void * js::Nursery::allocate(size_t size) { + JS_ASSERT(isEnabled()); JS_ASSERT(!runtime()->isHeapBusy()); /* Ensure there's enough space to replace the contents with a RelocationOverlay. */ diff --git a/js/src/gc/Nursery.h b/js/src/gc/Nursery.h index d782691d592..68ec04bf269 100644 --- a/js/src/gc/Nursery.h +++ b/js/src/gc/Nursery.h @@ -117,7 +117,10 @@ class Nursery static const uint8_t FreshNursery = 0x2a; static const uint8_t SweptNursery = 0x2b; static const uint8_t AllocatedThing = 0x2c; - void enterZealMode() { numActiveChunks_ = NumNurseryChunks; } + void enterZealMode() { + if (isEnabled()) + numActiveChunks_ = NumNurseryChunks; + } #endif private: diff --git a/js/src/jit-test/tests/gc/bug-935022.js b/js/src/jit-test/tests/gc/bug-935022.js new file mode 100644 index 00000000000..b4a5eb0fe61 --- /dev/null +++ b/js/src/jit-test/tests/gc/bug-935022.js @@ -0,0 +1,4 @@ +function callback(obj) {} +setObjectMetadataCallback(callback); +gczeal(7); +var statusitems = [];