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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 v8::StartupData Snapshot::CreateSnapshotBlob( | 148 v8::StartupData Snapshot::CreateSnapshotBlob( |
149 const i::StartupSerializer& startup_ser, | 149 const i::StartupSerializer& startup_ser, |
150 const i::PartialSerializer& context_ser, Snapshot::Metadata metadata) { | 150 const i::PartialSerializer& context_ser, Snapshot::Metadata metadata) { |
151 SnapshotData startup_snapshot(startup_ser); | 151 SnapshotData startup_snapshot(startup_ser); |
152 SnapshotData context_snapshot(context_ser); | 152 SnapshotData context_snapshot(context_ser); |
153 Vector<const byte> startup_data = startup_snapshot.RawData(); | 153 Vector<const byte> startup_data = startup_snapshot.RawData(); |
154 Vector<const byte> context_data = context_snapshot.RawData(); | 154 Vector<const byte> context_data = context_snapshot.RawData(); |
155 | 155 |
156 uint32_t first_page_sizes[kNumPagedSpaces]; | 156 uint32_t first_page_sizes[kNumPagedSpaces]; |
157 | 157 |
158 CalculateFirstPageSizes(metadata.embeds_script(), startup_snapshot, | 158 CalculateFirstPageSizes(!metadata.embeds_script(), startup_snapshot, |
159 context_snapshot, first_page_sizes); | 159 context_snapshot, first_page_sizes); |
160 | 160 |
161 int startup_length = startup_data.length(); | 161 int startup_length = startup_data.length(); |
162 int context_length = context_data.length(); | 162 int context_length = context_data.length(); |
163 int context_offset = ContextOffset(startup_length); | 163 int context_offset = ContextOffset(startup_length); |
164 | 164 |
165 int length = context_offset + context_length; | 165 int length = context_offset + context_length; |
166 char* data = new char[length]; | 166 char* data = new char[length]; |
167 | 167 |
168 memcpy(data + kMetadataOffset, &metadata.RawValue(), kInt32Size); | 168 memcpy(data + kMetadataOffset, &metadata.RawValue(), kInt32Size); |
(...skipping 30 matching lines...) Expand all Loading... |
199 int startup_length; | 199 int startup_length; |
200 memcpy(&startup_length, data->data + kStartupLengthOffset, kIntSize); | 200 memcpy(&startup_length, data->data + kStartupLengthOffset, kIntSize); |
201 int context_offset = ContextOffset(startup_length); | 201 int context_offset = ContextOffset(startup_length); |
202 const byte* context_data = | 202 const byte* context_data = |
203 reinterpret_cast<const byte*>(data->data + context_offset); | 203 reinterpret_cast<const byte*>(data->data + context_offset); |
204 DCHECK_LT(context_offset, data->raw_size); | 204 DCHECK_LT(context_offset, data->raw_size); |
205 int context_length = data->raw_size - context_offset; | 205 int context_length = data->raw_size - context_offset; |
206 return Vector<const byte>(context_data, context_length); | 206 return Vector<const byte>(context_data, context_length); |
207 } | 207 } |
208 } } // namespace v8::internal | 208 } } // namespace v8::internal |
OLD | NEW |