Chromium Code Reviews| Index: src/api.cc |
| diff --git a/src/api.cc b/src/api.cc |
| index 0d0bf3f75a6a8d2e01e1d57ac006ff2b7b5cb1c1..4954081067a830200d86a03b54726fd98a1aae04 100644 |
| --- a/src/api.cc |
| +++ b/src/api.cc |
| @@ -359,12 +359,12 @@ bool RunExtraCode(Isolate* isolate, const char* utf8_source) { |
| StartupData V8::CreateSnapshotDataBlob(const char* custom_source) { |
| - i::Isolate* internal_isolate = new i::Isolate(true); |
| - Isolate* isolate = reinterpret_cast<Isolate*>(internal_isolate); |
| + i::Isolate* i_isolate = new i::Isolate(true); |
| + Isolate* isolate = reinterpret_cast<Isolate*>(i_isolate); |
| StartupData result = {NULL, 0}; |
| { |
| Isolate::Scope isolate_scope(isolate); |
| - internal_isolate->Init(NULL); |
| + i_isolate->Init(NULL); |
| Persistent<Context> context; |
| i::Snapshot::Metadata metadata; |
| { |
| @@ -382,21 +382,31 @@ StartupData V8::CreateSnapshotDataBlob(const char* custom_source) { |
| { |
| HandleScope scope(isolate); |
| for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) { |
| - internal_isolate->bootstrapper()->NativesSourceLookup(i); |
| + i_isolate->bootstrapper()->NativesSourceLookup(i); |
| } |
| } |
| // If we don't do this then we end up with a stray root pointing at the |
| // context even after we have disposed of the context. |
| - internal_isolate->heap()->CollectAllAvailableGarbage("mksnapshot"); |
| + i_isolate->heap()->CollectAllAvailableGarbage("mksnapshot"); |
| + |
| + { |
| + HandleScope scope(isolate); |
| + // Clear code caches. |
| + i_isolate->heap()->public_set_code_stubs( |
| + *i::UnseededNumberDictionary::New(i_isolate, 128, i::TENURED)); |
|
Toon Verwaest
2015/03/09 12:32:50
What about extracting the original constructor fro
|
| + i_isolate->heap()->public_set_non_monomorphic_cache( |
| + *i::UnseededNumberDictionary::New(i_isolate, 64, i::TENURED)); |
| + } |
| + |
| i::Object* raw_context = *v8::Utils::OpenPersistent(context); |
| context.Reset(); |
| i::SnapshotByteSink snapshot_sink; |
| - i::StartupSerializer ser(internal_isolate, &snapshot_sink); |
| + i::StartupSerializer ser(i_isolate, &snapshot_sink); |
| ser.SerializeStrongReferences(); |
| i::SnapshotByteSink context_sink; |
| - i::PartialSerializer context_ser(internal_isolate, &ser, &context_sink); |
| + i::PartialSerializer context_ser(i_isolate, &ser, &context_sink); |
| context_ser.Serialize(&raw_context); |
| ser.SerializeWeakReferences(); |