Chromium Code Reviews| 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" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 RawObject** from = cls->from(); | 71 RawObject** from = cls->from(); |
| 72 RawObject** to = cls->to_snapshot(s->kind()); | 72 RawObject** to = cls->to_snapshot(s->kind()); |
| 73 for (RawObject** p = from; p <= to; p++) { | 73 for (RawObject** p = from; p <= to; p++) { |
| 74 s->Push(*p); | 74 s->Push(*p); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 void WriteAlloc(Serializer* s) { | 78 void WriteAlloc(Serializer* s) { |
| 79 s->WriteCid(kClassCid); | 79 s->WriteCid(kClassCid); |
| 80 intptr_t count = predefined_.length(); | 80 intptr_t count = predefined_.length(); |
| 81 s->Write<intptr_t>(count); | 81 s->Write<int32_t>(count); |
| 82 for (intptr_t i = 0; i < count; i++) { | 82 for (intptr_t i = 0; i < count; i++) { |
| 83 RawClass* cls = predefined_[i]; | 83 RawClass* cls = predefined_[i]; |
| 84 intptr_t class_id = cls->ptr()->id_; | 84 intptr_t class_id = cls->ptr()->id_; |
| 85 s->Write<intptr_t>(class_id); | 85 s->WriteCid(class_id); |
| 86 s->AssignRef(cls); | 86 s->AssignRef(cls); |
| 87 } | 87 } |
| 88 count = objects_.length(); | 88 count = objects_.length(); |
| 89 s->Write<intptr_t>(count); | 89 s->Write<int32_t>(count); |
| 90 for (intptr_t i = 0; i < count; i++) { | 90 for (intptr_t i = 0; i < count; i++) { |
| 91 RawClass* cls = objects_[i]; | 91 RawClass* cls = objects_[i]; |
| 92 s->AssignRef(cls); | 92 s->AssignRef(cls); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 void WriteFill(Serializer* s) { | 96 void WriteFill(Serializer* s) { |
| 97 intptr_t count = predefined_.length(); | 97 intptr_t count = predefined_.length(); |
| 98 for (intptr_t i = 0; i < count; i++) { | 98 for (intptr_t i = 0; i < count; i++) { |
| 99 WriteClass(s, predefined_[i]); | 99 WriteClass(s, predefined_[i]); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 130 | 130 |
| 131 | 131 |
| 132 class ClassDeserializationCluster : public DeserializationCluster { | 132 class ClassDeserializationCluster : public DeserializationCluster { |
| 133 public: | 133 public: |
| 134 ClassDeserializationCluster() { } | 134 ClassDeserializationCluster() { } |
| 135 virtual ~ClassDeserializationCluster() { } | 135 virtual ~ClassDeserializationCluster() { } |
| 136 | 136 |
| 137 void ReadAlloc(Deserializer* d) { | 137 void ReadAlloc(Deserializer* d) { |
| 138 predefined_start_index_ = d->next_index(); | 138 predefined_start_index_ = d->next_index(); |
| 139 PageSpace* old_space = d->heap()->old_space(); | 139 PageSpace* old_space = d->heap()->old_space(); |
| 140 intptr_t count = d->Read<intptr_t>(); | 140 intptr_t count = d->Read<int32_t>(); |
| 141 ClassTable* table = d->isolate()->class_table(); | 141 ClassTable* table = d->isolate()->class_table(); |
| 142 for (intptr_t i = 0; i < count; i++) { | 142 for (intptr_t i = 0; i < count; i++) { |
| 143 intptr_t class_id = d->Read<intptr_t>(); | 143 intptr_t class_id = d->ReadCid(); |
| 144 ASSERT(table->HasValidClassAt(class_id)); | 144 ASSERT(table->HasValidClassAt(class_id)); |
| 145 RawClass* cls = table->At(class_id); | 145 RawClass* cls = table->At(class_id); |
| 146 ASSERT(cls != NULL); | 146 ASSERT(cls != NULL); |
| 147 d->AssignRef(cls); | 147 d->AssignRef(cls); |
| 148 } | 148 } |
| 149 predefined_stop_index_ = d->next_index(); | 149 predefined_stop_index_ = d->next_index(); |
| 150 | 150 |
| 151 start_index_ = d->next_index(); | 151 start_index_ = d->next_index(); |
| 152 count = d->Read<intptr_t>(); | 152 count = d->Read<int32_t>(); |
| 153 for (intptr_t i = 0; i < count; i++) { | 153 for (intptr_t i = 0; i < count; i++) { |
| 154 d->AssignRef(AllocateUninitialized(old_space, | 154 d->AssignRef(AllocateUninitialized(old_space, |
| 155 Class::InstanceSize())); | 155 Class::InstanceSize())); |
| 156 } | 156 } |
| 157 stop_index_ = d->next_index(); | 157 stop_index_ = d->next_index(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void ReadFill(Deserializer* d) { | 160 void ReadFill(Deserializer* d) { |
| 161 Snapshot::Kind kind = d->kind(); | 161 Snapshot::Kind kind = d->kind(); |
| 162 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 162 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 163 ClassTable* table = d->isolate()->class_table(); | 163 ClassTable* table = d->isolate()->class_table(); |
| 164 | 164 |
| 165 for (intptr_t id = predefined_start_index_; | 165 for (intptr_t id = predefined_start_index_; |
| 166 id < predefined_stop_index_; | 166 id < predefined_stop_index_; |
| 167 id++) { | 167 id++) { |
| 168 RawClass* cls = reinterpret_cast<RawClass*>(d->Ref(id)); | 168 RawClass* cls = reinterpret_cast<RawClass*>(d->Ref(id)); |
| 169 RawObject** from = cls->from(); | 169 RawObject** from = cls->from(); |
| 170 RawObject** to_snapshot = cls->to_snapshot(kind); | 170 RawObject** to_snapshot = cls->to_snapshot(kind); |
| 171 for (RawObject** p = from; p <= to_snapshot; p++) { | 171 for (RawObject** p = from; p <= to_snapshot; p++) { |
| 172 *p = d->ReadRef(); | 172 *p = d->ReadRef(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 intptr_t class_id = d->ReadCid(); | 175 intptr_t class_id = d->ReadCid(); |
| 176 cls->ptr()->id_ = class_id; | 176 cls->ptr()->id_ = class_id; |
| 177 cls->ptr()->instance_size_in_words_ = d->Read<int32_t>(); | 177 if (!RawObject::IsInternalVMdefinedClassId(class_id)) { |
| 178 cls->ptr()->next_field_offset_in_words_ = d->Read<int32_t>(); | 178 cls->ptr()->instance_size_in_words_ = d->Read<int32_t>(); |
| 179 cls->ptr()->next_field_offset_in_words_ = d->Read<int32_t>(); | |
| 180 } else { | |
| 181 d->Read<int32_t>(); // Skip. | |
| 182 d->Read<int32_t>(); // Skip. | |
| 183 } | |
| 179 cls->ptr()->type_arguments_field_offset_in_words_ = d->Read<int32_t>(); | 184 cls->ptr()->type_arguments_field_offset_in_words_ = d->Read<int32_t>(); |
| 180 cls->ptr()->num_type_arguments_ = d->Read<uint16_t>(); | 185 cls->ptr()->num_type_arguments_ = d->Read<uint16_t>(); |
| 181 cls->ptr()->num_own_type_arguments_ = d->Read<uint16_t>(); | 186 cls->ptr()->num_own_type_arguments_ = d->Read<uint16_t>(); |
| 182 cls->ptr()->num_native_fields_ = d->Read<uint16_t>(); | 187 cls->ptr()->num_native_fields_ = d->Read<uint16_t>(); |
| 183 cls->ptr()->token_pos_ = d->ReadTokenPosition(); | 188 cls->ptr()->token_pos_ = d->ReadTokenPosition(); |
| 184 cls->ptr()->state_bits_ = d->Read<uint16_t>(); | 189 cls->ptr()->state_bits_ = d->Read<uint16_t>(); |
| 185 } | 190 } |
| 186 | 191 |
| 187 for (intptr_t id = start_index_; id < stop_index_; id++) { | 192 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| 188 RawClass* cls = reinterpret_cast<RawClass*>(d->Ref(id)); | 193 RawClass* cls = reinterpret_cast<RawClass*>(d->Ref(id)); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 RawObject** from = cls->from(); | 259 RawObject** from = cls->from(); |
| 255 RawObject** to = cls->to(); | 260 RawObject** to = cls->to(); |
| 256 for (RawObject** p = from; p <= to; p++) { | 261 for (RawObject** p = from; p <= to; p++) { |
| 257 s->Push(*p); | 262 s->Push(*p); |
| 258 } | 263 } |
| 259 } | 264 } |
| 260 | 265 |
| 261 void WriteAlloc(Serializer* s) { | 266 void WriteAlloc(Serializer* s) { |
| 262 s->WriteCid(kUnresolvedClassCid); | 267 s->WriteCid(kUnresolvedClassCid); |
| 263 intptr_t count = objects_.length(); | 268 intptr_t count = objects_.length(); |
| 264 s->Write<intptr_t>(count); | 269 s->Write<int32_t>(count); |
| 265 for (intptr_t i = 0; i < count; i++) { | 270 for (intptr_t i = 0; i < count; i++) { |
| 266 RawUnresolvedClass* cls = objects_[i]; | 271 RawUnresolvedClass* cls = objects_[i]; |
| 267 s->AssignRef(cls); | 272 s->AssignRef(cls); |
| 268 } | 273 } |
| 269 } | 274 } |
| 270 | 275 |
| 271 void WriteFill(Serializer* s) { | 276 void WriteFill(Serializer* s) { |
| 272 intptr_t count = objects_.length(); | 277 intptr_t count = objects_.length(); |
| 273 s->Write<intptr_t>(count); | 278 s->Write<int32_t>(count); |
| 274 for (intptr_t i = 0; i < count; i++) { | 279 for (intptr_t i = 0; i < count; i++) { |
| 275 RawUnresolvedClass* cls = objects_[i]; | 280 RawUnresolvedClass* cls = objects_[i]; |
| 276 RawObject** from = cls->from(); | 281 RawObject** from = cls->from(); |
| 277 RawObject** to = cls->to(); | 282 RawObject** to = cls->to(); |
| 278 for (RawObject** p = from; p <= to; p++) { | 283 for (RawObject** p = from; p <= to; p++) { |
| 279 s->WriteRef(*p); | 284 s->WriteRef(*p); |
| 280 } | 285 } |
| 281 s->WriteTokenPosition(cls->ptr()->token_pos_); | 286 s->WriteTokenPosition(cls->ptr()->token_pos_); |
| 282 } | 287 } |
| 283 } | 288 } |
| 284 | 289 |
| 285 private: | 290 private: |
| 286 GrowableArray<RawUnresolvedClass*> objects_; | 291 GrowableArray<RawUnresolvedClass*> objects_; |
| 287 }; | 292 }; |
| 288 | 293 |
| 289 | 294 |
| 290 class UnresolvedClassDeserializationCluster : public DeserializationCluster { | 295 class UnresolvedClassDeserializationCluster : public DeserializationCluster { |
| 291 public: | 296 public: |
| 292 UnresolvedClassDeserializationCluster() { } | 297 UnresolvedClassDeserializationCluster() { } |
| 293 virtual ~UnresolvedClassDeserializationCluster() { } | 298 virtual ~UnresolvedClassDeserializationCluster() { } |
| 294 | 299 |
| 295 void ReadAlloc(Deserializer* d) { | 300 void ReadAlloc(Deserializer* d) { |
| 296 start_index_ = d->next_index(); | 301 start_index_ = d->next_index(); |
| 297 PageSpace* old_space = d->heap()->old_space(); | 302 PageSpace* old_space = d->heap()->old_space(); |
| 298 intptr_t count = d->Read<intptr_t>(); | 303 intptr_t count = d->Read<int32_t>(); |
| 299 for (intptr_t i = 0; i < count; i++) { | 304 for (intptr_t i = 0; i < count; i++) { |
| 300 d->AssignRef(AllocateUninitialized(old_space, | 305 d->AssignRef(AllocateUninitialized(old_space, |
| 301 UnresolvedClass::InstanceSize())); | 306 UnresolvedClass::InstanceSize())); |
| 302 } | 307 } |
| 303 stop_index_ = d->next_index(); | 308 stop_index_ = d->next_index(); |
| 304 } | 309 } |
| 305 | 310 |
| 306 void ReadFill(Deserializer* d) { | 311 void ReadFill(Deserializer* d) { |
| 307 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 312 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 308 | 313 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 335 s->Push(type_args->ptr()->instantiations_); | 340 s->Push(type_args->ptr()->instantiations_); |
| 336 intptr_t length = Smi::Value(type_args->ptr()->length_); | 341 intptr_t length = Smi::Value(type_args->ptr()->length_); |
| 337 for (intptr_t i = 0; i < length; i++) { | 342 for (intptr_t i = 0; i < length; i++) { |
| 338 s->Push(type_args->ptr()->types()[i]); | 343 s->Push(type_args->ptr()->types()[i]); |
| 339 } | 344 } |
| 340 } | 345 } |
| 341 | 346 |
| 342 void WriteAlloc(Serializer* s) { | 347 void WriteAlloc(Serializer* s) { |
| 343 s->WriteCid(kTypeArgumentsCid); | 348 s->WriteCid(kTypeArgumentsCid); |
| 344 intptr_t count = objects_.length(); | 349 intptr_t count = objects_.length(); |
| 345 s->Write<intptr_t>(count); | 350 s->Write<int32_t>(count); |
|
siva
2016/07/08 16:25:20
How do you ensure that the count of objects being
rmacnak
2016/07/08 18:08:58
Added check in Serializer::Serialize()
| |
| 346 for (intptr_t i = 0; i < count; i++) { | 351 for (intptr_t i = 0; i < count; i++) { |
| 347 RawTypeArguments* type_args = objects_[i]; | 352 RawTypeArguments* type_args = objects_[i]; |
| 348 intptr_t length = Smi::Value(type_args->ptr()->length_); | 353 intptr_t length = Smi::Value(type_args->ptr()->length_); |
| 349 s->Write<intptr_t>(length); | 354 s->Write<int32_t>(length); |
| 350 s->AssignRef(type_args); | 355 s->AssignRef(type_args); |
| 351 } | 356 } |
| 352 } | 357 } |
| 353 | 358 |
| 354 void WriteFill(Serializer* s) { | 359 void WriteFill(Serializer* s) { |
| 355 intptr_t count = objects_.length(); | 360 intptr_t count = objects_.length(); |
| 356 for (intptr_t i = 0; i < count; i++) { | 361 for (intptr_t i = 0; i < count; i++) { |
| 357 RawTypeArguments* type_args = objects_[i]; | 362 RawTypeArguments* type_args = objects_[i]; |
| 358 intptr_t length = Smi::Value(type_args->ptr()->length_); | 363 intptr_t length = Smi::Value(type_args->ptr()->length_); |
| 359 s->Write<intptr_t>(length); | 364 s->Write<int32_t>(length); |
| 360 s->Write<bool>(type_args->IsCanonical()); | 365 s->Write<bool>(type_args->IsCanonical()); |
| 361 intptr_t hash = Smi::Value(type_args->ptr()->hash_); | 366 intptr_t hash = Smi::Value(type_args->ptr()->hash_); |
| 362 s->Write<int32_t>(hash); | 367 s->Write<int32_t>(hash); |
| 363 s->WriteRef(type_args->ptr()->instantiations_); | 368 s->WriteRef(type_args->ptr()->instantiations_); |
| 364 for (intptr_t j = 0; j < length; j++) { | 369 for (intptr_t j = 0; j < length; j++) { |
| 365 s->WriteRef(type_args->ptr()->types()[j]); | 370 s->WriteRef(type_args->ptr()->types()[j]); |
| 366 } | 371 } |
| 367 } | 372 } |
| 368 } | 373 } |
| 369 | 374 |
| 370 private: | 375 private: |
| 371 GrowableArray<RawTypeArguments*> objects_; | 376 GrowableArray<RawTypeArguments*> objects_; |
| 372 }; | 377 }; |
| 373 | 378 |
| 374 | 379 |
| 375 class TypeArgumentsDeserializationCluster : public DeserializationCluster { | 380 class TypeArgumentsDeserializationCluster : public DeserializationCluster { |
| 376 public: | 381 public: |
| 377 TypeArgumentsDeserializationCluster() { } | 382 TypeArgumentsDeserializationCluster() { } |
| 378 virtual ~TypeArgumentsDeserializationCluster() { } | 383 virtual ~TypeArgumentsDeserializationCluster() { } |
| 379 | 384 |
| 380 void ReadAlloc(Deserializer* d) { | 385 void ReadAlloc(Deserializer* d) { |
| 381 start_index_ = d->next_index(); | 386 start_index_ = d->next_index(); |
| 382 PageSpace* old_space = d->heap()->old_space(); | 387 PageSpace* old_space = d->heap()->old_space(); |
| 383 intptr_t count = d->Read<intptr_t>(); | 388 intptr_t count = d->Read<int32_t>(); |
| 384 for (intptr_t i = 0; i < count; i++) { | 389 for (intptr_t i = 0; i < count; i++) { |
| 385 intptr_t length = d->Read<intptr_t>(); | 390 intptr_t length = d->Read<int32_t>(); |
| 386 d->AssignRef(AllocateUninitialized(old_space, | 391 d->AssignRef(AllocateUninitialized(old_space, |
| 387 TypeArguments::InstanceSize(length))); | 392 TypeArguments::InstanceSize(length))); |
| 388 } | 393 } |
| 389 stop_index_ = d->next_index(); | 394 stop_index_ = d->next_index(); |
| 390 } | 395 } |
| 391 | 396 |
| 392 void ReadFill(Deserializer* d) { | 397 void ReadFill(Deserializer* d) { |
| 393 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 398 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 394 | 399 |
| 395 for (intptr_t id = start_index_; id < stop_index_; id++) { | 400 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| 396 RawTypeArguments* type_args = | 401 RawTypeArguments* type_args = |
| 397 reinterpret_cast<RawTypeArguments*>(d->Ref(id)); | 402 reinterpret_cast<RawTypeArguments*>(d->Ref(id)); |
| 398 intptr_t length = d->Read<intptr_t>(); | 403 intptr_t length = d->Read<int32_t>(); |
| 399 bool is_canonical = d->Read<bool>(); | 404 bool is_canonical = d->Read<bool>(); |
| 400 Deserializer::InitializeHeader(type_args, kTypeArgumentsCid, | 405 Deserializer::InitializeHeader(type_args, kTypeArgumentsCid, |
| 401 TypeArguments::InstanceSize(length), | 406 TypeArguments::InstanceSize(length), |
| 402 is_vm_object, is_canonical); | 407 is_vm_object, is_canonical); |
| 403 type_args->ptr()->length_ = Smi::New(length); | 408 type_args->ptr()->length_ = Smi::New(length); |
| 404 type_args->ptr()->hash_ = Smi::New(d->Read<int32_t>()); | 409 type_args->ptr()->hash_ = Smi::New(d->Read<int32_t>()); |
| 405 type_args->ptr()->instantiations_ = | 410 type_args->ptr()->instantiations_ = |
| 406 reinterpret_cast<RawArray*>(d->ReadRef()); | 411 reinterpret_cast<RawArray*>(d->ReadRef()); |
| 407 for (intptr_t j = 0; j < length; j++) { | 412 for (intptr_t j = 0; j < length; j++) { |
| 408 type_args->ptr()->types()[j] = | 413 type_args->ptr()->types()[j] = |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 425 RawObject** from = cls->from(); | 430 RawObject** from = cls->from(); |
| 426 RawObject** to = cls->to(); | 431 RawObject** to = cls->to(); |
| 427 for (RawObject** p = from; p <= to; p++) { | 432 for (RawObject** p = from; p <= to; p++) { |
| 428 s->Push(*p); | 433 s->Push(*p); |
| 429 } | 434 } |
| 430 } | 435 } |
| 431 | 436 |
| 432 void WriteAlloc(Serializer* s) { | 437 void WriteAlloc(Serializer* s) { |
| 433 s->WriteCid(kPatchClassCid); | 438 s->WriteCid(kPatchClassCid); |
| 434 intptr_t count = objects_.length(); | 439 intptr_t count = objects_.length(); |
| 435 s->Write<intptr_t>(count); | 440 s->Write<int32_t>(count); |
| 436 for (intptr_t i = 0; i < count; i++) { | 441 for (intptr_t i = 0; i < count; i++) { |
| 437 RawPatchClass* cls = objects_[i]; | 442 RawPatchClass* cls = objects_[i]; |
| 438 s->AssignRef(cls); | 443 s->AssignRef(cls); |
| 439 } | 444 } |
| 440 } | 445 } |
| 441 | 446 |
| 442 void WriteFill(Serializer* s) { | 447 void WriteFill(Serializer* s) { |
| 443 intptr_t count = objects_.length(); | 448 intptr_t count = objects_.length(); |
| 444 for (intptr_t i = 0; i < count; i++) { | 449 for (intptr_t i = 0; i < count; i++) { |
| 445 RawPatchClass* cls = objects_[i]; | 450 RawPatchClass* cls = objects_[i]; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 457 | 462 |
| 458 | 463 |
| 459 class PatchClassDeserializationCluster : public DeserializationCluster { | 464 class PatchClassDeserializationCluster : public DeserializationCluster { |
| 460 public: | 465 public: |
| 461 PatchClassDeserializationCluster() { } | 466 PatchClassDeserializationCluster() { } |
| 462 virtual ~PatchClassDeserializationCluster() { } | 467 virtual ~PatchClassDeserializationCluster() { } |
| 463 | 468 |
| 464 void ReadAlloc(Deserializer* d) { | 469 void ReadAlloc(Deserializer* d) { |
| 465 start_index_ = d->next_index(); | 470 start_index_ = d->next_index(); |
| 466 PageSpace* old_space = d->heap()->old_space(); | 471 PageSpace* old_space = d->heap()->old_space(); |
| 467 intptr_t count = d->Read<intptr_t>(); | 472 intptr_t count = d->Read<int32_t>(); |
| 468 for (intptr_t i = 0; i < count; i++) { | 473 for (intptr_t i = 0; i < count; i++) { |
| 469 d->AssignRef(AllocateUninitialized(old_space, | 474 d->AssignRef(AllocateUninitialized(old_space, |
| 470 PatchClass::InstanceSize())); | 475 PatchClass::InstanceSize())); |
| 471 } | 476 } |
| 472 stop_index_ = d->next_index(); | 477 stop_index_ = d->next_index(); |
| 473 } | 478 } |
| 474 | 479 |
| 475 void ReadFill(Deserializer* d) { | 480 void ReadFill(Deserializer* d) { |
| 476 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 481 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 477 | 482 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 507 s->Push(func->ptr()->code_); | 512 s->Push(func->ptr()->code_); |
| 508 } else if (s->kind() == Snapshot::kAppWithJIT) { | 513 } else if (s->kind() == Snapshot::kAppWithJIT) { |
| 509 s->Push(func->ptr()->unoptimized_code_); | 514 s->Push(func->ptr()->unoptimized_code_); |
| 510 s->Push(func->ptr()->ic_data_array_); | 515 s->Push(func->ptr()->ic_data_array_); |
| 511 } | 516 } |
| 512 } | 517 } |
| 513 | 518 |
| 514 void WriteAlloc(Serializer* s) { | 519 void WriteAlloc(Serializer* s) { |
| 515 s->WriteCid(kFunctionCid); | 520 s->WriteCid(kFunctionCid); |
| 516 intptr_t count = objects_.length(); | 521 intptr_t count = objects_.length(); |
| 517 s->Write<intptr_t>(count); | 522 s->Write<int32_t>(count); |
| 518 for (intptr_t i = 0; i < count; i++) { | 523 for (intptr_t i = 0; i < count; i++) { |
| 519 RawFunction* func = objects_[i]; | 524 RawFunction* func = objects_[i]; |
| 520 s->AssignRef(func); | 525 s->AssignRef(func); |
| 521 } | 526 } |
| 522 } | 527 } |
| 523 | 528 |
| 524 void WriteFill(Serializer* s) { | 529 void WriteFill(Serializer* s) { |
| 525 Snapshot::Kind kind = s->kind(); | 530 Snapshot::Kind kind = s->kind(); |
| 526 intptr_t count = objects_.length(); | 531 intptr_t count = objects_.length(); |
| 527 for (intptr_t i = 0; i < count; i++) { | 532 for (intptr_t i = 0; i < count; i++) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 565 | 570 |
| 566 | 571 |
| 567 class FunctionDeserializationCluster : public DeserializationCluster { | 572 class FunctionDeserializationCluster : public DeserializationCluster { |
| 568 public: | 573 public: |
| 569 FunctionDeserializationCluster() { } | 574 FunctionDeserializationCluster() { } |
| 570 virtual ~FunctionDeserializationCluster() { } | 575 virtual ~FunctionDeserializationCluster() { } |
| 571 | 576 |
| 572 void ReadAlloc(Deserializer* d) { | 577 void ReadAlloc(Deserializer* d) { |
| 573 start_index_ = d->next_index(); | 578 start_index_ = d->next_index(); |
| 574 PageSpace* old_space = d->heap()->old_space(); | 579 PageSpace* old_space = d->heap()->old_space(); |
| 575 intptr_t count = d->Read<intptr_t>(); | 580 intptr_t count = d->Read<int32_t>(); |
| 576 for (intptr_t i = 0; i < count; i++) { | 581 for (intptr_t i = 0; i < count; i++) { |
| 577 d->AssignRef(AllocateUninitialized(old_space, | 582 d->AssignRef(AllocateUninitialized(old_space, |
| 578 Function::InstanceSize())); | 583 Function::InstanceSize())); |
| 579 } | 584 } |
| 580 stop_index_ = d->next_index(); | 585 stop_index_ = d->next_index(); |
| 581 } | 586 } |
| 582 | 587 |
| 583 void ReadFill(Deserializer* d) { | 588 void ReadFill(Deserializer* d) { |
| 584 Snapshot::Kind kind = d->kind(); | 589 Snapshot::Kind kind = d->kind(); |
| 585 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 590 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 677 RawObject** from = data->from(); | 682 RawObject** from = data->from(); |
| 678 RawObject** to = data->to(); | 683 RawObject** to = data->to(); |
| 679 for (RawObject** p = from; p <= to; p++) { | 684 for (RawObject** p = from; p <= to; p++) { |
| 680 s->Push(*p); | 685 s->Push(*p); |
| 681 } | 686 } |
| 682 } | 687 } |
| 683 | 688 |
| 684 void WriteAlloc(Serializer* s) { | 689 void WriteAlloc(Serializer* s) { |
| 685 s->WriteCid(kClosureDataCid); | 690 s->WriteCid(kClosureDataCid); |
| 686 intptr_t count = objects_.length(); | 691 intptr_t count = objects_.length(); |
| 687 s->Write<intptr_t>(count); | 692 s->Write<int32_t>(count); |
| 688 for (intptr_t i = 0; i < count; i++) { | 693 for (intptr_t i = 0; i < count; i++) { |
| 689 RawClosureData* data = objects_[i]; | 694 RawClosureData* data = objects_[i]; |
| 690 s->AssignRef(data); | 695 s->AssignRef(data); |
| 691 } | 696 } |
| 692 } | 697 } |
| 693 | 698 |
| 694 void WriteFill(Serializer* s) { | 699 void WriteFill(Serializer* s) { |
| 695 intptr_t count = objects_.length(); | 700 intptr_t count = objects_.length(); |
| 696 for (intptr_t i = 0; i < count; i++) { | 701 for (intptr_t i = 0; i < count; i++) { |
| 697 RawClosureData* data = objects_[i]; | 702 RawClosureData* data = objects_[i]; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 709 | 714 |
| 710 | 715 |
| 711 class ClosureDataDeserializationCluster : public DeserializationCluster { | 716 class ClosureDataDeserializationCluster : public DeserializationCluster { |
| 712 public: | 717 public: |
| 713 ClosureDataDeserializationCluster() { } | 718 ClosureDataDeserializationCluster() { } |
| 714 virtual ~ClosureDataDeserializationCluster() { } | 719 virtual ~ClosureDataDeserializationCluster() { } |
| 715 | 720 |
| 716 void ReadAlloc(Deserializer* d) { | 721 void ReadAlloc(Deserializer* d) { |
| 717 start_index_ = d->next_index(); | 722 start_index_ = d->next_index(); |
| 718 PageSpace* old_space = d->heap()->old_space(); | 723 PageSpace* old_space = d->heap()->old_space(); |
| 719 intptr_t count = d->Read<intptr_t>(); | 724 intptr_t count = d->Read<int32_t>(); |
| 720 for (intptr_t i = 0; i < count; i++) { | 725 for (intptr_t i = 0; i < count; i++) { |
| 721 d->AssignRef(AllocateUninitialized(old_space, | 726 d->AssignRef(AllocateUninitialized(old_space, |
| 722 ClosureData::InstanceSize())); | 727 ClosureData::InstanceSize())); |
| 723 } | 728 } |
| 724 stop_index_ = d->next_index(); | 729 stop_index_ = d->next_index(); |
| 725 } | 730 } |
| 726 | 731 |
| 727 void ReadFill(Deserializer* d) { | 732 void ReadFill(Deserializer* d) { |
| 728 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 733 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 729 | 734 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 753 RawObject** from = data->from(); | 758 RawObject** from = data->from(); |
| 754 RawObject** to = data->to(); | 759 RawObject** to = data->to(); |
| 755 for (RawObject** p = from; p <= to; p++) { | 760 for (RawObject** p = from; p <= to; p++) { |
| 756 s->Push(*p); | 761 s->Push(*p); |
| 757 } | 762 } |
| 758 } | 763 } |
| 759 | 764 |
| 760 void WriteAlloc(Serializer* s) { | 765 void WriteAlloc(Serializer* s) { |
| 761 s->WriteCid(kRedirectionDataCid); | 766 s->WriteCid(kRedirectionDataCid); |
| 762 intptr_t count = objects_.length(); | 767 intptr_t count = objects_.length(); |
| 763 s->Write<intptr_t>(count); | 768 s->Write<int32_t>(count); |
| 764 for (intptr_t i = 0; i < count; i++) { | 769 for (intptr_t i = 0; i < count; i++) { |
| 765 RawRedirectionData* data = objects_[i]; | 770 RawRedirectionData* data = objects_[i]; |
| 766 s->AssignRef(data); | 771 s->AssignRef(data); |
| 767 } | 772 } |
| 768 } | 773 } |
| 769 | 774 |
| 770 void WriteFill(Serializer* s) { | 775 void WriteFill(Serializer* s) { |
| 771 intptr_t count = objects_.length(); | 776 intptr_t count = objects_.length(); |
| 772 for (intptr_t i = 0; i < count; i++) { | 777 for (intptr_t i = 0; i < count; i++) { |
| 773 RawRedirectionData* data = objects_[i]; | 778 RawRedirectionData* data = objects_[i]; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 785 | 790 |
| 786 | 791 |
| 787 class RedirectionDataDeserializationCluster : public DeserializationCluster { | 792 class RedirectionDataDeserializationCluster : public DeserializationCluster { |
| 788 public: | 793 public: |
| 789 RedirectionDataDeserializationCluster() { } | 794 RedirectionDataDeserializationCluster() { } |
| 790 virtual ~RedirectionDataDeserializationCluster() { } | 795 virtual ~RedirectionDataDeserializationCluster() { } |
| 791 | 796 |
| 792 void ReadAlloc(Deserializer* d) { | 797 void ReadAlloc(Deserializer* d) { |
| 793 start_index_ = d->next_index(); | 798 start_index_ = d->next_index(); |
| 794 PageSpace* old_space = d->heap()->old_space(); | 799 PageSpace* old_space = d->heap()->old_space(); |
| 795 intptr_t count = d->Read<intptr_t>(); | 800 intptr_t count = d->Read<int32_t>(); |
| 796 for (intptr_t i = 0; i < count; i++) { | 801 for (intptr_t i = 0; i < count; i++) { |
| 797 d->AssignRef(AllocateUninitialized(old_space, | 802 d->AssignRef(AllocateUninitialized(old_space, |
| 798 RedirectionData::InstanceSize())); | 803 RedirectionData::InstanceSize())); |
| 799 } | 804 } |
| 800 stop_index_ = d->next_index(); | 805 stop_index_ = d->next_index(); |
| 801 } | 806 } |
| 802 | 807 |
| 803 void ReadFill(Deserializer* d) { | 808 void ReadFill(Deserializer* d) { |
| 804 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 809 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 805 | 810 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 857 } | 862 } |
| 858 if (kind != Snapshot::kAppNoJIT) { | 863 if (kind != Snapshot::kAppNoJIT) { |
| 859 // Write out the guarded list length. | 864 // Write out the guarded list length. |
| 860 s->Push(field->ptr()->guarded_list_length_); | 865 s->Push(field->ptr()->guarded_list_length_); |
| 861 } | 866 } |
| 862 } | 867 } |
| 863 | 868 |
| 864 void WriteAlloc(Serializer* s) { | 869 void WriteAlloc(Serializer* s) { |
| 865 s->WriteCid(kFieldCid); | 870 s->WriteCid(kFieldCid); |
| 866 intptr_t count = objects_.length(); | 871 intptr_t count = objects_.length(); |
| 867 s->Write<intptr_t>(count); | 872 s->Write<int32_t>(count); |
| 868 for (intptr_t i = 0; i < count; i++) { | 873 for (intptr_t i = 0; i < count; i++) { |
| 869 RawField* field = objects_[i]; | 874 RawField* field = objects_[i]; |
| 870 s->AssignRef(field); | 875 s->AssignRef(field); |
| 871 } | 876 } |
| 872 } | 877 } |
| 873 | 878 |
| 874 void WriteFill(Serializer* s) { | 879 void WriteFill(Serializer* s) { |
| 875 Snapshot::Kind kind = s->kind(); | 880 Snapshot::Kind kind = s->kind(); |
| 876 intptr_t count = objects_.length(); | 881 intptr_t count = objects_.length(); |
| 877 for (intptr_t i = 0; i < count; i++) { | 882 for (intptr_t i = 0; i < count; i++) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 922 | 927 |
| 923 | 928 |
| 924 class FieldDeserializationCluster : public DeserializationCluster { | 929 class FieldDeserializationCluster : public DeserializationCluster { |
| 925 public: | 930 public: |
| 926 FieldDeserializationCluster() { } | 931 FieldDeserializationCluster() { } |
| 927 virtual ~FieldDeserializationCluster() { } | 932 virtual ~FieldDeserializationCluster() { } |
| 928 | 933 |
| 929 void ReadAlloc(Deserializer* d) { | 934 void ReadAlloc(Deserializer* d) { |
| 930 start_index_ = d->next_index(); | 935 start_index_ = d->next_index(); |
| 931 PageSpace* old_space = d->heap()->old_space(); | 936 PageSpace* old_space = d->heap()->old_space(); |
| 932 intptr_t count = d->Read<intptr_t>(); | 937 intptr_t count = d->Read<int32_t>(); |
| 933 for (intptr_t i = 0; i < count; i++) { | 938 for (intptr_t i = 0; i < count; i++) { |
| 934 d->AssignRef(AllocateUninitialized(old_space, Field::InstanceSize())); | 939 d->AssignRef(AllocateUninitialized(old_space, Field::InstanceSize())); |
| 935 } | 940 } |
| 936 stop_index_ = d->next_index(); | 941 stop_index_ = d->next_index(); |
| 937 } | 942 } |
| 938 | 943 |
| 939 void ReadFill(Deserializer* d) { | 944 void ReadFill(Deserializer* d) { |
| 940 Snapshot::Kind kind = d->kind(); | 945 Snapshot::Kind kind = d->kind(); |
| 941 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 946 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 942 | 947 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 999 RawObject** from = token->from(); | 1004 RawObject** from = token->from(); |
| 1000 RawObject** to = token->to(); | 1005 RawObject** to = token->to(); |
| 1001 for (RawObject** p = from; p <= to; p++) { | 1006 for (RawObject** p = from; p <= to; p++) { |
| 1002 s->Push(*p); | 1007 s->Push(*p); |
| 1003 } | 1008 } |
| 1004 } | 1009 } |
| 1005 | 1010 |
| 1006 void WriteAlloc(Serializer* s) { | 1011 void WriteAlloc(Serializer* s) { |
| 1007 s->WriteCid(kLiteralTokenCid); | 1012 s->WriteCid(kLiteralTokenCid); |
| 1008 intptr_t count = objects_.length(); | 1013 intptr_t count = objects_.length(); |
| 1009 s->Write<intptr_t>(count); | 1014 s->Write<int32_t>(count); |
| 1010 for (intptr_t i = 0; i < count; i++) { | 1015 for (intptr_t i = 0; i < count; i++) { |
| 1011 RawLiteralToken* token = objects_[i]; | 1016 RawLiteralToken* token = objects_[i]; |
| 1012 s->AssignRef(token); | 1017 s->AssignRef(token); |
| 1013 } | 1018 } |
| 1014 } | 1019 } |
| 1015 | 1020 |
| 1016 void WriteFill(Serializer* s) { | 1021 void WriteFill(Serializer* s) { |
| 1017 intptr_t count = objects_.length(); | 1022 intptr_t count = objects_.length(); |
| 1018 for (intptr_t i = 0; i < count; i++) { | 1023 for (intptr_t i = 0; i < count; i++) { |
| 1019 RawLiteralToken* token = objects_[i]; | 1024 RawLiteralToken* token = objects_[i]; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1032 | 1037 |
| 1033 | 1038 |
| 1034 class LiteralTokenDeserializationCluster : public DeserializationCluster { | 1039 class LiteralTokenDeserializationCluster : public DeserializationCluster { |
| 1035 public: | 1040 public: |
| 1036 LiteralTokenDeserializationCluster() { } | 1041 LiteralTokenDeserializationCluster() { } |
| 1037 virtual ~LiteralTokenDeserializationCluster() { } | 1042 virtual ~LiteralTokenDeserializationCluster() { } |
| 1038 | 1043 |
| 1039 void ReadAlloc(Deserializer* d) { | 1044 void ReadAlloc(Deserializer* d) { |
| 1040 start_index_ = d->next_index(); | 1045 start_index_ = d->next_index(); |
| 1041 PageSpace* old_space = d->heap()->old_space(); | 1046 PageSpace* old_space = d->heap()->old_space(); |
| 1042 intptr_t count = d->Read<intptr_t>(); | 1047 intptr_t count = d->Read<int32_t>(); |
| 1043 for (intptr_t i = 0; i < count; i++) { | 1048 for (intptr_t i = 0; i < count; i++) { |
| 1044 d->AssignRef(AllocateUninitialized(old_space, | 1049 d->AssignRef(AllocateUninitialized(old_space, |
| 1045 LiteralToken::InstanceSize())); | 1050 LiteralToken::InstanceSize())); |
| 1046 } | 1051 } |
| 1047 stop_index_ = d->next_index(); | 1052 stop_index_ = d->next_index(); |
| 1048 } | 1053 } |
| 1049 | 1054 |
| 1050 void ReadFill(Deserializer* d) { | 1055 void ReadFill(Deserializer* d) { |
| 1051 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 1056 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 1052 | 1057 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 1078 RawObject** from = stream->from(); | 1083 RawObject** from = stream->from(); |
| 1079 RawObject** to = stream->to(); | 1084 RawObject** to = stream->to(); |
| 1080 for (RawObject** p = from; p <= to; p++) { | 1085 for (RawObject** p = from; p <= to; p++) { |
| 1081 s->Push(*p); | 1086 s->Push(*p); |
| 1082 } | 1087 } |
| 1083 } | 1088 } |
| 1084 | 1089 |
| 1085 void WriteAlloc(Serializer* s) { | 1090 void WriteAlloc(Serializer* s) { |
| 1086 s->WriteCid(kTokenStreamCid); | 1091 s->WriteCid(kTokenStreamCid); |
| 1087 intptr_t count = objects_.length(); | 1092 intptr_t count = objects_.length(); |
| 1088 s->Write<intptr_t>(count); | 1093 s->Write<int32_t>(count); |
| 1089 for (intptr_t i = 0; i < count; i++) { | 1094 for (intptr_t i = 0; i < count; i++) { |
| 1090 RawTokenStream* stream = objects_[i]; | 1095 RawTokenStream* stream = objects_[i]; |
| 1091 s->AssignRef(stream); | 1096 s->AssignRef(stream); |
| 1092 } | 1097 } |
| 1093 } | 1098 } |
| 1094 | 1099 |
| 1095 void WriteFill(Serializer* s) { | 1100 void WriteFill(Serializer* s) { |
| 1096 intptr_t count = objects_.length(); | 1101 intptr_t count = objects_.length(); |
| 1097 for (intptr_t i = 0; i < count; i++) { | 1102 for (intptr_t i = 0; i < count; i++) { |
| 1098 RawTokenStream* stream = objects_[i]; | 1103 RawTokenStream* stream = objects_[i]; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1110 | 1115 |
| 1111 | 1116 |
| 1112 class TokenStreamDeserializationCluster : public DeserializationCluster { | 1117 class TokenStreamDeserializationCluster : public DeserializationCluster { |
| 1113 public: | 1118 public: |
| 1114 TokenStreamDeserializationCluster() { } | 1119 TokenStreamDeserializationCluster() { } |
| 1115 virtual ~TokenStreamDeserializationCluster() { } | 1120 virtual ~TokenStreamDeserializationCluster() { } |
| 1116 | 1121 |
| 1117 void ReadAlloc(Deserializer* d) { | 1122 void ReadAlloc(Deserializer* d) { |
| 1118 start_index_ = d->next_index(); | 1123 start_index_ = d->next_index(); |
| 1119 PageSpace* old_space = d->heap()->old_space(); | 1124 PageSpace* old_space = d->heap()->old_space(); |
| 1120 intptr_t count = d->Read<intptr_t>(); | 1125 intptr_t count = d->Read<int32_t>(); |
| 1121 for (intptr_t i = 0; i < count; i++) { | 1126 for (intptr_t i = 0; i < count; i++) { |
| 1122 d->AssignRef(AllocateUninitialized(old_space, | 1127 d->AssignRef(AllocateUninitialized(old_space, |
| 1123 TokenStream::InstanceSize())); | 1128 TokenStream::InstanceSize())); |
| 1124 } | 1129 } |
| 1125 stop_index_ = d->next_index(); | 1130 stop_index_ = d->next_index(); |
| 1126 } | 1131 } |
| 1127 | 1132 |
| 1128 void ReadFill(Deserializer* d) { | 1133 void ReadFill(Deserializer* d) { |
| 1129 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 1134 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 1130 | 1135 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1154 RawObject** from = script->from(); | 1159 RawObject** from = script->from(); |
| 1155 RawObject** to = script->to_snapshot(s->kind()); | 1160 RawObject** to = script->to_snapshot(s->kind()); |
| 1156 for (RawObject** p = from; p <= to; p++) { | 1161 for (RawObject** p = from; p <= to; p++) { |
| 1157 s->Push(*p); | 1162 s->Push(*p); |
| 1158 } | 1163 } |
| 1159 } | 1164 } |
| 1160 | 1165 |
| 1161 void WriteAlloc(Serializer* s) { | 1166 void WriteAlloc(Serializer* s) { |
| 1162 s->WriteCid(kScriptCid); | 1167 s->WriteCid(kScriptCid); |
| 1163 intptr_t count = objects_.length(); | 1168 intptr_t count = objects_.length(); |
| 1164 s->Write<intptr_t>(count); | 1169 s->Write<int32_t>(count); |
| 1165 for (intptr_t i = 0; i < count; i++) { | 1170 for (intptr_t i = 0; i < count; i++) { |
| 1166 RawScript* script = objects_[i]; | 1171 RawScript* script = objects_[i]; |
| 1167 s->AssignRef(script); | 1172 s->AssignRef(script); |
| 1168 } | 1173 } |
| 1169 } | 1174 } |
| 1170 | 1175 |
| 1171 void WriteFill(Serializer* s) { | 1176 void WriteFill(Serializer* s) { |
| 1172 Snapshot::Kind kind = s->kind(); | 1177 Snapshot::Kind kind = s->kind(); |
| 1173 intptr_t count = objects_.length(); | 1178 intptr_t count = objects_.length(); |
| 1174 for (intptr_t i = 0; i < count; i++) { | 1179 for (intptr_t i = 0; i < count; i++) { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1191 | 1196 |
| 1192 | 1197 |
| 1193 class ScriptDeserializationCluster : public DeserializationCluster { | 1198 class ScriptDeserializationCluster : public DeserializationCluster { |
| 1194 public: | 1199 public: |
| 1195 ScriptDeserializationCluster() { } | 1200 ScriptDeserializationCluster() { } |
| 1196 virtual ~ScriptDeserializationCluster() { } | 1201 virtual ~ScriptDeserializationCluster() { } |
| 1197 | 1202 |
| 1198 void ReadAlloc(Deserializer* d) { | 1203 void ReadAlloc(Deserializer* d) { |
| 1199 start_index_ = d->next_index(); | 1204 start_index_ = d->next_index(); |
| 1200 PageSpace* old_space = d->heap()->old_space(); | 1205 PageSpace* old_space = d->heap()->old_space(); |
| 1201 intptr_t count = d->Read<intptr_t>(); | 1206 intptr_t count = d->Read<int32_t>(); |
| 1202 for (intptr_t i = 0; i < count; i++) { | 1207 for (intptr_t i = 0; i < count; i++) { |
| 1203 d->AssignRef(AllocateUninitialized(old_space, Script::InstanceSize())); | 1208 d->AssignRef(AllocateUninitialized(old_space, Script::InstanceSize())); |
| 1204 } | 1209 } |
| 1205 stop_index_ = d->next_index(); | 1210 stop_index_ = d->next_index(); |
| 1206 } | 1211 } |
| 1207 | 1212 |
| 1208 void ReadFill(Deserializer* d) { | 1213 void ReadFill(Deserializer* d) { |
| 1209 Snapshot::Kind kind = d->kind(); | 1214 Snapshot::Kind kind = d->kind(); |
| 1210 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 1215 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 1211 | 1216 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1244 RawObject** from = lib->from(); | 1249 RawObject** from = lib->from(); |
| 1245 RawObject** to = lib->to_snapshot(); | 1250 RawObject** to = lib->to_snapshot(); |
| 1246 for (RawObject** p = from; p <= to; p++) { | 1251 for (RawObject** p = from; p <= to; p++) { |
| 1247 s->Push(*p); | 1252 s->Push(*p); |
| 1248 } | 1253 } |
| 1249 } | 1254 } |
| 1250 | 1255 |
| 1251 void WriteAlloc(Serializer* s) { | 1256 void WriteAlloc(Serializer* s) { |
| 1252 s->WriteCid(kLibraryCid); | 1257 s->WriteCid(kLibraryCid); |
| 1253 intptr_t count = objects_.length(); | 1258 intptr_t count = objects_.length(); |
| 1254 s->Write<intptr_t>(count); | 1259 s->Write<int32_t>(count); |
| 1255 for (intptr_t i = 0; i < count; i++) { | 1260 for (intptr_t i = 0; i < count; i++) { |
| 1256 RawLibrary* lib = objects_[i]; | 1261 RawLibrary* lib = objects_[i]; |
| 1257 s->AssignRef(lib); | 1262 s->AssignRef(lib); |
| 1258 } | 1263 } |
| 1259 } | 1264 } |
| 1260 | 1265 |
| 1261 void WriteFill(Serializer* s) { | 1266 void WriteFill(Serializer* s) { |
| 1262 intptr_t count = objects_.length(); | 1267 intptr_t count = objects_.length(); |
| 1263 for (intptr_t i = 0; i < count; i++) { | 1268 for (intptr_t i = 0; i < count; i++) { |
| 1264 RawLibrary* lib = objects_[i]; | 1269 RawLibrary* lib = objects_[i]; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 1282 }; | 1287 }; |
| 1283 | 1288 |
| 1284 class LibraryDeserializationCluster : public DeserializationCluster { | 1289 class LibraryDeserializationCluster : public DeserializationCluster { |
| 1285 public: | 1290 public: |
| 1286 LibraryDeserializationCluster() { } | 1291 LibraryDeserializationCluster() { } |
| 1287 virtual ~LibraryDeserializationCluster() { } | 1292 virtual ~LibraryDeserializationCluster() { } |
| 1288 | 1293 |
| 1289 void ReadAlloc(Deserializer* d) { | 1294 void ReadAlloc(Deserializer* d) { |
| 1290 start_index_ = d->next_index(); | 1295 start_index_ = d->next_index(); |
| 1291 PageSpace* old_space = d->heap()->old_space(); | 1296 PageSpace* old_space = d->heap()->old_space(); |
| 1292 intptr_t count = d->Read<intptr_t>(); | 1297 intptr_t count = d->Read<int32_t>(); |
| 1293 for (intptr_t i = 0; i < count; i++) { | 1298 for (intptr_t i = 0; i < count; i++) { |
| 1294 d->AssignRef(AllocateUninitialized(old_space, Library::InstanceSize())); | 1299 d->AssignRef(AllocateUninitialized(old_space, Library::InstanceSize())); |
| 1295 } | 1300 } |
| 1296 stop_index_ = d->next_index(); | 1301 stop_index_ = d->next_index(); |
| 1297 } | 1302 } |
| 1298 | 1303 |
| 1299 void ReadFill(Deserializer* d) { | 1304 void ReadFill(Deserializer* d) { |
| 1300 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 1305 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 1301 | 1306 |
| 1302 for (intptr_t id = start_index_; id < stop_index_; id++) { | 1307 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1354 RawObject** from = ns->from(); | 1359 RawObject** from = ns->from(); |
| 1355 RawObject** to = ns->to(); | 1360 RawObject** to = ns->to(); |
| 1356 for (RawObject** p = from; p <= to; p++) { | 1361 for (RawObject** p = from; p <= to; p++) { |
| 1357 s->Push(*p); | 1362 s->Push(*p); |
| 1358 } | 1363 } |
| 1359 } | 1364 } |
| 1360 | 1365 |
| 1361 void WriteAlloc(Serializer* s) { | 1366 void WriteAlloc(Serializer* s) { |
| 1362 s->WriteCid(kNamespaceCid); | 1367 s->WriteCid(kNamespaceCid); |
| 1363 intptr_t count = objects_.length(); | 1368 intptr_t count = objects_.length(); |
| 1364 s->Write<intptr_t>(count); | 1369 s->Write<int32_t>(count); |
| 1365 for (intptr_t i = 0; i < count; i++) { | 1370 for (intptr_t i = 0; i < count; i++) { |
| 1366 RawNamespace* ns = objects_[i]; | 1371 RawNamespace* ns = objects_[i]; |
| 1367 s->AssignRef(ns); | 1372 s->AssignRef(ns); |
| 1368 } | 1373 } |
| 1369 } | 1374 } |
| 1370 | 1375 |
| 1371 void WriteFill(Serializer* s) { | 1376 void WriteFill(Serializer* s) { |
| 1372 intptr_t count = objects_.length(); | 1377 intptr_t count = objects_.length(); |
| 1373 for (intptr_t i = 0; i < count; i++) { | 1378 for (intptr_t i = 0; i < count; i++) { |
| 1374 RawNamespace* ns = objects_[i]; | 1379 RawNamespace* ns = objects_[i]; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1386 | 1391 |
| 1387 | 1392 |
| 1388 class NamespaceDeserializationCluster : public DeserializationCluster { | 1393 class NamespaceDeserializationCluster : public DeserializationCluster { |
| 1389 public: | 1394 public: |
| 1390 NamespaceDeserializationCluster() { } | 1395 NamespaceDeserializationCluster() { } |
| 1391 virtual ~NamespaceDeserializationCluster() { } | 1396 virtual ~NamespaceDeserializationCluster() { } |
| 1392 | 1397 |
| 1393 void ReadAlloc(Deserializer* d) { | 1398 void ReadAlloc(Deserializer* d) { |
| 1394 start_index_ = d->next_index(); | 1399 start_index_ = d->next_index(); |
| 1395 PageSpace* old_space = d->heap()->old_space(); | 1400 PageSpace* old_space = d->heap()->old_space(); |
| 1396 intptr_t count = d->Read<intptr_t>(); | 1401 intptr_t count = d->Read<int32_t>(); |
| 1397 for (intptr_t i = 0; i < count; i++) { | 1402 for (intptr_t i = 0; i < count; i++) { |
| 1398 d->AssignRef(AllocateUninitialized(old_space, Namespace::InstanceSize())); | 1403 d->AssignRef(AllocateUninitialized(old_space, Namespace::InstanceSize())); |
| 1399 } | 1404 } |
| 1400 stop_index_ = d->next_index(); | 1405 stop_index_ = d->next_index(); |
| 1401 } | 1406 } |
| 1402 | 1407 |
| 1403 void ReadFill(Deserializer* d) { | 1408 void ReadFill(Deserializer* d) { |
| 1404 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 1409 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 1405 | 1410 |
| 1406 for (intptr_t id = start_index_; id < stop_index_; id++) { | 1411 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1429 s->Push(code->ptr()->object_pool_); | 1434 s->Push(code->ptr()->object_pool_); |
| 1430 s->Push(code->ptr()->owner_); | 1435 s->Push(code->ptr()->owner_); |
| 1431 s->Push(code->ptr()->exception_handlers_); | 1436 s->Push(code->ptr()->exception_handlers_); |
| 1432 s->Push(code->ptr()->pc_descriptors_); | 1437 s->Push(code->ptr()->pc_descriptors_); |
| 1433 s->Push(code->ptr()->stackmaps_); | 1438 s->Push(code->ptr()->stackmaps_); |
| 1434 } | 1439 } |
| 1435 | 1440 |
| 1436 void WriteAlloc(Serializer* s) { | 1441 void WriteAlloc(Serializer* s) { |
| 1437 s->WriteCid(kCodeCid); | 1442 s->WriteCid(kCodeCid); |
| 1438 intptr_t count = objects_.length(); | 1443 intptr_t count = objects_.length(); |
| 1439 s->Write<intptr_t>(count); | 1444 s->Write<int32_t>(count); |
| 1440 for (intptr_t i = 0; i < count; i++) { | 1445 for (intptr_t i = 0; i < count; i++) { |
| 1441 RawCode* code = objects_[i]; | 1446 RawCode* code = objects_[i]; |
| 1442 s->AssignRef(code); | 1447 s->AssignRef(code); |
| 1443 } | 1448 } |
| 1444 } | 1449 } |
| 1445 | 1450 |
| 1446 void WriteFill(Serializer* s) { | 1451 void WriteFill(Serializer* s) { |
| 1447 Snapshot::Kind kind = s->kind(); | 1452 Snapshot::Kind kind = s->kind(); |
| 1448 intptr_t count = objects_.length(); | 1453 intptr_t count = objects_.length(); |
| 1449 for (intptr_t i = 0; i < count; i++) { | 1454 for (intptr_t i = 0; i < count; i++) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1489 | 1494 |
| 1490 | 1495 |
| 1491 class CodeDeserializationCluster : public DeserializationCluster { | 1496 class CodeDeserializationCluster : public DeserializationCluster { |
| 1492 public: | 1497 public: |
| 1493 CodeDeserializationCluster() { } | 1498 CodeDeserializationCluster() { } |
| 1494 virtual ~CodeDeserializationCluster() { } | 1499 virtual ~CodeDeserializationCluster() { } |
| 1495 | 1500 |
| 1496 void ReadAlloc(Deserializer* d) { | 1501 void ReadAlloc(Deserializer* d) { |
| 1497 start_index_ = d->next_index(); | 1502 start_index_ = d->next_index(); |
| 1498 PageSpace* old_space = d->heap()->old_space(); | 1503 PageSpace* old_space = d->heap()->old_space(); |
| 1499 intptr_t count = d->Read<intptr_t>(); | 1504 intptr_t count = d->Read<int32_t>(); |
| 1500 for (intptr_t i = 0; i < count; i++) { | 1505 for (intptr_t i = 0; i < count; i++) { |
| 1501 d->AssignRef(AllocateUninitialized(old_space, Code::InstanceSize(0))); | 1506 d->AssignRef(AllocateUninitialized(old_space, Code::InstanceSize(0))); |
| 1502 } | 1507 } |
| 1503 stop_index_ = d->next_index(); | 1508 stop_index_ = d->next_index(); |
| 1504 } | 1509 } |
| 1505 | 1510 |
| 1506 void ReadFill(Deserializer* d) { | 1511 void ReadFill(Deserializer* d) { |
| 1507 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 1512 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 1508 | 1513 |
| 1509 for (intptr_t id = start_index_; id < stop_index_; id++) { | 1514 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1564 s->Push(pool->ptr()->data()[i].raw_obj_); | 1569 s->Push(pool->ptr()->data()[i].raw_obj_); |
| 1565 } | 1570 } |
| 1566 } | 1571 } |
| 1567 | 1572 |
| 1568 // TODO(rmacnak): Allocate the object pool and its info array together. | 1573 // TODO(rmacnak): Allocate the object pool and its info array together. |
| 1569 } | 1574 } |
| 1570 | 1575 |
| 1571 void WriteAlloc(Serializer* s) { | 1576 void WriteAlloc(Serializer* s) { |
| 1572 s->WriteCid(kObjectPoolCid); | 1577 s->WriteCid(kObjectPoolCid); |
| 1573 intptr_t count = objects_.length(); | 1578 intptr_t count = objects_.length(); |
| 1574 s->Write<intptr_t>(count); | 1579 s->Write<int32_t>(count); |
| 1575 for (intptr_t i = 0; i < count; i++) { | 1580 for (intptr_t i = 0; i < count; i++) { |
| 1576 RawObjectPool* pool = objects_[i]; | 1581 RawObjectPool* pool = objects_[i]; |
| 1577 intptr_t length = pool->ptr()->length_; | 1582 intptr_t length = pool->ptr()->length_; |
| 1578 s->Write<intptr_t>(length); | 1583 s->Write<int32_t>(length); |
| 1579 s->AssignRef(pool); | 1584 s->AssignRef(pool); |
| 1580 } | 1585 } |
| 1581 } | 1586 } |
| 1582 | 1587 |
| 1583 void WriteFill(Serializer* s) { | 1588 void WriteFill(Serializer* s) { |
| 1584 intptr_t count = objects_.length(); | 1589 intptr_t count = objects_.length(); |
| 1585 for (intptr_t i = 0; i < count; i++) { | 1590 for (intptr_t i = 0; i < count; i++) { |
| 1586 RawObjectPool* pool = objects_[i]; | 1591 RawObjectPool* pool = objects_[i]; |
| 1587 RawTypedData* info_array = pool->ptr()->info_array_; | 1592 RawTypedData* info_array = pool->ptr()->info_array_; |
| 1588 intptr_t length = pool->ptr()->length_; | 1593 intptr_t length = pool->ptr()->length_; |
| 1589 s->Write<intptr_t>(length); | 1594 s->Write<int32_t>(length); |
| 1590 for (intptr_t j = 0; j < length; j++) { | 1595 for (intptr_t j = 0; j < length; j++) { |
| 1591 ObjectPool::EntryType entry_type = | 1596 ObjectPool::EntryType entry_type = |
| 1592 static_cast<ObjectPool::EntryType>(info_array->ptr()->data()[j]); | 1597 static_cast<ObjectPool::EntryType>(info_array->ptr()->data()[j]); |
| 1593 s->Write<int8_t>(entry_type); | 1598 s->Write<int8_t>(entry_type); |
| 1594 RawObjectPool::Entry& entry = pool->ptr()->data()[j]; | 1599 RawObjectPool::Entry& entry = pool->ptr()->data()[j]; |
| 1595 switch (entry_type) { | 1600 switch (entry_type) { |
| 1596 case ObjectPool::kTaggedObject: { | 1601 case ObjectPool::kTaggedObject: { |
| 1597 #if !defined(TARGET_ARCH_DBC) | 1602 #if !defined(TARGET_ARCH_DBC) |
| 1598 if (entry.raw_obj_ == | 1603 if (entry.raw_obj_ == |
| 1599 StubCode::CallNativeCFunction_entry()->code()) { | 1604 StubCode::CallNativeCFunction_entry()->code()) { |
| 1600 // Natives can run while precompiling, becoming linked and | 1605 // Natives can run while precompiling, becoming linked and |
| 1601 // switching their stub. Reset to the initial stub used for | 1606 // switching their stub. Reset to the initial stub used for |
| 1602 // lazy-linking. | 1607 // lazy-linking. |
| 1603 s->WriteRef(StubCode::CallBootstrapCFunction_entry()->code()); | 1608 s->WriteRef(StubCode::CallBootstrapCFunction_entry()->code()); |
| 1604 break; | 1609 break; |
| 1605 } | 1610 } |
| 1606 #endif | 1611 #endif |
| 1607 s->WriteRef(entry.raw_obj_); | 1612 s->WriteRef(entry.raw_obj_); |
| 1608 break; | 1613 break; |
| 1609 } | 1614 } |
| 1610 case ObjectPool::kImmediate: { | 1615 case ObjectPool::kImmediate: { |
| 1611 s->Write<intptr_t>(entry.raw_value_); | 1616 s->Write<int32_t>(entry.raw_value_); |
| 1612 break; | 1617 break; |
| 1613 } | 1618 } |
| 1614 case ObjectPool::kNativeEntry: { | 1619 case ObjectPool::kNativeEntry: { |
| 1615 // Write nothing. Will initialize with the lazy link entry. | 1620 // Write nothing. Will initialize with the lazy link entry. |
| 1616 #if defined(TARGET_ARCH_DBC) | 1621 #if defined(TARGET_ARCH_DBC) |
| 1617 UNREACHABLE(); // DBC does not support lazy native call linking. | 1622 UNREACHABLE(); // DBC does not support lazy native call linking. |
| 1618 #endif | 1623 #endif |
| 1619 break; | 1624 break; |
| 1620 } | 1625 } |
| 1621 default: | 1626 default: |
| 1622 UNREACHABLE(); | 1627 UNREACHABLE(); |
| 1623 } | 1628 } |
| 1624 } | 1629 } |
| 1625 } | 1630 } |
| 1626 } | 1631 } |
| 1627 | 1632 |
| 1628 private: | 1633 private: |
| 1629 GrowableArray<RawObjectPool*> objects_; | 1634 GrowableArray<RawObjectPool*> objects_; |
| 1630 }; | 1635 }; |
| 1631 | 1636 |
| 1632 | 1637 |
| 1633 class ObjectPoolDeserializationCluster : public DeserializationCluster { | 1638 class ObjectPoolDeserializationCluster : public DeserializationCluster { |
| 1634 public: | 1639 public: |
| 1635 ObjectPoolDeserializationCluster() { } | 1640 ObjectPoolDeserializationCluster() { } |
| 1636 virtual ~ObjectPoolDeserializationCluster() { } | 1641 virtual ~ObjectPoolDeserializationCluster() { } |
| 1637 | 1642 |
| 1638 void ReadAlloc(Deserializer* d) { | 1643 void ReadAlloc(Deserializer* d) { |
| 1639 start_index_ = d->next_index(); | 1644 start_index_ = d->next_index(); |
| 1640 PageSpace* old_space = d->heap()->old_space(); | 1645 PageSpace* old_space = d->heap()->old_space(); |
| 1641 intptr_t count = d->Read<intptr_t>(); | 1646 intptr_t count = d->Read<int32_t>(); |
| 1642 for (intptr_t i = 0; i < count; i++) { | 1647 for (intptr_t i = 0; i < count; i++) { |
| 1643 intptr_t length = d->Read<intptr_t>(); | 1648 intptr_t length = d->Read<int32_t>(); |
| 1644 d->AssignRef(AllocateUninitialized(old_space, | 1649 d->AssignRef(AllocateUninitialized(old_space, |
| 1645 ObjectPool::InstanceSize(length))); | 1650 ObjectPool::InstanceSize(length))); |
| 1646 } | 1651 } |
| 1647 stop_index_ = d->next_index(); | 1652 stop_index_ = d->next_index(); |
| 1648 } | 1653 } |
| 1649 | 1654 |
| 1650 void ReadFill(Deserializer* d) { | 1655 void ReadFill(Deserializer* d) { |
| 1651 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 1656 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 1652 PageSpace* old_space = d->heap()->old_space(); | 1657 PageSpace* old_space = d->heap()->old_space(); |
| 1653 for (intptr_t id = start_index_; id < stop_index_; id += 1) { | 1658 for (intptr_t id = start_index_; id < stop_index_; id += 1) { |
| 1654 intptr_t length = d->Read<intptr_t>(); | 1659 intptr_t length = d->Read<int32_t>(); |
| 1655 RawTypedData* info_array = reinterpret_cast<RawTypedData*>( | 1660 RawTypedData* info_array = reinterpret_cast<RawTypedData*>( |
| 1656 AllocateUninitialized(old_space, TypedData::InstanceSize(length))); | 1661 AllocateUninitialized(old_space, TypedData::InstanceSize(length))); |
| 1657 Deserializer::InitializeHeader(info_array, kTypedDataUint8ArrayCid, | 1662 Deserializer::InitializeHeader(info_array, kTypedDataUint8ArrayCid, |
| 1658 TypedData::InstanceSize(length), | 1663 TypedData::InstanceSize(length), |
| 1659 is_vm_object); | 1664 is_vm_object); |
| 1660 info_array->ptr()->length_ = Smi::New(length); | 1665 info_array->ptr()->length_ = Smi::New(length); |
| 1661 RawObjectPool* pool = reinterpret_cast<RawObjectPool*>(d->Ref(id + 0)); | 1666 RawObjectPool* pool = reinterpret_cast<RawObjectPool*>(d->Ref(id + 0)); |
| 1662 Deserializer::InitializeHeader(pool, kObjectPoolCid, | 1667 Deserializer::InitializeHeader(pool, kObjectPoolCid, |
| 1663 ObjectPool::InstanceSize(length), | 1668 ObjectPool::InstanceSize(length), |
| 1664 is_vm_object); | 1669 is_vm_object); |
| 1665 pool->ptr()->length_ = length; | 1670 pool->ptr()->length_ = length; |
| 1666 pool->ptr()->info_array_ = info_array; | 1671 pool->ptr()->info_array_ = info_array; |
| 1667 for (intptr_t j = 0; j < length; j++) { | 1672 for (intptr_t j = 0; j < length; j++) { |
| 1668 ObjectPool::EntryType entry_type = | 1673 ObjectPool::EntryType entry_type = |
| 1669 static_cast<ObjectPool::EntryType>(d->Read<int8_t>()); | 1674 static_cast<ObjectPool::EntryType>(d->Read<int8_t>()); |
| 1670 info_array->ptr()->data()[j] = entry_type; | 1675 info_array->ptr()->data()[j] = entry_type; |
| 1671 RawObjectPool::Entry& entry = pool->ptr()->data()[j]; | 1676 RawObjectPool::Entry& entry = pool->ptr()->data()[j]; |
| 1672 switch (entry_type) { | 1677 switch (entry_type) { |
| 1673 case ObjectPool::kTaggedObject: | 1678 case ObjectPool::kTaggedObject: |
| 1674 entry.raw_obj_ = d->ReadRef(); | 1679 entry.raw_obj_ = d->ReadRef(); |
| 1675 break; | 1680 break; |
| 1676 case ObjectPool::kImmediate: | 1681 case ObjectPool::kImmediate: |
| 1677 entry.raw_value_ = d->Read<intptr_t>(); | 1682 entry.raw_value_ = d->Read<int32_t>(); |
| 1678 break; | 1683 break; |
| 1679 case ObjectPool::kNativeEntry: { | 1684 case ObjectPool::kNativeEntry: { |
| 1680 #if !defined(TARGET_ARCH_DBC) | 1685 #if !defined(TARGET_ARCH_DBC) |
| 1681 // Read nothing. Initialize with the lazy link entry. | 1686 // Read nothing. Initialize with the lazy link entry. |
| 1682 uword new_entry = NativeEntry::LinkNativeCallEntry(); | 1687 uword new_entry = NativeEntry::LinkNativeCallEntry(); |
| 1683 entry.raw_value_ = static_cast<intptr_t>(new_entry); | 1688 entry.raw_value_ = static_cast<intptr_t>(new_entry); |
| 1684 #else | 1689 #else |
| 1685 UNREACHABLE(); // DBC does not support lazy native call linking. | 1690 UNREACHABLE(); // DBC does not support lazy native call linking. |
| 1686 #endif | 1691 #endif |
| 1687 break; | 1692 break; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1721 Smi::Value(str->ptr()->length_) * 2); | 1726 Smi::Value(str->ptr()->length_) * 2); |
| 1722 str->ptr()->hash_ = Smi::New(hash); | 1727 str->ptr()->hash_ = Smi::New(hash); |
| 1723 } | 1728 } |
| 1724 ASSERT(str->ptr()->hash_ != Smi::New(0)); | 1729 ASSERT(str->ptr()->hash_ != Smi::New(0)); |
| 1725 } | 1730 } |
| 1726 } | 1731 } |
| 1727 | 1732 |
| 1728 void WriteAlloc(Serializer* s) { | 1733 void WriteAlloc(Serializer* s) { |
| 1729 s->WriteCid(cid_); | 1734 s->WriteCid(cid_); |
| 1730 intptr_t count = objects_.length(); | 1735 intptr_t count = objects_.length(); |
| 1731 s->Write<intptr_t>(count); | 1736 s->Write<int32_t>(count); |
| 1732 for (intptr_t i = 0; i < count; i++) { | 1737 for (intptr_t i = 0; i < count; i++) { |
| 1733 RawObject* object = objects_[i]; | 1738 RawObject* object = objects_[i]; |
| 1734 int32_t rodata_offset = s->GetRODataOffset(object); | 1739 int32_t rodata_offset = s->GetRODataOffset(object); |
| 1735 s->Write<int32_t>(rodata_offset); | 1740 s->Write<int32_t>(rodata_offset); |
| 1736 s->AssignRef(object); | 1741 s->AssignRef(object); |
| 1737 } | 1742 } |
| 1738 } | 1743 } |
| 1739 | 1744 |
| 1740 void WriteFill(Serializer* s) { | 1745 void WriteFill(Serializer* s) { |
| 1741 // No-op. | 1746 // No-op. |
| 1742 } | 1747 } |
| 1743 | 1748 |
| 1744 private: | 1749 private: |
| 1745 const intptr_t cid_; | 1750 const intptr_t cid_; |
| 1746 GrowableArray<RawObject*> objects_; | 1751 GrowableArray<RawObject*> objects_; |
| 1747 }; | 1752 }; |
| 1748 | 1753 |
| 1749 | 1754 |
| 1750 class RODataDeserializationCluster : public DeserializationCluster { | 1755 class RODataDeserializationCluster : public DeserializationCluster { |
| 1751 public: | 1756 public: |
| 1752 RODataDeserializationCluster() { } | 1757 RODataDeserializationCluster() { } |
| 1753 virtual ~RODataDeserializationCluster() { } | 1758 virtual ~RODataDeserializationCluster() { } |
| 1754 | 1759 |
| 1755 void ReadAlloc(Deserializer* d) { | 1760 void ReadAlloc(Deserializer* d) { |
| 1756 intptr_t count = d->Read<intptr_t>(); | 1761 intptr_t count = d->Read<int32_t>(); |
| 1757 for (intptr_t i = 0; i < count; i++) { | 1762 for (intptr_t i = 0; i < count; i++) { |
| 1758 int32_t rodata_offset = d->Read<int32_t>(); | 1763 int32_t rodata_offset = d->Read<int32_t>(); |
| 1759 d->AssignRef(d->GetObjectAt(rodata_offset)); | 1764 d->AssignRef(d->GetObjectAt(rodata_offset)); |
| 1760 } | 1765 } |
| 1761 } | 1766 } |
| 1762 | 1767 |
| 1763 void ReadFill(Deserializer* d) { | 1768 void ReadFill(Deserializer* d) { |
| 1764 // No-op. | 1769 // No-op. |
| 1765 } | 1770 } |
| 1766 }; | 1771 }; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1788 void Trace(Serializer* s, RawObject* object) { | 1793 void Trace(Serializer* s, RawObject* object) { |
| 1789 RawExceptionHandlers* handlers = ExceptionHandlers::RawCast(object); | 1794 RawExceptionHandlers* handlers = ExceptionHandlers::RawCast(object); |
| 1790 objects_.Add(handlers); | 1795 objects_.Add(handlers); |
| 1791 | 1796 |
| 1792 s->Push(handlers->ptr()->handled_types_data_); | 1797 s->Push(handlers->ptr()->handled_types_data_); |
| 1793 } | 1798 } |
| 1794 | 1799 |
| 1795 void WriteAlloc(Serializer* s) { | 1800 void WriteAlloc(Serializer* s) { |
| 1796 s->WriteCid(kExceptionHandlersCid); | 1801 s->WriteCid(kExceptionHandlersCid); |
| 1797 intptr_t count = objects_.length(); | 1802 intptr_t count = objects_.length(); |
| 1798 s->Write<intptr_t>(count); | 1803 s->Write<int32_t>(count); |
| 1799 for (intptr_t i = 0; i < count; i++) { | 1804 for (intptr_t i = 0; i < count; i++) { |
| 1800 RawExceptionHandlers* handlers = objects_[i]; | 1805 RawExceptionHandlers* handlers = objects_[i]; |
| 1801 intptr_t length = handlers->ptr()->num_entries_; | 1806 intptr_t length = handlers->ptr()->num_entries_; |
| 1802 s->Write<intptr_t>(length); | 1807 s->Write<int32_t>(length); |
| 1803 s->AssignRef(handlers); | 1808 s->AssignRef(handlers); |
| 1804 } | 1809 } |
| 1805 } | 1810 } |
| 1806 | 1811 |
| 1807 void WriteFill(Serializer* s) { | 1812 void WriteFill(Serializer* s) { |
| 1808 intptr_t count = objects_.length(); | 1813 intptr_t count = objects_.length(); |
| 1809 for (intptr_t i = 0; i < count; i++) { | 1814 for (intptr_t i = 0; i < count; i++) { |
| 1810 RawExceptionHandlers* handlers = objects_[i]; | 1815 RawExceptionHandlers* handlers = objects_[i]; |
| 1811 intptr_t length = handlers->ptr()->num_entries_; | 1816 intptr_t length = handlers->ptr()->num_entries_; |
| 1812 s->Write<intptr_t>(length); | 1817 s->Write<int32_t>(length); |
| 1813 s->WriteRef(handlers->ptr()->handled_types_data_); | 1818 s->WriteRef(handlers->ptr()->handled_types_data_); |
| 1814 | 1819 |
| 1815 uint8_t* data = reinterpret_cast<uint8_t*>(handlers->ptr()->data()); | 1820 uint8_t* data = reinterpret_cast<uint8_t*>(handlers->ptr()->data()); |
| 1816 intptr_t length_in_bytes = | 1821 intptr_t length_in_bytes = |
| 1817 length * sizeof(RawExceptionHandlers::HandlerInfo); | 1822 length * sizeof(RawExceptionHandlers::HandlerInfo); |
| 1818 s->WriteBytes(data, length_in_bytes); | 1823 s->WriteBytes(data, length_in_bytes); |
| 1819 } | 1824 } |
| 1820 } | 1825 } |
| 1821 | 1826 |
| 1822 private: | 1827 private: |
| 1823 GrowableArray<RawExceptionHandlers*> objects_; | 1828 GrowableArray<RawExceptionHandlers*> objects_; |
| 1824 }; | 1829 }; |
| 1825 | 1830 |
| 1826 | 1831 |
| 1827 class ExceptionHandlersDeserializationCluster : public DeserializationCluster { | 1832 class ExceptionHandlersDeserializationCluster : public DeserializationCluster { |
| 1828 public: | 1833 public: |
| 1829 ExceptionHandlersDeserializationCluster() { } | 1834 ExceptionHandlersDeserializationCluster() { } |
| 1830 virtual ~ExceptionHandlersDeserializationCluster() { } | 1835 virtual ~ExceptionHandlersDeserializationCluster() { } |
| 1831 | 1836 |
| 1832 void ReadAlloc(Deserializer* d) { | 1837 void ReadAlloc(Deserializer* d) { |
| 1833 start_index_ = d->next_index(); | 1838 start_index_ = d->next_index(); |
| 1834 PageSpace* old_space = d->heap()->old_space(); | 1839 PageSpace* old_space = d->heap()->old_space(); |
| 1835 intptr_t count = d->Read<intptr_t>(); | 1840 intptr_t count = d->Read<int32_t>(); |
| 1836 for (intptr_t i = 0; i < count; i++) { | 1841 for (intptr_t i = 0; i < count; i++) { |
| 1837 intptr_t length = d->Read<intptr_t>(); | 1842 intptr_t length = d->Read<int32_t>(); |
| 1838 d->AssignRef(AllocateUninitialized(old_space, | 1843 d->AssignRef(AllocateUninitialized(old_space, |
| 1839 ExceptionHandlers::InstanceSize(length))); | 1844 ExceptionHandlers::InstanceSize(length))); |
| 1840 } | 1845 } |
| 1841 stop_index_ = d->next_index(); | 1846 stop_index_ = d->next_index(); |
| 1842 } | 1847 } |
| 1843 | 1848 |
| 1844 void ReadFill(Deserializer* d) { | 1849 void ReadFill(Deserializer* d) { |
| 1845 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 1850 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 1846 | 1851 |
| 1847 for (intptr_t id = start_index_; id < stop_index_; id++) { | 1852 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| 1848 RawExceptionHandlers* handlers = | 1853 RawExceptionHandlers* handlers = |
| 1849 reinterpret_cast<RawExceptionHandlers*>(d->Ref(id)); | 1854 reinterpret_cast<RawExceptionHandlers*>(d->Ref(id)); |
| 1850 intptr_t length = d->Read<intptr_t>(); | 1855 intptr_t length = d->Read<int32_t>(); |
| 1851 Deserializer::InitializeHeader(handlers, kExceptionHandlersCid, | 1856 Deserializer::InitializeHeader(handlers, kExceptionHandlersCid, |
| 1852 ExceptionHandlers::InstanceSize(length), | 1857 ExceptionHandlers::InstanceSize(length), |
| 1853 is_vm_object); | 1858 is_vm_object); |
| 1854 handlers->ptr()->num_entries_ = length; | 1859 handlers->ptr()->num_entries_ = length; |
| 1855 handlers->ptr()->handled_types_data_ = | 1860 handlers->ptr()->handled_types_data_ = |
| 1856 reinterpret_cast<RawArray*>(d->ReadRef()); | 1861 reinterpret_cast<RawArray*>(d->ReadRef()); |
| 1857 | 1862 |
| 1858 uint8_t* data = reinterpret_cast<uint8_t*>(handlers->ptr()->data()); | 1863 uint8_t* data = reinterpret_cast<uint8_t*>(handlers->ptr()->data()); |
| 1859 intptr_t length_in_bytes = | 1864 intptr_t length_in_bytes = |
| 1860 length * sizeof(RawExceptionHandlers::HandlerInfo); | 1865 length * sizeof(RawExceptionHandlers::HandlerInfo); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1875 s->Push(context->ptr()->parent_); | 1880 s->Push(context->ptr()->parent_); |
| 1876 intptr_t length = context->ptr()->num_variables_; | 1881 intptr_t length = context->ptr()->num_variables_; |
| 1877 for (intptr_t i = 0; i < length; i++) { | 1882 for (intptr_t i = 0; i < length; i++) { |
| 1878 s->Push(context->ptr()->data()[i]); | 1883 s->Push(context->ptr()->data()[i]); |
| 1879 } | 1884 } |
| 1880 } | 1885 } |
| 1881 | 1886 |
| 1882 void WriteAlloc(Serializer* s) { | 1887 void WriteAlloc(Serializer* s) { |
| 1883 s->WriteCid(kContextCid); | 1888 s->WriteCid(kContextCid); |
| 1884 intptr_t count = objects_.length(); | 1889 intptr_t count = objects_.length(); |
| 1885 s->Write<intptr_t>(count); | 1890 s->Write<int32_t>(count); |
| 1886 for (intptr_t i = 0; i < count; i++) { | 1891 for (intptr_t i = 0; i < count; i++) { |
| 1887 RawContext* context = objects_[i]; | 1892 RawContext* context = objects_[i]; |
| 1888 intptr_t length = context->ptr()->num_variables_; | 1893 intptr_t length = context->ptr()->num_variables_; |
| 1889 s->Write<intptr_t>(length); | 1894 s->Write<int32_t>(length); |
| 1890 s->AssignRef(context); | 1895 s->AssignRef(context); |
| 1891 } | 1896 } |
| 1892 } | 1897 } |
| 1893 | 1898 |
| 1894 void WriteFill(Serializer* s) { | 1899 void WriteFill(Serializer* s) { |
| 1895 intptr_t count = objects_.length(); | 1900 intptr_t count = objects_.length(); |
| 1896 for (intptr_t i = 0; i < count; i++) { | 1901 for (intptr_t i = 0; i < count; i++) { |
| 1897 RawContext* context = objects_[i]; | 1902 RawContext* context = objects_[i]; |
| 1898 intptr_t length = context->ptr()->num_variables_; | 1903 intptr_t length = context->ptr()->num_variables_; |
| 1899 s->Write<intptr_t>(length); | 1904 s->Write<int32_t>(length); |
| 1900 s->WriteRef(context->ptr()->parent_); | 1905 s->WriteRef(context->ptr()->parent_); |
| 1901 for (intptr_t j = 0; j < length; j++) { | 1906 for (intptr_t j = 0; j < length; j++) { |
| 1902 s->WriteRef(context->ptr()->data()[j]); | 1907 s->WriteRef(context->ptr()->data()[j]); |
| 1903 } | 1908 } |
| 1904 } | 1909 } |
| 1905 } | 1910 } |
| 1906 | 1911 |
| 1907 private: | 1912 private: |
| 1908 GrowableArray<RawContext*> objects_; | 1913 GrowableArray<RawContext*> objects_; |
| 1909 }; | 1914 }; |
| 1910 | 1915 |
| 1911 | 1916 |
| 1912 class ContextDeserializationCluster : public DeserializationCluster { | 1917 class ContextDeserializationCluster : public DeserializationCluster { |
| 1913 public: | 1918 public: |
| 1914 ContextDeserializationCluster() { } | 1919 ContextDeserializationCluster() { } |
| 1915 virtual ~ContextDeserializationCluster() { } | 1920 virtual ~ContextDeserializationCluster() { } |
| 1916 | 1921 |
| 1917 void ReadAlloc(Deserializer* d) { | 1922 void ReadAlloc(Deserializer* d) { |
| 1918 start_index_ = d->next_index(); | 1923 start_index_ = d->next_index(); |
| 1919 PageSpace* old_space = d->heap()->old_space(); | 1924 PageSpace* old_space = d->heap()->old_space(); |
| 1920 intptr_t count = d->Read<intptr_t>(); | 1925 intptr_t count = d->Read<int32_t>(); |
| 1921 for (intptr_t i = 0; i < count; i++) { | 1926 for (intptr_t i = 0; i < count; i++) { |
| 1922 intptr_t length = d->Read<intptr_t>(); | 1927 intptr_t length = d->Read<int32_t>(); |
| 1923 d->AssignRef(AllocateUninitialized(old_space, | 1928 d->AssignRef(AllocateUninitialized(old_space, |
| 1924 Context::InstanceSize(length))); | 1929 Context::InstanceSize(length))); |
| 1925 } | 1930 } |
| 1926 stop_index_ = d->next_index(); | 1931 stop_index_ = d->next_index(); |
| 1927 } | 1932 } |
| 1928 | 1933 |
| 1929 void ReadFill(Deserializer* d) { | 1934 void ReadFill(Deserializer* d) { |
| 1930 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 1935 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 1931 | 1936 |
| 1932 for (intptr_t id = start_index_; id < stop_index_; id++) { | 1937 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| 1933 RawContext* context = reinterpret_cast<RawContext*>(d->Ref(id)); | 1938 RawContext* context = reinterpret_cast<RawContext*>(d->Ref(id)); |
| 1934 intptr_t length = d->Read<intptr_t>(); | 1939 intptr_t length = d->Read<int32_t>(); |
| 1935 Deserializer::InitializeHeader(context, kContextCid, | 1940 Deserializer::InitializeHeader(context, kContextCid, |
| 1936 Context::InstanceSize(length), | 1941 Context::InstanceSize(length), |
| 1937 is_vm_object); | 1942 is_vm_object); |
| 1938 context->ptr()->num_variables_ = length; | 1943 context->ptr()->num_variables_ = length; |
| 1939 context->ptr()->parent_ = reinterpret_cast<RawContext*>(d->ReadRef()); | 1944 context->ptr()->parent_ = reinterpret_cast<RawContext*>(d->ReadRef()); |
| 1940 for (intptr_t j = 0; j < length; j++) { | 1945 for (intptr_t j = 0; j < length; j++) { |
| 1941 context->ptr()->data()[j] = d->ReadRef(); | 1946 context->ptr()->data()[j] = d->ReadRef(); |
| 1942 } | 1947 } |
| 1943 } | 1948 } |
| 1944 } | 1949 } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1958 RawObject** from = scope->from(); | 1963 RawObject** from = scope->from(); |
| 1959 RawObject** to = scope->to(length); | 1964 RawObject** to = scope->to(length); |
| 1960 for (RawObject** p = from; p <= to; p++) { | 1965 for (RawObject** p = from; p <= to; p++) { |
| 1961 s->Push(*p); | 1966 s->Push(*p); |
| 1962 } | 1967 } |
| 1963 } | 1968 } |
| 1964 | 1969 |
| 1965 void WriteAlloc(Serializer* s) { | 1970 void WriteAlloc(Serializer* s) { |
| 1966 s->WriteCid(kContextScopeCid); | 1971 s->WriteCid(kContextScopeCid); |
| 1967 intptr_t count = objects_.length(); | 1972 intptr_t count = objects_.length(); |
| 1968 s->Write<intptr_t>(count); | 1973 s->Write<int32_t>(count); |
| 1969 for (intptr_t i = 0; i < count; i++) { | 1974 for (intptr_t i = 0; i < count; i++) { |
| 1970 RawContextScope* scope = objects_[i]; | 1975 RawContextScope* scope = objects_[i]; |
| 1971 intptr_t length = scope->ptr()->num_variables_; | 1976 intptr_t length = scope->ptr()->num_variables_; |
| 1972 s->Write<intptr_t>(length); | 1977 s->Write<int32_t>(length); |
| 1973 s->AssignRef(scope); | 1978 s->AssignRef(scope); |
| 1974 } | 1979 } |
| 1975 } | 1980 } |
| 1976 | 1981 |
| 1977 void WriteFill(Serializer* s) { | 1982 void WriteFill(Serializer* s) { |
| 1978 intptr_t count = objects_.length(); | 1983 intptr_t count = objects_.length(); |
| 1979 for (intptr_t i = 0; i < count; i++) { | 1984 for (intptr_t i = 0; i < count; i++) { |
| 1980 RawContextScope* scope = objects_[i]; | 1985 RawContextScope* scope = objects_[i]; |
| 1981 intptr_t length = scope->ptr()->num_variables_; | 1986 intptr_t length = scope->ptr()->num_variables_; |
| 1982 s->Write<intptr_t>(length); | 1987 s->Write<int32_t>(length); |
| 1983 s->Write<bool>(scope->ptr()->is_implicit_); | 1988 s->Write<bool>(scope->ptr()->is_implicit_); |
| 1984 RawObject** from = scope->from(); | 1989 RawObject** from = scope->from(); |
| 1985 RawObject** to = scope->to(length); | 1990 RawObject** to = scope->to(length); |
| 1986 for (RawObject** p = from; p <= to; p++) { | 1991 for (RawObject** p = from; p <= to; p++) { |
| 1987 s->WriteRef(*p); | 1992 s->WriteRef(*p); |
| 1988 } | 1993 } |
| 1989 } | 1994 } |
| 1990 } | 1995 } |
| 1991 | 1996 |
| 1992 private: | 1997 private: |
| 1993 GrowableArray<RawContextScope*> objects_; | 1998 GrowableArray<RawContextScope*> objects_; |
| 1994 }; | 1999 }; |
| 1995 | 2000 |
| 1996 | 2001 |
| 1997 class ContextScopeDeserializationCluster : public DeserializationCluster { | 2002 class ContextScopeDeserializationCluster : public DeserializationCluster { |
| 1998 public: | 2003 public: |
| 1999 ContextScopeDeserializationCluster() { } | 2004 ContextScopeDeserializationCluster() { } |
| 2000 virtual ~ContextScopeDeserializationCluster() { } | 2005 virtual ~ContextScopeDeserializationCluster() { } |
| 2001 | 2006 |
| 2002 void ReadAlloc(Deserializer* d) { | 2007 void ReadAlloc(Deserializer* d) { |
| 2003 start_index_ = d->next_index(); | 2008 start_index_ = d->next_index(); |
| 2004 PageSpace* old_space = d->heap()->old_space(); | 2009 PageSpace* old_space = d->heap()->old_space(); |
| 2005 intptr_t count = d->Read<intptr_t>(); | 2010 intptr_t count = d->Read<int32_t>(); |
| 2006 for (intptr_t i = 0; i < count; i++) { | 2011 for (intptr_t i = 0; i < count; i++) { |
| 2007 intptr_t length = d->Read<intptr_t>(); | 2012 intptr_t length = d->Read<int32_t>(); |
| 2008 d->AssignRef(AllocateUninitialized(old_space, | 2013 d->AssignRef(AllocateUninitialized(old_space, |
| 2009 ContextScope::InstanceSize(length))); | 2014 ContextScope::InstanceSize(length))); |
| 2010 } | 2015 } |
| 2011 stop_index_ = d->next_index(); | 2016 stop_index_ = d->next_index(); |
| 2012 } | 2017 } |
| 2013 | 2018 |
| 2014 void ReadFill(Deserializer* d) { | 2019 void ReadFill(Deserializer* d) { |
| 2015 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2020 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 2016 | 2021 |
| 2017 for (intptr_t id = start_index_; id < stop_index_; id++) { | 2022 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| 2018 RawContextScope* scope = reinterpret_cast<RawContextScope*>(d->Ref(id)); | 2023 RawContextScope* scope = reinterpret_cast<RawContextScope*>(d->Ref(id)); |
| 2019 intptr_t length = d->Read<intptr_t>(); | 2024 intptr_t length = d->Read<int32_t>(); |
| 2020 Deserializer::InitializeHeader(scope, kContextScopeCid, | 2025 Deserializer::InitializeHeader(scope, kContextScopeCid, |
| 2021 ContextScope::InstanceSize(length), | 2026 ContextScope::InstanceSize(length), |
| 2022 is_vm_object); | 2027 is_vm_object); |
| 2023 scope->ptr()->num_variables_ = length; | 2028 scope->ptr()->num_variables_ = length; |
| 2024 scope->ptr()->is_implicit_ = d->Read<bool>(); | 2029 scope->ptr()->is_implicit_ = d->Read<bool>(); |
| 2025 RawObject** from = scope->from(); | 2030 RawObject** from = scope->from(); |
| 2026 RawObject** to = scope->to(length); | 2031 RawObject** to = scope->to(length); |
| 2027 for (RawObject** p = from; p <= to; p++) { | 2032 for (RawObject** p = from; p <= to; p++) { |
| 2028 *p = d->ReadRef(); | 2033 *p = d->ReadRef(); |
| 2029 } | 2034 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 2044 RawObject** from = ic->from(); | 2049 RawObject** from = ic->from(); |
| 2045 RawObject** to = ic->to_snapshot(s->kind()); | 2050 RawObject** to = ic->to_snapshot(s->kind()); |
| 2046 for (RawObject** p = from; p <= to; p++) { | 2051 for (RawObject** p = from; p <= to; p++) { |
| 2047 s->Push(*p); | 2052 s->Push(*p); |
| 2048 } | 2053 } |
| 2049 } | 2054 } |
| 2050 | 2055 |
| 2051 void WriteAlloc(Serializer* s) { | 2056 void WriteAlloc(Serializer* s) { |
| 2052 s->WriteCid(kICDataCid); | 2057 s->WriteCid(kICDataCid); |
| 2053 intptr_t count = objects_.length(); | 2058 intptr_t count = objects_.length(); |
| 2054 s->Write<intptr_t>(count); | 2059 s->Write<int32_t>(count); |
| 2055 for (intptr_t i = 0; i < count; i++) { | 2060 for (intptr_t i = 0; i < count; i++) { |
| 2056 RawICData* ic = objects_[i]; | 2061 RawICData* ic = objects_[i]; |
| 2057 s->AssignRef(ic); | 2062 s->AssignRef(ic); |
| 2058 } | 2063 } |
| 2059 } | 2064 } |
| 2060 | 2065 |
| 2061 void WriteFill(Serializer* s) { | 2066 void WriteFill(Serializer* s) { |
| 2062 Snapshot::Kind kind = s->kind(); | 2067 Snapshot::Kind kind = s->kind(); |
| 2063 intptr_t count = objects_.length(); | 2068 intptr_t count = objects_.length(); |
| 2064 for (intptr_t i = 0; i < count; i++) { | 2069 for (intptr_t i = 0; i < count; i++) { |
| 2065 RawICData* ic = objects_[i]; | 2070 RawICData* ic = objects_[i]; |
| 2066 RawObject** from = ic->from(); | 2071 RawObject** from = ic->from(); |
| 2067 RawObject** to = ic->to_snapshot(kind); | 2072 RawObject** to = ic->to_snapshot(kind); |
| 2068 for (RawObject** p = from; p <= to; p++) { | 2073 for (RawObject** p = from; p <= to; p++) { |
| 2069 s->WriteRef(*p); | 2074 s->WriteRef(*p); |
| 2070 } | 2075 } |
| 2071 s->Write<int32_t>(ic->ptr()->deopt_id_); | 2076 s->Write<int32_t>(ic->ptr()->deopt_id_); |
| 2072 s->Write<uint32_t>(ic->ptr()->state_bits_); | 2077 s->Write<uint32_t>(ic->ptr()->state_bits_); |
| 2073 #if defined(TAG_IC_DATA) | 2078 #if defined(TAG_IC_DATA) |
| 2074 s->Write<intptr_t>(ic->ptr()->tag_); | 2079 s->Write<int32_t>(ic->ptr()->tag_); |
| 2075 #endif | 2080 #endif |
| 2076 } | 2081 } |
| 2077 } | 2082 } |
| 2078 | 2083 |
| 2079 private: | 2084 private: |
| 2080 GrowableArray<RawICData*> objects_; | 2085 GrowableArray<RawICData*> objects_; |
| 2081 }; | 2086 }; |
| 2082 | 2087 |
| 2083 | 2088 |
| 2084 class ICDataDeserializationCluster : public DeserializationCluster { | 2089 class ICDataDeserializationCluster : public DeserializationCluster { |
| 2085 public: | 2090 public: |
| 2086 ICDataDeserializationCluster() { } | 2091 ICDataDeserializationCluster() { } |
| 2087 virtual ~ICDataDeserializationCluster() { } | 2092 virtual ~ICDataDeserializationCluster() { } |
| 2088 | 2093 |
| 2089 void ReadAlloc(Deserializer* d) { | 2094 void ReadAlloc(Deserializer* d) { |
| 2090 start_index_ = d->next_index(); | 2095 start_index_ = d->next_index(); |
| 2091 PageSpace* old_space = d->heap()->old_space(); | 2096 PageSpace* old_space = d->heap()->old_space(); |
| 2092 intptr_t count = d->Read<intptr_t>(); | 2097 intptr_t count = d->Read<int32_t>(); |
| 2093 for (intptr_t i = 0; i < count; i++) { | 2098 for (intptr_t i = 0; i < count; i++) { |
| 2094 d->AssignRef(AllocateUninitialized(old_space, ICData::InstanceSize())); | 2099 d->AssignRef(AllocateUninitialized(old_space, ICData::InstanceSize())); |
| 2095 } | 2100 } |
| 2096 stop_index_ = d->next_index(); | 2101 stop_index_ = d->next_index(); |
| 2097 } | 2102 } |
| 2098 | 2103 |
| 2099 void ReadFill(Deserializer* d) { | 2104 void ReadFill(Deserializer* d) { |
| 2100 Snapshot::Kind kind = d->kind(); | 2105 Snapshot::Kind kind = d->kind(); |
| 2101 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2106 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 2102 | 2107 |
| 2103 for (intptr_t id = start_index_; id < stop_index_; id++) { | 2108 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| 2104 RawICData* ic = reinterpret_cast<RawICData*>(d->Ref(id)); | 2109 RawICData* ic = reinterpret_cast<RawICData*>(d->Ref(id)); |
| 2105 Deserializer::InitializeHeader(ic, kICDataCid, | 2110 Deserializer::InitializeHeader(ic, kICDataCid, |
| 2106 ICData::InstanceSize(), is_vm_object); | 2111 ICData::InstanceSize(), is_vm_object); |
| 2107 RawObject** from = ic->from(); | 2112 RawObject** from = ic->from(); |
| 2108 RawObject** to_snapshot = ic->to_snapshot(kind); | 2113 RawObject** to_snapshot = ic->to_snapshot(kind); |
| 2109 RawObject** to = ic->to(); | 2114 RawObject** to = ic->to(); |
| 2110 for (RawObject** p = from; p <= to_snapshot; p++) { | 2115 for (RawObject** p = from; p <= to_snapshot; p++) { |
| 2111 *p = d->ReadRef(); | 2116 *p = d->ReadRef(); |
| 2112 } | 2117 } |
| 2113 for (RawObject** p = to_snapshot + 1; p <= to; p++) { | 2118 for (RawObject** p = to_snapshot + 1; p <= to; p++) { |
| 2114 *p = Object::null(); | 2119 *p = Object::null(); |
| 2115 } | 2120 } |
| 2116 ic->ptr()->deopt_id_ = d->Read<int32_t>(); | 2121 ic->ptr()->deopt_id_ = d->Read<int32_t>(); |
| 2117 ic->ptr()->state_bits_ = d->Read<int32_t>(); | 2122 ic->ptr()->state_bits_ = d->Read<int32_t>(); |
| 2118 #if defined(TAG_IC_DATA) | 2123 #if defined(TAG_IC_DATA) |
| 2119 ic->ptr()->tag_ = d->Read<intptr_t>(); | 2124 ic->ptr()->tag_ = d->Read<int32_t>(); |
| 2120 #endif | 2125 #endif |
| 2121 } | 2126 } |
| 2122 } | 2127 } |
| 2123 | 2128 |
| 2124 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { | 2129 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { |
| 2125 NOT_IN_PRODUCT(TimelineDurationScope tds(Thread::Current(), | 2130 NOT_IN_PRODUCT(TimelineDurationScope tds(Thread::Current(), |
| 2126 Timeline::GetIsolateStream(), "PostLoadICData")); | 2131 Timeline::GetIsolateStream(), "PostLoadICData")); |
| 2127 | 2132 |
| 2128 if (kind == Snapshot::kAppNoJIT) { | 2133 if (kind == Snapshot::kAppNoJIT) { |
| 2129 ICData& ic = ICData::Handle(zone); | 2134 ICData& ic = ICData::Handle(zone); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 2158 RawObject** from = cache->from(); | 2163 RawObject** from = cache->from(); |
| 2159 RawObject** to = cache->to(); | 2164 RawObject** to = cache->to(); |
| 2160 for (RawObject** p = from; p <= to; p++) { | 2165 for (RawObject** p = from; p <= to; p++) { |
| 2161 s->Push(*p); | 2166 s->Push(*p); |
| 2162 } | 2167 } |
| 2163 } | 2168 } |
| 2164 | 2169 |
| 2165 void WriteAlloc(Serializer* s) { | 2170 void WriteAlloc(Serializer* s) { |
| 2166 s->WriteCid(kMegamorphicCacheCid); | 2171 s->WriteCid(kMegamorphicCacheCid); |
| 2167 intptr_t count = objects_.length(); | 2172 intptr_t count = objects_.length(); |
| 2168 s->Write<intptr_t>(count); | 2173 s->Write<int32_t>(count); |
| 2169 for (intptr_t i = 0; i < count; i++) { | 2174 for (intptr_t i = 0; i < count; i++) { |
| 2170 RawMegamorphicCache* cache = objects_[i]; | 2175 RawMegamorphicCache* cache = objects_[i]; |
| 2171 s->AssignRef(cache); | 2176 s->AssignRef(cache); |
| 2172 } | 2177 } |
| 2173 } | 2178 } |
| 2174 | 2179 |
| 2175 void WriteFill(Serializer* s) { | 2180 void WriteFill(Serializer* s) { |
| 2176 intptr_t count = objects_.length(); | 2181 intptr_t count = objects_.length(); |
| 2177 for (intptr_t i = 0; i < count; i++) { | 2182 for (intptr_t i = 0; i < count; i++) { |
| 2178 RawMegamorphicCache* cache = objects_[i]; | 2183 RawMegamorphicCache* cache = objects_[i]; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 2191 | 2196 |
| 2192 | 2197 |
| 2193 class MegamorphicCacheDeserializationCluster : public DeserializationCluster { | 2198 class MegamorphicCacheDeserializationCluster : public DeserializationCluster { |
| 2194 public: | 2199 public: |
| 2195 MegamorphicCacheDeserializationCluster() { } | 2200 MegamorphicCacheDeserializationCluster() { } |
| 2196 virtual ~MegamorphicCacheDeserializationCluster() { } | 2201 virtual ~MegamorphicCacheDeserializationCluster() { } |
| 2197 | 2202 |
| 2198 void ReadAlloc(Deserializer* d) { | 2203 void ReadAlloc(Deserializer* d) { |
| 2199 start_index_ = d->next_index(); | 2204 start_index_ = d->next_index(); |
| 2200 PageSpace* old_space = d->heap()->old_space(); | 2205 PageSpace* old_space = d->heap()->old_space(); |
| 2201 intptr_t count = d->Read<intptr_t>(); | 2206 intptr_t count = d->Read<int32_t>(); |
| 2202 for (intptr_t i = 0; i < count; i++) { | 2207 for (intptr_t i = 0; i < count; i++) { |
| 2203 d->AssignRef(AllocateUninitialized(old_space, | 2208 d->AssignRef(AllocateUninitialized(old_space, |
| 2204 MegamorphicCache::InstanceSize())); | 2209 MegamorphicCache::InstanceSize())); |
| 2205 } | 2210 } |
| 2206 stop_index_ = d->next_index(); | 2211 stop_index_ = d->next_index(); |
| 2207 } | 2212 } |
| 2208 | 2213 |
| 2209 void ReadFill(Deserializer* d) { | 2214 void ReadFill(Deserializer* d) { |
| 2210 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2215 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 2211 | 2216 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 2233 | 2238 |
| 2234 void Trace(Serializer* s, RawObject* object) { | 2239 void Trace(Serializer* s, RawObject* object) { |
| 2235 RawSubtypeTestCache* cache = SubtypeTestCache::RawCast(object); | 2240 RawSubtypeTestCache* cache = SubtypeTestCache::RawCast(object); |
| 2236 objects_.Add(cache); | 2241 objects_.Add(cache); |
| 2237 s->Push(cache->ptr()->cache_); | 2242 s->Push(cache->ptr()->cache_); |
| 2238 } | 2243 } |
| 2239 | 2244 |
| 2240 void WriteAlloc(Serializer* s) { | 2245 void WriteAlloc(Serializer* s) { |
| 2241 s->WriteCid(kSubtypeTestCacheCid); | 2246 s->WriteCid(kSubtypeTestCacheCid); |
| 2242 intptr_t count = objects_.length(); | 2247 intptr_t count = objects_.length(); |
| 2243 s->Write<intptr_t>(count); | 2248 s->Write<int32_t>(count); |
| 2244 for (intptr_t i = 0; i < count; i++) { | 2249 for (intptr_t i = 0; i < count; i++) { |
| 2245 RawSubtypeTestCache* cache = objects_[i]; | 2250 RawSubtypeTestCache* cache = objects_[i]; |
| 2246 s->AssignRef(cache); | 2251 s->AssignRef(cache); |
| 2247 } | 2252 } |
| 2248 } | 2253 } |
| 2249 | 2254 |
| 2250 void WriteFill(Serializer* s) { | 2255 void WriteFill(Serializer* s) { |
| 2251 intptr_t count = objects_.length(); | 2256 intptr_t count = objects_.length(); |
| 2252 for (intptr_t i = 0; i < count; i++) { | 2257 for (intptr_t i = 0; i < count; i++) { |
| 2253 RawSubtypeTestCache* cache = objects_[i]; | 2258 RawSubtypeTestCache* cache = objects_[i]; |
| 2254 s->WriteRef(cache->ptr()->cache_); | 2259 s->WriteRef(cache->ptr()->cache_); |
| 2255 } | 2260 } |
| 2256 } | 2261 } |
| 2257 | 2262 |
| 2258 private: | 2263 private: |
| 2259 GrowableArray<RawSubtypeTestCache*> objects_; | 2264 GrowableArray<RawSubtypeTestCache*> objects_; |
| 2260 }; | 2265 }; |
| 2261 | 2266 |
| 2262 | 2267 |
| 2263 class SubtypeTestCacheDeserializationCluster : public DeserializationCluster { | 2268 class SubtypeTestCacheDeserializationCluster : public DeserializationCluster { |
| 2264 public: | 2269 public: |
| 2265 SubtypeTestCacheDeserializationCluster() { } | 2270 SubtypeTestCacheDeserializationCluster() { } |
| 2266 virtual ~SubtypeTestCacheDeserializationCluster() { } | 2271 virtual ~SubtypeTestCacheDeserializationCluster() { } |
| 2267 | 2272 |
| 2268 void ReadAlloc(Deserializer* d) { | 2273 void ReadAlloc(Deserializer* d) { |
| 2269 start_index_ = d->next_index(); | 2274 start_index_ = d->next_index(); |
| 2270 PageSpace* old_space = d->heap()->old_space(); | 2275 PageSpace* old_space = d->heap()->old_space(); |
| 2271 intptr_t count = d->Read<intptr_t>(); | 2276 intptr_t count = d->Read<int32_t>(); |
| 2272 for (intptr_t i = 0; i < count; i++) { | 2277 for (intptr_t i = 0; i < count; i++) { |
| 2273 d->AssignRef(AllocateUninitialized(old_space, | 2278 d->AssignRef(AllocateUninitialized(old_space, |
| 2274 SubtypeTestCache::InstanceSize())); | 2279 SubtypeTestCache::InstanceSize())); |
| 2275 } | 2280 } |
| 2276 stop_index_ = d->next_index(); | 2281 stop_index_ = d->next_index(); |
| 2277 } | 2282 } |
| 2278 | 2283 |
| 2279 void ReadFill(Deserializer* d) { | 2284 void ReadFill(Deserializer* d) { |
| 2280 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2285 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 2281 | 2286 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 2303 RawObject** from = error->from(); | 2308 RawObject** from = error->from(); |
| 2304 RawObject** to = error->to(); | 2309 RawObject** to = error->to(); |
| 2305 for (RawObject** p = from; p <= to; p++) { | 2310 for (RawObject** p = from; p <= to; p++) { |
| 2306 s->Push(*p); | 2311 s->Push(*p); |
| 2307 } | 2312 } |
| 2308 } | 2313 } |
| 2309 | 2314 |
| 2310 void WriteAlloc(Serializer* s) { | 2315 void WriteAlloc(Serializer* s) { |
| 2311 s->WriteCid(kLanguageErrorCid); | 2316 s->WriteCid(kLanguageErrorCid); |
| 2312 intptr_t count = objects_.length(); | 2317 intptr_t count = objects_.length(); |
| 2313 s->Write<intptr_t>(count); | 2318 s->Write<int32_t>(count); |
| 2314 for (intptr_t i = 0; i < count; i++) { | 2319 for (intptr_t i = 0; i < count; i++) { |
| 2315 RawLanguageError* error = objects_[i]; | 2320 RawLanguageError* error = objects_[i]; |
| 2316 s->AssignRef(error); | 2321 s->AssignRef(error); |
| 2317 } | 2322 } |
| 2318 } | 2323 } |
| 2319 | 2324 |
| 2320 void WriteFill(Serializer* s) { | 2325 void WriteFill(Serializer* s) { |
| 2321 intptr_t count = objects_.length(); | 2326 intptr_t count = objects_.length(); |
| 2322 for (intptr_t i = 0; i < count; i++) { | 2327 for (intptr_t i = 0; i < count; i++) { |
| 2323 RawLanguageError* error = objects_[i]; | 2328 RawLanguageError* error = objects_[i]; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 2338 | 2343 |
| 2339 | 2344 |
| 2340 class LanguageErrorDeserializationCluster : public DeserializationCluster { | 2345 class LanguageErrorDeserializationCluster : public DeserializationCluster { |
| 2341 public: | 2346 public: |
| 2342 LanguageErrorDeserializationCluster() { } | 2347 LanguageErrorDeserializationCluster() { } |
| 2343 virtual ~LanguageErrorDeserializationCluster() { } | 2348 virtual ~LanguageErrorDeserializationCluster() { } |
| 2344 | 2349 |
| 2345 void ReadAlloc(Deserializer* d) { | 2350 void ReadAlloc(Deserializer* d) { |
| 2346 start_index_ = d->next_index(); | 2351 start_index_ = d->next_index(); |
| 2347 PageSpace* old_space = d->heap()->old_space(); | 2352 PageSpace* old_space = d->heap()->old_space(); |
| 2348 intptr_t count = d->Read<intptr_t>(); | 2353 intptr_t count = d->Read<int32_t>(); |
| 2349 for (intptr_t i = 0; i < count; i++) { | 2354 for (intptr_t i = 0; i < count; i++) { |
| 2350 d->AssignRef(AllocateUninitialized(old_space, | 2355 d->AssignRef(AllocateUninitialized(old_space, |
| 2351 LanguageError::InstanceSize())); | 2356 LanguageError::InstanceSize())); |
| 2352 } | 2357 } |
| 2353 stop_index_ = d->next_index(); | 2358 stop_index_ = d->next_index(); |
| 2354 } | 2359 } |
| 2355 | 2360 |
| 2356 void ReadFill(Deserializer* d) { | 2361 void ReadFill(Deserializer* d) { |
| 2357 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2362 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 2358 | 2363 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 2386 RawObject** from = exception->from(); | 2391 RawObject** from = exception->from(); |
| 2387 RawObject** to = exception->to(); | 2392 RawObject** to = exception->to(); |
| 2388 for (RawObject** p = from; p <= to; p++) { | 2393 for (RawObject** p = from; p <= to; p++) { |
| 2389 s->Push(*p); | 2394 s->Push(*p); |
| 2390 } | 2395 } |
| 2391 } | 2396 } |
| 2392 | 2397 |
| 2393 void WriteAlloc(Serializer* s) { | 2398 void WriteAlloc(Serializer* s) { |
| 2394 s->WriteCid(kUnhandledExceptionCid); | 2399 s->WriteCid(kUnhandledExceptionCid); |
| 2395 intptr_t count = objects_.length(); | 2400 intptr_t count = objects_.length(); |
| 2396 s->Write<intptr_t>(count); | 2401 s->Write<int32_t>(count); |
| 2397 for (intptr_t i = 0; i < count; i++) { | 2402 for (intptr_t i = 0; i < count; i++) { |
| 2398 RawUnhandledException* exception = objects_[i]; | 2403 RawUnhandledException* exception = objects_[i]; |
| 2399 s->AssignRef(exception); | 2404 s->AssignRef(exception); |
| 2400 } | 2405 } |
| 2401 } | 2406 } |
| 2402 | 2407 |
| 2403 void WriteFill(Serializer* s) { | 2408 void WriteFill(Serializer* s) { |
| 2404 intptr_t count = objects_.length(); | 2409 intptr_t count = objects_.length(); |
| 2405 for (intptr_t i = 0; i < count; i++) { | 2410 for (intptr_t i = 0; i < count; i++) { |
| 2406 RawUnhandledException* exception = objects_[i]; | 2411 RawUnhandledException* exception = objects_[i]; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 2418 | 2423 |
| 2419 | 2424 |
| 2420 class UnhandledExceptionDeserializationCluster : public DeserializationCluster { | 2425 class UnhandledExceptionDeserializationCluster : public DeserializationCluster { |
| 2421 public: | 2426 public: |
| 2422 UnhandledExceptionDeserializationCluster() { } | 2427 UnhandledExceptionDeserializationCluster() { } |
| 2423 virtual ~UnhandledExceptionDeserializationCluster() { } | 2428 virtual ~UnhandledExceptionDeserializationCluster() { } |
| 2424 | 2429 |
| 2425 void ReadAlloc(Deserializer* d) { | 2430 void ReadAlloc(Deserializer* d) { |
| 2426 start_index_ = d->next_index(); | 2431 start_index_ = d->next_index(); |
| 2427 PageSpace* old_space = d->heap()->old_space(); | 2432 PageSpace* old_space = d->heap()->old_space(); |
| 2428 intptr_t count = d->Read<intptr_t>(); | 2433 intptr_t count = d->Read<int32_t>(); |
| 2429 for (intptr_t i = 0; i < count; i++) { | 2434 for (intptr_t i = 0; i < count; i++) { |
| 2430 d->AssignRef(AllocateUninitialized(old_space, | 2435 d->AssignRef(AllocateUninitialized(old_space, |
| 2431 UnhandledException::InstanceSize())); | 2436 UnhandledException::InstanceSize())); |
| 2432 } | 2437 } |
| 2433 stop_index_ = d->next_index(); | 2438 stop_index_ = d->next_index(); |
| 2434 } | 2439 } |
| 2435 | 2440 |
| 2436 void ReadFill(Deserializer* d) { | 2441 void ReadFill(Deserializer* d) { |
| 2437 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2442 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 2438 | 2443 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 2449 } | 2454 } |
| 2450 } | 2455 } |
| 2451 } | 2456 } |
| 2452 }; | 2457 }; |
| 2453 | 2458 |
| 2454 | 2459 |
| 2455 class InstanceSerializationCluster : public SerializationCluster { | 2460 class InstanceSerializationCluster : public SerializationCluster { |
| 2456 public: | 2461 public: |
| 2457 explicit InstanceSerializationCluster(intptr_t cid) : cid_(cid) { | 2462 explicit InstanceSerializationCluster(intptr_t cid) : cid_(cid) { |
| 2458 RawClass* cls = Isolate::Current()->class_table()->At(cid); | 2463 RawClass* cls = Isolate::Current()->class_table()->At(cid); |
| 2459 next_field_offset_ = | 2464 next_field_offset_in_words_ = cls->ptr()->next_field_offset_in_words_; |
| 2460 cls->ptr()->next_field_offset_in_words_ << kWordSizeLog2; | |
| 2461 instance_size_in_words_ = cls->ptr()->instance_size_in_words_; | 2465 instance_size_in_words_ = cls->ptr()->instance_size_in_words_; |
| 2462 ASSERT(next_field_offset_ > 0); | 2466 ASSERT(next_field_offset_in_words_ > 0); |
| 2463 ASSERT(instance_size_in_words_ > 0); | 2467 ASSERT(instance_size_in_words_ > 0); |
| 2464 } | 2468 } |
| 2465 virtual ~InstanceSerializationCluster() { } | 2469 virtual ~InstanceSerializationCluster() { } |
| 2466 | 2470 |
| 2467 void Trace(Serializer* s, RawObject* object) { | 2471 void Trace(Serializer* s, RawObject* object) { |
| 2468 RawInstance* instance = Instance::RawCast(object); | 2472 RawInstance* instance = Instance::RawCast(object); |
| 2469 objects_.Add(instance); | 2473 objects_.Add(instance); |
| 2470 | 2474 |
| 2475 intptr_t next_field_offset = next_field_offset_in_words_ << kWordSizeLog2; | |
| 2471 intptr_t offset = Instance::NextFieldOffset(); | 2476 intptr_t offset = Instance::NextFieldOffset(); |
| 2472 while (offset < next_field_offset_) { | 2477 while (offset < next_field_offset) { |
| 2473 RawObject* raw_obj = *reinterpret_cast<RawObject**>( | 2478 RawObject* raw_obj = *reinterpret_cast<RawObject**>( |
| 2474 reinterpret_cast<uword>(instance->ptr()) + offset); | 2479 reinterpret_cast<uword>(instance->ptr()) + offset); |
| 2475 s->Push(raw_obj); | 2480 s->Push(raw_obj); |
| 2476 offset += kWordSize; | 2481 offset += kWordSize; |
| 2477 } | 2482 } |
| 2478 } | 2483 } |
| 2479 | 2484 |
| 2480 void WriteAlloc(Serializer* s) { | 2485 void WriteAlloc(Serializer* s) { |
| 2481 s->Write<intptr_t>(cid_); | 2486 s->Write<int32_t>(cid_); |
| 2482 intptr_t count = objects_.length(); | 2487 intptr_t count = objects_.length(); |
| 2483 s->Write<intptr_t>(count); | 2488 s->Write<int32_t>(count); |
| 2484 | 2489 |
| 2485 s->Write<intptr_t>(next_field_offset_); | 2490 s->Write<int32_t>(next_field_offset_in_words_); |
| 2486 s->Write<intptr_t>(instance_size_in_words_); | 2491 s->Write<int32_t>(instance_size_in_words_); |
| 2487 | 2492 |
| 2488 for (intptr_t i = 0; i < count; i++) { | 2493 for (intptr_t i = 0; i < count; i++) { |
| 2489 RawInstance* instance = objects_[i]; | 2494 RawInstance* instance = objects_[i]; |
| 2490 s->AssignRef(instance); | 2495 s->AssignRef(instance); |
| 2491 } | 2496 } |
| 2492 } | 2497 } |
| 2493 | 2498 |
| 2494 void WriteFill(Serializer* s) { | 2499 void WriteFill(Serializer* s) { |
| 2500 intptr_t next_field_offset = next_field_offset_in_words_ << kWordSizeLog2; | |
| 2495 intptr_t count = objects_.length(); | 2501 intptr_t count = objects_.length(); |
| 2496 for (intptr_t i = 0; i < count; i++) { | 2502 for (intptr_t i = 0; i < count; i++) { |
| 2497 RawInstance* instance = objects_[i]; | 2503 RawInstance* instance = objects_[i]; |
| 2498 s->Write<bool>(instance->IsCanonical()); | 2504 s->Write<bool>(instance->IsCanonical()); |
| 2499 intptr_t offset = Instance::NextFieldOffset(); | 2505 intptr_t offset = Instance::NextFieldOffset(); |
| 2500 while (offset < next_field_offset_) { | 2506 while (offset < next_field_offset) { |
| 2501 RawObject* raw_obj = *reinterpret_cast<RawObject**>( | 2507 RawObject* raw_obj = *reinterpret_cast<RawObject**>( |
| 2502 reinterpret_cast<uword>(instance->ptr()) + offset); | 2508 reinterpret_cast<uword>(instance->ptr()) + offset); |
| 2503 s->WriteRef(raw_obj); | 2509 s->WriteRef(raw_obj); |
| 2504 offset += kWordSize; | 2510 offset += kWordSize; |
| 2505 } | 2511 } |
| 2506 } | 2512 } |
| 2507 } | 2513 } |
| 2508 | 2514 |
| 2509 private: | 2515 private: |
| 2510 const intptr_t cid_; | 2516 const intptr_t cid_; |
| 2511 intptr_t next_field_offset_; | 2517 intptr_t next_field_offset_in_words_; |
| 2512 intptr_t instance_size_in_words_; | 2518 intptr_t instance_size_in_words_; |
| 2513 GrowableArray<RawInstance*> objects_; | 2519 GrowableArray<RawInstance*> objects_; |
| 2514 }; | 2520 }; |
| 2515 | 2521 |
| 2516 | 2522 |
| 2517 class InstanceDeserializationCluster : public DeserializationCluster { | 2523 class InstanceDeserializationCluster : public DeserializationCluster { |
| 2518 public: | 2524 public: |
| 2519 explicit InstanceDeserializationCluster(intptr_t cid) : cid_(cid) { } | 2525 explicit InstanceDeserializationCluster(intptr_t cid) : cid_(cid) { } |
| 2520 virtual ~InstanceDeserializationCluster() { } | 2526 virtual ~InstanceDeserializationCluster() { } |
| 2521 | 2527 |
| 2522 void ReadAlloc(Deserializer* d) { | 2528 void ReadAlloc(Deserializer* d) { |
| 2523 start_index_ = d->next_index(); | 2529 start_index_ = d->next_index(); |
| 2524 PageSpace* old_space = d->heap()->old_space(); | 2530 PageSpace* old_space = d->heap()->old_space(); |
| 2525 intptr_t count = d->Read<intptr_t>(); | 2531 intptr_t count = d->Read<int32_t>(); |
| 2526 next_field_offset_ = d->Read<intptr_t>(); | 2532 next_field_offset_in_words_ = d->Read<int32_t>(); |
| 2527 instance_size_in_words_ = d->Read<intptr_t>(); | 2533 instance_size_in_words_ = d->Read<int32_t>(); |
| 2528 intptr_t instance_size = | 2534 intptr_t instance_size = |
| 2529 Object::RoundedAllocationSize(instance_size_in_words_ * kWordSize); | 2535 Object::RoundedAllocationSize(instance_size_in_words_ * kWordSize); |
| 2530 for (intptr_t i = 0; i < count; i++) { | 2536 for (intptr_t i = 0; i < count; i++) { |
| 2531 d->AssignRef(AllocateUninitialized(old_space, instance_size)); | 2537 d->AssignRef(AllocateUninitialized(old_space, instance_size)); |
| 2532 } | 2538 } |
| 2533 stop_index_ = d->next_index(); | 2539 stop_index_ = d->next_index(); |
| 2534 } | 2540 } |
| 2535 | 2541 |
| 2536 void ReadFill(Deserializer* d) { | 2542 void ReadFill(Deserializer* d) { |
| 2543 intptr_t next_field_offset = next_field_offset_in_words_ << kWordSizeLog2; | |
| 2537 intptr_t instance_size = | 2544 intptr_t instance_size = |
| 2538 Object::RoundedAllocationSize(instance_size_in_words_ * kWordSize); | 2545 Object::RoundedAllocationSize(instance_size_in_words_ * kWordSize); |
| 2539 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2546 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 2540 | 2547 |
| 2541 for (intptr_t id = start_index_; id < stop_index_; id++) { | 2548 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| 2542 RawInstance* instance = reinterpret_cast<RawInstance*>(d->Ref(id)); | 2549 RawInstance* instance = reinterpret_cast<RawInstance*>(d->Ref(id)); |
| 2543 bool is_canonical = d->Read<bool>(); | 2550 bool is_canonical = d->Read<bool>(); |
| 2544 Deserializer::InitializeHeader(instance, cid_, | 2551 Deserializer::InitializeHeader(instance, cid_, |
| 2545 instance_size, | 2552 instance_size, |
| 2546 is_vm_object, is_canonical); | 2553 is_vm_object, is_canonical); |
| 2547 intptr_t offset = Instance::NextFieldOffset(); | 2554 intptr_t offset = Instance::NextFieldOffset(); |
| 2548 while (offset < next_field_offset_) { | 2555 while (offset < next_field_offset) { |
| 2549 RawObject** p = reinterpret_cast<RawObject**>( | 2556 RawObject** p = reinterpret_cast<RawObject**>( |
| 2550 reinterpret_cast<uword>(instance->ptr()) + offset); | 2557 reinterpret_cast<uword>(instance->ptr()) + offset); |
| 2551 *p = d->ReadRef(); | 2558 *p = d->ReadRef(); |
| 2552 offset += kWordSize; | 2559 offset += kWordSize; |
| 2553 } | 2560 } |
| 2554 if (offset < instance_size) { | 2561 if (offset < instance_size) { |
| 2555 RawObject** p = reinterpret_cast<RawObject**>( | 2562 RawObject** p = reinterpret_cast<RawObject**>( |
| 2556 reinterpret_cast<uword>(instance->ptr()) + offset); | 2563 reinterpret_cast<uword>(instance->ptr()) + offset); |
| 2557 *p = Object::null(); | 2564 *p = Object::null(); |
| 2558 offset += kWordSize; | 2565 offset += kWordSize; |
| 2559 } | 2566 } |
| 2560 ASSERT(offset == instance_size); | 2567 ASSERT(offset == instance_size); |
| 2561 } | 2568 } |
| 2562 } | 2569 } |
| 2563 | 2570 |
| 2564 private: | 2571 private: |
| 2565 const intptr_t cid_; | 2572 const intptr_t cid_; |
| 2566 intptr_t next_field_offset_; | 2573 intptr_t next_field_offset_in_words_; |
| 2567 intptr_t instance_size_in_words_; | 2574 intptr_t instance_size_in_words_; |
| 2568 }; | 2575 }; |
| 2569 | 2576 |
| 2570 | 2577 |
| 2571 class LibraryPrefixSerializationCluster : public SerializationCluster { | 2578 class LibraryPrefixSerializationCluster : public SerializationCluster { |
| 2572 public: | 2579 public: |
| 2573 LibraryPrefixSerializationCluster() { } | 2580 LibraryPrefixSerializationCluster() { } |
| 2574 virtual ~LibraryPrefixSerializationCluster() { } | 2581 virtual ~LibraryPrefixSerializationCluster() { } |
| 2575 | 2582 |
| 2576 void Trace(Serializer* s, RawObject* object) { | 2583 void Trace(Serializer* s, RawObject* object) { |
| 2577 RawLibraryPrefix* prefix = LibraryPrefix::RawCast(object); | 2584 RawLibraryPrefix* prefix = LibraryPrefix::RawCast(object); |
| 2578 objects_.Add(prefix); | 2585 objects_.Add(prefix); |
| 2579 | 2586 |
| 2580 RawObject** from = prefix->from(); | 2587 RawObject** from = prefix->from(); |
| 2581 RawObject** to = prefix->to(); | 2588 RawObject** to = prefix->to(); |
| 2582 for (RawObject** p = from; p <= to; p++) { | 2589 for (RawObject** p = from; p <= to; p++) { |
| 2583 s->Push(*p); | 2590 s->Push(*p); |
| 2584 } | 2591 } |
| 2585 } | 2592 } |
| 2586 | 2593 |
| 2587 void WriteAlloc(Serializer* s) { | 2594 void WriteAlloc(Serializer* s) { |
| 2588 s->WriteCid(kLibraryPrefixCid); | 2595 s->WriteCid(kLibraryPrefixCid); |
| 2589 intptr_t count = objects_.length(); | 2596 intptr_t count = objects_.length(); |
| 2590 s->Write<intptr_t>(count); | 2597 s->Write<int32_t>(count); |
| 2591 for (intptr_t i = 0; i < count; i++) { | 2598 for (intptr_t i = 0; i < count; i++) { |
| 2592 RawLibraryPrefix* prefix = objects_[i]; | 2599 RawLibraryPrefix* prefix = objects_[i]; |
| 2593 s->AssignRef(prefix); | 2600 s->AssignRef(prefix); |
| 2594 } | 2601 } |
| 2595 } | 2602 } |
| 2596 | 2603 |
| 2597 void WriteFill(Serializer* s) { | 2604 void WriteFill(Serializer* s) { |
| 2598 intptr_t count = objects_.length(); | 2605 intptr_t count = objects_.length(); |
| 2599 for (intptr_t i = 0; i < count; i++) { | 2606 for (intptr_t i = 0; i < count; i++) { |
| 2600 RawLibraryPrefix* prefix = objects_[i]; | 2607 RawLibraryPrefix* prefix = objects_[i]; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 2615 | 2622 |
| 2616 | 2623 |
| 2617 class LibraryPrefixDeserializationCluster : public DeserializationCluster { | 2624 class LibraryPrefixDeserializationCluster : public DeserializationCluster { |
| 2618 public: | 2625 public: |
| 2619 LibraryPrefixDeserializationCluster() { } | 2626 LibraryPrefixDeserializationCluster() { } |
| 2620 virtual ~LibraryPrefixDeserializationCluster() { } | 2627 virtual ~LibraryPrefixDeserializationCluster() { } |
| 2621 | 2628 |
| 2622 void ReadAlloc(Deserializer* d) { | 2629 void ReadAlloc(Deserializer* d) { |
| 2623 start_index_ = d->next_index(); | 2630 start_index_ = d->next_index(); |
| 2624 PageSpace* old_space = d->heap()->old_space(); | 2631 PageSpace* old_space = d->heap()->old_space(); |
| 2625 intptr_t count = d->Read<intptr_t>(); | 2632 intptr_t count = d->Read<int32_t>(); |
| 2626 for (intptr_t i = 0; i < count; i++) { | 2633 for (intptr_t i = 0; i < count; i++) { |
| 2627 d->AssignRef(AllocateUninitialized(old_space, | 2634 d->AssignRef(AllocateUninitialized(old_space, |
| 2628 LibraryPrefix::InstanceSize())); | 2635 LibraryPrefix::InstanceSize())); |
| 2629 } | 2636 } |
| 2630 stop_index_ = d->next_index(); | 2637 stop_index_ = d->next_index(); |
| 2631 } | 2638 } |
| 2632 | 2639 |
| 2633 void ReadFill(Deserializer* d) { | 2640 void ReadFill(Deserializer* d) { |
| 2634 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2641 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 2635 | 2642 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2673 | 2680 |
| 2674 RawSmi* raw_type_class_id = Smi::RawCast(type->ptr()->type_class_id_); | 2681 RawSmi* raw_type_class_id = Smi::RawCast(type->ptr()->type_class_id_); |
| 2675 RawClass* type_class = | 2682 RawClass* type_class = |
| 2676 s->isolate()->class_table()->At(Smi::Value(raw_type_class_id)); | 2683 s->isolate()->class_table()->At(Smi::Value(raw_type_class_id)); |
| 2677 s->Push(type_class); | 2684 s->Push(type_class); |
| 2678 } | 2685 } |
| 2679 | 2686 |
| 2680 void WriteAlloc(Serializer* s) { | 2687 void WriteAlloc(Serializer* s) { |
| 2681 s->WriteCid(kTypeCid); | 2688 s->WriteCid(kTypeCid); |
| 2682 intptr_t count = canonical_objects_.length(); | 2689 intptr_t count = canonical_objects_.length(); |
| 2683 s->Write<intptr_t>(count); | 2690 s->Write<int32_t>(count); |
| 2684 for (intptr_t i = 0; i < count; i++) { | 2691 for (intptr_t i = 0; i < count; i++) { |
| 2685 RawType* type = canonical_objects_[i]; | 2692 RawType* type = canonical_objects_[i]; |
| 2686 s->AssignRef(type); | 2693 s->AssignRef(type); |
| 2687 } | 2694 } |
| 2688 count = objects_.length(); | 2695 count = objects_.length(); |
| 2689 s->Write<intptr_t>(count); | 2696 s->Write<int32_t>(count); |
| 2690 for (intptr_t i = 0; i < count; i++) { | 2697 for (intptr_t i = 0; i < count; i++) { |
| 2691 RawType* type = objects_[i]; | 2698 RawType* type = objects_[i]; |
| 2692 s->AssignRef(type); | 2699 s->AssignRef(type); |
| 2693 } | 2700 } |
| 2694 } | 2701 } |
| 2695 | 2702 |
| 2696 void WriteFill(Serializer* s) { | 2703 void WriteFill(Serializer* s) { |
| 2697 intptr_t count = canonical_objects_.length(); | 2704 intptr_t count = canonical_objects_.length(); |
| 2698 for (intptr_t i = 0; i < count; i++) { | 2705 for (intptr_t i = 0; i < count; i++) { |
| 2699 RawType* type = canonical_objects_[i]; | 2706 RawType* type = canonical_objects_[i]; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 2725 | 2732 |
| 2726 | 2733 |
| 2727 class TypeDeserializationCluster : public DeserializationCluster { | 2734 class TypeDeserializationCluster : public DeserializationCluster { |
| 2728 public: | 2735 public: |
| 2729 TypeDeserializationCluster() { } | 2736 TypeDeserializationCluster() { } |
| 2730 virtual ~TypeDeserializationCluster() { } | 2737 virtual ~TypeDeserializationCluster() { } |
| 2731 | 2738 |
| 2732 void ReadAlloc(Deserializer* d) { | 2739 void ReadAlloc(Deserializer* d) { |
| 2733 canonical_start_index_ = d->next_index(); | 2740 canonical_start_index_ = d->next_index(); |
| 2734 PageSpace* old_space = d->heap()->old_space(); | 2741 PageSpace* old_space = d->heap()->old_space(); |
| 2735 intptr_t count = d->Read<intptr_t>(); | 2742 intptr_t count = d->Read<int32_t>(); |
| 2736 for (intptr_t i = 0; i < count; i++) { | 2743 for (intptr_t i = 0; i < count; i++) { |
| 2737 d->AssignRef(AllocateUninitialized(old_space, Type::InstanceSize())); | 2744 d->AssignRef(AllocateUninitialized(old_space, Type::InstanceSize())); |
| 2738 } | 2745 } |
| 2739 canonical_stop_index_ = d->next_index(); | 2746 canonical_stop_index_ = d->next_index(); |
| 2740 | 2747 |
| 2741 start_index_ = d->next_index(); | 2748 start_index_ = d->next_index(); |
| 2742 count = d->Read<intptr_t>(); | 2749 count = d->Read<int32_t>(); |
| 2743 for (intptr_t i = 0; i < count; i++) { | 2750 for (intptr_t i = 0; i < count; i++) { |
| 2744 d->AssignRef(AllocateUninitialized(old_space, Type::InstanceSize())); | 2751 d->AssignRef(AllocateUninitialized(old_space, Type::InstanceSize())); |
| 2745 } | 2752 } |
| 2746 stop_index_ = d->next_index(); | 2753 stop_index_ = d->next_index(); |
| 2747 } | 2754 } |
| 2748 | 2755 |
| 2749 void ReadFill(Deserializer* d) { | 2756 void ReadFill(Deserializer* d) { |
| 2750 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2757 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 2751 | 2758 |
| 2752 for (intptr_t id = canonical_start_index_; | 2759 for (intptr_t id = canonical_start_index_; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2796 RawObject** from = type->from(); | 2803 RawObject** from = type->from(); |
| 2797 RawObject** to = type->to(); | 2804 RawObject** to = type->to(); |
| 2798 for (RawObject** p = from; p <= to; p++) { | 2805 for (RawObject** p = from; p <= to; p++) { |
| 2799 s->Push(*p); | 2806 s->Push(*p); |
| 2800 } | 2807 } |
| 2801 } | 2808 } |
| 2802 | 2809 |
| 2803 void WriteAlloc(Serializer* s) { | 2810 void WriteAlloc(Serializer* s) { |
| 2804 s->WriteCid(kTypeRefCid); | 2811 s->WriteCid(kTypeRefCid); |
| 2805 intptr_t count = objects_.length(); | 2812 intptr_t count = objects_.length(); |
| 2806 s->Write<intptr_t>(count); | 2813 s->Write<int32_t>(count); |
| 2807 for (intptr_t i = 0; i < count; i++) { | 2814 for (intptr_t i = 0; i < count; i++) { |
| 2808 RawTypeRef* type = objects_[i]; | 2815 RawTypeRef* type = objects_[i]; |
| 2809 s->AssignRef(type); | 2816 s->AssignRef(type); |
| 2810 } | 2817 } |
| 2811 } | 2818 } |
| 2812 | 2819 |
| 2813 void WriteFill(Serializer* s) { | 2820 void WriteFill(Serializer* s) { |
| 2814 intptr_t count = objects_.length(); | 2821 intptr_t count = objects_.length(); |
| 2815 for (intptr_t i = 0; i < count; i++) { | 2822 for (intptr_t i = 0; i < count; i++) { |
| 2816 RawTypeRef* type = objects_[i]; | 2823 RawTypeRef* type = objects_[i]; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 2828 | 2835 |
| 2829 | 2836 |
| 2830 class TypeRefDeserializationCluster : public DeserializationCluster { | 2837 class TypeRefDeserializationCluster : public DeserializationCluster { |
| 2831 public: | 2838 public: |
| 2832 TypeRefDeserializationCluster() { } | 2839 TypeRefDeserializationCluster() { } |
| 2833 virtual ~TypeRefDeserializationCluster() { } | 2840 virtual ~TypeRefDeserializationCluster() { } |
| 2834 | 2841 |
| 2835 void ReadAlloc(Deserializer* d) { | 2842 void ReadAlloc(Deserializer* d) { |
| 2836 start_index_ = d->next_index(); | 2843 start_index_ = d->next_index(); |
| 2837 PageSpace* old_space = d->heap()->old_space(); | 2844 PageSpace* old_space = d->heap()->old_space(); |
| 2838 intptr_t count = d->Read<intptr_t>(); | 2845 intptr_t count = d->Read<int32_t>(); |
| 2839 for (intptr_t i = 0; i < count; i++) { | 2846 for (intptr_t i = 0; i < count; i++) { |
| 2840 d->AssignRef(AllocateUninitialized(old_space, TypeRef::InstanceSize())); | 2847 d->AssignRef(AllocateUninitialized(old_space, TypeRef::InstanceSize())); |
| 2841 } | 2848 } |
| 2842 stop_index_ = d->next_index(); | 2849 stop_index_ = d->next_index(); |
| 2843 } | 2850 } |
| 2844 | 2851 |
| 2845 void ReadFill(Deserializer* d) { | 2852 void ReadFill(Deserializer* d) { |
| 2846 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2853 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 2847 | 2854 |
| 2848 for (intptr_t id = start_index_; id < stop_index_; id++) { | 2855 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 2872 RawObject** from = type->from(); | 2879 RawObject** from = type->from(); |
| 2873 RawObject** to = type->to(); | 2880 RawObject** to = type->to(); |
| 2874 for (RawObject** p = from; p <= to; p++) { | 2881 for (RawObject** p = from; p <= to; p++) { |
| 2875 s->Push(*p); | 2882 s->Push(*p); |
| 2876 } | 2883 } |
| 2877 } | 2884 } |
| 2878 | 2885 |
| 2879 void WriteAlloc(Serializer* s) { | 2886 void WriteAlloc(Serializer* s) { |
| 2880 s->WriteCid(kTypeParameterCid); | 2887 s->WriteCid(kTypeParameterCid); |
| 2881 intptr_t count = objects_.length(); | 2888 intptr_t count = objects_.length(); |
| 2882 s->Write<intptr_t>(count); | 2889 s->Write<int32_t>(count); |
| 2883 for (intptr_t i = 0; i < count; i++) { | 2890 for (intptr_t i = 0; i < count; i++) { |
| 2884 RawTypeParameter* type = objects_[i]; | 2891 RawTypeParameter* type = objects_[i]; |
| 2885 s->AssignRef(type); | 2892 s->AssignRef(type); |
| 2886 } | 2893 } |
| 2887 } | 2894 } |
| 2888 | 2895 |
| 2889 void WriteFill(Serializer* s) { | 2896 void WriteFill(Serializer* s) { |
| 2890 intptr_t count = objects_.length(); | 2897 intptr_t count = objects_.length(); |
| 2891 for (intptr_t i = 0; i < count; i++) { | 2898 for (intptr_t i = 0; i < count; i++) { |
| 2892 RawTypeParameter* type = objects_[i]; | 2899 RawTypeParameter* type = objects_[i]; |
| 2893 RawObject** from = type->from(); | 2900 RawObject** from = type->from(); |
| 2894 RawObject** to = type->to(); | 2901 RawObject** to = type->to(); |
| 2895 for (RawObject** p = from; p <= to; p++) { | 2902 for (RawObject** p = from; p <= to; p++) { |
| 2896 s->WriteRef(*p); | 2903 s->WriteRef(*p); |
| 2897 } | 2904 } |
| 2898 s->Write<intptr_t>(type->ptr()->parameterized_class_id_); | 2905 s->Write<int32_t>(type->ptr()->parameterized_class_id_); |
| 2899 s->WriteTokenPosition(type->ptr()->token_pos_); | 2906 s->WriteTokenPosition(type->ptr()->token_pos_); |
| 2900 s->Write<int16_t>(type->ptr()->index_); | 2907 s->Write<int16_t>(type->ptr()->index_); |
| 2901 s->Write<int8_t>(type->ptr()->type_state_); | 2908 s->Write<int8_t>(type->ptr()->type_state_); |
| 2902 } | 2909 } |
| 2903 } | 2910 } |
| 2904 | 2911 |
| 2905 private: | 2912 private: |
| 2906 GrowableArray<RawTypeParameter*> objects_; | 2913 GrowableArray<RawTypeParameter*> objects_; |
| 2907 }; | 2914 }; |
| 2908 | 2915 |
| 2909 | 2916 |
| 2910 class TypeParameterDeserializationCluster : public DeserializationCluster { | 2917 class TypeParameterDeserializationCluster : public DeserializationCluster { |
| 2911 public: | 2918 public: |
| 2912 TypeParameterDeserializationCluster() { } | 2919 TypeParameterDeserializationCluster() { } |
| 2913 virtual ~TypeParameterDeserializationCluster() { } | 2920 virtual ~TypeParameterDeserializationCluster() { } |
| 2914 | 2921 |
| 2915 void ReadAlloc(Deserializer* d) { | 2922 void ReadAlloc(Deserializer* d) { |
| 2916 start_index_ = d->next_index(); | 2923 start_index_ = d->next_index(); |
| 2917 PageSpace* old_space = d->heap()->old_space(); | 2924 PageSpace* old_space = d->heap()->old_space(); |
| 2918 intptr_t count = d->Read<intptr_t>(); | 2925 intptr_t count = d->Read<int32_t>(); |
| 2919 for (intptr_t i = 0; i < count; i++) { | 2926 for (intptr_t i = 0; i < count; i++) { |
| 2920 d->AssignRef(AllocateUninitialized(old_space, | 2927 d->AssignRef(AllocateUninitialized(old_space, |
| 2921 TypeParameter::InstanceSize())); | 2928 TypeParameter::InstanceSize())); |
| 2922 } | 2929 } |
| 2923 stop_index_ = d->next_index(); | 2930 stop_index_ = d->next_index(); |
| 2924 } | 2931 } |
| 2925 | 2932 |
| 2926 void ReadFill(Deserializer* d) { | 2933 void ReadFill(Deserializer* d) { |
| 2927 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 2934 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 2928 | 2935 |
| 2929 for (intptr_t id = start_index_; id < stop_index_; id++) { | 2936 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| 2930 RawTypeParameter* type = reinterpret_cast<RawTypeParameter*>(d->Ref(id)); | 2937 RawTypeParameter* type = reinterpret_cast<RawTypeParameter*>(d->Ref(id)); |
| 2931 Deserializer::InitializeHeader(type, kTypeParameterCid, | 2938 Deserializer::InitializeHeader(type, kTypeParameterCid, |
| 2932 TypeParameter::InstanceSize(), | 2939 TypeParameter::InstanceSize(), |
| 2933 is_vm_object); | 2940 is_vm_object); |
| 2934 RawObject** from = type->from(); | 2941 RawObject** from = type->from(); |
| 2935 RawObject** to = type->to(); | 2942 RawObject** to = type->to(); |
| 2936 for (RawObject** p = from; p <= to; p++) { | 2943 for (RawObject** p = from; p <= to; p++) { |
| 2937 *p = d->ReadRef(); | 2944 *p = d->ReadRef(); |
| 2938 } | 2945 } |
| 2939 type->ptr()->parameterized_class_id_ = d->Read<intptr_t>(); | 2946 type->ptr()->parameterized_class_id_ = d->Read<int32_t>(); |
| 2940 type->ptr()->token_pos_ = d->ReadTokenPosition(); | 2947 type->ptr()->token_pos_ = d->ReadTokenPosition(); |
| 2941 type->ptr()->index_ = d->Read<int16_t>(); | 2948 type->ptr()->index_ = d->Read<int16_t>(); |
| 2942 type->ptr()->type_state_ = d->Read<int8_t>(); | 2949 type->ptr()->type_state_ = d->Read<int8_t>(); |
| 2943 } | 2950 } |
| 2944 } | 2951 } |
| 2945 }; | 2952 }; |
| 2946 | 2953 |
| 2947 | 2954 |
| 2948 class BoundedTypeSerializationCluster : public SerializationCluster { | 2955 class BoundedTypeSerializationCluster : public SerializationCluster { |
| 2949 public: | 2956 public: |
| 2950 BoundedTypeSerializationCluster() { } | 2957 BoundedTypeSerializationCluster() { } |
| 2951 virtual ~BoundedTypeSerializationCluster() { } | 2958 virtual ~BoundedTypeSerializationCluster() { } |
| 2952 | 2959 |
| 2953 void Trace(Serializer* s, RawObject* object) { | 2960 void Trace(Serializer* s, RawObject* object) { |
| 2954 RawBoundedType* type = BoundedType::RawCast(object); | 2961 RawBoundedType* type = BoundedType::RawCast(object); |
| 2955 objects_.Add(type); | 2962 objects_.Add(type); |
| 2956 | 2963 |
| 2957 RawObject** from = type->from(); | 2964 RawObject** from = type->from(); |
| 2958 RawObject** to = type->to(); | 2965 RawObject** to = type->to(); |
| 2959 for (RawObject** p = from; p <= to; p++) { | 2966 for (RawObject** p = from; p <= to; p++) { |
| 2960 s->Push(*p); | 2967 s->Push(*p); |
| 2961 } | 2968 } |
| 2962 } | 2969 } |
| 2963 | 2970 |
| 2964 void WriteAlloc(Serializer* s) { | 2971 void WriteAlloc(Serializer* s) { |
| 2965 s->WriteCid(kBoundedTypeCid); | 2972 s->WriteCid(kBoundedTypeCid); |
| 2966 intptr_t count = objects_.length(); | 2973 intptr_t count = objects_.length(); |
| 2967 s->Write<intptr_t>(count); | 2974 s->Write<int32_t>(count); |
| 2968 for (intptr_t i = 0; i < count; i++) { | 2975 for (intptr_t i = 0; i < count; i++) { |
| 2969 RawBoundedType* type = objects_[i]; | 2976 RawBoundedType* type = objects_[i]; |
| 2970 s->AssignRef(type); | 2977 s->AssignRef(type); |
| 2971 } | 2978 } |
| 2972 } | 2979 } |
| 2973 | 2980 |
| 2974 void WriteFill(Serializer* s) { | 2981 void WriteFill(Serializer* s) { |
| 2975 intptr_t count = objects_.length(); | 2982 intptr_t count = objects_.length(); |
| 2976 for (intptr_t i = 0; i < count; i++) { | 2983 for (intptr_t i = 0; i < count; i++) { |
| 2977 RawBoundedType* type = objects_[i]; | 2984 RawBoundedType* type = objects_[i]; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 2989 | 2996 |
| 2990 | 2997 |
| 2991 class BoundedTypeDeserializationCluster : public DeserializationCluster { | 2998 class BoundedTypeDeserializationCluster : public DeserializationCluster { |
| 2992 public: | 2999 public: |
| 2993 BoundedTypeDeserializationCluster() { } | 3000 BoundedTypeDeserializationCluster() { } |
| 2994 virtual ~BoundedTypeDeserializationCluster() { } | 3001 virtual ~BoundedTypeDeserializationCluster() { } |
| 2995 | 3002 |
| 2996 void ReadAlloc(Deserializer* d) { | 3003 void ReadAlloc(Deserializer* d) { |
| 2997 start_index_ = d->next_index(); | 3004 start_index_ = d->next_index(); |
| 2998 PageSpace* old_space = d->heap()->old_space(); | 3005 PageSpace* old_space = d->heap()->old_space(); |
| 2999 intptr_t count = d->Read<intptr_t>(); | 3006 intptr_t count = d->Read<int32_t>(); |
| 3000 for (intptr_t i = 0; i < count; i++) { | 3007 for (intptr_t i = 0; i < count; i++) { |
| 3001 d->AssignRef(AllocateUninitialized(old_space, | 3008 d->AssignRef(AllocateUninitialized(old_space, |
| 3002 BoundedType::InstanceSize())); | 3009 BoundedType::InstanceSize())); |
| 3003 } | 3010 } |
| 3004 stop_index_ = d->next_index(); | 3011 stop_index_ = d->next_index(); |
| 3005 } | 3012 } |
| 3006 | 3013 |
| 3007 void ReadFill(Deserializer* d) { | 3014 void ReadFill(Deserializer* d) { |
| 3008 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3015 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 3009 | 3016 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 3033 RawObject** from = closure->from(); | 3040 RawObject** from = closure->from(); |
| 3034 RawObject** to = closure->to(); | 3041 RawObject** to = closure->to(); |
| 3035 for (RawObject** p = from; p <= to; p++) { | 3042 for (RawObject** p = from; p <= to; p++) { |
| 3036 s->Push(*p); | 3043 s->Push(*p); |
| 3037 } | 3044 } |
| 3038 } | 3045 } |
| 3039 | 3046 |
| 3040 void WriteAlloc(Serializer* s) { | 3047 void WriteAlloc(Serializer* s) { |
| 3041 s->WriteCid(kClosureCid); | 3048 s->WriteCid(kClosureCid); |
| 3042 intptr_t count = objects_.length(); | 3049 intptr_t count = objects_.length(); |
| 3043 s->Write<intptr_t>(count); | 3050 s->Write<int32_t>(count); |
| 3044 for (intptr_t i = 0; i < count; i++) { | 3051 for (intptr_t i = 0; i < count; i++) { |
| 3045 RawClosure* closure = objects_[i]; | 3052 RawClosure* closure = objects_[i]; |
| 3046 s->AssignRef(closure); | 3053 s->AssignRef(closure); |
| 3047 } | 3054 } |
| 3048 } | 3055 } |
| 3049 | 3056 |
| 3050 void WriteFill(Serializer* s) { | 3057 void WriteFill(Serializer* s) { |
| 3051 intptr_t count = objects_.length(); | 3058 intptr_t count = objects_.length(); |
| 3052 for (intptr_t i = 0; i < count; i++) { | 3059 for (intptr_t i = 0; i < count; i++) { |
| 3053 RawClosure* closure = objects_[i]; | 3060 RawClosure* closure = objects_[i]; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 3066 | 3073 |
| 3067 | 3074 |
| 3068 class ClosureDeserializationCluster : public DeserializationCluster { | 3075 class ClosureDeserializationCluster : public DeserializationCluster { |
| 3069 public: | 3076 public: |
| 3070 ClosureDeserializationCluster() { } | 3077 ClosureDeserializationCluster() { } |
| 3071 virtual ~ClosureDeserializationCluster() { } | 3078 virtual ~ClosureDeserializationCluster() { } |
| 3072 | 3079 |
| 3073 void ReadAlloc(Deserializer* d) { | 3080 void ReadAlloc(Deserializer* d) { |
| 3074 start_index_ = d->next_index(); | 3081 start_index_ = d->next_index(); |
| 3075 PageSpace* old_space = d->heap()->old_space(); | 3082 PageSpace* old_space = d->heap()->old_space(); |
| 3076 intptr_t count = d->Read<intptr_t>(); | 3083 intptr_t count = d->Read<int32_t>(); |
| 3077 for (intptr_t i = 0; i < count; i++) { | 3084 for (intptr_t i = 0; i < count; i++) { |
| 3078 d->AssignRef(AllocateUninitialized(old_space, Closure::InstanceSize())); | 3085 d->AssignRef(AllocateUninitialized(old_space, Closure::InstanceSize())); |
| 3079 } | 3086 } |
| 3080 stop_index_ = d->next_index(); | 3087 stop_index_ = d->next_index(); |
| 3081 } | 3088 } |
| 3082 | 3089 |
| 3083 void ReadFill(Deserializer* d) { | 3090 void ReadFill(Deserializer* d) { |
| 3084 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3091 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 3085 | 3092 |
| 3086 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3093 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| 3087 RawClosure* closure = reinterpret_cast<RawClosure*>(d->Ref(id)); | 3094 RawClosure* closure = reinterpret_cast<RawClosure*>(d->Ref(id)); |
| 3088 bool is_canonical = d->Read<bool>(); | 3095 bool is_canonical = d->Read<bool>(); |
| 3089 Deserializer::InitializeHeader(closure, kClosureCid, | 3096 Deserializer::InitializeHeader(closure, kClosureCid, |
| 3090 Closure::InstanceSize(), | 3097 Closure::InstanceSize(), |
| 3091 is_vm_object, is_canonical); | 3098 is_vm_object, is_canonical); |
| 3092 RawObject** from = closure->from(); | 3099 RawObject** from = closure->from(); |
| 3093 RawObject** to = closure->to(); | 3100 RawObject** to = closure->to(); |
| 3094 for (RawObject** p = from; p <= to; p++) { | 3101 for (RawObject** p = from; p <= to; p++) { |
| 3095 *p = d->ReadRef(); | 3102 *p = d->ReadRef(); |
| 3096 } | 3103 } |
| 3097 } | 3104 } |
| 3098 } | 3105 } |
| 3099 }; | 3106 }; |
| 3100 | 3107 |
| 3101 | 3108 |
| 3109 bool IsAlwaysSmi(int64_t value) { | |
| 3110 const int64_t kMaxInt31 = (static_cast<int64_t>(1) << 30) - 1; | |
| 3111 const int64_t kMinInt31 = -(static_cast<int64_t>(1) << 30); | |
| 3112 return (value <= kMaxInt31) && (value >= kMinInt31); | |
| 3113 } | |
| 3114 | |
| 3115 | |
| 3116 bool IsAlwaysMint(int64_t value) { | |
| 3117 const int64_t kMaxInt63 = (static_cast<int64_t>(1) << 62) - 1; | |
| 3118 const int64_t kMinInt63 = -(static_cast<int64_t>(1) << 62); | |
| 3119 return (value > kMaxInt63) || (value < kMinInt63); | |
| 3120 } | |
| 3121 | |
| 3122 | |
| 3102 class MintSerializationCluster : public SerializationCluster { | 3123 class MintSerializationCluster : public SerializationCluster { |
| 3103 public: | 3124 public: |
| 3104 MintSerializationCluster() { } | 3125 MintSerializationCluster() { } |
| 3105 virtual ~MintSerializationCluster() { } | 3126 virtual ~MintSerializationCluster() { } |
| 3106 | 3127 |
| 3107 void Trace(Serializer* s, RawObject* object) { | 3128 void Trace(Serializer* s, RawObject* object) { |
| 3108 RawMint* mint = Mint::RawCast(object); | 3129 if (!object->IsHeapObject()) { |
| 3109 objects_.Add(mint); | 3130 RawSmi* smi = Smi::RawCast(object); |
| 3131 if (IsAlwaysSmi(Smi::Value(smi))) { | |
| 3132 always_smi_.Add(smi); | |
| 3133 } else { | |
| 3134 sometimes_smi_.Add(smi); | |
| 3135 } | |
| 3136 } else { | |
| 3137 RawMint* mint = Mint::RawCast(object); | |
| 3138 if (IsAlwaysMint(mint->ptr()->value_)) { | |
| 3139 always_mint_.Add(mint); | |
| 3140 } else { | |
| 3141 sometimes_mint_.Add(mint); | |
| 3142 } | |
| 3143 } | |
| 3110 } | 3144 } |
| 3111 | 3145 |
| 3112 void WriteAlloc(Serializer* s) { | 3146 void WriteAlloc(Serializer* s) { |
| 3113 s->WriteCid(kMintCid); | 3147 s->WriteCid(kMintCid); |
| 3114 intptr_t count = objects_.length(); | 3148 |
| 3115 s->Write<intptr_t>(count); | 3149 { |
| 3116 for (intptr_t i = 0; i < count; i++) { | 3150 intptr_t count = always_smi_.length(); |
| 3117 RawMint* mint = objects_[i]; | 3151 s->Write<int32_t>(count); |
| 3118 s->AssignRef(mint); | 3152 for (intptr_t i = 0; i < count; i++) { |
| 3153 RawSmi* smi = always_smi_[i]; | |
| 3154 s->Write<int32_t>(Smi::Value(smi)); | |
| 3155 s->AssignRef(smi); | |
| 3156 } | |
| 3157 } | |
| 3158 | |
| 3159 { | |
| 3160 s->Write<int32_t>(sometimes_smi_.length() + sometimes_mint_.length()); | |
| 3161 for (intptr_t i = 0; i < sometimes_smi_.length(); i++) { | |
| 3162 RawSmi* smi = sometimes_smi_[i]; | |
| 3163 s->Write<int64_t>(Smi::Value(smi)); | |
| 3164 s->AssignRef(smi); | |
| 3165 } | |
| 3166 | |
| 3167 for (intptr_t i = 0; i < sometimes_mint_.length(); i++) { | |
| 3168 RawMint* mint = sometimes_mint_[i]; | |
| 3169 s->Write<int64_t>(mint->ptr()->value_); | |
| 3170 s->AssignRef(mint); | |
| 3171 } | |
| 3172 } | |
| 3173 | |
| 3174 { | |
| 3175 intptr_t count = always_mint_.length(); | |
| 3176 s->Write<int32_t>(count); | |
| 3177 for (intptr_t i = 0; i < count; i++) { | |
| 3178 RawMint* mint = always_mint_[i]; | |
| 3179 s->Write<int64_t>(mint->ptr()->value_); | |
| 3180 s->AssignRef(mint); | |
| 3181 } | |
| 3119 } | 3182 } |
|
siva
2016/07/08 16:25:20
I am not sure I understand the benefit of classify
rmacnak
2016/07/08 18:08:58
It is not safe to run Mint::NewCanonical during Re
| |
| 3120 } | 3183 } |
| 3121 | 3184 |
| 3122 void WriteFill(Serializer* s) { | 3185 void WriteFill(Serializer* s) { } |
|
siva
2016/07/08 16:25:20
How is the canonical property of the always_mint o
rmacnak
2016/07/08 18:08:58
Every encountered mint is canonical.
| |
| 3123 intptr_t count = objects_.length(); | |
| 3124 for (intptr_t i = 0; i < count; i++) { | |
| 3125 RawMint* mint = objects_[i]; | |
| 3126 s->Write<bool>(mint->IsCanonical()); | |
| 3127 s->Write<int64_t>(mint->ptr()->value_); | |
| 3128 } | |
| 3129 } | |
| 3130 | 3186 |
| 3131 private: | 3187 private: |
| 3132 GrowableArray<RawMint*> objects_; | 3188 GrowableArray<RawSmi*> always_smi_; |
| 3189 GrowableArray<RawSmi*> sometimes_smi_; | |
| 3190 GrowableArray<RawMint*> sometimes_mint_; | |
| 3191 GrowableArray<RawMint*> always_mint_; | |
| 3133 }; | 3192 }; |
| 3134 | 3193 |
| 3135 | 3194 |
| 3136 class MintDeserializationCluster : public DeserializationCluster { | 3195 class MintDeserializationCluster : public DeserializationCluster { |
| 3137 public: | 3196 public: |
| 3138 MintDeserializationCluster() { } | 3197 MintDeserializationCluster() { } |
| 3139 virtual ~MintDeserializationCluster() { } | 3198 virtual ~MintDeserializationCluster() { } |
| 3140 | 3199 |
| 3141 void ReadAlloc(Deserializer* d) { | 3200 void ReadAlloc(Deserializer* d) { |
| 3142 start_index_ = d->next_index(); | |
| 3143 PageSpace* old_space = d->heap()->old_space(); | 3201 PageSpace* old_space = d->heap()->old_space(); |
| 3144 intptr_t count = d->Read<intptr_t>(); | 3202 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 3203 | |
| 3204 intptr_t count = d->Read<int32_t>(); | |
| 3145 for (intptr_t i = 0; i < count; i++) { | 3205 for (intptr_t i = 0; i < count; i++) { |
| 3146 d->AssignRef(AllocateUninitialized(old_space, Mint::InstanceSize())); | 3206 d->AssignRef(Smi::New(d->Read<int32_t>())); |
| 3147 } | 3207 } |
| 3148 stop_index_ = d->next_index(); | 3208 |
| 3209 count = d->Read<int32_t>(); | |
| 3210 for (intptr_t i = 0; i < count; i++) { | |
| 3211 #if defined(ARCH_IS_64_BIT) | |
| 3212 d->AssignRef(Smi::New(d->Read<int64_t>())); | |
| 3213 #else | |
| 3214 RawMint* mint = static_cast<RawMint*>( | |
| 3215 AllocateUninitialized(old_space, Mint::InstanceSize())); | |
| 3216 Deserializer::InitializeHeader(mint, kMintCid, | |
| 3217 Mint::InstanceSize(), | |
| 3218 is_vm_object, true); | |
| 3219 mint->ptr()->value_ = d->Read<int64_t>(); | |
| 3220 d->AssignRef(mint); | |
| 3221 #endif | |
|
siva
2016/07/08 16:25:20
Would prefer if you did
int64_t value = d->Read<i
rmacnak
2016/07/08 20:17:54
Done.
| |
| 3222 } | |
| 3223 | |
| 3224 count = d->Read<int32_t>(); | |
| 3225 for (intptr_t i = 0; i < count; i++) { | |
| 3226 RawMint* mint = static_cast<RawMint*>( | |
| 3227 AllocateUninitialized(old_space, Mint::InstanceSize())); | |
| 3228 Deserializer::InitializeHeader(mint, kMintCid, | |
| 3229 Mint::InstanceSize(), | |
| 3230 is_vm_object, true); | |
| 3231 mint->ptr()->value_ = d->Read<int64_t>(); | |
| 3232 d->AssignRef(mint); | |
| 3233 } | |
| 3149 } | 3234 } |
| 3150 | 3235 |
| 3151 void ReadFill(Deserializer* d) { | 3236 void ReadFill(Deserializer* d) { } |
| 3152 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | |
| 3153 | 3237 |
| 3154 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3238 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { |
| 3155 RawMint* mint = reinterpret_cast<RawMint*>(d->Ref(id)); | 3239 // TODO(rmacnak): Fix the Mint class's constants. |
| 3156 bool is_canonical = d->Read<bool>(); | |
| 3157 Deserializer::InitializeHeader(mint, kMintCid, | |
| 3158 Mint::InstanceSize(), | |
| 3159 is_vm_object, is_canonical); | |
| 3160 mint->ptr()->value_ = d->Read<int64_t>(); | |
| 3161 } | |
| 3162 } | 3240 } |
| 3163 }; | 3241 }; |
| 3164 | 3242 |
| 3165 | 3243 |
| 3166 class BigintSerializationCluster : public SerializationCluster { | 3244 class BigintSerializationCluster : public SerializationCluster { |
| 3167 public: | 3245 public: |
| 3168 BigintSerializationCluster() { } | 3246 BigintSerializationCluster() { } |
| 3169 virtual ~BigintSerializationCluster() { } | 3247 virtual ~BigintSerializationCluster() { } |
| 3170 | 3248 |
| 3171 void Trace(Serializer* s, RawObject* object) { | 3249 void Trace(Serializer* s, RawObject* object) { |
| 3172 RawBigint* bigint = Bigint::RawCast(object); | 3250 RawBigint* bigint = Bigint::RawCast(object); |
| 3173 objects_.Add(bigint); | 3251 objects_.Add(bigint); |
| 3174 | 3252 |
| 3175 RawObject** from = bigint->from(); | 3253 RawObject** from = bigint->from(); |
| 3176 RawObject** to = bigint->to(); | 3254 RawObject** to = bigint->to(); |
| 3177 for (RawObject** p = from; p <= to; p++) { | 3255 for (RawObject** p = from; p <= to; p++) { |
| 3178 s->Push(*p); | 3256 s->Push(*p); |
| 3179 } | 3257 } |
| 3180 } | 3258 } |
| 3181 | 3259 |
| 3182 void WriteAlloc(Serializer* s) { | 3260 void WriteAlloc(Serializer* s) { |
| 3183 s->WriteCid(kBigintCid); | 3261 s->WriteCid(kBigintCid); |
| 3184 intptr_t count = objects_.length(); | 3262 intptr_t count = objects_.length(); |
| 3185 s->Write<intptr_t>(count); | 3263 s->Write<int32_t>(count); |
| 3186 for (intptr_t i = 0; i < count; i++) { | 3264 for (intptr_t i = 0; i < count; i++) { |
| 3187 RawBigint* bigint = objects_[i]; | 3265 RawBigint* bigint = objects_[i]; |
| 3188 s->AssignRef(bigint); | 3266 s->AssignRef(bigint); |
| 3189 } | 3267 } |
| 3190 } | 3268 } |
| 3191 | 3269 |
| 3192 void WriteFill(Serializer* s) { | 3270 void WriteFill(Serializer* s) { |
| 3193 intptr_t count = objects_.length(); | 3271 intptr_t count = objects_.length(); |
| 3194 for (intptr_t i = 0; i < count; i++) { | 3272 for (intptr_t i = 0; i < count; i++) { |
| 3195 RawBigint* bigint = objects_[i]; | 3273 RawBigint* bigint = objects_[i]; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 3208 | 3286 |
| 3209 | 3287 |
| 3210 class BigintDeserializationCluster : public DeserializationCluster { | 3288 class BigintDeserializationCluster : public DeserializationCluster { |
| 3211 public: | 3289 public: |
| 3212 BigintDeserializationCluster() { } | 3290 BigintDeserializationCluster() { } |
| 3213 virtual ~BigintDeserializationCluster() { } | 3291 virtual ~BigintDeserializationCluster() { } |
| 3214 | 3292 |
| 3215 void ReadAlloc(Deserializer* d) { | 3293 void ReadAlloc(Deserializer* d) { |
| 3216 start_index_ = d->next_index(); | 3294 start_index_ = d->next_index(); |
| 3217 PageSpace* old_space = d->heap()->old_space(); | 3295 PageSpace* old_space = d->heap()->old_space(); |
| 3218 intptr_t count = d->Read<intptr_t>(); | 3296 intptr_t count = d->Read<int32_t>(); |
| 3219 for (intptr_t i = 0; i < count; i++) { | 3297 for (intptr_t i = 0; i < count; i++) { |
| 3220 d->AssignRef(AllocateUninitialized(old_space, Bigint::InstanceSize())); | 3298 d->AssignRef(AllocateUninitialized(old_space, Bigint::InstanceSize())); |
| 3221 } | 3299 } |
| 3222 stop_index_ = d->next_index(); | 3300 stop_index_ = d->next_index(); |
| 3223 } | 3301 } |
| 3224 | 3302 |
| 3225 void ReadFill(Deserializer* d) { | 3303 void ReadFill(Deserializer* d) { |
| 3226 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3304 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 3227 | 3305 |
| 3228 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3306 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 3247 virtual ~DoubleSerializationCluster() { } | 3325 virtual ~DoubleSerializationCluster() { } |
| 3248 | 3326 |
| 3249 void Trace(Serializer* s, RawObject* object) { | 3327 void Trace(Serializer* s, RawObject* object) { |
| 3250 RawDouble* dbl = Double::RawCast(object); | 3328 RawDouble* dbl = Double::RawCast(object); |
| 3251 objects_.Add(dbl); | 3329 objects_.Add(dbl); |
| 3252 } | 3330 } |
| 3253 | 3331 |
| 3254 void WriteAlloc(Serializer* s) { | 3332 void WriteAlloc(Serializer* s) { |
| 3255 s->WriteCid(kDoubleCid); | 3333 s->WriteCid(kDoubleCid); |
| 3256 intptr_t count = objects_.length(); | 3334 intptr_t count = objects_.length(); |
| 3257 s->Write<intptr_t>(count); | 3335 s->Write<int32_t>(count); |
| 3258 for (intptr_t i = 0; i < count; i++) { | 3336 for (intptr_t i = 0; i < count; i++) { |
| 3259 RawDouble* dbl = objects_[i]; | 3337 RawDouble* dbl = objects_[i]; |
| 3260 s->AssignRef(dbl); | 3338 s->AssignRef(dbl); |
| 3261 } | 3339 } |
| 3262 } | 3340 } |
| 3263 | 3341 |
| 3264 void WriteFill(Serializer* s) { | 3342 void WriteFill(Serializer* s) { |
| 3265 intptr_t count = objects_.length(); | 3343 intptr_t count = objects_.length(); |
| 3266 for (intptr_t i = 0; i < count; i++) { | 3344 for (intptr_t i = 0; i < count; i++) { |
| 3267 RawDouble* dbl = objects_[i]; | 3345 RawDouble* dbl = objects_[i]; |
| 3268 s->Write<bool>(dbl->IsCanonical()); | 3346 s->Write<bool>(dbl->IsCanonical()); |
| 3269 s->Write<double>(dbl->ptr()->value_); | 3347 s->Write<double>(dbl->ptr()->value_); |
| 3270 } | 3348 } |
| 3271 } | 3349 } |
| 3272 | 3350 |
| 3273 private: | 3351 private: |
| 3274 GrowableArray<RawDouble*> objects_; | 3352 GrowableArray<RawDouble*> objects_; |
| 3275 }; | 3353 }; |
| 3276 | 3354 |
| 3277 | 3355 |
| 3278 class DoubleDeserializationCluster : public DeserializationCluster { | 3356 class DoubleDeserializationCluster : public DeserializationCluster { |
| 3279 public: | 3357 public: |
| 3280 DoubleDeserializationCluster() { } | 3358 DoubleDeserializationCluster() { } |
| 3281 virtual ~DoubleDeserializationCluster() { } | 3359 virtual ~DoubleDeserializationCluster() { } |
| 3282 | 3360 |
| 3283 void ReadAlloc(Deserializer* d) { | 3361 void ReadAlloc(Deserializer* d) { |
| 3284 start_index_ = d->next_index(); | 3362 start_index_ = d->next_index(); |
| 3285 PageSpace* old_space = d->heap()->old_space(); | 3363 PageSpace* old_space = d->heap()->old_space(); |
| 3286 intptr_t count = d->Read<intptr_t>(); | 3364 intptr_t count = d->Read<int32_t>(); |
| 3287 for (intptr_t i = 0; i < count; i++) { | 3365 for (intptr_t i = 0; i < count; i++) { |
| 3288 d->AssignRef(AllocateUninitialized(old_space, Double::InstanceSize())); | 3366 d->AssignRef(AllocateUninitialized(old_space, Double::InstanceSize())); |
| 3289 } | 3367 } |
| 3290 stop_index_ = d->next_index(); | 3368 stop_index_ = d->next_index(); |
| 3291 } | 3369 } |
| 3292 | 3370 |
| 3293 void ReadFill(Deserializer* d) { | 3371 void ReadFill(Deserializer* d) { |
| 3294 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3372 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 3295 | 3373 |
| 3296 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3374 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 3317 RawObject** from = array->from(); | 3395 RawObject** from = array->from(); |
| 3318 RawObject** to = array->to(); | 3396 RawObject** to = array->to(); |
| 3319 for (RawObject** p = from; p <= to; p++) { | 3397 for (RawObject** p = from; p <= to; p++) { |
| 3320 s->Push(*p); | 3398 s->Push(*p); |
| 3321 } | 3399 } |
| 3322 } | 3400 } |
| 3323 | 3401 |
| 3324 void WriteAlloc(Serializer* s) { | 3402 void WriteAlloc(Serializer* s) { |
| 3325 s->WriteCid(kGrowableObjectArrayCid); | 3403 s->WriteCid(kGrowableObjectArrayCid); |
| 3326 intptr_t count = objects_.length(); | 3404 intptr_t count = objects_.length(); |
| 3327 s->Write<intptr_t>(count); | 3405 s->Write<int32_t>(count); |
| 3328 for (intptr_t i = 0; i < count; i++) { | 3406 for (intptr_t i = 0; i < count; i++) { |
| 3329 RawGrowableObjectArray* array = objects_[i]; | 3407 RawGrowableObjectArray* array = objects_[i]; |
| 3330 s->AssignRef(array); | 3408 s->AssignRef(array); |
| 3331 } | 3409 } |
| 3332 } | 3410 } |
| 3333 | 3411 |
| 3334 void WriteFill(Serializer* s) { | 3412 void WriteFill(Serializer* s) { |
| 3335 intptr_t count = objects_.length(); | 3413 intptr_t count = objects_.length(); |
| 3336 for (intptr_t i = 0; i < count; i++) { | 3414 for (intptr_t i = 0; i < count; i++) { |
| 3337 RawGrowableObjectArray* array = objects_[i]; | 3415 RawGrowableObjectArray* array = objects_[i]; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 3351 | 3429 |
| 3352 class GrowableObjectArrayDeserializationCluster | 3430 class GrowableObjectArrayDeserializationCluster |
| 3353 : public DeserializationCluster { | 3431 : public DeserializationCluster { |
| 3354 public: | 3432 public: |
| 3355 GrowableObjectArrayDeserializationCluster() { } | 3433 GrowableObjectArrayDeserializationCluster() { } |
| 3356 virtual ~GrowableObjectArrayDeserializationCluster() { } | 3434 virtual ~GrowableObjectArrayDeserializationCluster() { } |
| 3357 | 3435 |
| 3358 void ReadAlloc(Deserializer* d) { | 3436 void ReadAlloc(Deserializer* d) { |
| 3359 start_index_ = d->next_index(); | 3437 start_index_ = d->next_index(); |
| 3360 PageSpace* old_space = d->heap()->old_space(); | 3438 PageSpace* old_space = d->heap()->old_space(); |
| 3361 intptr_t count = d->Read<intptr_t>(); | 3439 intptr_t count = d->Read<int32_t>(); |
| 3362 for (intptr_t i = 0; i < count; i++) { | 3440 for (intptr_t i = 0; i < count; i++) { |
| 3363 d->AssignRef(AllocateUninitialized(old_space, | 3441 d->AssignRef(AllocateUninitialized(old_space, |
| 3364 GrowableObjectArray::InstanceSize())); | 3442 GrowableObjectArray::InstanceSize())); |
| 3365 } | 3443 } |
| 3366 stop_index_ = d->next_index(); | 3444 stop_index_ = d->next_index(); |
| 3367 } | 3445 } |
| 3368 | 3446 |
| 3369 void ReadFill(Deserializer* d) { | 3447 void ReadFill(Deserializer* d) { |
| 3370 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3448 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 3371 | 3449 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 3390 public: | 3468 public: |
| 3391 explicit TypedDataSerializationCluster(intptr_t cid) : cid_(cid) { } | 3469 explicit TypedDataSerializationCluster(intptr_t cid) : cid_(cid) { } |
| 3392 virtual ~TypedDataSerializationCluster() { } | 3470 virtual ~TypedDataSerializationCluster() { } |
| 3393 | 3471 |
| 3394 void Trace(Serializer* s, RawObject* object) { | 3472 void Trace(Serializer* s, RawObject* object) { |
| 3395 RawTypedData* data = TypedData::RawCast(object); | 3473 RawTypedData* data = TypedData::RawCast(object); |
| 3396 objects_.Add(data); | 3474 objects_.Add(data); |
| 3397 } | 3475 } |
| 3398 | 3476 |
| 3399 void WriteAlloc(Serializer* s) { | 3477 void WriteAlloc(Serializer* s) { |
| 3400 s->Write<intptr_t>(cid_); | 3478 s->Write<int32_t>(cid_); |
| 3401 intptr_t count = objects_.length(); | 3479 intptr_t count = objects_.length(); |
| 3402 s->Write<intptr_t>(count); | 3480 s->Write<int32_t>(count); |
| 3403 for (intptr_t i = 0; i < count; i++) { | 3481 for (intptr_t i = 0; i < count; i++) { |
| 3404 RawTypedData* data = objects_[i]; | 3482 RawTypedData* data = objects_[i]; |
| 3405 intptr_t length = Smi::Value(data->ptr()->length_); | 3483 intptr_t length = Smi::Value(data->ptr()->length_); |
| 3406 s->Write<intptr_t>(length); | 3484 s->Write<int32_t>(length); |
| 3407 s->AssignRef(data); | 3485 s->AssignRef(data); |
| 3408 } | 3486 } |
| 3409 } | 3487 } |
| 3410 | 3488 |
| 3411 void WriteFill(Serializer* s) { | 3489 void WriteFill(Serializer* s) { |
| 3412 intptr_t count = objects_.length(); | 3490 intptr_t count = objects_.length(); |
| 3413 intptr_t element_size = TypedData::ElementSizeInBytes(cid_); | 3491 intptr_t element_size = TypedData::ElementSizeInBytes(cid_); |
| 3414 for (intptr_t i = 0; i < count; i++) { | 3492 for (intptr_t i = 0; i < count; i++) { |
| 3415 RawTypedData* data = objects_[i]; | 3493 RawTypedData* data = objects_[i]; |
| 3416 intptr_t length = Smi::Value(data->ptr()->length_); | 3494 intptr_t length = Smi::Value(data->ptr()->length_); |
| 3417 s->Write<intptr_t>(length); | 3495 s->Write<int32_t>(length); |
| 3418 s->Write<bool>(data->IsCanonical()); | 3496 s->Write<bool>(data->IsCanonical()); |
| 3419 uint8_t* cdata = reinterpret_cast<uint8_t*>(data->ptr()->data()); | 3497 uint8_t* cdata = reinterpret_cast<uint8_t*>(data->ptr()->data()); |
| 3420 s->WriteBytes(cdata, length * element_size); | 3498 s->WriteBytes(cdata, length * element_size); |
| 3421 } | 3499 } |
| 3422 } | 3500 } |
| 3423 | 3501 |
| 3424 private: | 3502 private: |
| 3425 const intptr_t cid_; | 3503 const intptr_t cid_; |
| 3426 GrowableArray<RawTypedData*> objects_; | 3504 GrowableArray<RawTypedData*> objects_; |
| 3427 }; | 3505 }; |
| 3428 | 3506 |
| 3429 | 3507 |
| 3430 class TypedDataDeserializationCluster : public DeserializationCluster { | 3508 class TypedDataDeserializationCluster : public DeserializationCluster { |
| 3431 public: | 3509 public: |
| 3432 explicit TypedDataDeserializationCluster(intptr_t cid) : cid_(cid) { } | 3510 explicit TypedDataDeserializationCluster(intptr_t cid) : cid_(cid) { } |
| 3433 virtual ~TypedDataDeserializationCluster() { } | 3511 virtual ~TypedDataDeserializationCluster() { } |
| 3434 | 3512 |
| 3435 void ReadAlloc(Deserializer* d) { | 3513 void ReadAlloc(Deserializer* d) { |
| 3436 start_index_ = d->next_index(); | 3514 start_index_ = d->next_index(); |
| 3437 PageSpace* old_space = d->heap()->old_space(); | 3515 PageSpace* old_space = d->heap()->old_space(); |
| 3438 intptr_t count = d->Read<intptr_t>(); | 3516 intptr_t count = d->Read<int32_t>(); |
| 3439 intptr_t element_size = TypedData::ElementSizeInBytes(cid_); | 3517 intptr_t element_size = TypedData::ElementSizeInBytes(cid_); |
| 3440 for (intptr_t i = 0; i < count; i++) { | 3518 for (intptr_t i = 0; i < count; i++) { |
| 3441 intptr_t length = d->Read<intptr_t>(); | 3519 intptr_t length = d->Read<int32_t>(); |
| 3442 d->AssignRef(AllocateUninitialized(old_space, | 3520 d->AssignRef(AllocateUninitialized(old_space, |
| 3443 TypedData::InstanceSize(length * element_size))); | 3521 TypedData::InstanceSize(length * element_size))); |
| 3444 } | 3522 } |
| 3445 stop_index_ = d->next_index(); | 3523 stop_index_ = d->next_index(); |
| 3446 } | 3524 } |
| 3447 | 3525 |
| 3448 void ReadFill(Deserializer* d) { | 3526 void ReadFill(Deserializer* d) { |
| 3449 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3527 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 3450 intptr_t element_size = TypedData::ElementSizeInBytes(cid_); | 3528 intptr_t element_size = TypedData::ElementSizeInBytes(cid_); |
| 3451 | 3529 |
| 3452 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3530 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| 3453 RawTypedData* data = reinterpret_cast<RawTypedData*>(d->Ref(id)); | 3531 RawTypedData* data = reinterpret_cast<RawTypedData*>(d->Ref(id)); |
| 3454 intptr_t length = d->Read<intptr_t>(); | 3532 intptr_t length = d->Read<int32_t>(); |
| 3455 bool is_canonical = d->Read<bool>(); | 3533 bool is_canonical = d->Read<bool>(); |
| 3456 intptr_t length_in_bytes = length * element_size; | 3534 intptr_t length_in_bytes = length * element_size; |
| 3457 Deserializer::InitializeHeader(data, cid_, | 3535 Deserializer::InitializeHeader(data, cid_, |
| 3458 TypedData::InstanceSize(length_in_bytes), | 3536 TypedData::InstanceSize(length_in_bytes), |
| 3459 is_vm_object, is_canonical); | 3537 is_vm_object, is_canonical); |
| 3460 data->ptr()->length_ = Smi::New(length); | 3538 data->ptr()->length_ = Smi::New(length); |
| 3461 uint8_t* cdata = reinterpret_cast<uint8_t*>(data->ptr()->data()); | 3539 uint8_t* cdata = reinterpret_cast<uint8_t*>(data->ptr()->data()); |
| 3462 d->ReadBytes(cdata, length_in_bytes); | 3540 d->ReadBytes(cdata, length_in_bytes); |
| 3463 } | 3541 } |
| 3464 } | 3542 } |
| 3465 | 3543 |
| 3466 private: | 3544 private: |
| 3467 const intptr_t cid_; | 3545 const intptr_t cid_; |
| 3468 }; | 3546 }; |
| 3469 | 3547 |
| 3470 | 3548 |
| 3471 class ExternalTypedDataSerializationCluster : public SerializationCluster { | 3549 class ExternalTypedDataSerializationCluster : public SerializationCluster { |
| 3472 public: | 3550 public: |
| 3473 explicit ExternalTypedDataSerializationCluster(intptr_t cid) : cid_(cid) { } | 3551 explicit ExternalTypedDataSerializationCluster(intptr_t cid) : cid_(cid) { } |
| 3474 virtual ~ExternalTypedDataSerializationCluster() { } | 3552 virtual ~ExternalTypedDataSerializationCluster() { } |
| 3475 | 3553 |
| 3476 void Trace(Serializer* s, RawObject* object) { | 3554 void Trace(Serializer* s, RawObject* object) { |
| 3477 RawExternalTypedData* data = ExternalTypedData::RawCast(object); | 3555 RawExternalTypedData* data = ExternalTypedData::RawCast(object); |
| 3478 objects_.Add(data); | 3556 objects_.Add(data); |
| 3479 ASSERT(!data->IsCanonical()); | 3557 ASSERT(!data->IsCanonical()); |
| 3480 } | 3558 } |
| 3481 | 3559 |
| 3482 void WriteAlloc(Serializer* s) { | 3560 void WriteAlloc(Serializer* s) { |
| 3483 s->Write<intptr_t>(cid_); | 3561 s->Write<int32_t>(cid_); |
| 3484 intptr_t count = objects_.length(); | 3562 intptr_t count = objects_.length(); |
| 3485 s->Write<intptr_t>(count); | 3563 s->Write<int32_t>(count); |
| 3486 for (intptr_t i = 0; i < count; i++) { | 3564 for (intptr_t i = 0; i < count; i++) { |
| 3487 RawExternalTypedData* data = objects_[i]; | 3565 RawExternalTypedData* data = objects_[i]; |
| 3488 s->AssignRef(data); | 3566 s->AssignRef(data); |
| 3489 } | 3567 } |
| 3490 } | 3568 } |
| 3491 | 3569 |
| 3492 void WriteFill(Serializer* s) { | 3570 void WriteFill(Serializer* s) { |
| 3493 intptr_t count = objects_.length(); | 3571 intptr_t count = objects_.length(); |
| 3494 intptr_t element_size = ExternalTypedData::ElementSizeInBytes(cid_); | 3572 intptr_t element_size = ExternalTypedData::ElementSizeInBytes(cid_); |
| 3495 for (intptr_t i = 0; i < count; i++) { | 3573 for (intptr_t i = 0; i < count; i++) { |
| 3496 RawExternalTypedData* data = objects_[i]; | 3574 RawExternalTypedData* data = objects_[i]; |
| 3497 intptr_t length = Smi::Value(data->ptr()->length_); | 3575 intptr_t length = Smi::Value(data->ptr()->length_); |
| 3498 s->Write<intptr_t>(length); | 3576 s->Write<int32_t>(length); |
| 3499 uint8_t* cdata = reinterpret_cast<uint8_t*>(data->ptr()->data_); | 3577 uint8_t* cdata = reinterpret_cast<uint8_t*>(data->ptr()->data_); |
| 3500 s->WriteBytes(cdata, length * element_size); | 3578 s->WriteBytes(cdata, length * element_size); |
| 3501 } | 3579 } |
| 3502 } | 3580 } |
| 3503 | 3581 |
| 3504 private: | 3582 private: |
| 3505 const intptr_t cid_; | 3583 const intptr_t cid_; |
| 3506 GrowableArray<RawExternalTypedData*> objects_; | 3584 GrowableArray<RawExternalTypedData*> objects_; |
| 3507 }; | 3585 }; |
| 3508 | 3586 |
| 3509 | 3587 |
| 3510 class ExternalTypedDataDeserializationCluster : public DeserializationCluster { | 3588 class ExternalTypedDataDeserializationCluster : public DeserializationCluster { |
| 3511 public: | 3589 public: |
| 3512 explicit ExternalTypedDataDeserializationCluster(intptr_t cid) : cid_(cid) { } | 3590 explicit ExternalTypedDataDeserializationCluster(intptr_t cid) : cid_(cid) { } |
| 3513 virtual ~ExternalTypedDataDeserializationCluster() { } | 3591 virtual ~ExternalTypedDataDeserializationCluster() { } |
| 3514 | 3592 |
| 3515 void ReadAlloc(Deserializer* d) { | 3593 void ReadAlloc(Deserializer* d) { |
| 3516 start_index_ = d->next_index(); | 3594 start_index_ = d->next_index(); |
| 3517 PageSpace* old_space = d->heap()->old_space(); | 3595 PageSpace* old_space = d->heap()->old_space(); |
| 3518 intptr_t count = d->Read<intptr_t>(); | 3596 intptr_t count = d->Read<int32_t>(); |
| 3519 for (intptr_t i = 0; i < count; i++) { | 3597 for (intptr_t i = 0; i < count; i++) { |
| 3520 d->AssignRef(AllocateUninitialized(old_space, | 3598 d->AssignRef(AllocateUninitialized(old_space, |
| 3521 ExternalTypedData::InstanceSize())); | 3599 ExternalTypedData::InstanceSize())); |
| 3522 } | 3600 } |
| 3523 stop_index_ = d->next_index(); | 3601 stop_index_ = d->next_index(); |
| 3524 } | 3602 } |
| 3525 | 3603 |
| 3526 void ReadFill(Deserializer* d) { | 3604 void ReadFill(Deserializer* d) { |
| 3527 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3605 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 3528 intptr_t element_size = ExternalTypedData::ElementSizeInBytes(cid_); | 3606 intptr_t element_size = ExternalTypedData::ElementSizeInBytes(cid_); |
| 3529 | 3607 |
| 3530 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3608 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| 3531 RawExternalTypedData* data = | 3609 RawExternalTypedData* data = |
| 3532 reinterpret_cast<RawExternalTypedData*>(d->Ref(id)); | 3610 reinterpret_cast<RawExternalTypedData*>(d->Ref(id)); |
| 3533 intptr_t length = d->Read<intptr_t>(); | 3611 intptr_t length = d->Read<int32_t>(); |
| 3534 Deserializer::InitializeHeader(data, cid_, | 3612 Deserializer::InitializeHeader(data, cid_, |
| 3535 ExternalTypedData::InstanceSize(), | 3613 ExternalTypedData::InstanceSize(), |
| 3536 is_vm_object); | 3614 is_vm_object); |
| 3537 data->ptr()->length_ = Smi::New(length); | 3615 data->ptr()->length_ = Smi::New(length); |
| 3538 data->ptr()->data_ = const_cast<uint8_t*>(d->CurrentBufferAddress()); | 3616 data->ptr()->data_ = const_cast<uint8_t*>(d->CurrentBufferAddress()); |
| 3539 d->Advance(length * element_size); | 3617 d->Advance(length * element_size); |
| 3540 } | 3618 } |
| 3541 } | 3619 } |
| 3542 | 3620 |
| 3543 private: | 3621 private: |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 3557 RawObject** from = trace->from(); | 3635 RawObject** from = trace->from(); |
| 3558 RawObject** to = trace->to(); | 3636 RawObject** to = trace->to(); |
| 3559 for (RawObject** p = from; p <= to; p++) { | 3637 for (RawObject** p = from; p <= to; p++) { |
| 3560 s->Push(*p); | 3638 s->Push(*p); |
| 3561 } | 3639 } |
| 3562 } | 3640 } |
| 3563 | 3641 |
| 3564 void WriteAlloc(Serializer* s) { | 3642 void WriteAlloc(Serializer* s) { |
| 3565 s->WriteCid(kStacktraceCid); | 3643 s->WriteCid(kStacktraceCid); |
| 3566 intptr_t count = objects_.length(); | 3644 intptr_t count = objects_.length(); |
| 3567 s->Write<intptr_t>(count); | 3645 s->Write<int32_t>(count); |
| 3568 for (intptr_t i = 0; i < count; i++) { | 3646 for (intptr_t i = 0; i < count; i++) { |
| 3569 RawStacktrace* trace = objects_[i]; | 3647 RawStacktrace* trace = objects_[i]; |
| 3570 s->AssignRef(trace); | 3648 s->AssignRef(trace); |
| 3571 } | 3649 } |
| 3572 } | 3650 } |
| 3573 | 3651 |
| 3574 void WriteFill(Serializer* s) { | 3652 void WriteFill(Serializer* s) { |
| 3575 intptr_t count = objects_.length(); | 3653 intptr_t count = objects_.length(); |
| 3576 for (intptr_t i = 0; i < count; i++) { | 3654 for (intptr_t i = 0; i < count; i++) { |
| 3577 RawStacktrace* trace = objects_[i]; | 3655 RawStacktrace* trace = objects_[i]; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 3589 | 3667 |
| 3590 | 3668 |
| 3591 class StacktraceDeserializationCluster : public DeserializationCluster { | 3669 class StacktraceDeserializationCluster : public DeserializationCluster { |
| 3592 public: | 3670 public: |
| 3593 StacktraceDeserializationCluster() { } | 3671 StacktraceDeserializationCluster() { } |
| 3594 virtual ~StacktraceDeserializationCluster() { } | 3672 virtual ~StacktraceDeserializationCluster() { } |
| 3595 | 3673 |
| 3596 void ReadAlloc(Deserializer* d) { | 3674 void ReadAlloc(Deserializer* d) { |
| 3597 start_index_ = d->next_index(); | 3675 start_index_ = d->next_index(); |
| 3598 PageSpace* old_space = d->heap()->old_space(); | 3676 PageSpace* old_space = d->heap()->old_space(); |
| 3599 intptr_t count = d->Read<intptr_t>(); | 3677 intptr_t count = d->Read<int32_t>(); |
| 3600 for (intptr_t i = 0; i < count; i++) { | 3678 for (intptr_t i = 0; i < count; i++) { |
| 3601 d->AssignRef(AllocateUninitialized(old_space, | 3679 d->AssignRef(AllocateUninitialized(old_space, |
| 3602 Stacktrace::InstanceSize())); | 3680 Stacktrace::InstanceSize())); |
| 3603 } | 3681 } |
| 3604 stop_index_ = d->next_index(); | 3682 stop_index_ = d->next_index(); |
| 3605 } | 3683 } |
| 3606 | 3684 |
| 3607 void ReadFill(Deserializer* d) { | 3685 void ReadFill(Deserializer* d) { |
| 3608 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3686 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 3609 | 3687 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 3633 RawObject** from = regexp->from(); | 3711 RawObject** from = regexp->from(); |
| 3634 RawObject** to = regexp->to(); | 3712 RawObject** to = regexp->to(); |
| 3635 for (RawObject** p = from; p <= to; p++) { | 3713 for (RawObject** p = from; p <= to; p++) { |
| 3636 s->Push(*p); | 3714 s->Push(*p); |
| 3637 } | 3715 } |
| 3638 } | 3716 } |
| 3639 | 3717 |
| 3640 void WriteAlloc(Serializer* s) { | 3718 void WriteAlloc(Serializer* s) { |
| 3641 s->WriteCid(kRegExpCid); | 3719 s->WriteCid(kRegExpCid); |
| 3642 intptr_t count = objects_.length(); | 3720 intptr_t count = objects_.length(); |
| 3643 s->Write<intptr_t>(count); | 3721 s->Write<int32_t>(count); |
| 3644 for (intptr_t i = 0; i < count; i++) { | 3722 for (intptr_t i = 0; i < count; i++) { |
| 3645 RawRegExp* regexp = objects_[i]; | 3723 RawRegExp* regexp = objects_[i]; |
| 3646 s->AssignRef(regexp); | 3724 s->AssignRef(regexp); |
| 3647 } | 3725 } |
| 3648 } | 3726 } |
| 3649 | 3727 |
| 3650 void WriteFill(Serializer* s) { | 3728 void WriteFill(Serializer* s) { |
| 3651 intptr_t count = objects_.length(); | 3729 intptr_t count = objects_.length(); |
| 3652 for (intptr_t i = 0; i < count; i++) { | 3730 for (intptr_t i = 0; i < count; i++) { |
| 3653 RawRegExp* regexp = objects_[i]; | 3731 RawRegExp* regexp = objects_[i]; |
| 3654 RawObject** from = regexp->from(); | 3732 RawObject** from = regexp->from(); |
| 3655 RawObject** to = regexp->to(); | 3733 RawObject** to = regexp->to(); |
| 3656 for (RawObject** p = from; p <= to; p++) { | 3734 for (RawObject** p = from; p <= to; p++) { |
| 3657 s->WriteRef(*p); | 3735 s->WriteRef(*p); |
| 3658 } | 3736 } |
| 3659 | 3737 |
| 3660 s->Write<intptr_t>(regexp->ptr()->num_registers_); | 3738 s->Write<int32_t>(regexp->ptr()->num_registers_); |
| 3661 s->Write<int8_t>(regexp->ptr()->type_flags_); | 3739 s->Write<int8_t>(regexp->ptr()->type_flags_); |
| 3662 } | 3740 } |
| 3663 } | 3741 } |
| 3664 | 3742 |
| 3665 private: | 3743 private: |
| 3666 GrowableArray<RawRegExp*> objects_; | 3744 GrowableArray<RawRegExp*> objects_; |
| 3667 }; | 3745 }; |
| 3668 | 3746 |
| 3669 | 3747 |
| 3670 class RegExpDeserializationCluster : public DeserializationCluster { | 3748 class RegExpDeserializationCluster : public DeserializationCluster { |
| 3671 public: | 3749 public: |
| 3672 RegExpDeserializationCluster() { } | 3750 RegExpDeserializationCluster() { } |
| 3673 virtual ~RegExpDeserializationCluster() { } | 3751 virtual ~RegExpDeserializationCluster() { } |
| 3674 | 3752 |
| 3675 void ReadAlloc(Deserializer* d) { | 3753 void ReadAlloc(Deserializer* d) { |
| 3676 start_index_ = d->next_index(); | 3754 start_index_ = d->next_index(); |
| 3677 PageSpace* old_space = d->heap()->old_space(); | 3755 PageSpace* old_space = d->heap()->old_space(); |
| 3678 intptr_t count = d->Read<intptr_t>(); | 3756 intptr_t count = d->Read<int32_t>(); |
| 3679 for (intptr_t i = 0; i < count; i++) { | 3757 for (intptr_t i = 0; i < count; i++) { |
| 3680 d->AssignRef(AllocateUninitialized(old_space, | 3758 d->AssignRef(AllocateUninitialized(old_space, |
| 3681 RegExp::InstanceSize())); | 3759 RegExp::InstanceSize())); |
| 3682 } | 3760 } |
| 3683 stop_index_ = d->next_index(); | 3761 stop_index_ = d->next_index(); |
| 3684 } | 3762 } |
| 3685 | 3763 |
| 3686 void ReadFill(Deserializer* d) { | 3764 void ReadFill(Deserializer* d) { |
| 3687 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3765 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 3688 | 3766 |
| 3689 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3767 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| 3690 RawRegExp* regexp = reinterpret_cast<RawRegExp*>(d->Ref(id)); | 3768 RawRegExp* regexp = reinterpret_cast<RawRegExp*>(d->Ref(id)); |
| 3691 Deserializer::InitializeHeader(regexp, kRegExpCid, | 3769 Deserializer::InitializeHeader(regexp, kRegExpCid, |
| 3692 RegExp::InstanceSize(), is_vm_object); | 3770 RegExp::InstanceSize(), is_vm_object); |
| 3693 RawObject** from = regexp->from(); | 3771 RawObject** from = regexp->from(); |
| 3694 RawObject** to = regexp->to(); | 3772 RawObject** to = regexp->to(); |
| 3695 for (RawObject** p = from; p <= to; p++) { | 3773 for (RawObject** p = from; p <= to; p++) { |
| 3696 *p = d->ReadRef(); | 3774 *p = d->ReadRef(); |
| 3697 } | 3775 } |
| 3698 | 3776 |
| 3699 regexp->ptr()->num_registers_ = d->Read<intptr_t>(); | 3777 regexp->ptr()->num_registers_ = d->Read<int32_t>(); |
| 3700 regexp->ptr()->type_flags_ = d->Read<int8_t>(); | 3778 regexp->ptr()->type_flags_ = d->Read<int8_t>(); |
| 3701 } | 3779 } |
| 3702 } | 3780 } |
| 3703 }; | 3781 }; |
| 3704 | 3782 |
| 3705 | 3783 |
| 3706 class LinkedHashMapSerializationCluster : public SerializationCluster { | 3784 class LinkedHashMapSerializationCluster : public SerializationCluster { |
| 3707 public: | 3785 public: |
| 3708 LinkedHashMapSerializationCluster() { } | 3786 LinkedHashMapSerializationCluster() { } |
| 3709 virtual ~LinkedHashMapSerializationCluster() { } | 3787 virtual ~LinkedHashMapSerializationCluster() { } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 3723 RawObject* value = data_elements[i + 1]; | 3801 RawObject* value = data_elements[i + 1]; |
| 3724 s->Push(key); | 3802 s->Push(key); |
| 3725 s->Push(value); | 3803 s->Push(value); |
| 3726 } | 3804 } |
| 3727 } | 3805 } |
| 3728 } | 3806 } |
| 3729 | 3807 |
| 3730 void WriteAlloc(Serializer* s) { | 3808 void WriteAlloc(Serializer* s) { |
| 3731 s->WriteCid(kLinkedHashMapCid); | 3809 s->WriteCid(kLinkedHashMapCid); |
| 3732 intptr_t count = objects_.length(); | 3810 intptr_t count = objects_.length(); |
| 3733 s->Write<intptr_t>(count); | 3811 s->Write<int32_t>(count); |
| 3734 for (intptr_t i = 0; i < count; i++) { | 3812 for (intptr_t i = 0; i < count; i++) { |
| 3735 RawLinkedHashMap* map = objects_[i]; | 3813 RawLinkedHashMap* map = objects_[i]; |
| 3736 s->AssignRef(map); | 3814 s->AssignRef(map); |
| 3737 } | 3815 } |
| 3738 } | 3816 } |
| 3739 | 3817 |
| 3740 void WriteFill(Serializer* s) { | 3818 void WriteFill(Serializer* s) { |
| 3741 intptr_t count = objects_.length(); | 3819 intptr_t count = objects_.length(); |
| 3742 for (intptr_t i = 0; i < count; i++) { | 3820 for (intptr_t i = 0; i < count; i++) { |
| 3743 RawLinkedHashMap* map = objects_[i]; | 3821 RawLinkedHashMap* map = objects_[i]; |
| 3744 s->Write<bool>(map->IsCanonical()); | 3822 s->Write<bool>(map->IsCanonical()); |
| 3745 | 3823 |
| 3746 s->WriteRef(map->ptr()->type_arguments_); | 3824 s->WriteRef(map->ptr()->type_arguments_); |
| 3747 | 3825 |
| 3748 const intptr_t used_data = Smi::Value(map->ptr()->used_data_); | 3826 const intptr_t used_data = Smi::Value(map->ptr()->used_data_); |
| 3749 ASSERT((used_data & 1) == 0); // Keys + values, so must be even. | 3827 ASSERT((used_data & 1) == 0); // Keys + values, so must be even. |
| 3750 const intptr_t deleted_keys = Smi::Value(map->ptr()->deleted_keys_); | 3828 const intptr_t deleted_keys = Smi::Value(map->ptr()->deleted_keys_); |
| 3751 | 3829 |
| 3752 // Write out the number of (not deleted) key/value pairs that will follow. | 3830 // Write out the number of (not deleted) key/value pairs that will follow. |
| 3753 s->Write<intptr_t>((used_data >> 1) - deleted_keys); | 3831 s->Write<int32_t>((used_data >> 1) - deleted_keys); |
| 3754 | 3832 |
| 3755 RawArray* data_array = map->ptr()->data_; | 3833 RawArray* data_array = map->ptr()->data_; |
| 3756 RawObject** data_elements = data_array->ptr()->data(); | 3834 RawObject** data_elements = data_array->ptr()->data(); |
| 3757 for (intptr_t i = 0; i < used_data; i += 2) { | 3835 for (intptr_t i = 0; i < used_data; i += 2) { |
| 3758 RawObject* key = data_elements[i]; | 3836 RawObject* key = data_elements[i]; |
| 3759 if (key != data_array) { | 3837 if (key != data_array) { |
| 3760 RawObject* value = data_elements[i + 1]; | 3838 RawObject* value = data_elements[i + 1]; |
| 3761 s->WriteRef(key); | 3839 s->WriteRef(key); |
| 3762 s->WriteRef(value); | 3840 s->WriteRef(value); |
| 3763 } | 3841 } |
| 3764 } | 3842 } |
| 3765 } | 3843 } |
| 3766 } | 3844 } |
| 3767 | 3845 |
| 3768 private: | 3846 private: |
| 3769 GrowableArray<RawLinkedHashMap*> objects_; | 3847 GrowableArray<RawLinkedHashMap*> objects_; |
| 3770 }; | 3848 }; |
| 3771 | 3849 |
| 3772 | 3850 |
| 3773 class LinkedHashMapDeserializationCluster : public DeserializationCluster { | 3851 class LinkedHashMapDeserializationCluster : public DeserializationCluster { |
| 3774 public: | 3852 public: |
| 3775 LinkedHashMapDeserializationCluster() { } | 3853 LinkedHashMapDeserializationCluster() { } |
| 3776 virtual ~LinkedHashMapDeserializationCluster() { } | 3854 virtual ~LinkedHashMapDeserializationCluster() { } |
| 3777 | 3855 |
| 3778 void ReadAlloc(Deserializer* d) { | 3856 void ReadAlloc(Deserializer* d) { |
| 3779 start_index_ = d->next_index(); | 3857 start_index_ = d->next_index(); |
| 3780 PageSpace* old_space = d->heap()->old_space(); | 3858 PageSpace* old_space = d->heap()->old_space(); |
| 3781 intptr_t count = d->Read<intptr_t>(); | 3859 intptr_t count = d->Read<int32_t>(); |
| 3782 for (intptr_t i = 0; i < count; i++) { | 3860 for (intptr_t i = 0; i < count; i++) { |
| 3783 d->AssignRef(AllocateUninitialized(old_space, | 3861 d->AssignRef(AllocateUninitialized(old_space, |
| 3784 LinkedHashMap::InstanceSize())); | 3862 LinkedHashMap::InstanceSize())); |
| 3785 } | 3863 } |
| 3786 stop_index_ = d->next_index(); | 3864 stop_index_ = d->next_index(); |
| 3787 } | 3865 } |
| 3788 | 3866 |
| 3789 void ReadFill(Deserializer* d) { | 3867 void ReadFill(Deserializer* d) { |
| 3790 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3868 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 3791 PageSpace* old_space = d->heap()->old_space(); | 3869 PageSpace* old_space = d->heap()->old_space(); |
| 3792 | 3870 |
| 3793 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3871 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| 3794 RawLinkedHashMap* map = reinterpret_cast<RawLinkedHashMap*>(d->Ref(id)); | 3872 RawLinkedHashMap* map = reinterpret_cast<RawLinkedHashMap*>(d->Ref(id)); |
| 3795 bool is_canonical = d->Read<bool>(); | 3873 bool is_canonical = d->Read<bool>(); |
| 3796 Deserializer::InitializeHeader(map, kLinkedHashMapCid, | 3874 Deserializer::InitializeHeader(map, kLinkedHashMapCid, |
| 3797 LinkedHashMap::InstanceSize(), | 3875 LinkedHashMap::InstanceSize(), |
| 3798 is_vm_object, is_canonical); | 3876 is_vm_object, is_canonical); |
| 3799 | 3877 |
| 3800 map->ptr()->type_arguments_ = | 3878 map->ptr()->type_arguments_ = |
| 3801 reinterpret_cast<RawTypeArguments*>(d->ReadRef()); | 3879 reinterpret_cast<RawTypeArguments*>(d->ReadRef()); |
| 3802 | 3880 |
| 3803 // TODO(rmacnak): Reserve ref ids and co-allocate in ReadAlloc. | 3881 // TODO(rmacnak): Reserve ref ids and co-allocate in ReadAlloc. |
| 3804 intptr_t pairs = d->Read<intptr_t>(); | 3882 intptr_t pairs = d->Read<int32_t>(); |
| 3805 intptr_t used_data = pairs << 1; | 3883 intptr_t used_data = pairs << 1; |
| 3806 intptr_t data_size = Utils::Maximum( | 3884 intptr_t data_size = Utils::Maximum( |
| 3807 Utils::RoundUpToPowerOfTwo(used_data), | 3885 Utils::RoundUpToPowerOfTwo(used_data), |
| 3808 static_cast<uintptr_t>(LinkedHashMap::kInitialIndexSize)); | 3886 static_cast<uintptr_t>(LinkedHashMap::kInitialIndexSize)); |
| 3809 | 3887 |
| 3810 RawArray* data = reinterpret_cast<RawArray*>( | 3888 RawArray* data = reinterpret_cast<RawArray*>( |
| 3811 AllocateUninitialized(old_space, Array::InstanceSize(data_size))); | 3889 AllocateUninitialized(old_space, Array::InstanceSize(data_size))); |
| 3812 data->ptr()->type_arguments_ = TypeArguments::null(); | 3890 data->ptr()->type_arguments_ = TypeArguments::null(); |
| 3813 data->ptr()->length_ = Smi::New(data_size); | 3891 data->ptr()->length_ = Smi::New(data_size); |
| 3814 intptr_t i; | 3892 intptr_t i; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 3841 s->Push(array->ptr()->type_arguments_); | 3919 s->Push(array->ptr()->type_arguments_); |
| 3842 intptr_t length = Smi::Value(array->ptr()->length_); | 3920 intptr_t length = Smi::Value(array->ptr()->length_); |
| 3843 for (intptr_t i = 0; i < length; i++) { | 3921 for (intptr_t i = 0; i < length; i++) { |
| 3844 s->Push(array->ptr()->data()[i]); | 3922 s->Push(array->ptr()->data()[i]); |
| 3845 } | 3923 } |
| 3846 } | 3924 } |
| 3847 | 3925 |
| 3848 void WriteAlloc(Serializer* s) { | 3926 void WriteAlloc(Serializer* s) { |
| 3849 s->WriteCid(cid_); | 3927 s->WriteCid(cid_); |
| 3850 intptr_t count = objects_.length(); | 3928 intptr_t count = objects_.length(); |
| 3851 s->Write<intptr_t>(count); | 3929 s->Write<int32_t>(count); |
| 3852 for (intptr_t i = 0; i < count; i++) { | 3930 for (intptr_t i = 0; i < count; i++) { |
| 3853 RawArray* array = objects_[i]; | 3931 RawArray* array = objects_[i]; |
| 3854 intptr_t length = Smi::Value(array->ptr()->length_); | 3932 intptr_t length = Smi::Value(array->ptr()->length_); |
| 3855 s->Write<intptr_t>(length); | 3933 s->Write<int32_t>(length); |
| 3856 s->AssignRef(array); | 3934 s->AssignRef(array); |
| 3857 } | 3935 } |
| 3858 } | 3936 } |
| 3859 | 3937 |
| 3860 void WriteFill(Serializer* s) { | 3938 void WriteFill(Serializer* s) { |
| 3861 intptr_t count = objects_.length(); | 3939 intptr_t count = objects_.length(); |
| 3862 for (intptr_t i = 0; i < count; i++) { | 3940 for (intptr_t i = 0; i < count; i++) { |
| 3863 RawArray* array = objects_[i]; | 3941 RawArray* array = objects_[i]; |
| 3864 intptr_t length = Smi::Value(array->ptr()->length_); | 3942 intptr_t length = Smi::Value(array->ptr()->length_); |
| 3865 s->Write<intptr_t>(length); | 3943 s->Write<int32_t>(length); |
| 3866 s->Write<bool>(array->IsCanonical()); | 3944 s->Write<bool>(array->IsCanonical()); |
| 3867 s->WriteRef(array->ptr()->type_arguments_); | 3945 s->WriteRef(array->ptr()->type_arguments_); |
| 3868 for (intptr_t j = 0; j < length; j++) { | 3946 for (intptr_t j = 0; j < length; j++) { |
| 3869 s->WriteRef(array->ptr()->data()[j]); | 3947 s->WriteRef(array->ptr()->data()[j]); |
| 3870 } | 3948 } |
| 3871 } | 3949 } |
| 3872 } | 3950 } |
| 3873 | 3951 |
| 3874 private: | 3952 private: |
| 3875 intptr_t cid_; | 3953 intptr_t cid_; |
| 3876 GrowableArray<RawArray*> objects_; | 3954 GrowableArray<RawArray*> objects_; |
| 3877 }; | 3955 }; |
| 3878 | 3956 |
| 3879 | 3957 |
| 3880 class ArrayDeserializationCluster : public DeserializationCluster { | 3958 class ArrayDeserializationCluster : public DeserializationCluster { |
| 3881 public: | 3959 public: |
| 3882 explicit ArrayDeserializationCluster(intptr_t cid) : cid_(cid) { } | 3960 explicit ArrayDeserializationCluster(intptr_t cid) : cid_(cid) { } |
| 3883 virtual ~ArrayDeserializationCluster() { } | 3961 virtual ~ArrayDeserializationCluster() { } |
| 3884 | 3962 |
| 3885 void ReadAlloc(Deserializer* d) { | 3963 void ReadAlloc(Deserializer* d) { |
| 3886 start_index_ = d->next_index(); | 3964 start_index_ = d->next_index(); |
| 3887 PageSpace* old_space = d->heap()->old_space(); | 3965 PageSpace* old_space = d->heap()->old_space(); |
| 3888 intptr_t count = d->Read<intptr_t>(); | 3966 intptr_t count = d->Read<int32_t>(); |
| 3889 for (intptr_t i = 0; i < count; i++) { | 3967 for (intptr_t i = 0; i < count; i++) { |
| 3890 intptr_t length = d->Read<intptr_t>(); | 3968 intptr_t length = d->Read<int32_t>(); |
| 3891 d->AssignRef(AllocateUninitialized(old_space, | 3969 d->AssignRef(AllocateUninitialized(old_space, |
| 3892 Array::InstanceSize(length))); | 3970 Array::InstanceSize(length))); |
| 3893 } | 3971 } |
| 3894 stop_index_ = d->next_index(); | 3972 stop_index_ = d->next_index(); |
| 3895 } | 3973 } |
| 3896 | 3974 |
| 3897 void ReadFill(Deserializer* d) { | 3975 void ReadFill(Deserializer* d) { |
| 3898 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 3976 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 3899 | 3977 |
| 3900 for (intptr_t id = start_index_; id < stop_index_; id++) { | 3978 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| 3901 RawArray* array = reinterpret_cast<RawArray*>(d->Ref(id)); | 3979 RawArray* array = reinterpret_cast<RawArray*>(d->Ref(id)); |
| 3902 intptr_t length = d->Read<intptr_t>(); | 3980 intptr_t length = d->Read<int32_t>(); |
| 3903 bool is_canonical = d->Read<bool>(); | 3981 bool is_canonical = d->Read<bool>(); |
| 3904 Deserializer::InitializeHeader(array, cid_, | 3982 Deserializer::InitializeHeader(array, cid_, |
| 3905 Array::InstanceSize(length), | 3983 Array::InstanceSize(length), |
| 3906 is_vm_object, is_canonical); | 3984 is_vm_object, is_canonical); |
| 3907 array->ptr()->type_arguments_ = | 3985 array->ptr()->type_arguments_ = |
| 3908 reinterpret_cast<RawTypeArguments*>(d->ReadRef()); | 3986 reinterpret_cast<RawTypeArguments*>(d->ReadRef()); |
| 3909 array->ptr()->length_ = Smi::New(length); | 3987 array->ptr()->length_ = Smi::New(length); |
| 3910 for (intptr_t j = 0; j < length; j++) { | 3988 for (intptr_t j = 0; j < length; j++) { |
| 3911 array->ptr()->data()[j] = d->ReadRef(); | 3989 array->ptr()->data()[j] = d->ReadRef(); |
| 3912 } | 3990 } |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 3924 virtual ~OneByteStringSerializationCluster() { } | 4002 virtual ~OneByteStringSerializationCluster() { } |
| 3925 | 4003 |
| 3926 void Trace(Serializer* s, RawObject* object) { | 4004 void Trace(Serializer* s, RawObject* object) { |
| 3927 RawOneByteString* str = reinterpret_cast<RawOneByteString*>(object); | 4005 RawOneByteString* str = reinterpret_cast<RawOneByteString*>(object); |
| 3928 objects_.Add(str); | 4006 objects_.Add(str); |
| 3929 } | 4007 } |
| 3930 | 4008 |
| 3931 void WriteAlloc(Serializer* s) { | 4009 void WriteAlloc(Serializer* s) { |
| 3932 s->WriteCid(kOneByteStringCid); | 4010 s->WriteCid(kOneByteStringCid); |
| 3933 intptr_t count = objects_.length(); | 4011 intptr_t count = objects_.length(); |
| 3934 s->Write<intptr_t>(count); | 4012 s->Write<int32_t>(count); |
| 3935 for (intptr_t i = 0; i < count; i++) { | 4013 for (intptr_t i = 0; i < count; i++) { |
| 3936 RawOneByteString* str = objects_[i]; | 4014 RawOneByteString* str = objects_[i]; |
| 3937 intptr_t length = Smi::Value(str->ptr()->length_); | 4015 intptr_t length = Smi::Value(str->ptr()->length_); |
| 3938 s->Write<intptr_t>(length); | 4016 s->Write<int32_t>(length); |
| 3939 s->AssignRef(str); | 4017 s->AssignRef(str); |
| 3940 } | 4018 } |
| 3941 } | 4019 } |
| 3942 | 4020 |
| 3943 void WriteFill(Serializer* s) { | 4021 void WriteFill(Serializer* s) { |
| 3944 intptr_t count = objects_.length(); | 4022 intptr_t count = objects_.length(); |
| 3945 for (intptr_t i = 0; i < count; i++) { | 4023 for (intptr_t i = 0; i < count; i++) { |
| 3946 RawOneByteString* str = objects_[i]; | 4024 RawOneByteString* str = objects_[i]; |
| 3947 intptr_t length = Smi::Value(str->ptr()->length_); | 4025 intptr_t length = Smi::Value(str->ptr()->length_); |
| 3948 s->Write<intptr_t>(length); | 4026 s->Write<int32_t>(length); |
| 3949 s->Write<bool>(str->IsCanonical()); | 4027 s->Write<bool>(str->IsCanonical()); |
| 3950 intptr_t hash = Smi::Value(str->ptr()->hash_); | 4028 intptr_t hash = Smi::Value(str->ptr()->hash_); |
| 3951 s->Write<int32_t>(hash); | 4029 s->Write<int32_t>(hash); |
| 3952 s->WriteBytes(str->ptr()->data(), length); | 4030 s->WriteBytes(str->ptr()->data(), length); |
| 3953 } | 4031 } |
| 3954 } | 4032 } |
| 3955 | 4033 |
| 3956 private: | 4034 private: |
| 3957 GrowableArray<RawOneByteString*> objects_; | 4035 GrowableArray<RawOneByteString*> objects_; |
| 3958 }; | 4036 }; |
| 3959 | 4037 |
| 3960 | 4038 |
| 3961 class OneByteStringDeserializationCluster : public DeserializationCluster { | 4039 class OneByteStringDeserializationCluster : public DeserializationCluster { |
| 3962 public: | 4040 public: |
| 3963 OneByteStringDeserializationCluster() { } | 4041 OneByteStringDeserializationCluster() { } |
| 3964 virtual ~OneByteStringDeserializationCluster() { } | 4042 virtual ~OneByteStringDeserializationCluster() { } |
| 3965 | 4043 |
| 3966 void ReadAlloc(Deserializer* d) { | 4044 void ReadAlloc(Deserializer* d) { |
| 3967 start_index_ = d->next_index(); | 4045 start_index_ = d->next_index(); |
| 3968 PageSpace* old_space = d->heap()->old_space(); | 4046 PageSpace* old_space = d->heap()->old_space(); |
| 3969 intptr_t count = d->Read<intptr_t>(); | 4047 intptr_t count = d->Read<int32_t>(); |
| 3970 for (intptr_t i = 0; i < count; i++) { | 4048 for (intptr_t i = 0; i < count; i++) { |
| 3971 intptr_t length = d->Read<intptr_t>(); | 4049 intptr_t length = d->Read<int32_t>(); |
| 3972 d->AssignRef(AllocateUninitialized(old_space, | 4050 d->AssignRef(AllocateUninitialized(old_space, |
| 3973 OneByteString::InstanceSize(length))); | 4051 OneByteString::InstanceSize(length))); |
| 3974 } | 4052 } |
| 3975 stop_index_ = d->next_index(); | 4053 stop_index_ = d->next_index(); |
| 3976 } | 4054 } |
| 3977 | 4055 |
| 3978 void ReadFill(Deserializer* d) { | 4056 void ReadFill(Deserializer* d) { |
| 3979 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 4057 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 3980 | 4058 |
| 3981 for (intptr_t id = start_index_; id < stop_index_; id++) { | 4059 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| 3982 RawOneByteString* str = reinterpret_cast<RawOneByteString*>(d->Ref(id)); | 4060 RawOneByteString* str = reinterpret_cast<RawOneByteString*>(d->Ref(id)); |
| 3983 intptr_t length = d->Read<intptr_t>(); | 4061 intptr_t length = d->Read<int32_t>(); |
| 3984 bool is_canonical = d->Read<bool>(); | 4062 bool is_canonical = d->Read<bool>(); |
| 3985 Deserializer::InitializeHeader(str, kOneByteStringCid, | 4063 Deserializer::InitializeHeader(str, kOneByteStringCid, |
| 3986 OneByteString::InstanceSize(length), | 4064 OneByteString::InstanceSize(length), |
| 3987 is_vm_object, is_canonical); | 4065 is_vm_object, is_canonical); |
| 3988 str->ptr()->length_ = Smi::New(length); | 4066 str->ptr()->length_ = Smi::New(length); |
| 3989 str->ptr()->hash_ = Smi::New(d->Read<intptr_t>()); | 4067 str->ptr()->hash_ = Smi::New(d->Read<int32_t>()); |
| 3990 for (intptr_t j = 0; j < length; j++) { | 4068 for (intptr_t j = 0; j < length; j++) { |
| 3991 str->ptr()->data()[j] = d->Read<uint8_t>(); | 4069 str->ptr()->data()[j] = d->Read<uint8_t>(); |
| 3992 } | 4070 } |
| 3993 } | 4071 } |
| 3994 } | 4072 } |
| 3995 }; | 4073 }; |
| 3996 | 4074 |
| 3997 | 4075 |
| 3998 class TwoByteStringSerializationCluster : public SerializationCluster { | 4076 class TwoByteStringSerializationCluster : public SerializationCluster { |
| 3999 public: | 4077 public: |
| 4000 TwoByteStringSerializationCluster() { } | 4078 TwoByteStringSerializationCluster() { } |
| 4001 virtual ~TwoByteStringSerializationCluster() { } | 4079 virtual ~TwoByteStringSerializationCluster() { } |
| 4002 | 4080 |
| 4003 void Trace(Serializer* s, RawObject* object) { | 4081 void Trace(Serializer* s, RawObject* object) { |
| 4004 RawTwoByteString* str = reinterpret_cast<RawTwoByteString*>(object); | 4082 RawTwoByteString* str = reinterpret_cast<RawTwoByteString*>(object); |
| 4005 objects_.Add(str); | 4083 objects_.Add(str); |
| 4006 } | 4084 } |
| 4007 | 4085 |
| 4008 void WriteAlloc(Serializer* s) { | 4086 void WriteAlloc(Serializer* s) { |
| 4009 s->WriteCid(kTwoByteStringCid); | 4087 s->WriteCid(kTwoByteStringCid); |
| 4010 intptr_t count = objects_.length(); | 4088 intptr_t count = objects_.length(); |
| 4011 s->Write<intptr_t>(count); | 4089 s->Write<int32_t>(count); |
| 4012 for (intptr_t i = 0; i < count; i++) { | 4090 for (intptr_t i = 0; i < count; i++) { |
| 4013 RawTwoByteString* str = objects_[i]; | 4091 RawTwoByteString* str = objects_[i]; |
| 4014 intptr_t length = Smi::Value(str->ptr()->length_); | 4092 intptr_t length = Smi::Value(str->ptr()->length_); |
| 4015 s->Write<intptr_t>(length); | 4093 s->Write<int32_t>(length); |
| 4016 s->AssignRef(str); | 4094 s->AssignRef(str); |
| 4017 } | 4095 } |
| 4018 } | 4096 } |
| 4019 | 4097 |
| 4020 void WriteFill(Serializer* s) { | 4098 void WriteFill(Serializer* s) { |
| 4021 intptr_t count = objects_.length(); | 4099 intptr_t count = objects_.length(); |
| 4022 for (intptr_t i = 0; i < count; i++) { | 4100 for (intptr_t i = 0; i < count; i++) { |
| 4023 RawTwoByteString* str = objects_[i]; | 4101 RawTwoByteString* str = objects_[i]; |
| 4024 intptr_t length = Smi::Value(str->ptr()->length_); | 4102 intptr_t length = Smi::Value(str->ptr()->length_); |
| 4025 s->Write<intptr_t>(length); | 4103 s->Write<int32_t>(length); |
| 4026 s->Write<bool>(str->IsCanonical()); | 4104 s->Write<bool>(str->IsCanonical()); |
| 4027 intptr_t hash = Smi::Value(str->ptr()->hash_); | 4105 intptr_t hash = Smi::Value(str->ptr()->hash_); |
| 4028 s->Write<int32_t>(hash); | 4106 s->Write<int32_t>(hash); |
| 4029 s->WriteBytes(reinterpret_cast<uint8_t*>(str->ptr()->data()), length * 2); | 4107 s->WriteBytes(reinterpret_cast<uint8_t*>(str->ptr()->data()), length * 2); |
| 4030 } | 4108 } |
| 4031 } | 4109 } |
| 4032 | 4110 |
| 4033 private: | 4111 private: |
| 4034 GrowableArray<RawTwoByteString*> objects_; | 4112 GrowableArray<RawTwoByteString*> objects_; |
| 4035 }; | 4113 }; |
| 4036 | 4114 |
| 4037 | 4115 |
| 4038 class TwoByteStringDeserializationCluster : public DeserializationCluster { | 4116 class TwoByteStringDeserializationCluster : public DeserializationCluster { |
| 4039 public: | 4117 public: |
| 4040 TwoByteStringDeserializationCluster() { } | 4118 TwoByteStringDeserializationCluster() { } |
| 4041 virtual ~TwoByteStringDeserializationCluster() { } | 4119 virtual ~TwoByteStringDeserializationCluster() { } |
| 4042 | 4120 |
| 4043 void ReadAlloc(Deserializer* d) { | 4121 void ReadAlloc(Deserializer* d) { |
| 4044 start_index_ = d->next_index(); | 4122 start_index_ = d->next_index(); |
| 4045 PageSpace* old_space = d->heap()->old_space(); | 4123 PageSpace* old_space = d->heap()->old_space(); |
| 4046 intptr_t count = d->Read<intptr_t>(); | 4124 intptr_t count = d->Read<int32_t>(); |
| 4047 for (intptr_t i = 0; i < count; i++) { | 4125 for (intptr_t i = 0; i < count; i++) { |
| 4048 intptr_t length = d->Read<intptr_t>(); | 4126 intptr_t length = d->Read<int32_t>(); |
| 4049 d->AssignRef(AllocateUninitialized(old_space, | 4127 d->AssignRef(AllocateUninitialized(old_space, |
| 4050 TwoByteString::InstanceSize(length))); | 4128 TwoByteString::InstanceSize(length))); |
| 4051 } | 4129 } |
| 4052 stop_index_ = d->next_index(); | 4130 stop_index_ = d->next_index(); |
| 4053 } | 4131 } |
| 4054 | 4132 |
| 4055 void ReadFill(Deserializer* d) { | 4133 void ReadFill(Deserializer* d) { |
| 4056 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 4134 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
| 4057 | 4135 |
| 4058 for (intptr_t id = start_index_; id < stop_index_; id++) { | 4136 for (intptr_t id = start_index_; id < stop_index_; id++) { |
| 4059 RawTwoByteString* str = | 4137 RawTwoByteString* str = |
| 4060 reinterpret_cast<RawTwoByteString*>(d->Ref(id)); | 4138 reinterpret_cast<RawTwoByteString*>(d->Ref(id)); |
| 4061 intptr_t length = d->Read<intptr_t>(); | 4139 intptr_t length = d->Read<int32_t>(); |
| 4062 bool is_canonical = d->Read<bool>(); | 4140 bool is_canonical = d->Read<bool>(); |
| 4063 Deserializer::InitializeHeader(str, kTwoByteStringCid, | 4141 Deserializer::InitializeHeader(str, kTwoByteStringCid, |
| 4064 TwoByteString::InstanceSize(length), | 4142 TwoByteString::InstanceSize(length), |
| 4065 is_vm_object, is_canonical); | 4143 is_vm_object, is_canonical); |
| 4066 str->ptr()->length_ = Smi::New(length); | 4144 str->ptr()->length_ = Smi::New(length); |
| 4067 str->ptr()->hash_ = Smi::New(d->Read<int32_t>()); | 4145 str->ptr()->hash_ = Smi::New(d->Read<int32_t>()); |
| 4068 uint8_t* cdata = reinterpret_cast<uint8_t*>(str->ptr()->data()); | 4146 uint8_t* cdata = reinterpret_cast<uint8_t*>(str->ptr()->data()); |
| 4069 d->ReadBytes(cdata, length * 2); | 4147 d->ReadBytes(cdata, length * 2); |
| 4070 } | 4148 } |
| 4071 } | 4149 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4189 } | 4267 } |
| 4190 | 4268 |
| 4191 FATAL1("No cluster defined for cid %" Pd, cid); | 4269 FATAL1("No cluster defined for cid %" Pd, cid); |
| 4192 return NULL; | 4270 return NULL; |
| 4193 } | 4271 } |
| 4194 | 4272 |
| 4195 | 4273 |
| 4196 void Serializer::Trace(RawObject* object) { | 4274 void Serializer::Trace(RawObject* object) { |
| 4197 intptr_t cid; | 4275 intptr_t cid; |
| 4198 if (!object->IsHeapObject()) { | 4276 if (!object->IsHeapObject()) { |
| 4199 cid = kSmiCid; | 4277 // Smis are merged into the Mint cluster because Smis for the writer might |
| 4278 // become Mints for the reader and vice versa. | |
| 4279 cid = kMintCid; | |
| 4200 } else { | 4280 } else { |
| 4201 cid = object->GetClassId(); | 4281 cid = object->GetClassId(); |
| 4202 } | 4282 } |
| 4203 | 4283 |
| 4204 SerializationCluster* cluster = clusters_by_cid_[cid]; | 4284 SerializationCluster* cluster = clusters_by_cid_[cid]; |
| 4205 if (cluster == NULL) { | 4285 if (cluster == NULL) { |
| 4206 cluster = NewClusterForClass(cid); | 4286 cluster = NewClusterForClass(cid); |
| 4207 clusters_by_cid_[cid] = cluster; | 4287 clusters_by_cid_[cid] = cluster; |
| 4208 } | 4288 } |
| 4209 ASSERT(cluster != NULL); | 4289 ASSERT(cluster != NULL); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 4220 const char* expected_features = Dart::FeaturesString(kind_); | 4300 const char* expected_features = Dart::FeaturesString(kind_); |
| 4221 ASSERT(expected_features != NULL); | 4301 ASSERT(expected_features != NULL); |
| 4222 const intptr_t features_len = strlen(expected_features); | 4302 const intptr_t features_len = strlen(expected_features); |
| 4223 WriteBytes(reinterpret_cast<const uint8_t*>(expected_features), | 4303 WriteBytes(reinterpret_cast<const uint8_t*>(expected_features), |
| 4224 features_len + 1); | 4304 features_len + 1); |
| 4225 free(const_cast<char*>(expected_features)); | 4305 free(const_cast<char*>(expected_features)); |
| 4226 } | 4306 } |
| 4227 | 4307 |
| 4228 | 4308 |
| 4229 #if defined(DEBUG) | 4309 #if defined(DEBUG) |
| 4230 static const intptr_t kSectionMarker = 0xABAB; | 4310 static const int32_t kSectionMarker = 0xABAB; |
| 4231 #endif | 4311 #endif |
| 4232 | 4312 |
| 4233 void Serializer::Serialize() { | 4313 void Serializer::Serialize() { |
| 4234 while (stack_.length() > 0) { | 4314 while (stack_.length() > 0) { |
| 4235 Trace(stack_.RemoveLast()); | 4315 Trace(stack_.RemoveLast()); |
| 4236 } | 4316 } |
| 4237 | 4317 |
| 4238 intptr_t num_clusters = 0; | 4318 intptr_t num_clusters = 0; |
| 4239 for (intptr_t cid = 1; cid < num_cids_; cid++) { | 4319 for (intptr_t cid = 1; cid < num_cids_; cid++) { |
| 4240 SerializationCluster* cluster = clusters_by_cid_[cid]; | 4320 SerializationCluster* cluster = clusters_by_cid_[cid]; |
| 4241 if (cluster != NULL) { | 4321 if (cluster != NULL) { |
| 4242 num_clusters++; | 4322 num_clusters++; |
| 4243 } | 4323 } |
| 4244 } | 4324 } |
| 4245 | 4325 |
| 4246 intptr_t num_objects = num_base_objects_ + num_written_objects_; | 4326 intptr_t num_objects = num_base_objects_ + num_written_objects_; |
| 4247 | 4327 |
| 4248 Write<int32_t>(num_objects); | 4328 Write<int32_t>(num_objects); |
| 4249 Write<int32_t>(num_clusters); | 4329 Write<int32_t>(num_clusters); |
| 4250 | 4330 |
| 4251 for (intptr_t cid = 1; cid < num_cids_; cid++) { | 4331 for (intptr_t cid = 1; cid < num_cids_; cid++) { |
| 4252 SerializationCluster* cluster = clusters_by_cid_[cid]; | 4332 SerializationCluster* cluster = clusters_by_cid_[cid]; |
| 4253 if (cluster != NULL) { | 4333 if (cluster != NULL) { |
| 4254 cluster->WriteAlloc(this); | 4334 cluster->WriteAlloc(this); |
| 4255 #if defined(DEBUG) | 4335 #if defined(DEBUG) |
| 4256 Write<intptr_t>(next_ref_index_); | 4336 Write<int32_t>(next_ref_index_); |
| 4257 #endif | 4337 #endif |
| 4258 } | 4338 } |
| 4259 } | 4339 } |
| 4260 | 4340 |
| 4261 // We should have assigned a ref to every object we pushed. | 4341 // We should have assigned a ref to every object we pushed. |
| 4262 ASSERT((next_ref_index_ - 1) == num_objects); | 4342 ASSERT((next_ref_index_ - 1) == num_objects); |
| 4263 | 4343 |
| 4264 for (intptr_t cid = 1; cid < num_cids_; cid++) { | 4344 for (intptr_t cid = 1; cid < num_cids_; cid++) { |
| 4265 SerializationCluster* cluster = clusters_by_cid_[cid]; | 4345 SerializationCluster* cluster = clusters_by_cid_[cid]; |
| 4266 if (cluster != NULL) { | 4346 if (cluster != NULL) { |
| 4267 cluster->WriteFill(this); | 4347 cluster->WriteFill(this); |
| 4268 #if defined(DEBUG) | 4348 #if defined(DEBUG) |
| 4269 Write<intptr_t>(kSectionMarker); | 4349 Write<int32_t>(kSectionMarker); |
| 4270 #endif | 4350 #endif |
| 4271 } | 4351 } |
| 4272 } | 4352 } |
| 4273 } | 4353 } |
| 4274 | 4354 |
| 4275 | 4355 |
| 4276 void Serializer::AddVMIsolateBaseObjects() { | 4356 void Serializer::AddVMIsolateBaseObjects() { |
| 4277 // These objects are always allocated by Object::InitOnce, so they are not | 4357 // These objects are always allocated by Object::InitOnce, so they are not |
| 4278 // written into the snapshot. | 4358 // written into the snapshot. |
| 4279 | 4359 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4329 Serialize(); | 4409 Serialize(); |
| 4330 | 4410 |
| 4331 // Write roots. | 4411 // Write roots. |
| 4332 WriteRef(symbols.raw()); | 4412 WriteRef(symbols.raw()); |
| 4333 WriteRef(scripts.raw()); | 4413 WriteRef(scripts.raw()); |
| 4334 if (Snapshot::IncludesCode(kind_)) { | 4414 if (Snapshot::IncludesCode(kind_)) { |
| 4335 StubCode::WriteRef(this); | 4415 StubCode::WriteRef(this); |
| 4336 } | 4416 } |
| 4337 | 4417 |
| 4338 #if defined(DEBUG) | 4418 #if defined(DEBUG) |
| 4339 Write<intptr_t>(kSectionMarker); | 4419 Write<int32_t>(kSectionMarker); |
| 4340 #endif | 4420 #endif |
| 4341 | 4421 |
| 4342 // Note we are not clearing the object id table. The full ref table | 4422 // Note we are not clearing the object id table. The full ref table |
| 4343 // of the vm isolate snapshot serves as the base objects for the | 4423 // of the vm isolate snapshot serves as the base objects for the |
| 4344 // regular isolate snapshot. | 4424 // regular isolate snapshot. |
| 4345 | 4425 |
| 4346 // Return the number of objects, -1 accounts for unused ref 0. | 4426 // Return the number of objects, -1 accounts for unused ref 0. |
| 4347 return next_ref_index_ - 1; | 4427 return next_ref_index_ - 1; |
| 4348 } | 4428 } |
| 4349 | 4429 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 4372 } | 4452 } |
| 4373 | 4453 |
| 4374 Serialize(); | 4454 Serialize(); |
| 4375 | 4455 |
| 4376 // Write roots. | 4456 // Write roots. |
| 4377 for (RawObject** p = from; p <= to; p++) { | 4457 for (RawObject** p = from; p <= to; p++) { |
| 4378 WriteRef(*p); | 4458 WriteRef(*p); |
| 4379 } | 4459 } |
| 4380 | 4460 |
| 4381 #if defined(DEBUG) | 4461 #if defined(DEBUG) |
| 4382 Write<intptr_t>(kSectionMarker); | 4462 Write<int32_t>(kSectionMarker); |
| 4383 #endif | 4463 #endif |
| 4384 | 4464 |
| 4385 heap_->ResetObjectIdTable(); | 4465 heap_->ResetObjectIdTable(); |
| 4386 } | 4466 } |
| 4387 | 4467 |
| 4388 | 4468 |
| 4389 Deserializer::Deserializer(Thread* thread, | 4469 Deserializer::Deserializer(Thread* thread, |
| 4390 Snapshot::Kind kind, | 4470 Snapshot::Kind kind, |
| 4391 const uint8_t* buffer, | 4471 const uint8_t* buffer, |
| 4392 intptr_t size, | 4472 intptr_t size, |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4592 void Deserializer::Deserialize() { | 4672 void Deserializer::Deserialize() { |
| 4593 // TODO(rmacnak): Verify num of base objects. | 4673 // TODO(rmacnak): Verify num of base objects. |
| 4594 | 4674 |
| 4595 { | 4675 { |
| 4596 NOT_IN_PRODUCT(TimelineDurationScope tds(thread(), | 4676 NOT_IN_PRODUCT(TimelineDurationScope tds(thread(), |
| 4597 Timeline::GetIsolateStream(), "ReadAlloc")); | 4677 Timeline::GetIsolateStream(), "ReadAlloc")); |
| 4598 for (intptr_t i = 0; i < num_clusters_; i++) { | 4678 for (intptr_t i = 0; i < num_clusters_; i++) { |
| 4599 clusters_[i] = ReadCluster(); | 4679 clusters_[i] = ReadCluster(); |
| 4600 clusters_[i]->ReadAlloc(this); | 4680 clusters_[i]->ReadAlloc(this); |
| 4601 #if defined(DEBUG) | 4681 #if defined(DEBUG) |
| 4602 intptr_t serializers_next_ref_index_ = Read<intptr_t>(); | 4682 intptr_t serializers_next_ref_index_ = Read<int32_t>(); |
| 4603 ASSERT(serializers_next_ref_index_ == next_ref_index_); | 4683 ASSERT(serializers_next_ref_index_ == next_ref_index_); |
| 4604 #endif | 4684 #endif |
| 4605 } | 4685 } |
| 4606 } | 4686 } |
| 4607 | 4687 |
| 4608 // We should have completely filled the ref array. | 4688 // We should have completely filled the ref array. |
| 4609 ASSERT((next_ref_index_ - 1) == num_objects_); | 4689 ASSERT((next_ref_index_ - 1) == num_objects_); |
| 4610 | 4690 |
| 4611 { | 4691 { |
| 4612 NOT_IN_PRODUCT(TimelineDurationScope tds(thread(), | 4692 NOT_IN_PRODUCT(TimelineDurationScope tds(thread(), |
| 4613 Timeline::GetIsolateStream(), "ReadFill")); | 4693 Timeline::GetIsolateStream(), "ReadFill")); |
| 4614 for (intptr_t i = 0; i < num_clusters_; i++) { | 4694 for (intptr_t i = 0; i < num_clusters_; i++) { |
| 4615 clusters_[i]->ReadFill(this); | 4695 clusters_[i]->ReadFill(this); |
| 4616 #if defined(DEBUG) | 4696 #if defined(DEBUG) |
| 4617 intptr_t section_marker = Read<intptr_t>(); | 4697 int32_t section_marker = Read<int32_t>(); |
| 4618 ASSERT(section_marker == kSectionMarker); | 4698 ASSERT(section_marker == kSectionMarker); |
| 4619 #endif | 4699 #endif |
| 4620 } | 4700 } |
| 4621 } | 4701 } |
| 4622 } | 4702 } |
| 4623 | 4703 |
| 4624 class HeapLocker : public StackResource { | 4704 class HeapLocker : public StackResource { |
| 4625 public: | 4705 public: |
| 4626 HeapLocker(Thread* thread, PageSpace* page_space) | 4706 HeapLocker(Thread* thread, PageSpace* page_space) |
| 4627 : StackResource(thread), page_space_(page_space) { | 4707 : StackResource(thread), page_space_(page_space) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4691 | 4771 |
| 4692 // Read roots. | 4772 // Read roots. |
| 4693 symbol_table ^= ReadRef(); | 4773 symbol_table ^= ReadRef(); |
| 4694 isolate()->object_store()->set_symbol_table(symbol_table); | 4774 isolate()->object_store()->set_symbol_table(symbol_table); |
| 4695 ReadRef(); // Script list. | 4775 ReadRef(); // Script list. |
| 4696 if (Snapshot::IncludesCode(kind_)) { | 4776 if (Snapshot::IncludesCode(kind_)) { |
| 4697 StubCode::ReadRef(this); | 4777 StubCode::ReadRef(this); |
| 4698 } | 4778 } |
| 4699 | 4779 |
| 4700 #if defined(DEBUG) | 4780 #if defined(DEBUG) |
| 4701 intptr_t section_marker = Read<intptr_t>(); | 4781 int32_t section_marker = Read<int32_t>(); |
| 4702 ASSERT(section_marker == kSectionMarker); | 4782 ASSERT(section_marker == kSectionMarker); |
| 4703 #endif | 4783 #endif |
| 4704 | 4784 |
| 4705 refs = refs_; | 4785 refs = refs_; |
| 4706 refs_ = NULL; | 4786 refs_ = NULL; |
| 4707 } | 4787 } |
| 4708 | 4788 |
| 4709 Symbols::InitOnceFromSnapshot(isolate()); | 4789 Symbols::InitOnceFromSnapshot(isolate()); |
| 4710 | 4790 |
| 4711 Object::set_vm_isolate_snapshot_object_table(refs); | 4791 Object::set_vm_isolate_snapshot_object_table(refs); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 4732 Deserialize(); | 4812 Deserialize(); |
| 4733 | 4813 |
| 4734 // Read roots. | 4814 // Read roots. |
| 4735 RawObject** from = object_store->from(); | 4815 RawObject** from = object_store->from(); |
| 4736 RawObject** to = object_store->to_snapshot(kind_); | 4816 RawObject** to = object_store->to_snapshot(kind_); |
| 4737 for (RawObject** p = from; p <= to; p++) { | 4817 for (RawObject** p = from; p <= to; p++) { |
| 4738 *p = ReadRef(); | 4818 *p = ReadRef(); |
| 4739 } | 4819 } |
| 4740 | 4820 |
| 4741 #if defined(DEBUG) | 4821 #if defined(DEBUG) |
| 4742 intptr_t section_marker = Read<intptr_t>(); | 4822 int32_t section_marker = Read<int32_t>(); |
| 4743 ASSERT(section_marker == kSectionMarker); | 4823 ASSERT(section_marker == kSectionMarker); |
| 4744 #endif | 4824 #endif |
| 4745 | 4825 |
| 4746 refs = refs_; | 4826 refs = refs_; |
| 4747 refs_ = NULL; | 4827 refs_ = NULL; |
| 4748 } | 4828 } |
| 4749 | 4829 |
| 4750 #if defined(DEBUG) | 4830 #if defined(DEBUG) |
| 4751 Isolate* isolate = thread()->isolate(); | 4831 Isolate* isolate = thread()->isolate(); |
| 4752 isolate->ValidateClassTable(); | 4832 isolate->ValidateClassTable(); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4989 | 5069 |
| 4990 deserializer.ReadVMSnapshot(); | 5070 deserializer.ReadVMSnapshot(); |
| 4991 | 5071 |
| 4992 Dart::set_instructions_snapshot_buffer(instructions_buffer_); | 5072 Dart::set_instructions_snapshot_buffer(instructions_buffer_); |
| 4993 Dart::set_data_snapshot_buffer(data_buffer_); | 5073 Dart::set_data_snapshot_buffer(data_buffer_); |
| 4994 | 5074 |
| 4995 return ApiError::null(); | 5075 return ApiError::null(); |
| 4996 } | 5076 } |
| 4997 | 5077 |
| 4998 } // namespace dart | 5078 } // namespace dart |
| OLD | NEW |