| 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/v8.h" | 7 #include "src/v8.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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 uint32_t required = kMaxUInt32; | 130 uint32_t required = kMaxUInt32; |
| 131 if (single_chunk) { | 131 if (single_chunk) { |
| 132 // If both the startup snapshot data and the context snapshot data on | 132 // If both the startup snapshot data and the context snapshot data on |
| 133 // this space fit in a single page, then we consider limiting the size | 133 // this space fit in a single page, then we consider limiting the size |
| 134 // of the first page. For this, we add the chunk sizes and some extra | 134 // of the first page. For this, we add the chunk sizes and some extra |
| 135 // allowance. This way we achieve a smaller startup memory footprint. | 135 // allowance. This way we achieve a smaller startup memory footprint. |
| 136 required = (startup_reservations[startup_index].chunk_size() + | 136 required = (startup_reservations[startup_index].chunk_size() + |
| 137 2 * context_reservations[context_index].chunk_size()) + | 137 2 * context_reservations[context_index].chunk_size()) + |
| 138 Page::kObjectStartOffset; | 138 Page::kObjectStartOffset; |
| 139 // Add a small allowance to the code space for small scripts. | 139 // Add a small allowance to the code space for small scripts. |
| 140 if (space == CODE_SPACE) required += 32 * KB; | 140 if (space == CODE_SPACE) required += 64 * KB; |
| 141 } else { | 141 } else { |
| 142 // We expect the vanilla snapshot to only require on page per space. | 142 // We expect the vanilla snapshot to only require on page per space. |
| 143 DCHECK(!is_default_snapshot); | 143 DCHECK(!is_default_snapshot); |
| 144 } | 144 } |
| 145 | 145 |
| 146 if (space >= FIRST_PAGED_SPACE && space <= LAST_PAGED_SPACE) { | 146 if (space >= FIRST_PAGED_SPACE && space <= LAST_PAGED_SPACE) { |
| 147 uint32_t max_size = | 147 uint32_t max_size = |
| 148 MemoryAllocator::PageAreaSize(static_cast<AllocationSpace>(space)); | 148 MemoryAllocator::PageAreaSize(static_cast<AllocationSpace>(space)); |
| 149 sizes_out[space - FIRST_PAGED_SPACE] = Min(required, max_size); | 149 sizes_out[space - FIRST_PAGED_SPACE] = Min(required, max_size); |
| 150 } else { | 150 } else { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 memcpy(&startup_length, data->data + kStartupLengthOffset, kIntSize); | 222 memcpy(&startup_length, data->data + kStartupLengthOffset, kIntSize); |
| 223 int context_offset = ContextOffset(startup_length); | 223 int context_offset = ContextOffset(startup_length); |
| 224 const byte* context_data = | 224 const byte* context_data = |
| 225 reinterpret_cast<const byte*>(data->data + context_offset); | 225 reinterpret_cast<const byte*>(data->data + context_offset); |
| 226 DCHECK_LT(context_offset, data->raw_size); | 226 DCHECK_LT(context_offset, data->raw_size); |
| 227 int context_length = data->raw_size - context_offset; | 227 int context_length = data->raw_size - context_offset; |
| 228 return Vector<const byte>(context_data, context_length); | 228 return Vector<const byte>(context_data, context_length); |
| 229 } | 229 } |
| 230 } // namespace internal | 230 } // namespace internal |
| 231 } // namespace v8 | 231 } // namespace v8 |
| OLD | NEW |