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 2560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2571 int remaining = | 2571 int remaining = |
2572 static_cast<int>(allocation_info_.limit() - allocation_info_.top()); | 2572 static_cast<int>(allocation_info_.limit() - allocation_info_.top()); |
2573 heap()->CreateFillerObjectAt(allocation_info_.top(), remaining); | 2573 heap()->CreateFillerObjectAt(allocation_info_.top(), remaining); |
2574 | 2574 |
2575 allocation_info_.set_top(NULL); | 2575 allocation_info_.set_top(NULL); |
2576 allocation_info_.set_limit(NULL); | 2576 allocation_info_.set_limit(NULL); |
2577 } | 2577 } |
2578 } | 2578 } |
2579 | 2579 |
2580 | 2580 |
2581 HeapObject* PagedSpace::EnsureSweepingProgress( | 2581 HeapObject* PagedSpace::EnsureSweepingProgress(intptr_t size_in_bytes) { |
2582 int size_in_bytes) { | |
2583 MarkCompactCollector* collector = heap()->mark_compact_collector(); | 2582 MarkCompactCollector* collector = heap()->mark_compact_collector(); |
2584 | 2583 |
2585 if (collector->IsConcurrentSweepingInProgress(this)) { | 2584 if (collector->IsConcurrentSweepingInProgress(this)) { |
2586 // If sweeping is still in progress try to sweep pages on the main thread. | 2585 // If sweeping is still in progress try to sweep pages on the main thread. |
2587 int free_chunk = | 2586 intptr_t free_chunk = |
2588 collector->SweepInParallel(this, size_in_bytes); | 2587 collector->SweepInParallel(this, size_in_bytes); |
2589 if (free_chunk >= size_in_bytes) { | 2588 if (free_chunk >= size_in_bytes) { |
2590 HeapObject* object = free_list_.Allocate(size_in_bytes); | 2589 HeapObject* object = free_list_.Allocate(size_in_bytes); |
2591 // We should be able to allocate an object here since we just freed that | 2590 // We should be able to allocate an object here since we just freed that |
2592 // much memory. | 2591 // much memory. |
2593 ASSERT(object != NULL); | 2592 ASSERT(object != NULL); |
2594 if (object != NULL) return object; | 2593 if (object != NULL) return object; |
2595 } | 2594 } |
2596 | 2595 |
2597 // Wait for the sweeper threads here and complete the sweeping phase. | 2596 // Wait for the sweeper threads here and complete the sweeping phase. |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3149 object->ShortPrint(); | 3148 object->ShortPrint(); |
3150 PrintF("\n"); | 3149 PrintF("\n"); |
3151 } | 3150 } |
3152 printf(" --------------------------------------\n"); | 3151 printf(" --------------------------------------\n"); |
3153 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3152 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3154 } | 3153 } |
3155 | 3154 |
3156 #endif // DEBUG | 3155 #endif // DEBUG |
3157 | 3156 |
3158 } } // namespace v8::internal | 3157 } } // namespace v8::internal |
OLD | NEW |