зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1136046 - Increase maximum capacity of js::HashMap and HashSet r=luke
This commit is contained in:
Родитель
4cee6e7d5f
Коммит
8db99543e5
|
@ -1013,14 +1013,14 @@ class HashTable : private AllocPolicy
|
|||
void operator=(const HashTable &) = delete;
|
||||
|
||||
private:
|
||||
static const size_t CAP_BITS = 24;
|
||||
static const size_t CAP_BITS = 30;
|
||||
|
||||
public:
|
||||
Entry *table; // entry storage
|
||||
uint32_t gen; // entry storage generation number
|
||||
uint32_t entryCount; // number of entries in table
|
||||
uint32_t removedCount:CAP_BITS; // removed entry sentinels in table
|
||||
uint32_t gen:24; // entry storage generation number
|
||||
uint32_t hashShift:8; // multiplicative hash shift
|
||||
uint32_t entryCount; // number of entries in table
|
||||
uint32_t removedCount; // removed entry sentinels in table
|
||||
|
||||
#ifdef JS_DEBUG
|
||||
uint64_t mutationCount;
|
||||
|
@ -1088,8 +1088,6 @@ class HashTable : private AllocPolicy
|
|||
{
|
||||
static_assert(sFreeKey == 0,
|
||||
"newly-calloc'd tables have to be considered empty");
|
||||
static_assert(sMaxCapacity <= SIZE_MAX / sizeof(Entry),
|
||||
"would overflow allocating max number of entries");
|
||||
return alloc.template pod_calloc<Entry>(capacity);
|
||||
}
|
||||
|
||||
|
@ -1105,9 +1103,9 @@ class HashTable : private AllocPolicy
|
|||
: AllocPolicy(ap)
|
||||
, table(nullptr)
|
||||
, gen(0)
|
||||
, hashShift(sHashBits)
|
||||
, entryCount(0)
|
||||
, removedCount(0)
|
||||
, hashShift(sHashBits)
|
||||
#ifdef JS_DEBUG
|
||||
, mutationCount(0)
|
||||
, mEntered(false)
|
||||
|
|
|
@ -45,7 +45,6 @@ UNIFIED_SOURCES += [
|
|||
'testGCStoreBufferRemoval.cpp',
|
||||
'testGetPropertyDescriptor.cpp',
|
||||
'testHashTable.cpp',
|
||||
'testHashTableInit.cpp',
|
||||
'testIndexToString.cpp',
|
||||
'testIntern.cpp',
|
||||
'testIntString.cpp',
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "js/HashTable.h"
|
||||
#include "jsapi-tests/tests.h"
|
||||
|
||||
typedef js::HashSet<uint32_t, js::DefaultHasher<uint32_t>, js::SystemAllocPolicy> IntSet;
|
||||
|
||||
static const uint32_t MaxAllowedHashInit = 1 << 23;
|
||||
|
||||
BEGIN_TEST(testHashInitAlmostTooHuge)
|
||||
{
|
||||
IntSet smallEnough;
|
||||
CHECK(smallEnough.init(MaxAllowedHashInit));
|
||||
return true;
|
||||
}
|
||||
END_TEST(testHashInitAlmostTooHuge)
|
||||
|
||||
BEGIN_TEST(testHashInitTooHuge)
|
||||
{
|
||||
IntSet tooBig;
|
||||
CHECK(!tooBig.init(MaxAllowedHashInit + 1));
|
||||
return true;
|
||||
}
|
||||
END_TEST(testHashInitTooHuge)
|
Загрузка…
Ссылка в новой задаче