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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 } | 576 } |
577 } | 577 } |
578 | 578 |
579 | 579 |
580 void MarkCompactCollector::WaitUntilSweepingCompleted() { | 580 void MarkCompactCollector::WaitUntilSweepingCompleted() { |
581 ASSERT(sweeping_pending_ == true); | 581 ASSERT(sweeping_pending_ == true); |
582 for (int i = 0; i < isolate()->num_sweeper_threads(); i++) { | 582 for (int i = 0; i < isolate()->num_sweeper_threads(); i++) { |
583 isolate()->sweeper_threads()[i]->WaitForSweeperThread(); | 583 isolate()->sweeper_threads()[i]->WaitForSweeperThread(); |
584 } | 584 } |
585 sweeping_pending_ = false; | 585 sweeping_pending_ = false; |
586 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_DATA_SPACE)); | 586 RefillFreeLists(heap()->paged_space(OLD_DATA_SPACE)); |
587 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_POINTER_SPACE)); | 587 RefillFreeLists(heap()->paged_space(OLD_POINTER_SPACE)); |
588 heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes(); | 588 heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes(); |
589 heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes(); | 589 heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes(); |
590 } | 590 } |
591 | 591 |
592 | 592 |
593 intptr_t MarkCompactCollector:: | 593 intptr_t MarkCompactCollector::RefillFreeLists(PagedSpace* space) { |
594 StealMemoryFromSweeperThreads(PagedSpace* space) { | |
595 FreeList* free_list = space == heap()->old_pointer_space() | 594 FreeList* free_list = space == heap()->old_pointer_space() |
596 ? free_list_old_pointer_space_.get() | 595 ? free_list_old_pointer_space_.get() |
597 : free_list_old_data_space_.get(); | 596 : free_list_old_data_space_.get(); |
598 intptr_t freed_bytes = space->free_list()->Concatenate(free_list); | 597 intptr_t freed_bytes = space->free_list()->Concatenate(free_list); |
599 space->AddToAccountingStats(freed_bytes); | 598 space->AddToAccountingStats(freed_bytes); |
600 space->DecrementUnsweptFreeBytes(freed_bytes); | 599 space->DecrementUnsweptFreeBytes(freed_bytes); |
601 return freed_bytes; | 600 return freed_bytes; |
602 } | 601 } |
603 | 602 |
604 | 603 |
(...skipping 3771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4376 while (buffer != NULL) { | 4375 while (buffer != NULL) { |
4377 SlotsBuffer* next_buffer = buffer->next(); | 4376 SlotsBuffer* next_buffer = buffer->next(); |
4378 DeallocateBuffer(buffer); | 4377 DeallocateBuffer(buffer); |
4379 buffer = next_buffer; | 4378 buffer = next_buffer; |
4380 } | 4379 } |
4381 *buffer_address = NULL; | 4380 *buffer_address = NULL; |
4382 } | 4381 } |
4383 | 4382 |
4384 | 4383 |
4385 } } // namespace v8::internal | 4384 } } // namespace v8::internal |
OLD | NEW |