| OLD | NEW |
| 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 4719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4730 // Acquire execution access since we are going to read stack limit values. | 4730 // Acquire execution access since we are going to read stack limit values. |
| 4731 ExecutionAccess access(isolate()); | 4731 ExecutionAccess access(isolate()); |
| 4732 v->VisitPointers(&roots_[kSmiRootsStart], &roots_[kRootListLength]); | 4732 v->VisitPointers(&roots_[kSmiRootsStart], &roots_[kRootListLength]); |
| 4733 v->Synchronize(VisitorSynchronization::kSmiRootList); | 4733 v->Synchronize(VisitorSynchronization::kSmiRootList); |
| 4734 } | 4734 } |
| 4735 | 4735 |
| 4736 | 4736 |
| 4737 void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) { | 4737 void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) { |
| 4738 v->VisitPointers(&roots_[0], &roots_[kStrongRootListLength]); | 4738 v->VisitPointers(&roots_[0], &roots_[kStrongRootListLength]); |
| 4739 v->Synchronize(VisitorSynchronization::kStrongRootList); | 4739 v->Synchronize(VisitorSynchronization::kStrongRootList); |
| 4740 // The serializer/deserializer iterates the root list twice, first to pick |
| 4741 // off immortal immovable roots to make sure they end up on the first page, |
| 4742 // and then again for the rest. |
| 4743 if (mode == VISIT_ONLY_STRONG_ROOT_LIST) return; |
| 4740 | 4744 |
| 4741 isolate_->bootstrapper()->Iterate(v); | 4745 isolate_->bootstrapper()->Iterate(v); |
| 4742 v->Synchronize(VisitorSynchronization::kBootstrapper); | 4746 v->Synchronize(VisitorSynchronization::kBootstrapper); |
| 4743 isolate_->Iterate(v); | 4747 isolate_->Iterate(v); |
| 4744 v->Synchronize(VisitorSynchronization::kTop); | 4748 v->Synchronize(VisitorSynchronization::kTop); |
| 4745 Relocatable::Iterate(isolate_, v); | 4749 Relocatable::Iterate(isolate_, v); |
| 4746 v->Synchronize(VisitorSynchronization::kRelocatable); | 4750 v->Synchronize(VisitorSynchronization::kRelocatable); |
| 4747 | 4751 |
| 4748 isolate_->compilation_cache()->Iterate(v); | 4752 isolate_->compilation_cache()->Iterate(v); |
| 4749 v->Synchronize(VisitorSynchronization::kCompilationCache); | 4753 v->Synchronize(VisitorSynchronization::kCompilationCache); |
| 4750 | 4754 |
| 4751 // Iterate over local handles in handle scopes. | 4755 // Iterate over local handles in handle scopes. |
| 4752 isolate_->handle_scope_implementer()->Iterate(v); | 4756 isolate_->handle_scope_implementer()->Iterate(v); |
| 4753 isolate_->IterateDeferredHandles(v); | 4757 isolate_->IterateDeferredHandles(v); |
| 4754 v->Synchronize(VisitorSynchronization::kHandleScope); | 4758 v->Synchronize(VisitorSynchronization::kHandleScope); |
| 4755 | 4759 |
| 4756 // Iterate over the builtin code objects and code stubs in the | 4760 // Iterate over the builtin code objects and code stubs in the |
| 4757 // heap. Note that it is not necessary to iterate over code objects | 4761 // heap. Note that it is not necessary to iterate over code objects |
| 4758 // on scavenge collections. | 4762 // on scavenge collections. |
| 4759 if (mode != VISIT_ALL_IN_SCAVENGE) { | 4763 if (mode != VISIT_ALL_IN_SCAVENGE) { |
| 4760 isolate_->builtins()->IterateBuiltins(v); | 4764 isolate_->builtins()->IterateBuiltins(v); |
| 4761 v->Synchronize(VisitorSynchronization::kBuiltins); | 4765 v->Synchronize(VisitorSynchronization::kBuiltins); |
| 4762 isolate_->interpreter()->IterateDispatchTable(v); | 4766 isolate_->interpreter()->IterateDispatchTable(v); |
| 4763 v->Synchronize(VisitorSynchronization::kDispatchTable); | 4767 v->Synchronize(VisitorSynchronization::kDispatchTable); |
| 4764 } | 4768 } |
| 4765 | 4769 |
| 4766 // Iterate over global handles. | 4770 // Iterate over global handles. |
| 4767 switch (mode) { | 4771 switch (mode) { |
| 4772 case VISIT_ONLY_STRONG_ROOT_LIST: |
| 4773 UNREACHABLE(); |
| 4774 break; |
| 4768 case VISIT_ONLY_STRONG: | 4775 case VISIT_ONLY_STRONG: |
| 4769 case VISIT_ONLY_STRONG_FOR_SERIALIZATION: | 4776 case VISIT_ONLY_STRONG_FOR_SERIALIZATION: |
| 4770 isolate_->global_handles()->IterateStrongRoots(v); | 4777 isolate_->global_handles()->IterateStrongRoots(v); |
| 4771 break; | 4778 break; |
| 4772 case VISIT_ALL_IN_SCAVENGE: | 4779 case VISIT_ALL_IN_SCAVENGE: |
| 4773 isolate_->global_handles()->IterateNewSpaceStrongAndDependentRoots(v); | 4780 isolate_->global_handles()->IterateNewSpaceStrongAndDependentRoots(v); |
| 4774 break; | 4781 break; |
| 4775 case VISIT_ALL_IN_SWEEP_NEWSPACE: | 4782 case VISIT_ALL_IN_SWEEP_NEWSPACE: |
| 4776 case VISIT_ALL: | 4783 case VISIT_ALL: |
| 4777 isolate_->global_handles()->IterateAllRoots(v); | 4784 isolate_->global_handles()->IterateAllRoots(v); |
| (...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6399 } | 6406 } |
| 6400 | 6407 |
| 6401 | 6408 |
| 6402 // static | 6409 // static |
| 6403 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6410 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6404 return StaticVisitorBase::GetVisitorId(map); | 6411 return StaticVisitorBase::GetVisitorId(map); |
| 6405 } | 6412 } |
| 6406 | 6413 |
| 6407 } // namespace internal | 6414 } // namespace internal |
| 6408 } // namespace v8 | 6415 } // namespace v8 |
| OLD | NEW |