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 2822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2833 | 2833 |
2834 AllocationResult LargeObjectSpace::AllocateRaw(int object_size, | 2834 AllocationResult LargeObjectSpace::AllocateRaw(int object_size, |
2835 Executability executable) { | 2835 Executability executable) { |
2836 // Check if we want to force a GC before growing the old space further. | 2836 // Check if we want to force a GC before growing the old space further. |
2837 // If so, fail the allocation. | 2837 // If so, fail the allocation. |
2838 if (!heap()->always_allocate() && | 2838 if (!heap()->always_allocate() && |
2839 heap()->OldGenerationAllocationLimitReached()) { | 2839 heap()->OldGenerationAllocationLimitReached()) { |
2840 return AllocationResult::Retry(identity()); | 2840 return AllocationResult::Retry(identity()); |
2841 } | 2841 } |
2842 | 2842 |
2843 if (Size() + object_size > max_capacity_) { | 2843 if (!CanAllocateSize(object_size)) return AllocationResult::Retry(identity()); |
2844 return AllocationResult::Retry(identity()); | |
2845 } | |
2846 | 2844 |
2847 LargePage* page = heap()->isolate()->memory_allocator()->AllocateLargePage( | 2845 LargePage* page = heap()->isolate()->memory_allocator()->AllocateLargePage( |
2848 object_size, this, executable); | 2846 object_size, this, executable); |
2849 if (page == NULL) return AllocationResult::Retry(identity()); | 2847 if (page == NULL) return AllocationResult::Retry(identity()); |
2850 DCHECK(page->area_size() >= object_size); | 2848 DCHECK(page->area_size() >= object_size); |
2851 | 2849 |
2852 size_ += static_cast<int>(page->size()); | 2850 size_ += static_cast<int>(page->size()); |
2853 objects_size_ += object_size; | 2851 objects_size_ += object_size; |
2854 page_count_++; | 2852 page_count_++; |
2855 page->set_next_page(first_page_); | 2853 page->set_next_page(first_page_); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3098 object->ShortPrint(); | 3096 object->ShortPrint(); |
3099 PrintF("\n"); | 3097 PrintF("\n"); |
3100 } | 3098 } |
3101 printf(" --------------------------------------\n"); | 3099 printf(" --------------------------------------\n"); |
3102 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3100 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3103 } | 3101 } |
3104 | 3102 |
3105 #endif // DEBUG | 3103 #endif // DEBUG |
3106 } | 3104 } |
3107 } // namespace v8::internal | 3105 } // namespace v8::internal |
OLD | NEW |