зеркало из https://github.com/mozilla/gecko-dev.git
Bug 941804 - Reduce chunk size to 256K for B2G r=terrence
This commit is contained in:
Родитель
51552373b1
Коммит
1a8a0cee9f
|
@ -68,3 +68,5 @@ MOZ_BUNDLED_FONTS=1
|
|||
|
||||
# Enable exact rooting on b2g.
|
||||
JSGC_USE_EXACT_ROOTING=1
|
||||
|
||||
JS_GC_SMALL_CHUNK_SIZE=1
|
||||
|
|
14
configure.in
14
configure.in
|
@ -7229,6 +7229,17 @@ if test -n "$JSGC_GENERATIONAL"; then
|
|||
AC_DEFINE(JSGC_GENERATIONAL)
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Use a smaller chunk size for GC chunks
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_BOOL(small-chunk-size,
|
||||
[ --enable-small-chunk-size Allocate memory for JS GC things in smaller chunks],
|
||||
JS_GC_SMALL_CHUNK_SIZE=1,
|
||||
JS_GC_SMALL_CHUNK_SIZE= )
|
||||
if test -n "$JS_GC_SMALL_CHUNK_SIZE"; then
|
||||
AC_DEFINE(JS_GC_SMALL_CHUNK_SIZE)
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl Zealous JavaScript GC
|
||||
dnl ========================================================
|
||||
|
@ -9252,6 +9263,9 @@ fi
|
|||
if test -z "$JSGC_GENERATIONAL" ; then
|
||||
ac_configure_args="$ac_configure_args --disable-gcgenerational"
|
||||
fi
|
||||
if test -n "$JS_GC_SMALL_CHUNK_SIZE" ; then
|
||||
ac_configure_args="$ac_configure_args --enable-small-chunk-size"
|
||||
fi
|
||||
if test -z "$MOZ_NATIVE_NSPR"; then
|
||||
ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
|
||||
ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
|
||||
|
|
|
@ -32,7 +32,11 @@ const size_t ArenaShift = 12;
|
|||
const size_t ArenaSize = size_t(1) << ArenaShift;
|
||||
const size_t ArenaMask = ArenaSize - 1;
|
||||
|
||||
#ifdef JS_GC_SMALL_CHUNK_SIZE
|
||||
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;
|
||||
|
||||
|
@ -41,8 +45,13 @@ 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_SMALL_CHUNK_SIZE
|
||||
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);
|
||||
|
||||
|
|
|
@ -3214,6 +3214,19 @@ if test -n "$JSGC_USE_EXACT_ROOTING"; then
|
|||
AC_DEFINE(JSGC_USE_EXACT_ROOTING)
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Use a smaller chunk size for GC chunks
|
||||
dnl ========================================================
|
||||
dnl Use large (1MB) chunks by default. For B2G this option is used to give
|
||||
dnl smaller (currently 256K) chunks.
|
||||
MOZ_ARG_ENABLE_BOOL(small-chunk-size,
|
||||
[ --enable-small-chunk-size Allocate memory for JS GC things in smaller chunks],
|
||||
JS_GC_SMALL_CHUNK_SIZE=1,
|
||||
JS_GC_SMALL_CHUNK_SIZE= )
|
||||
if test -n "$JS_GC_SMALL_CHUNK_SIZE"; then
|
||||
AC_DEFINE(JS_GC_SMALL_CHUNK_SIZE)
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Use GC tracing
|
||||
dnl ========================================================
|
||||
|
|
|
@ -707,7 +707,12 @@ 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_SMALL_CHUNK_SIZE
|
||||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче