Bug 1414168 - Avoid padding near the beginning of arena_run_t. r=njn

This makes the run header larger than necessary, which happens to make
the current arena_bin_run_calc_size pick 8KiB runs for size class 96
when MOZ_DIAGNOSTIC_ASSERT_ENABLED is set. This change makes it pick
4KiB runs, making MOZ_DIAGNOSTIC_ASSERT_ENABLED builds use the same set
of run sizes as non-MOZ_DIAGNOSTIC_ASSERT_ENABLED builds.

--HG--
extra : rebase_source : fd7ef2d58ec601186647799e9dcf8146e723241c
This commit is contained in:
Mike Hommey 2017-11-08 09:56:08 +09:00
Родитель 87faa92489
Коммит f3daece337
1 изменённых файлов: 14 добавлений и 0 удалений

Просмотреть файл

@ -839,6 +839,18 @@ struct arena_run_t
#if defined(MOZ_DIAGNOSTIC_ASSERT_ENABLED)
uint32_t magic;
#define ARENA_RUN_MAGIC 0x384adf93
// On 64-bit platforms, having the arena_bin_t pointer following
// the magic field means there's padding between both fields, making
// the run header larger than necessary.
// But when MOZ_DIAGNOSTIC_ASSERT_ENABLED is not set, starting the
// header with this field followed by the arena_bin_t pointer yields
// the same padding. We do want the magic field to appear first, so
// depending whether MOZ_DIAGNOSTIC_ASSERT_ENABLED is set or not, we
// move some field to avoid padding.
// Number of free regions in run.
unsigned nfree;
#endif
// Bin this run is associated with.
@ -847,8 +859,10 @@ struct arena_run_t
// Index of first element that might have a free region.
unsigned regs_minelm;
#if !defined(MOZ_DIAGNOSTIC_ASSERT_ENABLED)
// Number of free regions in run.
unsigned nfree;
#endif
// Bitmask of in-use regions (0: in use, 1: free).
unsigned regs_mask[1]; // Dynamically sized.