| 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/full-codegen.h" | 7 #include "src/full-codegen.h" |
| 8 #include "src/macro-assembler.h" | 8 #include "src/macro-assembler.h" |
| 9 #include "src/mark-compact.h" | 9 #include "src/mark-compact.h" |
| 10 #include "src/msan.h" | 10 #include "src/msan.h" |
| (...skipping 2577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2588 // Retry the free list allocation. | 2588 // Retry the free list allocation. |
| 2589 HeapObject* object = free_list_.Allocate(size_in_bytes); | 2589 HeapObject* object = free_list_.Allocate(size_in_bytes); |
| 2590 if (object != NULL) return object; | 2590 if (object != NULL) return object; |
| 2591 } | 2591 } |
| 2592 | 2592 |
| 2593 // Free list allocation failed and there is no next page. Fail if we have | 2593 // Free list allocation failed and there is no next page. Fail if we have |
| 2594 // hit the old generation size limit that should cause a garbage | 2594 // hit the old generation size limit that should cause a garbage |
| 2595 // collection. | 2595 // collection. |
| 2596 if (!heap()->always_allocate() && | 2596 if (!heap()->always_allocate() && |
| 2597 heap()->OldGenerationAllocationLimitReached()) { | 2597 heap()->OldGenerationAllocationLimitReached()) { |
| 2598 // If sweeper threads are active, wait for them at that point. |
| 2599 if (collector->IsConcurrentSweepingInProgress()) { |
| 2600 collector->WaitUntilSweepingCompleted(); |
| 2601 |
| 2602 // After waiting for the sweeper threads, there may be new free-list |
| 2603 // entries. |
| 2604 HeapObject* object = free_list_.Allocate(size_in_bytes); |
| 2605 if (object != NULL) return object; |
| 2606 } |
| 2607 |
| 2598 return NULL; | 2608 return NULL; |
| 2599 } | 2609 } |
| 2600 | 2610 |
| 2601 // Try to expand the space and allocate in the new next page. | 2611 // Try to expand the space and allocate in the new next page. |
| 2602 if (Expand()) { | 2612 if (Expand()) { |
| 2603 ASSERT(CountTotalPages() > 1 || size_in_bytes <= free_list_.available()); | 2613 ASSERT(CountTotalPages() > 1 || size_in_bytes <= free_list_.available()); |
| 2604 return free_list_.Allocate(size_in_bytes); | 2614 return free_list_.Allocate(size_in_bytes); |
| 2605 } | 2615 } |
| 2606 | 2616 |
| 2607 // If sweeper threads are active, wait for them at that point. | |
| 2608 if (collector->IsConcurrentSweepingInProgress()) { | |
| 2609 collector->WaitUntilSweepingCompleted(); | |
| 2610 | |
| 2611 // After waiting for the sweeper threads, there may be new free-list | |
| 2612 // entries. | |
| 2613 HeapObject* object = free_list_.Allocate(size_in_bytes); | |
| 2614 if (object != NULL) return object; | |
| 2615 } | |
| 2616 | |
| 2617 // Finally, fail. | 2617 // Finally, fail. |
| 2618 return NULL; | 2618 return NULL; |
| 2619 } | 2619 } |
| 2620 | 2620 |
| 2621 | 2621 |
| 2622 #ifdef DEBUG | 2622 #ifdef DEBUG |
| 2623 void PagedSpace::ReportCodeStatistics(Isolate* isolate) { | 2623 void PagedSpace::ReportCodeStatistics(Isolate* isolate) { |
| 2624 CommentStatistic* comments_statistics = | 2624 CommentStatistic* comments_statistics = |
| 2625 isolate->paged_space_comments_statistics(); | 2625 isolate->paged_space_comments_statistics(); |
| 2626 ReportCodeKindStatistics(isolate->code_kind_statistics()); | 2626 ReportCodeKindStatistics(isolate->code_kind_statistics()); |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3125 object->ShortPrint(); | 3125 object->ShortPrint(); |
| 3126 PrintF("\n"); | 3126 PrintF("\n"); |
| 3127 } | 3127 } |
| 3128 printf(" --------------------------------------\n"); | 3128 printf(" --------------------------------------\n"); |
| 3129 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3129 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3130 } | 3130 } |
| 3131 | 3131 |
| 3132 #endif // DEBUG | 3132 #endif // DEBUG |
| 3133 | 3133 |
| 3134 } } // namespace v8::internal | 3134 } } // namespace v8::internal |
| OLD | NEW |