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