OLD | NEW |
---|---|
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 // The common functionality when building with or without snapshots. | 5 // The common functionality when building with or without snapshots. |
6 | 6 |
7 #include "src/snapshot/snapshot.h" | 7 #include "src/snapshot/snapshot.h" |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 // If both the startup snapshot data and the context snapshot data on | 136 // If both the startup snapshot data and the context snapshot data on |
137 // this space fit in a single page, then we consider limiting the size | 137 // this space fit in a single page, then we consider limiting the size |
138 // of the first page. For this, we add the chunk sizes and some extra | 138 // of the first page. For this, we add the chunk sizes and some extra |
139 // allowance. This way we achieve a smaller startup memory footprint. | 139 // allowance. This way we achieve a smaller startup memory footprint. |
140 required = (startup_reservations[startup_index].chunk_size() + | 140 required = (startup_reservations[startup_index].chunk_size() + |
141 2 * context_reservations[context_index].chunk_size()) + | 141 2 * context_reservations[context_index].chunk_size()) + |
142 Page::kObjectStartOffset; | 142 Page::kObjectStartOffset; |
143 // Add a small allowance to the code space for small scripts. | 143 // Add a small allowance to the code space for small scripts. |
144 if (space == CODE_SPACE) required += 32 * KB; | 144 if (space == CODE_SPACE) required += 32 * KB; |
145 } else { | 145 } else { |
146 // We expect the vanilla snapshot to only require on page per space. | 146 if (!FLAG_debug_code) { |
Yang
2016/05/17 11:12:57
I don't feel too strongly about this, but we could
epertoso
2016/05/17 12:21:20
Done.
| |
147 DCHECK(!is_default_snapshot); | 147 // We expect the vanilla snapshot to only require on page per space. |
rmcilroy
2016/05/17 10:45:23
/s/on/one
/s/per space./per space, unless we are e
epertoso
2016/05/17 11:02:31
Done.
| |
148 DCHECK(!is_default_snapshot); | |
149 } | |
148 } | 150 } |
149 | 151 |
150 if (space >= FIRST_PAGED_SPACE && space <= LAST_PAGED_SPACE) { | 152 if (space >= FIRST_PAGED_SPACE && space <= LAST_PAGED_SPACE) { |
151 uint32_t max_size = | 153 uint32_t max_size = |
152 MemoryAllocator::PageAreaSize(static_cast<AllocationSpace>(space)); | 154 MemoryAllocator::PageAreaSize(static_cast<AllocationSpace>(space)); |
153 sizes_out[space - FIRST_PAGED_SPACE] = Min(required, max_size); | 155 sizes_out[space - FIRST_PAGED_SPACE] = Min(required, max_size); |
154 } else { | 156 } else { |
155 DCHECK(single_chunk); | 157 DCHECK(single_chunk); |
156 } | 158 } |
157 startup_index++; | 159 startup_index++; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 Vector<const byte> SnapshotData::Payload() const { | 275 Vector<const byte> SnapshotData::Payload() const { |
274 int reservations_size = GetHeaderValue(kNumReservationsOffset) * kInt32Size; | 276 int reservations_size = GetHeaderValue(kNumReservationsOffset) * kInt32Size; |
275 const byte* payload = data_ + kHeaderSize + reservations_size; | 277 const byte* payload = data_ + kHeaderSize + reservations_size; |
276 int length = GetHeaderValue(kPayloadLengthOffset); | 278 int length = GetHeaderValue(kPayloadLengthOffset); |
277 DCHECK_EQ(data_ + size_, payload + length); | 279 DCHECK_EQ(data_ + size_, payload + length); |
278 return Vector<const byte>(payload, length); | 280 return Vector<const byte>(payload, length); |
279 } | 281 } |
280 | 282 |
281 } // namespace internal | 283 } // namespace internal |
282 } // namespace v8 | 284 } // namespace v8 |
OLD | NEW |