Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1235)

Side by Side Diff: src/api.cc

Issue 1114043002: Cache experimental natives sources as external strings. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: also delete experimental native sources at tear down Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/bootstrapper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 metadata.set_embeds_script(true); 356 metadata.set_embeds_script(true);
357 Context::Scope context_scope(new_context); 357 Context::Scope context_scope(new_context);
358 if (!RunExtraCode(isolate, custom_source)) context.Reset(); 358 if (!RunExtraCode(isolate, custom_source)) context.Reset();
359 } 359 }
360 } 360 }
361 if (!context.IsEmpty()) { 361 if (!context.IsEmpty()) {
362 // Make sure all builtin scripts are cached. 362 // Make sure all builtin scripts are cached.
363 { 363 {
364 HandleScope scope(isolate); 364 HandleScope scope(isolate);
365 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) { 365 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) {
366 internal_isolate->bootstrapper()->NativesSourceLookup(i); 366 internal_isolate->bootstrapper()->SourceLookup<i::Natives>(i);
367 } 367 }
368 } 368 }
369 // If we don't do this then we end up with a stray root pointing at the 369 // If we don't do this then we end up with a stray root pointing at the
370 // context even after we have disposed of the context. 370 // context even after we have disposed of the context.
371 internal_isolate->heap()->CollectAllAvailableGarbage("mksnapshot"); 371 internal_isolate->heap()->CollectAllAvailableGarbage("mksnapshot");
372 i::Object* raw_context = *v8::Utils::OpenPersistent(context); 372 i::Object* raw_context = *v8::Utils::OpenPersistent(context);
373 context.Reset(); 373 context.Reset();
374 374
375 i::SnapshotByteSink snapshot_sink; 375 i::SnapshotByteSink snapshot_sink;
376 i::StartupSerializer ser(internal_isolate, &snapshot_sink); 376 i::StartupSerializer ser(internal_isolate, &snapshot_sink);
(...skipping 7666 matching lines...) Expand 10 before | Expand all | Expand 10 after
8043 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 8043 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
8044 Address callback_address = 8044 Address callback_address =
8045 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8045 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8046 VMState<EXTERNAL> state(isolate); 8046 VMState<EXTERNAL> state(isolate);
8047 ExternalCallbackScope call_scope(isolate, callback_address); 8047 ExternalCallbackScope call_scope(isolate, callback_address);
8048 callback(info); 8048 callback(info);
8049 } 8049 }
8050 8050
8051 8051
8052 } } // namespace v8::internal 8052 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/bootstrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698