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

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: 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
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 4742 matching lines...) Expand 10 before | Expand all | Expand 10 after
4753 if (mode != VISIT_ALL_IN_SCAVENGE) { 4753 if (mode != VISIT_ALL_IN_SCAVENGE) {
4754 isolate_->builtins()->IterateBuiltins(v); 4754 isolate_->builtins()->IterateBuiltins(v);
4755 v->Synchronize(VisitorSynchronization::kBuiltins); 4755 v->Synchronize(VisitorSynchronization::kBuiltins);
4756 isolate_->interpreter()->IterateDispatchTable(v); 4756 isolate_->interpreter()->IterateDispatchTable(v);
4757 v->Synchronize(VisitorSynchronization::kDispatchTable); 4757 v->Synchronize(VisitorSynchronization::kDispatchTable);
4758 } 4758 }
4759 4759
4760 // Iterate over global handles. 4760 // Iterate over global handles.
4761 switch (mode) { 4761 switch (mode) {
4762 case VISIT_ONLY_STRONG: 4762 case VISIT_ONLY_STRONG:
4763 case VISIT_ONLY_STRONG_FOR_SERIALIZATION:
4763 isolate_->global_handles()->IterateStrongRoots(v); 4764 isolate_->global_handles()->IterateStrongRoots(v);
4764 break; 4765 break;
4765 case VISIT_ALL_IN_SCAVENGE: 4766 case VISIT_ALL_IN_SCAVENGE:
4766 isolate_->global_handles()->IterateNewSpaceStrongAndDependentRoots(v); 4767 isolate_->global_handles()->IterateNewSpaceStrongAndDependentRoots(v);
4767 break; 4768 break;
4768 case VISIT_ALL_IN_SWEEP_NEWSPACE: 4769 case VISIT_ALL_IN_SWEEP_NEWSPACE:
4769 case VISIT_ALL: 4770 case VISIT_ALL:
4770 isolate_->global_handles()->IterateAllRoots(v); 4771 isolate_->global_handles()->IterateAllRoots(v);
4771 break; 4772 break;
4772 } 4773 }
(...skipping 10 matching lines...) Expand all
4783 // Iterate over pointers being held by inactive threads. 4784 // Iterate over pointers being held by inactive threads.
4784 isolate_->thread_manager()->Iterate(v); 4785 isolate_->thread_manager()->Iterate(v);
4785 v->Synchronize(VisitorSynchronization::kThreadManager); 4786 v->Synchronize(VisitorSynchronization::kThreadManager);
4786 4787
4787 // Iterate over other strong roots (currently only identity maps). 4788 // Iterate over other strong roots (currently only identity maps).
4788 for (StrongRootsList* list = strong_roots_list_; list; list = list->next) { 4789 for (StrongRootsList* list = strong_roots_list_; list; list = list->next) {
4789 v->VisitPointers(list->start, list->end); 4790 v->VisitPointers(list->start, list->end);
4790 } 4791 }
4791 v->Synchronize(VisitorSynchronization::kStrongRoots); 4792 v->Synchronize(VisitorSynchronization::kStrongRoots);
4792 4793
4793 // Iterate over the pointers the Serialization/Deserialization code is 4794 // Iterate over the partial snapshot cache unless serializing.
4794 // holding. 4795 if (mode != VISIT_ONLY_STRONG_FOR_SERIALIZATION) {
4795 // During garbage collection this keeps the partial snapshot cache alive. 4796 SerializerDeserializer::Iterate(isolate_, v);
4796 // During deserialization of the startup snapshot this creates the partial 4797 }
4797 // snapshot cache and deserializes the objects it refers to. During
4798 // serialization this does nothing, since the partial snapshot cache is
4799 // empty. However the next thing we do is create the partial snapshot,
4800 // filling up the partial snapshot cache with objects it needs as we go.
4801 SerializerDeserializer::Iterate(isolate_, v);
4802 // We don't do a v->Synchronize call here, because in debug mode that will 4798 // We don't do a v->Synchronize call here, because in debug mode that will
4803 // output a flag to the snapshot. However at this point the serializer and 4799 // output a flag to the snapshot. However at this point the serializer and
4804 // deserializer are deliberately a little unsynchronized (see above) so the 4800 // deserializer are deliberately a little unsynchronized (see above) so the
4805 // checking of the sync flag in the snapshot would fail. 4801 // checking of the sync flag in the snapshot would fail.
4806 } 4802 }
4807 4803
4808 4804
4809 // TODO(1236194): Since the heap size is configurable on the command line 4805 // TODO(1236194): Since the heap size is configurable on the command line
4810 // and through the API, we should gracefully handle the case that the heap 4806 // and through the API, we should gracefully handle the case that the heap
4811 // size is not big enough to fit all the initial objects. 4807 // size is not big enough to fit all the initial objects.
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after
6397 } 6393 }
6398 6394
6399 6395
6400 // static 6396 // static
6401 int Heap::GetStaticVisitorIdForMap(Map* map) { 6397 int Heap::GetStaticVisitorIdForMap(Map* map) {
6402 return StaticVisitorBase::GetVisitorId(map); 6398 return StaticVisitorBase::GetVisitorId(map);
6403 } 6399 }
6404 6400
6405 } // namespace internal 6401 } // namespace internal
6406 } // namespace v8 6402 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698