| 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 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 reader->isolate(), NEW_OBJECT_WITH_LEN(TokenStream, len)); | 910 reader->isolate(), NEW_OBJECT_WITH_LEN(TokenStream, len)); |
| 911 reader->AddBackRef(object_id, &token_stream, kIsDeserialized); | 911 reader->AddBackRef(object_id, &token_stream, kIsDeserialized); |
| 912 | 912 |
| 913 // Set the object tags. | 913 // Set the object tags. |
| 914 token_stream.set_tags(tags); | 914 token_stream.set_tags(tags); |
| 915 | 915 |
| 916 // Read the stream of tokens into the TokenStream object for script | 916 // Read the stream of tokens into the TokenStream object for script |
| 917 // snapshots as we made a copy of token stream. | 917 // snapshots as we made a copy of token stream. |
| 918 if (kind == Snapshot::kScript) { | 918 if (kind == Snapshot::kScript) { |
| 919 NoGCScope no_gc; | 919 NoGCScope no_gc; |
| 920 RawExternalUint8Array* stream = token_stream.GetStream(); | 920 RawExternalTypedData* stream = token_stream.GetStream(); |
| 921 reader->ReadBytes(stream->ptr()->data_, len); | 921 reader->ReadBytes(stream->ptr()->data_, len); |
| 922 } | 922 } |
| 923 | 923 |
| 924 // Read in the literal/identifier token array. | 924 // Read in the literal/identifier token array. |
| 925 *(reader->TokensHandle()) ^= reader->ReadObjectImpl(); | 925 *(reader->TokensHandle()) ^= reader->ReadObjectImpl(); |
| 926 token_stream.SetTokenObjects(*(reader->TokensHandle())); | 926 token_stream.SetTokenObjects(*(reader->TokensHandle())); |
| 927 // Read in the private key in use by the token stream. | 927 // Read in the private key in use by the token stream. |
| 928 *(reader->StringHandle()) ^= reader->ReadObjectImpl(); | 928 *(reader->StringHandle()) ^= reader->ReadObjectImpl(); |
| 929 token_stream.SetPrivateKey(*(reader->StringHandle())); | 929 token_stream.SetPrivateKey(*(reader->StringHandle())); |
| 930 | 930 |
| 931 return token_stream.raw(); | 931 return token_stream.raw(); |
| 932 } | 932 } |
| 933 | 933 |
| 934 | 934 |
| 935 void RawTokenStream::WriteTo(SnapshotWriter* writer, | 935 void RawTokenStream::WriteTo(SnapshotWriter* writer, |
| 936 intptr_t object_id, | 936 intptr_t object_id, |
| 937 Snapshot::Kind kind) { | 937 Snapshot::Kind kind) { |
| 938 ASSERT(writer != NULL); | 938 ASSERT(writer != NULL); |
| 939 ASSERT((kind != Snapshot::kMessage) && | 939 ASSERT((kind != Snapshot::kMessage) && |
| 940 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); | 940 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); |
| 941 | 941 |
| 942 // Write out the serialization header value for this object. | 942 // Write out the serialization header value for this object. |
| 943 writer->WriteInlinedObjectHeader(object_id); | 943 writer->WriteInlinedObjectHeader(object_id); |
| 944 | 944 |
| 945 // Write out the class and tags information. | 945 // Write out the class and tags information. |
| 946 writer->WriteVMIsolateObject(kTokenStreamCid); | 946 writer->WriteVMIsolateObject(kTokenStreamCid); |
| 947 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 947 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 948 | 948 |
| 949 // Write out the length field and the token stream. | 949 // Write out the length field and the token stream. |
| 950 RawExternalUint8Array* stream = ptr()->stream_; | 950 RawExternalTypedData* stream = ptr()->stream_; |
| 951 intptr_t len = Smi::Value(stream->ptr()->length_); | 951 intptr_t len = Smi::Value(stream->ptr()->length_); |
| 952 writer->Write<RawObject*>(stream->ptr()->length_); | 952 writer->Write<RawObject*>(stream->ptr()->length_); |
| 953 writer->WriteBytes(stream->ptr()->data_, len); | 953 writer->WriteBytes(stream->ptr()->data_, len); |
| 954 | 954 |
| 955 // Write out the literal/identifier token array. | 955 // Write out the literal/identifier token array. |
| 956 writer->WriteObjectImpl(ptr()->token_objects_); | 956 writer->WriteObjectImpl(ptr()->token_objects_); |
| 957 // Write out the private key in use by the token stream. | 957 // Write out the private key in use by the token stream. |
| 958 writer->WriteObjectImpl(ptr()->private_key_); | 958 writer->WriteObjectImpl(ptr()->private_key_); |
| 959 } | 959 } |
| 960 | 960 |
| (...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2838 // Write out the class and tags information. | 2838 // Write out the class and tags information. |
| 2839 writer->WriteIndexedObject(kWeakPropertyCid); | 2839 writer->WriteIndexedObject(kWeakPropertyCid); |
| 2840 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 2840 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 2841 | 2841 |
| 2842 // Write out all the other fields. | 2842 // Write out all the other fields. |
| 2843 writer->Write<RawObject*>(ptr()->key_); | 2843 writer->Write<RawObject*>(ptr()->key_); |
| 2844 writer->Write<RawObject*>(ptr()->value_); | 2844 writer->Write<RawObject*>(ptr()->value_); |
| 2845 } | 2845 } |
| 2846 | 2846 |
| 2847 } // namespace dart | 2847 } // namespace dart |
| OLD | NEW |