| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 | 552 |
| 553 void MarkCompactCollector::WaitUntilSweepingCompleted() { | 553 void MarkCompactCollector::WaitUntilSweepingCompleted() { |
| 554 ASSERT(sweeping_pending_ == true); | 554 ASSERT(sweeping_pending_ == true); |
| 555 for (int i = 0; i < FLAG_sweeper_threads; i++) { | 555 for (int i = 0; i < FLAG_sweeper_threads; i++) { |
| 556 heap()->isolate()->sweeper_threads()[i]->WaitForSweeperThread(); | 556 heap()->isolate()->sweeper_threads()[i]->WaitForSweeperThread(); |
| 557 } | 557 } |
| 558 sweeping_pending_ = false; | 558 sweeping_pending_ = false; |
| 559 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_DATA_SPACE)); | 559 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_DATA_SPACE)); |
| 560 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_POINTER_SPACE)); | 560 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_POINTER_SPACE)); |
| 561 heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes(); | 561 heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes(); |
| 562 heap()->paged_space(OLD_DATA_SPACE)->SetPagesToSweep(NULL); |
| 562 heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes(); | 563 heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes(); |
| 564 heap()->paged_space(OLD_POINTER_SPACE)->SetPagesToSweep(NULL); |
| 563 } | 565 } |
| 564 | 566 |
| 565 | 567 |
| 566 intptr_t MarkCompactCollector:: | 568 intptr_t MarkCompactCollector:: |
| 567 StealMemoryFromSweeperThreads(PagedSpace* space) { | 569 StealMemoryFromSweeperThreads(PagedSpace* space) { |
| 568 intptr_t freed_bytes = 0; | 570 intptr_t freed_bytes = 0; |
| 569 for (int i = 0; i < FLAG_sweeper_threads; i++) { | 571 for (int i = 0; i < FLAG_sweeper_threads; i++) { |
| 570 freed_bytes += heap()->isolate()->sweeper_threads()[i]->StealMemory(space); | 572 freed_bytes += heap()->isolate()->sweeper_threads()[i]->StealMemory(space); |
| 571 } | 573 } |
| 572 space->AddToAccountingStats(freed_bytes); | 574 space->AddToAccountingStats(freed_bytes); |
| (...skipping 3248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3821 if (FLAG_gc_verbose) { | 3823 if (FLAG_gc_verbose) { |
| 3822 PrintF("Sweeping 0x%" V8PRIxPTR " lazily postponed.\n", | 3824 PrintF("Sweeping 0x%" V8PRIxPTR " lazily postponed.\n", |
| 3823 reinterpret_cast<intptr_t>(p)); | 3825 reinterpret_cast<intptr_t>(p)); |
| 3824 } | 3826 } |
| 3825 space->IncreaseUnsweptFreeBytes(p); | 3827 space->IncreaseUnsweptFreeBytes(p); |
| 3826 } else { | 3828 } else { |
| 3827 if (FLAG_gc_verbose) { | 3829 if (FLAG_gc_verbose) { |
| 3828 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively.\n", | 3830 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively.\n", |
| 3829 reinterpret_cast<intptr_t>(p)); | 3831 reinterpret_cast<intptr_t>(p)); |
| 3830 } | 3832 } |
| 3831 SweepConservatively<SWEEP_SEQUENTIALLY>(space, NULL, p); | 3833 space->SetPagesToSweep(p); |
| 3834 space->AdvanceSweeper(0); |
| 3832 pages_swept++; | 3835 pages_swept++; |
| 3833 space->SetPagesToSweep(p->next_page()); | |
| 3834 lazy_sweeping_active = true; | 3836 lazy_sweeping_active = true; |
| 3835 } | 3837 } |
| 3836 break; | 3838 break; |
| 3837 } | 3839 } |
| 3838 case CONCURRENT_CONSERVATIVE: | 3840 case CONCURRENT_CONSERVATIVE: |
| 3839 case PARALLEL_CONSERVATIVE: { | 3841 case PARALLEL_CONSERVATIVE: { |
| 3840 if (!parallel_sweeping_active) { | 3842 if (!parallel_sweeping_active) { |
| 3841 if (FLAG_gc_verbose) { | 3843 if (FLAG_gc_verbose) { |
| 3842 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively.\n", | 3844 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively.\n", |
| 3843 reinterpret_cast<intptr_t>(p)); | 3845 reinterpret_cast<intptr_t>(p)); |
| 3844 } | 3846 } |
| 3845 SweepConservatively<SWEEP_SEQUENTIALLY>(space, NULL, p); | 3847 space->SetPagesToSweep(p); |
| 3848 space->AdvanceSweeper(0); |
| 3846 pages_swept++; | 3849 pages_swept++; |
| 3847 parallel_sweeping_active = true; | 3850 parallel_sweeping_active = true; |
| 3848 } else { | 3851 } else { |
| 3849 if (FLAG_gc_verbose) { | 3852 if (FLAG_gc_verbose) { |
| 3850 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n", | 3853 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n", |
| 3851 reinterpret_cast<intptr_t>(p)); | 3854 reinterpret_cast<intptr_t>(p)); |
| 3852 } | 3855 } |
| 3853 p->set_parallel_sweeping(1); | 3856 p->set_parallel_sweeping(1); |
| 3854 space->IncreaseUnsweptFreeBytes(p); | 3857 space->IncreaseUnsweptFreeBytes(p); |
| 3855 } | 3858 } |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4128 while (buffer != NULL) { | 4131 while (buffer != NULL) { |
| 4129 SlotsBuffer* next_buffer = buffer->next(); | 4132 SlotsBuffer* next_buffer = buffer->next(); |
| 4130 DeallocateBuffer(buffer); | 4133 DeallocateBuffer(buffer); |
| 4131 buffer = next_buffer; | 4134 buffer = next_buffer; |
| 4132 } | 4135 } |
| 4133 *buffer_address = NULL; | 4136 *buffer_address = NULL; |
| 4134 } | 4137 } |
| 4135 | 4138 |
| 4136 | 4139 |
| 4137 } } // namespace v8::internal | 4140 } } // namespace v8::internal |
| OLD | NEW |