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/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/full-codegen.h" | 9 #include "src/full-codegen.h" |
10 #include "src/heap/mark-compact.h" | 10 #include "src/heap/mark-compact.h" |
(...skipping 2600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2611 } | 2611 } |
2612 | 2612 |
2613 // Free list allocation failed and there is no next page. Fail if we have | 2613 // Free list allocation failed and there is no next page. Fail if we have |
2614 // hit the old generation size limit that should cause a garbage | 2614 // hit the old generation size limit that should cause a garbage |
2615 // collection. | 2615 // collection. |
2616 if (!heap()->always_allocate() && | 2616 if (!heap()->always_allocate() && |
2617 heap()->OldGenerationAllocationLimitReached()) { | 2617 heap()->OldGenerationAllocationLimitReached()) { |
2618 // If sweeper threads are active, wait for them at that point and steal | 2618 // If sweeper threads are active, wait for them at that point and steal |
2619 // elements form their free-lists. | 2619 // elements form their free-lists. |
2620 HeapObject* object = WaitForSweeperThreadsAndRetryAllocation(size_in_bytes); | 2620 HeapObject* object = WaitForSweeperThreadsAndRetryAllocation(size_in_bytes); |
2621 if (object != NULL) return object; | 2621 return object; |
2622 } | 2622 } |
2623 | 2623 |
2624 // Try to expand the space and allocate in the new next page. | 2624 // Try to expand the space and allocate in the new next page. |
2625 if (Expand()) { | 2625 if (Expand()) { |
2626 DCHECK(CountTotalPages() > 1 || size_in_bytes <= free_list_.available()); | 2626 DCHECK(CountTotalPages() > 1 || size_in_bytes <= free_list_.available()); |
2627 return free_list_.Allocate(size_in_bytes); | 2627 return free_list_.Allocate(size_in_bytes); |
2628 } | 2628 } |
2629 | 2629 |
2630 // If sweeper threads are active, wait for them at that point and steal | 2630 // If sweeper threads are active, wait for them at that point and steal |
2631 // elements form their free-lists. Allocation may still fail their which | 2631 // elements form their free-lists. Allocation may still fail their which |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3131 object->ShortPrint(); | 3131 object->ShortPrint(); |
3132 PrintF("\n"); | 3132 PrintF("\n"); |
3133 } | 3133 } |
3134 printf(" --------------------------------------\n"); | 3134 printf(" --------------------------------------\n"); |
3135 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3135 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3136 } | 3136 } |
3137 | 3137 |
3138 #endif // DEBUG | 3138 #endif // DEBUG |
3139 } | 3139 } |
3140 } // namespace v8::internal | 3140 } // namespace v8::internal |
OLD | NEW |