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

Side by Side 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, 10 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 | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | 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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2716 matching lines...) Expand 10 before | Expand all | Expand 10 after
2727 if (templ->constructor()->IsUndefined()) { 2727 if (templ->constructor()->IsUndefined()) {
2728 Local<FunctionTemplate> constructor = FunctionTemplate::New(); 2728 Local<FunctionTemplate> constructor = FunctionTemplate::New();
2729 Utils::OpenHandle(*constructor)->set_instance_template(*templ); 2729 Utils::OpenHandle(*constructor)->set_instance_template(*templ);
2730 templ->set_constructor(*Utils::OpenHandle(*constructor)); 2730 templ->set_constructor(*Utils::OpenHandle(*constructor));
2731 } 2731 }
2732 return i::Handle<i::FunctionTemplateInfo>( 2732 return i::Handle<i::FunctionTemplateInfo>(
2733 i::FunctionTemplateInfo::cast(templ->constructor())); 2733 i::FunctionTemplateInfo::cast(templ->constructor()));
2734 } 2734 }
2735 2735
2736 2736
2737 Persistent<Context> v8::Context::New() {
2738 EnsureInitialized("v8::Context::New()");
2739 LOG_API("Context::New");
2740 ON_BAILOUT("v8::Context::New()", return Persistent<Context>());
2741
2742 if (i::Bootstrapper::AutoExtensionsExist()) {
2743 return New(0);
2744 }
2745
2746 // Enter V8 via an ENTER_V8 scope.
2747 Persistent<Context> result;
2748 {
2749 ENTER_V8;
2750 HandleScope scope;
2751 #if defined(ANDROID)
2752 // On mobile device, full GC is expensive, leave it to the system to
2753 // decide when should make a full GC.
2754 #else
2755 // Give the heap a chance to cleanup if we've disposed contexts.
2756 i::Heap::CollectAllGarbageIfContextDisposed();
2757 #endif
2758 i::Handle<i::Context> env = i::Snapshot::NewContextFromSnapshot();
2759 if (env.is_null()) {
2760 return New(0);
2761 }
2762 i::Counters::contexts_created_by_snapshot.Increment();
2763 return Persistent<Context>::New(Utils::ToLocal(env));
2764 }
2765 }
2766
2767
2737 Persistent<Context> v8::Context::New( 2768 Persistent<Context> v8::Context::New(
2738 v8::ExtensionConfiguration* extensions, 2769 v8::ExtensionConfiguration* extensions,
2739 v8::Handle<ObjectTemplate> global_template, 2770 v8::Handle<ObjectTemplate> global_template,
2740 v8::Handle<Value> global_object) { 2771 v8::Handle<Value> global_object) {
2741 EnsureInitialized("v8::Context::New()"); 2772 EnsureInitialized("v8::Context::New()");
2742 LOG_API("Context::New"); 2773 LOG_API("Context::New");
2743 ON_BAILOUT("v8::Context::New()", return Persistent<Context>()); 2774 ON_BAILOUT("v8::Context::New()", return Persistent<Context>());
2775 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
2744 2776
2745 // Enter V8 via an ENTER_V8 scope. 2777 // Enter V8 via an ENTER_V8 scope.
2746 i::Handle<i::Context> env; 2778 i::Handle<i::Context> env;
2747 { 2779 {
2748 ENTER_V8; 2780 ENTER_V8;
2749 #if defined(ANDROID) 2781 #if defined(ANDROID)
2750 // On mobile device, full GC is expensive, leave it to the system to 2782 // On mobile device, full GC is expensive, leave it to the system to
2751 // decide when should make a full GC. 2783 // decide when should make a full GC.
2752 #else 2784 #else
2753 // Give the heap a chance to cleanup if we've disposed contexts. 2785 // Give the heap a chance to cleanup if we've disposed contexts.
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
3829 3861
3830 3862
3831 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 3863 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
3832 HandleScopeImplementer* thread_local = 3864 HandleScopeImplementer* thread_local =
3833 reinterpret_cast<HandleScopeImplementer*>(storage); 3865 reinterpret_cast<HandleScopeImplementer*>(storage);
3834 thread_local->IterateThis(v); 3866 thread_local->IterateThis(v);
3835 return storage + ArchiveSpacePerThread(); 3867 return storage + ArchiveSpacePerThread();
3836 } 3868 }
3837 3869
3838 } } // namespace v8::internal 3870 } } // namespace v8::internal
OLDNEW
« 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