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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 VerifyEvacuation(heap->new_space()); | 219 VerifyEvacuation(heap->new_space()); |
220 | 220 |
221 VerifyEvacuationVisitor visitor; | 221 VerifyEvacuationVisitor visitor; |
222 heap->IterateStrongRoots(&visitor, VISIT_ALL); | 222 heap->IterateStrongRoots(&visitor, VISIT_ALL); |
223 } | 223 } |
224 #endif // VERIFY_HEAP | 224 #endif // VERIFY_HEAP |
225 | 225 |
226 | 226 |
227 void MarkCompactCollector::SetUp() { | 227 void MarkCompactCollector::SetUp() { |
228 free_list_old_space_.Reset(new FreeList(heap_->old_space())); | 228 free_list_old_space_.Reset(new FreeList(heap_->old_space())); |
229 free_list_code_space_.Reset(new FreeList(heap_->code_space())); | |
230 EnsureMarkingDequeIsReserved(); | 229 EnsureMarkingDequeIsReserved(); |
231 EnsureMarkingDequeIsCommitted(kMinMarkingDequeSize); | 230 EnsureMarkingDequeIsCommitted(kMinMarkingDequeSize); |
232 } | 231 } |
233 | 232 |
234 | 233 |
235 void MarkCompactCollector::TearDown() { | 234 void MarkCompactCollector::TearDown() { |
236 AbortCompaction(); | 235 AbortCompaction(); |
237 delete marking_deque_memory_; | 236 delete marking_deque_memory_; |
238 } | 237 } |
239 | 238 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 ClearInvalidStoreAndSlotsBufferEntries(); | 359 ClearInvalidStoreAndSlotsBufferEntries(); |
361 | 360 |
362 #ifdef VERIFY_HEAP | 361 #ifdef VERIFY_HEAP |
363 if (FLAG_verify_heap) { | 362 if (FLAG_verify_heap) { |
364 VerifyValidStoreAndSlotsBufferEntries(heap_); | 363 VerifyValidStoreAndSlotsBufferEntries(heap_); |
365 } | 364 } |
366 #endif | 365 #endif |
367 | 366 |
368 SweepSpaces(); | 367 SweepSpaces(); |
369 | 368 |
| 369 #ifdef VERIFY_HEAP |
| 370 VerifyWeakEmbeddedObjectsInCode(); |
| 371 if (FLAG_omit_map_checks_for_leaf_maps) { |
| 372 VerifyOmittedMapChecks(); |
| 373 } |
| 374 #endif |
| 375 |
370 Finish(); | 376 Finish(); |
371 | 377 |
372 if (marking_parity_ == EVEN_MARKING_PARITY) { | 378 if (marking_parity_ == EVEN_MARKING_PARITY) { |
373 marking_parity_ = ODD_MARKING_PARITY; | 379 marking_parity_ = ODD_MARKING_PARITY; |
374 } else { | 380 } else { |
375 DCHECK(marking_parity_ == ODD_MARKING_PARITY); | 381 DCHECK(marking_parity_ == ODD_MARKING_PARITY); |
376 marking_parity_ = EVEN_MARKING_PARITY; | 382 marking_parity_ = EVEN_MARKING_PARITY; |
377 } | 383 } |
378 } | 384 } |
379 | 385 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 | 492 |
487 Heap* heap_; | 493 Heap* heap_; |
488 PagedSpace* space_; | 494 PagedSpace* space_; |
489 | 495 |
490 DISALLOW_COPY_AND_ASSIGN(SweeperTask); | 496 DISALLOW_COPY_AND_ASSIGN(SweeperTask); |
491 }; | 497 }; |
492 | 498 |
493 | 499 |
494 void MarkCompactCollector::StartSweeperThreads() { | 500 void MarkCompactCollector::StartSweeperThreads() { |
495 DCHECK(free_list_old_space_.get()->IsEmpty()); | 501 DCHECK(free_list_old_space_.get()->IsEmpty()); |
496 DCHECK(free_list_code_space_.get()->IsEmpty()); | |
497 V8::GetCurrentPlatform()->CallOnBackgroundThread( | 502 V8::GetCurrentPlatform()->CallOnBackgroundThread( |
498 new SweeperTask(heap(), heap()->old_space()), | 503 new SweeperTask(heap(), heap()->old_space()), |
499 v8::Platform::kShortRunningTask); | 504 v8::Platform::kShortRunningTask); |
500 V8::GetCurrentPlatform()->CallOnBackgroundThread( | |
501 new SweeperTask(heap(), heap()->code_space()), | |
502 v8::Platform::kShortRunningTask); | |
503 } | 505 } |
504 | 506 |
505 | 507 |
506 void MarkCompactCollector::EnsureSweepingCompleted() { | 508 void MarkCompactCollector::EnsureSweepingCompleted() { |
507 DCHECK(sweeping_in_progress_ == true); | 509 DCHECK(sweeping_in_progress_ == true); |
508 | 510 |
509 // If sweeping is not completed or not running at all, we try to complete it | 511 // If sweeping is not completed or not running at all, we try to complete it |
510 // here. | 512 // here. |
511 if (!heap()->concurrent_sweeping_enabled() || !IsSweepingCompleted()) { | 513 if (!heap()->concurrent_sweeping_enabled() || !IsSweepingCompleted()) { |
512 SweepInParallel(heap()->paged_space(OLD_SPACE), 0); | 514 SweepInParallel(heap()->paged_space(OLD_SPACE), 0); |
513 SweepInParallel(heap()->paged_space(CODE_SPACE), 0); | |
514 } | 515 } |
515 // Wait twice for both jobs. | 516 // Wait twice for both jobs. |
516 if (heap()->concurrent_sweeping_enabled()) { | 517 if (heap()->concurrent_sweeping_enabled()) { |
517 pending_sweeper_jobs_semaphore_.Wait(); | 518 pending_sweeper_jobs_semaphore_.Wait(); |
518 pending_sweeper_jobs_semaphore_.Wait(); | |
519 } | 519 } |
520 ParallelSweepSpacesComplete(); | 520 ParallelSweepSpacesComplete(); |
521 sweeping_in_progress_ = false; | 521 sweeping_in_progress_ = false; |
522 RefillFreeList(heap()->paged_space(OLD_SPACE)); | 522 RefillFreeList(heap()->paged_space(OLD_SPACE)); |
523 RefillFreeList(heap()->paged_space(CODE_SPACE)); | |
524 heap()->paged_space(OLD_SPACE)->ResetUnsweptFreeBytes(); | 523 heap()->paged_space(OLD_SPACE)->ResetUnsweptFreeBytes(); |
525 heap()->paged_space(CODE_SPACE)->ResetUnsweptFreeBytes(); | |
526 | 524 |
527 #ifdef VERIFY_HEAP | 525 #ifdef VERIFY_HEAP |
528 if (FLAG_verify_heap && !evacuation()) { | 526 if (FLAG_verify_heap && !evacuation()) { |
529 VerifyEvacuation(heap_); | 527 VerifyEvacuation(heap_); |
530 } | 528 } |
531 #endif | 529 #endif |
532 } | 530 } |
533 | 531 |
534 | 532 |
535 void MarkCompactCollector::EnsureSweepingCompleted(Page* page, | |
536 PagedSpace* space) { | |
537 if (!page->SweepingCompleted()) { | |
538 SweepInParallel(page, space); | |
539 if (!page->SweepingCompleted()) { | |
540 // We were not able to sweep that page, i.e., a concurrent | |
541 // sweeper thread currently owns this page. | |
542 // TODO(hpayer): This may introduce a huge pause here. We | |
543 // just care about finish sweeping of the scan on scavenge page. | |
544 EnsureSweepingCompleted(); | |
545 } | |
546 } | |
547 } | |
548 | |
549 | |
550 bool MarkCompactCollector::IsSweepingCompleted() { | 533 bool MarkCompactCollector::IsSweepingCompleted() { |
551 if (!pending_sweeper_jobs_semaphore_.WaitFor( | 534 if (!pending_sweeper_jobs_semaphore_.WaitFor( |
552 base::TimeDelta::FromSeconds(0))) { | 535 base::TimeDelta::FromSeconds(0))) { |
553 return false; | 536 return false; |
554 } | 537 } |
555 pending_sweeper_jobs_semaphore_.Signal(); | 538 pending_sweeper_jobs_semaphore_.Signal(); |
556 return true; | 539 return true; |
557 } | 540 } |
558 | 541 |
559 | 542 |
560 void MarkCompactCollector::RefillFreeList(PagedSpace* space) { | 543 void MarkCompactCollector::RefillFreeList(PagedSpace* space) { |
561 FreeList* free_list; | 544 FreeList* free_list; |
562 | 545 |
563 if (space == heap()->old_space()) { | 546 if (space == heap()->old_space()) { |
564 free_list = free_list_old_space_.get(); | 547 free_list = free_list_old_space_.get(); |
565 } else if (space == heap()->code_space()) { | |
566 free_list = free_list_code_space_.get(); | |
567 } else { | 548 } else { |
568 // Any PagedSpace might invoke RefillFreeLists, so we need to make sure | 549 // Any PagedSpace might invoke RefillFreeLists, so we need to make sure |
569 // to only refill them for the old space. | 550 // to only refill them for the old space. |
570 return; | 551 return; |
571 } | 552 } |
572 | 553 |
573 intptr_t freed_bytes = space->free_list()->Concatenate(free_list); | 554 intptr_t freed_bytes = space->free_list()->Concatenate(free_list); |
574 space->AddToAccountingStats(freed_bytes); | 555 space->AddToAccountingStats(freed_bytes); |
575 space->DecrementUnsweptFreeBytes(freed_bytes); | 556 space->DecrementUnsweptFreeBytes(freed_bytes); |
576 } | 557 } |
(...skipping 2928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3505 DCHECK_EQ(skip_list_mode == REBUILD_SKIP_LIST, | 3486 DCHECK_EQ(skip_list_mode == REBUILD_SKIP_LIST, |
3506 space->identity() == CODE_SPACE); | 3487 space->identity() == CODE_SPACE); |
3507 DCHECK((p->skip_list() == NULL) || (skip_list_mode == REBUILD_SKIP_LIST)); | 3488 DCHECK((p->skip_list() == NULL) || (skip_list_mode == REBUILD_SKIP_LIST)); |
3508 DCHECK(parallelism == MarkCompactCollector::SWEEP_ON_MAIN_THREAD || | 3489 DCHECK(parallelism == MarkCompactCollector::SWEEP_ON_MAIN_THREAD || |
3509 sweeping_mode == SWEEP_ONLY); | 3490 sweeping_mode == SWEEP_ONLY); |
3510 | 3491 |
3511 Address free_start = p->area_start(); | 3492 Address free_start = p->area_start(); |
3512 DCHECK(reinterpret_cast<intptr_t>(free_start) % (32 * kPointerSize) == 0); | 3493 DCHECK(reinterpret_cast<intptr_t>(free_start) % (32 * kPointerSize) == 0); |
3513 int offsets[16]; | 3494 int offsets[16]; |
3514 | 3495 |
3515 // If we use the skip list for code space pages, we have to lock the skip | |
3516 // list because it could be accessed concurrently by the runtime or the | |
3517 // deoptimizer. | |
3518 SkipList* skip_list = p->skip_list(); | 3496 SkipList* skip_list = p->skip_list(); |
| 3497 int curr_region = -1; |
3519 if ((skip_list_mode == REBUILD_SKIP_LIST) && skip_list) { | 3498 if ((skip_list_mode == REBUILD_SKIP_LIST) && skip_list) { |
3520 skip_list->Clear(); | 3499 skip_list->Clear(); |
3521 } | 3500 } |
3522 | 3501 |
3523 intptr_t freed_bytes = 0; | 3502 intptr_t freed_bytes = 0; |
3524 intptr_t max_freed_bytes = 0; | 3503 intptr_t max_freed_bytes = 0; |
3525 int curr_region = -1; | |
3526 | 3504 |
3527 for (MarkBitCellIterator it(p); !it.Done(); it.Advance()) { | 3505 for (MarkBitCellIterator it(p); !it.Done(); it.Advance()) { |
3528 Address cell_base = it.CurrentCellBase(); | 3506 Address cell_base = it.CurrentCellBase(); |
3529 MarkBit::CellType* cell = it.CurrentCell(); | 3507 MarkBit::CellType* cell = it.CurrentCell(); |
3530 int live_objects = MarkWordToObjectStarts(*cell, offsets); | 3508 int live_objects = MarkWordToObjectStarts(*cell, offsets); |
3531 int live_index = 0; | 3509 int live_index = 0; |
3532 for (; live_objects != 0; live_objects--) { | 3510 for (; live_objects != 0; live_objects--) { |
3533 Address free_end = cell_base + offsets[live_index++] * kPointerSize; | 3511 Address free_end = cell_base + offsets[live_index++] * kPointerSize; |
3534 if (free_end != free_start) { | 3512 if (free_end != free_start) { |
3535 int size = static_cast<int>(free_end - free_start); | 3513 int size = static_cast<int>(free_end - free_start); |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4179 max_freed_overall = Max(max_freed, max_freed_overall); | 4157 max_freed_overall = Max(max_freed, max_freed_overall); |
4180 if (p == space->end_of_unswept_pages()) break; | 4158 if (p == space->end_of_unswept_pages()) break; |
4181 } | 4159 } |
4182 return max_freed_overall; | 4160 return max_freed_overall; |
4183 } | 4161 } |
4184 | 4162 |
4185 | 4163 |
4186 int MarkCompactCollector::SweepInParallel(Page* page, PagedSpace* space) { | 4164 int MarkCompactCollector::SweepInParallel(Page* page, PagedSpace* space) { |
4187 int max_freed = 0; | 4165 int max_freed = 0; |
4188 if (page->TryParallelSweeping()) { | 4166 if (page->TryParallelSweeping()) { |
4189 FreeList* free_list; | 4167 FreeList* free_list = free_list_old_space_.get(); |
4190 FreeList private_free_list(space); | 4168 FreeList private_free_list(space); |
4191 if (space->identity() == CODE_SPACE) { | 4169 max_freed = Sweep<SWEEP_ONLY, SWEEP_IN_PARALLEL, IGNORE_SKIP_LIST, |
4192 free_list = free_list_code_space_.get(); | 4170 IGNORE_FREE_SPACE>(space, &private_free_list, page, NULL); |
4193 max_freed = | |
4194 Sweep<SWEEP_ONLY, SWEEP_IN_PARALLEL, REBUILD_SKIP_LIST, | |
4195 IGNORE_FREE_SPACE>(space, &private_free_list, page, NULL); | |
4196 } else { | |
4197 free_list = free_list_old_space_.get(); | |
4198 max_freed = | |
4199 Sweep<SWEEP_ONLY, SWEEP_IN_PARALLEL, IGNORE_SKIP_LIST, | |
4200 IGNORE_FREE_SPACE>(space, &private_free_list, page, NULL); | |
4201 } | |
4202 free_list->Concatenate(&private_free_list); | 4171 free_list->Concatenate(&private_free_list); |
4203 } | 4172 } |
4204 return max_freed; | 4173 return max_freed; |
4205 } | 4174 } |
4206 | 4175 |
4207 | 4176 |
4208 void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { | 4177 void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { |
4209 space->ClearStats(); | 4178 space->ClearStats(); |
4210 | 4179 |
4211 // We defensively initialize end_of_unswept_pages_ here with the first page | 4180 // We defensively initialize end_of_unswept_pages_ here with the first page |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4248 unused_page_present = true; | 4217 unused_page_present = true; |
4249 } | 4218 } |
4250 | 4219 |
4251 switch (sweeper) { | 4220 switch (sweeper) { |
4252 case CONCURRENT_SWEEPING: | 4221 case CONCURRENT_SWEEPING: |
4253 if (!parallel_sweeping_active) { | 4222 if (!parallel_sweeping_active) { |
4254 if (FLAG_gc_verbose) { | 4223 if (FLAG_gc_verbose) { |
4255 PrintF("Sweeping 0x%" V8PRIxPTR ".\n", | 4224 PrintF("Sweeping 0x%" V8PRIxPTR ".\n", |
4256 reinterpret_cast<intptr_t>(p)); | 4225 reinterpret_cast<intptr_t>(p)); |
4257 } | 4226 } |
4258 if (space->identity() == CODE_SPACE) { | 4227 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, IGNORE_SKIP_LIST, |
4259 if (FLAG_zap_code_space) { | 4228 IGNORE_FREE_SPACE>(space, NULL, p, NULL); |
4260 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, REBUILD_SKIP_LIST, | |
4261 ZAP_FREE_SPACE>(space, NULL, p, NULL); | |
4262 } else { | |
4263 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, REBUILD_SKIP_LIST, | |
4264 IGNORE_FREE_SPACE>(space, NULL, p, NULL); | |
4265 } | |
4266 } else { | |
4267 DCHECK(space->identity() == OLD_SPACE); | |
4268 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, IGNORE_SKIP_LIST, | |
4269 IGNORE_FREE_SPACE>(space, NULL, p, NULL); | |
4270 } | |
4271 pages_swept++; | 4229 pages_swept++; |
4272 parallel_sweeping_active = true; | 4230 parallel_sweeping_active = true; |
4273 } else { | 4231 } else { |
4274 if (FLAG_gc_verbose) { | 4232 if (FLAG_gc_verbose) { |
4275 PrintF("Sweeping 0x%" V8PRIxPTR " in parallel.\n", | 4233 PrintF("Sweeping 0x%" V8PRIxPTR " in parallel.\n", |
4276 reinterpret_cast<intptr_t>(p)); | 4234 reinterpret_cast<intptr_t>(p)); |
4277 } | 4235 } |
4278 p->set_parallel_sweeping(MemoryChunk::SWEEPING_PENDING); | 4236 p->set_parallel_sweeping(MemoryChunk::SWEEPING_PENDING); |
4279 space->IncreaseUnsweptFreeBytes(p); | 4237 space->IncreaseUnsweptFreeBytes(p); |
4280 } | 4238 } |
4281 space->set_end_of_unswept_pages(p); | 4239 space->set_end_of_unswept_pages(p); |
4282 break; | 4240 break; |
4283 case SEQUENTIAL_SWEEPING: { | 4241 case SEQUENTIAL_SWEEPING: { |
4284 if (FLAG_gc_verbose) { | 4242 if (FLAG_gc_verbose) { |
4285 PrintF("Sweeping 0x%" V8PRIxPTR ".\n", reinterpret_cast<intptr_t>(p)); | 4243 PrintF("Sweeping 0x%" V8PRIxPTR ".\n", reinterpret_cast<intptr_t>(p)); |
4286 } | 4244 } |
4287 if (space->identity() == CODE_SPACE) { | 4245 if (space->identity() == CODE_SPACE && FLAG_zap_code_space) { |
4288 if (FLAG_zap_code_space) { | 4246 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, REBUILD_SKIP_LIST, |
4289 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, REBUILD_SKIP_LIST, | 4247 ZAP_FREE_SPACE>(space, NULL, p, NULL); |
4290 ZAP_FREE_SPACE>(space, NULL, p, NULL); | 4248 } else if (space->identity() == CODE_SPACE) { |
4291 } else { | 4249 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, REBUILD_SKIP_LIST, |
4292 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, REBUILD_SKIP_LIST, | 4250 IGNORE_FREE_SPACE>(space, NULL, p, NULL); |
4293 IGNORE_FREE_SPACE>(space, NULL, p, NULL); | |
4294 } | |
4295 } else { | 4251 } else { |
4296 DCHECK(space->identity() == OLD_SPACE || | |
4297 space->identity() == MAP_SPACE); | |
4298 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, IGNORE_SKIP_LIST, | 4252 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, IGNORE_SKIP_LIST, |
4299 IGNORE_FREE_SPACE>(space, NULL, p, NULL); | 4253 IGNORE_FREE_SPACE>(space, NULL, p, NULL); |
4300 } | 4254 } |
4301 pages_swept++; | 4255 pages_swept++; |
4302 break; | 4256 break; |
4303 } | 4257 } |
4304 default: { UNREACHABLE(); } | 4258 default: { UNREACHABLE(); } |
4305 } | 4259 } |
4306 } | 4260 } |
4307 | 4261 |
(...skipping 19 matching lines...) Expand all Loading... |
4327 #endif | 4281 #endif |
4328 | 4282 |
4329 MoveEvacuationCandidatesToEndOfPagesList(); | 4283 MoveEvacuationCandidatesToEndOfPagesList(); |
4330 | 4284 |
4331 // Noncompacting collections simply sweep the spaces to clear the mark | 4285 // Noncompacting collections simply sweep the spaces to clear the mark |
4332 // bits and free the nonlive blocks (for old and map spaces). We sweep | 4286 // bits and free the nonlive blocks (for old and map spaces). We sweep |
4333 // the map space last because freeing non-live maps overwrites them and | 4287 // the map space last because freeing non-live maps overwrites them and |
4334 // the other spaces rely on possibly non-live maps to get the sizes for | 4288 // the other spaces rely on possibly non-live maps to get the sizes for |
4335 // non-live objects. | 4289 // non-live objects. |
4336 { | 4290 { |
4337 { | 4291 GCTracer::Scope sweep_scope(heap()->tracer(), |
4338 GCTracer::Scope sweep_scope(heap()->tracer(), | 4292 GCTracer::Scope::MC_SWEEP_OLDSPACE); |
4339 GCTracer::Scope::MC_SWEEP_OLDSPACE); | 4293 { SweepSpace(heap()->old_space(), CONCURRENT_SWEEPING); } |
4340 SweepSpace(heap()->old_space(), CONCURRENT_SWEEPING); | |
4341 } | |
4342 { | |
4343 GCTracer::Scope sweep_scope(heap()->tracer(), | |
4344 GCTracer::Scope::MC_SWEEP_CODE); | |
4345 SweepSpace(heap()->code_space(), CONCURRENT_SWEEPING); | |
4346 } | |
4347 | |
4348 sweeping_in_progress_ = true; | 4294 sweeping_in_progress_ = true; |
4349 if (heap()->concurrent_sweeping_enabled()) { | 4295 if (heap()->concurrent_sweeping_enabled()) { |
4350 StartSweeperThreads(); | 4296 StartSweeperThreads(); |
4351 } | 4297 } |
4352 } | 4298 } |
| 4299 { |
| 4300 GCTracer::Scope sweep_scope(heap()->tracer(), |
| 4301 GCTracer::Scope::MC_SWEEP_CODE); |
| 4302 SweepSpace(heap()->code_space(), SEQUENTIAL_SWEEPING); |
| 4303 } |
4353 | 4304 |
4354 EvacuateNewSpaceAndCandidates(); | 4305 EvacuateNewSpaceAndCandidates(); |
4355 | 4306 |
4356 heap()->FreeDeadArrayBuffers(false); | 4307 heap()->FreeDeadArrayBuffers(false); |
4357 | 4308 |
4358 // ClearNonLiveReferences depends on precise sweeping of map space to | 4309 // ClearNonLiveReferences depends on precise sweeping of map space to |
4359 // detect whether unmarked map became dead in this collection or in one | 4310 // detect whether unmarked map became dead in this collection or in one |
4360 // of the previous ones. | 4311 // of the previous ones. |
4361 { | 4312 { |
4362 GCTracer::Scope sweep_scope(heap()->tracer(), | 4313 GCTracer::Scope sweep_scope(heap()->tracer(), |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4395 p->set_parallel_sweeping(MemoryChunk::SWEEPING_DONE); | 4346 p->set_parallel_sweeping(MemoryChunk::SWEEPING_DONE); |
4396 p->SetWasSwept(); | 4347 p->SetWasSwept(); |
4397 } | 4348 } |
4398 DCHECK(p->parallel_sweeping() == MemoryChunk::SWEEPING_DONE); | 4349 DCHECK(p->parallel_sweeping() == MemoryChunk::SWEEPING_DONE); |
4399 } | 4350 } |
4400 } | 4351 } |
4401 | 4352 |
4402 | 4353 |
4403 void MarkCompactCollector::ParallelSweepSpacesComplete() { | 4354 void MarkCompactCollector::ParallelSweepSpacesComplete() { |
4404 ParallelSweepSpaceComplete(heap()->old_space()); | 4355 ParallelSweepSpaceComplete(heap()->old_space()); |
4405 ParallelSweepSpaceComplete(heap()->code_space()); | |
4406 } | 4356 } |
4407 | 4357 |
4408 | 4358 |
4409 void MarkCompactCollector::EnableCodeFlushing(bool enable) { | 4359 void MarkCompactCollector::EnableCodeFlushing(bool enable) { |
4410 if (isolate()->debug()->is_loaded() || | 4360 if (isolate()->debug()->is_loaded() || |
4411 isolate()->debug()->has_break_points()) { | 4361 isolate()->debug()->has_break_points()) { |
4412 enable = false; | 4362 enable = false; |
4413 } | 4363 } |
4414 | 4364 |
4415 if (enable) { | 4365 if (enable) { |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4695 SlotsBuffer* buffer = *buffer_address; | 4645 SlotsBuffer* buffer = *buffer_address; |
4696 while (buffer != NULL) { | 4646 while (buffer != NULL) { |
4697 SlotsBuffer* next_buffer = buffer->next(); | 4647 SlotsBuffer* next_buffer = buffer->next(); |
4698 DeallocateBuffer(buffer); | 4648 DeallocateBuffer(buffer); |
4699 buffer = next_buffer; | 4649 buffer = next_buffer; |
4700 } | 4650 } |
4701 *buffer_address = NULL; | 4651 *buffer_address = NULL; |
4702 } | 4652 } |
4703 } // namespace internal | 4653 } // namespace internal |
4704 } // namespace v8 | 4654 } // namespace v8 |
OLD | NEW |