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/symbols.h" | 9 #include "vm/symbols.h" |
10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 ASSERT(reader != NULL); | 1556 ASSERT(reader != NULL); |
1557 | 1557 |
1558 // Allocate LanguageError object. | 1558 // Allocate LanguageError object. |
1559 LanguageError& language_error = | 1559 LanguageError& language_error = |
1560 LanguageError::ZoneHandle(reader->isolate(), NEW_OBJECT(LanguageError)); | 1560 LanguageError::ZoneHandle(reader->isolate(), NEW_OBJECT(LanguageError)); |
1561 reader->AddBackRef(object_id, &language_error, kIsDeserialized); | 1561 reader->AddBackRef(object_id, &language_error, kIsDeserialized); |
1562 | 1562 |
1563 // Set the object tags. | 1563 // Set the object tags. |
1564 language_error.set_tags(tags); | 1564 language_error.set_tags(tags); |
1565 | 1565 |
| 1566 // Set all non object fields. |
| 1567 language_error.set_token_pos(reader->ReadIntptrValue()); |
| 1568 language_error.set_kind(reader->Read<uint8_t>()); |
| 1569 |
1566 // Set all the object fields. | 1570 // Set all the object fields. |
1567 // TODO(5411462): Need to assert No GC can happen here, even though | 1571 // TODO(5411462): Need to assert No GC can happen here, even though |
1568 // allocations may happen. | 1572 // allocations may happen. |
1569 intptr_t num_flds = | 1573 intptr_t num_flds = |
1570 (language_error.raw()->to() - language_error.raw()->from()); | 1574 (language_error.raw()->to() - language_error.raw()->from()); |
1571 for (intptr_t i = 0; i <= num_flds; i++) { | 1575 for (intptr_t i = 0; i <= num_flds; i++) { |
1572 (*reader->ObjectHandle()) = reader->ReadObjectRef(); | 1576 (*reader->ObjectHandle()) = reader->ReadObjectRef(); |
1573 language_error.StorePointer((language_error.raw()->from() + i), | 1577 language_error.StorePointer((language_error.raw()->from() + i), |
1574 reader->ObjectHandle()->raw()); | 1578 reader->ObjectHandle()->raw()); |
1575 } | 1579 } |
1576 | 1580 |
1577 return language_error.raw(); | 1581 return language_error.raw(); |
1578 } | 1582 } |
1579 | 1583 |
1580 | 1584 |
1581 void RawLanguageError::WriteTo(SnapshotWriter* writer, | 1585 void RawLanguageError::WriteTo(SnapshotWriter* writer, |
1582 intptr_t object_id, | 1586 intptr_t object_id, |
1583 Snapshot::Kind kind) { | 1587 Snapshot::Kind kind) { |
1584 ASSERT(writer != NULL); | 1588 ASSERT(writer != NULL); |
1585 | 1589 |
1586 // Write out the serialization header value for this object. | 1590 // Write out the serialization header value for this object. |
1587 writer->WriteInlinedObjectHeader(object_id); | 1591 writer->WriteInlinedObjectHeader(object_id); |
1588 | 1592 |
1589 // Write out the class and tags information. | 1593 // Write out the class and tags information. |
1590 writer->WriteVMIsolateObject(kLanguageErrorCid); | 1594 writer->WriteVMIsolateObject(kLanguageErrorCid); |
1591 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 1595 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
1592 | 1596 |
| 1597 // Write out all the non object fields. |
| 1598 writer->WriteIntptrValue(ptr()->token_pos_); |
| 1599 writer->Write<uint8_t>(ptr()->kind_); |
| 1600 |
1593 // Write out all the object pointer fields. | 1601 // Write out all the object pointer fields. |
1594 SnapshotWriterVisitor visitor(writer); | 1602 SnapshotWriterVisitor visitor(writer); |
1595 visitor.VisitPointers(from(), to()); | 1603 visitor.VisitPointers(from(), to()); |
1596 } | 1604 } |
1597 | 1605 |
1598 | 1606 |
1599 RawUnhandledException* UnhandledException::ReadFrom(SnapshotReader* reader, | 1607 RawUnhandledException* UnhandledException::ReadFrom(SnapshotReader* reader, |
1600 intptr_t object_id, | 1608 intptr_t object_id, |
1601 intptr_t tags, | 1609 intptr_t tags, |
1602 Snapshot::Kind kind) { | 1610 Snapshot::Kind kind) { |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2658 // We do not allow objects with native fields in an isolate message. | 2666 // We do not allow objects with native fields in an isolate message. |
2659 writer->SetWriteException(Exceptions::kArgument, | 2667 writer->SetWriteException(Exceptions::kArgument, |
2660 "Illegal argument in isolate message" | 2668 "Illegal argument in isolate message" |
2661 " : (object is a MirrorReference)"); | 2669 " : (object is a MirrorReference)"); |
2662 } else { | 2670 } else { |
2663 UNREACHABLE(); | 2671 UNREACHABLE(); |
2664 } | 2672 } |
2665 } | 2673 } |
2666 | 2674 |
2667 } // namespace dart | 2675 } // namespace dart |
OLD | NEW |