| 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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 | 550 |
| 551 | 551 |
| 552 void MarkCompactCollector::WaitUntilSweepingCompleted() { | 552 void MarkCompactCollector::WaitUntilSweepingCompleted() { |
| 553 if (sweeping_pending_) { | 553 if (sweeping_pending_) { |
| 554 for (int i = 0; i < FLAG_sweeper_threads; i++) { | 554 for (int i = 0; i < FLAG_sweeper_threads; i++) { |
| 555 heap()->isolate()->sweeper_threads()[i]->WaitForSweeperThread(); | 555 heap()->isolate()->sweeper_threads()[i]->WaitForSweeperThread(); |
| 556 } | 556 } |
| 557 sweeping_pending_ = false; | 557 sweeping_pending_ = false; |
| 558 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_DATA_SPACE)); | 558 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_DATA_SPACE)); |
| 559 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_POINTER_SPACE)); | 559 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_POINTER_SPACE)); |
| 560 heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes(); |
| 561 heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes(); |
| 560 } | 562 } |
| 561 } | 563 } |
| 562 | 564 |
| 563 | 565 |
| 564 intptr_t MarkCompactCollector:: | 566 intptr_t MarkCompactCollector:: |
| 565 StealMemoryFromSweeperThreads(PagedSpace* space) { | 567 StealMemoryFromSweeperThreads(PagedSpace* space) { |
| 566 intptr_t freed_bytes = 0; | 568 intptr_t freed_bytes = 0; |
| 567 for (int i = 0; i < FLAG_sweeper_threads; i++) { | 569 for (int i = 0; i < FLAG_sweeper_threads; i++) { |
| 568 freed_bytes += heap()->isolate()->sweeper_threads()[i]->StealMemory(space); | 570 freed_bytes += heap()->isolate()->sweeper_threads()[i]->StealMemory(space); |
| 569 } | 571 } |
| 572 space->AddToAccountingStats(freed_bytes); |
| 573 space->DecrementUnsweptFreeBytes(freed_bytes); |
| 570 return freed_bytes; | 574 return freed_bytes; |
| 571 } | 575 } |
| 572 | 576 |
| 573 | 577 |
| 574 bool MarkCompactCollector::AreSweeperThreadsActivated() { | 578 bool MarkCompactCollector::AreSweeperThreadsActivated() { |
| 575 return heap()->isolate()->sweeper_threads() != NULL; | 579 return heap()->isolate()->sweeper_threads() != NULL; |
| 576 } | 580 } |
| 577 | 581 |
| 578 | 582 |
| 579 bool MarkCompactCollector::IsConcurrentSweepingInProgress() { | 583 bool MarkCompactCollector::IsConcurrentSweepingInProgress() { |
| (...skipping 3256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3836 lazy_sweeping_active = true; | 3840 lazy_sweeping_active = true; |
| 3837 break; | 3841 break; |
| 3838 } | 3842 } |
| 3839 case CONCURRENT_CONSERVATIVE: | 3843 case CONCURRENT_CONSERVATIVE: |
| 3840 case PARALLEL_CONSERVATIVE: { | 3844 case PARALLEL_CONSERVATIVE: { |
| 3841 if (FLAG_gc_verbose) { | 3845 if (FLAG_gc_verbose) { |
| 3842 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n", | 3846 PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n", |
| 3843 reinterpret_cast<intptr_t>(p)); | 3847 reinterpret_cast<intptr_t>(p)); |
| 3844 } | 3848 } |
| 3845 p->set_parallel_sweeping(1); | 3849 p->set_parallel_sweeping(1); |
| 3850 space->IncreaseUnsweptFreeBytes(p); |
| 3846 break; | 3851 break; |
| 3847 } | 3852 } |
| 3848 case PRECISE: { | 3853 case PRECISE: { |
| 3849 if (FLAG_gc_verbose) { | 3854 if (FLAG_gc_verbose) { |
| 3850 PrintF("Sweeping 0x%" V8PRIxPTR " precisely.\n", | 3855 PrintF("Sweeping 0x%" V8PRIxPTR " precisely.\n", |
| 3851 reinterpret_cast<intptr_t>(p)); | 3856 reinterpret_cast<intptr_t>(p)); |
| 3852 } | 3857 } |
| 3853 if (space->identity() == CODE_SPACE) { | 3858 if (space->identity() == CODE_SPACE) { |
| 3854 SweepPrecisely<SWEEP_ONLY, REBUILD_SKIP_LIST>(space, p, NULL); | 3859 SweepPrecisely<SWEEP_ONLY, REBUILD_SKIP_LIST>(space, p, NULL); |
| 3855 } else { | 3860 } else { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4116 while (buffer != NULL) { | 4121 while (buffer != NULL) { |
| 4117 SlotsBuffer* next_buffer = buffer->next(); | 4122 SlotsBuffer* next_buffer = buffer->next(); |
| 4118 DeallocateBuffer(buffer); | 4123 DeallocateBuffer(buffer); |
| 4119 buffer = next_buffer; | 4124 buffer = next_buffer; |
| 4120 } | 4125 } |
| 4121 *buffer_address = NULL; | 4126 *buffer_address = NULL; |
| 4122 } | 4127 } |
| 4123 | 4128 |
| 4124 | 4129 |
| 4125 } } // namespace v8::internal | 4130 } } // namespace v8::internal |
| OLD | NEW |