Remove serializer-specific hash table size heuristic.
authoryangguo <yangguo@chromium.org>
Tue, 4 Aug 2015 10:56:35 +0000 (03:56 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 4 Aug 2015 10:57:12 +0000 (10:57 +0000)
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}

src/api.cc
src/bootstrapper.cc
src/isolate.h
src/objects-inl.h
src/objects.cc
src/objects.h

index 586fd8613a5a4b9dcaa5b47bfa4d56e65d804c7b..524b71dbf2ab6626b58705112301afa11073555c 100644 (file)
@@ -367,14 +367,12 @@ StartupData V8::CreateSnapshotDataBlob(const char* custom_source) {
     base::ElapsedTimer timer;
     timer.Start();
     Isolate::Scope isolate_scope(isolate);
-    internal_isolate->set_creating_default_snapshot(true);
     internal_isolate->Init(NULL);
     Persistent<Context> context;
     i::Snapshot::Metadata metadata;
     {
       HandleScope handle_scope(isolate);
       Local<Context> new_context = Context::New(isolate);
-      internal_isolate->set_creating_default_snapshot(false);
       context.Reset(isolate, new_context);
       if (custom_source != NULL) {
         metadata.set_embeds_script(true);
index a0d62827cfd2b061b6e2b0b144a99e491bcaa9a8..2ba4d3092927e2cc19bfd6cd431c3bb0df5e35a0 100644 (file)
@@ -2413,7 +2413,8 @@ bool Genesis::InstallNatives(ContextType context_type) {
   InstallNativeFunctions();
 
   auto function_cache =
-      ObjectHashTable::New(isolate(), ApiNatives::kInitialFunctionCacheSize);
+      ObjectHashTable::New(isolate(), ApiNatives::kInitialFunctionCacheSize,
+                           USE_CUSTOM_MINIMUM_CAPACITY);
   native_context()->set_function_cache(*function_cache);
 
   // Store the map for the string prototype after the natives has been compiled
index a11f75ab290a1ce82439fa89c5508f3167e567bb..fe1f51b5c64f33969b52a2b579a261c7329d8e44 100644 (file)
@@ -385,7 +385,6 @@ typedef List<HeapObject*> DebugObjectCache;
   V(uint32_t, per_isolate_assert_data, 0xFFFFFFFFu)                            \
   V(PromiseRejectCallback, promise_reject_callback, NULL)                      \
   V(const v8::StartupData*, snapshot_blob, NULL)                               \
-  V(bool, creating_default_snapshot, false)                                    \
   ISOLATE_INIT_SIMULATOR_LIST(V)
 
 #define THREAD_LOCAL_TOP_ACCESSOR(type, name)                        \
index ffe4d65afd180385b0805d72770b15c2b471c8b7..3a9fe2991decc352c34f79a0635ce1968a57539f 100644 (file)
@@ -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>
 int HashTable<Derived, Shape, Key>::FindEntry(Key key) {
   return FindEntry(GetIsolate(), key);
index 51675d4c21597465a1e4fa790127b4e33d411d6f..3fbb68bcab434d3a05e2a358d493eae70181c635 100644 (file)
@@ -13452,9 +13452,7 @@ Handle<Derived> HashTable<Derived, Shape, Key>::New(
 
   int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY)
                      ? 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) {
     v8::internal::Heap::FatalProcessOutOfMemory("invalid table size", true);
   }
index e80ad0ae3af1a12dcd7efe2337ccc00c1b007a7a..94d11737a6fcd7e9139a1bc64bf7081b03b791a7 100644 (file)
@@ -2955,9 +2955,6 @@ class HashTableBase : public FixedArray {
   // number of elements. May be more than HashTable::kMaxCapacity.
   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
   // as keys and can be used to indicate missing or deleted elements.
   bool IsKey(Object* k) {