OLD | NEW |
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/stub_code.h" | 9 #include "vm/stub_code.h" |
10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
(...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1552 // Write out all the object pointer fields. | 1552 // Write out all the object pointer fields. |
1553 SnapshotWriterVisitor visitor(writer); | 1553 SnapshotWriterVisitor visitor(writer); |
1554 visitor.VisitPointers(from(), to()); | 1554 visitor.VisitPointers(from(), to()); |
1555 } | 1555 } |
1556 | 1556 |
1557 | 1557 |
1558 RawUnhandledException* UnhandledException::ReadFrom(SnapshotReader* reader, | 1558 RawUnhandledException* UnhandledException::ReadFrom(SnapshotReader* reader, |
1559 intptr_t object_id, | 1559 intptr_t object_id, |
1560 intptr_t tags, | 1560 intptr_t tags, |
1561 Snapshot::Kind kind) { | 1561 Snapshot::Kind kind) { |
1562 UNREACHABLE(); | 1562 UnhandledException& result = UnhandledException::ZoneHandle( |
1563 return UnhandledException::null(); | 1563 reader->isolate(), NEW_OBJECT(UnhandledException)); |
| 1564 reader->AddBackRef(object_id, &result, kIsDeserialized); |
| 1565 |
| 1566 // Set the object tags. |
| 1567 result.set_tags(tags); |
| 1568 |
| 1569 // Set all the object fields. |
| 1570 // TODO(5411462): Need to assert No GC can happen here, even though |
| 1571 // allocations may happen. |
| 1572 intptr_t num_flds = (result.raw()->to() - result.raw()->from()); |
| 1573 for (intptr_t i = 0; i <= num_flds; i++) { |
| 1574 *(result.raw()->from() + i) = reader->ReadObjectRef(); |
| 1575 } |
| 1576 return result.raw(); |
1564 } | 1577 } |
1565 | 1578 |
1566 | 1579 |
1567 void RawUnhandledException::WriteTo(SnapshotWriter* writer, | 1580 void RawUnhandledException::WriteTo(SnapshotWriter* writer, |
1568 intptr_t object_id, | 1581 intptr_t object_id, |
1569 Snapshot::Kind kind) { | 1582 Snapshot::Kind kind) { |
1570 UNREACHABLE(); | 1583 // Write out the serialization header value for this object. |
| 1584 writer->WriteInlinedObjectHeader(object_id); |
| 1585 |
| 1586 // Write out the class and tags information. |
| 1587 writer->WriteVMIsolateObject(kUnhandledExceptionCid); |
| 1588 writer->WriteTags(writer->GetObjectTags(this)); |
| 1589 // Write out all the object pointer fields. |
| 1590 SnapshotWriterVisitor visitor(writer); |
| 1591 visitor.VisitPointers(from(), to()); |
1571 } | 1592 } |
1572 | 1593 |
1573 | 1594 |
1574 RawUnwindError* UnwindError::ReadFrom(SnapshotReader* reader, | 1595 RawUnwindError* UnwindError::ReadFrom(SnapshotReader* reader, |
1575 intptr_t object_id, | 1596 intptr_t object_id, |
1576 intptr_t tags, | 1597 intptr_t tags, |
1577 Snapshot::Kind kind) { | 1598 Snapshot::Kind kind) { |
1578 UNREACHABLE(); | 1599 UNREACHABLE(); |
1579 return UnwindError::null(); | 1600 return UnwindError::null(); |
1580 } | 1601 } |
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2799 // We do not allow objects with native fields in an isolate message. | 2820 // We do not allow objects with native fields in an isolate message. |
2800 writer->SetWriteException(Exceptions::kArgument, | 2821 writer->SetWriteException(Exceptions::kArgument, |
2801 "Illegal argument in isolate message" | 2822 "Illegal argument in isolate message" |
2802 " : (object is a UserTag)"); | 2823 " : (object is a UserTag)"); |
2803 } else { | 2824 } else { |
2804 UNREACHABLE(); | 2825 UNREACHABLE(); |
2805 } | 2826 } |
2806 } | 2827 } |
2807 | 2828 |
2808 } // namespace dart | 2829 } // namespace dart |
OLD | NEW |