Bug 903519 - Allocate strings in the nursery, r=flagflip
☠☠ backed out by 65e92478e09d ☠ ☠
authorSteve Fink <sfink@mozilla.com>
Fri, 28 Jul 2017 16:46:43 -0700
changeset 450652 3f72f8747e2938a5b0e6632818e85d79e5f670a2
parent 450651 bb2cc298a15583b524102372d42f722aae5d505a
child 450653 7119bb67da6f65d56be8d0dae6c1da2d7a1cdbda
push id8531
push userryanvm@gmail.com
push dateFri, 12 Jan 2018 16:47:01 +0000
treeherdermozilla-beta@0bc627ade5a0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflagflip
bugs903519
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 903519 - Allocate strings in the nursery, r=flagflip
js/src/gc/Nursery.cpp
js/src/vm/String-inl.h
--- a/js/src/gc/Nursery.cpp
+++ b/js/src/gc/Nursery.cpp
@@ -117,28 +117,28 @@ js::Nursery::Nursery(JSRuntime* rt)
   , currentStringEnd_(0)
   , currentChunk_(0)
   , maxChunkCount_(0)
   , chunkCountLimit_(0)
   , timeInChunkAlloc_(0)
   , previousPromotionRate_(0)
   , profileThreshold_(0)
   , enableProfiling_(false)
-  , canAllocateStrings_(false)
+  , canAllocateStrings_(true)
   , reportTenurings_(0)
   , minorGCTriggerReason_(JS::gcreason::NO_REASON)
   , minorGcCount_(0)
   , freeMallocedBuffersTask(nullptr)
 #ifdef JS_GC_ZEAL
   , lastCanary_(nullptr)
 #endif
 {
-    const char* env = getenv("MOZ_ENABLE_NURSERY_STRINGS");
+    const char* env = getenv("MOZ_DISABLE_NURSERY_STRINGS");
     if (env && *env)
-        canAllocateStrings_ = true;
+        canAllocateStrings_ = false;
 }
 
 bool
 js::Nursery::init(uint32_t maxNurseryBytes, AutoLockGCBgAlloc& lock)
 {
     if (!mallocedBuffers.init())
         return false;
 
--- a/js/src/vm/String-inl.h
+++ b/js/src/vm/String-inl.h
@@ -117,17 +117,17 @@ template <js::AllowGC allowGC>
 MOZ_ALWAYS_INLINE JSRope*
 JSRope::new_(JSContext* cx,
              typename js::MaybeRooted<JSString*, allowGC>::HandleType left,
              typename js::MaybeRooted<JSString*, allowGC>::HandleType right,
              size_t length)
 {
     if (!validateLength(cx, length))
         return nullptr;
-    JSRope* str = js::Allocate<JSRope, allowGC>(cx, js::gc::TenuredHeap);
+    JSRope* str = js::Allocate<JSRope, allowGC>(cx, js::gc::DefaultHeap);
     if (!str)
         return nullptr;
     str->init(cx, left, right, length);
     return str;
 }
 
 MOZ_ALWAYS_INLINE void
 JSDependentString::init(JSContext* cx, JSLinearString* base, size_t start,
@@ -177,25 +177,25 @@ JSDependentString::new_(JSContext* cx, J
         return baseArg->hasLatin1Chars()
                ? js::NewInlineString<JS::Latin1Char>(cx, base, start, length)
                : js::NewInlineString<char16_t>(cx, base, start, length);
     }
 
     if (baseArg->isExternal() && !baseArg->ensureFlat(cx))
         return nullptr;
 
-    JSDependentString* str = js::Allocate<JSDependentString, js::NoGC>(cx, js::gc::TenuredHeap);
+    JSDependentString* str = js::Allocate<JSDependentString, js::NoGC>(cx, js::gc::DefaultHeap);
     if (str) {
         str->init(cx, baseArg, start, length);
         return str;
     }
 
     js::RootedLinearString base(cx, baseArg);
 
-    str = js::Allocate<JSDependentString>(cx, js::gc::TenuredHeap);
+    str = js::Allocate<JSDependentString>(cx, js::gc::DefaultHeap);
     if (!str)
         return nullptr;
     str->init(cx, base, start, length);
     return str;
 }
 
 MOZ_ALWAYS_INLINE void
 JSFlatString::init(const char16_t* chars, size_t length)
@@ -221,17 +221,17 @@ JSFlatString::new_(JSContext* cx, const 
 
     if (!validateLength(cx, length))
         return nullptr;
 
     JSFlatString* str;
     if (cx->compartment()->isAtomsCompartment())
         str = js::Allocate<js::NormalAtom, allowGC>(cx);
     else
-        str = js::Allocate<JSFlatString, allowGC>(cx, js::gc::TenuredHeap);
+        str = js::Allocate<JSFlatString, allowGC>(cx, js::gc::DefaultHeap);
     if (!str)
         return nullptr;
 
     if (!str->isTenured()) {
         // The chars pointer is only considered to be handed over to this
         // function on a successful return. If the following registration
         // fails, the string is partially initialized and must be made valid,
         // or its finalizer may attempt to free uninitialized memory.
@@ -265,27 +265,27 @@ JSFlatString::toPropertyName(JSContext* 
 
 template <js::AllowGC allowGC>
 MOZ_ALWAYS_INLINE JSThinInlineString*
 JSThinInlineString::new_(JSContext* cx)
 {
     if (cx->compartment()->isAtomsCompartment())
         return (JSThinInlineString*)(js::Allocate<js::NormalAtom, allowGC>(cx));
 
-    return js::Allocate<JSThinInlineString, allowGC>(cx, js::gc::TenuredHeap);
+    return js::Allocate<JSThinInlineString, allowGC>(cx, js::gc::DefaultHeap);
 }
 
 template <js::AllowGC allowGC>
 MOZ_ALWAYS_INLINE JSFatInlineString*
 JSFatInlineString::new_(JSContext* cx)
 {
     if (cx->compartment()->isAtomsCompartment())
         return (JSFatInlineString*)(js::Allocate<js::FatInlineAtom, allowGC>(cx));
 
-    return js::Allocate<JSFatInlineString, allowGC>(cx, js::gc::TenuredHeap);
+    return js::Allocate<JSFatInlineString, allowGC>(cx, js::gc::DefaultHeap);
 }
 
 template<>
 MOZ_ALWAYS_INLINE JS::Latin1Char*
 JSThinInlineString::init<JS::Latin1Char>(size_t length)
 {
     MOZ_ASSERT(lengthFits<JS::Latin1Char>(length));
     d.u1.length = length;