Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/base/platform/platform.h" | 7 #include "src/base/platform/platform.h" |
| 8 #include "src/full-codegen.h" | 8 #include "src/full-codegen.h" |
| 9 #include "src/macro-assembler.h" | 9 #include "src/macro-assembler.h" |
| 10 #include "src/mark-compact.h" | 10 #include "src/mark-compact.h" |
| (...skipping 2563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2574 int remaining = | 2574 int remaining = |
| 2575 static_cast<int>(allocation_info_.limit() - allocation_info_.top()); | 2575 static_cast<int>(allocation_info_.limit() - allocation_info_.top()); |
| 2576 heap()->CreateFillerObjectAt(allocation_info_.top(), remaining); | 2576 heap()->CreateFillerObjectAt(allocation_info_.top(), remaining); |
| 2577 | 2577 |
| 2578 allocation_info_.set_top(NULL); | 2578 allocation_info_.set_top(NULL); |
| 2579 allocation_info_.set_limit(NULL); | 2579 allocation_info_.set_limit(NULL); |
| 2580 } | 2580 } |
| 2581 } | 2581 } |
| 2582 | 2582 |
| 2583 | 2583 |
| 2584 HeapObject* PagedSpace::WaitForSweeperThreadsAndRetryAllocation( | 2584 HeapObject* PagedSpace::WaitForSweeperThreadsAndRetryAllocation( |
|
Jarin
2014/07/09 11:02:02
Nit: Now the name is a bit funny - it does not alw
Hannes Payer (out of office)
2014/07/10 12:03:45
Done.
| |
| 2585 int size_in_bytes) { | 2585 int size_in_bytes) { |
| 2586 MarkCompactCollector* collector = heap()->mark_compact_collector(); | 2586 MarkCompactCollector* collector = heap()->mark_compact_collector(); |
| 2587 | 2587 |
| 2588 // If sweeper threads are still running, wait for them. | |
| 2589 if (collector->IsConcurrentSweepingInProgress(this)) { | 2588 if (collector->IsConcurrentSweepingInProgress(this)) { |
| 2589 // If sweeping is still in progress try to sweep pages on the main thread. | |
| 2590 int free_chunk = | |
| 2591 collector->SweepInParallel<MarkCompactCollector::SWEEP_ON_MAIN_THREAD>( | |
| 2592 this, size_in_bytes); | |
| 2593 if (free_chunk >= size_in_bytes) { | |
| 2594 HeapObject* object = free_list_.Allocate(size_in_bytes); | |
| 2595 // We should be able to allocate an object here since we just freed that | |
| 2596 // much memory. | |
| 2597 ASSERT(object != NULL); | |
| 2598 if (object != NULL) return object; | |
| 2599 } | |
| 2600 | |
| 2601 // Wait for the sweeper threads here and complete the sweeping phase. | |
| 2590 collector->WaitUntilSweepingCompleted(); | 2602 collector->WaitUntilSweepingCompleted(); |
| 2591 | 2603 |
| 2592 // After waiting for the sweeper threads, there may be new free-list | 2604 // After waiting for the sweeper threads, there may be new free-list |
| 2593 // entries. | 2605 // entries. |
| 2594 return free_list_.Allocate(size_in_bytes); | 2606 return free_list_.Allocate(size_in_bytes); |
| 2595 } | 2607 } |
| 2596 return NULL; | 2608 return NULL; |
| 2597 } | 2609 } |
| 2598 | 2610 |
| 2599 | 2611 |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3141 object->ShortPrint(); | 3153 object->ShortPrint(); |
| 3142 PrintF("\n"); | 3154 PrintF("\n"); |
| 3143 } | 3155 } |
| 3144 printf(" --------------------------------------\n"); | 3156 printf(" --------------------------------------\n"); |
| 3145 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3157 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3146 } | 3158 } |
| 3147 | 3159 |
| 3148 #endif // DEBUG | 3160 #endif // DEBUG |
| 3149 | 3161 |
| 3150 } } // namespace v8::internal | 3162 } } // namespace v8::internal |
| OLD | NEW |