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

Unified Diff: src/api.cc

Issue 565047: * Add the partial context snapshot to the VM executable if... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: Created 10 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | src/bootstrapper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
===================================================================
--- src/api.cc (revision 3791)
+++ src/api.cc (working copy)
@@ -2734,6 +2734,37 @@
}
+Persistent<Context> v8::Context::New() {
+ EnsureInitialized("v8::Context::New()");
+ LOG_API("Context::New");
+ ON_BAILOUT("v8::Context::New()", return Persistent<Context>());
+
+ if (i::Bootstrapper::AutoExtensionsExist()) {
+ return New(0);
+ }
+
+ // Enter V8 via an ENTER_V8 scope.
+ Persistent<Context> result;
+ {
+ ENTER_V8;
+ HandleScope scope;
+#if defined(ANDROID)
+ // On mobile device, full GC is expensive, leave it to the system to
+ // decide when should make a full GC.
+#else
+ // Give the heap a chance to cleanup if we've disposed contexts.
+ i::Heap::CollectAllGarbageIfContextDisposed();
+#endif
+ i::Handle<i::Context> env = i::Snapshot::NewContextFromSnapshot();
+ if (env.is_null()) {
+ return New(0);
+ }
+ i::Counters::contexts_created_by_snapshot.Increment();
+ return Persistent<Context>::New(Utils::ToLocal(env));
+ }
+}
+
+
Persistent<Context> v8::Context::New(
v8::ExtensionConfiguration* extensions,
v8::Handle<ObjectTemplate> global_template,
@@ -2741,6 +2772,7 @@
EnsureInitialized("v8::Context::New()");
LOG_API("Context::New");
ON_BAILOUT("v8::Context::New()", return Persistent<Context>());
+ i::Counters::contexts_created_by_snapshot.Increment();
Mads Ager (chromium) 2010/02/04 07:39:05 This context is not created from the snapshot, rig
// Enter V8 via an ENTER_V8 scope.
i::Handle<i::Context> env;
« no previous file with comments | « include/v8.h ('k') | src/bootstrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698