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 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2018 } | 2018 } |
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()); |
Igor Sheludko
2014/06/24 15:12:38
Shouldn't limit updating be done only if the alloc
Hannes Payer (out of office)
2014/06/24 16:28:15
I changed the order, WDYT?
| |
2029 | 2029 |
2030 // Allocation in the other semi-space may fail due to fragmentation. | 2030 // Allocation in the other semi-space may fail due to fragmentation. |
2031 // In that case we allocate in the old generation. | 2031 // In that case we allocate in the old generation. |
2032 if (allocation.IsRetry()) { | 2032 if (allocation.IsRetry()) { |
2033 if (object_contents == DATA_OBJECT) { | 2033 if (object_contents == DATA_OBJECT) { |
2034 ASSERT(heap->AllowedToBeMigrated(object, OLD_DATA_SPACE)); | 2034 ASSERT(heap->AllowedToBeMigrated(object, OLD_DATA_SPACE)); |
2035 allocation = heap->old_data_space()->AllocateRaw(allocation_size); | 2035 allocation = heap->old_data_space()->AllocateRaw(allocation_size); |
2036 } else { | 2036 } else { |
2037 ASSERT(heap->AllowedToBeMigrated(object, OLD_POINTER_SPACE)); | 2037 ASSERT(heap->AllowedToBeMigrated(object, OLD_POINTER_SPACE)); |
2038 allocation = heap->old_pointer_space()->AllocateRaw(allocation_size); | 2038 allocation = heap->old_pointer_space()->AllocateRaw(allocation_size); |
2039 } | 2039 } |
2040 heap->IncrementPromotedObjectsSize(object_size); | |
2041 } else { | |
2042 heap->IncrementSemiSpaceCopiedObjectSize(object_size); | |
2040 } | 2043 } |
2041 | 2044 |
2042 HeapObject* target = HeapObject::cast(allocation.ToObjectChecked()); | 2045 HeapObject* target = HeapObject::cast(allocation.ToObjectChecked()); |
2043 | 2046 |
2044 if (alignment != kObjectAlignment) { | 2047 if (alignment != kObjectAlignment) { |
2045 target = EnsureDoubleAligned(heap, target, allocation_size); | 2048 target = EnsureDoubleAligned(heap, target, allocation_size); |
2046 } | 2049 } |
2047 | 2050 |
2048 // Order is important: slot might be inside of the target if target | 2051 // Order is important: slot might be inside of the target if target |
2049 // was allocated over a dead object and slot comes from the store | 2052 // was allocated over a dead object and slot comes from the store |
2050 // buffer. | 2053 // buffer. |
2051 *slot = target; | 2054 *slot = target; |
2052 MigrateObject(heap, object, target, object_size); | 2055 MigrateObject(heap, object, target, object_size); |
2053 heap->IncrementSemiSpaceCopiedObjectSize(object_size); | |
2054 return; | 2056 return; |
2055 } | 2057 } |
2056 | 2058 |
2057 | 2059 |
2058 static inline void EvacuateJSFunction(Map* map, | 2060 static inline void EvacuateJSFunction(Map* map, |
2059 HeapObject** slot, | 2061 HeapObject** slot, |
2060 HeapObject* object) { | 2062 HeapObject* object) { |
2061 ObjectEvacuationStrategy<POINTER_OBJECT>:: | 2063 ObjectEvacuationStrategy<POINTER_OBJECT>:: |
2062 template VisitSpecialized<JSFunction::kSize>(map, slot, object); | 2064 template VisitSpecialized<JSFunction::kSize>(map, slot, object); |
2063 | 2065 |
(...skipping 4306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6370 static_cast<int>(object_sizes_last_time_[index])); | 6372 static_cast<int>(object_sizes_last_time_[index])); |
6371 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6373 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6372 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6374 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6373 | 6375 |
6374 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6376 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6375 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6377 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6376 ClearObjectStats(); | 6378 ClearObjectStats(); |
6377 } | 6379 } |
6378 | 6380 |
6379 } } // namespace v8::internal | 6381 } } // namespace v8::internal |
OLD | NEW |