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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 while (it.has_next()) { | 130 while (it.has_next()) { |
131 Page* p = it.next(); | 131 Page* p = it.next(); |
132 VerifyMarking(space->heap(), p->area_start(), p->area_end()); | 132 VerifyMarking(space->heap(), p->area_start(), p->area_end()); |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 | 136 |
137 static void VerifyMarking(Heap* heap) { | 137 static void VerifyMarking(Heap* heap) { |
138 VerifyMarking(heap->old_space()); | 138 VerifyMarking(heap->old_space()); |
139 VerifyMarking(heap->code_space()); | 139 VerifyMarking(heap->code_space()); |
140 VerifyMarking(heap->cell_space()); | |
141 VerifyMarking(heap->map_space()); | 140 VerifyMarking(heap->map_space()); |
142 VerifyMarking(heap->new_space()); | 141 VerifyMarking(heap->new_space()); |
143 | 142 |
144 VerifyMarkingVisitor visitor(heap); | 143 VerifyMarkingVisitor visitor(heap); |
145 | 144 |
146 LargeObjectIterator it(heap->lo_space()); | 145 LargeObjectIterator it(heap->lo_space()); |
147 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { | 146 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { |
148 if (MarkCompactCollector::IsMarked(obj)) { | 147 if (MarkCompactCollector::IsMarked(obj)) { |
149 obj->Iterate(&visitor); | 148 obj->Iterate(&visitor); |
150 } | 149 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 Page* p = it.next(); | 207 Page* p = it.next(); |
209 if (p->IsEvacuationCandidate()) continue; | 208 if (p->IsEvacuationCandidate()) continue; |
210 VerifyEvacuation(p); | 209 VerifyEvacuation(p); |
211 } | 210 } |
212 } | 211 } |
213 | 212 |
214 | 213 |
215 static void VerifyEvacuation(Heap* heap) { | 214 static void VerifyEvacuation(Heap* heap) { |
216 VerifyEvacuation(heap, heap->old_space()); | 215 VerifyEvacuation(heap, heap->old_space()); |
217 VerifyEvacuation(heap, heap->code_space()); | 216 VerifyEvacuation(heap, heap->code_space()); |
218 VerifyEvacuation(heap, heap->cell_space()); | |
219 VerifyEvacuation(heap, heap->map_space()); | 217 VerifyEvacuation(heap, heap->map_space()); |
220 VerifyEvacuation(heap->new_space()); | 218 VerifyEvacuation(heap->new_space()); |
221 | 219 |
222 VerifyEvacuationVisitor visitor; | 220 VerifyEvacuationVisitor visitor; |
223 heap->IterateStrongRoots(&visitor, VISIT_ALL); | 221 heap->IterateStrongRoots(&visitor, VISIT_ALL); |
224 } | 222 } |
225 #endif // VERIFY_HEAP | 223 #endif // VERIFY_HEAP |
226 | 224 |
227 | 225 |
228 void MarkCompactCollector::SetUp() { | 226 void MarkCompactCollector::SetUp() { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 | 259 |
262 if (FLAG_compact_code_space && (mode == NON_INCREMENTAL_COMPACTION || | 260 if (FLAG_compact_code_space && (mode == NON_INCREMENTAL_COMPACTION || |
263 FLAG_incremental_code_compaction)) { | 261 FLAG_incremental_code_compaction)) { |
264 CollectEvacuationCandidates(heap()->code_space()); | 262 CollectEvacuationCandidates(heap()->code_space()); |
265 } else if (FLAG_trace_fragmentation) { | 263 } else if (FLAG_trace_fragmentation) { |
266 TraceFragmentation(heap()->code_space()); | 264 TraceFragmentation(heap()->code_space()); |
267 } | 265 } |
268 | 266 |
269 if (FLAG_trace_fragmentation) { | 267 if (FLAG_trace_fragmentation) { |
270 TraceFragmentation(heap()->map_space()); | 268 TraceFragmentation(heap()->map_space()); |
271 TraceFragmentation(heap()->cell_space()); | |
272 } | 269 } |
273 | 270 |
274 heap()->old_space()->EvictEvacuationCandidatesFromFreeLists(); | 271 heap()->old_space()->EvictEvacuationCandidatesFromFreeLists(); |
275 heap()->code_space()->EvictEvacuationCandidatesFromFreeLists(); | 272 heap()->code_space()->EvictEvacuationCandidatesFromFreeLists(); |
276 | 273 |
277 compacting_ = evacuation_candidates_.length() > 0; | 274 compacting_ = evacuation_candidates_.length() > 0; |
278 } | 275 } |
279 | 276 |
280 return compacting_; | 277 return compacting_; |
281 } | 278 } |
282 | 279 |
283 | 280 |
284 void MarkCompactCollector::ClearInvalidSlotsBufferEntries(PagedSpace* space) { | 281 void MarkCompactCollector::ClearInvalidSlotsBufferEntries(PagedSpace* space) { |
285 PageIterator it(space); | 282 PageIterator it(space); |
286 while (it.has_next()) { | 283 while (it.has_next()) { |
287 Page* p = it.next(); | 284 Page* p = it.next(); |
288 SlotsBuffer::RemoveInvalidSlots(heap_, p->slots_buffer()); | 285 SlotsBuffer::RemoveInvalidSlots(heap_, p->slots_buffer()); |
289 } | 286 } |
290 } | 287 } |
291 | 288 |
292 | 289 |
293 void MarkCompactCollector::ClearInvalidStoreAndSlotsBufferEntries() { | 290 void MarkCompactCollector::ClearInvalidStoreAndSlotsBufferEntries() { |
294 heap_->store_buffer()->ClearInvalidStoreBufferEntries(); | 291 heap_->store_buffer()->ClearInvalidStoreBufferEntries(); |
295 | 292 |
296 ClearInvalidSlotsBufferEntries(heap_->old_space()); | 293 ClearInvalidSlotsBufferEntries(heap_->old_space()); |
297 ClearInvalidSlotsBufferEntries(heap_->code_space()); | 294 ClearInvalidSlotsBufferEntries(heap_->code_space()); |
298 ClearInvalidSlotsBufferEntries(heap_->cell_space()); | |
299 ClearInvalidSlotsBufferEntries(heap_->map_space()); | 295 ClearInvalidSlotsBufferEntries(heap_->map_space()); |
300 | 296 |
301 LargeObjectIterator it(heap_->lo_space()); | 297 LargeObjectIterator it(heap_->lo_space()); |
302 for (HeapObject* object = it.Next(); object != NULL; object = it.Next()) { | 298 for (HeapObject* object = it.Next(); object != NULL; object = it.Next()) { |
303 MemoryChunk* chunk = MemoryChunk::FromAddress(object->address()); | 299 MemoryChunk* chunk = MemoryChunk::FromAddress(object->address()); |
304 SlotsBuffer::RemoveInvalidSlots(heap_, chunk->slots_buffer()); | 300 SlotsBuffer::RemoveInvalidSlots(heap_, chunk->slots_buffer()); |
305 } | 301 } |
306 } | 302 } |
307 | 303 |
308 | 304 |
309 #ifdef VERIFY_HEAP | 305 #ifdef VERIFY_HEAP |
310 static void VerifyValidSlotsBufferEntries(Heap* heap, PagedSpace* space) { | 306 static void VerifyValidSlotsBufferEntries(Heap* heap, PagedSpace* space) { |
311 PageIterator it(space); | 307 PageIterator it(space); |
312 while (it.has_next()) { | 308 while (it.has_next()) { |
313 Page* p = it.next(); | 309 Page* p = it.next(); |
314 SlotsBuffer::VerifySlots(heap, p->slots_buffer()); | 310 SlotsBuffer::VerifySlots(heap, p->slots_buffer()); |
315 } | 311 } |
316 } | 312 } |
317 | 313 |
318 | 314 |
319 static void VerifyValidStoreAndSlotsBufferEntries(Heap* heap) { | 315 static void VerifyValidStoreAndSlotsBufferEntries(Heap* heap) { |
320 heap->store_buffer()->VerifyValidStoreBufferEntries(); | 316 heap->store_buffer()->VerifyValidStoreBufferEntries(); |
321 | 317 |
322 VerifyValidSlotsBufferEntries(heap, heap->old_space()); | 318 VerifyValidSlotsBufferEntries(heap, heap->old_space()); |
323 VerifyValidSlotsBufferEntries(heap, heap->code_space()); | 319 VerifyValidSlotsBufferEntries(heap, heap->code_space()); |
324 VerifyValidSlotsBufferEntries(heap, heap->cell_space()); | |
325 VerifyValidSlotsBufferEntries(heap, heap->map_space()); | 320 VerifyValidSlotsBufferEntries(heap, heap->map_space()); |
326 | 321 |
327 LargeObjectIterator it(heap->lo_space()); | 322 LargeObjectIterator it(heap->lo_space()); |
328 for (HeapObject* object = it.Next(); object != NULL; object = it.Next()) { | 323 for (HeapObject* object = it.Next(); object != NULL; object = it.Next()) { |
329 MemoryChunk* chunk = MemoryChunk::FromAddress(object->address()); | 324 MemoryChunk* chunk = MemoryChunk::FromAddress(object->address()); |
330 SlotsBuffer::VerifySlots(heap, chunk->slots_buffer()); | 325 SlotsBuffer::VerifySlots(heap, chunk->slots_buffer()); |
331 } | 326 } |
332 } | 327 } |
333 #endif | 328 #endif |
334 | 329 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 NewSpacePage* p = it.next(); | 400 NewSpacePage* p = it.next(); |
406 CHECK(p->markbits()->IsClean()); | 401 CHECK(p->markbits()->IsClean()); |
407 CHECK_EQ(0, p->LiveBytes()); | 402 CHECK_EQ(0, p->LiveBytes()); |
408 } | 403 } |
409 } | 404 } |
410 | 405 |
411 | 406 |
412 void MarkCompactCollector::VerifyMarkbitsAreClean() { | 407 void MarkCompactCollector::VerifyMarkbitsAreClean() { |
413 VerifyMarkbitsAreClean(heap_->old_space()); | 408 VerifyMarkbitsAreClean(heap_->old_space()); |
414 VerifyMarkbitsAreClean(heap_->code_space()); | 409 VerifyMarkbitsAreClean(heap_->code_space()); |
415 VerifyMarkbitsAreClean(heap_->cell_space()); | |
416 VerifyMarkbitsAreClean(heap_->map_space()); | 410 VerifyMarkbitsAreClean(heap_->map_space()); |
417 VerifyMarkbitsAreClean(heap_->new_space()); | 411 VerifyMarkbitsAreClean(heap_->new_space()); |
418 | 412 |
419 LargeObjectIterator it(heap_->lo_space()); | 413 LargeObjectIterator it(heap_->lo_space()); |
420 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { | 414 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { |
421 MarkBit mark_bit = Marking::MarkBitFrom(obj); | 415 MarkBit mark_bit = Marking::MarkBitFrom(obj); |
422 CHECK(Marking::IsWhite(mark_bit)); | 416 CHECK(Marking::IsWhite(mark_bit)); |
423 CHECK_EQ(0, Page::FromAddress(obj->address())->LiveBytes()); | 417 CHECK_EQ(0, Page::FromAddress(obj->address())->LiveBytes()); |
424 } | 418 } |
425 } | 419 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 while (it.has_next()) { | 456 while (it.has_next()) { |
463 Bitmap::Clear(it.next()); | 457 Bitmap::Clear(it.next()); |
464 } | 458 } |
465 } | 459 } |
466 | 460 |
467 | 461 |
468 void MarkCompactCollector::ClearMarkbits() { | 462 void MarkCompactCollector::ClearMarkbits() { |
469 ClearMarkbitsInPagedSpace(heap_->code_space()); | 463 ClearMarkbitsInPagedSpace(heap_->code_space()); |
470 ClearMarkbitsInPagedSpace(heap_->map_space()); | 464 ClearMarkbitsInPagedSpace(heap_->map_space()); |
471 ClearMarkbitsInPagedSpace(heap_->old_space()); | 465 ClearMarkbitsInPagedSpace(heap_->old_space()); |
472 ClearMarkbitsInPagedSpace(heap_->cell_space()); | |
473 ClearMarkbitsInNewSpace(heap_->new_space()); | 466 ClearMarkbitsInNewSpace(heap_->new_space()); |
474 | 467 |
475 LargeObjectIterator it(heap_->lo_space()); | 468 LargeObjectIterator it(heap_->lo_space()); |
476 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { | 469 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { |
477 MarkBit mark_bit = Marking::MarkBitFrom(obj); | 470 MarkBit mark_bit = Marking::MarkBitFrom(obj); |
478 mark_bit.Clear(); | 471 mark_bit.Clear(); |
479 mark_bit.Next().Clear(); | 472 mark_bit.Next().Clear(); |
480 Page::FromAddress(obj->address())->ResetProgressBar(); | 473 Page::FromAddress(obj->address())->ResetProgressBar(); |
481 Page::FromAddress(obj->address())->ResetLiveBytes(); | 474 Page::FromAddress(obj->address())->ResetLiveBytes(); |
482 } | 475 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 const char* AllocationSpaceName(AllocationSpace space) { | 599 const char* AllocationSpaceName(AllocationSpace space) { |
607 switch (space) { | 600 switch (space) { |
608 case NEW_SPACE: | 601 case NEW_SPACE: |
609 return "NEW_SPACE"; | 602 return "NEW_SPACE"; |
610 case OLD_SPACE: | 603 case OLD_SPACE: |
611 return "OLD_SPACE"; | 604 return "OLD_SPACE"; |
612 case CODE_SPACE: | 605 case CODE_SPACE: |
613 return "CODE_SPACE"; | 606 return "CODE_SPACE"; |
614 case MAP_SPACE: | 607 case MAP_SPACE: |
615 return "MAP_SPACE"; | 608 return "MAP_SPACE"; |
616 case CELL_SPACE: | |
617 return "CELL_SPACE"; | |
618 case LO_SPACE: | 609 case LO_SPACE: |
619 return "LO_SPACE"; | 610 return "LO_SPACE"; |
620 default: | 611 default: |
621 UNREACHABLE(); | 612 UNREACHABLE(); |
622 } | 613 } |
623 | 614 |
624 return NULL; | 615 return NULL; |
625 } | 616 } |
626 | 617 |
627 | 618 |
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2086 | 2077 |
2087 DiscoverGreyObjectsInSpace(heap(), &marking_deque_, heap()->old_space()); | 2078 DiscoverGreyObjectsInSpace(heap(), &marking_deque_, heap()->old_space()); |
2088 if (marking_deque_.IsFull()) return; | 2079 if (marking_deque_.IsFull()) return; |
2089 | 2080 |
2090 DiscoverGreyObjectsInSpace(heap(), &marking_deque_, heap()->code_space()); | 2081 DiscoverGreyObjectsInSpace(heap(), &marking_deque_, heap()->code_space()); |
2091 if (marking_deque_.IsFull()) return; | 2082 if (marking_deque_.IsFull()) return; |
2092 | 2083 |
2093 DiscoverGreyObjectsInSpace(heap(), &marking_deque_, heap()->map_space()); | 2084 DiscoverGreyObjectsInSpace(heap(), &marking_deque_, heap()->map_space()); |
2094 if (marking_deque_.IsFull()) return; | 2085 if (marking_deque_.IsFull()) return; |
2095 | 2086 |
2096 DiscoverGreyObjectsInSpace(heap(), &marking_deque_, heap()->cell_space()); | |
2097 if (marking_deque_.IsFull()) return; | |
2098 | |
2099 LargeObjectIterator lo_it(heap()->lo_space()); | 2087 LargeObjectIterator lo_it(heap()->lo_space()); |
2100 DiscoverGreyObjectsWithIterator(heap(), &marking_deque_, &lo_it); | 2088 DiscoverGreyObjectsWithIterator(heap(), &marking_deque_, &lo_it); |
2101 if (marking_deque_.IsFull()) return; | 2089 if (marking_deque_.IsFull()) return; |
2102 | 2090 |
2103 marking_deque_.ClearOverflowed(); | 2091 marking_deque_.ClearOverflowed(); |
2104 } | 2092 } |
2105 | 2093 |
2106 | 2094 |
2107 // Mark all objects reachable (transitively) from objects on the marking | 2095 // Mark all objects reachable (transitively) from objects on the marking |
2108 // stack. Before: the marking stack contains zero or more heap object | 2096 // stack. Before: the marking stack contains zero or more heap object |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2279 | 2267 |
2280 #ifdef DEBUG | 2268 #ifdef DEBUG |
2281 DCHECK(state_ == PREPARE_GC); | 2269 DCHECK(state_ == PREPARE_GC); |
2282 state_ = MARK_LIVE_OBJECTS; | 2270 state_ = MARK_LIVE_OBJECTS; |
2283 #endif | 2271 #endif |
2284 | 2272 |
2285 EnsureMarkingDequeIsCommittedAndInitialize(); | 2273 EnsureMarkingDequeIsCommittedAndInitialize(); |
2286 | 2274 |
2287 PrepareForCodeFlushing(); | 2275 PrepareForCodeFlushing(); |
2288 | 2276 |
2289 if (was_marked_incrementally_) { | |
2290 // There is no write barrier on cells so we have to scan them now at the end | |
2291 // of the incremental marking. | |
2292 { | |
2293 HeapObjectIterator cell_iterator(heap()->cell_space()); | |
2294 HeapObject* cell; | |
2295 while ((cell = cell_iterator.Next()) != NULL) { | |
2296 DCHECK(cell->IsCell()); | |
2297 if (IsMarked(cell)) { | |
2298 int offset = Cell::kValueOffset; | |
2299 MarkCompactMarkingVisitor::VisitPointer( | |
2300 heap(), reinterpret_cast<Object**>(cell->address() + offset)); | |
2301 } | |
2302 } | |
2303 } | |
2304 } | |
2305 | |
2306 RootMarkingVisitor root_visitor(heap()); | 2277 RootMarkingVisitor root_visitor(heap()); |
2307 MarkRoots(&root_visitor); | 2278 MarkRoots(&root_visitor); |
2308 | 2279 |
2309 ProcessTopOptimizedFrame(&root_visitor); | 2280 ProcessTopOptimizedFrame(&root_visitor); |
2310 | 2281 |
2311 // Retaining dying maps should happen before or during ephemeral marking | 2282 // Retaining dying maps should happen before or during ephemeral marking |
2312 // because a map could keep the key of an ephemeron alive. Note that map | 2283 // because a map could keep the key of an ephemeron alive. Note that map |
2313 // aging is imprecise: maps that are kept alive only by ephemerons will age. | 2284 // aging is imprecise: maps that are kept alive only by ephemerons will age. |
2314 RetainMaps(); | 2285 RetainMaps(); |
2315 | 2286 |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2848 class PointersUpdatingVisitor : public ObjectVisitor { | 2819 class PointersUpdatingVisitor : public ObjectVisitor { |
2849 public: | 2820 public: |
2850 explicit PointersUpdatingVisitor(Heap* heap) : heap_(heap) {} | 2821 explicit PointersUpdatingVisitor(Heap* heap) : heap_(heap) {} |
2851 | 2822 |
2852 void VisitPointer(Object** p) { UpdatePointer(p); } | 2823 void VisitPointer(Object** p) { UpdatePointer(p); } |
2853 | 2824 |
2854 void VisitPointers(Object** start, Object** end) { | 2825 void VisitPointers(Object** start, Object** end) { |
2855 for (Object** p = start; p < end; p++) UpdatePointer(p); | 2826 for (Object** p = start; p < end; p++) UpdatePointer(p); |
2856 } | 2827 } |
2857 | 2828 |
| 2829 void VisitCell(RelocInfo* rinfo) { |
| 2830 DCHECK(rinfo->rmode() == RelocInfo::CELL); |
| 2831 Object* cell = rinfo->target_cell(); |
| 2832 Object* old_cell = cell; |
| 2833 VisitPointer(&cell); |
| 2834 if (cell != old_cell) { |
| 2835 rinfo->set_target_cell(reinterpret_cast<Cell*>(cell)); |
| 2836 } |
| 2837 } |
| 2838 |
2858 void VisitEmbeddedPointer(RelocInfo* rinfo) { | 2839 void VisitEmbeddedPointer(RelocInfo* rinfo) { |
2859 DCHECK(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); | 2840 DCHECK(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); |
2860 Object* target = rinfo->target_object(); | 2841 Object* target = rinfo->target_object(); |
2861 Object* old_target = target; | 2842 Object* old_target = target; |
2862 VisitPointer(&target); | 2843 VisitPointer(&target); |
2863 // Avoid unnecessary changes that might unnecessary flush the instruction | 2844 // Avoid unnecessary changes that might unnecessary flush the instruction |
2864 // cache. | 2845 // cache. |
2865 if (target != old_target) { | 2846 if (target != old_target) { |
2866 rinfo->set_target_object(target); | 2847 rinfo->set_target_object(target); |
2867 } | 2848 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2956 if (heap->new_space()->ToSpaceContains(slot_address)) { | 2937 if (heap->new_space()->ToSpaceContains(slot_address)) { |
2957 space_owner_id = 1; | 2938 space_owner_id = 1; |
2958 } else if (heap->new_space()->FromSpaceContains(slot_address)) { | 2939 } else if (heap->new_space()->FromSpaceContains(slot_address)) { |
2959 space_owner_id = 2; | 2940 space_owner_id = 2; |
2960 } else if (heap->old_space()->ContainsSafe(slot_address)) { | 2941 } else if (heap->old_space()->ContainsSafe(slot_address)) { |
2961 space_owner_id = 3; | 2942 space_owner_id = 3; |
2962 } else if (heap->code_space()->ContainsSafe(slot_address)) { | 2943 } else if (heap->code_space()->ContainsSafe(slot_address)) { |
2963 space_owner_id = 4; | 2944 space_owner_id = 4; |
2964 } else if (heap->map_space()->ContainsSafe(slot_address)) { | 2945 } else if (heap->map_space()->ContainsSafe(slot_address)) { |
2965 space_owner_id = 5; | 2946 space_owner_id = 5; |
2966 } else if (heap->cell_space()->ContainsSafe(slot_address)) { | |
2967 space_owner_id = 6; | |
2968 } else { | 2947 } else { |
2969 // Lo space or other. | 2948 // Lo space or other. |
2970 space_owner_id = 7; | 2949 space_owner_id = 6; |
2971 } | 2950 } |
2972 data[index++] = space_owner_id; | 2951 data[index++] = space_owner_id; |
2973 data[index++] = 0x20aaaaaaaaUL; | 2952 data[index++] = 0x20aaaaaaaaUL; |
2974 | 2953 |
2975 // Find map word lying near before the slot address (usually the map word is | 2954 // Find map word lying near before the slot address (usually the map word is |
2976 // at -3 words from the slot but just in case we look up further. | 2955 // at -3 words from the slot but just in case we look up further. |
2977 Object** map_slot = slot; | 2956 Object** map_slot = slot; |
2978 bool found = false; | 2957 bool found = false; |
2979 const int kMaxDistanceToMap = 64; | 2958 const int kMaxDistanceToMap = 64; |
2980 for (int i = 0; i < kMaxDistanceToMap; i++, map_slot--) { | 2959 for (int i = 0; i < kMaxDistanceToMap; i++, map_slot--) { |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3388 | 3367 |
3389 | 3368 |
3390 static inline void UpdateSlot(Isolate* isolate, ObjectVisitor* v, | 3369 static inline void UpdateSlot(Isolate* isolate, ObjectVisitor* v, |
3391 SlotsBuffer::SlotType slot_type, Address addr) { | 3370 SlotsBuffer::SlotType slot_type, Address addr) { |
3392 switch (slot_type) { | 3371 switch (slot_type) { |
3393 case SlotsBuffer::CODE_TARGET_SLOT: { | 3372 case SlotsBuffer::CODE_TARGET_SLOT: { |
3394 RelocInfo rinfo(addr, RelocInfo::CODE_TARGET, 0, NULL); | 3373 RelocInfo rinfo(addr, RelocInfo::CODE_TARGET, 0, NULL); |
3395 rinfo.Visit(isolate, v); | 3374 rinfo.Visit(isolate, v); |
3396 break; | 3375 break; |
3397 } | 3376 } |
| 3377 case SlotsBuffer::CELL_TARGET_SLOT: { |
| 3378 RelocInfo rinfo(addr, RelocInfo::CELL, 0, NULL); |
| 3379 rinfo.Visit(isolate, v); |
| 3380 break; |
| 3381 } |
3398 case SlotsBuffer::CODE_ENTRY_SLOT: { | 3382 case SlotsBuffer::CODE_ENTRY_SLOT: { |
3399 v->VisitCodeEntry(addr); | 3383 v->VisitCodeEntry(addr); |
3400 break; | 3384 break; |
3401 } | 3385 } |
3402 case SlotsBuffer::RELOCATED_CODE_OBJECT: { | 3386 case SlotsBuffer::RELOCATED_CODE_OBJECT: { |
3403 HeapObject* obj = HeapObject::FromAddress(addr); | 3387 HeapObject* obj = HeapObject::FromAddress(addr); |
3404 Code::cast(obj)->CodeIterateBody(v); | 3388 Code::cast(obj)->CodeIterateBody(v); |
3405 break; | 3389 break; |
3406 } | 3390 } |
3407 case SlotsBuffer::DEBUG_TARGET_SLOT: { | 3391 case SlotsBuffer::DEBUG_TARGET_SLOT: { |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3785 UNREACHABLE(); | 3769 UNREACHABLE(); |
3786 break; | 3770 break; |
3787 } | 3771 } |
3788 } | 3772 } |
3789 } | 3773 } |
3790 } | 3774 } |
3791 | 3775 |
3792 GCTracer::Scope gc_scope(heap()->tracer(), | 3776 GCTracer::Scope gc_scope(heap()->tracer(), |
3793 GCTracer::Scope::MC_UPDATE_MISC_POINTERS); | 3777 GCTracer::Scope::MC_UPDATE_MISC_POINTERS); |
3794 | 3778 |
3795 // Update pointers from cells. | |
3796 HeapObjectIterator cell_iterator(heap_->cell_space()); | |
3797 for (HeapObject* cell = cell_iterator.Next(); cell != NULL; | |
3798 cell = cell_iterator.Next()) { | |
3799 if (cell->IsCell()) { | |
3800 Cell::BodyDescriptor::IterateBody(cell, &updating_visitor); | |
3801 } | |
3802 } | |
3803 | |
3804 heap_->string_table()->Iterate(&updating_visitor); | 3779 heap_->string_table()->Iterate(&updating_visitor); |
3805 | 3780 |
3806 // Update pointers from external string table. | 3781 // Update pointers from external string table. |
3807 heap_->UpdateReferencesInExternalStringTable( | 3782 heap_->UpdateReferencesInExternalStringTable( |
3808 &UpdateReferenceInExternalStringTableEntry); | 3783 &UpdateReferenceInExternalStringTableEntry); |
3809 | 3784 |
3810 EvacuationWeakObjectRetainer evacuation_object_retainer; | 3785 EvacuationWeakObjectRetainer evacuation_object_retainer; |
3811 heap()->ProcessAllWeakReferences(&evacuation_object_retainer); | 3786 heap()->ProcessAllWeakReferences(&evacuation_object_retainer); |
3812 | 3787 |
3813 // Collects callback info for handles that are pending (about to be | 3788 // Collects callback info for handles that are pending (about to be |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4408 } | 4383 } |
4409 } | 4384 } |
4410 RemoveDeadInvalidatedCode(); | 4385 RemoveDeadInvalidatedCode(); |
4411 | 4386 |
4412 { | 4387 { |
4413 GCTracer::Scope sweep_scope(heap()->tracer(), | 4388 GCTracer::Scope sweep_scope(heap()->tracer(), |
4414 GCTracer::Scope::MC_SWEEP_CODE); | 4389 GCTracer::Scope::MC_SWEEP_CODE); |
4415 SweepSpace(heap()->code_space(), SEQUENTIAL_SWEEPING); | 4390 SweepSpace(heap()->code_space(), SEQUENTIAL_SWEEPING); |
4416 } | 4391 } |
4417 | 4392 |
4418 { | |
4419 GCTracer::Scope sweep_scope(heap()->tracer(), | |
4420 GCTracer::Scope::MC_SWEEP_CELL); | |
4421 SweepSpace(heap()->cell_space(), SEQUENTIAL_SWEEPING); | |
4422 } | |
4423 | |
4424 EvacuateNewSpaceAndCandidates(); | 4393 EvacuateNewSpaceAndCandidates(); |
4425 | 4394 |
4426 // ClearNonLiveReferences depends on precise sweeping of map space to | 4395 // ClearNonLiveReferences depends on precise sweeping of map space to |
4427 // detect whether unmarked map became dead in this collection or in one | 4396 // detect whether unmarked map became dead in this collection or in one |
4428 // of the previous ones. | 4397 // of the previous ones. |
4429 { | 4398 { |
4430 GCTracer::Scope sweep_scope(heap()->tracer(), | 4399 GCTracer::Scope sweep_scope(heap()->tracer(), |
4431 GCTracer::Scope::MC_SWEEP_MAP); | 4400 GCTracer::Scope::MC_SWEEP_MAP); |
4432 SweepSpace(heap()->map_space(), SEQUENTIAL_SWEEPING); | 4401 SweepSpace(heap()->map_space(), SEQUENTIAL_SWEEPING); |
4433 } | 4402 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4592 } | 4561 } |
4593 } | 4562 } |
4594 buffer = buffer->next(); | 4563 buffer = buffer->next(); |
4595 } | 4564 } |
4596 } | 4565 } |
4597 | 4566 |
4598 | 4567 |
4599 static inline SlotsBuffer::SlotType SlotTypeForRMode(RelocInfo::Mode rmode) { | 4568 static inline SlotsBuffer::SlotType SlotTypeForRMode(RelocInfo::Mode rmode) { |
4600 if (RelocInfo::IsCodeTarget(rmode)) { | 4569 if (RelocInfo::IsCodeTarget(rmode)) { |
4601 return SlotsBuffer::CODE_TARGET_SLOT; | 4570 return SlotsBuffer::CODE_TARGET_SLOT; |
| 4571 } else if (RelocInfo::IsCell(rmode)) { |
| 4572 return SlotsBuffer::CELL_TARGET_SLOT; |
4602 } else if (RelocInfo::IsEmbeddedObject(rmode)) { | 4573 } else if (RelocInfo::IsEmbeddedObject(rmode)) { |
4603 return SlotsBuffer::EMBEDDED_OBJECT_SLOT; | 4574 return SlotsBuffer::EMBEDDED_OBJECT_SLOT; |
4604 } else if (RelocInfo::IsDebugBreakSlot(rmode)) { | 4575 } else if (RelocInfo::IsDebugBreakSlot(rmode)) { |
4605 return SlotsBuffer::DEBUG_TARGET_SLOT; | 4576 return SlotsBuffer::DEBUG_TARGET_SLOT; |
4606 } else if (RelocInfo::IsJSReturn(rmode)) { | 4577 } else if (RelocInfo::IsJSReturn(rmode)) { |
4607 return SlotsBuffer::JS_RETURN_SLOT; | 4578 return SlotsBuffer::JS_RETURN_SLOT; |
4608 } | 4579 } |
4609 UNREACHABLE(); | 4580 UNREACHABLE(); |
4610 return SlotsBuffer::NUMBER_OF_SLOT_TYPES; | 4581 return SlotsBuffer::NUMBER_OF_SLOT_TYPES; |
4611 } | 4582 } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4750 SlotsBuffer* buffer = *buffer_address; | 4721 SlotsBuffer* buffer = *buffer_address; |
4751 while (buffer != NULL) { | 4722 while (buffer != NULL) { |
4752 SlotsBuffer* next_buffer = buffer->next(); | 4723 SlotsBuffer* next_buffer = buffer->next(); |
4753 DeallocateBuffer(buffer); | 4724 DeallocateBuffer(buffer); |
4754 buffer = next_buffer; | 4725 buffer = next_buffer; |
4755 } | 4726 } |
4756 *buffer_address = NULL; | 4727 *buffer_address = NULL; |
4757 } | 4728 } |
4758 } | 4729 } |
4759 } // namespace v8::internal | 4730 } // namespace v8::internal |
OLD | NEW |