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

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

Issue 130563005: Fix dartbug.com/15963: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 11 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 | « no previous file | runtime/vm/snapshot.h » ('j') | 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/bigint_operations.h" 5 #include "vm/bigint_operations.h"
6 #include "vm/object.h" 6 #include "vm/object.h"
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 #include "vm/snapshot.h" 8 #include "vm/snapshot.h"
9 #include "vm/symbols.h" 9 #include "vm/symbols.h"
10 #include "vm/visitor.h" 10 #include "vm/visitor.h"
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 intptr_t object_id, 1677 intptr_t object_id,
1678 Snapshot::Kind kind) { 1678 Snapshot::Kind kind) {
1679 UNREACHABLE(); 1679 UNREACHABLE();
1680 } 1680 }
1681 1681
1682 1682
1683 RawInstance* Instance::ReadFrom(SnapshotReader* reader, 1683 RawInstance* Instance::ReadFrom(SnapshotReader* reader,
1684 intptr_t object_id, 1684 intptr_t object_id,
1685 intptr_t tags, 1685 intptr_t tags,
1686 Snapshot::Kind kind) { 1686 Snapshot::Kind kind) {
1687 UNREACHABLE(); 1687 ASSERT(reader != NULL);
1688 return Instance::null(); 1688
1689 // Create an Instance object or get canonical one if it is a canonical
1690 // constant.
1691 Instance& obj = Instance::ZoneHandle(reader->isolate(), Instance::null());
1692 if (kind == Snapshot::kFull) {
1693 obj = reader->NewInstance();
1694 } else {
1695 obj ^= Object::Allocate(kInstanceCid,
1696 Instance::InstanceSize(),
1697 HEAP_SPACE(kind));
1698 // When reading a script snapshot we need to canonicalize only those object
1699 // references that are objects from the core library (loaded from a
1700 // full snapshot). Objects that are only in the script need not be
1701 // canonicalized as they are already canonical.
1702 // When reading a message snapshot we always have to canonicalize.
1703 if (RawObject::IsCanonical(tags) &&
1704 (RawObject::IsCreatedFromSnapshot(tags) ||
1705 (kind == Snapshot::kMessage))) {
1706 obj = obj.CheckAndCanonicalize(NULL);
1707 }
1708 }
1709 reader->AddBackRef(object_id, &obj, kIsDeserialized);
1710
1711 // Set the object tags.
1712 obj.set_tags(tags);
1713
1714 return obj.raw();
1689 } 1715 }
1690 1716
1691 1717
1692 void RawInstance::WriteTo(SnapshotWriter* writer, 1718 void RawInstance::WriteTo(SnapshotWriter* writer,
1693 intptr_t object_id, 1719 intptr_t object_id,
1694 Snapshot::Kind kind) { 1720 Snapshot::Kind kind) {
1695 UNREACHABLE(); 1721 ASSERT(writer != NULL);
1722
1723 // Write out the serialization header value for this object.
1724 writer->WriteInlinedObjectHeader(object_id);
1725
1726 // Write out the class and tags information.
1727 writer->WriteIndexedObject(kInstanceCid);
1728 writer->WriteIntptrValue(writer->GetObjectTags(this));
1696 } 1729 }
1697 1730
1698 1731
1699 RawMint* Mint::ReadFrom(SnapshotReader* reader, 1732 RawMint* Mint::ReadFrom(SnapshotReader* reader,
1700 intptr_t object_id, 1733 intptr_t object_id,
1701 intptr_t tags, 1734 intptr_t tags,
1702 Snapshot::Kind kind) { 1735 Snapshot::Kind kind) {
1703 ASSERT(reader != NULL); 1736 ASSERT(reader != NULL);
1704 1737
1705 // Read the 64 bit value for the object. 1738 // Read the 64 bit value for the object.
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
2554 array ^= reader->ReadObjectRef(); 2587 array ^= reader->ReadObjectRef();
2555 result.set_code_array(array); 2588 result.set_code_array(array);
2556 array ^= reader->ReadObjectRef(); 2589 array ^= reader->ReadObjectRef();
2557 result.set_pc_offset_array(array); 2590 result.set_pc_offset_array(array);
2558 2591
2559 array ^= reader->ReadObjectRef(); 2592 array ^= reader->ReadObjectRef();
2560 result.set_catch_code_array(array); 2593 result.set_catch_code_array(array);
2561 array ^= reader->ReadObjectRef(); 2594 array ^= reader->ReadObjectRef();
2562 result.set_catch_pc_offset_array(array); 2595 result.set_catch_pc_offset_array(array);
2563 2596
2597 bool expand_inlined = reader->Read<bool>();
2598 result.set_expand_inlined(expand_inlined);
2599
2564 return result.raw(); 2600 return result.raw();
2565 } 2601 }
2566 UNREACHABLE(); // Stacktraces are not sent in a snapshot. 2602 UNREACHABLE(); // Stacktraces are not sent in a snapshot.
2567 return Stacktrace::null(); 2603 return Stacktrace::null();
2568 } 2604 }
2569 2605
2570 2606
2571 void RawStacktrace::WriteTo(SnapshotWriter* writer, 2607 void RawStacktrace::WriteTo(SnapshotWriter* writer,
2572 intptr_t object_id, 2608 intptr_t object_id,
2573 Snapshot::Kind kind) { 2609 Snapshot::Kind kind) {
2574 if (kind == Snapshot::kFull) { 2610 if (kind == Snapshot::kFull) {
2575 ASSERT(writer != NULL); 2611 ASSERT(writer != NULL);
2576 ASSERT(this == Isolate::Current()->object_store()-> 2612 ASSERT(this == Isolate::Current()->object_store()->
2577 preallocated_stack_trace()); 2613 preallocated_stack_trace());
2578 2614
2579 // Write out the serialization header value for this object. 2615 // Write out the serialization header value for this object.
2580 writer->WriteInlinedObjectHeader(object_id); 2616 writer->WriteInlinedObjectHeader(object_id);
2581 2617
2582 // Write out the class and tags information. 2618 // Write out the class and tags information.
2583 writer->WriteIndexedObject(kStacktraceCid); 2619 writer->WriteIndexedObject(kStacktraceCid);
2584 writer->WriteIntptrValue(writer->GetObjectTags(this)); 2620 writer->WriteIntptrValue(writer->GetObjectTags(this));
2585 2621
2586 // There are no non object pointer fields.
2587
2588 // Write out all the object pointer fields. 2622 // Write out all the object pointer fields.
2589 SnapshotWriterVisitor visitor(writer); 2623 SnapshotWriterVisitor visitor(writer);
2590 visitor.VisitPointers(from(), to()); 2624 visitor.VisitPointers(from(), to());
2625
2626 writer->Write(expand_inlined_);
2591 } else { 2627 } else {
2592 // Stacktraces are not allowed in other snapshot forms. 2628 // Stacktraces are not allowed in other snapshot forms.
2593 writer->SetWriteException(Exceptions::kArgument, 2629 writer->SetWriteException(Exceptions::kArgument,
2594 "Illegal argument in isolate message" 2630 "Illegal argument in isolate message"
2595 " : (object is a stacktrace)"); 2631 " : (object is a stacktrace)");
2596 } 2632 }
2597 } 2633 }
2598 2634
2599 2635
2600 RawJSRegExp* JSRegExp::ReadFrom(SnapshotReader* reader, 2636 RawJSRegExp* JSRegExp::ReadFrom(SnapshotReader* reader,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2710 // We do not allow objects with native fields in an isolate message. 2746 // We do not allow objects with native fields in an isolate message.
2711 writer->SetWriteException(Exceptions::kArgument, 2747 writer->SetWriteException(Exceptions::kArgument,
2712 "Illegal argument in isolate message" 2748 "Illegal argument in isolate message"
2713 " : (object is a MirrorReference)"); 2749 " : (object is a MirrorReference)");
2714 } else { 2750 } else {
2715 UNREACHABLE(); 2751 UNREACHABLE();
2716 } 2752 }
2717 } 2753 }
2718 2754
2719 } // namespace dart 2755 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698