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