OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/once.h" | 9 #include "src/base/once.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2019 } | 2019 } |
2020 | 2020 |
2021 heap->IncrementPromotedObjectsSize(object_size); | 2021 heap->IncrementPromotedObjectsSize(object_size); |
2022 return; | 2022 return; |
2023 } | 2023 } |
2024 } | 2024 } |
2025 ASSERT(heap->AllowedToBeMigrated(object, NEW_SPACE)); | 2025 ASSERT(heap->AllowedToBeMigrated(object, NEW_SPACE)); |
2026 AllocationResult allocation = | 2026 AllocationResult allocation = |
2027 heap->new_space()->AllocateRaw(allocation_size); | 2027 heap->new_space()->AllocateRaw(allocation_size); |
2028 heap->promotion_queue()->SetNewLimit(heap->new_space()->top()); | 2028 heap->promotion_queue()->SetNewLimit(heap->new_space()->top()); |
| 2029 |
| 2030 // Allocation in the other semi-space may fail due to fragmentation. |
| 2031 // In that case we allocate in the old generation. |
| 2032 if (allocation.IsRetry()) { |
| 2033 if (object_contents == DATA_OBJECT) { |
| 2034 ASSERT(heap->AllowedToBeMigrated(object, OLD_DATA_SPACE)); |
| 2035 allocation = heap->old_data_space()->AllocateRaw(allocation_size); |
| 2036 } else { |
| 2037 ASSERT(heap->AllowedToBeMigrated(object, OLD_POINTER_SPACE)); |
| 2038 allocation = heap->old_pointer_space()->AllocateRaw(allocation_size); |
| 2039 } |
| 2040 } |
| 2041 |
2029 HeapObject* target = HeapObject::cast(allocation.ToObjectChecked()); | 2042 HeapObject* target = HeapObject::cast(allocation.ToObjectChecked()); |
2030 | 2043 |
2031 if (alignment != kObjectAlignment) { | 2044 if (alignment != kObjectAlignment) { |
2032 target = EnsureDoubleAligned(heap, target, allocation_size); | 2045 target = EnsureDoubleAligned(heap, target, allocation_size); |
2033 } | 2046 } |
2034 | 2047 |
2035 // Order is important: slot might be inside of the target if target | 2048 // Order is important: slot might be inside of the target if target |
2036 // was allocated over a dead object and slot comes from the store | 2049 // was allocated over a dead object and slot comes from the store |
2037 // buffer. | 2050 // buffer. |
2038 *slot = target; | 2051 *slot = target; |
(...skipping 4318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6357 static_cast<int>(object_sizes_last_time_[index])); | 6370 static_cast<int>(object_sizes_last_time_[index])); |
6358 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6371 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6359 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6372 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6360 | 6373 |
6361 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6374 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6362 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6375 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6363 ClearObjectStats(); | 6376 ClearObjectStats(); |
6364 } | 6377 } |
6365 | 6378 |
6366 } } // namespace v8::internal | 6379 } } // namespace v8::internal |
OLD | NEW |