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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "code-stubs.h" | 7 #include "code-stubs.h" |
8 #include "compilation-cache.h" | 8 #include "compilation-cache.h" |
9 #include "cpu-profiler.h" | 9 #include "cpu-profiler.h" |
10 #include "deoptimizer.h" | 10 #include "deoptimizer.h" |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 } | 601 } |
602 ParallelSweepSpacesComplete(); | 602 ParallelSweepSpacesComplete(); |
603 sweeping_pending_ = false; | 603 sweeping_pending_ = false; |
604 RefillFreeList(heap()->paged_space(OLD_DATA_SPACE)); | 604 RefillFreeList(heap()->paged_space(OLD_DATA_SPACE)); |
605 RefillFreeList(heap()->paged_space(OLD_POINTER_SPACE)); | 605 RefillFreeList(heap()->paged_space(OLD_POINTER_SPACE)); |
606 heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes(); | 606 heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes(); |
607 heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes(); | 607 heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes(); |
608 } | 608 } |
609 | 609 |
610 | 610 |
| 611 bool MarkCompactCollector::IsSweepingCompleted() { |
| 612 for (int i = 0; i < isolate()->num_sweeper_threads(); i++) { |
| 613 if (!isolate()->sweeper_threads()[i]->SweepingCompleted()) { |
| 614 return false; |
| 615 } |
| 616 } |
| 617 if (FLAG_job_based_sweeping) { |
| 618 if (!pending_sweeper_jobs_semaphore_.WaitFor(TimeDelta::FromSeconds(0))) { |
| 619 return false; |
| 620 } |
| 621 pending_sweeper_jobs_semaphore_.Signal(); |
| 622 } |
| 623 return true; |
| 624 } |
| 625 |
| 626 |
611 void MarkCompactCollector::RefillFreeList(PagedSpace* space) { | 627 void MarkCompactCollector::RefillFreeList(PagedSpace* space) { |
612 FreeList* free_list; | 628 FreeList* free_list; |
613 | 629 |
614 if (space == heap()->old_pointer_space()) { | 630 if (space == heap()->old_pointer_space()) { |
615 free_list = free_list_old_pointer_space_.get(); | 631 free_list = free_list_old_pointer_space_.get(); |
616 } else if (space == heap()->old_data_space()) { | 632 } else if (space == heap()->old_data_space()) { |
617 free_list = free_list_old_data_space_.get(); | 633 free_list = free_list_old_data_space_.get(); |
618 } else { | 634 } else { |
619 // Any PagedSpace might invoke RefillFreeLists, so we need to make sure | 635 // Any PagedSpace might invoke RefillFreeLists, so we need to make sure |
620 // to only refill them for old data and pointer spaces. | 636 // to only refill them for old data and pointer spaces. |
(...skipping 3901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4522 while (buffer != NULL) { | 4538 while (buffer != NULL) { |
4523 SlotsBuffer* next_buffer = buffer->next(); | 4539 SlotsBuffer* next_buffer = buffer->next(); |
4524 DeallocateBuffer(buffer); | 4540 DeallocateBuffer(buffer); |
4525 buffer = next_buffer; | 4541 buffer = next_buffer; |
4526 } | 4542 } |
4527 *buffer_address = NULL; | 4543 *buffer_address = NULL; |
4528 } | 4544 } |
4529 | 4545 |
4530 | 4546 |
4531 } } // namespace v8::internal | 4547 } } // namespace v8::internal |
OLD | NEW |