Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: src/snapshot-common.cc

Issue 996213003: Hide native Date implementation in function context. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: padded formatting Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 void CalculateFirstPageSizes(bool is_default_snapshot, 91 void CalculateFirstPageSizes(bool is_default_snapshot,
92 const SnapshotData& startup_snapshot, 92 const SnapshotData& startup_snapshot,
93 const SnapshotData& context_snapshot, 93 const SnapshotData& context_snapshot,
94 uint32_t* sizes_out) { 94 uint32_t* sizes_out) {
95 Vector<const SerializedData::Reservation> startup_reservations = 95 Vector<const SerializedData::Reservation> startup_reservations =
96 startup_snapshot.Reservations(); 96 startup_snapshot.Reservations();
97 Vector<const SerializedData::Reservation> context_reservations = 97 Vector<const SerializedData::Reservation> context_reservations =
98 context_snapshot.Reservations(); 98 context_snapshot.Reservations();
99 int startup_index = 0; 99 int startup_index = 0;
100 int context_index = 0; 100 int context_index = 0;
101
102 if (FLAG_profile_deserialization) {
103 int startup_total = 0;
104 int context_total = 0;
105 for (auto& reservation : startup_reservations) {
106 startup_total += reservation.chunk_size();
107 }
108 for (auto& reservation : context_reservations) {
109 context_total += reservation.chunk_size();
110 }
111 PrintF(
112 "Deserialization will reserve:\n"
113 "%*d bytes for startup\n"
114 "%*d bytes per context\n",
115 10, startup_total, 10, context_total);
116 }
117
101 for (int space = 0; space < i::Serializer::kNumberOfSpaces; space++) { 118 for (int space = 0; space < i::Serializer::kNumberOfSpaces; space++) {
102 bool single_chunk = true; 119 bool single_chunk = true;
103 while (!startup_reservations[startup_index].is_last()) { 120 while (!startup_reservations[startup_index].is_last()) {
104 single_chunk = false; 121 single_chunk = false;
105 startup_index++; 122 startup_index++;
106 } 123 }
107 while (!context_reservations[context_index].is_last()) { 124 while (!context_reservations[context_index].is_last()) {
108 single_chunk = false; 125 single_chunk = false;
109 context_index++; 126 context_index++;
110 } 127 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 int length = context_offset + context_length; 176 int length = context_offset + context_length;
160 char* data = new char[length]; 177 char* data = new char[length];
161 178
162 memcpy(data + kMetadataOffset, &metadata.RawValue(), kInt32Size); 179 memcpy(data + kMetadataOffset, &metadata.RawValue(), kInt32Size);
163 memcpy(data + kFirstPageSizesOffset, first_page_sizes, 180 memcpy(data + kFirstPageSizesOffset, first_page_sizes,
164 kNumPagedSpaces * kInt32Size); 181 kNumPagedSpaces * kInt32Size);
165 memcpy(data + kStartupLengthOffset, &startup_length, kInt32Size); 182 memcpy(data + kStartupLengthOffset, &startup_length, kInt32Size);
166 memcpy(data + kStartupDataOffset, startup_data.begin(), startup_length); 183 memcpy(data + kStartupDataOffset, startup_data.begin(), startup_length);
167 memcpy(data + context_offset, context_data.begin(), context_length); 184 memcpy(data + context_offset, context_data.begin(), context_length);
168 v8::StartupData result = {data, length}; 185 v8::StartupData result = {data, length};
186
187 if (FLAG_profile_deserialization) {
188 PrintF(
189 "Snapshot blob consists of:\n"
190 "%*d bytes for startup\n"
191 "%*d bytes for context\n",
192 10, startup_length, 10, context_length);
193 }
169 return result; 194 return result;
170 } 195 }
171 196
172 197
173 Snapshot::Metadata Snapshot::ExtractMetadata(const v8::StartupData* data) { 198 Snapshot::Metadata Snapshot::ExtractMetadata(const v8::StartupData* data) {
174 uint32_t raw; 199 uint32_t raw;
175 memcpy(&raw, data->data + kMetadataOffset, kInt32Size); 200 memcpy(&raw, data->data + kMetadataOffset, kInt32Size);
176 return Metadata(raw); 201 return Metadata(raw);
177 } 202 }
178 203
(...skipping 14 matching lines...) Expand all
193 int startup_length; 218 int startup_length;
194 memcpy(&startup_length, data->data + kStartupLengthOffset, kIntSize); 219 memcpy(&startup_length, data->data + kStartupLengthOffset, kIntSize);
195 int context_offset = ContextOffset(startup_length); 220 int context_offset = ContextOffset(startup_length);
196 const byte* context_data = 221 const byte* context_data =
197 reinterpret_cast<const byte*>(data->data + context_offset); 222 reinterpret_cast<const byte*>(data->data + context_offset);
198 DCHECK_LT(context_offset, data->raw_size); 223 DCHECK_LT(context_offset, data->raw_size);
199 int context_length = data->raw_size - context_offset; 224 int context_length = data->raw_size - context_offset;
200 return Vector<const byte>(context_data, context_length); 225 return Vector<const byte>(context_data, context_length);
201 } 226 }
202 } } // namespace v8::internal 227 } } // namespace v8::internal
OLDNEW
« src/i18n.js ('K') | « src/math.js ('k') | src/third_party/fdlibm/fdlibm.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698