OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/clustered_snapshot.h" | 5 #include "vm/clustered_snapshot.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
11 #include "vm/dart_entry.h" | 11 #include "vm/dart_entry.h" |
12 #include "vm/exceptions.h" | 12 #include "vm/exceptions.h" |
13 #include "vm/heap.h" | 13 #include "vm/heap.h" |
14 #include "vm/lockers.h" | 14 #include "vm/lockers.h" |
15 #include "vm/longjump.h" | 15 #include "vm/longjump.h" |
16 #include "vm/native_entry.h" | 16 #include "vm/native_entry.h" |
17 #include "vm/object.h" | 17 #include "vm/object.h" |
18 #include "vm/object_store.h" | 18 #include "vm/object_store.h" |
19 #include "vm/stub_code.h" | 19 #include "vm/stub_code.h" |
20 #include "vm/symbols.h" | 20 #include "vm/symbols.h" |
21 #include "vm/timeline.h" | 21 #include "vm/timeline.h" |
22 #include "vm/version.h" | 22 #include "vm/version.h" |
23 | 23 |
24 namespace dart { | 24 namespace dart { |
25 | 25 |
26 static RawObject* AllocateUninitialized(PageSpace* old_space, intptr_t size) { | 26 static RawObject* AllocateUninitialized(PageSpace* old_space, intptr_t size) { |
27 ASSERT(Utils::IsAligned(size, kObjectAlignment)); | 27 ASSERT(Utils::IsAligned(size, kObjectAlignment)); |
28 uword address = old_space->TryAllocateDataBumpLocked(size, | 28 uword address = |
29 PageSpace::kForceGrowth); | 29 old_space->TryAllocateDataBumpLocked(size, PageSpace::kForceGrowth); |
30 if (address == 0) { | 30 if (address == 0) { |
31 OUT_OF_MEMORY(); | 31 OUT_OF_MEMORY(); |
32 } | 32 } |
33 return reinterpret_cast<RawObject*>(address + kHeapObjectTag); | 33 return reinterpret_cast<RawObject*>(address + kHeapObjectTag); |
34 } | 34 } |
35 | 35 |
36 | 36 |
37 void Deserializer::InitializeHeader(RawObject* raw, | 37 void Deserializer::InitializeHeader(RawObject* raw, |
38 intptr_t class_id, | 38 intptr_t class_id, |
39 intptr_t size, | 39 intptr_t size, |
40 bool is_vm_isolate, | 40 bool is_vm_isolate, |
41 bool is_canonical) { | 41 bool is_canonical) { |
42 ASSERT(Utils::IsAligned(size, kObjectAlignment)); | 42 ASSERT(Utils::IsAligned(size, kObjectAlignment)); |
43 uword tags = 0; | 43 uword tags = 0; |
44 tags = RawObject::ClassIdTag::update(class_id, tags); | 44 tags = RawObject::ClassIdTag::update(class_id, tags); |
45 tags = RawObject::SizeTag::update(size, tags); | 45 tags = RawObject::SizeTag::update(size, tags); |
46 tags = RawObject::VMHeapObjectTag::update(is_vm_isolate, tags); | 46 tags = RawObject::VMHeapObjectTag::update(is_vm_isolate, tags); |
47 tags = RawObject::CanonicalObjectTag::update(is_canonical, tags); | 47 tags = RawObject::CanonicalObjectTag::update(is_canonical, tags); |
48 raw->ptr()->tags_ = tags; | 48 raw->ptr()->tags_ = tags; |
49 } | 49 } |
50 | 50 |
51 | 51 |
52 #if !defined(DART_PRECOMPILED_RUNTIME) | 52 #if !defined(DART_PRECOMPILED_RUNTIME) |
53 class ClassSerializationCluster : public SerializationCluster { | 53 class ClassSerializationCluster : public SerializationCluster { |
54 public: | 54 public: |
55 explicit ClassSerializationCluster(intptr_t num_cids) : | 55 explicit ClassSerializationCluster(intptr_t num_cids) |
56 predefined_(kNumPredefinedCids), objects_(num_cids) { } | 56 : predefined_(kNumPredefinedCids), objects_(num_cids) {} |
57 virtual ~ClassSerializationCluster() { } | 57 virtual ~ClassSerializationCluster() {} |
58 | 58 |
59 void Trace(Serializer* s, RawObject* object) { | 59 void Trace(Serializer* s, RawObject* object) { |
60 RawClass* cls = Class::RawCast(object); | 60 RawClass* cls = Class::RawCast(object); |
61 intptr_t class_id = cls->ptr()->id_; | 61 intptr_t class_id = cls->ptr()->id_; |
62 | 62 |
63 if (class_id < kNumPredefinedCids) { | 63 if (class_id < kNumPredefinedCids) { |
64 // These classes are allocated by Object::Init or Object::InitOnce, so the | 64 // These classes are allocated by Object::Init or Object::InitOnce, so the |
65 // deserializer must find them in the class table instead of allocating | 65 // deserializer must find them in the class table instead of allocating |
66 // them. | 66 // them. |
67 predefined_.Add(cls); | 67 predefined_.Add(cls); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 private: | 128 private: |
129 GrowableArray<RawClass*> predefined_; | 129 GrowableArray<RawClass*> predefined_; |
130 GrowableArray<RawClass*> objects_; | 130 GrowableArray<RawClass*> objects_; |
131 }; | 131 }; |
132 #endif // !DART_PRECOMPILED_RUNTIME | 132 #endif // !DART_PRECOMPILED_RUNTIME |
133 | 133 |
134 | 134 |
135 class ClassDeserializationCluster : public DeserializationCluster { | 135 class ClassDeserializationCluster : public DeserializationCluster { |
136 public: | 136 public: |
137 ClassDeserializationCluster() { } | 137 ClassDeserializationCluster() {} |
138 virtual ~ClassDeserializationCluster() { } | 138 virtual ~ClassDeserializationCluster() {} |
139 | 139 |
140 void ReadAlloc(Deserializer* d) { | 140 void ReadAlloc(Deserializer* d) { |
141 predefined_start_index_ = d->next_index(); | 141 predefined_start_index_ = d->next_index(); |
142 PageSpace* old_space = d->heap()->old_space(); | 142 PageSpace* old_space = d->heap()->old_space(); |
143 intptr_t count = d->Read<int32_t>(); | 143 intptr_t count = d->Read<int32_t>(); |
144 ClassTable* table = d->isolate()->class_table(); | 144 ClassTable* table = d->isolate()->class_table(); |
145 for (intptr_t i = 0; i < count; i++) { | 145 for (intptr_t i = 0; i < count; i++) { |
146 intptr_t class_id = d->ReadCid(); | 146 intptr_t class_id = d->ReadCid(); |
147 ASSERT(table->HasValidClassAt(class_id)); | 147 ASSERT(table->HasValidClassAt(class_id)); |
148 RawClass* cls = table->At(class_id); | 148 RawClass* cls = table->At(class_id); |
149 ASSERT(cls != NULL); | 149 ASSERT(cls != NULL); |
150 d->AssignRef(cls); | 150 d->AssignRef(cls); |
151 } | 151 } |
152 predefined_stop_index_ = d->next_index(); | 152 predefined_stop_index_ = d->next_index(); |
153 | 153 |
154 start_index_ = d->next_index(); | 154 start_index_ = d->next_index(); |
155 count = d->Read<int32_t>(); | 155 count = d->Read<int32_t>(); |
156 for (intptr_t i = 0; i < count; i++) { | 156 for (intptr_t i = 0; i < count; i++) { |
157 d->AssignRef(AllocateUninitialized(old_space, | 157 d->AssignRef(AllocateUninitialized(old_space, Class::InstanceSize())); |
158 Class::InstanceSize())); | |
159 } | 158 } |
160 stop_index_ = d->next_index(); | 159 stop_index_ = d->next_index(); |
161 } | 160 } |
162 | 161 |
163 void ReadFill(Deserializer* d) { | 162 void ReadFill(Deserializer* d) { |
164 Snapshot::Kind kind = d->kind(); | 163 Snapshot::Kind kind = d->kind(); |
165 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 164 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
166 ClassTable* table = d->isolate()->class_table(); | 165 ClassTable* table = d->isolate()->class_table(); |
167 | 166 |
168 for (intptr_t id = predefined_start_index_; | 167 for (intptr_t id = predefined_start_index_; id < predefined_stop_index_; |
169 id < predefined_stop_index_; | |
170 id++) { | 168 id++) { |
171 RawClass* cls = reinterpret_cast<RawClass*>(d->Ref(id)); | 169 RawClass* cls = reinterpret_cast<RawClass*>(d->Ref(id)); |
172 RawObject** from = cls->from(); | 170 RawObject** from = cls->from(); |
173 RawObject** to_snapshot = cls->to_snapshot(kind); | 171 RawObject** to_snapshot = cls->to_snapshot(kind); |
174 for (RawObject** p = from; p <= to_snapshot; p++) { | 172 for (RawObject** p = from; p <= to_snapshot; p++) { |
175 *p = d->ReadRef(); | 173 *p = d->ReadRef(); |
176 } | 174 } |
177 | 175 |
178 intptr_t class_id = d->ReadCid(); | 176 intptr_t class_id = d->ReadCid(); |
179 cls->ptr()->id_ = class_id; | 177 cls->ptr()->id_ = class_id; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 cls->ptr()->num_native_fields_ = d->Read<uint16_t>(); | 219 cls->ptr()->num_native_fields_ = d->Read<uint16_t>(); |
222 cls->ptr()->token_pos_ = d->ReadTokenPosition(); | 220 cls->ptr()->token_pos_ = d->ReadTokenPosition(); |
223 cls->ptr()->state_bits_ = d->Read<uint16_t>(); | 221 cls->ptr()->state_bits_ = d->Read<uint16_t>(); |
224 | 222 |
225 table->AllocateIndex(class_id); | 223 table->AllocateIndex(class_id); |
226 table->SetAt(class_id, cls); | 224 table->SetAt(class_id, cls); |
227 } | 225 } |
228 } | 226 } |
229 | 227 |
230 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { | 228 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { |
231 NOT_IN_PRODUCT(TimelineDurationScope tds(Thread::Current(), | 229 NOT_IN_PRODUCT(TimelineDurationScope tds( |
232 Timeline::GetIsolateStream(), "PostLoadClass")); | 230 Thread::Current(), Timeline::GetIsolateStream(), "PostLoadClass")); |
233 | 231 |
234 Class& cls = Class::Handle(zone); | 232 Class& cls = Class::Handle(zone); |
235 for (intptr_t i = predefined_start_index_; | 233 for (intptr_t i = predefined_start_index_; i < predefined_stop_index_; |
236 i < predefined_stop_index_; | |
237 i++) { | 234 i++) { |
238 cls ^= refs.At(i); | 235 cls ^= refs.At(i); |
239 cls.RehashConstants(zone); | 236 cls.RehashConstants(zone); |
240 } | 237 } |
241 for (intptr_t i = start_index_; i < stop_index_; i++) { | 238 for (intptr_t i = start_index_; i < stop_index_; i++) { |
242 cls ^= refs.At(i); | 239 cls ^= refs.At(i); |
243 cls.RehashConstants(zone); | 240 cls.RehashConstants(zone); |
244 } | 241 } |
245 } | 242 } |
246 | 243 |
247 private: | 244 private: |
248 intptr_t predefined_start_index_; | 245 intptr_t predefined_start_index_; |
249 intptr_t predefined_stop_index_; | 246 intptr_t predefined_stop_index_; |
250 }; | 247 }; |
251 | 248 |
252 | 249 |
253 #if !defined(DART_PRECOMPILED_RUNTIME) | 250 #if !defined(DART_PRECOMPILED_RUNTIME) |
254 class UnresolvedClassSerializationCluster : public SerializationCluster { | 251 class UnresolvedClassSerializationCluster : public SerializationCluster { |
255 public: | 252 public: |
256 UnresolvedClassSerializationCluster() { } | 253 UnresolvedClassSerializationCluster() {} |
257 virtual ~UnresolvedClassSerializationCluster() { } | 254 virtual ~UnresolvedClassSerializationCluster() {} |
258 | 255 |
259 void Trace(Serializer* s, RawObject* object) { | 256 void Trace(Serializer* s, RawObject* object) { |
260 RawUnresolvedClass* cls = UnresolvedClass::RawCast(object); | 257 RawUnresolvedClass* cls = UnresolvedClass::RawCast(object); |
261 objects_.Add(cls); | 258 objects_.Add(cls); |
262 | 259 |
263 RawObject** from = cls->from(); | 260 RawObject** from = cls->from(); |
264 RawObject** to = cls->to(); | 261 RawObject** to = cls->to(); |
265 for (RawObject** p = from; p <= to; p++) { | 262 for (RawObject** p = from; p <= to; p++) { |
266 s->Push(*p); | 263 s->Push(*p); |
267 } | 264 } |
(...skipping 24 matching lines...) Expand all Loading... |
292 } | 289 } |
293 | 290 |
294 private: | 291 private: |
295 GrowableArray<RawUnresolvedClass*> objects_; | 292 GrowableArray<RawUnresolvedClass*> objects_; |
296 }; | 293 }; |
297 #endif // !DART_PRECOMPILED_RUNTIME | 294 #endif // !DART_PRECOMPILED_RUNTIME |
298 | 295 |
299 | 296 |
300 class UnresolvedClassDeserializationCluster : public DeserializationCluster { | 297 class UnresolvedClassDeserializationCluster : public DeserializationCluster { |
301 public: | 298 public: |
302 UnresolvedClassDeserializationCluster() { } | 299 UnresolvedClassDeserializationCluster() {} |
303 virtual ~UnresolvedClassDeserializationCluster() { } | 300 virtual ~UnresolvedClassDeserializationCluster() {} |
304 | 301 |
305 void ReadAlloc(Deserializer* d) { | 302 void ReadAlloc(Deserializer* d) { |
306 start_index_ = d->next_index(); | 303 start_index_ = d->next_index(); |
307 PageSpace* old_space = d->heap()->old_space(); | 304 PageSpace* old_space = d->heap()->old_space(); |
308 intptr_t count = d->Read<int32_t>(); | 305 intptr_t count = d->Read<int32_t>(); |
309 for (intptr_t i = 0; i < count; i++) { | 306 for (intptr_t i = 0; i < count; i++) { |
310 d->AssignRef(AllocateUninitialized(old_space, | 307 d->AssignRef( |
311 UnresolvedClass::InstanceSize())); | 308 AllocateUninitialized(old_space, UnresolvedClass::InstanceSize())); |
312 } | 309 } |
313 stop_index_ = d->next_index(); | 310 stop_index_ = d->next_index(); |
314 } | 311 } |
315 | 312 |
316 void ReadFill(Deserializer* d) { | 313 void ReadFill(Deserializer* d) { |
317 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 314 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
318 | 315 |
319 for (intptr_t id = start_index_; id < stop_index_; id++) { | 316 for (intptr_t id = start_index_; id < stop_index_; id++) { |
320 RawUnresolvedClass* cls = | 317 RawUnresolvedClass* cls = |
321 reinterpret_cast<RawUnresolvedClass*>(d->Ref(id)); | 318 reinterpret_cast<RawUnresolvedClass*>(d->Ref(id)); |
322 Deserializer::InitializeHeader(cls, kUnresolvedClassCid, | 319 Deserializer::InitializeHeader(cls, kUnresolvedClassCid, |
323 UnresolvedClass::InstanceSize(), | 320 UnresolvedClass::InstanceSize(), |
324 is_vm_object); | 321 is_vm_object); |
325 RawObject** from = cls->from(); | 322 RawObject** from = cls->from(); |
326 RawObject** to = cls->to(); | 323 RawObject** to = cls->to(); |
327 for (RawObject** p = from; p <= to; p++) { | 324 for (RawObject** p = from; p <= to; p++) { |
328 *p = d->ReadRef(); | 325 *p = d->ReadRef(); |
329 } | 326 } |
330 cls->ptr()->token_pos_ = d->ReadTokenPosition(); | 327 cls->ptr()->token_pos_ = d->ReadTokenPosition(); |
331 } | 328 } |
332 } | 329 } |
333 }; | 330 }; |
334 | 331 |
335 | 332 |
336 #if !defined(DART_PRECOMPILED_RUNTIME) | 333 #if !defined(DART_PRECOMPILED_RUNTIME) |
337 class TypeArgumentsSerializationCluster : public SerializationCluster { | 334 class TypeArgumentsSerializationCluster : public SerializationCluster { |
338 public: | 335 public: |
339 TypeArgumentsSerializationCluster() { } | 336 TypeArgumentsSerializationCluster() {} |
340 virtual ~TypeArgumentsSerializationCluster() { } | 337 virtual ~TypeArgumentsSerializationCluster() {} |
341 | 338 |
342 void Trace(Serializer* s, RawObject* object) { | 339 void Trace(Serializer* s, RawObject* object) { |
343 RawTypeArguments* type_args = TypeArguments::RawCast(object); | 340 RawTypeArguments* type_args = TypeArguments::RawCast(object); |
344 objects_.Add(type_args); | 341 objects_.Add(type_args); |
345 | 342 |
346 s->Push(type_args->ptr()->instantiations_); | 343 s->Push(type_args->ptr()->instantiations_); |
347 intptr_t length = Smi::Value(type_args->ptr()->length_); | 344 intptr_t length = Smi::Value(type_args->ptr()->length_); |
348 for (intptr_t i = 0; i < length; i++) { | 345 for (intptr_t i = 0; i < length; i++) { |
349 s->Push(type_args->ptr()->types()[i]); | 346 s->Push(type_args->ptr()->types()[i]); |
350 } | 347 } |
(...skipping 28 matching lines...) Expand all Loading... |
379 } | 376 } |
380 | 377 |
381 private: | 378 private: |
382 GrowableArray<RawTypeArguments*> objects_; | 379 GrowableArray<RawTypeArguments*> objects_; |
383 }; | 380 }; |
384 #endif // !DART_PRECOMPILED_RUNTIME | 381 #endif // !DART_PRECOMPILED_RUNTIME |
385 | 382 |
386 | 383 |
387 class TypeArgumentsDeserializationCluster : public DeserializationCluster { | 384 class TypeArgumentsDeserializationCluster : public DeserializationCluster { |
388 public: | 385 public: |
389 TypeArgumentsDeserializationCluster() { } | 386 TypeArgumentsDeserializationCluster() {} |
390 virtual ~TypeArgumentsDeserializationCluster() { } | 387 virtual ~TypeArgumentsDeserializationCluster() {} |
391 | 388 |
392 void ReadAlloc(Deserializer* d) { | 389 void ReadAlloc(Deserializer* d) { |
393 start_index_ = d->next_index(); | 390 start_index_ = d->next_index(); |
394 PageSpace* old_space = d->heap()->old_space(); | 391 PageSpace* old_space = d->heap()->old_space(); |
395 intptr_t count = d->Read<int32_t>(); | 392 intptr_t count = d->Read<int32_t>(); |
396 for (intptr_t i = 0; i < count; i++) { | 393 for (intptr_t i = 0; i < count; i++) { |
397 intptr_t length = d->Read<int32_t>(); | 394 intptr_t length = d->Read<int32_t>(); |
398 d->AssignRef(AllocateUninitialized(old_space, | 395 d->AssignRef(AllocateUninitialized(old_space, |
399 TypeArguments::InstanceSize(length))); | 396 TypeArguments::InstanceSize(length))); |
400 } | 397 } |
(...skipping 20 matching lines...) Expand all Loading... |
421 reinterpret_cast<RawAbstractType*>(d->ReadRef()); | 418 reinterpret_cast<RawAbstractType*>(d->ReadRef()); |
422 } | 419 } |
423 } | 420 } |
424 } | 421 } |
425 }; | 422 }; |
426 | 423 |
427 | 424 |
428 #if !defined(DART_PRECOMPILED_RUNTIME) | 425 #if !defined(DART_PRECOMPILED_RUNTIME) |
429 class PatchClassSerializationCluster : public SerializationCluster { | 426 class PatchClassSerializationCluster : public SerializationCluster { |
430 public: | 427 public: |
431 PatchClassSerializationCluster() { } | 428 PatchClassSerializationCluster() {} |
432 virtual ~PatchClassSerializationCluster() { } | 429 virtual ~PatchClassSerializationCluster() {} |
433 | 430 |
434 void Trace(Serializer* s, RawObject* object) { | 431 void Trace(Serializer* s, RawObject* object) { |
435 RawPatchClass* cls = PatchClass::RawCast(object); | 432 RawPatchClass* cls = PatchClass::RawCast(object); |
436 objects_.Add(cls); | 433 objects_.Add(cls); |
437 | 434 |
438 RawObject** from = cls->from(); | 435 RawObject** from = cls->from(); |
439 RawObject** to = cls->to(); | 436 RawObject** to = cls->to(); |
440 for (RawObject** p = from; p <= to; p++) { | 437 for (RawObject** p = from; p <= to; p++) { |
441 s->Push(*p); | 438 s->Push(*p); |
442 } | 439 } |
(...skipping 22 matching lines...) Expand all Loading... |
465 } | 462 } |
466 | 463 |
467 private: | 464 private: |
468 GrowableArray<RawPatchClass*> objects_; | 465 GrowableArray<RawPatchClass*> objects_; |
469 }; | 466 }; |
470 #endif // !DART_PRECOMPILED_RUNTIME | 467 #endif // !DART_PRECOMPILED_RUNTIME |
471 | 468 |
472 | 469 |
473 class PatchClassDeserializationCluster : public DeserializationCluster { | 470 class PatchClassDeserializationCluster : public DeserializationCluster { |
474 public: | 471 public: |
475 PatchClassDeserializationCluster() { } | 472 PatchClassDeserializationCluster() {} |
476 virtual ~PatchClassDeserializationCluster() { } | 473 virtual ~PatchClassDeserializationCluster() {} |
477 | 474 |
478 void ReadAlloc(Deserializer* d) { | 475 void ReadAlloc(Deserializer* d) { |
479 start_index_ = d->next_index(); | 476 start_index_ = d->next_index(); |
480 PageSpace* old_space = d->heap()->old_space(); | 477 PageSpace* old_space = d->heap()->old_space(); |
481 intptr_t count = d->Read<int32_t>(); | 478 intptr_t count = d->Read<int32_t>(); |
482 for (intptr_t i = 0; i < count; i++) { | 479 for (intptr_t i = 0; i < count; i++) { |
483 d->AssignRef(AllocateUninitialized(old_space, | 480 d->AssignRef( |
484 PatchClass::InstanceSize())); | 481 AllocateUninitialized(old_space, PatchClass::InstanceSize())); |
485 } | 482 } |
486 stop_index_ = d->next_index(); | 483 stop_index_ = d->next_index(); |
487 } | 484 } |
488 | 485 |
489 void ReadFill(Deserializer* d) { | 486 void ReadFill(Deserializer* d) { |
490 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 487 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
491 | 488 |
492 for (intptr_t id = start_index_; id < stop_index_; id++) { | 489 for (intptr_t id = start_index_; id < stop_index_; id++) { |
493 RawPatchClass* cls = reinterpret_cast<RawPatchClass*>(d->Ref(id)); | 490 RawPatchClass* cls = reinterpret_cast<RawPatchClass*>(d->Ref(id)); |
494 Deserializer::InitializeHeader(cls, kPatchClassCid, | 491 Deserializer::InitializeHeader(cls, kPatchClassCid, |
495 PatchClass::InstanceSize(), is_vm_object); | 492 PatchClass::InstanceSize(), is_vm_object); |
496 RawObject** from = cls->from(); | 493 RawObject** from = cls->from(); |
497 RawObject** to = cls->to(); | 494 RawObject** to = cls->to(); |
498 for (RawObject** p = from; p <= to; p++) { | 495 for (RawObject** p = from; p <= to; p++) { |
499 *p = d->ReadRef(); | 496 *p = d->ReadRef(); |
500 } | 497 } |
501 } | 498 } |
502 } | 499 } |
503 }; | 500 }; |
504 | 501 |
505 | 502 |
506 #if !defined(DART_PRECOMPILED_RUNTIME) | 503 #if !defined(DART_PRECOMPILED_RUNTIME) |
507 class FunctionSerializationCluster : public SerializationCluster { | 504 class FunctionSerializationCluster : public SerializationCluster { |
508 public: | 505 public: |
509 FunctionSerializationCluster() { } | 506 FunctionSerializationCluster() {} |
510 virtual ~FunctionSerializationCluster() { } | 507 virtual ~FunctionSerializationCluster() {} |
511 | 508 |
512 void Trace(Serializer* s, RawObject* object) { | 509 void Trace(Serializer* s, RawObject* object) { |
513 RawFunction* func = Function::RawCast(object); | 510 RawFunction* func = Function::RawCast(object); |
514 objects_.Add(func); | 511 objects_.Add(func); |
515 | 512 |
516 RawObject** from = func->from(); | 513 RawObject** from = func->from(); |
517 RawObject** to = func->to_snapshot(); | 514 RawObject** to = func->to_snapshot(); |
518 for (RawObject** p = from; p <= to; p++) { | 515 for (RawObject** p = from; p <= to; p++) { |
519 s->Push(*p); | 516 s->Push(*p); |
520 } | 517 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 } | 580 } |
584 | 581 |
585 private: | 582 private: |
586 GrowableArray<RawFunction*> objects_; | 583 GrowableArray<RawFunction*> objects_; |
587 }; | 584 }; |
588 #endif // !DART_PRECOMPILED_RUNTIME | 585 #endif // !DART_PRECOMPILED_RUNTIME |
589 | 586 |
590 | 587 |
591 class FunctionDeserializationCluster : public DeserializationCluster { | 588 class FunctionDeserializationCluster : public DeserializationCluster { |
592 public: | 589 public: |
593 FunctionDeserializationCluster() { } | 590 FunctionDeserializationCluster() {} |
594 virtual ~FunctionDeserializationCluster() { } | 591 virtual ~FunctionDeserializationCluster() {} |
595 | 592 |
596 void ReadAlloc(Deserializer* d) { | 593 void ReadAlloc(Deserializer* d) { |
597 start_index_ = d->next_index(); | 594 start_index_ = d->next_index(); |
598 PageSpace* old_space = d->heap()->old_space(); | 595 PageSpace* old_space = d->heap()->old_space(); |
599 intptr_t count = d->Read<int32_t>(); | 596 intptr_t count = d->Read<int32_t>(); |
600 for (intptr_t i = 0; i < count; i++) { | 597 for (intptr_t i = 0; i < count; i++) { |
601 d->AssignRef(AllocateUninitialized(old_space, | 598 d->AssignRef(AllocateUninitialized(old_space, Function::InstanceSize())); |
602 Function::InstanceSize())); | |
603 } | 599 } |
604 stop_index_ = d->next_index(); | 600 stop_index_ = d->next_index(); |
605 } | 601 } |
606 | 602 |
607 void ReadFill(Deserializer* d) { | 603 void ReadFill(Deserializer* d) { |
608 Snapshot::Kind kind = d->kind(); | 604 Snapshot::Kind kind = d->kind(); |
609 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 605 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
610 | 606 |
611 for (intptr_t id = start_index_; id < stop_index_; id++) { | 607 for (intptr_t id = start_index_; id < stop_index_; id++) { |
612 RawFunction* func = reinterpret_cast<RawFunction*>(d->Ref(id)); | 608 RawFunction* func = reinterpret_cast<RawFunction*>(d->Ref(id)); |
613 Deserializer::InitializeHeader(func, kFunctionCid, | 609 Deserializer::InitializeHeader(func, kFunctionCid, |
614 Function::InstanceSize(), is_vm_object); | 610 Function::InstanceSize(), is_vm_object); |
615 RawObject** from = func->from(); | 611 RawObject** from = func->from(); |
616 RawObject** to_snapshot = func->to_snapshot(); | 612 RawObject** to_snapshot = func->to_snapshot(); |
617 RawObject** to = func->to(); | 613 RawObject** to = func->to(); |
618 for (RawObject** p = from; p <= to_snapshot; p++) { | 614 for (RawObject** p = from; p <= to_snapshot; p++) { |
619 *p = d->ReadRef(); | 615 *p = d->ReadRef(); |
620 } | 616 } |
621 for (RawObject** p = to_snapshot + 1; p <= to; p++) { | 617 for (RawObject** p = to_snapshot + 1; p <= to; p++) { |
622 *p = Object::null(); | 618 *p = Object::null(); |
623 } | 619 } |
624 if (kind == Snapshot::kAppNoJIT) { | 620 if (kind == Snapshot::kAppNoJIT) { |
625 func->ptr()->code_ = reinterpret_cast<RawCode*>(d->ReadRef()); | 621 func->ptr()->code_ = reinterpret_cast<RawCode*>(d->ReadRef()); |
626 } else if (kind == Snapshot::kAppWithJIT) { | 622 } else if (kind == Snapshot::kAppWithJIT) { |
627 NOT_IN_PRECOMPILED(func->ptr()->unoptimized_code_ = | 623 NOT_IN_PRECOMPILED(func->ptr()->unoptimized_code_ = |
628 reinterpret_cast<RawCode*>(d->ReadRef())); | 624 reinterpret_cast<RawCode*>(d->ReadRef())); |
629 func->ptr()->code_ = reinterpret_cast<RawCode*>(d->ReadRef()); | 625 func->ptr()->code_ = reinterpret_cast<RawCode*>(d->ReadRef()); |
630 func->ptr()->ic_data_array_ = reinterpret_cast<RawArray*>(d->ReadRef()); | 626 func->ptr()->ic_data_array_ = reinterpret_cast<RawArray*>(d->ReadRef()); |
631 } | 627 } |
632 | 628 |
633 #if defined(DEBUG) | 629 #if defined(DEBUG) |
634 func->ptr()->entry_point_ = 0; | 630 func->ptr()->entry_point_ = 0; |
635 #endif | 631 #endif |
636 | 632 |
637 #if !defined(DART_PRECOMPILED_RUNTIME) | 633 #if !defined(DART_PRECOMPILED_RUNTIME) |
638 if (kind != Snapshot::kAppNoJIT) { | 634 if (kind != Snapshot::kAppNoJIT) { |
(...skipping 11 matching lines...) Expand all Loading... |
650 func->ptr()->usage_counter_ = d->Read<int32_t>(); | 646 func->ptr()->usage_counter_ = d->Read<int32_t>(); |
651 func->ptr()->deoptimization_counter_ = d->Read<int8_t>(); | 647 func->ptr()->deoptimization_counter_ = d->Read<int8_t>(); |
652 func->ptr()->optimized_instruction_count_ = d->Read<uint16_t>(); | 648 func->ptr()->optimized_instruction_count_ = d->Read<uint16_t>(); |
653 func->ptr()->optimized_call_site_count_ = d->Read<uint16_t>(); | 649 func->ptr()->optimized_call_site_count_ = d->Read<uint16_t>(); |
654 #endif | 650 #endif |
655 } | 651 } |
656 } | 652 } |
657 } | 653 } |
658 | 654 |
659 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { | 655 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { |
660 NOT_IN_PRODUCT(TimelineDurationScope tds(Thread::Current(), | 656 NOT_IN_PRODUCT(TimelineDurationScope tds( |
661 Timeline::GetIsolateStream(), "PostLoadFunction")); | 657 Thread::Current(), Timeline::GetIsolateStream(), "PostLoadFunction")); |
662 | 658 |
663 if (kind == Snapshot::kAppNoJIT) { | 659 if (kind == Snapshot::kAppNoJIT) { |
664 Function& func = Function::Handle(zone); | 660 Function& func = Function::Handle(zone); |
665 for (intptr_t i = start_index_; i < stop_index_; i++) { | 661 for (intptr_t i = start_index_; i < stop_index_; i++) { |
666 func ^= refs.At(i); | 662 func ^= refs.At(i); |
667 ASSERT(func.raw()->ptr()->code_->IsCode()); | 663 ASSERT(func.raw()->ptr()->code_->IsCode()); |
668 uword entry_point = func.raw()->ptr()->code_->ptr()->entry_point_; | 664 uword entry_point = func.raw()->ptr()->code_->ptr()->entry_point_; |
669 ASSERT(entry_point != 0); | 665 ASSERT(entry_point != 0); |
670 func.raw()->ptr()->entry_point_ = entry_point; | 666 func.raw()->ptr()->entry_point_ = entry_point; |
671 } | 667 } |
(...skipping 20 matching lines...) Expand all Loading... |
692 func.set_was_compiled(false); | 688 func.set_was_compiled(false); |
693 } | 689 } |
694 } | 690 } |
695 } | 691 } |
696 }; | 692 }; |
697 | 693 |
698 | 694 |
699 #if !defined(DART_PRECOMPILED_RUNTIME) | 695 #if !defined(DART_PRECOMPILED_RUNTIME) |
700 class ClosureDataSerializationCluster : public SerializationCluster { | 696 class ClosureDataSerializationCluster : public SerializationCluster { |
701 public: | 697 public: |
702 ClosureDataSerializationCluster() { } | 698 ClosureDataSerializationCluster() {} |
703 virtual ~ClosureDataSerializationCluster() { } | 699 virtual ~ClosureDataSerializationCluster() {} |
704 | 700 |
705 void Trace(Serializer* s, RawObject* object) { | 701 void Trace(Serializer* s, RawObject* object) { |
706 RawClosureData* data = ClosureData::RawCast(object); | 702 RawClosureData* data = ClosureData::RawCast(object); |
707 objects_.Add(data); | 703 objects_.Add(data); |
708 | 704 |
709 if (s->kind() != Snapshot::kAppNoJIT) { | 705 if (s->kind() != Snapshot::kAppNoJIT) { |
710 s->Push(data->ptr()->context_scope_); | 706 s->Push(data->ptr()->context_scope_); |
711 } | 707 } |
712 s->Push(data->ptr()->parent_function_); | 708 s->Push(data->ptr()->parent_function_); |
713 s->Push(data->ptr()->signature_type_); | 709 s->Push(data->ptr()->signature_type_); |
(...skipping 24 matching lines...) Expand all Loading... |
738 } | 734 } |
739 | 735 |
740 private: | 736 private: |
741 GrowableArray<RawClosureData*> objects_; | 737 GrowableArray<RawClosureData*> objects_; |
742 }; | 738 }; |
743 #endif // !DART_PRECOMPILED_RUNTIME | 739 #endif // !DART_PRECOMPILED_RUNTIME |
744 | 740 |
745 | 741 |
746 class ClosureDataDeserializationCluster : public DeserializationCluster { | 742 class ClosureDataDeserializationCluster : public DeserializationCluster { |
747 public: | 743 public: |
748 ClosureDataDeserializationCluster() { } | 744 ClosureDataDeserializationCluster() {} |
749 virtual ~ClosureDataDeserializationCluster() { } | 745 virtual ~ClosureDataDeserializationCluster() {} |
750 | 746 |
751 void ReadAlloc(Deserializer* d) { | 747 void ReadAlloc(Deserializer* d) { |
752 start_index_ = d->next_index(); | 748 start_index_ = d->next_index(); |
753 PageSpace* old_space = d->heap()->old_space(); | 749 PageSpace* old_space = d->heap()->old_space(); |
754 intptr_t count = d->Read<int32_t>(); | 750 intptr_t count = d->Read<int32_t>(); |
755 for (intptr_t i = 0; i < count; i++) { | 751 for (intptr_t i = 0; i < count; i++) { |
756 d->AssignRef(AllocateUninitialized(old_space, | 752 d->AssignRef( |
757 ClosureData::InstanceSize())); | 753 AllocateUninitialized(old_space, ClosureData::InstanceSize())); |
758 } | 754 } |
759 stop_index_ = d->next_index(); | 755 stop_index_ = d->next_index(); |
760 } | 756 } |
761 | 757 |
762 void ReadFill(Deserializer* d) { | 758 void ReadFill(Deserializer* d) { |
763 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 759 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
764 | 760 |
765 for (intptr_t id = start_index_; id < stop_index_; id++) { | 761 for (intptr_t id = start_index_; id < stop_index_; id++) { |
766 RawClosureData* data = reinterpret_cast<RawClosureData*>(d->Ref(id)); | 762 RawClosureData* data = reinterpret_cast<RawClosureData*>(d->Ref(id)); |
767 Deserializer::InitializeHeader(data, kClosureDataCid, | 763 Deserializer::InitializeHeader(data, kClosureDataCid, |
768 ClosureData::InstanceSize(), | 764 ClosureData::InstanceSize(), is_vm_object); |
769 is_vm_object); | |
770 if (d->kind() == Snapshot::kAppNoJIT) { | 765 if (d->kind() == Snapshot::kAppNoJIT) { |
771 data->ptr()->context_scope_ = ContextScope::null(); | 766 data->ptr()->context_scope_ = ContextScope::null(); |
772 } else { | 767 } else { |
773 data->ptr()->context_scope_ = | 768 data->ptr()->context_scope_ = |
774 static_cast<RawContextScope*>(d->ReadRef()); | 769 static_cast<RawContextScope*>(d->ReadRef()); |
775 } | 770 } |
776 data->ptr()->parent_function_ = static_cast<RawFunction*>(d->ReadRef()); | 771 data->ptr()->parent_function_ = static_cast<RawFunction*>(d->ReadRef()); |
777 data->ptr()->signature_type_ = static_cast<RawType*>(d->ReadRef()); | 772 data->ptr()->signature_type_ = static_cast<RawType*>(d->ReadRef()); |
778 data->ptr()->closure_ = static_cast<RawInstance*>(d->ReadRef()); | 773 data->ptr()->closure_ = static_cast<RawInstance*>(d->ReadRef()); |
779 } | 774 } |
780 } | 775 } |
781 }; | 776 }; |
782 | 777 |
783 | 778 |
784 #if !defined(DART_PRECOMPILED_RUNTIME) | 779 #if !defined(DART_PRECOMPILED_RUNTIME) |
785 class RedirectionDataSerializationCluster : public SerializationCluster { | 780 class RedirectionDataSerializationCluster : public SerializationCluster { |
786 public: | 781 public: |
787 RedirectionDataSerializationCluster() { } | 782 RedirectionDataSerializationCluster() {} |
788 virtual ~RedirectionDataSerializationCluster() { } | 783 virtual ~RedirectionDataSerializationCluster() {} |
789 | 784 |
790 void Trace(Serializer* s, RawObject* object) { | 785 void Trace(Serializer* s, RawObject* object) { |
791 RawRedirectionData* data = RedirectionData::RawCast(object); | 786 RawRedirectionData* data = RedirectionData::RawCast(object); |
792 objects_.Add(data); | 787 objects_.Add(data); |
793 | 788 |
794 RawObject** from = data->from(); | 789 RawObject** from = data->from(); |
795 RawObject** to = data->to(); | 790 RawObject** to = data->to(); |
796 for (RawObject** p = from; p <= to; p++) { | 791 for (RawObject** p = from; p <= to; p++) { |
797 s->Push(*p); | 792 s->Push(*p); |
798 } | 793 } |
(...skipping 22 matching lines...) Expand all Loading... |
821 } | 816 } |
822 | 817 |
823 private: | 818 private: |
824 GrowableArray<RawRedirectionData*> objects_; | 819 GrowableArray<RawRedirectionData*> objects_; |
825 }; | 820 }; |
826 #endif // !DART_PRECOMPILED_RUNTIME | 821 #endif // !DART_PRECOMPILED_RUNTIME |
827 | 822 |
828 | 823 |
829 class RedirectionDataDeserializationCluster : public DeserializationCluster { | 824 class RedirectionDataDeserializationCluster : public DeserializationCluster { |
830 public: | 825 public: |
831 RedirectionDataDeserializationCluster() { } | 826 RedirectionDataDeserializationCluster() {} |
832 virtual ~RedirectionDataDeserializationCluster() { } | 827 virtual ~RedirectionDataDeserializationCluster() {} |
833 | 828 |
834 void ReadAlloc(Deserializer* d) { | 829 void ReadAlloc(Deserializer* d) { |
835 start_index_ = d->next_index(); | 830 start_index_ = d->next_index(); |
836 PageSpace* old_space = d->heap()->old_space(); | 831 PageSpace* old_space = d->heap()->old_space(); |
837 intptr_t count = d->Read<int32_t>(); | 832 intptr_t count = d->Read<int32_t>(); |
838 for (intptr_t i = 0; i < count; i++) { | 833 for (intptr_t i = 0; i < count; i++) { |
839 d->AssignRef(AllocateUninitialized(old_space, | 834 d->AssignRef( |
840 RedirectionData::InstanceSize())); | 835 AllocateUninitialized(old_space, RedirectionData::InstanceSize())); |
841 } | 836 } |
842 stop_index_ = d->next_index(); | 837 stop_index_ = d->next_index(); |
843 } | 838 } |
844 | 839 |
845 void ReadFill(Deserializer* d) { | 840 void ReadFill(Deserializer* d) { |
846 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 841 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
847 | 842 |
848 for (intptr_t id = start_index_; id < stop_index_; id++) { | 843 for (intptr_t id = start_index_; id < stop_index_; id++) { |
849 RawRedirectionData* data = | 844 RawRedirectionData* data = |
850 reinterpret_cast<RawRedirectionData*>(d->Ref(id)); | 845 reinterpret_cast<RawRedirectionData*>(d->Ref(id)); |
851 Deserializer::InitializeHeader(data, kRedirectionDataCid, | 846 Deserializer::InitializeHeader(data, kRedirectionDataCid, |
852 RedirectionData::InstanceSize(), | 847 RedirectionData::InstanceSize(), |
853 is_vm_object); | 848 is_vm_object); |
854 RawObject** from = data->from(); | 849 RawObject** from = data->from(); |
855 RawObject** to = data->to(); | 850 RawObject** to = data->to(); |
856 for (RawObject** p = from; p <= to; p++) { | 851 for (RawObject** p = from; p <= to; p++) { |
857 *p = d->ReadRef(); | 852 *p = d->ReadRef(); |
858 } | 853 } |
859 } | 854 } |
860 } | 855 } |
861 }; | 856 }; |
862 | 857 |
863 | 858 |
864 #if !defined(DART_PRECOMPILED_RUNTIME) | 859 #if !defined(DART_PRECOMPILED_RUNTIME) |
865 class FieldSerializationCluster : public SerializationCluster { | 860 class FieldSerializationCluster : public SerializationCluster { |
866 public: | 861 public: |
867 FieldSerializationCluster() { } | 862 FieldSerializationCluster() {} |
868 virtual ~FieldSerializationCluster() { } | 863 virtual ~FieldSerializationCluster() {} |
869 | 864 |
870 void Trace(Serializer* s, RawObject* object) { | 865 void Trace(Serializer* s, RawObject* object) { |
871 RawField* field = Field::RawCast(object); | 866 RawField* field = Field::RawCast(object); |
872 objects_.Add(field); | 867 objects_.Add(field); |
873 | 868 |
874 Snapshot::Kind kind = s->kind(); | 869 Snapshot::Kind kind = s->kind(); |
875 | 870 |
876 s->Push(field->ptr()->name_); | 871 s->Push(field->ptr()->name_); |
877 s->Push(field->ptr()->owner_); | 872 s->Push(field->ptr()->owner_); |
878 s->Push(field->ptr()->type_); | 873 s->Push(field->ptr()->type_); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 } | 961 } |
967 | 962 |
968 private: | 963 private: |
969 GrowableArray<RawField*> objects_; | 964 GrowableArray<RawField*> objects_; |
970 }; | 965 }; |
971 #endif // !DART_PRECOMPILED_RUNTIME | 966 #endif // !DART_PRECOMPILED_RUNTIME |
972 | 967 |
973 | 968 |
974 class FieldDeserializationCluster : public DeserializationCluster { | 969 class FieldDeserializationCluster : public DeserializationCluster { |
975 public: | 970 public: |
976 FieldDeserializationCluster() { } | 971 FieldDeserializationCluster() {} |
977 virtual ~FieldDeserializationCluster() { } | 972 virtual ~FieldDeserializationCluster() {} |
978 | 973 |
979 void ReadAlloc(Deserializer* d) { | 974 void ReadAlloc(Deserializer* d) { |
980 start_index_ = d->next_index(); | 975 start_index_ = d->next_index(); |
981 PageSpace* old_space = d->heap()->old_space(); | 976 PageSpace* old_space = d->heap()->old_space(); |
982 intptr_t count = d->Read<int32_t>(); | 977 intptr_t count = d->Read<int32_t>(); |
983 for (intptr_t i = 0; i < count; i++) { | 978 for (intptr_t i = 0; i < count; i++) { |
984 d->AssignRef(AllocateUninitialized(old_space, Field::InstanceSize())); | 979 d->AssignRef(AllocateUninitialized(old_space, Field::InstanceSize())); |
985 } | 980 } |
986 stop_index_ = d->next_index(); | 981 stop_index_ = d->next_index(); |
987 } | 982 } |
988 | 983 |
989 void ReadFill(Deserializer* d) { | 984 void ReadFill(Deserializer* d) { |
990 Snapshot::Kind kind = d->kind(); | 985 Snapshot::Kind kind = d->kind(); |
991 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 986 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
992 | 987 |
993 for (intptr_t id = start_index_; id < stop_index_; id++) { | 988 for (intptr_t id = start_index_; id < stop_index_; id++) { |
994 RawField* field = reinterpret_cast<RawField*>(d->Ref(id)); | 989 RawField* field = reinterpret_cast<RawField*>(d->Ref(id)); |
995 Deserializer::InitializeHeader(field, kFieldCid, | 990 Deserializer::InitializeHeader(field, kFieldCid, Field::InstanceSize(), |
996 Field::InstanceSize(), is_vm_object); | 991 is_vm_object); |
997 RawObject** from = field->from(); | 992 RawObject** from = field->from(); |
998 RawObject** to_snapshot = field->to_snapshot(kind); | 993 RawObject** to_snapshot = field->to_snapshot(kind); |
999 RawObject** to = field->to(); | 994 RawObject** to = field->to(); |
1000 for (RawObject** p = from; p <= to_snapshot; p++) { | 995 for (RawObject** p = from; p <= to_snapshot; p++) { |
1001 *p = d->ReadRef(); | 996 *p = d->ReadRef(); |
1002 } | 997 } |
1003 for (RawObject** p = to_snapshot + 1; p <= to; p++) { | 998 for (RawObject** p = to_snapshot + 1; p <= to; p++) { |
1004 *p = Object::null(); | 999 *p = Object::null(); |
1005 } | 1000 } |
1006 | 1001 |
1007 if (kind != Snapshot::kAppNoJIT) { | 1002 if (kind != Snapshot::kAppNoJIT) { |
1008 field->ptr()->token_pos_ = d->ReadTokenPosition(); | 1003 field->ptr()->token_pos_ = d->ReadTokenPosition(); |
1009 field->ptr()->guarded_cid_ = d->ReadCid(); | 1004 field->ptr()->guarded_cid_ = d->ReadCid(); |
1010 field->ptr()->is_nullable_ = d->ReadCid(); | 1005 field->ptr()->is_nullable_ = d->ReadCid(); |
1011 } | 1006 } |
1012 field->ptr()->kind_bits_ = d->Read<uint8_t>(); | 1007 field->ptr()->kind_bits_ = d->Read<uint8_t>(); |
1013 } | 1008 } |
1014 } | 1009 } |
1015 | 1010 |
1016 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { | 1011 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { |
1017 NOT_IN_PRODUCT(TimelineDurationScope tds(Thread::Current(), | 1012 NOT_IN_PRODUCT(TimelineDurationScope tds( |
1018 Timeline::GetIsolateStream(), "PostLoadField")); | 1013 Thread::Current(), Timeline::GetIsolateStream(), "PostLoadField")); |
1019 | 1014 |
1020 Field& field = Field::Handle(zone); | 1015 Field& field = Field::Handle(zone); |
1021 if (!FLAG_use_field_guards) { | 1016 if (!FLAG_use_field_guards) { |
1022 for (intptr_t i = start_index_; i < stop_index_; i++) { | 1017 for (intptr_t i = start_index_; i < stop_index_; i++) { |
1023 field ^= refs.At(i); | 1018 field ^= refs.At(i); |
1024 field.set_guarded_cid(kDynamicCid); | 1019 field.set_guarded_cid(kDynamicCid); |
1025 field.set_is_nullable(true); | 1020 field.set_is_nullable(true); |
1026 field.set_guarded_list_length(Field::kNoFixedLength); | 1021 field.set_guarded_list_length(Field::kNoFixedLength); |
1027 field.set_guarded_list_length_in_object_offset( | 1022 field.set_guarded_list_length_in_object_offset( |
1028 Field::kUnknownLengthOffset); | 1023 Field::kUnknownLengthOffset); |
1029 } | 1024 } |
1030 } else { | 1025 } else { |
1031 for (intptr_t i = start_index_; i < stop_index_; i++) { | 1026 for (intptr_t i = start_index_; i < stop_index_; i++) { |
1032 field ^= refs.At(i); | 1027 field ^= refs.At(i); |
1033 field.InitializeGuardedListLengthInObjectOffset(); | 1028 field.InitializeGuardedListLengthInObjectOffset(); |
1034 } | 1029 } |
1035 } | 1030 } |
1036 } | 1031 } |
1037 }; | 1032 }; |
1038 | 1033 |
1039 | 1034 |
1040 #if !defined(DART_PRECOMPILED_RUNTIME) | 1035 #if !defined(DART_PRECOMPILED_RUNTIME) |
1041 class LiteralTokenSerializationCluster : public SerializationCluster { | 1036 class LiteralTokenSerializationCluster : public SerializationCluster { |
1042 public: | 1037 public: |
1043 LiteralTokenSerializationCluster() { } | 1038 LiteralTokenSerializationCluster() {} |
1044 virtual ~LiteralTokenSerializationCluster() { } | 1039 virtual ~LiteralTokenSerializationCluster() {} |
1045 | 1040 |
1046 void Trace(Serializer* s, RawObject* object) { | 1041 void Trace(Serializer* s, RawObject* object) { |
1047 RawLiteralToken* token = LiteralToken::RawCast(object); | 1042 RawLiteralToken* token = LiteralToken::RawCast(object); |
1048 objects_.Add(token); | 1043 objects_.Add(token); |
1049 | 1044 |
1050 RawObject** from = token->from(); | 1045 RawObject** from = token->from(); |
1051 RawObject** to = token->to(); | 1046 RawObject** to = token->to(); |
1052 for (RawObject** p = from; p <= to; p++) { | 1047 for (RawObject** p = from; p <= to; p++) { |
1053 s->Push(*p); | 1048 s->Push(*p); |
1054 } | 1049 } |
(...skipping 23 matching lines...) Expand all Loading... |
1078 } | 1073 } |
1079 | 1074 |
1080 private: | 1075 private: |
1081 GrowableArray<RawLiteralToken*> objects_; | 1076 GrowableArray<RawLiteralToken*> objects_; |
1082 }; | 1077 }; |
1083 #endif // !DART_PRECOMPILED_RUNTIME | 1078 #endif // !DART_PRECOMPILED_RUNTIME |
1084 | 1079 |
1085 | 1080 |
1086 class LiteralTokenDeserializationCluster : public DeserializationCluster { | 1081 class LiteralTokenDeserializationCluster : public DeserializationCluster { |
1087 public: | 1082 public: |
1088 LiteralTokenDeserializationCluster() { } | 1083 LiteralTokenDeserializationCluster() {} |
1089 virtual ~LiteralTokenDeserializationCluster() { } | 1084 virtual ~LiteralTokenDeserializationCluster() {} |
1090 | 1085 |
1091 void ReadAlloc(Deserializer* d) { | 1086 void ReadAlloc(Deserializer* d) { |
1092 start_index_ = d->next_index(); | 1087 start_index_ = d->next_index(); |
1093 PageSpace* old_space = d->heap()->old_space(); | 1088 PageSpace* old_space = d->heap()->old_space(); |
1094 intptr_t count = d->Read<int32_t>(); | 1089 intptr_t count = d->Read<int32_t>(); |
1095 for (intptr_t i = 0; i < count; i++) { | 1090 for (intptr_t i = 0; i < count; i++) { |
1096 d->AssignRef(AllocateUninitialized(old_space, | 1091 d->AssignRef( |
1097 LiteralToken::InstanceSize())); | 1092 AllocateUninitialized(old_space, LiteralToken::InstanceSize())); |
1098 } | 1093 } |
1099 stop_index_ = d->next_index(); | 1094 stop_index_ = d->next_index(); |
1100 } | 1095 } |
1101 | 1096 |
1102 void ReadFill(Deserializer* d) { | 1097 void ReadFill(Deserializer* d) { |
1103 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 1098 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
1104 | 1099 |
1105 for (intptr_t id = start_index_; id < stop_index_; id++) { | 1100 for (intptr_t id = start_index_; id < stop_index_; id++) { |
1106 RawLiteralToken* token = reinterpret_cast<RawLiteralToken*>(d->Ref(id)); | 1101 RawLiteralToken* token = reinterpret_cast<RawLiteralToken*>(d->Ref(id)); |
1107 Deserializer::InitializeHeader(token, kLiteralTokenCid, | 1102 Deserializer::InitializeHeader( |
1108 LiteralToken::InstanceSize(), | 1103 token, kLiteralTokenCid, LiteralToken::InstanceSize(), is_vm_object); |
1109 is_vm_object); | |
1110 RawObject** from = token->from(); | 1104 RawObject** from = token->from(); |
1111 RawObject** to = token->to(); | 1105 RawObject** to = token->to(); |
1112 for (RawObject** p = from; p <= to; p++) { | 1106 for (RawObject** p = from; p <= to; p++) { |
1113 *p = d->ReadRef(); | 1107 *p = d->ReadRef(); |
1114 } | 1108 } |
1115 token->ptr()->kind_ = static_cast<Token::Kind>(d->Read<int32_t>()); | 1109 token->ptr()->kind_ = static_cast<Token::Kind>(d->Read<int32_t>()); |
1116 } | 1110 } |
1117 } | 1111 } |
1118 }; | 1112 }; |
1119 | 1113 |
1120 | 1114 |
1121 #if !defined(DART_PRECOMPILED_RUNTIME) | 1115 #if !defined(DART_PRECOMPILED_RUNTIME) |
1122 class TokenStreamSerializationCluster : public SerializationCluster { | 1116 class TokenStreamSerializationCluster : public SerializationCluster { |
1123 public: | 1117 public: |
1124 TokenStreamSerializationCluster() { } | 1118 TokenStreamSerializationCluster() {} |
1125 virtual ~TokenStreamSerializationCluster() { } | 1119 virtual ~TokenStreamSerializationCluster() {} |
1126 | 1120 |
1127 void Trace(Serializer* s, RawObject* object) { | 1121 void Trace(Serializer* s, RawObject* object) { |
1128 RawTokenStream* stream = TokenStream::RawCast(object); | 1122 RawTokenStream* stream = TokenStream::RawCast(object); |
1129 objects_.Add(stream); | 1123 objects_.Add(stream); |
1130 | 1124 |
1131 RawObject** from = stream->from(); | 1125 RawObject** from = stream->from(); |
1132 RawObject** to = stream->to(); | 1126 RawObject** to = stream->to(); |
1133 for (RawObject** p = from; p <= to; p++) { | 1127 for (RawObject** p = from; p <= to; p++) { |
1134 s->Push(*p); | 1128 s->Push(*p); |
1135 } | 1129 } |
(...skipping 22 matching lines...) Expand all Loading... |
1158 } | 1152 } |
1159 | 1153 |
1160 private: | 1154 private: |
1161 GrowableArray<RawTokenStream*> objects_; | 1155 GrowableArray<RawTokenStream*> objects_; |
1162 }; | 1156 }; |
1163 #endif // !DART_PRECOMPILED_RUNTIME | 1157 #endif // !DART_PRECOMPILED_RUNTIME |
1164 | 1158 |
1165 | 1159 |
1166 class TokenStreamDeserializationCluster : public DeserializationCluster { | 1160 class TokenStreamDeserializationCluster : public DeserializationCluster { |
1167 public: | 1161 public: |
1168 TokenStreamDeserializationCluster() { } | 1162 TokenStreamDeserializationCluster() {} |
1169 virtual ~TokenStreamDeserializationCluster() { } | 1163 virtual ~TokenStreamDeserializationCluster() {} |
1170 | 1164 |
1171 void ReadAlloc(Deserializer* d) { | 1165 void ReadAlloc(Deserializer* d) { |
1172 start_index_ = d->next_index(); | 1166 start_index_ = d->next_index(); |
1173 PageSpace* old_space = d->heap()->old_space(); | 1167 PageSpace* old_space = d->heap()->old_space(); |
1174 intptr_t count = d->Read<int32_t>(); | 1168 intptr_t count = d->Read<int32_t>(); |
1175 for (intptr_t i = 0; i < count; i++) { | 1169 for (intptr_t i = 0; i < count; i++) { |
1176 d->AssignRef(AllocateUninitialized(old_space, | 1170 d->AssignRef( |
1177 TokenStream::InstanceSize())); | 1171 AllocateUninitialized(old_space, TokenStream::InstanceSize())); |
1178 } | 1172 } |
1179 stop_index_ = d->next_index(); | 1173 stop_index_ = d->next_index(); |
1180 } | 1174 } |
1181 | 1175 |
1182 void ReadFill(Deserializer* d) { | 1176 void ReadFill(Deserializer* d) { |
1183 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 1177 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
1184 | 1178 |
1185 for (intptr_t id = start_index_; id < stop_index_; id++) { | 1179 for (intptr_t id = start_index_; id < stop_index_; id++) { |
1186 RawTokenStream* stream = reinterpret_cast<RawTokenStream*>(d->Ref(id)); | 1180 RawTokenStream* stream = reinterpret_cast<RawTokenStream*>(d->Ref(id)); |
1187 Deserializer::InitializeHeader(stream, kTokenStreamCid, | 1181 Deserializer::InitializeHeader(stream, kTokenStreamCid, |
1188 TokenStream::InstanceSize(), is_vm_object); | 1182 TokenStream::InstanceSize(), is_vm_object); |
1189 RawObject** from = stream->from(); | 1183 RawObject** from = stream->from(); |
1190 RawObject** to = stream->to(); | 1184 RawObject** to = stream->to(); |
1191 for (RawObject** p = from; p <= to; p++) { | 1185 for (RawObject** p = from; p <= to; p++) { |
1192 *p = d->ReadRef(); | 1186 *p = d->ReadRef(); |
1193 } | 1187 } |
1194 } | 1188 } |
1195 } | 1189 } |
1196 }; | 1190 }; |
1197 | 1191 |
1198 | 1192 |
1199 #if !defined(DART_PRECOMPILED_RUNTIME) | 1193 #if !defined(DART_PRECOMPILED_RUNTIME) |
1200 class ScriptSerializationCluster : public SerializationCluster { | 1194 class ScriptSerializationCluster : public SerializationCluster { |
1201 public: | 1195 public: |
1202 ScriptSerializationCluster() { } | 1196 ScriptSerializationCluster() {} |
1203 virtual ~ScriptSerializationCluster() { } | 1197 virtual ~ScriptSerializationCluster() {} |
1204 | 1198 |
1205 void Trace(Serializer* s, RawObject* object) { | 1199 void Trace(Serializer* s, RawObject* object) { |
1206 RawScript* script = Script::RawCast(object); | 1200 RawScript* script = Script::RawCast(object); |
1207 objects_.Add(script); | 1201 objects_.Add(script); |
1208 | 1202 |
1209 RawObject** from = script->from(); | 1203 RawObject** from = script->from(); |
1210 RawObject** to = script->to_snapshot(s->kind()); | 1204 RawObject** to = script->to_snapshot(s->kind()); |
1211 for (RawObject** p = from; p <= to; p++) { | 1205 for (RawObject** p = from; p <= to; p++) { |
1212 s->Push(*p); | 1206 s->Push(*p); |
1213 } | 1207 } |
(...skipping 27 matching lines...) Expand all Loading... |
1241 } | 1235 } |
1242 | 1236 |
1243 private: | 1237 private: |
1244 GrowableArray<RawScript*> objects_; | 1238 GrowableArray<RawScript*> objects_; |
1245 }; | 1239 }; |
1246 #endif // !DART_PRECOMPILED_RUNTIME | 1240 #endif // !DART_PRECOMPILED_RUNTIME |
1247 | 1241 |
1248 | 1242 |
1249 class ScriptDeserializationCluster : public DeserializationCluster { | 1243 class ScriptDeserializationCluster : public DeserializationCluster { |
1250 public: | 1244 public: |
1251 ScriptDeserializationCluster() { } | 1245 ScriptDeserializationCluster() {} |
1252 virtual ~ScriptDeserializationCluster() { } | 1246 virtual ~ScriptDeserializationCluster() {} |
1253 | 1247 |
1254 void ReadAlloc(Deserializer* d) { | 1248 void ReadAlloc(Deserializer* d) { |
1255 start_index_ = d->next_index(); | 1249 start_index_ = d->next_index(); |
1256 PageSpace* old_space = d->heap()->old_space(); | 1250 PageSpace* old_space = d->heap()->old_space(); |
1257 intptr_t count = d->Read<int32_t>(); | 1251 intptr_t count = d->Read<int32_t>(); |
1258 for (intptr_t i = 0; i < count; i++) { | 1252 for (intptr_t i = 0; i < count; i++) { |
1259 d->AssignRef(AllocateUninitialized(old_space, Script::InstanceSize())); | 1253 d->AssignRef(AllocateUninitialized(old_space, Script::InstanceSize())); |
1260 } | 1254 } |
1261 stop_index_ = d->next_index(); | 1255 stop_index_ = d->next_index(); |
1262 } | 1256 } |
1263 | 1257 |
1264 void ReadFill(Deserializer* d) { | 1258 void ReadFill(Deserializer* d) { |
1265 Snapshot::Kind kind = d->kind(); | 1259 Snapshot::Kind kind = d->kind(); |
1266 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 1260 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
1267 | 1261 |
1268 for (intptr_t id = start_index_; id < stop_index_; id++) { | 1262 for (intptr_t id = start_index_; id < stop_index_; id++) { |
1269 RawScript* script = reinterpret_cast<RawScript*>(d->Ref(id)); | 1263 RawScript* script = reinterpret_cast<RawScript*>(d->Ref(id)); |
1270 Deserializer::InitializeHeader(script, kScriptCid, | 1264 Deserializer::InitializeHeader(script, kScriptCid, Script::InstanceSize(), |
1271 Script::InstanceSize(), is_vm_object); | 1265 is_vm_object); |
1272 RawObject** from = script->from(); | 1266 RawObject** from = script->from(); |
1273 RawObject** to_snapshot = script->to_snapshot(kind); | 1267 RawObject** to_snapshot = script->to_snapshot(kind); |
1274 RawObject** to = script->to(); | 1268 RawObject** to = script->to(); |
1275 for (RawObject** p = from; p <= to_snapshot; p++) { | 1269 for (RawObject** p = from; p <= to_snapshot; p++) { |
1276 *p = d->ReadRef(); | 1270 *p = d->ReadRef(); |
1277 } | 1271 } |
1278 for (RawObject** p = to_snapshot + 1; p <= to; p++) { | 1272 for (RawObject** p = to_snapshot + 1; p <= to; p++) { |
1279 *p = Object::null(); | 1273 *p = Object::null(); |
1280 } | 1274 } |
1281 | 1275 |
1282 script->ptr()->line_offset_ = d->Read<int32_t>(); | 1276 script->ptr()->line_offset_ = d->Read<int32_t>(); |
1283 script->ptr()->col_offset_ = d->Read<int32_t>(); | 1277 script->ptr()->col_offset_ = d->Read<int32_t>(); |
1284 script->ptr()->kind_ = d->Read<int8_t>(); | 1278 script->ptr()->kind_ = d->Read<int8_t>(); |
1285 script->ptr()->load_timestamp_ = 0; | 1279 script->ptr()->load_timestamp_ = 0; |
1286 } | 1280 } |
1287 } | 1281 } |
1288 }; | 1282 }; |
1289 | 1283 |
1290 | 1284 |
1291 #if !defined(DART_PRECOMPILED_RUNTIME) | 1285 #if !defined(DART_PRECOMPILED_RUNTIME) |
1292 class LibrarySerializationCluster : public SerializationCluster { | 1286 class LibrarySerializationCluster : public SerializationCluster { |
1293 public: | 1287 public: |
1294 LibrarySerializationCluster() { } | 1288 LibrarySerializationCluster() {} |
1295 virtual ~LibrarySerializationCluster() { } | 1289 virtual ~LibrarySerializationCluster() {} |
1296 | 1290 |
1297 void Trace(Serializer* s, RawObject* object) { | 1291 void Trace(Serializer* s, RawObject* object) { |
1298 RawLibrary* lib = Library::RawCast(object); | 1292 RawLibrary* lib = Library::RawCast(object); |
1299 objects_.Add(lib); | 1293 objects_.Add(lib); |
1300 | 1294 |
1301 RawObject** from = lib->from(); | 1295 RawObject** from = lib->from(); |
1302 RawObject** to = lib->to_snapshot(); | 1296 RawObject** to = lib->to_snapshot(); |
1303 for (RawObject** p = from; p <= to; p++) { | 1297 for (RawObject** p = from; p <= to; p++) { |
1304 s->Push(*p); | 1298 s->Push(*p); |
1305 } | 1299 } |
(...skipping 29 matching lines...) Expand all Loading... |
1335 } | 1329 } |
1336 | 1330 |
1337 private: | 1331 private: |
1338 GrowableArray<RawLibrary*> objects_; | 1332 GrowableArray<RawLibrary*> objects_; |
1339 }; | 1333 }; |
1340 #endif // !DART_PRECOMPILED_RUNTIME | 1334 #endif // !DART_PRECOMPILED_RUNTIME |
1341 | 1335 |
1342 | 1336 |
1343 class LibraryDeserializationCluster : public DeserializationCluster { | 1337 class LibraryDeserializationCluster : public DeserializationCluster { |
1344 public: | 1338 public: |
1345 LibraryDeserializationCluster() { } | 1339 LibraryDeserializationCluster() {} |
1346 virtual ~LibraryDeserializationCluster() { } | 1340 virtual ~LibraryDeserializationCluster() {} |
1347 | 1341 |
1348 void ReadAlloc(Deserializer* d) { | 1342 void ReadAlloc(Deserializer* d) { |
1349 start_index_ = d->next_index(); | 1343 start_index_ = d->next_index(); |
1350 PageSpace* old_space = d->heap()->old_space(); | 1344 PageSpace* old_space = d->heap()->old_space(); |
1351 intptr_t count = d->Read<int32_t>(); | 1345 intptr_t count = d->Read<int32_t>(); |
1352 for (intptr_t i = 0; i < count; i++) { | 1346 for (intptr_t i = 0; i < count; i++) { |
1353 d->AssignRef(AllocateUninitialized(old_space, Library::InstanceSize())); | 1347 d->AssignRef(AllocateUninitialized(old_space, Library::InstanceSize())); |
1354 } | 1348 } |
1355 stop_index_ = d->next_index(); | 1349 stop_index_ = d->next_index(); |
1356 } | 1350 } |
1357 | 1351 |
1358 void ReadFill(Deserializer* d) { | 1352 void ReadFill(Deserializer* d) { |
1359 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 1353 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
1360 | 1354 |
1361 for (intptr_t id = start_index_; id < stop_index_; id++) { | 1355 for (intptr_t id = start_index_; id < stop_index_; id++) { |
1362 RawLibrary* lib = reinterpret_cast<RawLibrary*>(d->Ref(id)); | 1356 RawLibrary* lib = reinterpret_cast<RawLibrary*>(d->Ref(id)); |
1363 Deserializer::InitializeHeader(lib, kLibraryCid, | 1357 Deserializer::InitializeHeader(lib, kLibraryCid, Library::InstanceSize(), |
1364 Library::InstanceSize(), is_vm_object); | 1358 is_vm_object); |
1365 RawObject** from = lib->from(); | 1359 RawObject** from = lib->from(); |
1366 RawObject** to_snapshot = lib->to_snapshot(); | 1360 RawObject** to_snapshot = lib->to_snapshot(); |
1367 RawObject** to = lib->to(); | 1361 RawObject** to = lib->to(); |
1368 for (RawObject** p = from; p <= to_snapshot; p++) { | 1362 for (RawObject** p = from; p <= to_snapshot; p++) { |
1369 *p = d->ReadRef(); | 1363 *p = d->ReadRef(); |
1370 } | 1364 } |
1371 for (RawObject** p = to_snapshot + 1; p <= to; p++) { | 1365 for (RawObject** p = to_snapshot + 1; p <= to; p++) { |
1372 *p = Object::null(); | 1366 *p = Object::null(); |
1373 } | 1367 } |
1374 | 1368 |
1375 lib->ptr()->native_entry_resolver_ = NULL; | 1369 lib->ptr()->native_entry_resolver_ = NULL; |
1376 lib->ptr()->native_entry_symbol_resolver_ = NULL; | 1370 lib->ptr()->native_entry_symbol_resolver_ = NULL; |
1377 lib->ptr()->index_ = d->Read<int32_t>(); | 1371 lib->ptr()->index_ = d->Read<int32_t>(); |
1378 lib->ptr()->num_imports_ = d->Read<uint16_t>(); | 1372 lib->ptr()->num_imports_ = d->Read<uint16_t>(); |
1379 lib->ptr()->load_state_ = d->Read<int8_t>(); | 1373 lib->ptr()->load_state_ = d->Read<int8_t>(); |
1380 lib->ptr()->corelib_imported_ = d->Read<bool>(); | 1374 lib->ptr()->corelib_imported_ = d->Read<bool>(); |
1381 lib->ptr()->is_dart_scheme_ = d->Read<bool>(); | 1375 lib->ptr()->is_dart_scheme_ = d->Read<bool>(); |
1382 lib->ptr()->debuggable_ = d->Read<bool>(); | 1376 lib->ptr()->debuggable_ = d->Read<bool>(); |
1383 lib->ptr()->is_in_fullsnapshot_ = true; | 1377 lib->ptr()->is_in_fullsnapshot_ = true; |
1384 } | 1378 } |
1385 } | 1379 } |
1386 | 1380 |
1387 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { | 1381 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { |
1388 // TODO(rmacnak): This is surprisingly slow, roughly 20% of deserialization | 1382 // TODO(rmacnak): This is surprisingly slow, roughly 20% of deserialization |
1389 // time for the JIT. Maybe make the lookups happy with a null? | 1383 // time for the JIT. Maybe make the lookups happy with a null? |
1390 | 1384 |
1391 NOT_IN_PRODUCT(TimelineDurationScope tds(Thread::Current(), | 1385 NOT_IN_PRODUCT(TimelineDurationScope tds( |
1392 Timeline::GetIsolateStream(), "PostLoadLibrary")); | 1386 Thread::Current(), Timeline::GetIsolateStream(), "PostLoadLibrary")); |
1393 | 1387 |
1394 Library& lib = Library::Handle(zone); | 1388 Library& lib = Library::Handle(zone); |
1395 for (intptr_t i = start_index_; i < stop_index_; i++) { | 1389 for (intptr_t i = start_index_; i < stop_index_; i++) { |
1396 lib ^= refs.At(i); | 1390 lib ^= refs.At(i); |
1397 const intptr_t kInitialNameCacheSize = 64; | 1391 const intptr_t kInitialNameCacheSize = 64; |
1398 lib.InitResolvedNamesCache(kInitialNameCacheSize); | 1392 lib.InitResolvedNamesCache(kInitialNameCacheSize); |
1399 } | 1393 } |
1400 } | 1394 } |
1401 }; | 1395 }; |
1402 | 1396 |
1403 | 1397 |
1404 #if !defined(DART_PRECOMPILED_RUNTIME) | 1398 #if !defined(DART_PRECOMPILED_RUNTIME) |
1405 class NamespaceSerializationCluster : public SerializationCluster { | 1399 class NamespaceSerializationCluster : public SerializationCluster { |
1406 public: | 1400 public: |
1407 NamespaceSerializationCluster() { } | 1401 NamespaceSerializationCluster() {} |
1408 virtual ~NamespaceSerializationCluster() { } | 1402 virtual ~NamespaceSerializationCluster() {} |
1409 | 1403 |
1410 void Trace(Serializer* s, RawObject* object) { | 1404 void Trace(Serializer* s, RawObject* object) { |
1411 RawNamespace* ns = Namespace::RawCast(object); | 1405 RawNamespace* ns = Namespace::RawCast(object); |
1412 objects_.Add(ns); | 1406 objects_.Add(ns); |
1413 | 1407 |
1414 RawObject** from = ns->from(); | 1408 RawObject** from = ns->from(); |
1415 RawObject** to = ns->to(); | 1409 RawObject** to = ns->to(); |
1416 for (RawObject** p = from; p <= to; p++) { | 1410 for (RawObject** p = from; p <= to; p++) { |
1417 s->Push(*p); | 1411 s->Push(*p); |
1418 } | 1412 } |
(...skipping 22 matching lines...) Expand all Loading... |
1441 } | 1435 } |
1442 | 1436 |
1443 private: | 1437 private: |
1444 GrowableArray<RawNamespace*> objects_; | 1438 GrowableArray<RawNamespace*> objects_; |
1445 }; | 1439 }; |
1446 #endif // !DART_PRECOMPILED_RUNTIME | 1440 #endif // !DART_PRECOMPILED_RUNTIME |
1447 | 1441 |
1448 | 1442 |
1449 class NamespaceDeserializationCluster : public DeserializationCluster { | 1443 class NamespaceDeserializationCluster : public DeserializationCluster { |
1450 public: | 1444 public: |
1451 NamespaceDeserializationCluster() { } | 1445 NamespaceDeserializationCluster() {} |
1452 virtual ~NamespaceDeserializationCluster() { } | 1446 virtual ~NamespaceDeserializationCluster() {} |
1453 | 1447 |
1454 void ReadAlloc(Deserializer* d) { | 1448 void ReadAlloc(Deserializer* d) { |
1455 start_index_ = d->next_index(); | 1449 start_index_ = d->next_index(); |
1456 PageSpace* old_space = d->heap()->old_space(); | 1450 PageSpace* old_space = d->heap()->old_space(); |
1457 intptr_t count = d->Read<int32_t>(); | 1451 intptr_t count = d->Read<int32_t>(); |
1458 for (intptr_t i = 0; i < count; i++) { | 1452 for (intptr_t i = 0; i < count; i++) { |
1459 d->AssignRef(AllocateUninitialized(old_space, Namespace::InstanceSize())); | 1453 d->AssignRef(AllocateUninitialized(old_space, Namespace::InstanceSize())); |
1460 } | 1454 } |
1461 stop_index_ = d->next_index(); | 1455 stop_index_ = d->next_index(); |
1462 } | 1456 } |
(...skipping 11 matching lines...) Expand all Loading... |
1474 *p = d->ReadRef(); | 1468 *p = d->ReadRef(); |
1475 } | 1469 } |
1476 } | 1470 } |
1477 } | 1471 } |
1478 }; | 1472 }; |
1479 | 1473 |
1480 | 1474 |
1481 #if !defined(DART_PRECOMPILED_RUNTIME) | 1475 #if !defined(DART_PRECOMPILED_RUNTIME) |
1482 class CodeSerializationCluster : public SerializationCluster { | 1476 class CodeSerializationCluster : public SerializationCluster { |
1483 public: | 1477 public: |
1484 CodeSerializationCluster() { } | 1478 CodeSerializationCluster() {} |
1485 virtual ~CodeSerializationCluster() { } | 1479 virtual ~CodeSerializationCluster() {} |
1486 | 1480 |
1487 void Trace(Serializer* s, RawObject* object) { | 1481 void Trace(Serializer* s, RawObject* object) { |
1488 RawCode* code = Code::RawCast(object); | 1482 RawCode* code = Code::RawCast(object); |
1489 objects_.Add(code); | 1483 objects_.Add(code); |
1490 | 1484 |
1491 s->Push(code->ptr()->object_pool_); | 1485 s->Push(code->ptr()->object_pool_); |
1492 s->Push(code->ptr()->owner_); | 1486 s->Push(code->ptr()->owner_); |
1493 s->Push(code->ptr()->exception_handlers_); | 1487 s->Push(code->ptr()->exception_handlers_); |
1494 s->Push(code->ptr()->pc_descriptors_); | 1488 s->Push(code->ptr()->pc_descriptors_); |
1495 s->Push(code->ptr()->stackmaps_); | 1489 s->Push(code->ptr()->stackmaps_); |
(...skipping 22 matching lines...) Expand all Loading... |
1518 for (intptr_t i = 0; i < count; i++) { | 1512 for (intptr_t i = 0; i < count; i++) { |
1519 RawCode* code = objects_[i]; | 1513 RawCode* code = objects_[i]; |
1520 | 1514 |
1521 intptr_t pointer_offsets_length = | 1515 intptr_t pointer_offsets_length = |
1522 Code::PtrOffBits::decode(code->ptr()->state_bits_); | 1516 Code::PtrOffBits::decode(code->ptr()->state_bits_); |
1523 if (pointer_offsets_length != 0) { | 1517 if (pointer_offsets_length != 0) { |
1524 FATAL("Cannot serialize code with embedded pointers"); | 1518 FATAL("Cannot serialize code with embedded pointers"); |
1525 } | 1519 } |
1526 if (kind == Snapshot::kAppNoJIT) { | 1520 if (kind == Snapshot::kAppNoJIT) { |
1527 // No disabled code in precompilation. | 1521 // No disabled code in precompilation. |
1528 NOT_IN_PRECOMPILED(ASSERT( | 1522 NOT_IN_PRECOMPILED(ASSERT(code->ptr()->instructions_ == |
1529 code->ptr()->instructions_ == code->ptr()->active_instructions_)); | 1523 code->ptr()->active_instructions_)); |
1530 } | 1524 } |
1531 | 1525 |
1532 RawInstructions* instr = code->ptr()->instructions_; | 1526 RawInstructions* instr = code->ptr()->instructions_; |
1533 int32_t text_offset = s->GetTextOffset(instr, code); | 1527 int32_t text_offset = s->GetTextOffset(instr, code); |
1534 s->Write<int32_t>(text_offset); | 1528 s->Write<int32_t>(text_offset); |
1535 if (s->kind() == Snapshot::kAppWithJIT) { | 1529 if (s->kind() == Snapshot::kAppWithJIT) { |
1536 // TODO(rmacnak): Fix references to disabled code before serializing. | 1530 // TODO(rmacnak): Fix references to disabled code before serializing. |
1537 if (code->ptr()->active_instructions_ != code->ptr()->instructions_) { | 1531 if (code->ptr()->active_instructions_ != code->ptr()->instructions_) { |
1538 instr = code->ptr()->active_instructions_; | 1532 instr = code->ptr()->active_instructions_; |
1539 text_offset = s->GetTextOffset(instr, code); | 1533 text_offset = s->GetTextOffset(instr, code); |
(...skipping 19 matching lines...) Expand all Loading... |
1559 } | 1553 } |
1560 | 1554 |
1561 private: | 1555 private: |
1562 GrowableArray<RawCode*> objects_; | 1556 GrowableArray<RawCode*> objects_; |
1563 }; | 1557 }; |
1564 #endif // !DART_PRECOMPILED_RUNTIME | 1558 #endif // !DART_PRECOMPILED_RUNTIME |
1565 | 1559 |
1566 | 1560 |
1567 class CodeDeserializationCluster : public DeserializationCluster { | 1561 class CodeDeserializationCluster : public DeserializationCluster { |
1568 public: | 1562 public: |
1569 CodeDeserializationCluster() { } | 1563 CodeDeserializationCluster() {} |
1570 virtual ~CodeDeserializationCluster() { } | 1564 virtual ~CodeDeserializationCluster() {} |
1571 | 1565 |
1572 void ReadAlloc(Deserializer* d) { | 1566 void ReadAlloc(Deserializer* d) { |
1573 start_index_ = d->next_index(); | 1567 start_index_ = d->next_index(); |
1574 PageSpace* old_space = d->heap()->old_space(); | 1568 PageSpace* old_space = d->heap()->old_space(); |
1575 intptr_t count = d->Read<int32_t>(); | 1569 intptr_t count = d->Read<int32_t>(); |
1576 for (intptr_t i = 0; i < count; i++) { | 1570 for (intptr_t i = 0; i < count; i++) { |
1577 d->AssignRef(AllocateUninitialized(old_space, Code::InstanceSize(0))); | 1571 d->AssignRef(AllocateUninitialized(old_space, Code::InstanceSize(0))); |
1578 } | 1572 } |
1579 stop_index_ = d->next_index(); | 1573 stop_index_ = d->next_index(); |
1580 } | 1574 } |
1581 | 1575 |
1582 void ReadFill(Deserializer* d) { | 1576 void ReadFill(Deserializer* d) { |
1583 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 1577 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
1584 | 1578 |
1585 for (intptr_t id = start_index_; id < stop_index_; id++) { | 1579 for (intptr_t id = start_index_; id < stop_index_; id++) { |
1586 RawCode* code = reinterpret_cast<RawCode*>(d->Ref(id)); | 1580 RawCode* code = reinterpret_cast<RawCode*>(d->Ref(id)); |
1587 Deserializer::InitializeHeader(code, kCodeCid, | 1581 Deserializer::InitializeHeader(code, kCodeCid, Code::InstanceSize(0), |
1588 Code::InstanceSize(0), is_vm_object); | 1582 is_vm_object); |
1589 | 1583 |
1590 int32_t text_offset = d->Read<int32_t>(); | 1584 int32_t text_offset = d->Read<int32_t>(); |
1591 RawInstructions* instr = reinterpret_cast<RawInstructions*>( | 1585 RawInstructions* instr = reinterpret_cast<RawInstructions*>( |
1592 d->GetInstructionsAt(text_offset) + kHeapObjectTag); | 1586 d->GetInstructionsAt(text_offset) + kHeapObjectTag); |
1593 | 1587 |
1594 code->ptr()->entry_point_ = Instructions::UncheckedEntryPoint(instr); | 1588 code->ptr()->entry_point_ = Instructions::UncheckedEntryPoint(instr); |
1595 code->ptr()->checked_entry_point_ = | 1589 code->ptr()->checked_entry_point_ = |
1596 Instructions::CheckedEntryPoint(instr); | 1590 Instructions::CheckedEntryPoint(instr); |
1597 NOT_IN_PRECOMPILED(code->ptr()->active_instructions_ = instr); | 1591 NOT_IN_PRECOMPILED(code->ptr()->active_instructions_ = instr); |
1598 code->ptr()->instructions_ = instr; | 1592 code->ptr()->instructions_ = instr; |
(...skipping 10 matching lines...) Expand all Loading... |
1609 } | 1603 } |
1610 #endif // !DART_PRECOMPILED_RUNTIME | 1604 #endif // !DART_PRECOMPILED_RUNTIME |
1611 | 1605 |
1612 code->ptr()->object_pool_ = | 1606 code->ptr()->object_pool_ = |
1613 reinterpret_cast<RawObjectPool*>(d->ReadRef()); | 1607 reinterpret_cast<RawObjectPool*>(d->ReadRef()); |
1614 code->ptr()->owner_ = d->ReadRef(); | 1608 code->ptr()->owner_ = d->ReadRef(); |
1615 code->ptr()->exception_handlers_ = | 1609 code->ptr()->exception_handlers_ = |
1616 reinterpret_cast<RawExceptionHandlers*>(d->ReadRef()); | 1610 reinterpret_cast<RawExceptionHandlers*>(d->ReadRef()); |
1617 code->ptr()->pc_descriptors_ = | 1611 code->ptr()->pc_descriptors_ = |
1618 reinterpret_cast<RawPcDescriptors*>(d->ReadRef()); | 1612 reinterpret_cast<RawPcDescriptors*>(d->ReadRef()); |
1619 code->ptr()->stackmaps_ = | 1613 code->ptr()->stackmaps_ = reinterpret_cast<RawArray*>(d->ReadRef()); |
1620 reinterpret_cast<RawArray*>(d->ReadRef()); | |
1621 | 1614 |
1622 #if !defined(DART_PRECOMPILED_RUNTIME) | 1615 #if !defined(DART_PRECOMPILED_RUNTIME) |
1623 if (d->kind() == Snapshot::kAppWithJIT) { | 1616 if (d->kind() == Snapshot::kAppWithJIT) { |
1624 code->ptr()->deopt_info_array_ = | 1617 code->ptr()->deopt_info_array_ = |
1625 reinterpret_cast<RawArray*>(d->ReadRef()); | 1618 reinterpret_cast<RawArray*>(d->ReadRef()); |
1626 code->ptr()->static_calls_target_table_ = | 1619 code->ptr()->static_calls_target_table_ = |
1627 reinterpret_cast<RawArray*>(d->ReadRef()); | 1620 reinterpret_cast<RawArray*>(d->ReadRef()); |
1628 #if defined(PRODUCT) | 1621 #if defined(PRODUCT) |
1629 code->ptr()->inlined_metadata_ = Array::null(); | 1622 code->ptr()->inlined_metadata_ = Array::null(); |
1630 code->ptr()->return_address_metadata_ = Object::null(); | 1623 code->ptr()->return_address_metadata_ = Object::null(); |
(...skipping 18 matching lines...) Expand all Loading... |
1649 | 1642 |
1650 code->ptr()->state_bits_ = d->Read<int32_t>(); | 1643 code->ptr()->state_bits_ = d->Read<int32_t>(); |
1651 } | 1644 } |
1652 } | 1645 } |
1653 }; | 1646 }; |
1654 | 1647 |
1655 | 1648 |
1656 #if !defined(DART_PRECOMPILED_RUNTIME) | 1649 #if !defined(DART_PRECOMPILED_RUNTIME) |
1657 class ObjectPoolSerializationCluster : public SerializationCluster { | 1650 class ObjectPoolSerializationCluster : public SerializationCluster { |
1658 public: | 1651 public: |
1659 ObjectPoolSerializationCluster() { } | 1652 ObjectPoolSerializationCluster() {} |
1660 virtual ~ObjectPoolSerializationCluster() { } | 1653 virtual ~ObjectPoolSerializationCluster() {} |
1661 | 1654 |
1662 void Trace(Serializer* s, RawObject* object) { | 1655 void Trace(Serializer* s, RawObject* object) { |
1663 RawObjectPool* pool = ObjectPool::RawCast(object); | 1656 RawObjectPool* pool = ObjectPool::RawCast(object); |
1664 objects_.Add(pool); | 1657 objects_.Add(pool); |
1665 | 1658 |
1666 intptr_t length = pool->ptr()->length_; | 1659 intptr_t length = pool->ptr()->length_; |
1667 RawTypedData* info_array = pool->ptr()->info_array_; | 1660 RawTypedData* info_array = pool->ptr()->info_array_; |
1668 | 1661 |
1669 for (intptr_t i = 0; i < length; i++) { | 1662 for (intptr_t i = 0; i < length; i++) { |
1670 ObjectPool::EntryType entry_type = | 1663 ObjectPool::EntryType entry_type = |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1706 #if !defined(TARGET_ARCH_DBC) | 1699 #if !defined(TARGET_ARCH_DBC) |
1707 if (entry.raw_obj_ == | 1700 if (entry.raw_obj_ == |
1708 StubCode::CallNativeCFunction_entry()->code()) { | 1701 StubCode::CallNativeCFunction_entry()->code()) { |
1709 // Natives can run while precompiling, becoming linked and | 1702 // Natives can run while precompiling, becoming linked and |
1710 // switching their stub. Reset to the initial stub used for | 1703 // switching their stub. Reset to the initial stub used for |
1711 // lazy-linking. | 1704 // lazy-linking. |
1712 s->WriteRef(StubCode::CallBootstrapCFunction_entry()->code()); | 1705 s->WriteRef(StubCode::CallBootstrapCFunction_entry()->code()); |
1713 break; | 1706 break; |
1714 } | 1707 } |
1715 #endif | 1708 #endif |
1716 s->WriteRef(entry.raw_obj_); | 1709 s->WriteRef(entry.raw_obj_); |
1717 break; | 1710 break; |
1718 } | 1711 } |
1719 case ObjectPool::kImmediate: { | 1712 case ObjectPool::kImmediate: { |
1720 s->Write<intptr_t>(entry.raw_value_); | 1713 s->Write<intptr_t>(entry.raw_value_); |
1721 break; | 1714 break; |
1722 } | 1715 } |
1723 case ObjectPool::kNativeEntry: { | 1716 case ObjectPool::kNativeEntry: { |
1724 // Write nothing. Will initialize with the lazy link entry. | 1717 // Write nothing. Will initialize with the lazy link entry. |
1725 #if defined(TARGET_ARCH_DBC) | 1718 #if defined(TARGET_ARCH_DBC) |
1726 UNREACHABLE(); // DBC does not support lazy native call linking. | 1719 UNREACHABLE(); // DBC does not support lazy native call linking. |
1727 #endif | 1720 #endif |
1728 break; | 1721 break; |
1729 } | 1722 } |
1730 default: | 1723 default: |
1731 UNREACHABLE(); | 1724 UNREACHABLE(); |
1732 } | 1725 } |
1733 } | 1726 } |
1734 } | 1727 } |
1735 } | 1728 } |
1736 | 1729 |
1737 private: | 1730 private: |
1738 GrowableArray<RawObjectPool*> objects_; | 1731 GrowableArray<RawObjectPool*> objects_; |
1739 }; | 1732 }; |
1740 #endif // !DART_PRECOMPILED_RUNTIME | 1733 #endif // !DART_PRECOMPILED_RUNTIME |
1741 | 1734 |
1742 | 1735 |
1743 class ObjectPoolDeserializationCluster : public DeserializationCluster { | 1736 class ObjectPoolDeserializationCluster : public DeserializationCluster { |
1744 public: | 1737 public: |
1745 ObjectPoolDeserializationCluster() { } | 1738 ObjectPoolDeserializationCluster() {} |
1746 virtual ~ObjectPoolDeserializationCluster() { } | 1739 virtual ~ObjectPoolDeserializationCluster() {} |
1747 | 1740 |
1748 void ReadAlloc(Deserializer* d) { | 1741 void ReadAlloc(Deserializer* d) { |
1749 start_index_ = d->next_index(); | 1742 start_index_ = d->next_index(); |
1750 PageSpace* old_space = d->heap()->old_space(); | 1743 PageSpace* old_space = d->heap()->old_space(); |
1751 intptr_t count = d->Read<int32_t>(); | 1744 intptr_t count = d->Read<int32_t>(); |
1752 for (intptr_t i = 0; i < count; i++) { | 1745 for (intptr_t i = 0; i < count; i++) { |
1753 intptr_t length = d->Read<int32_t>(); | 1746 intptr_t length = d->Read<int32_t>(); |
1754 d->AssignRef(AllocateUninitialized(old_space, | 1747 d->AssignRef( |
1755 ObjectPool::InstanceSize(length))); | 1748 AllocateUninitialized(old_space, ObjectPool::InstanceSize(length))); |
1756 } | 1749 } |
1757 stop_index_ = d->next_index(); | 1750 stop_index_ = d->next_index(); |
1758 } | 1751 } |
1759 | 1752 |
1760 void ReadFill(Deserializer* d) { | 1753 void ReadFill(Deserializer* d) { |
1761 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 1754 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
1762 PageSpace* old_space = d->heap()->old_space(); | 1755 PageSpace* old_space = d->heap()->old_space(); |
1763 for (intptr_t id = start_index_; id < stop_index_; id += 1) { | 1756 for (intptr_t id = start_index_; id < stop_index_; id += 1) { |
1764 intptr_t length = d->Read<int32_t>(); | 1757 intptr_t length = d->Read<int32_t>(); |
1765 RawTypedData* info_array = reinterpret_cast<RawTypedData*>( | 1758 RawTypedData* info_array = reinterpret_cast<RawTypedData*>( |
1766 AllocateUninitialized(old_space, TypedData::InstanceSize(length))); | 1759 AllocateUninitialized(old_space, TypedData::InstanceSize(length))); |
1767 Deserializer::InitializeHeader(info_array, kTypedDataUint8ArrayCid, | 1760 Deserializer::InitializeHeader(info_array, kTypedDataUint8ArrayCid, |
1768 TypedData::InstanceSize(length), | 1761 TypedData::InstanceSize(length), |
1769 is_vm_object); | 1762 is_vm_object); |
1770 info_array->ptr()->length_ = Smi::New(length); | 1763 info_array->ptr()->length_ = Smi::New(length); |
1771 RawObjectPool* pool = reinterpret_cast<RawObjectPool*>(d->Ref(id + 0)); | 1764 RawObjectPool* pool = reinterpret_cast<RawObjectPool*>(d->Ref(id + 0)); |
1772 Deserializer::InitializeHeader(pool, kObjectPoolCid, | 1765 Deserializer::InitializeHeader( |
1773 ObjectPool::InstanceSize(length), | 1766 pool, kObjectPoolCid, ObjectPool::InstanceSize(length), is_vm_object); |
1774 is_vm_object); | |
1775 pool->ptr()->length_ = length; | 1767 pool->ptr()->length_ = length; |
1776 pool->ptr()->info_array_ = info_array; | 1768 pool->ptr()->info_array_ = info_array; |
1777 for (intptr_t j = 0; j < length; j++) { | 1769 for (intptr_t j = 0; j < length; j++) { |
1778 ObjectPool::EntryType entry_type = | 1770 ObjectPool::EntryType entry_type = |
1779 static_cast<ObjectPool::EntryType>(d->Read<int8_t>()); | 1771 static_cast<ObjectPool::EntryType>(d->Read<int8_t>()); |
1780 info_array->ptr()->data()[j] = entry_type; | 1772 info_array->ptr()->data()[j] = entry_type; |
1781 RawObjectPool::Entry& entry = pool->ptr()->data()[j]; | 1773 RawObjectPool::Entry& entry = pool->ptr()->data()[j]; |
1782 switch (entry_type) { | 1774 switch (entry_type) { |
1783 case ObjectPool::kTaggedObject: | 1775 case ObjectPool::kTaggedObject: |
1784 entry.raw_obj_ = d->ReadRef(); | 1776 entry.raw_obj_ = d->ReadRef(); |
(...skipping 17 matching lines...) Expand all Loading... |
1802 } | 1794 } |
1803 } | 1795 } |
1804 } | 1796 } |
1805 }; | 1797 }; |
1806 | 1798 |
1807 | 1799 |
1808 #if !defined(DART_PRECOMPILED_RUNTIME) | 1800 #if !defined(DART_PRECOMPILED_RUNTIME) |
1809 // PcDescriptor, Stackmap, OneByteString, TwoByteString | 1801 // PcDescriptor, Stackmap, OneByteString, TwoByteString |
1810 class RODataSerializationCluster : public SerializationCluster { | 1802 class RODataSerializationCluster : public SerializationCluster { |
1811 public: | 1803 public: |
1812 explicit RODataSerializationCluster(intptr_t cid) : cid_(cid) { } | 1804 explicit RODataSerializationCluster(intptr_t cid) : cid_(cid) {} |
1813 virtual ~RODataSerializationCluster() { } | 1805 virtual ~RODataSerializationCluster() {} |
1814 | 1806 |
1815 void Trace(Serializer* s, RawObject* object) { | 1807 void Trace(Serializer* s, RawObject* object) { |
1816 objects_.Add(object); | 1808 objects_.Add(object); |
1817 | 1809 |
1818 // A string's hash must already be computed when we write it because it | 1810 // A string's hash must already be computed when we write it because it |
1819 // will be loaded into read-only memory. | 1811 // will be loaded into read-only memory. |
1820 if (cid_ == kOneByteStringCid) { | 1812 if (cid_ == kOneByteStringCid) { |
1821 RawOneByteString* str = static_cast<RawOneByteString*>(object); | 1813 RawOneByteString* str = static_cast<RawOneByteString*>(object); |
1822 if (str->ptr()->hash_ == Smi::New(0)) { | 1814 if (str->ptr()->hash_ == Smi::New(0)) { |
1823 intptr_t hash = String::Hash(str->ptr()->data(), | 1815 intptr_t hash = |
1824 Smi::Value(str->ptr()->length_)); | 1816 String::Hash(str->ptr()->data(), Smi::Value(str->ptr()->length_)); |
1825 str->ptr()->hash_ = Smi::New(hash); | 1817 str->ptr()->hash_ = Smi::New(hash); |
1826 } | 1818 } |
1827 ASSERT(str->ptr()->hash_ != Smi::New(0)); | 1819 ASSERT(str->ptr()->hash_ != Smi::New(0)); |
1828 } else if (cid_ == kTwoByteStringCid) { | 1820 } else if (cid_ == kTwoByteStringCid) { |
1829 RawTwoByteString* str = static_cast<RawTwoByteString*>(object); | 1821 RawTwoByteString* str = static_cast<RawTwoByteString*>(object); |
1830 if (str->ptr()->hash_ == Smi::New(0)) { | 1822 if (str->ptr()->hash_ == Smi::New(0)) { |
1831 intptr_t hash = String::Hash(str->ptr()->data(), | 1823 intptr_t hash = String::Hash(str->ptr()->data(), |
1832 Smi::Value(str->ptr()->length_) * 2); | 1824 Smi::Value(str->ptr()->length_) * 2); |
1833 str->ptr()->hash_ = Smi::New(hash); | 1825 str->ptr()->hash_ = Smi::New(hash); |
1834 } | 1826 } |
(...skipping 19 matching lines...) Expand all Loading... |
1854 | 1846 |
1855 private: | 1847 private: |
1856 const intptr_t cid_; | 1848 const intptr_t cid_; |
1857 GrowableArray<RawObject*> objects_; | 1849 GrowableArray<RawObject*> objects_; |
1858 }; | 1850 }; |
1859 #endif // !DART_PRECOMPILED_RUNTIME | 1851 #endif // !DART_PRECOMPILED_RUNTIME |
1860 | 1852 |
1861 | 1853 |
1862 class RODataDeserializationCluster : public DeserializationCluster { | 1854 class RODataDeserializationCluster : public DeserializationCluster { |
1863 public: | 1855 public: |
1864 RODataDeserializationCluster() { } | 1856 RODataDeserializationCluster() {} |
1865 virtual ~RODataDeserializationCluster() { } | 1857 virtual ~RODataDeserializationCluster() {} |
1866 | 1858 |
1867 void ReadAlloc(Deserializer* d) { | 1859 void ReadAlloc(Deserializer* d) { |
1868 intptr_t count = d->Read<int32_t>(); | 1860 intptr_t count = d->Read<int32_t>(); |
1869 for (intptr_t i = 0; i < count; i++) { | 1861 for (intptr_t i = 0; i < count; i++) { |
1870 int32_t rodata_offset = d->Read<int32_t>(); | 1862 int32_t rodata_offset = d->Read<int32_t>(); |
1871 d->AssignRef(d->GetObjectAt(rodata_offset)); | 1863 d->AssignRef(d->GetObjectAt(rodata_offset)); |
1872 } | 1864 } |
1873 } | 1865 } |
1874 | 1866 |
1875 void ReadFill(Deserializer* d) { | 1867 void ReadFill(Deserializer* d) { |
1876 // No-op. | 1868 // No-op. |
1877 } | 1869 } |
1878 }; | 1870 }; |
1879 | 1871 |
1880 | 1872 |
1881 #if !defined(DART_PRECOMPILED_RUNTIME) | 1873 #if !defined(DART_PRECOMPILED_RUNTIME) |
1882 class ExceptionHandlersSerializationCluster : public SerializationCluster { | 1874 class ExceptionHandlersSerializationCluster : public SerializationCluster { |
1883 public: | 1875 public: |
1884 ExceptionHandlersSerializationCluster() { } | 1876 ExceptionHandlersSerializationCluster() {} |
1885 virtual ~ExceptionHandlersSerializationCluster() { } | 1877 virtual ~ExceptionHandlersSerializationCluster() {} |
1886 | 1878 |
1887 void Trace(Serializer* s, RawObject* object) { | 1879 void Trace(Serializer* s, RawObject* object) { |
1888 RawExceptionHandlers* handlers = ExceptionHandlers::RawCast(object); | 1880 RawExceptionHandlers* handlers = ExceptionHandlers::RawCast(object); |
1889 objects_.Add(handlers); | 1881 objects_.Add(handlers); |
1890 | 1882 |
1891 s->Push(handlers->ptr()->handled_types_data_); | 1883 s->Push(handlers->ptr()->handled_types_data_); |
1892 } | 1884 } |
1893 | 1885 |
1894 void WriteAlloc(Serializer* s) { | 1886 void WriteAlloc(Serializer* s) { |
1895 s->WriteCid(kExceptionHandlersCid); | 1887 s->WriteCid(kExceptionHandlersCid); |
(...skipping 23 matching lines...) Expand all Loading... |
1919 } | 1911 } |
1920 | 1912 |
1921 private: | 1913 private: |
1922 GrowableArray<RawExceptionHandlers*> objects_; | 1914 GrowableArray<RawExceptionHandlers*> objects_; |
1923 }; | 1915 }; |
1924 #endif // !DART_PRECOMPILED_RUNTIME | 1916 #endif // !DART_PRECOMPILED_RUNTIME |
1925 | 1917 |
1926 | 1918 |
1927 class ExceptionHandlersDeserializationCluster : public DeserializationCluster { | 1919 class ExceptionHandlersDeserializationCluster : public DeserializationCluster { |
1928 public: | 1920 public: |
1929 ExceptionHandlersDeserializationCluster() { } | 1921 ExceptionHandlersDeserializationCluster() {} |
1930 virtual ~ExceptionHandlersDeserializationCluster() { } | 1922 virtual ~ExceptionHandlersDeserializationCluster() {} |
1931 | 1923 |
1932 void ReadAlloc(Deserializer* d) { | 1924 void ReadAlloc(Deserializer* d) { |
1933 start_index_ = d->next_index(); | 1925 start_index_ = d->next_index(); |
1934 PageSpace* old_space = d->heap()->old_space(); | 1926 PageSpace* old_space = d->heap()->old_space(); |
1935 intptr_t count = d->Read<int32_t>(); | 1927 intptr_t count = d->Read<int32_t>(); |
1936 for (intptr_t i = 0; i < count; i++) { | 1928 for (intptr_t i = 0; i < count; i++) { |
1937 intptr_t length = d->Read<int32_t>(); | 1929 intptr_t length = d->Read<int32_t>(); |
1938 d->AssignRef(AllocateUninitialized(old_space, | 1930 d->AssignRef(AllocateUninitialized( |
1939 ExceptionHandlers::InstanceSize(length))); | 1931 old_space, ExceptionHandlers::InstanceSize(length))); |
1940 } | 1932 } |
1941 stop_index_ = d->next_index(); | 1933 stop_index_ = d->next_index(); |
1942 } | 1934 } |
1943 | 1935 |
1944 void ReadFill(Deserializer* d) { | 1936 void ReadFill(Deserializer* d) { |
1945 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 1937 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
1946 | 1938 |
1947 for (intptr_t id = start_index_; id < stop_index_; id++) { | 1939 for (intptr_t id = start_index_; id < stop_index_; id++) { |
1948 RawExceptionHandlers* handlers = | 1940 RawExceptionHandlers* handlers = |
1949 reinterpret_cast<RawExceptionHandlers*>(d->Ref(id)); | 1941 reinterpret_cast<RawExceptionHandlers*>(d->Ref(id)); |
1950 intptr_t length = d->Read<int32_t>(); | 1942 intptr_t length = d->Read<int32_t>(); |
1951 Deserializer::InitializeHeader(handlers, kExceptionHandlersCid, | 1943 Deserializer::InitializeHeader(handlers, kExceptionHandlersCid, |
1952 ExceptionHandlers::InstanceSize(length), | 1944 ExceptionHandlers::InstanceSize(length), |
1953 is_vm_object); | 1945 is_vm_object); |
1954 handlers->ptr()->num_entries_ = length; | 1946 handlers->ptr()->num_entries_ = length; |
1955 handlers->ptr()->handled_types_data_ = | 1947 handlers->ptr()->handled_types_data_ = |
1956 reinterpret_cast<RawArray*>(d->ReadRef()); | 1948 reinterpret_cast<RawArray*>(d->ReadRef()); |
1957 | 1949 |
1958 uint8_t* data = reinterpret_cast<uint8_t*>(handlers->ptr()->data()); | 1950 uint8_t* data = reinterpret_cast<uint8_t*>(handlers->ptr()->data()); |
1959 intptr_t length_in_bytes = | 1951 intptr_t length_in_bytes = |
1960 length * sizeof(RawExceptionHandlers::HandlerInfo); | 1952 length * sizeof(RawExceptionHandlers::HandlerInfo); |
1961 d->ReadBytes(data, length_in_bytes); | 1953 d->ReadBytes(data, length_in_bytes); |
1962 } | 1954 } |
1963 } | 1955 } |
1964 }; | 1956 }; |
1965 | 1957 |
1966 #if !defined(DART_PRECOMPILED_RUNTIME) | 1958 #if !defined(DART_PRECOMPILED_RUNTIME) |
1967 class ContextSerializationCluster : public SerializationCluster { | 1959 class ContextSerializationCluster : public SerializationCluster { |
1968 public: | 1960 public: |
1969 ContextSerializationCluster() { } | 1961 ContextSerializationCluster() {} |
1970 virtual ~ContextSerializationCluster() { } | 1962 virtual ~ContextSerializationCluster() {} |
1971 | 1963 |
1972 void Trace(Serializer* s, RawObject* object) { | 1964 void Trace(Serializer* s, RawObject* object) { |
1973 RawContext* context = Context::RawCast(object); | 1965 RawContext* context = Context::RawCast(object); |
1974 objects_.Add(context); | 1966 objects_.Add(context); |
1975 | 1967 |
1976 s->Push(context->ptr()->parent_); | 1968 s->Push(context->ptr()->parent_); |
1977 intptr_t length = context->ptr()->num_variables_; | 1969 intptr_t length = context->ptr()->num_variables_; |
1978 for (intptr_t i = 0; i < length; i++) { | 1970 for (intptr_t i = 0; i < length; i++) { |
1979 s->Push(context->ptr()->data()[i]); | 1971 s->Push(context->ptr()->data()[i]); |
1980 } | 1972 } |
(...skipping 25 matching lines...) Expand all Loading... |
2006 } | 1998 } |
2007 | 1999 |
2008 private: | 2000 private: |
2009 GrowableArray<RawContext*> objects_; | 2001 GrowableArray<RawContext*> objects_; |
2010 }; | 2002 }; |
2011 #endif // !DART_PRECOMPILED_RUNTIME | 2003 #endif // !DART_PRECOMPILED_RUNTIME |
2012 | 2004 |
2013 | 2005 |
2014 class ContextDeserializationCluster : public DeserializationCluster { | 2006 class ContextDeserializationCluster : public DeserializationCluster { |
2015 public: | 2007 public: |
2016 ContextDeserializationCluster() { } | 2008 ContextDeserializationCluster() {} |
2017 virtual ~ContextDeserializationCluster() { } | 2009 virtual ~ContextDeserializationCluster() {} |
2018 | 2010 |
2019 void ReadAlloc(Deserializer* d) { | 2011 void ReadAlloc(Deserializer* d) { |
2020 start_index_ = d->next_index(); | 2012 start_index_ = d->next_index(); |
2021 PageSpace* old_space = d->heap()->old_space(); | 2013 PageSpace* old_space = d->heap()->old_space(); |
2022 intptr_t count = d->Read<int32_t>(); | 2014 intptr_t count = d->Read<int32_t>(); |
2023 for (intptr_t i = 0; i < count; i++) { | 2015 for (intptr_t i = 0; i < count; i++) { |
2024 intptr_t length = d->Read<int32_t>(); | 2016 intptr_t length = d->Read<int32_t>(); |
2025 d->AssignRef(AllocateUninitialized(old_space, | 2017 d->AssignRef( |
2026 Context::InstanceSize(length))); | 2018 AllocateUninitialized(old_space, Context::InstanceSize(length))); |
2027 } | 2019 } |
2028 stop_index_ = d->next_index(); | 2020 stop_index_ = d->next_index(); |
2029 } | 2021 } |
2030 | 2022 |
2031 void ReadFill(Deserializer* d) { | 2023 void ReadFill(Deserializer* d) { |
2032 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2024 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
2033 | 2025 |
2034 for (intptr_t id = start_index_; id < stop_index_; id++) { | 2026 for (intptr_t id = start_index_; id < stop_index_; id++) { |
2035 RawContext* context = reinterpret_cast<RawContext*>(d->Ref(id)); | 2027 RawContext* context = reinterpret_cast<RawContext*>(d->Ref(id)); |
2036 intptr_t length = d->Read<int32_t>(); | 2028 intptr_t length = d->Read<int32_t>(); |
2037 Deserializer::InitializeHeader(context, kContextCid, | 2029 Deserializer::InitializeHeader( |
2038 Context::InstanceSize(length), | 2030 context, kContextCid, Context::InstanceSize(length), is_vm_object); |
2039 is_vm_object); | |
2040 context->ptr()->num_variables_ = length; | 2031 context->ptr()->num_variables_ = length; |
2041 context->ptr()->parent_ = reinterpret_cast<RawContext*>(d->ReadRef()); | 2032 context->ptr()->parent_ = reinterpret_cast<RawContext*>(d->ReadRef()); |
2042 for (intptr_t j = 0; j < length; j++) { | 2033 for (intptr_t j = 0; j < length; j++) { |
2043 context->ptr()->data()[j] = d->ReadRef(); | 2034 context->ptr()->data()[j] = d->ReadRef(); |
2044 } | 2035 } |
2045 } | 2036 } |
2046 } | 2037 } |
2047 }; | 2038 }; |
2048 | 2039 |
2049 | 2040 |
2050 #if !defined(DART_PRECOMPILED_RUNTIME) | 2041 #if !defined(DART_PRECOMPILED_RUNTIME) |
2051 class ContextScopeSerializationCluster : public SerializationCluster { | 2042 class ContextScopeSerializationCluster : public SerializationCluster { |
2052 public: | 2043 public: |
2053 ContextScopeSerializationCluster() { } | 2044 ContextScopeSerializationCluster() {} |
2054 virtual ~ContextScopeSerializationCluster() { } | 2045 virtual ~ContextScopeSerializationCluster() {} |
2055 | 2046 |
2056 void Trace(Serializer* s, RawObject* object) { | 2047 void Trace(Serializer* s, RawObject* object) { |
2057 RawContextScope* scope = ContextScope::RawCast(object); | 2048 RawContextScope* scope = ContextScope::RawCast(object); |
2058 objects_.Add(scope); | 2049 objects_.Add(scope); |
2059 | 2050 |
2060 intptr_t length = scope->ptr()->num_variables_; | 2051 intptr_t length = scope->ptr()->num_variables_; |
2061 RawObject** from = scope->from(); | 2052 RawObject** from = scope->from(); |
2062 RawObject** to = scope->to(length); | 2053 RawObject** to = scope->to(length); |
2063 for (RawObject** p = from; p <= to; p++) { | 2054 for (RawObject** p = from; p <= to; p++) { |
2064 s->Push(*p); | 2055 s->Push(*p); |
(...skipping 28 matching lines...) Expand all Loading... |
2093 } | 2084 } |
2094 | 2085 |
2095 private: | 2086 private: |
2096 GrowableArray<RawContextScope*> objects_; | 2087 GrowableArray<RawContextScope*> objects_; |
2097 }; | 2088 }; |
2098 #endif // !DART_PRECOMPILED_RUNTIME | 2089 #endif // !DART_PRECOMPILED_RUNTIME |
2099 | 2090 |
2100 | 2091 |
2101 class ContextScopeDeserializationCluster : public DeserializationCluster { | 2092 class ContextScopeDeserializationCluster : public DeserializationCluster { |
2102 public: | 2093 public: |
2103 ContextScopeDeserializationCluster() { } | 2094 ContextScopeDeserializationCluster() {} |
2104 virtual ~ContextScopeDeserializationCluster() { } | 2095 virtual ~ContextScopeDeserializationCluster() {} |
2105 | 2096 |
2106 void ReadAlloc(Deserializer* d) { | 2097 void ReadAlloc(Deserializer* d) { |
2107 start_index_ = d->next_index(); | 2098 start_index_ = d->next_index(); |
2108 PageSpace* old_space = d->heap()->old_space(); | 2099 PageSpace* old_space = d->heap()->old_space(); |
2109 intptr_t count = d->Read<int32_t>(); | 2100 intptr_t count = d->Read<int32_t>(); |
2110 for (intptr_t i = 0; i < count; i++) { | 2101 for (intptr_t i = 0; i < count; i++) { |
2111 intptr_t length = d->Read<int32_t>(); | 2102 intptr_t length = d->Read<int32_t>(); |
2112 d->AssignRef(AllocateUninitialized(old_space, | 2103 d->AssignRef( |
2113 ContextScope::InstanceSize(length))); | 2104 AllocateUninitialized(old_space, ContextScope::InstanceSize(length))); |
2114 } | 2105 } |
2115 stop_index_ = d->next_index(); | 2106 stop_index_ = d->next_index(); |
2116 } | 2107 } |
2117 | 2108 |
2118 void ReadFill(Deserializer* d) { | 2109 void ReadFill(Deserializer* d) { |
2119 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2110 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
2120 | 2111 |
2121 for (intptr_t id = start_index_; id < stop_index_; id++) { | 2112 for (intptr_t id = start_index_; id < stop_index_; id++) { |
2122 RawContextScope* scope = reinterpret_cast<RawContextScope*>(d->Ref(id)); | 2113 RawContextScope* scope = reinterpret_cast<RawContextScope*>(d->Ref(id)); |
2123 intptr_t length = d->Read<int32_t>(); | 2114 intptr_t length = d->Read<int32_t>(); |
2124 Deserializer::InitializeHeader(scope, kContextScopeCid, | 2115 Deserializer::InitializeHeader(scope, kContextScopeCid, |
2125 ContextScope::InstanceSize(length), | 2116 ContextScope::InstanceSize(length), |
2126 is_vm_object); | 2117 is_vm_object); |
2127 scope->ptr()->num_variables_ = length; | 2118 scope->ptr()->num_variables_ = length; |
2128 scope->ptr()->is_implicit_ = d->Read<bool>(); | 2119 scope->ptr()->is_implicit_ = d->Read<bool>(); |
2129 RawObject** from = scope->from(); | 2120 RawObject** from = scope->from(); |
2130 RawObject** to = scope->to(length); | 2121 RawObject** to = scope->to(length); |
2131 for (RawObject** p = from; p <= to; p++) { | 2122 for (RawObject** p = from; p <= to; p++) { |
2132 *p = d->ReadRef(); | 2123 *p = d->ReadRef(); |
2133 } | 2124 } |
2134 } | 2125 } |
2135 } | 2126 } |
2136 }; | 2127 }; |
2137 | 2128 |
2138 | 2129 |
2139 #if !defined(DART_PRECOMPILED_RUNTIME) | 2130 #if !defined(DART_PRECOMPILED_RUNTIME) |
2140 class UnlinkedCallSerializationCluster : public SerializationCluster { | 2131 class UnlinkedCallSerializationCluster : public SerializationCluster { |
2141 public: | 2132 public: |
2142 UnlinkedCallSerializationCluster() { } | 2133 UnlinkedCallSerializationCluster() {} |
2143 virtual ~UnlinkedCallSerializationCluster() { } | 2134 virtual ~UnlinkedCallSerializationCluster() {} |
2144 | 2135 |
2145 void Trace(Serializer* s, RawObject* object) { | 2136 void Trace(Serializer* s, RawObject* object) { |
2146 RawUnlinkedCall* unlinked = UnlinkedCall::RawCast(object); | 2137 RawUnlinkedCall* unlinked = UnlinkedCall::RawCast(object); |
2147 objects_.Add(unlinked); | 2138 objects_.Add(unlinked); |
2148 | 2139 |
2149 RawObject** from = unlinked->from(); | 2140 RawObject** from = unlinked->from(); |
2150 RawObject** to = unlinked->to(); | 2141 RawObject** to = unlinked->to(); |
2151 for (RawObject** p = from; p <= to; p++) { | 2142 for (RawObject** p = from; p <= to; p++) { |
2152 s->Push(*p); | 2143 s->Push(*p); |
2153 } | 2144 } |
(...skipping 22 matching lines...) Expand all Loading... |
2176 } | 2167 } |
2177 | 2168 |
2178 private: | 2169 private: |
2179 GrowableArray<RawUnlinkedCall*> objects_; | 2170 GrowableArray<RawUnlinkedCall*> objects_; |
2180 }; | 2171 }; |
2181 #endif // !DART_PRECOMPILED_RUNTIME | 2172 #endif // !DART_PRECOMPILED_RUNTIME |
2182 | 2173 |
2183 | 2174 |
2184 class UnlinkedCallDeserializationCluster : public DeserializationCluster { | 2175 class UnlinkedCallDeserializationCluster : public DeserializationCluster { |
2185 public: | 2176 public: |
2186 UnlinkedCallDeserializationCluster() { } | 2177 UnlinkedCallDeserializationCluster() {} |
2187 virtual ~UnlinkedCallDeserializationCluster() { } | 2178 virtual ~UnlinkedCallDeserializationCluster() {} |
2188 | 2179 |
2189 void ReadAlloc(Deserializer* d) { | 2180 void ReadAlloc(Deserializer* d) { |
2190 start_index_ = d->next_index(); | 2181 start_index_ = d->next_index(); |
2191 PageSpace* old_space = d->heap()->old_space(); | 2182 PageSpace* old_space = d->heap()->old_space(); |
2192 intptr_t count = d->Read<int32_t>(); | 2183 intptr_t count = d->Read<int32_t>(); |
2193 for (intptr_t i = 0; i < count; i++) { | 2184 for (intptr_t i = 0; i < count; i++) { |
2194 d->AssignRef(AllocateUninitialized(old_space, | 2185 d->AssignRef( |
2195 UnlinkedCall::InstanceSize())); | 2186 AllocateUninitialized(old_space, UnlinkedCall::InstanceSize())); |
2196 } | 2187 } |
2197 stop_index_ = d->next_index(); | 2188 stop_index_ = d->next_index(); |
2198 } | 2189 } |
2199 | 2190 |
2200 void ReadFill(Deserializer* d) { | 2191 void ReadFill(Deserializer* d) { |
2201 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2192 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
2202 | 2193 |
2203 for (intptr_t id = start_index_; id < stop_index_; id++) { | 2194 for (intptr_t id = start_index_; id < stop_index_; id++) { |
2204 RawUnlinkedCall* unlinked = | 2195 RawUnlinkedCall* unlinked = |
2205 reinterpret_cast<RawUnlinkedCall*>(d->Ref(id)); | 2196 reinterpret_cast<RawUnlinkedCall*>(d->Ref(id)); |
2206 Deserializer::InitializeHeader(unlinked, kUnlinkedCallCid, | 2197 Deserializer::InitializeHeader(unlinked, kUnlinkedCallCid, |
2207 UnlinkedCall::InstanceSize(), | 2198 UnlinkedCall::InstanceSize(), |
2208 is_vm_object); | 2199 is_vm_object); |
2209 RawObject** from = unlinked->from(); | 2200 RawObject** from = unlinked->from(); |
2210 RawObject** to = unlinked->to(); | 2201 RawObject** to = unlinked->to(); |
2211 for (RawObject** p = from; p <= to; p++) { | 2202 for (RawObject** p = from; p <= to; p++) { |
2212 *p = d->ReadRef(); | 2203 *p = d->ReadRef(); |
2213 } | 2204 } |
2214 } | 2205 } |
2215 } | 2206 } |
2216 }; | 2207 }; |
2217 | 2208 |
2218 | 2209 |
2219 #if !defined(DART_PRECOMPILED_RUNTIME) | 2210 #if !defined(DART_PRECOMPILED_RUNTIME) |
2220 class ICDataSerializationCluster : public SerializationCluster { | 2211 class ICDataSerializationCluster : public SerializationCluster { |
2221 public: | 2212 public: |
2222 ICDataSerializationCluster() { } | 2213 ICDataSerializationCluster() {} |
2223 virtual ~ICDataSerializationCluster() { } | 2214 virtual ~ICDataSerializationCluster() {} |
2224 | 2215 |
2225 void Trace(Serializer* s, RawObject* object) { | 2216 void Trace(Serializer* s, RawObject* object) { |
2226 RawICData* ic = ICData::RawCast(object); | 2217 RawICData* ic = ICData::RawCast(object); |
2227 objects_.Add(ic); | 2218 objects_.Add(ic); |
2228 | 2219 |
2229 RawObject** from = ic->from(); | 2220 RawObject** from = ic->from(); |
2230 RawObject** to = ic->to_snapshot(s->kind()); | 2221 RawObject** to = ic->to_snapshot(s->kind()); |
2231 for (RawObject** p = from; p <= to; p++) { | 2222 for (RawObject** p = from; p <= to; p++) { |
2232 s->Push(*p); | 2223 s->Push(*p); |
2233 } | 2224 } |
(...skipping 30 matching lines...) Expand all Loading... |
2264 } | 2255 } |
2265 | 2256 |
2266 private: | 2257 private: |
2267 GrowableArray<RawICData*> objects_; | 2258 GrowableArray<RawICData*> objects_; |
2268 }; | 2259 }; |
2269 #endif // !DART_PRECOMPILED_RUNTIME | 2260 #endif // !DART_PRECOMPILED_RUNTIME |
2270 | 2261 |
2271 | 2262 |
2272 class ICDataDeserializationCluster : public DeserializationCluster { | 2263 class ICDataDeserializationCluster : public DeserializationCluster { |
2273 public: | 2264 public: |
2274 ICDataDeserializationCluster() { } | 2265 ICDataDeserializationCluster() {} |
2275 virtual ~ICDataDeserializationCluster() { } | 2266 virtual ~ICDataDeserializationCluster() {} |
2276 | 2267 |
2277 void ReadAlloc(Deserializer* d) { | 2268 void ReadAlloc(Deserializer* d) { |
2278 start_index_ = d->next_index(); | 2269 start_index_ = d->next_index(); |
2279 PageSpace* old_space = d->heap()->old_space(); | 2270 PageSpace* old_space = d->heap()->old_space(); |
2280 intptr_t count = d->Read<int32_t>(); | 2271 intptr_t count = d->Read<int32_t>(); |
2281 for (intptr_t i = 0; i < count; i++) { | 2272 for (intptr_t i = 0; i < count; i++) { |
2282 d->AssignRef(AllocateUninitialized(old_space, ICData::InstanceSize())); | 2273 d->AssignRef(AllocateUninitialized(old_space, ICData::InstanceSize())); |
2283 } | 2274 } |
2284 stop_index_ = d->next_index(); | 2275 stop_index_ = d->next_index(); |
2285 } | 2276 } |
2286 | 2277 |
2287 void ReadFill(Deserializer* d) { | 2278 void ReadFill(Deserializer* d) { |
2288 Snapshot::Kind kind = d->kind(); | 2279 Snapshot::Kind kind = d->kind(); |
2289 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2280 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
2290 | 2281 |
2291 for (intptr_t id = start_index_; id < stop_index_; id++) { | 2282 for (intptr_t id = start_index_; id < stop_index_; id++) { |
2292 RawICData* ic = reinterpret_cast<RawICData*>(d->Ref(id)); | 2283 RawICData* ic = reinterpret_cast<RawICData*>(d->Ref(id)); |
2293 Deserializer::InitializeHeader(ic, kICDataCid, | 2284 Deserializer::InitializeHeader(ic, kICDataCid, ICData::InstanceSize(), |
2294 ICData::InstanceSize(), is_vm_object); | 2285 is_vm_object); |
2295 RawObject** from = ic->from(); | 2286 RawObject** from = ic->from(); |
2296 RawObject** to_snapshot = ic->to_snapshot(kind); | 2287 RawObject** to_snapshot = ic->to_snapshot(kind); |
2297 RawObject** to = ic->to(); | 2288 RawObject** to = ic->to(); |
2298 for (RawObject** p = from; p <= to_snapshot; p++) { | 2289 for (RawObject** p = from; p <= to_snapshot; p++) { |
2299 *p = d->ReadRef(); | 2290 *p = d->ReadRef(); |
2300 } | 2291 } |
2301 for (RawObject** p = to_snapshot + 1; p <= to; p++) { | 2292 for (RawObject** p = to_snapshot + 1; p <= to; p++) { |
2302 *p = Object::null(); | 2293 *p = Object::null(); |
2303 } | 2294 } |
2304 NOT_IN_PRECOMPILED(ic->ptr()->deopt_id_ = d->Read<int32_t>()); | 2295 NOT_IN_PRECOMPILED(ic->ptr()->deopt_id_ = d->Read<int32_t>()); |
2305 ic->ptr()->state_bits_ = d->Read<int32_t>(); | 2296 ic->ptr()->state_bits_ = d->Read<int32_t>(); |
2306 #if defined(TAG_IC_DATA) | 2297 #if defined(TAG_IC_DATA) |
2307 ic->ptr()->tag_ = d->Read<int32_t>(); | 2298 ic->ptr()->tag_ = d->Read<int32_t>(); |
2308 #endif | 2299 #endif |
2309 } | 2300 } |
2310 } | 2301 } |
2311 }; | 2302 }; |
2312 | 2303 |
2313 | 2304 |
2314 #if !defined(DART_PRECOMPILED_RUNTIME) | 2305 #if !defined(DART_PRECOMPILED_RUNTIME) |
2315 class MegamorphicCacheSerializationCluster : public SerializationCluster { | 2306 class MegamorphicCacheSerializationCluster : public SerializationCluster { |
2316 public: | 2307 public: |
2317 MegamorphicCacheSerializationCluster() { } | 2308 MegamorphicCacheSerializationCluster() {} |
2318 virtual ~MegamorphicCacheSerializationCluster() { } | 2309 virtual ~MegamorphicCacheSerializationCluster() {} |
2319 | 2310 |
2320 void Trace(Serializer* s, RawObject* object) { | 2311 void Trace(Serializer* s, RawObject* object) { |
2321 RawMegamorphicCache* cache = MegamorphicCache::RawCast(object); | 2312 RawMegamorphicCache* cache = MegamorphicCache::RawCast(object); |
2322 objects_.Add(cache); | 2313 objects_.Add(cache); |
2323 | 2314 |
2324 RawObject** from = cache->from(); | 2315 RawObject** from = cache->from(); |
2325 RawObject** to = cache->to(); | 2316 RawObject** to = cache->to(); |
2326 for (RawObject** p = from; p <= to; p++) { | 2317 for (RawObject** p = from; p <= to; p++) { |
2327 s->Push(*p); | 2318 s->Push(*p); |
2328 } | 2319 } |
(...skipping 23 matching lines...) Expand all Loading... |
2352 } | 2343 } |
2353 | 2344 |
2354 private: | 2345 private: |
2355 GrowableArray<RawMegamorphicCache*> objects_; | 2346 GrowableArray<RawMegamorphicCache*> objects_; |
2356 }; | 2347 }; |
2357 #endif // !DART_PRECOMPILED_RUNTIME | 2348 #endif // !DART_PRECOMPILED_RUNTIME |
2358 | 2349 |
2359 | 2350 |
2360 class MegamorphicCacheDeserializationCluster : public DeserializationCluster { | 2351 class MegamorphicCacheDeserializationCluster : public DeserializationCluster { |
2361 public: | 2352 public: |
2362 MegamorphicCacheDeserializationCluster() { } | 2353 MegamorphicCacheDeserializationCluster() {} |
2363 virtual ~MegamorphicCacheDeserializationCluster() { } | 2354 virtual ~MegamorphicCacheDeserializationCluster() {} |
2364 | 2355 |
2365 void ReadAlloc(Deserializer* d) { | 2356 void ReadAlloc(Deserializer* d) { |
2366 start_index_ = d->next_index(); | 2357 start_index_ = d->next_index(); |
2367 PageSpace* old_space = d->heap()->old_space(); | 2358 PageSpace* old_space = d->heap()->old_space(); |
2368 intptr_t count = d->Read<int32_t>(); | 2359 intptr_t count = d->Read<int32_t>(); |
2369 for (intptr_t i = 0; i < count; i++) { | 2360 for (intptr_t i = 0; i < count; i++) { |
2370 d->AssignRef(AllocateUninitialized(old_space, | 2361 d->AssignRef( |
2371 MegamorphicCache::InstanceSize())); | 2362 AllocateUninitialized(old_space, MegamorphicCache::InstanceSize())); |
2372 } | 2363 } |
2373 stop_index_ = d->next_index(); | 2364 stop_index_ = d->next_index(); |
2374 } | 2365 } |
2375 | 2366 |
2376 void ReadFill(Deserializer* d) { | 2367 void ReadFill(Deserializer* d) { |
2377 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2368 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
2378 | 2369 |
2379 for (intptr_t id = start_index_; id < stop_index_; id++) { | 2370 for (intptr_t id = start_index_; id < stop_index_; id++) { |
2380 RawMegamorphicCache* cache = | 2371 RawMegamorphicCache* cache = |
2381 reinterpret_cast<RawMegamorphicCache*>(d->Ref(id)); | 2372 reinterpret_cast<RawMegamorphicCache*>(d->Ref(id)); |
2382 Deserializer::InitializeHeader(cache, kMegamorphicCacheCid, | 2373 Deserializer::InitializeHeader(cache, kMegamorphicCacheCid, |
2383 MegamorphicCache::InstanceSize(), | 2374 MegamorphicCache::InstanceSize(), |
2384 is_vm_object); | 2375 is_vm_object); |
2385 RawObject** from = cache->from(); | 2376 RawObject** from = cache->from(); |
2386 RawObject** to = cache->to(); | 2377 RawObject** to = cache->to(); |
2387 for (RawObject** p = from; p <= to; p++) { | 2378 for (RawObject** p = from; p <= to; p++) { |
2388 *p = d->ReadRef(); | 2379 *p = d->ReadRef(); |
2389 } | 2380 } |
2390 cache->ptr()->filled_entry_count_ = d->Read<int32_t>(); | 2381 cache->ptr()->filled_entry_count_ = d->Read<int32_t>(); |
2391 } | 2382 } |
2392 } | 2383 } |
2393 }; | 2384 }; |
2394 | 2385 |
2395 | 2386 |
2396 #if !defined(DART_PRECOMPILED_RUNTIME) | 2387 #if !defined(DART_PRECOMPILED_RUNTIME) |
2397 class SubtypeTestCacheSerializationCluster : public SerializationCluster { | 2388 class SubtypeTestCacheSerializationCluster : public SerializationCluster { |
2398 public: | 2389 public: |
2399 SubtypeTestCacheSerializationCluster() { } | 2390 SubtypeTestCacheSerializationCluster() {} |
2400 virtual ~SubtypeTestCacheSerializationCluster() { } | 2391 virtual ~SubtypeTestCacheSerializationCluster() {} |
2401 | 2392 |
2402 void Trace(Serializer* s, RawObject* object) { | 2393 void Trace(Serializer* s, RawObject* object) { |
2403 RawSubtypeTestCache* cache = SubtypeTestCache::RawCast(object); | 2394 RawSubtypeTestCache* cache = SubtypeTestCache::RawCast(object); |
2404 objects_.Add(cache); | 2395 objects_.Add(cache); |
2405 s->Push(cache->ptr()->cache_); | 2396 s->Push(cache->ptr()->cache_); |
2406 } | 2397 } |
2407 | 2398 |
2408 void WriteAlloc(Serializer* s) { | 2399 void WriteAlloc(Serializer* s) { |
2409 s->WriteCid(kSubtypeTestCacheCid); | 2400 s->WriteCid(kSubtypeTestCacheCid); |
2410 intptr_t count = objects_.length(); | 2401 intptr_t count = objects_.length(); |
(...skipping 13 matching lines...) Expand all Loading... |
2424 } | 2415 } |
2425 | 2416 |
2426 private: | 2417 private: |
2427 GrowableArray<RawSubtypeTestCache*> objects_; | 2418 GrowableArray<RawSubtypeTestCache*> objects_; |
2428 }; | 2419 }; |
2429 #endif // !DART_PRECOMPILED_RUNTIME | 2420 #endif // !DART_PRECOMPILED_RUNTIME |
2430 | 2421 |
2431 | 2422 |
2432 class SubtypeTestCacheDeserializationCluster : public DeserializationCluster { | 2423 class SubtypeTestCacheDeserializationCluster : public DeserializationCluster { |
2433 public: | 2424 public: |
2434 SubtypeTestCacheDeserializationCluster() { } | 2425 SubtypeTestCacheDeserializationCluster() {} |
2435 virtual ~SubtypeTestCacheDeserializationCluster() { } | 2426 virtual ~SubtypeTestCacheDeserializationCluster() {} |
2436 | 2427 |
2437 void ReadAlloc(Deserializer* d) { | 2428 void ReadAlloc(Deserializer* d) { |
2438 start_index_ = d->next_index(); | 2429 start_index_ = d->next_index(); |
2439 PageSpace* old_space = d->heap()->old_space(); | 2430 PageSpace* old_space = d->heap()->old_space(); |
2440 intptr_t count = d->Read<int32_t>(); | 2431 intptr_t count = d->Read<int32_t>(); |
2441 for (intptr_t i = 0; i < count; i++) { | 2432 for (intptr_t i = 0; i < count; i++) { |
2442 d->AssignRef(AllocateUninitialized(old_space, | 2433 d->AssignRef( |
2443 SubtypeTestCache::InstanceSize())); | 2434 AllocateUninitialized(old_space, SubtypeTestCache::InstanceSize())); |
2444 } | 2435 } |
2445 stop_index_ = d->next_index(); | 2436 stop_index_ = d->next_index(); |
2446 } | 2437 } |
2447 | 2438 |
2448 void ReadFill(Deserializer* d) { | 2439 void ReadFill(Deserializer* d) { |
2449 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2440 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
2450 | 2441 |
2451 for (intptr_t id = start_index_; id < stop_index_; id++) { | 2442 for (intptr_t id = start_index_; id < stop_index_; id++) { |
2452 RawSubtypeTestCache* cache = | 2443 RawSubtypeTestCache* cache = |
2453 reinterpret_cast<RawSubtypeTestCache*>(d->Ref(id)); | 2444 reinterpret_cast<RawSubtypeTestCache*>(d->Ref(id)); |
2454 Deserializer::InitializeHeader(cache, kSubtypeTestCacheCid, | 2445 Deserializer::InitializeHeader(cache, kSubtypeTestCacheCid, |
2455 SubtypeTestCache::InstanceSize(), | 2446 SubtypeTestCache::InstanceSize(), |
2456 is_vm_object); | 2447 is_vm_object); |
2457 cache->ptr()->cache_ = reinterpret_cast<RawArray*>(d->ReadRef()); | 2448 cache->ptr()->cache_ = reinterpret_cast<RawArray*>(d->ReadRef()); |
2458 } | 2449 } |
2459 } | 2450 } |
2460 }; | 2451 }; |
2461 | 2452 |
2462 | 2453 |
2463 #if !defined(DART_PRECOMPILED_RUNTIME) | 2454 #if !defined(DART_PRECOMPILED_RUNTIME) |
2464 class LanguageErrorSerializationCluster : public SerializationCluster { | 2455 class LanguageErrorSerializationCluster : public SerializationCluster { |
2465 public: | 2456 public: |
2466 LanguageErrorSerializationCluster() { } | 2457 LanguageErrorSerializationCluster() {} |
2467 virtual ~LanguageErrorSerializationCluster() { } | 2458 virtual ~LanguageErrorSerializationCluster() {} |
2468 | 2459 |
2469 void Trace(Serializer* s, RawObject* object) { | 2460 void Trace(Serializer* s, RawObject* object) { |
2470 RawLanguageError* error = LanguageError::RawCast(object); | 2461 RawLanguageError* error = LanguageError::RawCast(object); |
2471 objects_.Add(error); | 2462 objects_.Add(error); |
2472 | 2463 |
2473 RawObject** from = error->from(); | 2464 RawObject** from = error->from(); |
2474 RawObject** to = error->to(); | 2465 RawObject** to = error->to(); |
2475 for (RawObject** p = from; p <= to; p++) { | 2466 for (RawObject** p = from; p <= to; p++) { |
2476 s->Push(*p); | 2467 s->Push(*p); |
2477 } | 2468 } |
(...skipping 25 matching lines...) Expand all Loading... |
2503 } | 2494 } |
2504 | 2495 |
2505 private: | 2496 private: |
2506 GrowableArray<RawLanguageError*> objects_; | 2497 GrowableArray<RawLanguageError*> objects_; |
2507 }; | 2498 }; |
2508 #endif // !DART_PRECOMPILED_RUNTIME | 2499 #endif // !DART_PRECOMPILED_RUNTIME |
2509 | 2500 |
2510 | 2501 |
2511 class LanguageErrorDeserializationCluster : public DeserializationCluster { | 2502 class LanguageErrorDeserializationCluster : public DeserializationCluster { |
2512 public: | 2503 public: |
2513 LanguageErrorDeserializationCluster() { } | 2504 LanguageErrorDeserializationCluster() {} |
2514 virtual ~LanguageErrorDeserializationCluster() { } | 2505 virtual ~LanguageErrorDeserializationCluster() {} |
2515 | 2506 |
2516 void ReadAlloc(Deserializer* d) { | 2507 void ReadAlloc(Deserializer* d) { |
2517 start_index_ = d->next_index(); | 2508 start_index_ = d->next_index(); |
2518 PageSpace* old_space = d->heap()->old_space(); | 2509 PageSpace* old_space = d->heap()->old_space(); |
2519 intptr_t count = d->Read<int32_t>(); | 2510 intptr_t count = d->Read<int32_t>(); |
2520 for (intptr_t i = 0; i < count; i++) { | 2511 for (intptr_t i = 0; i < count; i++) { |
2521 d->AssignRef(AllocateUninitialized(old_space, | 2512 d->AssignRef( |
2522 LanguageError::InstanceSize())); | 2513 AllocateUninitialized(old_space, LanguageError::InstanceSize())); |
2523 } | 2514 } |
2524 stop_index_ = d->next_index(); | 2515 stop_index_ = d->next_index(); |
2525 } | 2516 } |
2526 | 2517 |
2527 void ReadFill(Deserializer* d) { | 2518 void ReadFill(Deserializer* d) { |
2528 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2519 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
2529 | 2520 |
2530 for (intptr_t id = start_index_; id < stop_index_; id++) { | 2521 for (intptr_t id = start_index_; id < stop_index_; id++) { |
2531 RawLanguageError* error = reinterpret_cast<RawLanguageError*>(d->Ref(id)); | 2522 RawLanguageError* error = reinterpret_cast<RawLanguageError*>(d->Ref(id)); |
2532 Deserializer::InitializeHeader(error, kLanguageErrorCid, | 2523 Deserializer::InitializeHeader(error, kLanguageErrorCid, |
2533 LanguageError::InstanceSize(), | 2524 LanguageError::InstanceSize(), |
2534 is_vm_object); | 2525 is_vm_object); |
2535 RawObject** from = error->from(); | 2526 RawObject** from = error->from(); |
2536 RawObject** to = error->to(); | 2527 RawObject** to = error->to(); |
2537 for (RawObject** p = from; p <= to; p++) { | 2528 for (RawObject** p = from; p <= to; p++) { |
2538 *p = d->ReadRef(); | 2529 *p = d->ReadRef(); |
2539 } | 2530 } |
2540 error->ptr()->token_pos_ = d->ReadTokenPosition(); | 2531 error->ptr()->token_pos_ = d->ReadTokenPosition(); |
2541 error->ptr()->report_after_token_ = d->Read<bool>(); | 2532 error->ptr()->report_after_token_ = d->Read<bool>(); |
2542 error->ptr()->kind_ = d->Read<int8_t>(); | 2533 error->ptr()->kind_ = d->Read<int8_t>(); |
2543 } | 2534 } |
2544 } | 2535 } |
2545 }; | 2536 }; |
2546 | 2537 |
2547 | 2538 |
2548 #if !defined(DART_PRECOMPILED_RUNTIME) | 2539 #if !defined(DART_PRECOMPILED_RUNTIME) |
2549 class UnhandledExceptionSerializationCluster : public SerializationCluster { | 2540 class UnhandledExceptionSerializationCluster : public SerializationCluster { |
2550 public: | 2541 public: |
2551 UnhandledExceptionSerializationCluster() { } | 2542 UnhandledExceptionSerializationCluster() {} |
2552 virtual ~UnhandledExceptionSerializationCluster() { } | 2543 virtual ~UnhandledExceptionSerializationCluster() {} |
2553 | 2544 |
2554 void Trace(Serializer* s, RawObject* object) { | 2545 void Trace(Serializer* s, RawObject* object) { |
2555 RawUnhandledException* exception = UnhandledException::RawCast(object); | 2546 RawUnhandledException* exception = UnhandledException::RawCast(object); |
2556 objects_.Add(exception); | 2547 objects_.Add(exception); |
2557 | 2548 |
2558 RawObject** from = exception->from(); | 2549 RawObject** from = exception->from(); |
2559 RawObject** to = exception->to(); | 2550 RawObject** to = exception->to(); |
2560 for (RawObject** p = from; p <= to; p++) { | 2551 for (RawObject** p = from; p <= to; p++) { |
2561 s->Push(*p); | 2552 s->Push(*p); |
2562 } | 2553 } |
(...skipping 22 matching lines...) Expand all Loading... |
2585 } | 2576 } |
2586 | 2577 |
2587 private: | 2578 private: |
2588 GrowableArray<RawUnhandledException*> objects_; | 2579 GrowableArray<RawUnhandledException*> objects_; |
2589 }; | 2580 }; |
2590 #endif // !DART_PRECOMPILED_RUNTIME | 2581 #endif // !DART_PRECOMPILED_RUNTIME |
2591 | 2582 |
2592 | 2583 |
2593 class UnhandledExceptionDeserializationCluster : public DeserializationCluster { | 2584 class UnhandledExceptionDeserializationCluster : public DeserializationCluster { |
2594 public: | 2585 public: |
2595 UnhandledExceptionDeserializationCluster() { } | 2586 UnhandledExceptionDeserializationCluster() {} |
2596 virtual ~UnhandledExceptionDeserializationCluster() { } | 2587 virtual ~UnhandledExceptionDeserializationCluster() {} |
2597 | 2588 |
2598 void ReadAlloc(Deserializer* d) { | 2589 void ReadAlloc(Deserializer* d) { |
2599 start_index_ = d->next_index(); | 2590 start_index_ = d->next_index(); |
2600 PageSpace* old_space = d->heap()->old_space(); | 2591 PageSpace* old_space = d->heap()->old_space(); |
2601 intptr_t count = d->Read<int32_t>(); | 2592 intptr_t count = d->Read<int32_t>(); |
2602 for (intptr_t i = 0; i < count; i++) { | 2593 for (intptr_t i = 0; i < count; i++) { |
2603 d->AssignRef(AllocateUninitialized(old_space, | 2594 d->AssignRef( |
2604 UnhandledException::InstanceSize())); | 2595 AllocateUninitialized(old_space, UnhandledException::InstanceSize())); |
2605 } | 2596 } |
2606 stop_index_ = d->next_index(); | 2597 stop_index_ = d->next_index(); |
2607 } | 2598 } |
2608 | 2599 |
2609 void ReadFill(Deserializer* d) { | 2600 void ReadFill(Deserializer* d) { |
2610 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2601 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
2611 | 2602 |
2612 for (intptr_t id = start_index_; id < stop_index_; id++) { | 2603 for (intptr_t id = start_index_; id < stop_index_; id++) { |
2613 RawUnhandledException* exception = | 2604 RawUnhandledException* exception = |
2614 reinterpret_cast<RawUnhandledException*>(d->Ref(id)); | 2605 reinterpret_cast<RawUnhandledException*>(d->Ref(id)); |
(...skipping 13 matching lines...) Expand all Loading... |
2628 #if !defined(DART_PRECOMPILED_RUNTIME) | 2619 #if !defined(DART_PRECOMPILED_RUNTIME) |
2629 class InstanceSerializationCluster : public SerializationCluster { | 2620 class InstanceSerializationCluster : public SerializationCluster { |
2630 public: | 2621 public: |
2631 explicit InstanceSerializationCluster(intptr_t cid) : cid_(cid) { | 2622 explicit InstanceSerializationCluster(intptr_t cid) : cid_(cid) { |
2632 RawClass* cls = Isolate::Current()->class_table()->At(cid); | 2623 RawClass* cls = Isolate::Current()->class_table()->At(cid); |
2633 next_field_offset_in_words_ = cls->ptr()->next_field_offset_in_words_; | 2624 next_field_offset_in_words_ = cls->ptr()->next_field_offset_in_words_; |
2634 instance_size_in_words_ = cls->ptr()->instance_size_in_words_; | 2625 instance_size_in_words_ = cls->ptr()->instance_size_in_words_; |
2635 ASSERT(next_field_offset_in_words_ > 0); | 2626 ASSERT(next_field_offset_in_words_ > 0); |
2636 ASSERT(instance_size_in_words_ > 0); | 2627 ASSERT(instance_size_in_words_ > 0); |
2637 } | 2628 } |
2638 virtual ~InstanceSerializationCluster() { } | 2629 virtual ~InstanceSerializationCluster() {} |
2639 | 2630 |
2640 void Trace(Serializer* s, RawObject* object) { | 2631 void Trace(Serializer* s, RawObject* object) { |
2641 RawInstance* instance = Instance::RawCast(object); | 2632 RawInstance* instance = Instance::RawCast(object); |
2642 objects_.Add(instance); | 2633 objects_.Add(instance); |
2643 | 2634 |
2644 intptr_t next_field_offset = next_field_offset_in_words_ << kWordSizeLog2; | 2635 intptr_t next_field_offset = next_field_offset_in_words_ << kWordSizeLog2; |
2645 intptr_t offset = Instance::NextFieldOffset(); | 2636 intptr_t offset = Instance::NextFieldOffset(); |
2646 while (offset < next_field_offset) { | 2637 while (offset < next_field_offset) { |
2647 RawObject* raw_obj = *reinterpret_cast<RawObject**>( | 2638 RawObject* raw_obj = *reinterpret_cast<RawObject**>( |
2648 reinterpret_cast<uword>(instance->ptr()) + offset); | 2639 reinterpret_cast<uword>(instance->ptr()) + offset); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2685 const intptr_t cid_; | 2676 const intptr_t cid_; |
2686 intptr_t next_field_offset_in_words_; | 2677 intptr_t next_field_offset_in_words_; |
2687 intptr_t instance_size_in_words_; | 2678 intptr_t instance_size_in_words_; |
2688 GrowableArray<RawInstance*> objects_; | 2679 GrowableArray<RawInstance*> objects_; |
2689 }; | 2680 }; |
2690 #endif // !DART_PRECOMPILED_RUNTIME | 2681 #endif // !DART_PRECOMPILED_RUNTIME |
2691 | 2682 |
2692 | 2683 |
2693 class InstanceDeserializationCluster : public DeserializationCluster { | 2684 class InstanceDeserializationCluster : public DeserializationCluster { |
2694 public: | 2685 public: |
2695 explicit InstanceDeserializationCluster(intptr_t cid) : cid_(cid) { } | 2686 explicit InstanceDeserializationCluster(intptr_t cid) : cid_(cid) {} |
2696 virtual ~InstanceDeserializationCluster() { } | 2687 virtual ~InstanceDeserializationCluster() {} |
2697 | 2688 |
2698 void ReadAlloc(Deserializer* d) { | 2689 void ReadAlloc(Deserializer* d) { |
2699 start_index_ = d->next_index(); | 2690 start_index_ = d->next_index(); |
2700 PageSpace* old_space = d->heap()->old_space(); | 2691 PageSpace* old_space = d->heap()->old_space(); |
2701 intptr_t count = d->Read<int32_t>(); | 2692 intptr_t count = d->Read<int32_t>(); |
2702 next_field_offset_in_words_ = d->Read<int32_t>(); | 2693 next_field_offset_in_words_ = d->Read<int32_t>(); |
2703 instance_size_in_words_ = d->Read<int32_t>(); | 2694 instance_size_in_words_ = d->Read<int32_t>(); |
2704 intptr_t instance_size = | 2695 intptr_t instance_size = |
2705 Object::RoundedAllocationSize(instance_size_in_words_ * kWordSize); | 2696 Object::RoundedAllocationSize(instance_size_in_words_ * kWordSize); |
2706 for (intptr_t i = 0; i < count; i++) { | 2697 for (intptr_t i = 0; i < count; i++) { |
2707 d->AssignRef(AllocateUninitialized(old_space, instance_size)); | 2698 d->AssignRef(AllocateUninitialized(old_space, instance_size)); |
2708 } | 2699 } |
2709 stop_index_ = d->next_index(); | 2700 stop_index_ = d->next_index(); |
2710 } | 2701 } |
2711 | 2702 |
2712 void ReadFill(Deserializer* d) { | 2703 void ReadFill(Deserializer* d) { |
2713 intptr_t next_field_offset = next_field_offset_in_words_ << kWordSizeLog2; | 2704 intptr_t next_field_offset = next_field_offset_in_words_ << kWordSizeLog2; |
2714 intptr_t instance_size = | 2705 intptr_t instance_size = |
2715 Object::RoundedAllocationSize(instance_size_in_words_ * kWordSize); | 2706 Object::RoundedAllocationSize(instance_size_in_words_ * kWordSize); |
2716 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2707 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
2717 | 2708 |
2718 for (intptr_t id = start_index_; id < stop_index_; id++) { | 2709 for (intptr_t id = start_index_; id < stop_index_; id++) { |
2719 RawInstance* instance = reinterpret_cast<RawInstance*>(d->Ref(id)); | 2710 RawInstance* instance = reinterpret_cast<RawInstance*>(d->Ref(id)); |
2720 bool is_canonical = d->Read<bool>(); | 2711 bool is_canonical = d->Read<bool>(); |
2721 Deserializer::InitializeHeader(instance, cid_, | 2712 Deserializer::InitializeHeader(instance, cid_, instance_size, |
2722 instance_size, | |
2723 is_vm_object, is_canonical); | 2713 is_vm_object, is_canonical); |
2724 intptr_t offset = Instance::NextFieldOffset(); | 2714 intptr_t offset = Instance::NextFieldOffset(); |
2725 while (offset < next_field_offset) { | 2715 while (offset < next_field_offset) { |
2726 RawObject** p = reinterpret_cast<RawObject**>( | 2716 RawObject** p = reinterpret_cast<RawObject**>( |
2727 reinterpret_cast<uword>(instance->ptr()) + offset); | 2717 reinterpret_cast<uword>(instance->ptr()) + offset); |
2728 *p = d->ReadRef(); | 2718 *p = d->ReadRef(); |
2729 offset += kWordSize; | 2719 offset += kWordSize; |
2730 } | 2720 } |
2731 if (offset < instance_size) { | 2721 if (offset < instance_size) { |
2732 RawObject** p = reinterpret_cast<RawObject**>( | 2722 RawObject** p = reinterpret_cast<RawObject**>( |
2733 reinterpret_cast<uword>(instance->ptr()) + offset); | 2723 reinterpret_cast<uword>(instance->ptr()) + offset); |
2734 *p = Object::null(); | 2724 *p = Object::null(); |
2735 offset += kWordSize; | 2725 offset += kWordSize; |
2736 } | 2726 } |
2737 ASSERT(offset == instance_size); | 2727 ASSERT(offset == instance_size); |
2738 } | 2728 } |
2739 } | 2729 } |
2740 | 2730 |
2741 private: | 2731 private: |
2742 const intptr_t cid_; | 2732 const intptr_t cid_; |
2743 intptr_t next_field_offset_in_words_; | 2733 intptr_t next_field_offset_in_words_; |
2744 intptr_t instance_size_in_words_; | 2734 intptr_t instance_size_in_words_; |
2745 }; | 2735 }; |
2746 | 2736 |
2747 | 2737 |
2748 #if !defined(DART_PRECOMPILED_RUNTIME) | 2738 #if !defined(DART_PRECOMPILED_RUNTIME) |
2749 class LibraryPrefixSerializationCluster : public SerializationCluster { | 2739 class LibraryPrefixSerializationCluster : public SerializationCluster { |
2750 public: | 2740 public: |
2751 LibraryPrefixSerializationCluster() { } | 2741 LibraryPrefixSerializationCluster() {} |
2752 virtual ~LibraryPrefixSerializationCluster() { } | 2742 virtual ~LibraryPrefixSerializationCluster() {} |
2753 | 2743 |
2754 void Trace(Serializer* s, RawObject* object) { | 2744 void Trace(Serializer* s, RawObject* object) { |
2755 RawLibraryPrefix* prefix = LibraryPrefix::RawCast(object); | 2745 RawLibraryPrefix* prefix = LibraryPrefix::RawCast(object); |
2756 objects_.Add(prefix); | 2746 objects_.Add(prefix); |
2757 | 2747 |
2758 RawObject** from = prefix->from(); | 2748 RawObject** from = prefix->from(); |
2759 RawObject** to = prefix->to(); | 2749 RawObject** to = prefix->to(); |
2760 for (RawObject** p = from; p <= to; p++) { | 2750 for (RawObject** p = from; p <= to; p++) { |
2761 s->Push(*p); | 2751 s->Push(*p); |
2762 } | 2752 } |
(...skipping 24 matching lines...) Expand all Loading... |
2787 } | 2777 } |
2788 | 2778 |
2789 private: | 2779 private: |
2790 GrowableArray<RawLibraryPrefix*> objects_; | 2780 GrowableArray<RawLibraryPrefix*> objects_; |
2791 }; | 2781 }; |
2792 #endif // !DART_PRECOMPILED_RUNTIME | 2782 #endif // !DART_PRECOMPILED_RUNTIME |
2793 | 2783 |
2794 | 2784 |
2795 class LibraryPrefixDeserializationCluster : public DeserializationCluster { | 2785 class LibraryPrefixDeserializationCluster : public DeserializationCluster { |
2796 public: | 2786 public: |
2797 LibraryPrefixDeserializationCluster() { } | 2787 LibraryPrefixDeserializationCluster() {} |
2798 virtual ~LibraryPrefixDeserializationCluster() { } | 2788 virtual ~LibraryPrefixDeserializationCluster() {} |
2799 | 2789 |
2800 void ReadAlloc(Deserializer* d) { | 2790 void ReadAlloc(Deserializer* d) { |
2801 start_index_ = d->next_index(); | 2791 start_index_ = d->next_index(); |
2802 PageSpace* old_space = d->heap()->old_space(); | 2792 PageSpace* old_space = d->heap()->old_space(); |
2803 intptr_t count = d->Read<int32_t>(); | 2793 intptr_t count = d->Read<int32_t>(); |
2804 for (intptr_t i = 0; i < count; i++) { | 2794 for (intptr_t i = 0; i < count; i++) { |
2805 d->AssignRef(AllocateUninitialized(old_space, | 2795 d->AssignRef( |
2806 LibraryPrefix::InstanceSize())); | 2796 AllocateUninitialized(old_space, LibraryPrefix::InstanceSize())); |
2807 } | 2797 } |
2808 stop_index_ = d->next_index(); | 2798 stop_index_ = d->next_index(); |
2809 } | 2799 } |
2810 | 2800 |
2811 void ReadFill(Deserializer* d) { | 2801 void ReadFill(Deserializer* d) { |
2812 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2802 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
2813 | 2803 |
2814 for (intptr_t id = start_index_; id < stop_index_; id++) { | 2804 for (intptr_t id = start_index_; id < stop_index_; id++) { |
2815 RawLibraryPrefix* prefix = | 2805 RawLibraryPrefix* prefix = |
2816 reinterpret_cast<RawLibraryPrefix*>(d->Ref(id)); | 2806 reinterpret_cast<RawLibraryPrefix*>(d->Ref(id)); |
2817 Deserializer::InitializeHeader(prefix, kLibraryPrefixCid, | 2807 Deserializer::InitializeHeader(prefix, kLibraryPrefixCid, |
2818 LibraryPrefix::InstanceSize(), | 2808 LibraryPrefix::InstanceSize(), |
2819 is_vm_object); | 2809 is_vm_object); |
2820 RawObject** from = prefix->from(); | 2810 RawObject** from = prefix->from(); |
2821 RawObject** to = prefix->to(); | 2811 RawObject** to = prefix->to(); |
2822 for (RawObject** p = from; p <= to; p++) { | 2812 for (RawObject** p = from; p <= to; p++) { |
2823 *p = d->ReadRef(); | 2813 *p = d->ReadRef(); |
2824 } | 2814 } |
2825 prefix->ptr()->num_imports_ = d->Read<uint16_t>(); | 2815 prefix->ptr()->num_imports_ = d->Read<uint16_t>(); |
2826 prefix->ptr()->is_deferred_load_ = d->Read<bool>(); | 2816 prefix->ptr()->is_deferred_load_ = d->Read<bool>(); |
2827 prefix->ptr()->is_loaded_ = !prefix->ptr()->is_deferred_load_; | 2817 prefix->ptr()->is_loaded_ = !prefix->ptr()->is_deferred_load_; |
2828 } | 2818 } |
2829 } | 2819 } |
2830 }; | 2820 }; |
2831 | 2821 |
2832 | 2822 |
2833 #if !defined(DART_PRECOMPILED_RUNTIME) | 2823 #if !defined(DART_PRECOMPILED_RUNTIME) |
2834 class TypeSerializationCluster : public SerializationCluster { | 2824 class TypeSerializationCluster : public SerializationCluster { |
2835 public: | 2825 public: |
2836 TypeSerializationCluster() { } | 2826 TypeSerializationCluster() {} |
2837 virtual ~TypeSerializationCluster() { } | 2827 virtual ~TypeSerializationCluster() {} |
2838 | 2828 |
2839 void Trace(Serializer* s, RawObject* object) { | 2829 void Trace(Serializer* s, RawObject* object) { |
2840 RawType* type = Type::RawCast(object); | 2830 RawType* type = Type::RawCast(object); |
2841 if (type->IsCanonical()) { | 2831 if (type->IsCanonical()) { |
2842 canonical_objects_.Add(type); | 2832 canonical_objects_.Add(type); |
2843 } else { | 2833 } else { |
2844 objects_.Add(type); | 2834 objects_.Add(type); |
2845 } | 2835 } |
2846 | 2836 |
2847 RawObject** from = type->from(); | 2837 RawObject** from = type->from(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2904 | 2894 |
2905 private: | 2895 private: |
2906 GrowableArray<RawType*> canonical_objects_; | 2896 GrowableArray<RawType*> canonical_objects_; |
2907 GrowableArray<RawType*> objects_; | 2897 GrowableArray<RawType*> objects_; |
2908 }; | 2898 }; |
2909 #endif // !DART_PRECOMPILED_RUNTIME | 2899 #endif // !DART_PRECOMPILED_RUNTIME |
2910 | 2900 |
2911 | 2901 |
2912 class TypeDeserializationCluster : public DeserializationCluster { | 2902 class TypeDeserializationCluster : public DeserializationCluster { |
2913 public: | 2903 public: |
2914 TypeDeserializationCluster() { } | 2904 TypeDeserializationCluster() {} |
2915 virtual ~TypeDeserializationCluster() { } | 2905 virtual ~TypeDeserializationCluster() {} |
2916 | 2906 |
2917 void ReadAlloc(Deserializer* d) { | 2907 void ReadAlloc(Deserializer* d) { |
2918 canonical_start_index_ = d->next_index(); | 2908 canonical_start_index_ = d->next_index(); |
2919 PageSpace* old_space = d->heap()->old_space(); | 2909 PageSpace* old_space = d->heap()->old_space(); |
2920 intptr_t count = d->Read<int32_t>(); | 2910 intptr_t count = d->Read<int32_t>(); |
2921 for (intptr_t i = 0; i < count; i++) { | 2911 for (intptr_t i = 0; i < count; i++) { |
2922 d->AssignRef(AllocateUninitialized(old_space, Type::InstanceSize())); | 2912 d->AssignRef(AllocateUninitialized(old_space, Type::InstanceSize())); |
2923 } | 2913 } |
2924 canonical_stop_index_ = d->next_index(); | 2914 canonical_stop_index_ = d->next_index(); |
2925 | 2915 |
2926 start_index_ = d->next_index(); | 2916 start_index_ = d->next_index(); |
2927 count = d->Read<int32_t>(); | 2917 count = d->Read<int32_t>(); |
2928 for (intptr_t i = 0; i < count; i++) { | 2918 for (intptr_t i = 0; i < count; i++) { |
2929 d->AssignRef(AllocateUninitialized(old_space, Type::InstanceSize())); | 2919 d->AssignRef(AllocateUninitialized(old_space, Type::InstanceSize())); |
2930 } | 2920 } |
2931 stop_index_ = d->next_index(); | 2921 stop_index_ = d->next_index(); |
2932 } | 2922 } |
2933 | 2923 |
2934 void ReadFill(Deserializer* d) { | 2924 void ReadFill(Deserializer* d) { |
2935 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2925 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
2936 | 2926 |
2937 for (intptr_t id = canonical_start_index_; | 2927 for (intptr_t id = canonical_start_index_; id < canonical_stop_index_; |
2938 id < canonical_stop_index_; | |
2939 id++) { | 2928 id++) { |
2940 RawType* type = reinterpret_cast<RawType*>(d->Ref(id)); | 2929 RawType* type = reinterpret_cast<RawType*>(d->Ref(id)); |
2941 Deserializer::InitializeHeader(type, kTypeCid, | 2930 Deserializer::InitializeHeader(type, kTypeCid, Type::InstanceSize(), |
2942 Type::InstanceSize(), is_vm_object, true); | 2931 is_vm_object, true); |
2943 RawObject** from = type->from(); | 2932 RawObject** from = type->from(); |
2944 RawObject** to = type->to(); | 2933 RawObject** to = type->to(); |
2945 for (RawObject** p = from; p <= to; p++) { | 2934 for (RawObject** p = from; p <= to; p++) { |
2946 *p = d->ReadRef(); | 2935 *p = d->ReadRef(); |
2947 } | 2936 } |
2948 type->ptr()->token_pos_ = d->ReadTokenPosition(); | 2937 type->ptr()->token_pos_ = d->ReadTokenPosition(); |
2949 type->ptr()->type_state_ = d->Read<int8_t>(); | 2938 type->ptr()->type_state_ = d->Read<int8_t>(); |
2950 } | 2939 } |
2951 | 2940 |
2952 for (intptr_t id = start_index_; id < stop_index_; id++) { | 2941 for (intptr_t id = start_index_; id < stop_index_; id++) { |
2953 RawType* type = reinterpret_cast<RawType*>(d->Ref(id)); | 2942 RawType* type = reinterpret_cast<RawType*>(d->Ref(id)); |
2954 Deserializer::InitializeHeader(type, kTypeCid, | 2943 Deserializer::InitializeHeader(type, kTypeCid, Type::InstanceSize(), |
2955 Type::InstanceSize(), is_vm_object); | 2944 is_vm_object); |
2956 RawObject** from = type->from(); | 2945 RawObject** from = type->from(); |
2957 RawObject** to = type->to(); | 2946 RawObject** to = type->to(); |
2958 for (RawObject** p = from; p <= to; p++) { | 2947 for (RawObject** p = from; p <= to; p++) { |
2959 *p = d->ReadRef(); | 2948 *p = d->ReadRef(); |
2960 } | 2949 } |
2961 type->ptr()->token_pos_ = d->ReadTokenPosition(); | 2950 type->ptr()->token_pos_ = d->ReadTokenPosition(); |
2962 type->ptr()->type_state_ = d->Read<int8_t>(); | 2951 type->ptr()->type_state_ = d->Read<int8_t>(); |
2963 } | 2952 } |
2964 } | 2953 } |
2965 | 2954 |
2966 private: | 2955 private: |
2967 intptr_t canonical_start_index_; | 2956 intptr_t canonical_start_index_; |
2968 intptr_t canonical_stop_index_; | 2957 intptr_t canonical_stop_index_; |
2969 }; | 2958 }; |
2970 | 2959 |
2971 | 2960 |
2972 #if !defined(DART_PRECOMPILED_RUNTIME) | 2961 #if !defined(DART_PRECOMPILED_RUNTIME) |
2973 class TypeRefSerializationCluster : public SerializationCluster { | 2962 class TypeRefSerializationCluster : public SerializationCluster { |
2974 public: | 2963 public: |
2975 TypeRefSerializationCluster() { } | 2964 TypeRefSerializationCluster() {} |
2976 virtual ~TypeRefSerializationCluster() { } | 2965 virtual ~TypeRefSerializationCluster() {} |
2977 | 2966 |
2978 void Trace(Serializer* s, RawObject* object) { | 2967 void Trace(Serializer* s, RawObject* object) { |
2979 RawTypeRef* type = TypeRef::RawCast(object); | 2968 RawTypeRef* type = TypeRef::RawCast(object); |
2980 objects_.Add(type); | 2969 objects_.Add(type); |
2981 | 2970 |
2982 RawObject** from = type->from(); | 2971 RawObject** from = type->from(); |
2983 RawObject** to = type->to(); | 2972 RawObject** to = type->to(); |
2984 for (RawObject** p = from; p <= to; p++) { | 2973 for (RawObject** p = from; p <= to; p++) { |
2985 s->Push(*p); | 2974 s->Push(*p); |
2986 } | 2975 } |
(...skipping 22 matching lines...) Expand all Loading... |
3009 } | 2998 } |
3010 | 2999 |
3011 private: | 3000 private: |
3012 GrowableArray<RawTypeRef*> objects_; | 3001 GrowableArray<RawTypeRef*> objects_; |
3013 }; | 3002 }; |
3014 #endif // !DART_PRECOMPILED_RUNTIME | 3003 #endif // !DART_PRECOMPILED_RUNTIME |
3015 | 3004 |
3016 | 3005 |
3017 class TypeRefDeserializationCluster : public DeserializationCluster { | 3006 class TypeRefDeserializationCluster : public DeserializationCluster { |
3018 public: | 3007 public: |
3019 TypeRefDeserializationCluster() { } | 3008 TypeRefDeserializationCluster() {} |
3020 virtual ~TypeRefDeserializationCluster() { } | 3009 virtual ~TypeRefDeserializationCluster() {} |
3021 | 3010 |
3022 void ReadAlloc(Deserializer* d) { | 3011 void ReadAlloc(Deserializer* d) { |
3023 start_index_ = d->next_index(); | 3012 start_index_ = d->next_index(); |
3024 PageSpace* old_space = d->heap()->old_space(); | 3013 PageSpace* old_space = d->heap()->old_space(); |
3025 intptr_t count = d->Read<int32_t>(); | 3014 intptr_t count = d->Read<int32_t>(); |
3026 for (intptr_t i = 0; i < count; i++) { | 3015 for (intptr_t i = 0; i < count; i++) { |
3027 d->AssignRef(AllocateUninitialized(old_space, TypeRef::InstanceSize())); | 3016 d->AssignRef(AllocateUninitialized(old_space, TypeRef::InstanceSize())); |
3028 } | 3017 } |
3029 stop_index_ = d->next_index(); | 3018 stop_index_ = d->next_index(); |
3030 } | 3019 } |
3031 | 3020 |
3032 void ReadFill(Deserializer* d) { | 3021 void ReadFill(Deserializer* d) { |
3033 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3022 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
3034 | 3023 |
3035 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3024 for (intptr_t id = start_index_; id < stop_index_; id++) { |
3036 RawTypeRef* type = reinterpret_cast<RawTypeRef*>(d->Ref(id)); | 3025 RawTypeRef* type = reinterpret_cast<RawTypeRef*>(d->Ref(id)); |
3037 Deserializer::InitializeHeader(type, kTypeRefCid, | 3026 Deserializer::InitializeHeader(type, kTypeRefCid, TypeRef::InstanceSize(), |
3038 TypeRef::InstanceSize(), is_vm_object); | 3027 is_vm_object); |
3039 RawObject** from = type->from(); | 3028 RawObject** from = type->from(); |
3040 RawObject** to = type->to(); | 3029 RawObject** to = type->to(); |
3041 for (RawObject** p = from; p <= to; p++) { | 3030 for (RawObject** p = from; p <= to; p++) { |
3042 *p = d->ReadRef(); | 3031 *p = d->ReadRef(); |
3043 } | 3032 } |
3044 } | 3033 } |
3045 } | 3034 } |
3046 }; | 3035 }; |
3047 | 3036 |
3048 | 3037 |
3049 #if !defined(DART_PRECOMPILED_RUNTIME) | 3038 #if !defined(DART_PRECOMPILED_RUNTIME) |
3050 class TypeParameterSerializationCluster : public SerializationCluster { | 3039 class TypeParameterSerializationCluster : public SerializationCluster { |
3051 public: | 3040 public: |
3052 TypeParameterSerializationCluster() { } | 3041 TypeParameterSerializationCluster() {} |
3053 virtual ~TypeParameterSerializationCluster() { } | 3042 virtual ~TypeParameterSerializationCluster() {} |
3054 | 3043 |
3055 void Trace(Serializer* s, RawObject* object) { | 3044 void Trace(Serializer* s, RawObject* object) { |
3056 RawTypeParameter* type = TypeParameter::RawCast(object); | 3045 RawTypeParameter* type = TypeParameter::RawCast(object); |
3057 objects_.Add(type); | 3046 objects_.Add(type); |
3058 ASSERT(!type->IsCanonical()); | 3047 ASSERT(!type->IsCanonical()); |
3059 | 3048 |
3060 RawObject** from = type->from(); | 3049 RawObject** from = type->from(); |
3061 RawObject** to = type->to(); | 3050 RawObject** to = type->to(); |
3062 for (RawObject** p = from; p <= to; p++) { | 3051 for (RawObject** p = from; p <= to; p++) { |
3063 s->Push(*p); | 3052 s->Push(*p); |
(...skipping 28 matching lines...) Expand all Loading... |
3092 } | 3081 } |
3093 | 3082 |
3094 private: | 3083 private: |
3095 GrowableArray<RawTypeParameter*> objects_; | 3084 GrowableArray<RawTypeParameter*> objects_; |
3096 }; | 3085 }; |
3097 #endif // !DART_PRECOMPILED_RUNTIME | 3086 #endif // !DART_PRECOMPILED_RUNTIME |
3098 | 3087 |
3099 | 3088 |
3100 class TypeParameterDeserializationCluster : public DeserializationCluster { | 3089 class TypeParameterDeserializationCluster : public DeserializationCluster { |
3101 public: | 3090 public: |
3102 TypeParameterDeserializationCluster() { } | 3091 TypeParameterDeserializationCluster() {} |
3103 virtual ~TypeParameterDeserializationCluster() { } | 3092 virtual ~TypeParameterDeserializationCluster() {} |
3104 | 3093 |
3105 void ReadAlloc(Deserializer* d) { | 3094 void ReadAlloc(Deserializer* d) { |
3106 start_index_ = d->next_index(); | 3095 start_index_ = d->next_index(); |
3107 PageSpace* old_space = d->heap()->old_space(); | 3096 PageSpace* old_space = d->heap()->old_space(); |
3108 intptr_t count = d->Read<int32_t>(); | 3097 intptr_t count = d->Read<int32_t>(); |
3109 for (intptr_t i = 0; i < count; i++) { | 3098 for (intptr_t i = 0; i < count; i++) { |
3110 d->AssignRef(AllocateUninitialized(old_space, | 3099 d->AssignRef( |
3111 TypeParameter::InstanceSize())); | 3100 AllocateUninitialized(old_space, TypeParameter::InstanceSize())); |
3112 } | 3101 } |
3113 stop_index_ = d->next_index(); | 3102 stop_index_ = d->next_index(); |
3114 } | 3103 } |
3115 | 3104 |
3116 void ReadFill(Deserializer* d) { | 3105 void ReadFill(Deserializer* d) { |
3117 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3106 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
3118 | 3107 |
3119 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3108 for (intptr_t id = start_index_; id < stop_index_; id++) { |
3120 RawTypeParameter* type = reinterpret_cast<RawTypeParameter*>(d->Ref(id)); | 3109 RawTypeParameter* type = reinterpret_cast<RawTypeParameter*>(d->Ref(id)); |
3121 Deserializer::InitializeHeader(type, kTypeParameterCid, | 3110 Deserializer::InitializeHeader( |
3122 TypeParameter::InstanceSize(), | 3111 type, kTypeParameterCid, TypeParameter::InstanceSize(), is_vm_object); |
3123 is_vm_object); | |
3124 RawObject** from = type->from(); | 3112 RawObject** from = type->from(); |
3125 RawObject** to = type->to(); | 3113 RawObject** to = type->to(); |
3126 for (RawObject** p = from; p <= to; p++) { | 3114 for (RawObject** p = from; p <= to; p++) { |
3127 *p = d->ReadRef(); | 3115 *p = d->ReadRef(); |
3128 } | 3116 } |
3129 type->ptr()->parameterized_class_id_ = d->Read<int32_t>(); | 3117 type->ptr()->parameterized_class_id_ = d->Read<int32_t>(); |
3130 type->ptr()->token_pos_ = d->ReadTokenPosition(); | 3118 type->ptr()->token_pos_ = d->ReadTokenPosition(); |
3131 type->ptr()->index_ = d->Read<int16_t>(); | 3119 type->ptr()->index_ = d->Read<int16_t>(); |
3132 type->ptr()->parent_level_ = d->Read<uint8_t>(); | 3120 type->ptr()->parent_level_ = d->Read<uint8_t>(); |
3133 type->ptr()->type_state_ = d->Read<int8_t>(); | 3121 type->ptr()->type_state_ = d->Read<int8_t>(); |
3134 } | 3122 } |
3135 } | 3123 } |
3136 }; | 3124 }; |
3137 | 3125 |
3138 | 3126 |
3139 #if !defined(DART_PRECOMPILED_RUNTIME) | 3127 #if !defined(DART_PRECOMPILED_RUNTIME) |
3140 class BoundedTypeSerializationCluster : public SerializationCluster { | 3128 class BoundedTypeSerializationCluster : public SerializationCluster { |
3141 public: | 3129 public: |
3142 BoundedTypeSerializationCluster() { } | 3130 BoundedTypeSerializationCluster() {} |
3143 virtual ~BoundedTypeSerializationCluster() { } | 3131 virtual ~BoundedTypeSerializationCluster() {} |
3144 | 3132 |
3145 void Trace(Serializer* s, RawObject* object) { | 3133 void Trace(Serializer* s, RawObject* object) { |
3146 RawBoundedType* type = BoundedType::RawCast(object); | 3134 RawBoundedType* type = BoundedType::RawCast(object); |
3147 objects_.Add(type); | 3135 objects_.Add(type); |
3148 | 3136 |
3149 RawObject** from = type->from(); | 3137 RawObject** from = type->from(); |
3150 RawObject** to = type->to(); | 3138 RawObject** to = type->to(); |
3151 for (RawObject** p = from; p <= to; p++) { | 3139 for (RawObject** p = from; p <= to; p++) { |
3152 s->Push(*p); | 3140 s->Push(*p); |
3153 } | 3141 } |
(...skipping 22 matching lines...) Expand all Loading... |
3176 } | 3164 } |
3177 | 3165 |
3178 private: | 3166 private: |
3179 GrowableArray<RawBoundedType*> objects_; | 3167 GrowableArray<RawBoundedType*> objects_; |
3180 }; | 3168 }; |
3181 #endif // !DART_PRECOMPILED_RUNTIME | 3169 #endif // !DART_PRECOMPILED_RUNTIME |
3182 | 3170 |
3183 | 3171 |
3184 class BoundedTypeDeserializationCluster : public DeserializationCluster { | 3172 class BoundedTypeDeserializationCluster : public DeserializationCluster { |
3185 public: | 3173 public: |
3186 BoundedTypeDeserializationCluster() { } | 3174 BoundedTypeDeserializationCluster() {} |
3187 virtual ~BoundedTypeDeserializationCluster() { } | 3175 virtual ~BoundedTypeDeserializationCluster() {} |
3188 | 3176 |
3189 void ReadAlloc(Deserializer* d) { | 3177 void ReadAlloc(Deserializer* d) { |
3190 start_index_ = d->next_index(); | 3178 start_index_ = d->next_index(); |
3191 PageSpace* old_space = d->heap()->old_space(); | 3179 PageSpace* old_space = d->heap()->old_space(); |
3192 intptr_t count = d->Read<int32_t>(); | 3180 intptr_t count = d->Read<int32_t>(); |
3193 for (intptr_t i = 0; i < count; i++) { | 3181 for (intptr_t i = 0; i < count; i++) { |
3194 d->AssignRef(AllocateUninitialized(old_space, | 3182 d->AssignRef( |
3195 BoundedType::InstanceSize())); | 3183 AllocateUninitialized(old_space, BoundedType::InstanceSize())); |
3196 } | 3184 } |
3197 stop_index_ = d->next_index(); | 3185 stop_index_ = d->next_index(); |
3198 } | 3186 } |
3199 | 3187 |
3200 void ReadFill(Deserializer* d) { | 3188 void ReadFill(Deserializer* d) { |
3201 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3189 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
3202 | 3190 |
3203 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3191 for (intptr_t id = start_index_; id < stop_index_; id++) { |
3204 RawBoundedType* type = reinterpret_cast<RawBoundedType*>(d->Ref(id)); | 3192 RawBoundedType* type = reinterpret_cast<RawBoundedType*>(d->Ref(id)); |
3205 Deserializer::InitializeHeader(type, kBoundedTypeCid, | 3193 Deserializer::InitializeHeader(type, kBoundedTypeCid, |
3206 BoundedType::InstanceSize(), is_vm_object); | 3194 BoundedType::InstanceSize(), is_vm_object); |
3207 RawObject** from = type->from(); | 3195 RawObject** from = type->from(); |
3208 RawObject** to = type->to(); | 3196 RawObject** to = type->to(); |
3209 for (RawObject** p = from; p <= to; p++) { | 3197 for (RawObject** p = from; p <= to; p++) { |
3210 *p = d->ReadRef(); | 3198 *p = d->ReadRef(); |
3211 } | 3199 } |
3212 } | 3200 } |
3213 } | 3201 } |
3214 }; | 3202 }; |
3215 | 3203 |
3216 | 3204 |
3217 #if !defined(DART_PRECOMPILED_RUNTIME) | 3205 #if !defined(DART_PRECOMPILED_RUNTIME) |
3218 class ClosureSerializationCluster : public SerializationCluster { | 3206 class ClosureSerializationCluster : public SerializationCluster { |
3219 public: | 3207 public: |
3220 ClosureSerializationCluster() { } | 3208 ClosureSerializationCluster() {} |
3221 virtual ~ClosureSerializationCluster() { } | 3209 virtual ~ClosureSerializationCluster() {} |
3222 | 3210 |
3223 void Trace(Serializer* s, RawObject* object) { | 3211 void Trace(Serializer* s, RawObject* object) { |
3224 RawClosure* closure = Closure::RawCast(object); | 3212 RawClosure* closure = Closure::RawCast(object); |
3225 objects_.Add(closure); | 3213 objects_.Add(closure); |
3226 | 3214 |
3227 RawObject** from = closure->from(); | 3215 RawObject** from = closure->from(); |
3228 RawObject** to = closure->to(); | 3216 RawObject** to = closure->to(); |
3229 for (RawObject** p = from; p <= to; p++) { | 3217 for (RawObject** p = from; p <= to; p++) { |
3230 s->Push(*p); | 3218 s->Push(*p); |
3231 } | 3219 } |
(...skipping 23 matching lines...) Expand all Loading... |
3255 } | 3243 } |
3256 | 3244 |
3257 private: | 3245 private: |
3258 GrowableArray<RawClosure*> objects_; | 3246 GrowableArray<RawClosure*> objects_; |
3259 }; | 3247 }; |
3260 #endif // !DART_PRECOMPILED_RUNTIME | 3248 #endif // !DART_PRECOMPILED_RUNTIME |
3261 | 3249 |
3262 | 3250 |
3263 class ClosureDeserializationCluster : public DeserializationCluster { | 3251 class ClosureDeserializationCluster : public DeserializationCluster { |
3264 public: | 3252 public: |
3265 ClosureDeserializationCluster() { } | 3253 ClosureDeserializationCluster() {} |
3266 virtual ~ClosureDeserializationCluster() { } | 3254 virtual ~ClosureDeserializationCluster() {} |
3267 | 3255 |
3268 void ReadAlloc(Deserializer* d) { | 3256 void ReadAlloc(Deserializer* d) { |
3269 start_index_ = d->next_index(); | 3257 start_index_ = d->next_index(); |
3270 PageSpace* old_space = d->heap()->old_space(); | 3258 PageSpace* old_space = d->heap()->old_space(); |
3271 intptr_t count = d->Read<int32_t>(); | 3259 intptr_t count = d->Read<int32_t>(); |
3272 for (intptr_t i = 0; i < count; i++) { | 3260 for (intptr_t i = 0; i < count; i++) { |
3273 d->AssignRef(AllocateUninitialized(old_space, Closure::InstanceSize())); | 3261 d->AssignRef(AllocateUninitialized(old_space, Closure::InstanceSize())); |
3274 } | 3262 } |
3275 stop_index_ = d->next_index(); | 3263 stop_index_ = d->next_index(); |
3276 } | 3264 } |
3277 | 3265 |
3278 void ReadFill(Deserializer* d) { | 3266 void ReadFill(Deserializer* d) { |
3279 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3267 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
3280 | 3268 |
3281 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3269 for (intptr_t id = start_index_; id < stop_index_; id++) { |
3282 RawClosure* closure = reinterpret_cast<RawClosure*>(d->Ref(id)); | 3270 RawClosure* closure = reinterpret_cast<RawClosure*>(d->Ref(id)); |
3283 bool is_canonical = d->Read<bool>(); | 3271 bool is_canonical = d->Read<bool>(); |
3284 Deserializer::InitializeHeader(closure, kClosureCid, | 3272 Deserializer::InitializeHeader(closure, kClosureCid, |
3285 Closure::InstanceSize(), | 3273 Closure::InstanceSize(), is_vm_object, |
3286 is_vm_object, is_canonical); | 3274 is_canonical); |
3287 RawObject** from = closure->from(); | 3275 RawObject** from = closure->from(); |
3288 RawObject** to = closure->to(); | 3276 RawObject** to = closure->to(); |
3289 for (RawObject** p = from; p <= to; p++) { | 3277 for (RawObject** p = from; p <= to; p++) { |
3290 *p = d->ReadRef(); | 3278 *p = d->ReadRef(); |
3291 } | 3279 } |
3292 } | 3280 } |
3293 } | 3281 } |
3294 }; | 3282 }; |
3295 | 3283 |
3296 | 3284 |
3297 #if !defined(DART_PRECOMPILED_RUNTIME) | 3285 #if !defined(DART_PRECOMPILED_RUNTIME) |
3298 class MintSerializationCluster : public SerializationCluster { | 3286 class MintSerializationCluster : public SerializationCluster { |
3299 public: | 3287 public: |
3300 MintSerializationCluster() { } | 3288 MintSerializationCluster() {} |
3301 virtual ~MintSerializationCluster() { } | 3289 virtual ~MintSerializationCluster() {} |
3302 | 3290 |
3303 void Trace(Serializer* s, RawObject* object) { | 3291 void Trace(Serializer* s, RawObject* object) { |
3304 if (!object->IsHeapObject()) { | 3292 if (!object->IsHeapObject()) { |
3305 RawSmi* smi = Smi::RawCast(object); | 3293 RawSmi* smi = Smi::RawCast(object); |
3306 smis_.Add(smi); | 3294 smis_.Add(smi); |
3307 } else { | 3295 } else { |
3308 RawMint* mint = Mint::RawCast(object); | 3296 RawMint* mint = Mint::RawCast(object); |
3309 mints_.Add(mint); | 3297 mints_.Add(mint); |
3310 } | 3298 } |
3311 } | 3299 } |
3312 | 3300 |
3313 void WriteAlloc(Serializer* s) { | 3301 void WriteAlloc(Serializer* s) { |
3314 s->WriteCid(kMintCid); | 3302 s->WriteCid(kMintCid); |
3315 | 3303 |
3316 s->Write<int32_t>(smis_.length() + mints_.length()); | 3304 s->Write<int32_t>(smis_.length() + mints_.length()); |
3317 for (intptr_t i = 0; i < smis_.length(); i++) { | 3305 for (intptr_t i = 0; i < smis_.length(); i++) { |
3318 RawSmi* smi = smis_[i]; | 3306 RawSmi* smi = smis_[i]; |
3319 s->Write<bool>(true); | 3307 s->Write<bool>(true); |
3320 s->Write<int64_t>(Smi::Value(smi)); | 3308 s->Write<int64_t>(Smi::Value(smi)); |
3321 s->AssignRef(smi); | 3309 s->AssignRef(smi); |
3322 } | 3310 } |
3323 for (intptr_t i = 0; i < mints_.length(); i++) { | 3311 for (intptr_t i = 0; i < mints_.length(); i++) { |
3324 RawMint* mint = mints_[i]; | 3312 RawMint* mint = mints_[i]; |
3325 s->Write<bool>(mint->IsCanonical()); | 3313 s->Write<bool>(mint->IsCanonical()); |
3326 s->Write<int64_t>(mint->ptr()->value_); | 3314 s->Write<int64_t>(mint->ptr()->value_); |
3327 s->AssignRef(mint); | 3315 s->AssignRef(mint); |
3328 } | 3316 } |
3329 } | 3317 } |
3330 | 3318 |
3331 void WriteFill(Serializer* s) { } | 3319 void WriteFill(Serializer* s) {} |
3332 | 3320 |
3333 private: | 3321 private: |
3334 GrowableArray<RawSmi*> smis_; | 3322 GrowableArray<RawSmi*> smis_; |
3335 GrowableArray<RawMint*> mints_; | 3323 GrowableArray<RawMint*> mints_; |
3336 }; | 3324 }; |
3337 #endif // !DART_PRECOMPILED_RUNTIME | 3325 #endif // !DART_PRECOMPILED_RUNTIME |
3338 | 3326 |
3339 | 3327 |
3340 class MintDeserializationCluster : public DeserializationCluster { | 3328 class MintDeserializationCluster : public DeserializationCluster { |
3341 public: | 3329 public: |
3342 MintDeserializationCluster() { } | 3330 MintDeserializationCluster() {} |
3343 virtual ~MintDeserializationCluster() { } | 3331 virtual ~MintDeserializationCluster() {} |
3344 | 3332 |
3345 void ReadAlloc(Deserializer* d) { | 3333 void ReadAlloc(Deserializer* d) { |
3346 PageSpace* old_space = d->heap()->old_space(); | 3334 PageSpace* old_space = d->heap()->old_space(); |
3347 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3335 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
3348 | 3336 |
3349 start_index_ = d->next_index(); | 3337 start_index_ = d->next_index(); |
3350 intptr_t count = d->Read<int32_t>(); | 3338 intptr_t count = d->Read<int32_t>(); |
3351 for (intptr_t i = 0; i < count; i++) { | 3339 for (intptr_t i = 0; i < count; i++) { |
3352 bool is_canonical = d->Read<bool>(); | 3340 bool is_canonical = d->Read<bool>(); |
3353 int64_t value = d->Read<int64_t>(); | 3341 int64_t value = d->Read<int64_t>(); |
3354 if (Smi::IsValid(value)) { | 3342 if (Smi::IsValid(value)) { |
3355 d->AssignRef(Smi::New(value)); | 3343 d->AssignRef(Smi::New(value)); |
3356 } else { | 3344 } else { |
3357 RawMint* mint = static_cast<RawMint*>( | 3345 RawMint* mint = static_cast<RawMint*>( |
3358 AllocateUninitialized(old_space, Mint::InstanceSize())); | 3346 AllocateUninitialized(old_space, Mint::InstanceSize())); |
3359 Deserializer::InitializeHeader(mint, kMintCid, | 3347 Deserializer::InitializeHeader(mint, kMintCid, Mint::InstanceSize(), |
3360 Mint::InstanceSize(), | |
3361 is_vm_object, is_canonical); | 3348 is_vm_object, is_canonical); |
3362 mint->ptr()->value_ = value; | 3349 mint->ptr()->value_ = value; |
3363 d->AssignRef(mint); | 3350 d->AssignRef(mint); |
3364 } | 3351 } |
3365 } | 3352 } |
3366 stop_index_ = d->next_index(); | 3353 stop_index_ = d->next_index(); |
3367 } | 3354 } |
3368 | 3355 |
3369 void ReadFill(Deserializer* d) { } | 3356 void ReadFill(Deserializer* d) {} |
3370 | 3357 |
3371 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { | 3358 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { |
3372 NOT_IN_PRODUCT(TimelineDurationScope tds(Thread::Current(), | 3359 NOT_IN_PRODUCT(TimelineDurationScope tds( |
3373 Timeline::GetIsolateStream(), "PostLoadMint")); | 3360 Thread::Current(), Timeline::GetIsolateStream(), "PostLoadMint")); |
3374 | 3361 |
3375 const GrowableObjectArray& new_constants = | 3362 const GrowableObjectArray& new_constants = |
3376 GrowableObjectArray::Handle(zone, GrowableObjectArray::New()); | 3363 GrowableObjectArray::Handle(zone, GrowableObjectArray::New()); |
3377 Object& number = Object::Handle(zone); | 3364 Object& number = Object::Handle(zone); |
3378 for (intptr_t i = start_index_; i < stop_index_; i++) { | 3365 for (intptr_t i = start_index_; i < stop_index_; i++) { |
3379 number = refs.At(i); | 3366 number = refs.At(i); |
3380 if (number.IsMint() && number.IsCanonical()) { | 3367 if (number.IsMint() && number.IsCanonical()) { |
3381 new_constants.Add(number); | 3368 new_constants.Add(number); |
3382 } | 3369 } |
3383 } | 3370 } |
3384 const Array& constants_array = | 3371 const Array& constants_array = |
3385 Array::Handle(zone, Array::MakeArray(new_constants)); | 3372 Array::Handle(zone, Array::MakeArray(new_constants)); |
3386 const Class& mint_cls = Class::Handle(zone, | 3373 const Class& mint_cls = |
3387 Isolate::Current()->object_store()->mint_class()); | 3374 Class::Handle(zone, Isolate::Current()->object_store()->mint_class()); |
3388 mint_cls.set_constants(constants_array); | 3375 mint_cls.set_constants(constants_array); |
3389 } | 3376 } |
3390 }; | 3377 }; |
3391 | 3378 |
3392 | 3379 |
3393 #if !defined(DART_PRECOMPILED_RUNTIME) | 3380 #if !defined(DART_PRECOMPILED_RUNTIME) |
3394 class BigintSerializationCluster : public SerializationCluster { | 3381 class BigintSerializationCluster : public SerializationCluster { |
3395 public: | 3382 public: |
3396 BigintSerializationCluster() { } | 3383 BigintSerializationCluster() {} |
3397 virtual ~BigintSerializationCluster() { } | 3384 virtual ~BigintSerializationCluster() {} |
3398 | 3385 |
3399 void Trace(Serializer* s, RawObject* object) { | 3386 void Trace(Serializer* s, RawObject* object) { |
3400 RawBigint* bigint = Bigint::RawCast(object); | 3387 RawBigint* bigint = Bigint::RawCast(object); |
3401 objects_.Add(bigint); | 3388 objects_.Add(bigint); |
3402 | 3389 |
3403 RawObject** from = bigint->from(); | 3390 RawObject** from = bigint->from(); |
3404 RawObject** to = bigint->to(); | 3391 RawObject** to = bigint->to(); |
3405 for (RawObject** p = from; p <= to; p++) { | 3392 for (RawObject** p = from; p <= to; p++) { |
3406 s->Push(*p); | 3393 s->Push(*p); |
3407 } | 3394 } |
(...skipping 23 matching lines...) Expand all Loading... |
3431 } | 3418 } |
3432 | 3419 |
3433 private: | 3420 private: |
3434 GrowableArray<RawBigint*> objects_; | 3421 GrowableArray<RawBigint*> objects_; |
3435 }; | 3422 }; |
3436 #endif // !DART_PRECOMPILED_RUNTIME | 3423 #endif // !DART_PRECOMPILED_RUNTIME |
3437 | 3424 |
3438 | 3425 |
3439 class BigintDeserializationCluster : public DeserializationCluster { | 3426 class BigintDeserializationCluster : public DeserializationCluster { |
3440 public: | 3427 public: |
3441 BigintDeserializationCluster() { } | 3428 BigintDeserializationCluster() {} |
3442 virtual ~BigintDeserializationCluster() { } | 3429 virtual ~BigintDeserializationCluster() {} |
3443 | 3430 |
3444 void ReadAlloc(Deserializer* d) { | 3431 void ReadAlloc(Deserializer* d) { |
3445 start_index_ = d->next_index(); | 3432 start_index_ = d->next_index(); |
3446 PageSpace* old_space = d->heap()->old_space(); | 3433 PageSpace* old_space = d->heap()->old_space(); |
3447 intptr_t count = d->Read<int32_t>(); | 3434 intptr_t count = d->Read<int32_t>(); |
3448 for (intptr_t i = 0; i < count; i++) { | 3435 for (intptr_t i = 0; i < count; i++) { |
3449 d->AssignRef(AllocateUninitialized(old_space, Bigint::InstanceSize())); | 3436 d->AssignRef(AllocateUninitialized(old_space, Bigint::InstanceSize())); |
3450 } | 3437 } |
3451 stop_index_ = d->next_index(); | 3438 stop_index_ = d->next_index(); |
3452 } | 3439 } |
3453 | 3440 |
3454 void ReadFill(Deserializer* d) { | 3441 void ReadFill(Deserializer* d) { |
3455 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3442 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
3456 | 3443 |
3457 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3444 for (intptr_t id = start_index_; id < stop_index_; id++) { |
3458 RawBigint* bigint = reinterpret_cast<RawBigint*>(d->Ref(id)); | 3445 RawBigint* bigint = reinterpret_cast<RawBigint*>(d->Ref(id)); |
3459 bool is_canonical = d->Read<bool>(); | 3446 bool is_canonical = d->Read<bool>(); |
3460 Deserializer::InitializeHeader(bigint, kBigintCid, | 3447 Deserializer::InitializeHeader(bigint, kBigintCid, Bigint::InstanceSize(), |
3461 Bigint::InstanceSize(), | |
3462 is_vm_object, is_canonical); | 3448 is_vm_object, is_canonical); |
3463 RawObject** from = bigint->from(); | 3449 RawObject** from = bigint->from(); |
3464 RawObject** to = bigint->to(); | 3450 RawObject** to = bigint->to(); |
3465 for (RawObject** p = from; p <= to; p++) { | 3451 for (RawObject** p = from; p <= to; p++) { |
3466 *p = d->ReadRef(); | 3452 *p = d->ReadRef(); |
3467 } | 3453 } |
3468 } | 3454 } |
3469 } | 3455 } |
3470 }; | 3456 }; |
3471 | 3457 |
3472 | 3458 |
3473 #if !defined(DART_PRECOMPILED_RUNTIME) | 3459 #if !defined(DART_PRECOMPILED_RUNTIME) |
3474 class DoubleSerializationCluster : public SerializationCluster { | 3460 class DoubleSerializationCluster : public SerializationCluster { |
3475 public: | 3461 public: |
3476 DoubleSerializationCluster() { } | 3462 DoubleSerializationCluster() {} |
3477 virtual ~DoubleSerializationCluster() { } | 3463 virtual ~DoubleSerializationCluster() {} |
3478 | 3464 |
3479 void Trace(Serializer* s, RawObject* object) { | 3465 void Trace(Serializer* s, RawObject* object) { |
3480 RawDouble* dbl = Double::RawCast(object); | 3466 RawDouble* dbl = Double::RawCast(object); |
3481 objects_.Add(dbl); | 3467 objects_.Add(dbl); |
3482 } | 3468 } |
3483 | 3469 |
3484 void WriteAlloc(Serializer* s) { | 3470 void WriteAlloc(Serializer* s) { |
3485 s->WriteCid(kDoubleCid); | 3471 s->WriteCid(kDoubleCid); |
3486 intptr_t count = objects_.length(); | 3472 intptr_t count = objects_.length(); |
3487 s->Write<int32_t>(count); | 3473 s->Write<int32_t>(count); |
(...skipping 13 matching lines...) Expand all Loading... |
3501 } | 3487 } |
3502 | 3488 |
3503 private: | 3489 private: |
3504 GrowableArray<RawDouble*> objects_; | 3490 GrowableArray<RawDouble*> objects_; |
3505 }; | 3491 }; |
3506 #endif // !DART_PRECOMPILED_RUNTIME | 3492 #endif // !DART_PRECOMPILED_RUNTIME |
3507 | 3493 |
3508 | 3494 |
3509 class DoubleDeserializationCluster : public DeserializationCluster { | 3495 class DoubleDeserializationCluster : public DeserializationCluster { |
3510 public: | 3496 public: |
3511 DoubleDeserializationCluster() { } | 3497 DoubleDeserializationCluster() {} |
3512 virtual ~DoubleDeserializationCluster() { } | 3498 virtual ~DoubleDeserializationCluster() {} |
3513 | 3499 |
3514 void ReadAlloc(Deserializer* d) { | 3500 void ReadAlloc(Deserializer* d) { |
3515 start_index_ = d->next_index(); | 3501 start_index_ = d->next_index(); |
3516 PageSpace* old_space = d->heap()->old_space(); | 3502 PageSpace* old_space = d->heap()->old_space(); |
3517 intptr_t count = d->Read<int32_t>(); | 3503 intptr_t count = d->Read<int32_t>(); |
3518 for (intptr_t i = 0; i < count; i++) { | 3504 for (intptr_t i = 0; i < count; i++) { |
3519 d->AssignRef(AllocateUninitialized(old_space, Double::InstanceSize())); | 3505 d->AssignRef(AllocateUninitialized(old_space, Double::InstanceSize())); |
3520 } | 3506 } |
3521 stop_index_ = d->next_index(); | 3507 stop_index_ = d->next_index(); |
3522 } | 3508 } |
3523 | 3509 |
3524 void ReadFill(Deserializer* d) { | 3510 void ReadFill(Deserializer* d) { |
3525 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3511 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
3526 | 3512 |
3527 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3513 for (intptr_t id = start_index_; id < stop_index_; id++) { |
3528 RawDouble* dbl = reinterpret_cast<RawDouble*>(d->Ref(id)); | 3514 RawDouble* dbl = reinterpret_cast<RawDouble*>(d->Ref(id)); |
3529 bool is_canonical = d->Read<bool>(); | 3515 bool is_canonical = d->Read<bool>(); |
3530 Deserializer::InitializeHeader(dbl, kDoubleCid, | 3516 Deserializer::InitializeHeader(dbl, kDoubleCid, Double::InstanceSize(), |
3531 Double::InstanceSize(), | |
3532 is_vm_object, is_canonical); | 3517 is_vm_object, is_canonical); |
3533 dbl->ptr()->value_ = d->Read<double>(); | 3518 dbl->ptr()->value_ = d->Read<double>(); |
3534 } | 3519 } |
3535 } | 3520 } |
3536 }; | 3521 }; |
3537 | 3522 |
3538 | 3523 |
3539 #if !defined(DART_PRECOMPILED_RUNTIME) | 3524 #if !defined(DART_PRECOMPILED_RUNTIME) |
3540 class GrowableObjectArraySerializationCluster : public SerializationCluster { | 3525 class GrowableObjectArraySerializationCluster : public SerializationCluster { |
3541 public: | 3526 public: |
3542 GrowableObjectArraySerializationCluster() { } | 3527 GrowableObjectArraySerializationCluster() {} |
3543 virtual ~GrowableObjectArraySerializationCluster() { } | 3528 virtual ~GrowableObjectArraySerializationCluster() {} |
3544 | 3529 |
3545 void Trace(Serializer* s, RawObject* object) { | 3530 void Trace(Serializer* s, RawObject* object) { |
3546 RawGrowableObjectArray* array = GrowableObjectArray::RawCast(object); | 3531 RawGrowableObjectArray* array = GrowableObjectArray::RawCast(object); |
3547 objects_.Add(array); | 3532 objects_.Add(array); |
3548 | 3533 |
3549 RawObject** from = array->from(); | 3534 RawObject** from = array->from(); |
3550 RawObject** to = array->to(); | 3535 RawObject** to = array->to(); |
3551 for (RawObject** p = from; p <= to; p++) { | 3536 for (RawObject** p = from; p <= to; p++) { |
3552 s->Push(*p); | 3537 s->Push(*p); |
3553 } | 3538 } |
(...skipping 24 matching lines...) Expand all Loading... |
3578 | 3563 |
3579 private: | 3564 private: |
3580 GrowableArray<RawGrowableObjectArray*> objects_; | 3565 GrowableArray<RawGrowableObjectArray*> objects_; |
3581 }; | 3566 }; |
3582 #endif // !DART_PRECOMPILED_RUNTIME | 3567 #endif // !DART_PRECOMPILED_RUNTIME |
3583 | 3568 |
3584 | 3569 |
3585 class GrowableObjectArrayDeserializationCluster | 3570 class GrowableObjectArrayDeserializationCluster |
3586 : public DeserializationCluster { | 3571 : public DeserializationCluster { |
3587 public: | 3572 public: |
3588 GrowableObjectArrayDeserializationCluster() { } | 3573 GrowableObjectArrayDeserializationCluster() {} |
3589 virtual ~GrowableObjectArrayDeserializationCluster() { } | 3574 virtual ~GrowableObjectArrayDeserializationCluster() {} |
3590 | 3575 |
3591 void ReadAlloc(Deserializer* d) { | 3576 void ReadAlloc(Deserializer* d) { |
3592 start_index_ = d->next_index(); | 3577 start_index_ = d->next_index(); |
3593 PageSpace* old_space = d->heap()->old_space(); | 3578 PageSpace* old_space = d->heap()->old_space(); |
3594 intptr_t count = d->Read<int32_t>(); | 3579 intptr_t count = d->Read<int32_t>(); |
3595 for (intptr_t i = 0; i < count; i++) { | 3580 for (intptr_t i = 0; i < count; i++) { |
3596 d->AssignRef(AllocateUninitialized(old_space, | 3581 d->AssignRef(AllocateUninitialized(old_space, |
3597 GrowableObjectArray::InstanceSize())); | 3582 GrowableObjectArray::InstanceSize())); |
3598 } | 3583 } |
3599 stop_index_ = d->next_index(); | 3584 stop_index_ = d->next_index(); |
(...skipping 15 matching lines...) Expand all Loading... |
3615 *p = d->ReadRef(); | 3600 *p = d->ReadRef(); |
3616 } | 3601 } |
3617 } | 3602 } |
3618 } | 3603 } |
3619 }; | 3604 }; |
3620 | 3605 |
3621 | 3606 |
3622 #if !defined(DART_PRECOMPILED_RUNTIME) | 3607 #if !defined(DART_PRECOMPILED_RUNTIME) |
3623 class TypedDataSerializationCluster : public SerializationCluster { | 3608 class TypedDataSerializationCluster : public SerializationCluster { |
3624 public: | 3609 public: |
3625 explicit TypedDataSerializationCluster(intptr_t cid) : cid_(cid) { } | 3610 explicit TypedDataSerializationCluster(intptr_t cid) : cid_(cid) {} |
3626 virtual ~TypedDataSerializationCluster() { } | 3611 virtual ~TypedDataSerializationCluster() {} |
3627 | 3612 |
3628 void Trace(Serializer* s, RawObject* object) { | 3613 void Trace(Serializer* s, RawObject* object) { |
3629 RawTypedData* data = TypedData::RawCast(object); | 3614 RawTypedData* data = TypedData::RawCast(object); |
3630 objects_.Add(data); | 3615 objects_.Add(data); |
3631 } | 3616 } |
3632 | 3617 |
3633 void WriteAlloc(Serializer* s) { | 3618 void WriteAlloc(Serializer* s) { |
3634 s->WriteCid(cid_); | 3619 s->WriteCid(cid_); |
3635 intptr_t count = objects_.length(); | 3620 intptr_t count = objects_.length(); |
3636 s->Write<int32_t>(count); | 3621 s->Write<int32_t>(count); |
(...skipping 20 matching lines...) Expand all Loading... |
3657 | 3642 |
3658 private: | 3643 private: |
3659 const intptr_t cid_; | 3644 const intptr_t cid_; |
3660 GrowableArray<RawTypedData*> objects_; | 3645 GrowableArray<RawTypedData*> objects_; |
3661 }; | 3646 }; |
3662 #endif // !DART_PRECOMPILED_RUNTIME | 3647 #endif // !DART_PRECOMPILED_RUNTIME |
3663 | 3648 |
3664 | 3649 |
3665 class TypedDataDeserializationCluster : public DeserializationCluster { | 3650 class TypedDataDeserializationCluster : public DeserializationCluster { |
3666 public: | 3651 public: |
3667 explicit TypedDataDeserializationCluster(intptr_t cid) : cid_(cid) { } | 3652 explicit TypedDataDeserializationCluster(intptr_t cid) : cid_(cid) {} |
3668 virtual ~TypedDataDeserializationCluster() { } | 3653 virtual ~TypedDataDeserializationCluster() {} |
3669 | 3654 |
3670 void ReadAlloc(Deserializer* d) { | 3655 void ReadAlloc(Deserializer* d) { |
3671 start_index_ = d->next_index(); | 3656 start_index_ = d->next_index(); |
3672 PageSpace* old_space = d->heap()->old_space(); | 3657 PageSpace* old_space = d->heap()->old_space(); |
3673 intptr_t count = d->Read<int32_t>(); | 3658 intptr_t count = d->Read<int32_t>(); |
3674 intptr_t element_size = TypedData::ElementSizeInBytes(cid_); | 3659 intptr_t element_size = TypedData::ElementSizeInBytes(cid_); |
3675 for (intptr_t i = 0; i < count; i++) { | 3660 for (intptr_t i = 0; i < count; i++) { |
3676 intptr_t length = d->Read<int32_t>(); | 3661 intptr_t length = d->Read<int32_t>(); |
3677 d->AssignRef(AllocateUninitialized(old_space, | 3662 d->AssignRef(AllocateUninitialized( |
3678 TypedData::InstanceSize(length * element_size))); | 3663 old_space, TypedData::InstanceSize(length * element_size))); |
3679 } | 3664 } |
3680 stop_index_ = d->next_index(); | 3665 stop_index_ = d->next_index(); |
3681 } | 3666 } |
3682 | 3667 |
3683 void ReadFill(Deserializer* d) { | 3668 void ReadFill(Deserializer* d) { |
3684 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3669 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
3685 intptr_t element_size = TypedData::ElementSizeInBytes(cid_); | 3670 intptr_t element_size = TypedData::ElementSizeInBytes(cid_); |
3686 | 3671 |
3687 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3672 for (intptr_t id = start_index_; id < stop_index_; id++) { |
3688 RawTypedData* data = reinterpret_cast<RawTypedData*>(d->Ref(id)); | 3673 RawTypedData* data = reinterpret_cast<RawTypedData*>(d->Ref(id)); |
(...skipping 10 matching lines...) Expand all Loading... |
3699 } | 3684 } |
3700 | 3685 |
3701 private: | 3686 private: |
3702 const intptr_t cid_; | 3687 const intptr_t cid_; |
3703 }; | 3688 }; |
3704 | 3689 |
3705 | 3690 |
3706 #if !defined(DART_PRECOMPILED_RUNTIME) | 3691 #if !defined(DART_PRECOMPILED_RUNTIME) |
3707 class ExternalTypedDataSerializationCluster : public SerializationCluster { | 3692 class ExternalTypedDataSerializationCluster : public SerializationCluster { |
3708 public: | 3693 public: |
3709 explicit ExternalTypedDataSerializationCluster(intptr_t cid) : cid_(cid) { } | 3694 explicit ExternalTypedDataSerializationCluster(intptr_t cid) : cid_(cid) {} |
3710 virtual ~ExternalTypedDataSerializationCluster() { } | 3695 virtual ~ExternalTypedDataSerializationCluster() {} |
3711 | 3696 |
3712 void Trace(Serializer* s, RawObject* object) { | 3697 void Trace(Serializer* s, RawObject* object) { |
3713 RawExternalTypedData* data = ExternalTypedData::RawCast(object); | 3698 RawExternalTypedData* data = ExternalTypedData::RawCast(object); |
3714 objects_.Add(data); | 3699 objects_.Add(data); |
3715 ASSERT(!data->IsCanonical()); | 3700 ASSERT(!data->IsCanonical()); |
3716 } | 3701 } |
3717 | 3702 |
3718 void WriteAlloc(Serializer* s) { | 3703 void WriteAlloc(Serializer* s) { |
3719 s->WriteCid(cid_); | 3704 s->WriteCid(cid_); |
3720 intptr_t count = objects_.length(); | 3705 intptr_t count = objects_.length(); |
(...skipping 18 matching lines...) Expand all Loading... |
3739 | 3724 |
3740 private: | 3725 private: |
3741 const intptr_t cid_; | 3726 const intptr_t cid_; |
3742 GrowableArray<RawExternalTypedData*> objects_; | 3727 GrowableArray<RawExternalTypedData*> objects_; |
3743 }; | 3728 }; |
3744 #endif // !DART_PRECOMPILED_RUNTIME | 3729 #endif // !DART_PRECOMPILED_RUNTIME |
3745 | 3730 |
3746 | 3731 |
3747 class ExternalTypedDataDeserializationCluster : public DeserializationCluster { | 3732 class ExternalTypedDataDeserializationCluster : public DeserializationCluster { |
3748 public: | 3733 public: |
3749 explicit ExternalTypedDataDeserializationCluster(intptr_t cid) : cid_(cid) { } | 3734 explicit ExternalTypedDataDeserializationCluster(intptr_t cid) : cid_(cid) {} |
3750 virtual ~ExternalTypedDataDeserializationCluster() { } | 3735 virtual ~ExternalTypedDataDeserializationCluster() {} |
3751 | 3736 |
3752 void ReadAlloc(Deserializer* d) { | 3737 void ReadAlloc(Deserializer* d) { |
3753 start_index_ = d->next_index(); | 3738 start_index_ = d->next_index(); |
3754 PageSpace* old_space = d->heap()->old_space(); | 3739 PageSpace* old_space = d->heap()->old_space(); |
3755 intptr_t count = d->Read<int32_t>(); | 3740 intptr_t count = d->Read<int32_t>(); |
3756 for (intptr_t i = 0; i < count; i++) { | 3741 for (intptr_t i = 0; i < count; i++) { |
3757 d->AssignRef(AllocateUninitialized(old_space, | 3742 d->AssignRef( |
3758 ExternalTypedData::InstanceSize())); | 3743 AllocateUninitialized(old_space, ExternalTypedData::InstanceSize())); |
3759 } | 3744 } |
3760 stop_index_ = d->next_index(); | 3745 stop_index_ = d->next_index(); |
3761 } | 3746 } |
3762 | 3747 |
3763 void ReadFill(Deserializer* d) { | 3748 void ReadFill(Deserializer* d) { |
3764 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3749 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
3765 intptr_t element_size = ExternalTypedData::ElementSizeInBytes(cid_); | 3750 intptr_t element_size = ExternalTypedData::ElementSizeInBytes(cid_); |
3766 | 3751 |
3767 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3752 for (intptr_t id = start_index_; id < stop_index_; id++) { |
3768 RawExternalTypedData* data = | 3753 RawExternalTypedData* data = |
3769 reinterpret_cast<RawExternalTypedData*>(d->Ref(id)); | 3754 reinterpret_cast<RawExternalTypedData*>(d->Ref(id)); |
3770 intptr_t length = d->Read<int32_t>(); | 3755 intptr_t length = d->Read<int32_t>(); |
3771 Deserializer::InitializeHeader(data, cid_, | 3756 Deserializer::InitializeHeader( |
3772 ExternalTypedData::InstanceSize(), | 3757 data, cid_, ExternalTypedData::InstanceSize(), is_vm_object); |
3773 is_vm_object); | |
3774 data->ptr()->length_ = Smi::New(length); | 3758 data->ptr()->length_ = Smi::New(length); |
3775 data->ptr()->data_ = const_cast<uint8_t*>(d->CurrentBufferAddress()); | 3759 data->ptr()->data_ = const_cast<uint8_t*>(d->CurrentBufferAddress()); |
3776 d->Advance(length * element_size); | 3760 d->Advance(length * element_size); |
3777 // No finalizer / external size 0. | 3761 // No finalizer / external size 0. |
3778 } | 3762 } |
3779 } | 3763 } |
3780 | 3764 |
3781 private: | 3765 private: |
3782 const intptr_t cid_; | 3766 const intptr_t cid_; |
3783 }; | 3767 }; |
3784 | 3768 |
3785 | 3769 |
3786 #if !defined(DART_PRECOMPILED_RUNTIME) | 3770 #if !defined(DART_PRECOMPILED_RUNTIME) |
3787 class StacktraceSerializationCluster : public SerializationCluster { | 3771 class StacktraceSerializationCluster : public SerializationCluster { |
3788 public: | 3772 public: |
3789 StacktraceSerializationCluster() { } | 3773 StacktraceSerializationCluster() {} |
3790 virtual ~StacktraceSerializationCluster() { } | 3774 virtual ~StacktraceSerializationCluster() {} |
3791 | 3775 |
3792 void Trace(Serializer* s, RawObject* object) { | 3776 void Trace(Serializer* s, RawObject* object) { |
3793 RawStacktrace* trace = Stacktrace::RawCast(object); | 3777 RawStacktrace* trace = Stacktrace::RawCast(object); |
3794 objects_.Add(trace); | 3778 objects_.Add(trace); |
3795 | 3779 |
3796 RawObject** from = trace->from(); | 3780 RawObject** from = trace->from(); |
3797 RawObject** to = trace->to(); | 3781 RawObject** to = trace->to(); |
3798 for (RawObject** p = from; p <= to; p++) { | 3782 for (RawObject** p = from; p <= to; p++) { |
3799 s->Push(*p); | 3783 s->Push(*p); |
3800 } | 3784 } |
(...skipping 22 matching lines...) Expand all Loading... |
3823 } | 3807 } |
3824 | 3808 |
3825 private: | 3809 private: |
3826 GrowableArray<RawStacktrace*> objects_; | 3810 GrowableArray<RawStacktrace*> objects_; |
3827 }; | 3811 }; |
3828 #endif // !DART_PRECOMPILED_RUNTIME | 3812 #endif // !DART_PRECOMPILED_RUNTIME |
3829 | 3813 |
3830 | 3814 |
3831 class StacktraceDeserializationCluster : public DeserializationCluster { | 3815 class StacktraceDeserializationCluster : public DeserializationCluster { |
3832 public: | 3816 public: |
3833 StacktraceDeserializationCluster() { } | 3817 StacktraceDeserializationCluster() {} |
3834 virtual ~StacktraceDeserializationCluster() { } | 3818 virtual ~StacktraceDeserializationCluster() {} |
3835 | 3819 |
3836 void ReadAlloc(Deserializer* d) { | 3820 void ReadAlloc(Deserializer* d) { |
3837 start_index_ = d->next_index(); | 3821 start_index_ = d->next_index(); |
3838 PageSpace* old_space = d->heap()->old_space(); | 3822 PageSpace* old_space = d->heap()->old_space(); |
3839 intptr_t count = d->Read<int32_t>(); | 3823 intptr_t count = d->Read<int32_t>(); |
3840 for (intptr_t i = 0; i < count; i++) { | 3824 for (intptr_t i = 0; i < count; i++) { |
3841 d->AssignRef(AllocateUninitialized(old_space, | 3825 d->AssignRef( |
3842 Stacktrace::InstanceSize())); | 3826 AllocateUninitialized(old_space, Stacktrace::InstanceSize())); |
3843 } | 3827 } |
3844 stop_index_ = d->next_index(); | 3828 stop_index_ = d->next_index(); |
3845 } | 3829 } |
3846 | 3830 |
3847 void ReadFill(Deserializer* d) { | 3831 void ReadFill(Deserializer* d) { |
3848 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3832 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
3849 | 3833 |
3850 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3834 for (intptr_t id = start_index_; id < stop_index_; id++) { |
3851 RawStacktrace* trace = reinterpret_cast<RawStacktrace*>(d->Ref(id)); | 3835 RawStacktrace* trace = reinterpret_cast<RawStacktrace*>(d->Ref(id)); |
3852 Deserializer::InitializeHeader(trace, kStacktraceCid, | 3836 Deserializer::InitializeHeader(trace, kStacktraceCid, |
3853 Stacktrace::InstanceSize(), is_vm_object); | 3837 Stacktrace::InstanceSize(), is_vm_object); |
3854 RawObject** from = trace->from(); | 3838 RawObject** from = trace->from(); |
3855 RawObject** to = trace->to(); | 3839 RawObject** to = trace->to(); |
3856 for (RawObject** p = from; p <= to; p++) { | 3840 for (RawObject** p = from; p <= to; p++) { |
3857 *p = d->ReadRef(); | 3841 *p = d->ReadRef(); |
3858 } | 3842 } |
3859 } | 3843 } |
3860 } | 3844 } |
3861 }; | 3845 }; |
3862 | 3846 |
3863 | 3847 |
3864 #if !defined(DART_PRECOMPILED_RUNTIME) | 3848 #if !defined(DART_PRECOMPILED_RUNTIME) |
3865 class RegExpSerializationCluster : public SerializationCluster { | 3849 class RegExpSerializationCluster : public SerializationCluster { |
3866 public: | 3850 public: |
3867 RegExpSerializationCluster() { } | 3851 RegExpSerializationCluster() {} |
3868 virtual ~RegExpSerializationCluster() { } | 3852 virtual ~RegExpSerializationCluster() {} |
3869 | 3853 |
3870 void Trace(Serializer* s, RawObject* object) { | 3854 void Trace(Serializer* s, RawObject* object) { |
3871 RawRegExp* regexp = RegExp::RawCast(object); | 3855 RawRegExp* regexp = RegExp::RawCast(object); |
3872 objects_.Add(regexp); | 3856 objects_.Add(regexp); |
3873 | 3857 |
3874 RawObject** from = regexp->from(); | 3858 RawObject** from = regexp->from(); |
3875 RawObject** to = regexp->to(); | 3859 RawObject** to = regexp->to(); |
3876 for (RawObject** p = from; p <= to; p++) { | 3860 for (RawObject** p = from; p <= to; p++) { |
3877 s->Push(*p); | 3861 s->Push(*p); |
3878 } | 3862 } |
(...skipping 25 matching lines...) Expand all Loading... |
3904 } | 3888 } |
3905 | 3889 |
3906 private: | 3890 private: |
3907 GrowableArray<RawRegExp*> objects_; | 3891 GrowableArray<RawRegExp*> objects_; |
3908 }; | 3892 }; |
3909 #endif // !DART_PRECOMPILED_RUNTIME | 3893 #endif // !DART_PRECOMPILED_RUNTIME |
3910 | 3894 |
3911 | 3895 |
3912 class RegExpDeserializationCluster : public DeserializationCluster { | 3896 class RegExpDeserializationCluster : public DeserializationCluster { |
3913 public: | 3897 public: |
3914 RegExpDeserializationCluster() { } | 3898 RegExpDeserializationCluster() {} |
3915 virtual ~RegExpDeserializationCluster() { } | 3899 virtual ~RegExpDeserializationCluster() {} |
3916 | 3900 |
3917 void ReadAlloc(Deserializer* d) { | 3901 void ReadAlloc(Deserializer* d) { |
3918 start_index_ = d->next_index(); | 3902 start_index_ = d->next_index(); |
3919 PageSpace* old_space = d->heap()->old_space(); | 3903 PageSpace* old_space = d->heap()->old_space(); |
3920 intptr_t count = d->Read<int32_t>(); | 3904 intptr_t count = d->Read<int32_t>(); |
3921 for (intptr_t i = 0; i < count; i++) { | 3905 for (intptr_t i = 0; i < count; i++) { |
3922 d->AssignRef(AllocateUninitialized(old_space, | 3906 d->AssignRef(AllocateUninitialized(old_space, RegExp::InstanceSize())); |
3923 RegExp::InstanceSize())); | |
3924 } | 3907 } |
3925 stop_index_ = d->next_index(); | 3908 stop_index_ = d->next_index(); |
3926 } | 3909 } |
3927 | 3910 |
3928 void ReadFill(Deserializer* d) { | 3911 void ReadFill(Deserializer* d) { |
3929 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3912 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
3930 | 3913 |
3931 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3914 for (intptr_t id = start_index_; id < stop_index_; id++) { |
3932 RawRegExp* regexp = reinterpret_cast<RawRegExp*>(d->Ref(id)); | 3915 RawRegExp* regexp = reinterpret_cast<RawRegExp*>(d->Ref(id)); |
3933 Deserializer::InitializeHeader(regexp, kRegExpCid, | 3916 Deserializer::InitializeHeader(regexp, kRegExpCid, RegExp::InstanceSize(), |
3934 RegExp::InstanceSize(), is_vm_object); | 3917 is_vm_object); |
3935 RawObject** from = regexp->from(); | 3918 RawObject** from = regexp->from(); |
3936 RawObject** to = regexp->to(); | 3919 RawObject** to = regexp->to(); |
3937 for (RawObject** p = from; p <= to; p++) { | 3920 for (RawObject** p = from; p <= to; p++) { |
3938 *p = d->ReadRef(); | 3921 *p = d->ReadRef(); |
3939 } | 3922 } |
3940 | 3923 |
3941 regexp->ptr()->num_registers_ = d->Read<int32_t>(); | 3924 regexp->ptr()->num_registers_ = d->Read<int32_t>(); |
3942 regexp->ptr()->type_flags_ = d->Read<int8_t>(); | 3925 regexp->ptr()->type_flags_ = d->Read<int8_t>(); |
3943 } | 3926 } |
3944 } | 3927 } |
3945 }; | 3928 }; |
3946 | 3929 |
3947 | 3930 |
3948 #if !defined(DART_PRECOMPILED_RUNTIME) | 3931 #if !defined(DART_PRECOMPILED_RUNTIME) |
3949 class WeakPropertySerializationCluster : public SerializationCluster { | 3932 class WeakPropertySerializationCluster : public SerializationCluster { |
3950 public: | 3933 public: |
3951 WeakPropertySerializationCluster() { } | 3934 WeakPropertySerializationCluster() {} |
3952 virtual ~WeakPropertySerializationCluster() { } | 3935 virtual ~WeakPropertySerializationCluster() {} |
3953 | 3936 |
3954 void Trace(Serializer* s, RawObject* object) { | 3937 void Trace(Serializer* s, RawObject* object) { |
3955 RawWeakProperty* property = WeakProperty::RawCast(object); | 3938 RawWeakProperty* property = WeakProperty::RawCast(object); |
3956 objects_.Add(property); | 3939 objects_.Add(property); |
3957 | 3940 |
3958 RawObject** from = property->from(); | 3941 RawObject** from = property->from(); |
3959 RawObject** to = property->to(); | 3942 RawObject** to = property->to(); |
3960 for (RawObject** p = from; p <= to; p++) { | 3943 for (RawObject** p = from; p <= to; p++) { |
3961 s->Push(*p); | 3944 s->Push(*p); |
3962 } | 3945 } |
(...skipping 22 matching lines...) Expand all Loading... |
3985 } | 3968 } |
3986 | 3969 |
3987 private: | 3970 private: |
3988 GrowableArray<RawWeakProperty*> objects_; | 3971 GrowableArray<RawWeakProperty*> objects_; |
3989 }; | 3972 }; |
3990 #endif // !DART_PRECOMPILED_RUNTIME | 3973 #endif // !DART_PRECOMPILED_RUNTIME |
3991 | 3974 |
3992 | 3975 |
3993 class WeakPropertyDeserializationCluster : public DeserializationCluster { | 3976 class WeakPropertyDeserializationCluster : public DeserializationCluster { |
3994 public: | 3977 public: |
3995 WeakPropertyDeserializationCluster() { } | 3978 WeakPropertyDeserializationCluster() {} |
3996 virtual ~WeakPropertyDeserializationCluster() { } | 3979 virtual ~WeakPropertyDeserializationCluster() {} |
3997 | 3980 |
3998 void ReadAlloc(Deserializer* d) { | 3981 void ReadAlloc(Deserializer* d) { |
3999 start_index_ = d->next_index(); | 3982 start_index_ = d->next_index(); |
4000 PageSpace* old_space = d->heap()->old_space(); | 3983 PageSpace* old_space = d->heap()->old_space(); |
4001 intptr_t count = d->Read<int32_t>(); | 3984 intptr_t count = d->Read<int32_t>(); |
4002 for (intptr_t i = 0; i < count; i++) { | 3985 for (intptr_t i = 0; i < count; i++) { |
4003 d->AssignRef(AllocateUninitialized(old_space, | 3986 d->AssignRef( |
4004 WeakProperty::InstanceSize())); | 3987 AllocateUninitialized(old_space, WeakProperty::InstanceSize())); |
4005 } | 3988 } |
4006 stop_index_ = d->next_index(); | 3989 stop_index_ = d->next_index(); |
4007 } | 3990 } |
4008 | 3991 |
4009 void ReadFill(Deserializer* d) { | 3992 void ReadFill(Deserializer* d) { |
4010 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3993 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
4011 | 3994 |
4012 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3995 for (intptr_t id = start_index_; id < stop_index_; id++) { |
4013 RawWeakProperty* property = | 3996 RawWeakProperty* property = |
4014 reinterpret_cast<RawWeakProperty*>(d->Ref(id)); | 3997 reinterpret_cast<RawWeakProperty*>(d->Ref(id)); |
4015 Deserializer::InitializeHeader(property, kWeakPropertyCid, | 3998 Deserializer::InitializeHeader(property, kWeakPropertyCid, |
4016 WeakProperty::InstanceSize(), | 3999 WeakProperty::InstanceSize(), |
4017 is_vm_object); | 4000 is_vm_object); |
4018 RawObject** from = property->from(); | 4001 RawObject** from = property->from(); |
4019 RawObject** to = property->to(); | 4002 RawObject** to = property->to(); |
4020 for (RawObject** p = from; p <= to; p++) { | 4003 for (RawObject** p = from; p <= to; p++) { |
4021 *p = d->ReadRef(); | 4004 *p = d->ReadRef(); |
4022 } | 4005 } |
4023 } | 4006 } |
4024 } | 4007 } |
4025 }; | 4008 }; |
4026 | 4009 |
4027 | 4010 |
4028 #if !defined(DART_PRECOMPILED_RUNTIME) | 4011 #if !defined(DART_PRECOMPILED_RUNTIME) |
4029 class LinkedHashMapSerializationCluster : public SerializationCluster { | 4012 class LinkedHashMapSerializationCluster : public SerializationCluster { |
4030 public: | 4013 public: |
4031 LinkedHashMapSerializationCluster() { } | 4014 LinkedHashMapSerializationCluster() {} |
4032 virtual ~LinkedHashMapSerializationCluster() { } | 4015 virtual ~LinkedHashMapSerializationCluster() {} |
4033 | 4016 |
4034 void Trace(Serializer* s, RawObject* object) { | 4017 void Trace(Serializer* s, RawObject* object) { |
4035 RawLinkedHashMap* map = LinkedHashMap::RawCast(object); | 4018 RawLinkedHashMap* map = LinkedHashMap::RawCast(object); |
4036 objects_.Add(map); | 4019 objects_.Add(map); |
4037 | 4020 |
4038 s->Push(map->ptr()->type_arguments_); | 4021 s->Push(map->ptr()->type_arguments_); |
4039 | 4022 |
4040 intptr_t used_data = Smi::Value(map->ptr()->used_data_); | 4023 intptr_t used_data = Smi::Value(map->ptr()->used_data_); |
4041 RawArray* data_array = map->ptr()->data_; | 4024 RawArray* data_array = map->ptr()->data_; |
4042 RawObject** data_elements = data_array->ptr()->data(); | 4025 RawObject** data_elements = data_array->ptr()->data(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4089 } | 4072 } |
4090 | 4073 |
4091 private: | 4074 private: |
4092 GrowableArray<RawLinkedHashMap*> objects_; | 4075 GrowableArray<RawLinkedHashMap*> objects_; |
4093 }; | 4076 }; |
4094 #endif // !DART_PRECOMPILED_RUNTIME | 4077 #endif // !DART_PRECOMPILED_RUNTIME |
4095 | 4078 |
4096 | 4079 |
4097 class LinkedHashMapDeserializationCluster : public DeserializationCluster { | 4080 class LinkedHashMapDeserializationCluster : public DeserializationCluster { |
4098 public: | 4081 public: |
4099 LinkedHashMapDeserializationCluster() { } | 4082 LinkedHashMapDeserializationCluster() {} |
4100 virtual ~LinkedHashMapDeserializationCluster() { } | 4083 virtual ~LinkedHashMapDeserializationCluster() {} |
4101 | 4084 |
4102 void ReadAlloc(Deserializer* d) { | 4085 void ReadAlloc(Deserializer* d) { |
4103 start_index_ = d->next_index(); | 4086 start_index_ = d->next_index(); |
4104 PageSpace* old_space = d->heap()->old_space(); | 4087 PageSpace* old_space = d->heap()->old_space(); |
4105 intptr_t count = d->Read<int32_t>(); | 4088 intptr_t count = d->Read<int32_t>(); |
4106 for (intptr_t i = 0; i < count; i++) { | 4089 for (intptr_t i = 0; i < count; i++) { |
4107 d->AssignRef(AllocateUninitialized(old_space, | 4090 d->AssignRef( |
4108 LinkedHashMap::InstanceSize())); | 4091 AllocateUninitialized(old_space, LinkedHashMap::InstanceSize())); |
4109 } | 4092 } |
4110 stop_index_ = d->next_index(); | 4093 stop_index_ = d->next_index(); |
4111 } | 4094 } |
4112 | 4095 |
4113 void ReadFill(Deserializer* d) { | 4096 void ReadFill(Deserializer* d) { |
4114 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 4097 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
4115 PageSpace* old_space = d->heap()->old_space(); | 4098 PageSpace* old_space = d->heap()->old_space(); |
4116 | 4099 |
4117 for (intptr_t id = start_index_; id < stop_index_; id++) { | 4100 for (intptr_t id = start_index_; id < stop_index_; id++) { |
4118 RawLinkedHashMap* map = reinterpret_cast<RawLinkedHashMap*>(d->Ref(id)); | 4101 RawLinkedHashMap* map = reinterpret_cast<RawLinkedHashMap*>(d->Ref(id)); |
(...skipping 30 matching lines...) Expand all Loading... |
4149 map->ptr()->used_data_ = Smi::New(used_data); | 4132 map->ptr()->used_data_ = Smi::New(used_data); |
4150 map->ptr()->deleted_keys_ = Smi::New(0); | 4133 map->ptr()->deleted_keys_ = Smi::New(0); |
4151 } | 4134 } |
4152 } | 4135 } |
4153 }; | 4136 }; |
4154 | 4137 |
4155 | 4138 |
4156 #if !defined(DART_PRECOMPILED_RUNTIME) | 4139 #if !defined(DART_PRECOMPILED_RUNTIME) |
4157 class ArraySerializationCluster : public SerializationCluster { | 4140 class ArraySerializationCluster : public SerializationCluster { |
4158 public: | 4141 public: |
4159 explicit ArraySerializationCluster(intptr_t cid) : cid_(cid) { } | 4142 explicit ArraySerializationCluster(intptr_t cid) : cid_(cid) {} |
4160 virtual ~ArraySerializationCluster() { } | 4143 virtual ~ArraySerializationCluster() {} |
4161 | 4144 |
4162 void Trace(Serializer* s, RawObject* object) { | 4145 void Trace(Serializer* s, RawObject* object) { |
4163 RawArray* array = Array::RawCast(object); | 4146 RawArray* array = Array::RawCast(object); |
4164 objects_.Add(array); | 4147 objects_.Add(array); |
4165 | 4148 |
4166 s->Push(array->ptr()->type_arguments_); | 4149 s->Push(array->ptr()->type_arguments_); |
4167 intptr_t length = Smi::Value(array->ptr()->length_); | 4150 intptr_t length = Smi::Value(array->ptr()->length_); |
4168 for (intptr_t i = 0; i < length; i++) { | 4151 for (intptr_t i = 0; i < length; i++) { |
4169 s->Push(array->ptr()->data()[i]); | 4152 s->Push(array->ptr()->data()[i]); |
4170 } | 4153 } |
(...skipping 27 matching lines...) Expand all Loading... |
4198 | 4181 |
4199 private: | 4182 private: |
4200 intptr_t cid_; | 4183 intptr_t cid_; |
4201 GrowableArray<RawArray*> objects_; | 4184 GrowableArray<RawArray*> objects_; |
4202 }; | 4185 }; |
4203 #endif // !DART_PRECOMPILED_RUNTIME | 4186 #endif // !DART_PRECOMPILED_RUNTIME |
4204 | 4187 |
4205 | 4188 |
4206 class ArrayDeserializationCluster : public DeserializationCluster { | 4189 class ArrayDeserializationCluster : public DeserializationCluster { |
4207 public: | 4190 public: |
4208 explicit ArrayDeserializationCluster(intptr_t cid) : cid_(cid) { } | 4191 explicit ArrayDeserializationCluster(intptr_t cid) : cid_(cid) {} |
4209 virtual ~ArrayDeserializationCluster() { } | 4192 virtual ~ArrayDeserializationCluster() {} |
4210 | 4193 |
4211 void ReadAlloc(Deserializer* d) { | 4194 void ReadAlloc(Deserializer* d) { |
4212 start_index_ = d->next_index(); | 4195 start_index_ = d->next_index(); |
4213 PageSpace* old_space = d->heap()->old_space(); | 4196 PageSpace* old_space = d->heap()->old_space(); |
4214 intptr_t count = d->Read<int32_t>(); | 4197 intptr_t count = d->Read<int32_t>(); |
4215 for (intptr_t i = 0; i < count; i++) { | 4198 for (intptr_t i = 0; i < count; i++) { |
4216 intptr_t length = d->Read<int32_t>(); | 4199 intptr_t length = d->Read<int32_t>(); |
4217 d->AssignRef(AllocateUninitialized(old_space, | 4200 d->AssignRef( |
4218 Array::InstanceSize(length))); | 4201 AllocateUninitialized(old_space, Array::InstanceSize(length))); |
4219 } | 4202 } |
4220 stop_index_ = d->next_index(); | 4203 stop_index_ = d->next_index(); |
4221 } | 4204 } |
4222 | 4205 |
4223 void ReadFill(Deserializer* d) { | 4206 void ReadFill(Deserializer* d) { |
4224 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 4207 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
4225 | 4208 |
4226 for (intptr_t id = start_index_; id < stop_index_; id++) { | 4209 for (intptr_t id = start_index_; id < stop_index_; id++) { |
4227 RawArray* array = reinterpret_cast<RawArray*>(d->Ref(id)); | 4210 RawArray* array = reinterpret_cast<RawArray*>(d->Ref(id)); |
4228 intptr_t length = d->Read<int32_t>(); | 4211 intptr_t length = d->Read<int32_t>(); |
4229 bool is_canonical = d->Read<bool>(); | 4212 bool is_canonical = d->Read<bool>(); |
4230 Deserializer::InitializeHeader(array, cid_, | 4213 Deserializer::InitializeHeader(array, cid_, Array::InstanceSize(length), |
4231 Array::InstanceSize(length), | |
4232 is_vm_object, is_canonical); | 4214 is_vm_object, is_canonical); |
4233 array->ptr()->type_arguments_ = | 4215 array->ptr()->type_arguments_ = |
4234 reinterpret_cast<RawTypeArguments*>(d->ReadRef()); | 4216 reinterpret_cast<RawTypeArguments*>(d->ReadRef()); |
4235 array->ptr()->length_ = Smi::New(length); | 4217 array->ptr()->length_ = Smi::New(length); |
4236 for (intptr_t j = 0; j < length; j++) { | 4218 for (intptr_t j = 0; j < length; j++) { |
4237 array->ptr()->data()[j] = d->ReadRef(); | 4219 array->ptr()->data()[j] = d->ReadRef(); |
4238 } | 4220 } |
4239 } | 4221 } |
4240 } | 4222 } |
4241 | 4223 |
4242 private: | 4224 private: |
4243 const intptr_t cid_; | 4225 const intptr_t cid_; |
4244 }; | 4226 }; |
4245 | 4227 |
4246 | 4228 |
4247 #if !defined(DART_PRECOMPILED_RUNTIME) | 4229 #if !defined(DART_PRECOMPILED_RUNTIME) |
4248 class OneByteStringSerializationCluster : public SerializationCluster { | 4230 class OneByteStringSerializationCluster : public SerializationCluster { |
4249 public: | 4231 public: |
4250 OneByteStringSerializationCluster() { } | 4232 OneByteStringSerializationCluster() {} |
4251 virtual ~OneByteStringSerializationCluster() { } | 4233 virtual ~OneByteStringSerializationCluster() {} |
4252 | 4234 |
4253 void Trace(Serializer* s, RawObject* object) { | 4235 void Trace(Serializer* s, RawObject* object) { |
4254 RawOneByteString* str = reinterpret_cast<RawOneByteString*>(object); | 4236 RawOneByteString* str = reinterpret_cast<RawOneByteString*>(object); |
4255 objects_.Add(str); | 4237 objects_.Add(str); |
4256 } | 4238 } |
4257 | 4239 |
4258 void WriteAlloc(Serializer* s) { | 4240 void WriteAlloc(Serializer* s) { |
4259 s->WriteCid(kOneByteStringCid); | 4241 s->WriteCid(kOneByteStringCid); |
4260 intptr_t count = objects_.length(); | 4242 intptr_t count = objects_.length(); |
4261 s->Write<int32_t>(count); | 4243 s->Write<int32_t>(count); |
(...skipping 19 matching lines...) Expand all Loading... |
4281 } | 4263 } |
4282 | 4264 |
4283 private: | 4265 private: |
4284 GrowableArray<RawOneByteString*> objects_; | 4266 GrowableArray<RawOneByteString*> objects_; |
4285 }; | 4267 }; |
4286 #endif // !DART_PRECOMPILED_RUNTIME | 4268 #endif // !DART_PRECOMPILED_RUNTIME |
4287 | 4269 |
4288 | 4270 |
4289 class OneByteStringDeserializationCluster : public DeserializationCluster { | 4271 class OneByteStringDeserializationCluster : public DeserializationCluster { |
4290 public: | 4272 public: |
4291 OneByteStringDeserializationCluster() { } | 4273 OneByteStringDeserializationCluster() {} |
4292 virtual ~OneByteStringDeserializationCluster() { } | 4274 virtual ~OneByteStringDeserializationCluster() {} |
4293 | 4275 |
4294 void ReadAlloc(Deserializer* d) { | 4276 void ReadAlloc(Deserializer* d) { |
4295 start_index_ = d->next_index(); | 4277 start_index_ = d->next_index(); |
4296 PageSpace* old_space = d->heap()->old_space(); | 4278 PageSpace* old_space = d->heap()->old_space(); |
4297 intptr_t count = d->Read<int32_t>(); | 4279 intptr_t count = d->Read<int32_t>(); |
4298 for (intptr_t i = 0; i < count; i++) { | 4280 for (intptr_t i = 0; i < count; i++) { |
4299 intptr_t length = d->Read<int32_t>(); | 4281 intptr_t length = d->Read<int32_t>(); |
4300 d->AssignRef(AllocateUninitialized(old_space, | 4282 d->AssignRef(AllocateUninitialized(old_space, |
4301 OneByteString::InstanceSize(length))); | 4283 OneByteString::InstanceSize(length))); |
4302 } | 4284 } |
(...skipping 16 matching lines...) Expand all Loading... |
4319 str->ptr()->data()[j] = d->Read<uint8_t>(); | 4301 str->ptr()->data()[j] = d->Read<uint8_t>(); |
4320 } | 4302 } |
4321 } | 4303 } |
4322 } | 4304 } |
4323 }; | 4305 }; |
4324 | 4306 |
4325 | 4307 |
4326 #if !defined(DART_PRECOMPILED_RUNTIME) | 4308 #if !defined(DART_PRECOMPILED_RUNTIME) |
4327 class TwoByteStringSerializationCluster : public SerializationCluster { | 4309 class TwoByteStringSerializationCluster : public SerializationCluster { |
4328 public: | 4310 public: |
4329 TwoByteStringSerializationCluster() { } | 4311 TwoByteStringSerializationCluster() {} |
4330 virtual ~TwoByteStringSerializationCluster() { } | 4312 virtual ~TwoByteStringSerializationCluster() {} |
4331 | 4313 |
4332 void Trace(Serializer* s, RawObject* object) { | 4314 void Trace(Serializer* s, RawObject* object) { |
4333 RawTwoByteString* str = reinterpret_cast<RawTwoByteString*>(object); | 4315 RawTwoByteString* str = reinterpret_cast<RawTwoByteString*>(object); |
4334 objects_.Add(str); | 4316 objects_.Add(str); |
4335 } | 4317 } |
4336 | 4318 |
4337 void WriteAlloc(Serializer* s) { | 4319 void WriteAlloc(Serializer* s) { |
4338 s->WriteCid(kTwoByteStringCid); | 4320 s->WriteCid(kTwoByteStringCid); |
4339 intptr_t count = objects_.length(); | 4321 intptr_t count = objects_.length(); |
4340 s->Write<int32_t>(count); | 4322 s->Write<int32_t>(count); |
(...skipping 19 matching lines...) Expand all Loading... |
4360 } | 4342 } |
4361 | 4343 |
4362 private: | 4344 private: |
4363 GrowableArray<RawTwoByteString*> objects_; | 4345 GrowableArray<RawTwoByteString*> objects_; |
4364 }; | 4346 }; |
4365 #endif // !DART_PRECOMPILED_RUNTIME | 4347 #endif // !DART_PRECOMPILED_RUNTIME |
4366 | 4348 |
4367 | 4349 |
4368 class TwoByteStringDeserializationCluster : public DeserializationCluster { | 4350 class TwoByteStringDeserializationCluster : public DeserializationCluster { |
4369 public: | 4351 public: |
4370 TwoByteStringDeserializationCluster() { } | 4352 TwoByteStringDeserializationCluster() {} |
4371 virtual ~TwoByteStringDeserializationCluster() { } | 4353 virtual ~TwoByteStringDeserializationCluster() {} |
4372 | 4354 |
4373 void ReadAlloc(Deserializer* d) { | 4355 void ReadAlloc(Deserializer* d) { |
4374 start_index_ = d->next_index(); | 4356 start_index_ = d->next_index(); |
4375 PageSpace* old_space = d->heap()->old_space(); | 4357 PageSpace* old_space = d->heap()->old_space(); |
4376 intptr_t count = d->Read<int32_t>(); | 4358 intptr_t count = d->Read<int32_t>(); |
4377 for (intptr_t i = 0; i < count; i++) { | 4359 for (intptr_t i = 0; i < count; i++) { |
4378 intptr_t length = d->Read<int32_t>(); | 4360 intptr_t length = d->Read<int32_t>(); |
4379 d->AssignRef(AllocateUninitialized(old_space, | 4361 d->AssignRef(AllocateUninitialized(old_space, |
4380 TwoByteString::InstanceSize(length))); | 4362 TwoByteString::InstanceSize(length))); |
4381 } | 4363 } |
4382 stop_index_ = d->next_index(); | 4364 stop_index_ = d->next_index(); |
4383 } | 4365 } |
4384 | 4366 |
4385 void ReadFill(Deserializer* d) { | 4367 void ReadFill(Deserializer* d) { |
4386 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 4368 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
4387 | 4369 |
4388 for (intptr_t id = start_index_; id < stop_index_; id++) { | 4370 for (intptr_t id = start_index_; id < stop_index_; id++) { |
4389 RawTwoByteString* str = | 4371 RawTwoByteString* str = reinterpret_cast<RawTwoByteString*>(d->Ref(id)); |
4390 reinterpret_cast<RawTwoByteString*>(d->Ref(id)); | |
4391 intptr_t length = d->Read<int32_t>(); | 4372 intptr_t length = d->Read<int32_t>(); |
4392 bool is_canonical = d->Read<bool>(); | 4373 bool is_canonical = d->Read<bool>(); |
4393 Deserializer::InitializeHeader(str, kTwoByteStringCid, | 4374 Deserializer::InitializeHeader(str, kTwoByteStringCid, |
4394 TwoByteString::InstanceSize(length), | 4375 TwoByteString::InstanceSize(length), |
4395 is_vm_object, is_canonical); | 4376 is_vm_object, is_canonical); |
4396 str->ptr()->length_ = Smi::New(length); | 4377 str->ptr()->length_ = Smi::New(length); |
4397 str->ptr()->hash_ = Smi::New(d->Read<int32_t>()); | 4378 str->ptr()->hash_ = Smi::New(d->Read<int32_t>()); |
4398 uint8_t* cdata = reinterpret_cast<uint8_t*>(str->ptr()->data()); | 4379 uint8_t* cdata = reinterpret_cast<uint8_t*>(str->ptr()->data()); |
4399 d->ReadBytes(cdata, length * 2); | 4380 d->ReadBytes(cdata, length * 2); |
4400 } | 4381 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4432 delete[] clusters_by_cid_; | 4413 delete[] clusters_by_cid_; |
4433 } | 4414 } |
4434 | 4415 |
4435 | 4416 |
4436 SerializationCluster* Serializer::NewClusterForClass(intptr_t cid) { | 4417 SerializationCluster* Serializer::NewClusterForClass(intptr_t cid) { |
4437 #if defined(DART_PRECOMPILED_RUNTIME) | 4418 #if defined(DART_PRECOMPILED_RUNTIME) |
4438 UNREACHABLE(); | 4419 UNREACHABLE(); |
4439 return NULL; | 4420 return NULL; |
4440 #else | 4421 #else |
4441 Zone* Z = zone_; | 4422 Zone* Z = zone_; |
4442 if ((cid >= kNumPredefinedCids) || | 4423 if ((cid >= kNumPredefinedCids) || (cid == kInstanceCid) || |
4443 (cid == kInstanceCid) || | |
4444 RawObject::IsTypedDataViewClassId(cid)) { | 4424 RawObject::IsTypedDataViewClassId(cid)) { |
4445 Push(isolate()->class_table()->At(cid)); | 4425 Push(isolate()->class_table()->At(cid)); |
4446 return new (Z) InstanceSerializationCluster(cid); | 4426 return new (Z) InstanceSerializationCluster(cid); |
4447 } | 4427 } |
4448 if (RawObject::IsExternalTypedDataClassId(cid)) { | 4428 if (RawObject::IsExternalTypedDataClassId(cid)) { |
4449 return new (Z) ExternalTypedDataSerializationCluster(cid); | 4429 return new (Z) ExternalTypedDataSerializationCluster(cid); |
4450 } | 4430 } |
4451 if (RawObject::IsTypedDataClassId(cid)) { | 4431 if (RawObject::IsTypedDataClassId(cid)) { |
4452 return new (Z) TypedDataSerializationCluster(cid); | 4432 return new (Z) TypedDataSerializationCluster(cid); |
4453 } | 4433 } |
4454 | 4434 |
4455 switch (cid) { | 4435 switch (cid) { |
4456 case kClassCid: return new (Z) ClassSerializationCluster(num_cids_); | 4436 case kClassCid: |
| 4437 return new (Z) ClassSerializationCluster(num_cids_); |
4457 case kUnresolvedClassCid: | 4438 case kUnresolvedClassCid: |
4458 return new (Z) UnresolvedClassSerializationCluster(); | 4439 return new (Z) UnresolvedClassSerializationCluster(); |
4459 case kTypeArgumentsCid: return new (Z) TypeArgumentsSerializationCluster(); | 4440 case kTypeArgumentsCid: |
4460 case kPatchClassCid: return new (Z) PatchClassSerializationCluster(); | 4441 return new (Z) TypeArgumentsSerializationCluster(); |
4461 case kFunctionCid: return new (Z) FunctionSerializationCluster(); | 4442 case kPatchClassCid: |
4462 case kClosureDataCid: return new (Z) ClosureDataSerializationCluster(); | 4443 return new (Z) PatchClassSerializationCluster(); |
| 4444 case kFunctionCid: |
| 4445 return new (Z) FunctionSerializationCluster(); |
| 4446 case kClosureDataCid: |
| 4447 return new (Z) ClosureDataSerializationCluster(); |
4463 case kRedirectionDataCid: | 4448 case kRedirectionDataCid: |
4464 return new (Z) RedirectionDataSerializationCluster(); | 4449 return new (Z) RedirectionDataSerializationCluster(); |
4465 case kFieldCid: return new (Z) FieldSerializationCluster(); | 4450 case kFieldCid: |
4466 case kLiteralTokenCid: return new (Z) LiteralTokenSerializationCluster(); | 4451 return new (Z) FieldSerializationCluster(); |
4467 case kTokenStreamCid: return new (Z) TokenStreamSerializationCluster(); | 4452 case kLiteralTokenCid: |
4468 case kScriptCid: return new (Z) ScriptSerializationCluster(); | 4453 return new (Z) LiteralTokenSerializationCluster(); |
4469 case kLibraryCid: return new (Z) LibrarySerializationCluster(); | 4454 case kTokenStreamCid: |
4470 case kNamespaceCid: return new (Z) NamespaceSerializationCluster(); | 4455 return new (Z) TokenStreamSerializationCluster(); |
4471 case kCodeCid: return new (Z) CodeSerializationCluster(); | 4456 case kScriptCid: |
4472 case kObjectPoolCid: return new (Z) ObjectPoolSerializationCluster(); | 4457 return new (Z) ScriptSerializationCluster(); |
| 4458 case kLibraryCid: |
| 4459 return new (Z) LibrarySerializationCluster(); |
| 4460 case kNamespaceCid: |
| 4461 return new (Z) NamespaceSerializationCluster(); |
| 4462 case kCodeCid: |
| 4463 return new (Z) CodeSerializationCluster(); |
| 4464 case kObjectPoolCid: |
| 4465 return new (Z) ObjectPoolSerializationCluster(); |
4473 case kPcDescriptorsCid: | 4466 case kPcDescriptorsCid: |
4474 return new (Z) RODataSerializationCluster(kPcDescriptorsCid); | 4467 return new (Z) RODataSerializationCluster(kPcDescriptorsCid); |
4475 case kStackmapCid: | 4468 case kStackmapCid: |
4476 return new (Z) RODataSerializationCluster(kStackmapCid); | 4469 return new (Z) RODataSerializationCluster(kStackmapCid); |
4477 case kExceptionHandlersCid: | 4470 case kExceptionHandlersCid: |
4478 return new (Z) ExceptionHandlersSerializationCluster(); | 4471 return new (Z) ExceptionHandlersSerializationCluster(); |
4479 case kContextCid: return new (Z) ContextSerializationCluster(); | 4472 case kContextCid: |
4480 case kContextScopeCid: return new (Z) ContextScopeSerializationCluster(); | 4473 return new (Z) ContextSerializationCluster(); |
4481 case kUnlinkedCallCid: return new (Z) UnlinkedCallSerializationCluster(); | 4474 case kContextScopeCid: |
4482 case kICDataCid: return new (Z) ICDataSerializationCluster(); | 4475 return new (Z) ContextScopeSerializationCluster(); |
| 4476 case kUnlinkedCallCid: |
| 4477 return new (Z) UnlinkedCallSerializationCluster(); |
| 4478 case kICDataCid: |
| 4479 return new (Z) ICDataSerializationCluster(); |
4483 case kMegamorphicCacheCid: | 4480 case kMegamorphicCacheCid: |
4484 return new (Z) MegamorphicCacheSerializationCluster(); | 4481 return new (Z) MegamorphicCacheSerializationCluster(); |
4485 case kSubtypeTestCacheCid: | 4482 case kSubtypeTestCacheCid: |
4486 return new (Z) SubtypeTestCacheSerializationCluster(); | 4483 return new (Z) SubtypeTestCacheSerializationCluster(); |
4487 case kLanguageErrorCid: | 4484 case kLanguageErrorCid: |
4488 return new (Z) LanguageErrorSerializationCluster(); | 4485 return new (Z) LanguageErrorSerializationCluster(); |
4489 case kUnhandledExceptionCid: | 4486 case kUnhandledExceptionCid: |
4490 return new (Z) UnhandledExceptionSerializationCluster(); | 4487 return new (Z) UnhandledExceptionSerializationCluster(); |
4491 case kLibraryPrefixCid: return new (Z) LibraryPrefixSerializationCluster(); | 4488 case kLibraryPrefixCid: |
4492 case kTypeCid: return new (Z) TypeSerializationCluster(); | 4489 return new (Z) LibraryPrefixSerializationCluster(); |
4493 case kTypeRefCid: return new (Z) TypeRefSerializationCluster(); | 4490 case kTypeCid: |
4494 case kTypeParameterCid: return new (Z) TypeParameterSerializationCluster(); | 4491 return new (Z) TypeSerializationCluster(); |
4495 case kBoundedTypeCid: return new (Z) BoundedTypeSerializationCluster(); | 4492 case kTypeRefCid: |
4496 case kClosureCid: return new (Z) ClosureSerializationCluster(); | 4493 return new (Z) TypeRefSerializationCluster(); |
4497 case kMintCid: return new (Z) MintSerializationCluster(); | 4494 case kTypeParameterCid: |
4498 case kBigintCid: return new (Z) BigintSerializationCluster(); | 4495 return new (Z) TypeParameterSerializationCluster(); |
4499 case kDoubleCid: return new (Z) DoubleSerializationCluster(); | 4496 case kBoundedTypeCid: |
| 4497 return new (Z) BoundedTypeSerializationCluster(); |
| 4498 case kClosureCid: |
| 4499 return new (Z) ClosureSerializationCluster(); |
| 4500 case kMintCid: |
| 4501 return new (Z) MintSerializationCluster(); |
| 4502 case kBigintCid: |
| 4503 return new (Z) BigintSerializationCluster(); |
| 4504 case kDoubleCid: |
| 4505 return new (Z) DoubleSerializationCluster(); |
4500 case kGrowableObjectArrayCid: | 4506 case kGrowableObjectArrayCid: |
4501 return new (Z) GrowableObjectArraySerializationCluster(); | 4507 return new (Z) GrowableObjectArraySerializationCluster(); |
4502 case kStacktraceCid: return new (Z) StacktraceSerializationCluster(); | 4508 case kStacktraceCid: |
4503 case kRegExpCid: return new (Z) RegExpSerializationCluster(); | 4509 return new (Z) StacktraceSerializationCluster(); |
4504 case kWeakPropertyCid: return new (Z) WeakPropertySerializationCluster(); | 4510 case kRegExpCid: |
4505 case kLinkedHashMapCid: return new (Z) LinkedHashMapSerializationCluster(); | 4511 return new (Z) RegExpSerializationCluster(); |
| 4512 case kWeakPropertyCid: |
| 4513 return new (Z) WeakPropertySerializationCluster(); |
| 4514 case kLinkedHashMapCid: |
| 4515 return new (Z) LinkedHashMapSerializationCluster(); |
4506 case kArrayCid: | 4516 case kArrayCid: |
4507 return new (Z) ArraySerializationCluster(kArrayCid); | 4517 return new (Z) ArraySerializationCluster(kArrayCid); |
4508 case kImmutableArrayCid: | 4518 case kImmutableArrayCid: |
4509 return new (Z) ArraySerializationCluster(kImmutableArrayCid); | 4519 return new (Z) ArraySerializationCluster(kImmutableArrayCid); |
4510 case kOneByteStringCid: { | 4520 case kOneByteStringCid: { |
4511 if (Snapshot::IncludesCode(kind_)) { | 4521 if (Snapshot::IncludesCode(kind_)) { |
4512 return new (Z) RODataSerializationCluster(kOneByteStringCid); | 4522 return new (Z) RODataSerializationCluster(kOneByteStringCid); |
4513 } else { | 4523 } else { |
4514 return new (Z) OneByteStringSerializationCluster(); | 4524 return new (Z) OneByteStringSerializationCluster(); |
4515 } | 4525 } |
4516 } | 4526 } |
4517 case kTwoByteStringCid: { | 4527 case kTwoByteStringCid: { |
4518 if (Snapshot::IncludesCode(kind_)) { | 4528 if (Snapshot::IncludesCode(kind_)) { |
4519 return new (Z) RODataSerializationCluster(kTwoByteStringCid); | 4529 return new (Z) RODataSerializationCluster(kTwoByteStringCid); |
4520 } else { | 4530 } else { |
4521 return new (Z) TwoByteStringSerializationCluster(); | 4531 return new (Z) TwoByteStringSerializationCluster(); |
4522 } | 4532 } |
4523 } | 4533 } |
4524 default: break; | 4534 default: |
| 4535 break; |
4525 } | 4536 } |
4526 | 4537 |
4527 FATAL1("No cluster defined for cid %" Pd, cid); | 4538 FATAL1("No cluster defined for cid %" Pd, cid); |
4528 return NULL; | 4539 return NULL; |
4529 #endif // !DART_PRECOMPILED_RUNTIME | 4540 #endif // !DART_PRECOMPILED_RUNTIME |
4530 } | 4541 } |
4531 | 4542 |
4532 | 4543 |
4533 void Serializer::Trace(RawObject* object) { | 4544 void Serializer::Trace(RawObject* object) { |
4534 intptr_t cid; | 4545 intptr_t cid; |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4757 | 4768 |
4758 Deserializer::~Deserializer() { | 4769 Deserializer::~Deserializer() { |
4759 delete[] clusters_; | 4770 delete[] clusters_; |
4760 } | 4771 } |
4761 | 4772 |
4762 | 4773 |
4763 DeserializationCluster* Deserializer::ReadCluster() { | 4774 DeserializationCluster* Deserializer::ReadCluster() { |
4764 intptr_t cid = ReadCid(); | 4775 intptr_t cid = ReadCid(); |
4765 | 4776 |
4766 Zone* Z = zone_; | 4777 Zone* Z = zone_; |
4767 if ((cid >= kNumPredefinedCids) || | 4778 if ((cid >= kNumPredefinedCids) || (cid == kInstanceCid) || |
4768 (cid == kInstanceCid) || | |
4769 RawObject::IsTypedDataViewClassId(cid)) { | 4779 RawObject::IsTypedDataViewClassId(cid)) { |
4770 return new (Z) InstanceDeserializationCluster(cid); | 4780 return new (Z) InstanceDeserializationCluster(cid); |
4771 } | 4781 } |
4772 if (RawObject::IsExternalTypedDataClassId(cid)) { | 4782 if (RawObject::IsExternalTypedDataClassId(cid)) { |
4773 return new (Z) ExternalTypedDataDeserializationCluster(cid); | 4783 return new (Z) ExternalTypedDataDeserializationCluster(cid); |
4774 } | 4784 } |
4775 if (RawObject::IsTypedDataClassId(cid)) { | 4785 if (RawObject::IsTypedDataClassId(cid)) { |
4776 return new (Z) TypedDataDeserializationCluster(cid); | 4786 return new (Z) TypedDataDeserializationCluster(cid); |
4777 } | 4787 } |
4778 | 4788 |
4779 switch (cid) { | 4789 switch (cid) { |
4780 case kClassCid: return new (Z) ClassDeserializationCluster(); | 4790 case kClassCid: |
| 4791 return new (Z) ClassDeserializationCluster(); |
4781 case kUnresolvedClassCid: | 4792 case kUnresolvedClassCid: |
4782 return new (Z) UnresolvedClassDeserializationCluster(); | 4793 return new (Z) UnresolvedClassDeserializationCluster(); |
4783 case kTypeArgumentsCid: | 4794 case kTypeArgumentsCid: |
4784 return new (Z) TypeArgumentsDeserializationCluster(); | 4795 return new (Z) TypeArgumentsDeserializationCluster(); |
4785 case kPatchClassCid: return new (Z) PatchClassDeserializationCluster(); | 4796 case kPatchClassCid: |
4786 case kFunctionCid: return new (Z) FunctionDeserializationCluster(); | 4797 return new (Z) PatchClassDeserializationCluster(); |
4787 case kClosureDataCid: return new (Z) ClosureDataDeserializationCluster(); | 4798 case kFunctionCid: |
| 4799 return new (Z) FunctionDeserializationCluster(); |
| 4800 case kClosureDataCid: |
| 4801 return new (Z) ClosureDataDeserializationCluster(); |
4788 case kRedirectionDataCid: | 4802 case kRedirectionDataCid: |
4789 return new (Z) RedirectionDataDeserializationCluster(); | 4803 return new (Z) RedirectionDataDeserializationCluster(); |
4790 case kFieldCid: return new (Z) FieldDeserializationCluster(); | 4804 case kFieldCid: |
4791 case kLiteralTokenCid: return new (Z) LiteralTokenDeserializationCluster(); | 4805 return new (Z) FieldDeserializationCluster(); |
4792 case kTokenStreamCid: return new (Z) TokenStreamDeserializationCluster(); | 4806 case kLiteralTokenCid: |
4793 case kScriptCid: return new (Z) ScriptDeserializationCluster(); | 4807 return new (Z) LiteralTokenDeserializationCluster(); |
4794 case kLibraryCid: return new (Z) LibraryDeserializationCluster(); | 4808 case kTokenStreamCid: |
4795 case kNamespaceCid: return new (Z) NamespaceDeserializationCluster(); | 4809 return new (Z) TokenStreamDeserializationCluster(); |
4796 case kCodeCid: return new (Z) CodeDeserializationCluster(); | 4810 case kScriptCid: |
4797 case kObjectPoolCid: return new (Z) ObjectPoolDeserializationCluster(); | 4811 return new (Z) ScriptDeserializationCluster(); |
| 4812 case kLibraryCid: |
| 4813 return new (Z) LibraryDeserializationCluster(); |
| 4814 case kNamespaceCid: |
| 4815 return new (Z) NamespaceDeserializationCluster(); |
| 4816 case kCodeCid: |
| 4817 return new (Z) CodeDeserializationCluster(); |
| 4818 case kObjectPoolCid: |
| 4819 return new (Z) ObjectPoolDeserializationCluster(); |
4798 case kPcDescriptorsCid: | 4820 case kPcDescriptorsCid: |
4799 case kStackmapCid: | 4821 case kStackmapCid: |
4800 return new (Z) RODataDeserializationCluster(); | 4822 return new (Z) RODataDeserializationCluster(); |
4801 case kExceptionHandlersCid: | 4823 case kExceptionHandlersCid: |
4802 return new (Z) ExceptionHandlersDeserializationCluster(); | 4824 return new (Z) ExceptionHandlersDeserializationCluster(); |
4803 case kContextCid: return new (Z) ContextDeserializationCluster(); | 4825 case kContextCid: |
4804 case kContextScopeCid: return new (Z) ContextScopeDeserializationCluster(); | 4826 return new (Z) ContextDeserializationCluster(); |
4805 case kUnlinkedCallCid: return new (Z) UnlinkedCallDeserializationCluster(); | 4827 case kContextScopeCid: |
4806 case kICDataCid: return new (Z) ICDataDeserializationCluster(); | 4828 return new (Z) ContextScopeDeserializationCluster(); |
| 4829 case kUnlinkedCallCid: |
| 4830 return new (Z) UnlinkedCallDeserializationCluster(); |
| 4831 case kICDataCid: |
| 4832 return new (Z) ICDataDeserializationCluster(); |
4807 case kMegamorphicCacheCid: | 4833 case kMegamorphicCacheCid: |
4808 return new (Z) MegamorphicCacheDeserializationCluster(); | 4834 return new (Z) MegamorphicCacheDeserializationCluster(); |
4809 case kSubtypeTestCacheCid: | 4835 case kSubtypeTestCacheCid: |
4810 return new (Z) SubtypeTestCacheDeserializationCluster(); | 4836 return new (Z) SubtypeTestCacheDeserializationCluster(); |
4811 case kLanguageErrorCid: | 4837 case kLanguageErrorCid: |
4812 return new (Z) LanguageErrorDeserializationCluster(); | 4838 return new (Z) LanguageErrorDeserializationCluster(); |
4813 case kUnhandledExceptionCid: | 4839 case kUnhandledExceptionCid: |
4814 return new (Z) UnhandledExceptionDeserializationCluster(); | 4840 return new (Z) UnhandledExceptionDeserializationCluster(); |
4815 case kLibraryPrefixCid: | 4841 case kLibraryPrefixCid: |
4816 return new (Z) LibraryPrefixDeserializationCluster(); | 4842 return new (Z) LibraryPrefixDeserializationCluster(); |
4817 case kTypeCid: return new (Z) TypeDeserializationCluster(); | 4843 case kTypeCid: |
4818 case kTypeRefCid: return new (Z) TypeRefDeserializationCluster(); | 4844 return new (Z) TypeDeserializationCluster(); |
| 4845 case kTypeRefCid: |
| 4846 return new (Z) TypeRefDeserializationCluster(); |
4819 case kTypeParameterCid: | 4847 case kTypeParameterCid: |
4820 return new (Z) TypeParameterDeserializationCluster(); | 4848 return new (Z) TypeParameterDeserializationCluster(); |
4821 case kBoundedTypeCid: return new (Z) BoundedTypeDeserializationCluster(); | 4849 case kBoundedTypeCid: |
4822 case kClosureCid: return new (Z) ClosureDeserializationCluster(); | 4850 return new (Z) BoundedTypeDeserializationCluster(); |
4823 case kMintCid: return new (Z) MintDeserializationCluster(); | 4851 case kClosureCid: |
4824 case kBigintCid: return new (Z) BigintDeserializationCluster(); | 4852 return new (Z) ClosureDeserializationCluster(); |
4825 case kDoubleCid: return new (Z) DoubleDeserializationCluster(); | 4853 case kMintCid: |
| 4854 return new (Z) MintDeserializationCluster(); |
| 4855 case kBigintCid: |
| 4856 return new (Z) BigintDeserializationCluster(); |
| 4857 case kDoubleCid: |
| 4858 return new (Z) DoubleDeserializationCluster(); |
4826 case kGrowableObjectArrayCid: | 4859 case kGrowableObjectArrayCid: |
4827 return new (Z) GrowableObjectArrayDeserializationCluster(); | 4860 return new (Z) GrowableObjectArrayDeserializationCluster(); |
4828 case kStacktraceCid: return new (Z) StacktraceDeserializationCluster(); | 4861 case kStacktraceCid: |
4829 case kRegExpCid: return new (Z) RegExpDeserializationCluster(); | 4862 return new (Z) StacktraceDeserializationCluster(); |
4830 case kWeakPropertyCid: return new (Z) WeakPropertyDeserializationCluster(); | 4863 case kRegExpCid: |
| 4864 return new (Z) RegExpDeserializationCluster(); |
| 4865 case kWeakPropertyCid: |
| 4866 return new (Z) WeakPropertyDeserializationCluster(); |
4831 case kLinkedHashMapCid: | 4867 case kLinkedHashMapCid: |
4832 return new (Z) LinkedHashMapDeserializationCluster(); | 4868 return new (Z) LinkedHashMapDeserializationCluster(); |
4833 case kArrayCid: | 4869 case kArrayCid: |
4834 return new (Z) ArrayDeserializationCluster(kArrayCid); | 4870 return new (Z) ArrayDeserializationCluster(kArrayCid); |
4835 case kImmutableArrayCid: | 4871 case kImmutableArrayCid: |
4836 return new (Z) ArrayDeserializationCluster(kImmutableArrayCid); | 4872 return new (Z) ArrayDeserializationCluster(kImmutableArrayCid); |
4837 case kOneByteStringCid: { | 4873 case kOneByteStringCid: { |
4838 if (Snapshot::IncludesCode(kind_)) { | 4874 if (Snapshot::IncludesCode(kind_)) { |
4839 return new (Z) RODataDeserializationCluster(); | 4875 return new (Z) RODataDeserializationCluster(); |
4840 } else { | 4876 } else { |
4841 return new (Z) OneByteStringDeserializationCluster(); | 4877 return new (Z) OneByteStringDeserializationCluster(); |
4842 } | 4878 } |
4843 } | 4879 } |
4844 case kTwoByteStringCid: { | 4880 case kTwoByteStringCid: { |
4845 if (Snapshot::IncludesCode(kind_)) { | 4881 if (Snapshot::IncludesCode(kind_)) { |
4846 return new (Z) RODataDeserializationCluster(); | 4882 return new (Z) RODataDeserializationCluster(); |
4847 } else { | 4883 } else { |
4848 return new (Z) TwoByteStringDeserializationCluster(); | 4884 return new (Z) TwoByteStringDeserializationCluster(); |
4849 } | 4885 } |
4850 } | 4886 } |
4851 default: break; | 4887 default: |
| 4888 break; |
4852 } | 4889 } |
4853 FATAL1("No cluster defined for cid %" Pd, cid); | 4890 FATAL1("No cluster defined for cid %" Pd, cid); |
4854 return NULL; | 4891 return NULL; |
4855 } | 4892 } |
4856 | 4893 |
4857 | 4894 |
4858 RawApiError* Deserializer::VerifyVersionAndFeatures() { | 4895 RawApiError* Deserializer::VerifyVersionAndFeatures() { |
4859 // If the version string doesn't match, return an error. | 4896 // If the version string doesn't match, return an error. |
4860 // Note: New things are allocated only if we're going to return an error. | 4897 // Note: New things are allocated only if we're going to return an error. |
4861 | 4898 |
4862 const char* expected_version = Version::SnapshotString(); | 4899 const char* expected_version = Version::SnapshotString(); |
4863 ASSERT(expected_version != NULL); | 4900 ASSERT(expected_version != NULL); |
4864 const intptr_t version_len = strlen(expected_version); | 4901 const intptr_t version_len = strlen(expected_version); |
4865 if (PendingBytes() < version_len) { | 4902 if (PendingBytes() < version_len) { |
4866 const intptr_t kMessageBufferSize = 128; | 4903 const intptr_t kMessageBufferSize = 128; |
4867 char message_buffer[kMessageBufferSize]; | 4904 char message_buffer[kMessageBufferSize]; |
4868 OS::SNPrint(message_buffer, | 4905 OS::SNPrint(message_buffer, kMessageBufferSize, |
4869 kMessageBufferSize, | |
4870 "No full snapshot version found, expected '%s'", | 4906 "No full snapshot version found, expected '%s'", |
4871 expected_version); | 4907 expected_version); |
4872 // This can also fail while bringing up the VM isolate, so make sure to | 4908 // This can also fail while bringing up the VM isolate, so make sure to |
4873 // allocate the error message in old space. | 4909 // allocate the error message in old space. |
4874 const String& msg = String::Handle(String::New(message_buffer, Heap::kOld)); | 4910 const String& msg = String::Handle(String::New(message_buffer, Heap::kOld)); |
4875 return ApiError::New(msg, Heap::kOld); | 4911 return ApiError::New(msg, Heap::kOld); |
4876 } | 4912 } |
4877 | 4913 |
4878 const char* version = reinterpret_cast<const char*>(CurrentBufferAddress()); | 4914 const char* version = reinterpret_cast<const char*>(CurrentBufferAddress()); |
4879 ASSERT(version != NULL); | 4915 ASSERT(version != NULL); |
4880 if (strncmp(version, expected_version, version_len)) { | 4916 if (strncmp(version, expected_version, version_len)) { |
4881 const intptr_t kMessageBufferSize = 256; | 4917 const intptr_t kMessageBufferSize = 256; |
4882 char message_buffer[kMessageBufferSize]; | 4918 char message_buffer[kMessageBufferSize]; |
4883 char* actual_version = OS::StrNDup(version, version_len); | 4919 char* actual_version = OS::StrNDup(version, version_len); |
4884 OS::SNPrint(message_buffer, | 4920 OS::SNPrint(message_buffer, kMessageBufferSize, |
4885 kMessageBufferSize, | |
4886 "Wrong %s snapshot version, expected '%s' found '%s'", | 4921 "Wrong %s snapshot version, expected '%s' found '%s'", |
4887 (Snapshot::IsFull(kind_)) ? "full" : "script", | 4922 (Snapshot::IsFull(kind_)) ? "full" : "script", expected_version, |
4888 expected_version, | |
4889 actual_version); | 4923 actual_version); |
4890 free(actual_version); | 4924 free(actual_version); |
4891 // This can also fail while bringing up the VM isolate, so make sure to | 4925 // This can also fail while bringing up the VM isolate, so make sure to |
4892 // allocate the error message in old space. | 4926 // allocate the error message in old space. |
4893 const String& msg = String::Handle(String::New(message_buffer, Heap::kOld)); | 4927 const String& msg = String::Handle(String::New(message_buffer, Heap::kOld)); |
4894 return ApiError::New(msg, Heap::kOld); | 4928 return ApiError::New(msg, Heap::kOld); |
4895 } | 4929 } |
4896 Advance(version_len); | 4930 Advance(version_len); |
4897 | 4931 |
4898 const char* expected_features = Dart::FeaturesString(kind_); | 4932 const char* expected_features = Dart::FeaturesString(kind_); |
4899 ASSERT(expected_features != NULL); | 4933 ASSERT(expected_features != NULL); |
4900 const intptr_t expected_len = strlen(expected_features); | 4934 const intptr_t expected_len = strlen(expected_features); |
4901 | 4935 |
4902 const char* features = reinterpret_cast<const char*>(CurrentBufferAddress()); | 4936 const char* features = reinterpret_cast<const char*>(CurrentBufferAddress()); |
4903 ASSERT(features != NULL); | 4937 ASSERT(features != NULL); |
4904 intptr_t buffer_len = OS::StrNLen(features, PendingBytes()); | 4938 intptr_t buffer_len = OS::StrNLen(features, PendingBytes()); |
4905 if ((buffer_len != expected_len) || | 4939 if ((buffer_len != expected_len) || |
4906 strncmp(features, expected_features, expected_len)) { | 4940 strncmp(features, expected_features, expected_len)) { |
4907 const intptr_t kMessageBufferSize = 256; | 4941 const intptr_t kMessageBufferSize = 256; |
4908 char message_buffer[kMessageBufferSize]; | 4942 char message_buffer[kMessageBufferSize]; |
4909 char* actual_features = OS::StrNDup(features, buffer_len < 128 ? buffer_len | 4943 char* actual_features = |
4910 : 128); | 4944 OS::StrNDup(features, buffer_len < 128 ? buffer_len : 128); |
4911 OS::SNPrint(message_buffer, | 4945 OS::SNPrint(message_buffer, kMessageBufferSize, |
4912 kMessageBufferSize, | |
4913 "Wrong features in snapshot, expected '%s' found '%s'", | 4946 "Wrong features in snapshot, expected '%s' found '%s'", |
4914 expected_features, | 4947 expected_features, actual_features); |
4915 actual_features); | |
4916 free(const_cast<char*>(expected_features)); | 4948 free(const_cast<char*>(expected_features)); |
4917 free(actual_features); | 4949 free(actual_features); |
4918 // This can also fail while bringing up the VM isolate, so make sure to | 4950 // This can also fail while bringing up the VM isolate, so make sure to |
4919 // allocate the error message in old space. | 4951 // allocate the error message in old space. |
4920 const String& msg = String::Handle(String::New(message_buffer, Heap::kOld)); | 4952 const String& msg = String::Handle(String::New(message_buffer, Heap::kOld)); |
4921 return ApiError::New(msg, Heap::kOld); | 4953 return ApiError::New(msg, Heap::kOld); |
4922 } | 4954 } |
4923 free(const_cast<char*>(expected_features)); | 4955 free(const_cast<char*>(expected_features)); |
4924 Advance(expected_len + 1); | 4956 Advance(expected_len + 1); |
4925 return ApiError::null(); | 4957 return ApiError::null(); |
4926 } | 4958 } |
4927 | 4959 |
4928 | 4960 |
4929 void Deserializer::Prepare() { | 4961 void Deserializer::Prepare() { |
4930 num_objects_ = Read<int32_t>(); | 4962 num_objects_ = Read<int32_t>(); |
4931 num_clusters_ = Read<int32_t>(); | 4963 num_clusters_ = Read<int32_t>(); |
4932 | 4964 |
4933 clusters_ = new DeserializationCluster*[num_clusters_]; | 4965 clusters_ = new DeserializationCluster*[num_clusters_]; |
4934 refs_ = Array::New(num_objects_ + 1, Heap::kOld); | 4966 refs_ = Array::New(num_objects_ + 1, Heap::kOld); |
4935 } | 4967 } |
4936 | 4968 |
4937 | 4969 |
4938 void Deserializer::Deserialize() { | 4970 void Deserializer::Deserialize() { |
4939 // TODO(rmacnak): Verify num of base objects. | 4971 // TODO(rmacnak): Verify num of base objects. |
4940 | 4972 |
4941 { | 4973 { |
4942 NOT_IN_PRODUCT(TimelineDurationScope tds(thread(), | 4974 NOT_IN_PRODUCT(TimelineDurationScope tds( |
4943 Timeline::GetIsolateStream(), "ReadAlloc")); | 4975 thread(), Timeline::GetIsolateStream(), "ReadAlloc")); |
4944 for (intptr_t i = 0; i < num_clusters_; i++) { | 4976 for (intptr_t i = 0; i < num_clusters_; i++) { |
4945 clusters_[i] = ReadCluster(); | 4977 clusters_[i] = ReadCluster(); |
4946 clusters_[i]->ReadAlloc(this); | 4978 clusters_[i]->ReadAlloc(this); |
4947 #if defined(DEBUG) | 4979 #if defined(DEBUG) |
4948 intptr_t serializers_next_ref_index_ = Read<int32_t>(); | 4980 intptr_t serializers_next_ref_index_ = Read<int32_t>(); |
4949 ASSERT(serializers_next_ref_index_ == next_ref_index_); | 4981 ASSERT(serializers_next_ref_index_ == next_ref_index_); |
4950 #endif | 4982 #endif |
4951 } | 4983 } |
4952 } | 4984 } |
4953 | 4985 |
4954 // We should have completely filled the ref array. | 4986 // We should have completely filled the ref array. |
4955 ASSERT((next_ref_index_ - 1) == num_objects_); | 4987 ASSERT((next_ref_index_ - 1) == num_objects_); |
4956 | 4988 |
4957 { | 4989 { |
4958 NOT_IN_PRODUCT(TimelineDurationScope tds(thread(), | 4990 NOT_IN_PRODUCT(TimelineDurationScope tds( |
4959 Timeline::GetIsolateStream(), "ReadFill")); | 4991 thread(), Timeline::GetIsolateStream(), "ReadFill")); |
4960 for (intptr_t i = 0; i < num_clusters_; i++) { | 4992 for (intptr_t i = 0; i < num_clusters_; i++) { |
4961 clusters_[i]->ReadFill(this); | 4993 clusters_[i]->ReadFill(this); |
4962 #if defined(DEBUG) | 4994 #if defined(DEBUG) |
4963 int32_t section_marker = Read<int32_t>(); | 4995 int32_t section_marker = Read<int32_t>(); |
4964 ASSERT(section_marker == kSectionMarker); | 4996 ASSERT(section_marker == kSectionMarker); |
4965 #endif | 4997 #endif |
4966 } | 4998 } |
4967 } | 4999 } |
4968 } | 5000 } |
4969 | 5001 |
4970 class HeapLocker : public StackResource { | 5002 class HeapLocker : public StackResource { |
4971 public: | 5003 public: |
4972 HeapLocker(Thread* thread, PageSpace* page_space) | 5004 HeapLocker(Thread* thread, PageSpace* page_space) |
4973 : StackResource(thread), page_space_(page_space) { | 5005 : StackResource(thread), page_space_(page_space) { |
4974 page_space_->AcquireDataLock(); | 5006 page_space_->AcquireDataLock(); |
4975 } | 5007 } |
4976 ~HeapLocker() { | 5008 ~HeapLocker() { page_space_->ReleaseDataLock(); } |
4977 page_space_->ReleaseDataLock(); | |
4978 } | |
4979 | 5009 |
4980 private: | 5010 private: |
4981 PageSpace* page_space_; | 5011 PageSpace* page_space_; |
4982 }; | 5012 }; |
4983 | 5013 |
4984 | 5014 |
4985 void Deserializer::AddVMIsolateBaseObjects() { | 5015 void Deserializer::AddVMIsolateBaseObjects() { |
4986 // These objects are always allocated by Object::InitOnce, so they are not | 5016 // These objects are always allocated by Object::InitOnce, so they are not |
4987 // written into the snapshot. | 5017 // written into the snapshot. |
4988 | 5018 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5093 refs_ = NULL; | 5123 refs_ = NULL; |
5094 } | 5124 } |
5095 | 5125 |
5096 #if defined(DEBUG) | 5126 #if defined(DEBUG) |
5097 Isolate* isolate = thread()->isolate(); | 5127 Isolate* isolate = thread()->isolate(); |
5098 isolate->ValidateClassTable(); | 5128 isolate->ValidateClassTable(); |
5099 isolate->heap()->Verify(); | 5129 isolate->heap()->Verify(); |
5100 #endif | 5130 #endif |
5101 | 5131 |
5102 { | 5132 { |
5103 NOT_IN_PRODUCT(TimelineDurationScope tds(thread(), | 5133 NOT_IN_PRODUCT(TimelineDurationScope tds( |
5104 Timeline::GetIsolateStream(), "PostLoad")); | 5134 thread(), Timeline::GetIsolateStream(), "PostLoad")); |
5105 for (intptr_t i = 0; i < num_clusters_; i++) { | 5135 for (intptr_t i = 0; i < num_clusters_; i++) { |
5106 clusters_[i]->PostLoad(refs, kind_, zone_); | 5136 clusters_[i]->PostLoad(refs, kind_, zone_); |
5107 } | 5137 } |
5108 } | 5138 } |
5109 | 5139 |
5110 // Setup native resolver for bootstrap impl. | 5140 // Setup native resolver for bootstrap impl. |
5111 Bootstrap::SetupNativeResolver(); | 5141 Bootstrap::SetupNativeResolver(); |
5112 } | 5142 } |
5113 | 5143 |
5114 | 5144 |
5115 // An object visitor which will iterate over all the token stream objects in the | 5145 // An object visitor which will iterate over all the token stream objects in the |
5116 // heap and either count them or collect them into an array. This is used during | 5146 // heap and either count them or collect them into an array. This is used during |
5117 // full snapshot generation of the VM isolate to write out all token streams so | 5147 // full snapshot generation of the VM isolate to write out all token streams so |
5118 // they will be shared across all isolates. | 5148 // they will be shared across all isolates. |
5119 class SnapshotTokenStreamVisitor : public ObjectVisitor { | 5149 class SnapshotTokenStreamVisitor : public ObjectVisitor { |
5120 public: | 5150 public: |
5121 explicit SnapshotTokenStreamVisitor(Thread* thread) : | 5151 explicit SnapshotTokenStreamVisitor(Thread* thread) |
5122 objHandle_(Object::Handle(thread->zone())), | 5152 : objHandle_(Object::Handle(thread->zone())), |
5123 count_(0), | 5153 count_(0), |
5124 token_streams_(NULL) {} | 5154 token_streams_(NULL) {} |
5125 | 5155 |
5126 SnapshotTokenStreamVisitor(Thread* thread, const Array* token_streams) : | 5156 SnapshotTokenStreamVisitor(Thread* thread, const Array* token_streams) |
5127 objHandle_(Object::Handle(thread->zone())), | 5157 : objHandle_(Object::Handle(thread->zone())), |
5128 count_(0), | 5158 count_(0), |
5129 token_streams_(token_streams) {} | 5159 token_streams_(token_streams) {} |
5130 | 5160 |
5131 void VisitObject(RawObject* obj) { | 5161 void VisitObject(RawObject* obj) { |
5132 if (obj->IsTokenStream()) { | 5162 if (obj->IsTokenStream()) { |
5133 if (token_streams_ != NULL) { | 5163 if (token_streams_ != NULL) { |
5134 objHandle_ = obj; | 5164 objHandle_ = obj; |
5135 token_streams_->SetAt(count_, objHandle_); | 5165 token_streams_->SetAt(count_, objHandle_); |
5136 } | 5166 } |
5137 count_ += 1; | 5167 count_ += 1; |
5138 } | 5168 } |
5139 } | 5169 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5173 ASSERT(object_store != NULL); | 5203 ASSERT(object_store != NULL); |
5174 | 5204 |
5175 #if defined(DEBUG) | 5205 #if defined(DEBUG) |
5176 // Ensure the class table is valid. | 5206 // Ensure the class table is valid. |
5177 isolate()->ValidateClassTable(); | 5207 isolate()->ValidateClassTable(); |
5178 #endif | 5208 #endif |
5179 // Can't have any mutation happening while we're serializing. | 5209 // Can't have any mutation happening while we're serializing. |
5180 ASSERT(isolate()->background_compiler() == NULL); | 5210 ASSERT(isolate()->background_compiler() == NULL); |
5181 | 5211 |
5182 if (vm_isolate_snapshot_buffer != NULL) { | 5212 if (vm_isolate_snapshot_buffer != NULL) { |
5183 NOT_IN_PRODUCT(TimelineDurationScope tds(thread(), | 5213 NOT_IN_PRODUCT(TimelineDurationScope tds( |
5184 Timeline::GetIsolateStream(), "PrepareNewVMIsolate")); | 5214 thread(), Timeline::GetIsolateStream(), "PrepareNewVMIsolate")); |
5185 | 5215 |
5186 // Collect all the token stream objects into an array so that we can write | 5216 // Collect all the token stream objects into an array so that we can write |
5187 // it out as part of the VM isolate snapshot. We first count the number of | 5217 // it out as part of the VM isolate snapshot. We first count the number of |
5188 // token streams, allocate an array and then fill it up with the token | 5218 // token streams, allocate an array and then fill it up with the token |
5189 // streams. | 5219 // streams. |
5190 SnapshotTokenStreamVisitor token_streams_counter(thread()); | 5220 SnapshotTokenStreamVisitor token_streams_counter(thread()); |
5191 heap()->IterateOldObjects(&token_streams_counter); | 5221 heap()->IterateOldObjects(&token_streams_counter); |
5192 Dart::vm_isolate()->heap()->IterateOldObjects(&token_streams_counter); | 5222 Dart::vm_isolate()->heap()->IterateOldObjects(&token_streams_counter); |
5193 intptr_t count = token_streams_counter.count(); | 5223 intptr_t count = token_streams_counter.count(); |
5194 token_streams_ = Array::New(count, Heap::kOld); | 5224 token_streams_ = Array::New(count, Heap::kOld); |
(...skipping 22 matching lines...) Expand all Loading... |
5217 if (!saved_symbol_table_.IsNull()) { | 5247 if (!saved_symbol_table_.IsNull()) { |
5218 isolate()->object_store()->set_symbol_table(saved_symbol_table_); | 5248 isolate()->object_store()->set_symbol_table(saved_symbol_table_); |
5219 saved_symbol_table_ = Array::null(); | 5249 saved_symbol_table_ = Array::null(); |
5220 } | 5250 } |
5221 new_vm_symbol_table_ = Array::null(); | 5251 new_vm_symbol_table_ = Array::null(); |
5222 token_streams_ = Array::null(); | 5252 token_streams_ = Array::null(); |
5223 } | 5253 } |
5224 | 5254 |
5225 | 5255 |
5226 intptr_t FullSnapshotWriter::WriteVmIsolateSnapshot() { | 5256 intptr_t FullSnapshotWriter::WriteVmIsolateSnapshot() { |
5227 NOT_IN_PRODUCT(TimelineDurationScope tds(thread(), | 5257 NOT_IN_PRODUCT(TimelineDurationScope tds( |
5228 Timeline::GetIsolateStream(), "WriteVmIsolateSnapshot")); | 5258 thread(), Timeline::GetIsolateStream(), "WriteVmIsolateSnapshot")); |
5229 | 5259 |
5230 ASSERT(vm_isolate_snapshot_buffer_ != NULL); | 5260 ASSERT(vm_isolate_snapshot_buffer_ != NULL); |
5231 Serializer serializer(thread(), | 5261 Serializer serializer(thread(), kind_, vm_isolate_snapshot_buffer_, alloc_, |
5232 kind_, | 5262 kInitialSize, instructions_writer_); |
5233 vm_isolate_snapshot_buffer_, | |
5234 alloc_, | |
5235 kInitialSize, | |
5236 instructions_writer_); | |
5237 | 5263 |
5238 serializer.ReserveHeader(); | 5264 serializer.ReserveHeader(); |
5239 serializer.WriteVersionAndFeatures(); | 5265 serializer.WriteVersionAndFeatures(); |
5240 /* | 5266 /* |
5241 * Now Write out the following | 5267 * Now Write out the following |
5242 * - the symbol table | 5268 * - the symbol table |
5243 * - all the token streams | 5269 * - all the token streams |
5244 * - the stub code (precompiled snapshots only) | 5270 * - the stub code (precompiled snapshots only) |
5245 **/ | 5271 **/ |
5246 intptr_t num_objects = serializer.WriteVMSnapshot(new_vm_symbol_table_, | 5272 intptr_t num_objects = |
5247 token_streams_); | 5273 serializer.WriteVMSnapshot(new_vm_symbol_table_, token_streams_); |
5248 serializer.FillHeader(serializer.kind()); | 5274 serializer.FillHeader(serializer.kind()); |
5249 | 5275 |
5250 vm_isolate_snapshot_size_ = serializer.bytes_written(); | 5276 vm_isolate_snapshot_size_ = serializer.bytes_written(); |
5251 return num_objects; | 5277 return num_objects; |
5252 } | 5278 } |
5253 | 5279 |
5254 | 5280 |
5255 void FullSnapshotWriter::WriteIsolateFullSnapshot( | 5281 void FullSnapshotWriter::WriteIsolateFullSnapshot(intptr_t num_base_objects) { |
5256 intptr_t num_base_objects) { | 5282 NOT_IN_PRODUCT(TimelineDurationScope tds( |
5257 NOT_IN_PRODUCT(TimelineDurationScope tds(thread(), | 5283 thread(), Timeline::GetIsolateStream(), "WriteIsolateFullSnapshot")); |
5258 Timeline::GetIsolateStream(), "WriteIsolateFullSnapshot")); | |
5259 | 5284 |
5260 Serializer serializer(thread(), | 5285 Serializer serializer(thread(), kind_, isolate_snapshot_buffer_, alloc_, |
5261 kind_, | 5286 kInitialSize, instructions_writer_); |
5262 isolate_snapshot_buffer_, | |
5263 alloc_, | |
5264 kInitialSize, | |
5265 instructions_writer_); | |
5266 ObjectStore* object_store = isolate()->object_store(); | 5287 ObjectStore* object_store = isolate()->object_store(); |
5267 ASSERT(object_store != NULL); | 5288 ASSERT(object_store != NULL); |
5268 | 5289 |
5269 serializer.ReserveHeader(); | 5290 serializer.ReserveHeader(); |
5270 serializer.WriteVersionAndFeatures(); | 5291 serializer.WriteVersionAndFeatures(); |
5271 serializer.WriteFullSnapshot(num_base_objects, object_store); | 5292 serializer.WriteFullSnapshot(num_base_objects, object_store); |
5272 serializer.FillHeader(serializer.kind()); | 5293 serializer.FillHeader(serializer.kind()); |
5273 | 5294 |
5274 isolate_snapshot_size_ = serializer.bytes_written(); | 5295 isolate_snapshot_size_ = serializer.bytes_written(); |
5275 } | 5296 } |
5276 | 5297 |
5277 | 5298 |
5278 void FullSnapshotWriter::WriteFullSnapshot() { | 5299 void FullSnapshotWriter::WriteFullSnapshot() { |
5279 intptr_t num_base_objects; | 5300 intptr_t num_base_objects; |
5280 if (vm_isolate_snapshot_buffer() != NULL) { | 5301 if (vm_isolate_snapshot_buffer() != NULL) { |
5281 num_base_objects = WriteVmIsolateSnapshot(); | 5302 num_base_objects = WriteVmIsolateSnapshot(); |
5282 ASSERT(num_base_objects != 0); | 5303 ASSERT(num_base_objects != 0); |
5283 } else { | 5304 } else { |
5284 num_base_objects = 0; | 5305 num_base_objects = 0; |
5285 } | 5306 } |
5286 | 5307 |
5287 WriteIsolateFullSnapshot(num_base_objects); | 5308 WriteIsolateFullSnapshot(num_base_objects); |
5288 | 5309 |
5289 if (Snapshot::IncludesCode(kind_)) { | 5310 if (Snapshot::IncludesCode(kind_)) { |
5290 instructions_writer_->Write(*vm_isolate_snapshot_buffer_, | 5311 instructions_writer_->Write( |
5291 vm_isolate_snapshot_size_, | 5312 *vm_isolate_snapshot_buffer_, vm_isolate_snapshot_size_, |
5292 *isolate_snapshot_buffer_, | 5313 *isolate_snapshot_buffer_, isolate_snapshot_size_); |
5293 isolate_snapshot_size_); | |
5294 | 5314 |
5295 OS::Print("VMIsolate(CodeSize): %" Pd "\n", VmIsolateSnapshotSize()); | 5315 OS::Print("VMIsolate(CodeSize): %" Pd "\n", VmIsolateSnapshotSize()); |
5296 OS::Print("Isolate(CodeSize): %" Pd "\n", IsolateSnapshotSize()); | 5316 OS::Print("Isolate(CodeSize): %" Pd "\n", IsolateSnapshotSize()); |
5297 OS::Print("ReadOnlyData(CodeSize): %" Pd "\n", | 5317 OS::Print("ReadOnlyData(CodeSize): %" Pd "\n", |
5298 instructions_writer_->data_size()); | 5318 instructions_writer_->data_size()); |
5299 OS::Print("Instructions(CodeSize): %" Pd "\n", | 5319 OS::Print("Instructions(CodeSize): %" Pd "\n", |
5300 instructions_writer_->text_size()); | 5320 instructions_writer_->text_size()); |
5301 intptr_t total = VmIsolateSnapshotSize() + | 5321 intptr_t total = VmIsolateSnapshotSize() + IsolateSnapshotSize() + |
5302 IsolateSnapshotSize() + | |
5303 instructions_writer_->data_size() + | 5322 instructions_writer_->data_size() + |
5304 instructions_writer_->text_size(); | 5323 instructions_writer_->text_size(); |
5305 OS::Print("Total(CodeSize): %" Pd "\n", total); | 5324 OS::Print("Total(CodeSize): %" Pd "\n", total); |
5306 } | 5325 } |
5307 } | 5326 } |
5308 | 5327 |
5309 | 5328 |
5310 RawApiError* IsolateSnapshotReader::ReadFullSnapshot() { | 5329 RawApiError* IsolateSnapshotReader::ReadFullSnapshot() { |
5311 Deserializer deserializer(thread_, | 5330 Deserializer deserializer(thread_, kind_, buffer_, size_, |
5312 kind_, | 5331 instructions_buffer_, data_buffer_); |
5313 buffer_, | |
5314 size_, | |
5315 instructions_buffer_, | |
5316 data_buffer_); | |
5317 | 5332 |
5318 RawApiError* error = deserializer.VerifyVersionAndFeatures(); | 5333 RawApiError* error = deserializer.VerifyVersionAndFeatures(); |
5319 if (error != ApiError::null()) { | 5334 if (error != ApiError::null()) { |
5320 return error; | 5335 return error; |
5321 } | 5336 } |
5322 | 5337 |
5323 deserializer.ReadFullSnapshot(thread_->isolate()->object_store()); | 5338 deserializer.ReadFullSnapshot(thread_->isolate()->object_store()); |
5324 | 5339 |
5325 return ApiError::null(); | 5340 return ApiError::null(); |
5326 } | 5341 } |
5327 | 5342 |
5328 | 5343 |
5329 RawApiError* VmIsolateSnapshotReader::ReadVmIsolateSnapshot() { | 5344 RawApiError* VmIsolateSnapshotReader::ReadVmIsolateSnapshot() { |
5330 Deserializer deserializer(thread_, | 5345 Deserializer deserializer(thread_, kind_, buffer_, size_, |
5331 kind_, | 5346 instructions_buffer_, data_buffer_); |
5332 buffer_, | |
5333 size_, | |
5334 instructions_buffer_, | |
5335 data_buffer_); | |
5336 | 5347 |
5337 RawApiError* error = deserializer.VerifyVersionAndFeatures(); | 5348 RawApiError* error = deserializer.VerifyVersionAndFeatures(); |
5338 if (error != ApiError::null()) { | 5349 if (error != ApiError::null()) { |
5339 return error; | 5350 return error; |
5340 } | 5351 } |
5341 | 5352 |
5342 deserializer.ReadVMSnapshot(); | 5353 deserializer.ReadVMSnapshot(); |
5343 | 5354 |
5344 Dart::set_instructions_snapshot_buffer(instructions_buffer_); | 5355 Dart::set_instructions_snapshot_buffer(instructions_buffer_); |
5345 Dart::set_data_snapshot_buffer(data_buffer_); | 5356 Dart::set_data_snapshot_buffer(data_buffer_); |
5346 | 5357 |
5347 return ApiError::null(); | 5358 return ApiError::null(); |
5348 } | 5359 } |
5349 | 5360 |
5350 } // namespace dart | 5361 } // namespace dart |
OLD | NEW |