OLD | NEW |
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 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 } | 1197 } |
1197 | 1198 |
1198 default: | 1199 default: |
1199 UNREACHABLE(); | 1200 UNREACHABLE(); |
1200 } | 1201 } |
1201 } | 1202 } |
1202 ASSERT_EQ(limit, current); | 1203 ASSERT_EQ(limit, current); |
1203 } | 1204 } |
1204 | 1205 |
1205 | 1206 |
1206 void SnapshotByteSink::PutInt(uintptr_t integer, const char* description) { | |
1207 ASSERT(integer < 1 << 22); | |
1208 integer <<= 2; | |
1209 int bytes = 1; | |
1210 if (integer > 0xff) bytes = 2; | |
1211 if (integer > 0xffff) bytes = 3; | |
1212 integer |= bytes; | |
1213 Put(static_cast<int>(integer & 0xff), "IntPart1"); | |
1214 if (bytes > 1) Put(static_cast<int>((integer >> 8) & 0xff), "IntPart2"); | |
1215 if (bytes > 2) Put(static_cast<int>((integer >> 16) & 0xff), "IntPart3"); | |
1216 } | |
1217 | |
1218 | |
1219 Serializer::Serializer(Isolate* isolate, SnapshotByteSink* sink) | 1207 Serializer::Serializer(Isolate* isolate, SnapshotByteSink* sink) |
1220 : isolate_(isolate), | 1208 : isolate_(isolate), |
1221 sink_(sink), | 1209 sink_(sink), |
1222 external_reference_encoder_(new ExternalReferenceEncoder(isolate)), | 1210 external_reference_encoder_(new ExternalReferenceEncoder(isolate)), |
1223 root_index_wave_front_(0), | 1211 root_index_wave_front_(0), |
1224 code_address_map_(NULL) { | 1212 code_address_map_(NULL) { |
1225 // The serializer is meant to be used only to generate initial heap images | 1213 // The serializer is meant to be used only to generate initial heap images |
1226 // from a context in which there is only one isolate. | 1214 // from a context in which there is only one isolate. |
1227 for (int i = 0; i <= LAST_SPACE; i++) { | 1215 for (int i = 0; i <= LAST_SPACE; i++) { |
1228 fullness_[i] = 0; | 1216 fullness_[i] = 0; |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1824 } | 1812 } |
1825 } | 1813 } |
1826 | 1814 |
1827 | 1815 |
1828 void Serializer::InitializeCodeAddressMap() { | 1816 void Serializer::InitializeCodeAddressMap() { |
1829 isolate_->InitializeLoggingAndCounters(); | 1817 isolate_->InitializeLoggingAndCounters(); |
1830 code_address_map_ = new CodeAddressMap(isolate_); | 1818 code_address_map_ = new CodeAddressMap(isolate_); |
1831 } | 1819 } |
1832 | 1820 |
1833 | 1821 |
1834 bool SnapshotByteSource::AtEOF() { | |
1835 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; | |
1836 for (int x = position_; x < length_; x++) { | |
1837 if (data_[x] != SerializerDeserializer::nop()) return false; | |
1838 } | |
1839 return true; | |
1840 } | |
1841 | |
1842 } } // namespace v8::internal | 1822 } } // namespace v8::internal |
OLD | NEW |