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" | |
20 #include "src/stub-cache.h" | 19 #include "src/stub-cache.h" |
21 #include "src/v8threads.h" | 20 #include "src/v8threads.h" |
22 | 21 |
23 namespace v8 { | 22 namespace v8 { |
24 namespace internal { | 23 namespace internal { |
25 | 24 |
26 | 25 |
27 // ----------------------------------------------------------------------------- | 26 // ----------------------------------------------------------------------------- |
28 // Coding of external references. | 27 // Coding of external references. |
29 | 28 |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 } | 1196 } |
1198 | 1197 |
1199 default: | 1198 default: |
1200 UNREACHABLE(); | 1199 UNREACHABLE(); |
1201 } | 1200 } |
1202 } | 1201 } |
1203 ASSERT_EQ(limit, current); | 1202 ASSERT_EQ(limit, current); |
1204 } | 1203 } |
1205 | 1204 |
1206 | 1205 |
| 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 |
1207 Serializer::Serializer(Isolate* isolate, SnapshotByteSink* sink) | 1219 Serializer::Serializer(Isolate* isolate, SnapshotByteSink* sink) |
1208 : isolate_(isolate), | 1220 : isolate_(isolate), |
1209 sink_(sink), | 1221 sink_(sink), |
1210 external_reference_encoder_(new ExternalReferenceEncoder(isolate)), | 1222 external_reference_encoder_(new ExternalReferenceEncoder(isolate)), |
1211 root_index_wave_front_(0), | 1223 root_index_wave_front_(0), |
1212 code_address_map_(NULL) { | 1224 code_address_map_(NULL) { |
1213 // The serializer is meant to be used only to generate initial heap images | 1225 // The serializer is meant to be used only to generate initial heap images |
1214 // from a context in which there is only one isolate. | 1226 // from a context in which there is only one isolate. |
1215 for (int i = 0; i <= LAST_SPACE; i++) { | 1227 for (int i = 0; i <= LAST_SPACE; i++) { |
1216 fullness_[i] = 0; | 1228 fullness_[i] = 0; |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1812 } | 1824 } |
1813 } | 1825 } |
1814 | 1826 |
1815 | 1827 |
1816 void Serializer::InitializeCodeAddressMap() { | 1828 void Serializer::InitializeCodeAddressMap() { |
1817 isolate_->InitializeLoggingAndCounters(); | 1829 isolate_->InitializeLoggingAndCounters(); |
1818 code_address_map_ = new CodeAddressMap(isolate_); | 1830 code_address_map_ = new CodeAddressMap(isolate_); |
1819 } | 1831 } |
1820 | 1832 |
1821 | 1833 |
| 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 |
1822 } } // namespace v8::internal | 1842 } } // namespace v8::internal |
OLD | NEW |