Bug 1517461: Use background allocation kind when tenuring typed arrays allocated from JIT code. r=jonco
authorAndré Bargull <andre.bargull@gmail.com>
Thu, 03 Jan 2019 04:59:58 -0800
changeset 452717 b1c3821412f8f212fda67ffc7121d82d6a5d2fd4
parent 452716 0153780b0a346f828b2f235f63bf796490594493
child 452718 5d07c4ae4354b01f9f1b9d2846cd30a96a9e3c7c
push id110958
push usercbrindusan@mozilla.com
push dateMon, 07 Jan 2019 17:39:37 +0000
treeherdermozilla-inbound@b1c3821412f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1517461
milestone66.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 1517461: Use background allocation kind when tenuring typed arrays allocated from JIT code. r=jonco
js/src/vm/JSObject.cpp
--- a/js/src/vm/JSObject.cpp
+++ b/js/src/vm/JSObject.cpp
@@ -3969,22 +3969,24 @@ js::gc::AllocKind JSObject::allocKindFor
     return as<JSFunction>().getAllocKind();
   }
 
   /*
    * Typed arrays in the nursery may have a lazily allocated buffer, make
    * sure there is room for the array's fixed data when moving the array.
    */
   if (is<TypedArrayObject>() && !as<TypedArrayObject>().hasBuffer()) {
-    size_t nbytes = as<TypedArrayObject>().byteLength();
+    gc::AllocKind allocKind;
     if (as<TypedArrayObject>().hasInlineElements()) {
-      return GetBackgroundAllocKind(
-          TypedArrayObject::AllocKindForLazyBuffer(nbytes));
+      size_t nbytes = as<TypedArrayObject>().byteLength();
+      allocKind = TypedArrayObject::AllocKindForLazyBuffer(nbytes);
+    } else {
+      allocKind = GetGCObjectKind(getClass());
     }
-    return GetGCObjectKind(getClass());
+    return GetBackgroundAllocKind(allocKind);
   }
 
   // Proxies that are CrossCompartmentWrappers may be nursery allocated.
   if (IsProxy(this)) {
     return as<ProxyObject>().allocKindForTenure();
   }
 
   // Inlined typed objects are followed by their data, so make sure we copy