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

Side by Side Diff: src/heap/heap.cc

Issue 1805903002: [serializer] Add API to warm up startup snapshot with an additional script. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix comment Created 4 years, 9 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 | « src/globals.h ('k') | src/isolate.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/heap/heap.h" 5 #include "src/heap/heap.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/ast/scopeinfo.h" 9 #include "src/ast/scopeinfo.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 4748 matching lines...) Expand 10 before | Expand all | Expand 10 after
4759 if (mode != VISIT_ALL_IN_SCAVENGE) { 4759 if (mode != VISIT_ALL_IN_SCAVENGE) {
4760 isolate_->builtins()->IterateBuiltins(v); 4760 isolate_->builtins()->IterateBuiltins(v);
4761 v->Synchronize(VisitorSynchronization::kBuiltins); 4761 v->Synchronize(VisitorSynchronization::kBuiltins);
4762 isolate_->interpreter()->IterateDispatchTable(v); 4762 isolate_->interpreter()->IterateDispatchTable(v);
4763 v->Synchronize(VisitorSynchronization::kDispatchTable); 4763 v->Synchronize(VisitorSynchronization::kDispatchTable);
4764 } 4764 }
4765 4765
4766 // Iterate over global handles. 4766 // Iterate over global handles.
4767 switch (mode) { 4767 switch (mode) {
4768 case VISIT_ONLY_STRONG: 4768 case VISIT_ONLY_STRONG:
4769 case VISIT_ONLY_STRONG_FOR_SERIALIZATION:
4769 isolate_->global_handles()->IterateStrongRoots(v); 4770 isolate_->global_handles()->IterateStrongRoots(v);
4770 break; 4771 break;
4771 case VISIT_ALL_IN_SCAVENGE: 4772 case VISIT_ALL_IN_SCAVENGE:
4772 isolate_->global_handles()->IterateNewSpaceStrongAndDependentRoots(v); 4773 isolate_->global_handles()->IterateNewSpaceStrongAndDependentRoots(v);
4773 break; 4774 break;
4774 case VISIT_ALL_IN_SWEEP_NEWSPACE: 4775 case VISIT_ALL_IN_SWEEP_NEWSPACE:
4775 case VISIT_ALL: 4776 case VISIT_ALL:
4776 isolate_->global_handles()->IterateAllRoots(v); 4777 isolate_->global_handles()->IterateAllRoots(v);
4777 break; 4778 break;
4778 } 4779 }
(...skipping 10 matching lines...) Expand all
4789 // Iterate over pointers being held by inactive threads. 4790 // Iterate over pointers being held by inactive threads.
4790 isolate_->thread_manager()->Iterate(v); 4791 isolate_->thread_manager()->Iterate(v);
4791 v->Synchronize(VisitorSynchronization::kThreadManager); 4792 v->Synchronize(VisitorSynchronization::kThreadManager);
4792 4793
4793 // Iterate over other strong roots (currently only identity maps). 4794 // Iterate over other strong roots (currently only identity maps).
4794 for (StrongRootsList* list = strong_roots_list_; list; list = list->next) { 4795 for (StrongRootsList* list = strong_roots_list_; list; list = list->next) {
4795 v->VisitPointers(list->start, list->end); 4796 v->VisitPointers(list->start, list->end);
4796 } 4797 }
4797 v->Synchronize(VisitorSynchronization::kStrongRoots); 4798 v->Synchronize(VisitorSynchronization::kStrongRoots);
4798 4799
4799 // Iterate over the pointers the Serialization/Deserialization code is 4800 // Iterate over the partial snapshot cache unless serializing.
4800 // holding. 4801 if (mode != VISIT_ONLY_STRONG_FOR_SERIALIZATION) {
4801 // During garbage collection this keeps the partial snapshot cache alive. 4802 SerializerDeserializer::Iterate(isolate_, v);
4802 // During deserialization of the startup snapshot this creates the partial 4803 }
4803 // snapshot cache and deserializes the objects it refers to. During
4804 // serialization this does nothing, since the partial snapshot cache is
4805 // empty. However the next thing we do is create the partial snapshot,
4806 // filling up the partial snapshot cache with objects it needs as we go.
4807 SerializerDeserializer::Iterate(isolate_, v);
4808 // We don't do a v->Synchronize call here, because in debug mode that will 4804 // We don't do a v->Synchronize call here, because in debug mode that will
4809 // output a flag to the snapshot. However at this point the serializer and 4805 // output a flag to the snapshot. However at this point the serializer and
4810 // deserializer are deliberately a little unsynchronized (see above) so the 4806 // deserializer are deliberately a little unsynchronized (see above) so the
4811 // checking of the sync flag in the snapshot would fail. 4807 // checking of the sync flag in the snapshot would fail.
4812 } 4808 }
4813 4809
4814 4810
4815 // TODO(1236194): Since the heap size is configurable on the command line 4811 // TODO(1236194): Since the heap size is configurable on the command line
4816 // and through the API, we should gracefully handle the case that the heap 4812 // and through the API, we should gracefully handle the case that the heap
4817 // size is not big enough to fit all the initial objects. 4813 // size is not big enough to fit all the initial objects.
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after
6403 } 6399 }
6404 6400
6405 6401
6406 // static 6402 // static
6407 int Heap::GetStaticVisitorIdForMap(Map* map) { 6403 int Heap::GetStaticVisitorIdForMap(Map* map) {
6408 return StaticVisitorBase::GetVisitorId(map); 6404 return StaticVisitorBase::GetVisitorId(map);
6409 } 6405 }
6410 6406
6411 } // namespace internal 6407 } // namespace internal
6412 } // namespace v8 6408 } // namespace v8
OLDNEW
« no previous file with comments | « src/globals.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698