Bug 941804 - Reduce chunk size to 256K for B2G r=terrence
☠☠ backed out by 8059cfb48c1f ☠ ☠
authorJon Coppeard <jcoppeard@mozilla.com>
Mon, 14 Jul 2014 10:05:17 +0100
changeset 215721 a1feed3cd3031c9b32dd621461fec053b32867bd
parent 215720 423abac3c7f55da58fd2567c699041e893e16814
child 215722 62725e1af7fc564db6efbc52641aae53a116a79e
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs941804
milestone33.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 941804 - Reduce chunk size to 256K for B2G r=terrence
js/public/HeapAPI.h
js/src/gc/Heap.h
--- a/js/public/HeapAPI.h
+++ b/js/public/HeapAPI.h
@@ -8,16 +8,20 @@
 #define js_HeapAPI_h
 
 #include <limits.h>
 
 #include "jspubtd.h"
 
 #include "js/Utility.h"
 
+#ifdef MOZ_B2G
+#define JS_GC_CHUNK_SIZE_SMALL
+#endif
+
 /* These values are private to the JS engine. */
 namespace js {
 
 // Whether the current thread is permitted access to any part of the specified
 // runtime or zone.
 JS_FRIEND_API(bool)
 CurrentThreadCanAccessRuntime(JSRuntime *rt);
 
@@ -27,27 +31,36 @@ CurrentThreadCanAccessZone(JS::Zone *zon
 namespace gc {
 
 struct Cell;
 
 const size_t ArenaShift = 12;
 const size_t ArenaSize = size_t(1) << ArenaShift;
 const size_t ArenaMask = ArenaSize - 1;
 
+#ifdef JS_GC_CHUNK_SIZE_SMALL
+const size_t ChunkShift = 18;
+#else
 const size_t ChunkShift = 20;
+#endif
 const size_t ChunkSize = size_t(1) << ChunkShift;
 const size_t ChunkMask = ChunkSize - 1;
 
 const size_t CellShift = 3;
 const size_t CellSize = size_t(1) << CellShift;
 const size_t CellMask = CellSize - 1;
 
 /* These are magic constants derived from actual offsets in gc/Heap.h. */
+#ifdef JS_GC_CHUNK_SIZE_SMALL
+const size_t ChunkMarkBitmapOffset = 258104;
+const size_t ChunkMarkBitmapBits = 31744;
+#else
 const size_t ChunkMarkBitmapOffset = 1032352;
 const size_t ChunkMarkBitmapBits = 129024;
+#endif
 const size_t ChunkRuntimeOffset = ChunkSize - sizeof(void*);
 const size_t ChunkLocationOffset = ChunkSize - 2 * sizeof(void*) - sizeof(uint64_t);
 
 /*
  * Live objects are marked black. How many other additional colors are available
  * depends on the size of the GCThing. Objects marked gray are eligible for
  * cycle collection.
  */
--- a/js/src/gc/Heap.h
+++ b/js/src/gc/Heap.h
@@ -695,17 +695,22 @@ struct ChunkInfo
  * divide the amount of available space less the header info (not including
  * the mark bitmap which is distributed into the arena size) by the size of
  * the arena (with the mark bitmap bytes it uses).
  */
 const size_t BytesPerArenaWithHeader = ArenaSize + ArenaBitmapBytes;
 const size_t ChunkDecommitBitmapBytes = ChunkSize / ArenaSize / JS_BITS_PER_BYTE;
 const size_t ChunkBytesAvailable = ChunkSize - sizeof(ChunkInfo) - ChunkDecommitBitmapBytes;
 const size_t ArenasPerChunk = ChunkBytesAvailable / BytesPerArenaWithHeader;
+
+#ifdef JS_GC_CHUNK_SIZE_SMALL
+static_assert(ArenasPerChunk == 62, "Do not accidentally change our heap's density.");
+#else
 static_assert(ArenasPerChunk == 252, "Do not accidentally change our heap's density.");
+#endif
 
 /* A chunk bitmap contains enough mark bits for all the cells in a chunk. */
 struct ChunkBitmap
 {
     volatile uintptr_t bitmap[ArenaBitmapWords * ArenasPerChunk];
 
   public:
     ChunkBitmap() { }