| 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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 // TODO(5411462): Need to assert No GC can happen here, even though | 827 // TODO(5411462): Need to assert No GC can happen here, even though |
| 828 // allocations may happen. | 828 // allocations may happen. |
| 829 *reader->StringHandle() ^= reader->ReadObjectImpl(); | 829 *reader->StringHandle() ^= reader->ReadObjectImpl(); |
| 830 script.set_url(*reader->StringHandle()); | 830 script.set_url(*reader->StringHandle()); |
| 831 *reader->StringHandle() ^= String::null(); | 831 *reader->StringHandle() ^= String::null(); |
| 832 script.set_source(*reader->StringHandle()); | 832 script.set_source(*reader->StringHandle()); |
| 833 TokenStream& stream = TokenStream::Handle(); | 833 TokenStream& stream = TokenStream::Handle(); |
| 834 stream ^= reader->ReadObjectImpl(); | 834 stream ^= reader->ReadObjectImpl(); |
| 835 script.set_tokens(stream); | 835 script.set_tokens(stream); |
| 836 | 836 |
| 837 script.raw_ptr()->line_offset_ = reader->Read<int32_t>(); |
| 838 script.raw_ptr()->col_offset_ = reader->Read<int32_t>(); |
| 839 script.raw_ptr()->kind_ = reader->Read<int8_t>(); |
| 840 |
| 837 return script.raw(); | 841 return script.raw(); |
| 838 } | 842 } |
| 839 | 843 |
| 840 | 844 |
| 841 void RawScript::WriteTo(SnapshotWriter* writer, | 845 void RawScript::WriteTo(SnapshotWriter* writer, |
| 842 intptr_t object_id, | 846 intptr_t object_id, |
| 843 Snapshot::Kind kind) { | 847 Snapshot::Kind kind) { |
| 844 ASSERT(writer != NULL); | 848 ASSERT(writer != NULL); |
| 845 ASSERT(tokens_ != TokenStream::null()); | 849 ASSERT(tokens_ != TokenStream::null()); |
| 846 ASSERT((kind != Snapshot::kMessage) && | 850 ASSERT((kind != Snapshot::kMessage) && |
| 847 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); | 851 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); |
| 848 | 852 |
| 849 // Write out the serialization header value for this object. | 853 // Write out the serialization header value for this object. |
| 850 writer->WriteInlinedObjectHeader(object_id); | 854 writer->WriteInlinedObjectHeader(object_id); |
| 851 | 855 |
| 852 // Write out the class and tags information. | 856 // Write out the class and tags information. |
| 853 writer->WriteVMIsolateObject(kScriptCid); | 857 writer->WriteVMIsolateObject(kScriptCid); |
| 854 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 858 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 855 | 859 |
| 856 // Write out all the object pointer fields. | 860 // Write out all the object pointer fields. |
| 857 writer->WriteObjectImpl(ptr()->url_); | 861 writer->WriteObjectImpl(ptr()->url_); |
| 858 writer->WriteObjectImpl(ptr()->tokens_); | 862 writer->WriteObjectImpl(ptr()->tokens_); |
| 863 |
| 864 writer->Write<int32_t>(ptr()->line_offset_); |
| 865 writer->Write<int32_t>(ptr()->col_offset_); |
| 866 writer->Write<int8_t>(ptr()->kind_); |
| 859 } | 867 } |
| 860 | 868 |
| 861 | 869 |
| 862 RawLibrary* Library::ReadFrom(SnapshotReader* reader, | 870 RawLibrary* Library::ReadFrom(SnapshotReader* reader, |
| 863 intptr_t object_id, | 871 intptr_t object_id, |
| 864 intptr_t tags, | 872 intptr_t tags, |
| 865 Snapshot::Kind kind) { | 873 Snapshot::Kind kind) { |
| 866 ASSERT(reader != NULL); | 874 ASSERT(reader != NULL); |
| 867 ASSERT(kind != Snapshot::kMessage); | 875 ASSERT(kind != Snapshot::kMessage); |
| 868 | 876 |
| (...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2232 // Write out the class and tags information. | 2240 // Write out the class and tags information. |
| 2233 writer->WriteIndexedObject(kWeakPropertyCid); | 2241 writer->WriteIndexedObject(kWeakPropertyCid); |
| 2234 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 2242 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 2235 | 2243 |
| 2236 // Write out all the other fields. | 2244 // Write out all the other fields. |
| 2237 writer->Write<RawObject*>(ptr()->key_); | 2245 writer->Write<RawObject*>(ptr()->key_); |
| 2238 writer->Write<RawObject*>(ptr()->value_); | 2246 writer->Write<RawObject*>(ptr()->value_); |
| 2239 } | 2247 } |
| 2240 | 2248 |
| 2241 } // namespace dart | 2249 } // namespace dart |
| OLD | NEW |