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())); |
229 EnsureMarkingDequeIsReserved(); | 230 EnsureMarkingDequeIsReserved(); |
230 EnsureMarkingDequeIsCommitted(kMinMarkingDequeSize); | 231 EnsureMarkingDequeIsCommitted(kMinMarkingDequeSize); |
231 } | 232 } |
232 | 233 |
233 | 234 |
234 void MarkCompactCollector::TearDown() { | 235 void MarkCompactCollector::TearDown() { |
235 AbortCompaction(); | 236 AbortCompaction(); |
236 delete marking_deque_memory_; | 237 delete marking_deque_memory_; |
237 } | 238 } |
238 | 239 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 ClearInvalidStoreAndSlotsBufferEntries(); | 362 ClearInvalidStoreAndSlotsBufferEntries(); |
362 | 363 |
363 #ifdef VERIFY_HEAP | 364 #ifdef VERIFY_HEAP |
364 if (FLAG_verify_heap) { | 365 if (FLAG_verify_heap) { |
365 VerifyValidStoreAndSlotsBufferEntries(heap_); | 366 VerifyValidStoreAndSlotsBufferEntries(heap_); |
366 } | 367 } |
367 #endif | 368 #endif |
368 | 369 |
369 SweepSpaces(); | 370 SweepSpaces(); |
370 | 371 |
371 #ifdef VERIFY_HEAP | |
372 VerifyWeakEmbeddedObjectsInCode(); | |
373 if (FLAG_omit_map_checks_for_leaf_maps) { | |
374 VerifyOmittedMapChecks(); | |
375 } | |
376 #endif | |
377 | |
378 Finish(); | 372 Finish(); |
379 | 373 |
380 if (marking_parity_ == EVEN_MARKING_PARITY) { | 374 if (marking_parity_ == EVEN_MARKING_PARITY) { |
381 marking_parity_ = ODD_MARKING_PARITY; | 375 marking_parity_ = ODD_MARKING_PARITY; |
382 } else { | 376 } else { |
383 DCHECK(marking_parity_ == ODD_MARKING_PARITY); | 377 DCHECK(marking_parity_ == ODD_MARKING_PARITY); |
384 marking_parity_ = EVEN_MARKING_PARITY; | 378 marking_parity_ = EVEN_MARKING_PARITY; |
385 } | 379 } |
386 } | 380 } |
387 | 381 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 | 488 |
495 Heap* heap_; | 489 Heap* heap_; |
496 PagedSpace* space_; | 490 PagedSpace* space_; |
497 | 491 |
498 DISALLOW_COPY_AND_ASSIGN(SweeperTask); | 492 DISALLOW_COPY_AND_ASSIGN(SweeperTask); |
499 }; | 493 }; |
500 | 494 |
501 | 495 |
502 void MarkCompactCollector::StartSweeperThreads() { | 496 void MarkCompactCollector::StartSweeperThreads() { |
503 DCHECK(free_list_old_space_.get()->IsEmpty()); | 497 DCHECK(free_list_old_space_.get()->IsEmpty()); |
| 498 DCHECK(free_list_code_space_.get()->IsEmpty()); |
504 V8::GetCurrentPlatform()->CallOnBackgroundThread( | 499 V8::GetCurrentPlatform()->CallOnBackgroundThread( |
505 new SweeperTask(heap(), heap()->old_space()), | 500 new SweeperTask(heap(), heap()->old_space()), |
506 v8::Platform::kShortRunningTask); | 501 v8::Platform::kShortRunningTask); |
| 502 V8::GetCurrentPlatform()->CallOnBackgroundThread( |
| 503 new SweeperTask(heap(), heap()->code_space()), |
| 504 v8::Platform::kShortRunningTask); |
507 } | 505 } |
508 | 506 |
509 | 507 |
| 508 void MarkCompactCollector::SweepOrWaitUntilSweepingCompleted(Page* page) { |
| 509 PagedSpace* owner = reinterpret_cast<PagedSpace*>(page->owner()); |
| 510 if (!page->SweepingCompleted()) { |
| 511 SweepInParallel(page, owner); |
| 512 if (!page->SweepingCompleted()) { |
| 513 // We were not able to sweep that page, i.e., a concurrent |
| 514 // sweeper thread currently owns this page. Wait for the sweeper |
| 515 // thread to be done with this page. |
| 516 page->WaitUntilSweepingCompleted(); |
| 517 } |
| 518 } |
| 519 } |
| 520 |
| 521 |
510 void MarkCompactCollector::EnsureSweepingCompleted() { | 522 void MarkCompactCollector::EnsureSweepingCompleted() { |
511 DCHECK(sweeping_in_progress_ == true); | 523 DCHECK(sweeping_in_progress_ == true); |
512 | 524 |
513 // If sweeping is not completed or not running at all, we try to complete it | 525 // If sweeping is not completed or not running at all, we try to complete it |
514 // here. | 526 // here. |
515 if (!heap()->concurrent_sweeping_enabled() || !IsSweepingCompleted()) { | 527 if (!heap()->concurrent_sweeping_enabled() || !IsSweepingCompleted()) { |
516 SweepInParallel(heap()->paged_space(OLD_SPACE), 0); | 528 SweepInParallel(heap()->paged_space(OLD_SPACE), 0); |
| 529 SweepInParallel(heap()->paged_space(CODE_SPACE), 0); |
517 } | 530 } |
518 // Wait twice for both jobs. | 531 // Wait twice for both jobs. |
519 if (heap()->concurrent_sweeping_enabled()) { | 532 if (heap()->concurrent_sweeping_enabled()) { |
520 pending_sweeper_jobs_semaphore_.Wait(); | 533 pending_sweeper_jobs_semaphore_.Wait(); |
| 534 pending_sweeper_jobs_semaphore_.Wait(); |
521 } | 535 } |
522 ParallelSweepSpacesComplete(); | 536 ParallelSweepSpacesComplete(); |
523 sweeping_in_progress_ = false; | 537 sweeping_in_progress_ = false; |
524 RefillFreeList(heap()->paged_space(OLD_SPACE)); | 538 RefillFreeList(heap()->paged_space(OLD_SPACE)); |
| 539 RefillFreeList(heap()->paged_space(CODE_SPACE)); |
525 heap()->paged_space(OLD_SPACE)->ResetUnsweptFreeBytes(); | 540 heap()->paged_space(OLD_SPACE)->ResetUnsweptFreeBytes(); |
| 541 heap()->paged_space(CODE_SPACE)->ResetUnsweptFreeBytes(); |
526 | 542 |
527 #ifdef VERIFY_HEAP | 543 #ifdef VERIFY_HEAP |
528 if (FLAG_verify_heap && !evacuation()) { | 544 if (FLAG_verify_heap && !evacuation()) { |
529 VerifyEvacuation(heap_); | 545 VerifyEvacuation(heap_); |
530 } | 546 } |
531 #endif | 547 #endif |
532 } | 548 } |
533 | 549 |
534 | 550 |
535 bool MarkCompactCollector::IsSweepingCompleted() { | 551 bool MarkCompactCollector::IsSweepingCompleted() { |
536 if (!pending_sweeper_jobs_semaphore_.WaitFor( | 552 if (!pending_sweeper_jobs_semaphore_.WaitFor( |
537 base::TimeDelta::FromSeconds(0))) { | 553 base::TimeDelta::FromSeconds(0))) { |
538 return false; | 554 return false; |
539 } | 555 } |
540 pending_sweeper_jobs_semaphore_.Signal(); | 556 pending_sweeper_jobs_semaphore_.Signal(); |
541 return true; | 557 return true; |
542 } | 558 } |
543 | 559 |
544 | 560 |
545 void MarkCompactCollector::RefillFreeList(PagedSpace* space) { | 561 void MarkCompactCollector::RefillFreeList(PagedSpace* space) { |
546 FreeList* free_list; | 562 FreeList* free_list; |
547 | 563 |
548 if (space == heap()->old_space()) { | 564 if (space == heap()->old_space()) { |
549 free_list = free_list_old_space_.get(); | 565 free_list = free_list_old_space_.get(); |
| 566 } else if (space == heap()->code_space()) { |
| 567 free_list = free_list_code_space_.get(); |
550 } else { | 568 } else { |
551 // Any PagedSpace might invoke RefillFreeLists, so we need to make sure | 569 // Any PagedSpace might invoke RefillFreeLists, so we need to make sure |
552 // to only refill them for the old space. | 570 // to only refill them for the old space. |
553 return; | 571 return; |
554 } | 572 } |
555 | 573 |
556 intptr_t freed_bytes = space->free_list()->Concatenate(free_list); | 574 intptr_t freed_bytes = space->free_list()->Concatenate(free_list); |
557 space->AddToAccountingStats(freed_bytes); | 575 space->AddToAccountingStats(freed_bytes); |
558 space->DecrementUnsweptFreeBytes(freed_bytes); | 576 space->DecrementUnsweptFreeBytes(freed_bytes); |
559 } | 577 } |
(...skipping 2912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3472 DCHECK_EQ(skip_list_mode == REBUILD_SKIP_LIST, | 3490 DCHECK_EQ(skip_list_mode == REBUILD_SKIP_LIST, |
3473 space->identity() == CODE_SPACE); | 3491 space->identity() == CODE_SPACE); |
3474 DCHECK((p->skip_list() == NULL) || (skip_list_mode == REBUILD_SKIP_LIST)); | 3492 DCHECK((p->skip_list() == NULL) || (skip_list_mode == REBUILD_SKIP_LIST)); |
3475 DCHECK(parallelism == MarkCompactCollector::SWEEP_ON_MAIN_THREAD || | 3493 DCHECK(parallelism == MarkCompactCollector::SWEEP_ON_MAIN_THREAD || |
3476 sweeping_mode == SWEEP_ONLY); | 3494 sweeping_mode == SWEEP_ONLY); |
3477 | 3495 |
3478 Address free_start = p->area_start(); | 3496 Address free_start = p->area_start(); |
3479 DCHECK(reinterpret_cast<intptr_t>(free_start) % (32 * kPointerSize) == 0); | 3497 DCHECK(reinterpret_cast<intptr_t>(free_start) % (32 * kPointerSize) == 0); |
3480 int offsets[16]; | 3498 int offsets[16]; |
3481 | 3499 |
| 3500 // If we use the skip list for code space pages, we have to lock the skip |
| 3501 // list because it could be accessed concurrently by the runtime or the |
| 3502 // deoptimizer. |
3482 SkipList* skip_list = p->skip_list(); | 3503 SkipList* skip_list = p->skip_list(); |
3483 int curr_region = -1; | |
3484 if ((skip_list_mode == REBUILD_SKIP_LIST) && skip_list) { | 3504 if ((skip_list_mode == REBUILD_SKIP_LIST) && skip_list) { |
3485 skip_list->Clear(); | 3505 skip_list->Clear(); |
3486 } | 3506 } |
3487 | 3507 |
3488 intptr_t freed_bytes = 0; | 3508 intptr_t freed_bytes = 0; |
3489 intptr_t max_freed_bytes = 0; | 3509 intptr_t max_freed_bytes = 0; |
| 3510 int curr_region = -1; |
3490 | 3511 |
3491 for (MarkBitCellIterator it(p); !it.Done(); it.Advance()) { | 3512 for (MarkBitCellIterator it(p); !it.Done(); it.Advance()) { |
3492 Address cell_base = it.CurrentCellBase(); | 3513 Address cell_base = it.CurrentCellBase(); |
3493 MarkBit::CellType* cell = it.CurrentCell(); | 3514 MarkBit::CellType* cell = it.CurrentCell(); |
3494 int live_objects = MarkWordToObjectStarts(*cell, offsets); | 3515 int live_objects = MarkWordToObjectStarts(*cell, offsets); |
3495 int live_index = 0; | 3516 int live_index = 0; |
3496 for (; live_objects != 0; live_objects--) { | 3517 for (; live_objects != 0; live_objects--) { |
3497 Address free_end = cell_base + offsets[live_index++] * kPointerSize; | 3518 Address free_end = cell_base + offsets[live_index++] * kPointerSize; |
3498 if (free_end != free_start) { | 3519 if (free_end != free_start) { |
3499 int size = static_cast<int>(free_end - free_start); | 3520 int size = static_cast<int>(free_end - free_start); |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4238 | 4259 |
4239 int MarkCompactCollector::SweepInParallel(Page* page, PagedSpace* space) { | 4260 int MarkCompactCollector::SweepInParallel(Page* page, PagedSpace* space) { |
4240 int max_freed = 0; | 4261 int max_freed = 0; |
4241 if (page->TryLock()) { | 4262 if (page->TryLock()) { |
4242 // If this page was already swept in the meantime, we can return here. | 4263 // If this page was already swept in the meantime, we can return here. |
4243 if (page->parallel_sweeping() != MemoryChunk::SWEEPING_PENDING) { | 4264 if (page->parallel_sweeping() != MemoryChunk::SWEEPING_PENDING) { |
4244 page->mutex()->Unlock(); | 4265 page->mutex()->Unlock(); |
4245 return 0; | 4266 return 0; |
4246 } | 4267 } |
4247 page->set_parallel_sweeping(MemoryChunk::SWEEPING_IN_PROGRESS); | 4268 page->set_parallel_sweeping(MemoryChunk::SWEEPING_IN_PROGRESS); |
4248 FreeList* free_list = free_list_old_space_.get(); | 4269 FreeList* free_list; |
4249 FreeList private_free_list(space); | 4270 FreeList private_free_list(space); |
4250 max_freed = Sweep<SWEEP_ONLY, SWEEP_IN_PARALLEL, IGNORE_SKIP_LIST, | 4271 if (space->identity() == CODE_SPACE) { |
4251 IGNORE_FREE_SPACE>(space, &private_free_list, page, NULL); | 4272 free_list = free_list_code_space_.get(); |
| 4273 max_freed = |
| 4274 Sweep<SWEEP_ONLY, SWEEP_IN_PARALLEL, REBUILD_SKIP_LIST, |
| 4275 IGNORE_FREE_SPACE>(space, &private_free_list, page, NULL); |
| 4276 } else { |
| 4277 free_list = free_list_old_space_.get(); |
| 4278 max_freed = |
| 4279 Sweep<SWEEP_ONLY, SWEEP_IN_PARALLEL, IGNORE_SKIP_LIST, |
| 4280 IGNORE_FREE_SPACE>(space, &private_free_list, page, NULL); |
| 4281 } |
4252 free_list->Concatenate(&private_free_list); | 4282 free_list->Concatenate(&private_free_list); |
4253 page->mutex()->Unlock(); | 4283 page->mutex()->Unlock(); |
4254 } | 4284 } |
4255 return max_freed; | 4285 return max_freed; |
4256 } | 4286 } |
4257 | 4287 |
4258 | 4288 |
4259 void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { | 4289 void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { |
4260 space->ClearStats(); | 4290 space->ClearStats(); |
4261 | 4291 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4299 unused_page_present = true; | 4329 unused_page_present = true; |
4300 } | 4330 } |
4301 | 4331 |
4302 switch (sweeper) { | 4332 switch (sweeper) { |
4303 case CONCURRENT_SWEEPING: | 4333 case CONCURRENT_SWEEPING: |
4304 if (!parallel_sweeping_active) { | 4334 if (!parallel_sweeping_active) { |
4305 if (FLAG_gc_verbose) { | 4335 if (FLAG_gc_verbose) { |
4306 PrintF("Sweeping 0x%" V8PRIxPTR ".\n", | 4336 PrintF("Sweeping 0x%" V8PRIxPTR ".\n", |
4307 reinterpret_cast<intptr_t>(p)); | 4337 reinterpret_cast<intptr_t>(p)); |
4308 } | 4338 } |
4309 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, IGNORE_SKIP_LIST, | 4339 if (space->identity() == CODE_SPACE) { |
4310 IGNORE_FREE_SPACE>(space, NULL, p, NULL); | 4340 if (FLAG_zap_code_space) { |
| 4341 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, REBUILD_SKIP_LIST, |
| 4342 ZAP_FREE_SPACE>(space, NULL, p, NULL); |
| 4343 } else { |
| 4344 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, REBUILD_SKIP_LIST, |
| 4345 IGNORE_FREE_SPACE>(space, NULL, p, NULL); |
| 4346 } |
| 4347 } else { |
| 4348 DCHECK(space->identity() == OLD_SPACE); |
| 4349 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, IGNORE_SKIP_LIST, |
| 4350 IGNORE_FREE_SPACE>(space, NULL, p, NULL); |
| 4351 } |
4311 pages_swept++; | 4352 pages_swept++; |
4312 parallel_sweeping_active = true; | 4353 parallel_sweeping_active = true; |
4313 } else { | 4354 } else { |
4314 if (FLAG_gc_verbose) { | 4355 if (FLAG_gc_verbose) { |
4315 PrintF("Sweeping 0x%" V8PRIxPTR " in parallel.\n", | 4356 PrintF("Sweeping 0x%" V8PRIxPTR " in parallel.\n", |
4316 reinterpret_cast<intptr_t>(p)); | 4357 reinterpret_cast<intptr_t>(p)); |
4317 } | 4358 } |
4318 p->set_parallel_sweeping(MemoryChunk::SWEEPING_PENDING); | 4359 p->set_parallel_sweeping(MemoryChunk::SWEEPING_PENDING); |
4319 space->IncreaseUnsweptFreeBytes(p); | 4360 space->IncreaseUnsweptFreeBytes(p); |
4320 } | 4361 } |
4321 space->set_end_of_unswept_pages(p); | 4362 space->set_end_of_unswept_pages(p); |
4322 break; | 4363 break; |
4323 case SEQUENTIAL_SWEEPING: { | 4364 case SEQUENTIAL_SWEEPING: { |
4324 if (FLAG_gc_verbose) { | 4365 if (FLAG_gc_verbose) { |
4325 PrintF("Sweeping 0x%" V8PRIxPTR ".\n", reinterpret_cast<intptr_t>(p)); | 4366 PrintF("Sweeping 0x%" V8PRIxPTR ".\n", reinterpret_cast<intptr_t>(p)); |
4326 } | 4367 } |
4327 if (space->identity() == CODE_SPACE && FLAG_zap_code_space) { | 4368 if (space->identity() == CODE_SPACE) { |
4328 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, REBUILD_SKIP_LIST, | 4369 if (FLAG_zap_code_space) { |
4329 ZAP_FREE_SPACE>(space, NULL, p, NULL); | 4370 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, REBUILD_SKIP_LIST, |
4330 } else if (space->identity() == CODE_SPACE) { | 4371 ZAP_FREE_SPACE>(space, NULL, p, NULL); |
4331 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, REBUILD_SKIP_LIST, | 4372 } else { |
4332 IGNORE_FREE_SPACE>(space, NULL, p, NULL); | 4373 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, REBUILD_SKIP_LIST, |
| 4374 IGNORE_FREE_SPACE>(space, NULL, p, NULL); |
| 4375 } |
4333 } else { | 4376 } else { |
| 4377 DCHECK(space->identity() == OLD_SPACE || |
| 4378 space->identity() == MAP_SPACE); |
4334 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, IGNORE_SKIP_LIST, | 4379 Sweep<SWEEP_ONLY, SWEEP_ON_MAIN_THREAD, IGNORE_SKIP_LIST, |
4335 IGNORE_FREE_SPACE>(space, NULL, p, NULL); | 4380 IGNORE_FREE_SPACE>(space, NULL, p, NULL); |
4336 } | 4381 } |
4337 pages_swept++; | 4382 pages_swept++; |
4338 break; | 4383 break; |
4339 } | 4384 } |
4340 default: { UNREACHABLE(); } | 4385 default: { UNREACHABLE(); } |
4341 } | 4386 } |
4342 } | 4387 } |
4343 | 4388 |
(...skipping 19 matching lines...) Expand all Loading... |
4363 #endif | 4408 #endif |
4364 | 4409 |
4365 MoveEvacuationCandidatesToEndOfPagesList(); | 4410 MoveEvacuationCandidatesToEndOfPagesList(); |
4366 | 4411 |
4367 // Noncompacting collections simply sweep the spaces to clear the mark | 4412 // Noncompacting collections simply sweep the spaces to clear the mark |
4368 // bits and free the nonlive blocks (for old and map spaces). We sweep | 4413 // bits and free the nonlive blocks (for old and map spaces). We sweep |
4369 // the map space last because freeing non-live maps overwrites them and | 4414 // the map space last because freeing non-live maps overwrites them and |
4370 // the other spaces rely on possibly non-live maps to get the sizes for | 4415 // the other spaces rely on possibly non-live maps to get the sizes for |
4371 // non-live objects. | 4416 // non-live objects. |
4372 { | 4417 { |
4373 GCTracer::Scope sweep_scope(heap()->tracer(), | 4418 { |
4374 GCTracer::Scope::MC_SWEEP_OLDSPACE); | 4419 GCTracer::Scope sweep_scope(heap()->tracer(), |
4375 { SweepSpace(heap()->old_space(), CONCURRENT_SWEEPING); } | 4420 GCTracer::Scope::MC_SWEEP_OLDSPACE); |
| 4421 SweepSpace(heap()->old_space(), CONCURRENT_SWEEPING); |
| 4422 } |
| 4423 { |
| 4424 GCTracer::Scope sweep_scope(heap()->tracer(), |
| 4425 GCTracer::Scope::MC_SWEEP_CODE); |
| 4426 SweepSpace(heap()->code_space(), CONCURRENT_SWEEPING); |
| 4427 } |
| 4428 |
4376 sweeping_in_progress_ = true; | 4429 sweeping_in_progress_ = true; |
4377 if (heap()->concurrent_sweeping_enabled()) { | 4430 if (heap()->concurrent_sweeping_enabled()) { |
4378 StartSweeperThreads(); | 4431 StartSweeperThreads(); |
4379 } | 4432 } |
4380 } | 4433 } |
| 4434 |
4381 RemoveDeadInvalidatedCode(); | 4435 RemoveDeadInvalidatedCode(); |
4382 | 4436 |
4383 { | |
4384 GCTracer::Scope sweep_scope(heap()->tracer(), | |
4385 GCTracer::Scope::MC_SWEEP_CODE); | |
4386 SweepSpace(heap()->code_space(), SEQUENTIAL_SWEEPING); | |
4387 } | |
4388 | |
4389 EvacuateNewSpaceAndCandidates(); | 4437 EvacuateNewSpaceAndCandidates(); |
4390 | 4438 |
4391 heap()->FreeDeadArrayBuffers(false); | 4439 heap()->FreeDeadArrayBuffers(false); |
4392 | 4440 |
4393 // ClearNonLiveReferences depends on precise sweeping of map space to | 4441 // ClearNonLiveReferences depends on precise sweeping of map space to |
4394 // detect whether unmarked map became dead in this collection or in one | 4442 // detect whether unmarked map became dead in this collection or in one |
4395 // of the previous ones. | 4443 // of the previous ones. |
4396 { | 4444 { |
4397 GCTracer::Scope sweep_scope(heap()->tracer(), | 4445 GCTracer::Scope sweep_scope(heap()->tracer(), |
4398 GCTracer::Scope::MC_SWEEP_MAP); | 4446 GCTracer::Scope::MC_SWEEP_MAP); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4430 p->set_parallel_sweeping(MemoryChunk::SWEEPING_DONE); | 4478 p->set_parallel_sweeping(MemoryChunk::SWEEPING_DONE); |
4431 p->SetWasSwept(); | 4479 p->SetWasSwept(); |
4432 } | 4480 } |
4433 DCHECK(p->parallel_sweeping() == MemoryChunk::SWEEPING_DONE); | 4481 DCHECK(p->parallel_sweeping() == MemoryChunk::SWEEPING_DONE); |
4434 } | 4482 } |
4435 } | 4483 } |
4436 | 4484 |
4437 | 4485 |
4438 void MarkCompactCollector::ParallelSweepSpacesComplete() { | 4486 void MarkCompactCollector::ParallelSweepSpacesComplete() { |
4439 ParallelSweepSpaceComplete(heap()->old_space()); | 4487 ParallelSweepSpaceComplete(heap()->old_space()); |
| 4488 ParallelSweepSpaceComplete(heap()->code_space()); |
4440 } | 4489 } |
4441 | 4490 |
4442 | 4491 |
4443 void MarkCompactCollector::EnableCodeFlushing(bool enable) { | 4492 void MarkCompactCollector::EnableCodeFlushing(bool enable) { |
4444 if (isolate()->debug()->is_active()) enable = false; | 4493 if (isolate()->debug()->is_active()) enable = false; |
4445 | 4494 |
4446 if (enable) { | 4495 if (enable) { |
4447 if (code_flusher_ != NULL) return; | 4496 if (code_flusher_ != NULL) return; |
4448 code_flusher_ = new CodeFlusher(isolate()); | 4497 code_flusher_ = new CodeFlusher(isolate()); |
4449 } else { | 4498 } else { |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4748 SlotsBuffer* buffer = *buffer_address; | 4797 SlotsBuffer* buffer = *buffer_address; |
4749 while (buffer != NULL) { | 4798 while (buffer != NULL) { |
4750 SlotsBuffer* next_buffer = buffer->next(); | 4799 SlotsBuffer* next_buffer = buffer->next(); |
4751 DeallocateBuffer(buffer); | 4800 DeallocateBuffer(buffer); |
4752 buffer = next_buffer; | 4801 buffer = next_buffer; |
4753 } | 4802 } |
4754 *buffer_address = NULL; | 4803 *buffer_address = NULL; |
4755 } | 4804 } |
4756 } // namespace internal | 4805 } // namespace internal |
4757 } // namespace v8 | 4806 } // namespace v8 |
OLD | NEW |