Bug 1005836 - Avoid slop NodePool::Block allocations. r=mccr8.

--HG--
extra : rebase_source : 2297b22e7a5d6679d8b25679d338f001c7427b60
This commit is contained in:
Nicholas Nethercote 2014-05-13 20:42:27 -07:00
Родитель 19853ae90f
Коммит cbc884ac7a
1 изменённых файлов: 10 добавлений и 1 удалений

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

@ -613,7 +613,9 @@ public:
class NodePool
{
private:
enum { BlockSize = 8 * 1024 }; // could be int template parameter
// The -2 allows us to use |BlockSize + 1| for |mEntries|, and fit |mNext|,
// all without causing slop.
enum { BlockSize = 8 * 1024 - 2 };
struct Block
{
@ -623,6 +625,13 @@ private:
Block()
{
NS_NOTREACHED("should never be called");
// Ensure Block is the right size (see the comment on BlockSize above).
static_assert(
sizeof(Block) == 163824 || // 32-bit; equals 39.997 pages
sizeof(Block) == 262120, // 64-bit; equals 63.994 pages
"ill-sized NodePool::Block"
);
}
~Block()
{