Remove serializer-specific hash table size heuristic.
The heuristic can cause weird behavior when bootstrapping. The memory savings is not worth this hassle. Review URL: https://codereview.chromium.org/1265983006 Cr-Commit-Position: refs/heads/master@{#29992}
This commit is contained in:
parent
8548ea5d1a
commit
a246e296c6
@ -367,14 +367,12 @@ StartupData V8::CreateSnapshotDataBlob(const char* custom_source) {
|
|||||||
base::ElapsedTimer timer;
|
base::ElapsedTimer timer;
|
||||||
timer.Start();
|
timer.Start();
|
||||||
Isolate::Scope isolate_scope(isolate);
|
Isolate::Scope isolate_scope(isolate);
|
||||||
internal_isolate->set_creating_default_snapshot(true);
|
|
||||||
internal_isolate->Init(NULL);
|
internal_isolate->Init(NULL);
|
||||||
Persistent<Context> context;
|
Persistent<Context> context;
|
||||||
i::Snapshot::Metadata metadata;
|
i::Snapshot::Metadata metadata;
|
||||||
{
|
{
|
||||||
HandleScope handle_scope(isolate);
|
HandleScope handle_scope(isolate);
|
||||||
Local<Context> new_context = Context::New(isolate);
|
Local<Context> new_context = Context::New(isolate);
|
||||||
internal_isolate->set_creating_default_snapshot(false);
|
|
||||||
context.Reset(isolate, new_context);
|
context.Reset(isolate, new_context);
|
||||||
if (custom_source != NULL) {
|
if (custom_source != NULL) {
|
||||||
metadata.set_embeds_script(true);
|
metadata.set_embeds_script(true);
|
||||||
|
@ -2413,7 +2413,8 @@ bool Genesis::InstallNatives(ContextType context_type) {
|
|||||||
InstallNativeFunctions();
|
InstallNativeFunctions();
|
||||||
|
|
||||||
auto function_cache =
|
auto function_cache =
|
||||||
ObjectHashTable::New(isolate(), ApiNatives::kInitialFunctionCacheSize);
|
ObjectHashTable::New(isolate(), ApiNatives::kInitialFunctionCacheSize,
|
||||||
|
USE_CUSTOM_MINIMUM_CAPACITY);
|
||||||
native_context()->set_function_cache(*function_cache);
|
native_context()->set_function_cache(*function_cache);
|
||||||
|
|
||||||
// Store the map for the string prototype after the natives has been compiled
|
// Store the map for the string prototype after the natives has been compiled
|
||||||
|
@ -385,7 +385,6 @@ typedef List<HeapObject*> DebugObjectCache;
|
|||||||
V(uint32_t, per_isolate_assert_data, 0xFFFFFFFFu) \
|
V(uint32_t, per_isolate_assert_data, 0xFFFFFFFFu) \
|
||||||
V(PromiseRejectCallback, promise_reject_callback, NULL) \
|
V(PromiseRejectCallback, promise_reject_callback, NULL) \
|
||||||
V(const v8::StartupData*, snapshot_blob, NULL) \
|
V(const v8::StartupData*, snapshot_blob, NULL) \
|
||||||
V(bool, creating_default_snapshot, false) \
|
|
||||||
ISOLATE_INIT_SIMULATOR_LIST(V)
|
ISOLATE_INIT_SIMULATOR_LIST(V)
|
||||||
|
|
||||||
#define THREAD_LOCAL_TOP_ACCESSOR(type, name) \
|
#define THREAD_LOCAL_TOP_ACCESSOR(type, name) \
|
||||||
|
@ -2996,13 +2996,6 @@ int HashTableBase::ComputeCapacity(int at_least_space_for) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int HashTableBase::ComputeCapacityForSerialization(int at_least_space_for) {
|
|
||||||
const int kMinCapacity = 1;
|
|
||||||
int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for);
|
|
||||||
return Max(capacity, kMinCapacity);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template <typename Derived, typename Shape, typename Key>
|
template <typename Derived, typename Shape, typename Key>
|
||||||
int HashTable<Derived, Shape, Key>::FindEntry(Key key) {
|
int HashTable<Derived, Shape, Key>::FindEntry(Key key) {
|
||||||
return FindEntry(GetIsolate(), key);
|
return FindEntry(GetIsolate(), key);
|
||||||
|
@ -13452,8 +13452,6 @@ Handle<Derived> HashTable<Derived, Shape, Key>::New(
|
|||||||
|
|
||||||
int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY)
|
int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY)
|
||||||
? at_least_space_for
|
? at_least_space_for
|
||||||
: isolate->creating_default_snapshot()
|
|
||||||
? ComputeCapacityForSerialization(at_least_space_for)
|
|
||||||
: ComputeCapacity(at_least_space_for);
|
: ComputeCapacity(at_least_space_for);
|
||||||
if (capacity > HashTable::kMaxCapacity) {
|
if (capacity > HashTable::kMaxCapacity) {
|
||||||
v8::internal::Heap::FatalProcessOutOfMemory("invalid table size", true);
|
v8::internal::Heap::FatalProcessOutOfMemory("invalid table size", true);
|
||||||
|
@ -2955,9 +2955,6 @@ class HashTableBase : public FixedArray {
|
|||||||
// number of elements. May be more than HashTable::kMaxCapacity.
|
// number of elements. May be more than HashTable::kMaxCapacity.
|
||||||
static inline int ComputeCapacity(int at_least_space_for);
|
static inline int ComputeCapacity(int at_least_space_for);
|
||||||
|
|
||||||
// Use a different heuristic to compute capacity when serializing.
|
|
||||||
static inline int ComputeCapacityForSerialization(int at_least_space_for);
|
|
||||||
|
|
||||||
// Tells whether k is a real key. The hole and undefined are not allowed
|
// Tells whether k is a real key. The hole and undefined are not allowed
|
||||||
// as keys and can be used to indicate missing or deleted elements.
|
// as keys and can be used to indicate missing or deleted elements.
|
||||||
bool IsKey(Object* k) {
|
bool IsKey(Object* k) {
|
||||||
|
Loading…
Reference in New Issue
Block a user