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/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 DCHECK_LE(1, reservation->length()); | 932 DCHECK_LE(1, reservation->length()); |
933 if (reservation->at(0).size == 0) continue; | 933 if (reservation->at(0).size == 0) continue; |
934 bool perform_gc = false; | 934 bool perform_gc = false; |
935 if (space == LO_SPACE) { | 935 if (space == LO_SPACE) { |
936 DCHECK_EQ(1, reservation->length()); | 936 DCHECK_EQ(1, reservation->length()); |
937 perform_gc = !lo_space()->CanAllocateSize(reservation->at(0).size); | 937 perform_gc = !lo_space()->CanAllocateSize(reservation->at(0).size); |
938 } else { | 938 } else { |
939 for (auto& chunk : *reservation) { | 939 for (auto& chunk : *reservation) { |
940 AllocationResult allocation; | 940 AllocationResult allocation; |
941 int size = chunk.size; | 941 int size = chunk.size; |
| 942 DCHECK_LE(size, MemoryAllocator::PageAreaSize( |
| 943 static_cast<AllocationSpace>(space))); |
942 if (space == NEW_SPACE) { | 944 if (space == NEW_SPACE) { |
943 allocation = new_space()->AllocateRaw(size); | 945 allocation = new_space()->AllocateRaw(size); |
944 } else { | 946 } else { |
945 allocation = paged_space(space)->AllocateRaw(size); | 947 allocation = paged_space(space)->AllocateRaw(size); |
946 } | 948 } |
947 FreeListNode* node; | 949 FreeListNode* node; |
948 if (allocation.To(&node)) { | 950 if (allocation.To(&node)) { |
949 // Mark with a free list node, in case we have a GC before | 951 // Mark with a free list node, in case we have a GC before |
950 // deserializing. | 952 // deserializing. |
951 node->set_size(this, size); | 953 node->set_size(this, size); |
(...skipping 5300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6252 static_cast<int>(object_sizes_last_time_[index])); | 6254 static_cast<int>(object_sizes_last_time_[index])); |
6253 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6255 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6254 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6256 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6255 | 6257 |
6256 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6258 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6257 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6259 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6258 ClearObjectStats(); | 6260 ClearObjectStats(); |
6259 } | 6261 } |
6260 } | 6262 } |
6261 } // namespace v8::internal | 6263 } // namespace v8::internal |
OLD | NEW |