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

Side by Side Diff: runtime/vm/snapshot.cc

Issue 468423002: Add support for TypedData in full snapshot. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/snapshot.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/bootstrap.h" 9 #include "vm/bootstrap.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 // instance of it. The individual fields will be read later. 286 // instance of it. The individual fields will be read later.
287 if (SerializedHeaderData::decode(class_header) == kInstanceObjectId) { 287 if (SerializedHeaderData::decode(class_header) == kInstanceObjectId) {
288 Instance& result = Instance::ZoneHandle(isolate(), Instance::null()); 288 Instance& result = Instance::ZoneHandle(isolate(), Instance::null());
289 AddBackRef(object_id, &result, kIsNotDeserialized); 289 AddBackRef(object_id, &result, kIsNotDeserialized);
290 290
291 cls_ ^= ReadObjectImpl(); // Read class information. 291 cls_ ^= ReadObjectImpl(); // Read class information.
292 ASSERT(!cls_.IsNull()); 292 ASSERT(!cls_.IsNull());
293 intptr_t instance_size = cls_.instance_size(); 293 intptr_t instance_size = cls_.instance_size();
294 ASSERT(instance_size > 0); 294 ASSERT(instance_size > 0);
295 if (kind_ == Snapshot::kFull) { 295 if (kind_ == Snapshot::kFull) {
296 result ^= AllocateUninitialized(cls_, instance_size); 296 result ^= AllocateUninitialized(cls_.id(), instance_size);
297 } else { 297 } else {
298 result ^= Object::Allocate(cls_.id(), instance_size, HEAP_SPACE(kind_)); 298 result ^= Object::Allocate(cls_.id(), instance_size, HEAP_SPACE(kind_));
299 } 299 }
300 return result.raw(); 300 return result.raw();
301 } 301 }
302 ASSERT((class_header & kSmiTagMask) != kSmiTag); 302 ASSERT((class_header & kSmiTagMask) != kSmiTag);
303 cls_ = LookupInternalClass(class_header); 303 cls_ = LookupInternalClass(class_header);
304 ASSERT(!cls_.IsNull()); 304 ASSERT(!cls_.IsNull());
305 305
306 // Similarly Array and ImmutableArray objects are also similarly only 306 // Similarly Array and ImmutableArray objects are also similarly only
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 // Setup native resolver for bootstrap impl. 417 // Setup native resolver for bootstrap impl.
418 Bootstrap::SetupNativeResolver(); 418 Bootstrap::SetupNativeResolver();
419 } 419 }
420 420
421 421
422 #define ALLOC_NEW_OBJECT_WITH_LEN(type, class_obj, length) \ 422 #define ALLOC_NEW_OBJECT_WITH_LEN(type, class_obj, length) \
423 ASSERT(kind_ == Snapshot::kFull); \ 423 ASSERT(kind_ == Snapshot::kFull); \
424 ASSERT(isolate()->no_gc_scope_depth() != 0); \ 424 ASSERT(isolate()->no_gc_scope_depth() != 0); \
425 cls_ = class_obj; \ 425 cls_ = class_obj; \
426 Raw##type* obj = reinterpret_cast<Raw##type*>( \ 426 Raw##type* obj = reinterpret_cast<Raw##type*>( \
427 AllocateUninitialized(cls_, type::InstanceSize(length))); \ 427 AllocateUninitialized(cls_.id(), type::InstanceSize(length))); \
428 obj->ptr()->length_ = Smi::New(length); \ 428 obj->ptr()->length_ = Smi::New(length); \
429 return obj; \ 429 return obj; \
430 430
431 431
432 RawArray* SnapshotReader::NewArray(intptr_t len) { 432 RawArray* SnapshotReader::NewArray(intptr_t len) {
433 ALLOC_NEW_OBJECT_WITH_LEN(Array, object_store()->array_class(), len); 433 ALLOC_NEW_OBJECT_WITH_LEN(Array, object_store()->array_class(), len);
434 } 434 }
435 435
436 436
437 RawImmutableArray* SnapshotReader::NewImmutableArray(intptr_t len) { 437 RawImmutableArray* SnapshotReader::NewImmutableArray(intptr_t len) {
(...skipping 22 matching lines...) Expand all
460 Object::type_arguments_class(), 460 Object::type_arguments_class(),
461 len); 461 len);
462 } 462 }
463 463
464 464
465 RawTokenStream* SnapshotReader::NewTokenStream(intptr_t len) { 465 RawTokenStream* SnapshotReader::NewTokenStream(intptr_t len) {
466 ASSERT(kind_ == Snapshot::kFull); 466 ASSERT(kind_ == Snapshot::kFull);
467 ASSERT(isolate()->no_gc_scope_depth() != 0); 467 ASSERT(isolate()->no_gc_scope_depth() != 0);
468 cls_ = Object::token_stream_class(); 468 cls_ = Object::token_stream_class();
469 stream_ = reinterpret_cast<RawTokenStream*>( 469 stream_ = reinterpret_cast<RawTokenStream*>(
470 AllocateUninitialized(cls_, TokenStream::InstanceSize())); 470 AllocateUninitialized(cls_.id(), TokenStream::InstanceSize()));
471 cls_ = isolate()->class_table()->At(kExternalTypedDataUint8ArrayCid); 471 cls_ = isolate()->class_table()->At(kExternalTypedDataUint8ArrayCid);
472 uint8_t* array = const_cast<uint8_t*>(CurrentBufferAddress()); 472 uint8_t* array = const_cast<uint8_t*>(CurrentBufferAddress());
473 ASSERT(array != NULL); 473 ASSERT(array != NULL);
474 Advance(len); 474 Advance(len);
475 data_ = reinterpret_cast<RawExternalTypedData*>( 475 data_ = reinterpret_cast<RawExternalTypedData*>(
476 AllocateUninitialized(cls_, ExternalTypedData::InstanceSize())); 476 AllocateUninitialized(cls_.id(), ExternalTypedData::InstanceSize()));
477 data_.SetData(array); 477 data_.SetData(array);
478 data_.SetLength(len); 478 data_.SetLength(len);
479 stream_.SetStream(data_); 479 stream_.SetStream(data_);
480 return stream_.raw(); 480 return stream_.raw();
481 } 481 }
482 482
483 483
484 RawContext* SnapshotReader::NewContext(intptr_t num_variables) { 484 RawContext* SnapshotReader::NewContext(intptr_t num_variables) {
485 ASSERT(kind_ == Snapshot::kFull); 485 ASSERT(kind_ == Snapshot::kFull);
486 ASSERT(isolate()->no_gc_scope_depth() != 0); 486 ASSERT(isolate()->no_gc_scope_depth() != 0);
487 cls_ = Object::context_class(); 487 cls_ = Object::context_class();
488 RawContext* obj = reinterpret_cast<RawContext*>( 488 RawContext* obj = reinterpret_cast<RawContext*>(
489 AllocateUninitialized(cls_, Context::InstanceSize(num_variables))); 489 AllocateUninitialized(cls_.id(), Context::InstanceSize(num_variables)));
490 obj->ptr()->num_variables_ = num_variables; 490 obj->ptr()->num_variables_ = num_variables;
491 return obj; 491 return obj;
492 } 492 }
493 493
494 494
495 RawClass* SnapshotReader::NewClass(intptr_t class_id) { 495 RawClass* SnapshotReader::NewClass(intptr_t class_id) {
496 ASSERT(kind_ == Snapshot::kFull); 496 ASSERT(kind_ == Snapshot::kFull);
497 ASSERT(isolate()->no_gc_scope_depth() != 0); 497 ASSERT(isolate()->no_gc_scope_depth() != 0);
498 if (class_id < kNumPredefinedCids) { 498 if (class_id < kNumPredefinedCids) {
499 ASSERT((class_id >= kInstanceCid) && 499 ASSERT((class_id >= kInstanceCid) &&
500 (class_id <= kNullCid)); 500 (class_id <= kNullCid));
501 return isolate()->class_table()->At(class_id); 501 return isolate()->class_table()->At(class_id);
502 } 502 }
503 cls_ = Object::class_class(); 503 cls_ = Object::class_class();
504 RawClass* obj = reinterpret_cast<RawClass*>( 504 RawClass* obj = reinterpret_cast<RawClass*>(
505 AllocateUninitialized(cls_, Class::InstanceSize())); 505 AllocateUninitialized(cls_.id(), Class::InstanceSize()));
506 Instance fake; 506 Instance fake;
507 obj->ptr()->handle_vtable_ = fake.vtable(); 507 obj->ptr()->handle_vtable_ = fake.vtable();
508 cls_ = obj; 508 cls_ = obj;
509 cls_.set_id(class_id); 509 cls_.set_id(class_id);
510 isolate()->RegisterClassAt(class_id, cls_); 510 isolate()->RegisterClassAt(class_id, cls_);
511 return cls_.raw(); 511 return cls_.raw();
512 } 512 }
513 513
514 514
515 RawInstance* SnapshotReader::NewInstance() { 515 RawInstance* SnapshotReader::NewInstance() {
516 ASSERT(kind_ == Snapshot::kFull); 516 ASSERT(kind_ == Snapshot::kFull);
517 ASSERT(isolate()->no_gc_scope_depth() != 0); 517 ASSERT(isolate()->no_gc_scope_depth() != 0);
518 cls_ = object_store()->object_class(); 518 cls_ = object_store()->object_class();
519 RawInstance* obj = reinterpret_cast<RawInstance*>( 519 RawInstance* obj = reinterpret_cast<RawInstance*>(
520 AllocateUninitialized(cls_, Instance::InstanceSize())); 520 AllocateUninitialized(cls_.id(), Instance::InstanceSize()));
521 return obj; 521 return obj;
522 } 522 }
523 523
524 524
525 RawMint* SnapshotReader::NewMint(int64_t value) { 525 RawMint* SnapshotReader::NewMint(int64_t value) {
526 ASSERT(kind_ == Snapshot::kFull); 526 ASSERT(kind_ == Snapshot::kFull);
527 ASSERT(isolate()->no_gc_scope_depth() != 0); 527 ASSERT(isolate()->no_gc_scope_depth() != 0);
528 cls_ = object_store()->mint_class(); 528 cls_ = object_store()->mint_class();
529 RawMint* obj = reinterpret_cast<RawMint*>( 529 RawMint* obj = reinterpret_cast<RawMint*>(
530 AllocateUninitialized(cls_, Mint::InstanceSize())); 530 AllocateUninitialized(cls_.id(), Mint::InstanceSize()));
531 obj->ptr()->value_ = value; 531 obj->ptr()->value_ = value;
532 return obj; 532 return obj;
533 } 533 }
534 534
535 535
536 RawBigint* SnapshotReader::NewBigint(const char* hex_string) { 536 RawBigint* SnapshotReader::NewBigint(const char* hex_string) {
537 ASSERT(kind_ == Snapshot::kFull); 537 ASSERT(kind_ == Snapshot::kFull);
538 ASSERT(isolate()->no_gc_scope_depth() != 0); 538 ASSERT(isolate()->no_gc_scope_depth() != 0);
539 cls_ = object_store()->bigint_class(); 539 cls_ = object_store()->bigint_class();
540 intptr_t bigint_length = BigintOperations::ComputeChunkLength(hex_string); 540 intptr_t bigint_length = BigintOperations::ComputeChunkLength(hex_string);
541 RawBigint* obj = reinterpret_cast<RawBigint*>( 541 RawBigint* obj = reinterpret_cast<RawBigint*>(
542 AllocateUninitialized(cls_, Bigint::InstanceSize(bigint_length))); 542 AllocateUninitialized(cls_.id(), Bigint::InstanceSize(bigint_length)));
543 obj->ptr()->allocated_length_ = bigint_length; 543 obj->ptr()->allocated_length_ = bigint_length;
544 obj->ptr()->signed_length_ = bigint_length; 544 obj->ptr()->signed_length_ = bigint_length;
545 BigintOperations::FromHexCString(hex_string, Bigint::Handle(obj)); 545 BigintOperations::FromHexCString(hex_string, Bigint::Handle(obj));
546 return obj; 546 return obj;
547 } 547 }
548 548
549 549
550 RawDouble* SnapshotReader::NewDouble(double value) { 550 RawDouble* SnapshotReader::NewDouble(double value) {
551 ASSERT(kind_ == Snapshot::kFull); 551 ASSERT(kind_ == Snapshot::kFull);
552 ASSERT(isolate()->no_gc_scope_depth() != 0); 552 ASSERT(isolate()->no_gc_scope_depth() != 0);
553 cls_ = object_store()->double_class(); 553 cls_ = object_store()->double_class();
554 RawDouble* obj = reinterpret_cast<RawDouble*>( 554 RawDouble* obj = reinterpret_cast<RawDouble*>(
555 AllocateUninitialized(cls_, Double::InstanceSize())); 555 AllocateUninitialized(cls_.id(), Double::InstanceSize()));
556 obj->ptr()->value_ = value; 556 obj->ptr()->value_ = value;
557 return obj; 557 return obj;
558 } 558 }
559 559
560 560
561 RawTypedData* SnapshotReader::NewTypedData(intptr_t class_id, intptr_t len) {
562 ASSERT(kind_ == Snapshot::kFull);
563 ASSERT(isolate()->no_gc_scope_depth() != 0);
564 const intptr_t lengthInBytes = len * TypedData::ElementSizeInBytes(class_id);
565 RawTypedData* obj = reinterpret_cast<RawTypedData*>(
566 AllocateUninitialized(class_id, TypedData::InstanceSize(lengthInBytes)));
567 obj->ptr()->length_ = Smi::New(len);
568 return obj;
569 }
570
571
561 #define ALLOC_NEW_OBJECT(type, class_obj) \ 572 #define ALLOC_NEW_OBJECT(type, class_obj) \
562 ASSERT(kind_ == Snapshot::kFull); \ 573 ASSERT(kind_ == Snapshot::kFull); \
563 ASSERT(isolate()->no_gc_scope_depth() != 0); \ 574 ASSERT(isolate()->no_gc_scope_depth() != 0); \
564 cls_ = class_obj; \ 575 cls_ = class_obj; \
565 return reinterpret_cast<Raw##type*>( \ 576 return reinterpret_cast<Raw##type*>( \
566 AllocateUninitialized(cls_, type::InstanceSize())); \ 577 AllocateUninitialized(cls_.id(), type::InstanceSize())); \
567 578
568 579
569 RawUnresolvedClass* SnapshotReader::NewUnresolvedClass() { 580 RawUnresolvedClass* SnapshotReader::NewUnresolvedClass() {
570 ALLOC_NEW_OBJECT(UnresolvedClass, Object::unresolved_class_class()); 581 ALLOC_NEW_OBJECT(UnresolvedClass, Object::unresolved_class_class());
571 } 582 }
572 583
573 584
574 RawType* SnapshotReader::NewType() { 585 RawType* SnapshotReader::NewType() {
575 ALLOC_NEW_OBJECT(Type, object_store()->type_class()); 586 ALLOC_NEW_OBJECT(Type, object_store()->type_class());
576 } 587 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 object_store()->growable_object_array_class()); 662 object_store()->growable_object_array_class());
652 } 663 }
653 664
654 665
655 RawFloat32x4* SnapshotReader::NewFloat32x4(float v0, float v1, float v2, 666 RawFloat32x4* SnapshotReader::NewFloat32x4(float v0, float v1, float v2,
656 float v3) { 667 float v3) {
657 ASSERT(kind_ == Snapshot::kFull); 668 ASSERT(kind_ == Snapshot::kFull);
658 ASSERT(isolate()->no_gc_scope_depth() != 0); 669 ASSERT(isolate()->no_gc_scope_depth() != 0);
659 cls_ = object_store()->float32x4_class(); 670 cls_ = object_store()->float32x4_class();
660 RawFloat32x4* obj = reinterpret_cast<RawFloat32x4*>( 671 RawFloat32x4* obj = reinterpret_cast<RawFloat32x4*>(
661 AllocateUninitialized(cls_, Float32x4::InstanceSize())); 672 AllocateUninitialized(cls_.id(), Float32x4::InstanceSize()));
662 obj->ptr()->value_[0] = v0; 673 obj->ptr()->value_[0] = v0;
663 obj->ptr()->value_[1] = v1; 674 obj->ptr()->value_[1] = v1;
664 obj->ptr()->value_[2] = v2; 675 obj->ptr()->value_[2] = v2;
665 obj->ptr()->value_[3] = v3; 676 obj->ptr()->value_[3] = v3;
666 return obj; 677 return obj;
667 } 678 }
668 679
669 680
670 RawInt32x4* SnapshotReader::NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2, 681 RawInt32x4* SnapshotReader::NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2,
671 uint32_t v3) { 682 uint32_t v3) {
672 ASSERT(kind_ == Snapshot::kFull); 683 ASSERT(kind_ == Snapshot::kFull);
673 ASSERT(isolate()->no_gc_scope_depth() != 0); 684 ASSERT(isolate()->no_gc_scope_depth() != 0);
674 cls_ = object_store()->int32x4_class(); 685 cls_ = object_store()->int32x4_class();
675 RawInt32x4* obj = reinterpret_cast<RawInt32x4*>( 686 RawInt32x4* obj = reinterpret_cast<RawInt32x4*>(
676 AllocateUninitialized(cls_, Int32x4::InstanceSize())); 687 AllocateUninitialized(cls_.id(), Int32x4::InstanceSize()));
677 obj->ptr()->value_[0] = v0; 688 obj->ptr()->value_[0] = v0;
678 obj->ptr()->value_[1] = v1; 689 obj->ptr()->value_[1] = v1;
679 obj->ptr()->value_[2] = v2; 690 obj->ptr()->value_[2] = v2;
680 obj->ptr()->value_[3] = v3; 691 obj->ptr()->value_[3] = v3;
681 return obj; 692 return obj;
682 } 693 }
683 694
684 695
685 RawFloat64x2* SnapshotReader::NewFloat64x2(double v0, double v1) { 696 RawFloat64x2* SnapshotReader::NewFloat64x2(double v0, double v1) {
686 ASSERT(kind_ == Snapshot::kFull); 697 ASSERT(kind_ == Snapshot::kFull);
687 ASSERT(isolate()->no_gc_scope_depth() != 0); 698 ASSERT(isolate()->no_gc_scope_depth() != 0);
688 cls_ = object_store()->float64x2_class(); 699 cls_ = object_store()->float64x2_class();
689 RawFloat64x2* obj = reinterpret_cast<RawFloat64x2*>( 700 RawFloat64x2* obj = reinterpret_cast<RawFloat64x2*>(
690 AllocateUninitialized(cls_, Float64x2::InstanceSize())); 701 AllocateUninitialized(cls_.id(), Float64x2::InstanceSize()));
691 obj->ptr()->value_[0] = v0; 702 obj->ptr()->value_[0] = v0;
692 obj->ptr()->value_[1] = v1; 703 obj->ptr()->value_[1] = v1;
693 return obj; 704 return obj;
694 } 705 }
695 706
696 707
697 RawApiError* SnapshotReader::NewApiError() { 708 RawApiError* SnapshotReader::NewApiError() {
698 ALLOC_NEW_OBJECT(ApiError, Object::api_error_class()); 709 ALLOC_NEW_OBJECT(ApiError, Object::api_error_class());
699 } 710 }
700 711
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 } else if (SerializedHeaderTag::decode(class_header) == kObjectId) { 749 } else if (SerializedHeaderTag::decode(class_header) == kObjectId) {
739 intptr_t class_id = SerializedHeaderData::decode(class_header); 750 intptr_t class_id = SerializedHeaderData::decode(class_header);
740 if (IsObjectStoreClassId(class_id)) { 751 if (IsObjectStoreClassId(class_id)) {
741 return isolate()->class_table()->At(class_id); // get singleton class. 752 return isolate()->class_table()->At(class_id); // get singleton class.
742 } 753 }
743 } 754 }
744 return Class::null(); 755 return Class::null();
745 } 756 }
746 757
747 758
748 RawObject* SnapshotReader::AllocateUninitialized(const Class& cls, 759 RawObject* SnapshotReader::AllocateUninitialized(intptr_t class_id,
749 intptr_t size) { 760 intptr_t size) {
750 ASSERT(isolate()->no_gc_scope_depth() != 0); 761 ASSERT(isolate()->no_gc_scope_depth() != 0);
751 ASSERT(Utils::IsAligned(size, kObjectAlignment)); 762 ASSERT(Utils::IsAligned(size, kObjectAlignment));
752 Heap* heap = isolate()->heap(); 763 Heap* heap = isolate()->heap();
753 764
754 uword address = heap->TryAllocate(size, Heap::kOld, PageSpace::kForceGrowth); 765 uword address = heap->TryAllocate(size, Heap::kOld, PageSpace::kForceGrowth);
755 if (address == 0) { 766 if (address == 0) {
756 // Use the preallocated out of memory exception to avoid calling 767 // Use the preallocated out of memory exception to avoid calling
757 // into dart code or allocating any code. 768 // into dart code or allocating any code.
758 // We do a longjmp at this point to unwind out of the entire 769 // We do a longjmp at this point to unwind out of the entire
(...skipping 10 matching lines...) Expand all
769 *reinterpret_cast<intptr_t*>(current) = kZapUninitializedWord; 780 *reinterpret_cast<intptr_t*>(current) = kZapUninitializedWord;
770 current += kWordSize; 781 current += kWordSize;
771 } 782 }
772 #endif // defined(DBEUG) 783 #endif // defined(DBEUG)
773 // Make sure to initialize the last word, as this can be left untouched in 784 // Make sure to initialize the last word, as this can be left untouched in
774 // case the object deserialized has an alignment tail. 785 // case the object deserialized has an alignment tail.
775 *reinterpret_cast<RawObject**>(address + size - kWordSize) = Object::null(); 786 *reinterpret_cast<RawObject**>(address + size - kWordSize) = Object::null();
776 787
777 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag); 788 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag);
778 uword tags = 0; 789 uword tags = 0;
779 intptr_t index = cls.id(); 790 ASSERT(class_id != kIllegalCid);
780 ASSERT(index != kIllegalCid); 791 tags = RawObject::ClassIdTag::update(class_id, tags);
781 tags = RawObject::ClassIdTag::update(index, tags);
782 tags = RawObject::SizeTag::update(size, tags); 792 tags = RawObject::SizeTag::update(size, tags);
783 raw_obj->ptr()->tags_ = tags; 793 raw_obj->ptr()->tags_ = tags;
784 return raw_obj; 794 return raw_obj;
785 } 795 }
786 796
787 797
788 RawObject* SnapshotReader::ReadVMIsolateObject(intptr_t header_value) { 798 RawObject* SnapshotReader::ReadVMIsolateObject(intptr_t header_value) {
789 intptr_t object_id = GetVMIsolateObjectId(header_value); 799 intptr_t object_id = GetVMIsolateObjectId(header_value);
790 if (object_id == kNullObject) { 800 if (object_id == kNullObject) {
791 // This is a singleton null object, return it. 801 // This is a singleton null object, return it.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 intptr_t instance_size = 0; 863 intptr_t instance_size = 0;
854 if (result == NULL) { 864 if (result == NULL) {
855 result = &(Instance::ZoneHandle(isolate(), Instance::null())); 865 result = &(Instance::ZoneHandle(isolate(), Instance::null()));
856 AddBackRef(object_id, result, kIsDeserialized); 866 AddBackRef(object_id, result, kIsDeserialized);
857 cls_ ^= ReadObjectImpl(); 867 cls_ ^= ReadObjectImpl();
858 ASSERT(!cls_.IsNull()); 868 ASSERT(!cls_.IsNull());
859 instance_size = cls_.instance_size(); 869 instance_size = cls_.instance_size();
860 ASSERT(instance_size > 0); 870 ASSERT(instance_size > 0);
861 // Allocate the instance and read in all the fields for the object. 871 // Allocate the instance and read in all the fields for the object.
862 if (kind_ == Snapshot::kFull) { 872 if (kind_ == Snapshot::kFull) {
863 *result ^= AllocateUninitialized(cls_, instance_size); 873 *result ^= AllocateUninitialized(cls_.id(), instance_size);
864 } else { 874 } else {
865 *result ^= Object::Allocate(cls_.id(), 875 *result ^= Object::Allocate(cls_.id(),
866 instance_size, 876 instance_size,
867 HEAP_SPACE(kind_)); 877 HEAP_SPACE(kind_));
868 } 878 }
869 } else { 879 } else {
870 cls_ ^= ReadObjectImpl(); 880 cls_ ^= ReadObjectImpl();
871 ASSERT(!cls_.IsNull()); 881 ASSERT(!cls_.IsNull());
872 instance_size = cls_.instance_size(); 882 instance_size = cls_.instance_size();
873 } 883 }
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 NoGCScope no_gc; 1651 NoGCScope no_gc;
1642 WriteObject(obj.raw()); 1652 WriteObject(obj.raw());
1643 UnmarkAll(); 1653 UnmarkAll();
1644 } else { 1654 } else {
1645 ThrowException(exception_type(), exception_msg()); 1655 ThrowException(exception_type(), exception_msg());
1646 } 1656 }
1647 } 1657 }
1648 1658
1649 1659
1650 } // namespace dart 1660 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/snapshot.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698