| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 if (single_chunk) { | 135 if (single_chunk) { |
| 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 if (!FLAG_debug_code) { |
| 146 // We expect the vanilla snapshot to only require on page per space. | 146 // We expect the vanilla snapshot to only require one page per space, |
| 147 // unless we are emitting debug code. |
| 147 DCHECK(!is_default_snapshot); | 148 DCHECK(!is_default_snapshot); |
| 148 } | 149 } |
| 149 | 150 |
| 150 if (space >= FIRST_PAGED_SPACE && space <= LAST_PAGED_SPACE) { | 151 if (space >= FIRST_PAGED_SPACE && space <= LAST_PAGED_SPACE) { |
| 151 uint32_t max_size = | 152 uint32_t max_size = |
| 152 MemoryAllocator::PageAreaSize(static_cast<AllocationSpace>(space)); | 153 MemoryAllocator::PageAreaSize(static_cast<AllocationSpace>(space)); |
| 153 sizes_out[space - FIRST_PAGED_SPACE] = Min(required, max_size); | 154 sizes_out[space - FIRST_PAGED_SPACE] = Min(required, max_size); |
| 154 } else { | 155 } else { |
| 155 DCHECK(single_chunk); | 156 DCHECK(single_chunk); |
| 156 } | 157 } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 Vector<const byte> SnapshotData::Payload() const { | 274 Vector<const byte> SnapshotData::Payload() const { |
| 274 int reservations_size = GetHeaderValue(kNumReservationsOffset) * kInt32Size; | 275 int reservations_size = GetHeaderValue(kNumReservationsOffset) * kInt32Size; |
| 275 const byte* payload = data_ + kHeaderSize + reservations_size; | 276 const byte* payload = data_ + kHeaderSize + reservations_size; |
| 276 int length = GetHeaderValue(kPayloadLengthOffset); | 277 int length = GetHeaderValue(kPayloadLengthOffset); |
| 277 DCHECK_EQ(data_ + size_, payload + length); | 278 DCHECK_EQ(data_ + size_, payload + length); |
| 278 return Vector<const byte>(payload, length); | 279 return Vector<const byte>(payload, length); |
| 279 } | 280 } |
| 280 | 281 |
| 281 } // namespace internal | 282 } // namespace internal |
| 282 } // namespace v8 | 283 } // namespace v8 |
| OLD | NEW |