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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
341 HeapObjectIterator it(heap->code_space()); | 341 HeapObjectIterator it(heap->code_space()); |
342 | 342 |
343 for (Object* object = it.Next(); object != NULL; object = it.Next()) { | 343 for (Object* object = it.Next(); object != NULL; object = it.Next()) { |
344 VerifyNativeContextSeparationVisitor visitor; | 344 VerifyNativeContextSeparationVisitor visitor; |
345 Code::cast(object)->CodeIterateBody(&visitor); | 345 Code::cast(object)->CodeIterateBody(&visitor); |
346 } | 346 } |
347 } | 347 } |
348 #endif | 348 #endif |
349 | 349 |
350 | 350 |
351 void MarkCompactCollector::SetUp() { | |
352 free_list_old_data_space_.Reset(new FreeList(heap_->old_data_space())); | |
353 free_list_old_pointer_space_.Reset(new FreeList(heap_->old_pointer_space())); | |
354 } | |
355 | |
356 | |
351 void MarkCompactCollector::TearDown() { | 357 void MarkCompactCollector::TearDown() { |
352 AbortCompaction(); | 358 AbortCompaction(); |
353 } | 359 } |
354 | 360 |
355 | 361 |
356 void MarkCompactCollector::AddEvacuationCandidate(Page* p) { | 362 void MarkCompactCollector::AddEvacuationCandidate(Page* p) { |
357 p->MarkEvacuationCandidate(); | 363 p->MarkEvacuationCandidate(); |
358 evacuation_candidates_.Add(p); | 364 evacuation_candidates_.Add(p); |
359 } | 365 } |
360 | 366 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
578 } | 584 } |
579 sweeping_pending_ = false; | 585 sweeping_pending_ = false; |
580 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_DATA_SPACE)); | 586 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_DATA_SPACE)); |
581 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_POINTER_SPACE)); | 587 StealMemoryFromSweeperThreads(heap()->paged_space(OLD_POINTER_SPACE)); |
582 heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes(); | 588 heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes(); |
583 heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes(); | 589 heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes(); |
584 } | 590 } |
585 | 591 |
586 | 592 |
587 intptr_t MarkCompactCollector:: | 593 intptr_t MarkCompactCollector:: |
588 StealMemoryFromSweeperThreads(PagedSpace* space) { | 594 StealMemoryFromSweeperThreads(PagedSpace* space) { |
Hannes Payer (out of office)
2014/01/21 11:31:38
We should rename this function to e.g. RefillFreeL
| |
589 intptr_t freed_bytes = 0; | 595 FreeList* free_list = space == heap()->old_pointer_space() |
590 for (int i = 0; i < isolate()->num_sweeper_threads(); i++) { | 596 ? free_list_old_pointer_space_.get() |
591 freed_bytes += isolate()->sweeper_threads()[i]->StealMemory(space); | 597 : free_list_old_data_space_.get(); |
592 } | 598 intptr_t freed_bytes = space->free_list()->Concatenate(free_list); |
593 space->AddToAccountingStats(freed_bytes); | 599 space->AddToAccountingStats(freed_bytes); |
594 space->DecrementUnsweptFreeBytes(freed_bytes); | 600 space->DecrementUnsweptFreeBytes(freed_bytes); |
595 return freed_bytes; | 601 return freed_bytes; |
596 } | 602 } |
597 | 603 |
598 | 604 |
599 bool MarkCompactCollector::AreSweeperThreadsActivated() { | 605 bool MarkCompactCollector::AreSweeperThreadsActivated() { |
600 return isolate()->sweeper_threads() != NULL; | 606 return isolate()->sweeper_threads() != NULL; |
601 } | 607 } |
602 | 608 |
(...skipping 3361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3964 freed_bytes += Free<mode>(space, free_list, free_start, | 3970 freed_bytes += Free<mode>(space, free_list, free_start, |
3965 static_cast<int>(p->area_end() - free_start)); | 3971 static_cast<int>(p->area_end() - free_start)); |
3966 } | 3972 } |
3967 | 3973 |
3968 p->ResetLiveBytes(); | 3974 p->ResetLiveBytes(); |
3969 return freed_bytes; | 3975 return freed_bytes; |
3970 } | 3976 } |
3971 | 3977 |
3972 | 3978 |
3973 void MarkCompactCollector::SweepInParallel(PagedSpace* space, | 3979 void MarkCompactCollector::SweepInParallel(PagedSpace* space, |
3974 FreeList* private_free_list, | 3980 FreeList* private_free_list) { |
3975 FreeList* free_list) { | |
3976 PageIterator it(space); | 3981 PageIterator it(space); |
3982 FreeList* free_list = space == heap()->old_pointer_space() | |
3983 ? free_list_old_pointer_space_.get() | |
3984 : free_list_old_data_space_.get(); | |
3977 while (it.has_next()) { | 3985 while (it.has_next()) { |
3978 Page* p = it.next(); | 3986 Page* p = it.next(); |
3979 | 3987 |
3980 if (p->TryParallelSweeping()) { | 3988 if (p->TryParallelSweeping()) { |
3981 SweepConservatively<SWEEP_IN_PARALLEL>(space, private_free_list, p); | 3989 SweepConservatively<SWEEP_IN_PARALLEL>(space, private_free_list, p); |
3982 free_list->Concatenate(private_free_list); | 3990 free_list->Concatenate(private_free_list); |
3983 } | 3991 } |
3984 } | 3992 } |
3985 } | 3993 } |
3986 | 3994 |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4369 while (buffer != NULL) { | 4377 while (buffer != NULL) { |
4370 SlotsBuffer* next_buffer = buffer->next(); | 4378 SlotsBuffer* next_buffer = buffer->next(); |
4371 DeallocateBuffer(buffer); | 4379 DeallocateBuffer(buffer); |
4372 buffer = next_buffer; | 4380 buffer = next_buffer; |
4373 } | 4381 } |
4374 *buffer_address = NULL; | 4382 *buffer_address = NULL; |
4375 } | 4383 } |
4376 | 4384 |
4377 | 4385 |
4378 } } // namespace v8::internal | 4386 } } // namespace v8::internal |
OLD | NEW |