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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1953 void MarkCompactCollector::MarkRoots(RootMarkingVisitor* visitor) { | 1953 void MarkCompactCollector::MarkRoots(RootMarkingVisitor* visitor) { |
1954 // Mark the heap roots including global variables, stack variables, | 1954 // Mark the heap roots including global variables, stack variables, |
1955 // etc., and all objects reachable from them. | 1955 // etc., and all objects reachable from them. |
1956 heap()->IterateStrongRoots(visitor, VISIT_ONLY_STRONG); | 1956 heap()->IterateStrongRoots(visitor, VISIT_ONLY_STRONG); |
1957 | 1957 |
1958 // Handle the string table specially. | 1958 // Handle the string table specially. |
1959 MarkStringTable(visitor); | 1959 MarkStringTable(visitor); |
1960 | 1960 |
1961 MarkWeakObjectToCodeTable(); | 1961 MarkWeakObjectToCodeTable(); |
1962 | 1962 |
1963 heap()->IterateEmbeddedMapCache(visitor); | |
1964 | |
1963 // There may be overflowed objects in the heap. Visit them now. | 1965 // There may be overflowed objects in the heap. Visit them now. |
1964 while (marking_deque_.overflowed()) { | 1966 while (marking_deque_.overflowed()) { |
1965 RefillMarkingDeque(); | 1967 RefillMarkingDeque(); |
1966 EmptyMarkingDeque(); | 1968 EmptyMarkingDeque(); |
1967 } | 1969 } |
1968 } | 1970 } |
1969 | 1971 |
1970 | 1972 |
1971 void MarkCompactCollector::MarkImplicitRefGroups() { | 1973 void MarkCompactCollector::MarkImplicitRefGroups() { |
1972 List<ImplicitRefGroup*>* ref_groups = | 1974 List<ImplicitRefGroup*>* ref_groups = |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2192 } | 2194 } |
2193 } | 2195 } |
2194 } | 2196 } |
2195 } | 2197 } |
2196 | 2198 |
2197 RootMarkingVisitor root_visitor(heap()); | 2199 RootMarkingVisitor root_visitor(heap()); |
2198 MarkRoots(&root_visitor); | 2200 MarkRoots(&root_visitor); |
2199 | 2201 |
2200 ProcessTopOptimizedFrame(&root_visitor); | 2202 ProcessTopOptimizedFrame(&root_visitor); |
2201 | 2203 |
2204 ProcessMarkingDeque(); | |
Hannes Payer (out of office)
2014/11/17 17:34:33
Why?
| |
2205 | |
2202 // The objects reachable from the roots are marked, yet unreachable | 2206 // The objects reachable from the roots are marked, yet unreachable |
2203 // objects are unmarked. Mark objects reachable due to host | 2207 // objects are unmarked. Mark objects reachable due to host |
2204 // application specific logic or through Harmony weak maps. | 2208 // application specific logic or through Harmony weak maps. |
2205 ProcessEphemeralMarking(&root_visitor); | 2209 ProcessEphemeralMarking(&root_visitor); |
2206 | 2210 |
2207 // The objects reachable from the roots, weak maps or object groups | 2211 // The objects reachable from the roots, weak maps or object groups |
2208 // are marked, yet unreachable objects are unmarked. Mark objects | 2212 // are marked, yet unreachable objects are unmarked. Mark objects |
2209 // reachable only from weak global handles. | 2213 // reachable only from weak global handles. |
2210 // | 2214 // |
2211 // First we identify nonlive weak handles and mark them as pending | 2215 // First we identify nonlive weak handles and mark them as pending |
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3526 | 3530 |
3527 heap_->string_table()->Iterate(&updating_visitor); | 3531 heap_->string_table()->Iterate(&updating_visitor); |
3528 updating_visitor.VisitPointer(heap_->weak_object_to_code_table_address()); | 3532 updating_visitor.VisitPointer(heap_->weak_object_to_code_table_address()); |
3529 if (heap_->weak_object_to_code_table()->IsHashTable()) { | 3533 if (heap_->weak_object_to_code_table()->IsHashTable()) { |
3530 WeakHashTable* table = | 3534 WeakHashTable* table = |
3531 WeakHashTable::cast(heap_->weak_object_to_code_table()); | 3535 WeakHashTable::cast(heap_->weak_object_to_code_table()); |
3532 table->Iterate(&updating_visitor); | 3536 table->Iterate(&updating_visitor); |
3533 table->Rehash(heap_->isolate()->factory()->undefined_value()); | 3537 table->Rehash(heap_->isolate()->factory()->undefined_value()); |
3534 } | 3538 } |
3535 | 3539 |
3540 updating_visitor.VisitPointer(heap_->embedded_map_cache_address()); | |
3541 // No need to iterate the contents of the embedded map cache since | |
Hannes Payer (out of office)
2014/11/17 17:34:33
Please move the comment before updating_visitor.Vi
| |
3542 // maps do not move. | |
3543 | |
3536 // Update pointers from external string table. | 3544 // Update pointers from external string table. |
3537 heap_->UpdateReferencesInExternalStringTable( | 3545 heap_->UpdateReferencesInExternalStringTable( |
3538 &UpdateReferenceInExternalStringTableEntry); | 3546 &UpdateReferenceInExternalStringTableEntry); |
3539 | 3547 |
3540 EvacuationWeakObjectRetainer evacuation_object_retainer; | 3548 EvacuationWeakObjectRetainer evacuation_object_retainer; |
3541 heap()->ProcessWeakReferences(&evacuation_object_retainer); | 3549 heap()->ProcessWeakReferences(&evacuation_object_retainer); |
3542 | 3550 |
3543 // Visit invalidated code (we ignored all slots on it) and clear mark-bits | 3551 // Visit invalidated code (we ignored all slots on it) and clear mark-bits |
3544 // under it. | 3552 // under it. |
3545 ProcessInvalidatedCode(&updating_visitor); | 3553 ProcessInvalidatedCode(&updating_visitor); |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4392 SlotsBuffer* buffer = *buffer_address; | 4400 SlotsBuffer* buffer = *buffer_address; |
4393 while (buffer != NULL) { | 4401 while (buffer != NULL) { |
4394 SlotsBuffer* next_buffer = buffer->next(); | 4402 SlotsBuffer* next_buffer = buffer->next(); |
4395 DeallocateBuffer(buffer); | 4403 DeallocateBuffer(buffer); |
4396 buffer = next_buffer; | 4404 buffer = next_buffer; |
4397 } | 4405 } |
4398 *buffer_address = NULL; | 4406 *buffer_address = NULL; |
4399 } | 4407 } |
4400 } | 4408 } |
4401 } // namespace v8::internal | 4409 } // namespace v8::internal |
OLD | NEW |