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

Side by Side Diff: src/serialize.cc

Issue 334913004: Support external startup data in V8. (retry) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase + style fix Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/serialize.h ('k') | src/snapshot.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
11 #include "src/execution.h" 11 #include "src/execution.h"
12 #include "src/global-handles.h" 12 #include "src/global-handles.h"
13 #include "src/ic-inl.h" 13 #include "src/ic-inl.h"
14 #include "src/natives.h" 14 #include "src/natives.h"
15 #include "src/platform.h" 15 #include "src/platform.h"
16 #include "src/runtime.h" 16 #include "src/runtime.h"
17 #include "src/serialize.h" 17 #include "src/serialize.h"
18 #include "src/snapshot.h" 18 #include "src/snapshot.h"
19 #include "src/snapshot-source-sink.h"
19 #include "src/stub-cache.h" 20 #include "src/stub-cache.h"
20 #include "src/v8threads.h" 21 #include "src/v8threads.h"
21 22
22 namespace v8 { 23 namespace v8 {
23 namespace internal { 24 namespace internal {
24 25
25 26
26 // ----------------------------------------------------------------------------- 27 // -----------------------------------------------------------------------------
27 // Coding of external references. 28 // Coding of external references.
28 29
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 } 1198 }
1198 1199
1199 default: 1200 default:
1200 UNREACHABLE(); 1201 UNREACHABLE();
1201 } 1202 }
1202 } 1203 }
1203 ASSERT_EQ(limit, current); 1204 ASSERT_EQ(limit, current);
1204 } 1205 }
1205 1206
1206 1207
1207 void SnapshotByteSink::PutInt(uintptr_t integer, const char* description) {
1208 ASSERT(integer < 1 << 22);
1209 integer <<= 2;
1210 int bytes = 1;
1211 if (integer > 0xff) bytes = 2;
1212 if (integer > 0xffff) bytes = 3;
1213 integer |= bytes;
1214 Put(static_cast<int>(integer & 0xff), "IntPart1");
1215 if (bytes > 1) Put(static_cast<int>((integer >> 8) & 0xff), "IntPart2");
1216 if (bytes > 2) Put(static_cast<int>((integer >> 16) & 0xff), "IntPart3");
1217 }
1218
1219
1220 Serializer::Serializer(Isolate* isolate, SnapshotByteSink* sink) 1208 Serializer::Serializer(Isolate* isolate, SnapshotByteSink* sink)
1221 : isolate_(isolate), 1209 : isolate_(isolate),
1222 sink_(sink), 1210 sink_(sink),
1223 external_reference_encoder_(new ExternalReferenceEncoder(isolate)), 1211 external_reference_encoder_(new ExternalReferenceEncoder(isolate)),
1224 root_index_wave_front_(0), 1212 root_index_wave_front_(0),
1225 code_address_map_(NULL) { 1213 code_address_map_(NULL) {
1226 // The serializer is meant to be used only to generate initial heap images 1214 // The serializer is meant to be used only to generate initial heap images
1227 // from a context in which there is only one isolate. 1215 // from a context in which there is only one isolate.
1228 for (int i = 0; i <= LAST_SPACE; i++) { 1216 for (int i = 0; i <= LAST_SPACE; i++) {
1229 fullness_[i] = 0; 1217 fullness_[i] = 0;
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 } 1813 }
1826 } 1814 }
1827 1815
1828 1816
1829 void Serializer::InitializeCodeAddressMap() { 1817 void Serializer::InitializeCodeAddressMap() {
1830 isolate_->InitializeLoggingAndCounters(); 1818 isolate_->InitializeLoggingAndCounters();
1831 code_address_map_ = new CodeAddressMap(isolate_); 1819 code_address_map_ = new CodeAddressMap(isolate_);
1832 } 1820 }
1833 1821
1834 1822
1835 bool SnapshotByteSource::AtEOF() {
1836 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false;
1837 for (int x = position_; x < length_; x++) {
1838 if (data_[x] != SerializerDeserializer::nop()) return false;
1839 }
1840 return true;
1841 }
1842
1843 } } // namespace v8::internal 1823 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/serialize.h ('k') | src/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698