Commit 4f4c90d0 authored by yangguo's avatar yangguo Committed by Commit bot

Use conservative hash table capacity growth during entire snapshotting.

We want to use the conservative growth strategy during
- isolate initialization
- bootstrapping a context

But not when
- not creating a snapshot
- running additional code for custom snapshot.

R=mvstanton@chromium.org

Review URL: https://codereview.chromium.org/1155823003

Cr-Commit-Position: refs/heads/master@{#28586}
parent f034d6d8
......@@ -347,12 +347,14 @@ 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);
Handle<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);
......
......@@ -378,6 +378,7 @@ 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) \
......
......@@ -14728,10 +14728,10 @@ Handle<Derived> HashTable<Derived, Shape, Key>::New(
PretenureFlag pretenure) {
DCHECK(0 <= at_least_space_for);
DCHECK(!capacity_option || base::bits::IsPowerOfTwo32(at_least_space_for));
int capacity =
(capacity_option == USE_CUSTOM_MINIMUM_CAPACITY)
int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY)
? at_least_space_for
: isolate->serializer_enabled() && isolate->bootstrapper()->IsActive()
: isolate->creating_default_snapshot()
? ComputeCapacityForSerialization(at_least_space_for)
: ComputeCapacity(at_least_space_for);
if (capacity > HashTable::kMaxCapacity) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment