| 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 #ifndef VM_SNAPSHOT_H_ | 5 #ifndef VM_SNAPSHOT_H_ |
| 6 #define VM_SNAPSHOT_H_ | 6 #define VM_SNAPSHOT_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
| 10 #include "vm/bitfield.h" | 10 #include "vm/bitfield.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 class RawScript; | 55 class RawScript; |
| 56 class RawSmi; | 56 class RawSmi; |
| 57 class RawTokenStream; | 57 class RawTokenStream; |
| 58 class RawType; | 58 class RawType; |
| 59 class RawTypeParameter; | 59 class RawTypeParameter; |
| 60 class RawTypeArguments; | 60 class RawTypeArguments; |
| 61 class RawTwoByteString; | 61 class RawTwoByteString; |
| 62 class RawUnresolvedClass; | 62 class RawUnresolvedClass; |
| 63 class String; | 63 class String; |
| 64 class TokenStream; | 64 class TokenStream; |
| 65 class UnhandledException; |
| 65 | 66 |
| 66 // Serialized object header encoding is as follows: | 67 // Serialized object header encoding is as follows: |
| 67 // - Smi: the Smi value is written as is (last bit is not tagged). | 68 // - Smi: the Smi value is written as is (last bit is not tagged). |
| 68 // - VM object (from VM isolate): (object id in vm isolate | 0x3) | 69 // - VM object (from VM isolate): (object id in vm isolate | 0x3) |
| 69 // This valus is serialized as a negative number. | 70 // This valus is serialized as a negative number. |
| 70 // (note VM objects are never serialized they are expected to be found | 71 // (note VM objects are never serialized they are expected to be found |
| 71 // using ths unique ID assigned to them). | 72 // using ths unique ID assigned to them). |
| 72 // - Reference to object that has already been written: (object id | 0x3) | 73 // - Reference to object that has already been written: (object id | 0x3) |
| 73 // This valus is serialized as a positive number. | 74 // This valus is serialized as a positive number. |
| 74 // - Object that is seen for the first time (inlined in the stream): | 75 // - Object that is seen for the first time (inlined in the stream): |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 Heap* heap() const { return isolate_->heap(); } | 214 Heap* heap() const { return isolate_->heap(); } |
| 214 ObjectStore* object_store() const { return isolate_->object_store(); } | 215 ObjectStore* object_store() const { return isolate_->object_store(); } |
| 215 ClassTable* class_table() const { return isolate_->class_table(); } | 216 ClassTable* class_table() const { return isolate_->class_table(); } |
| 216 Object* ObjectHandle() { return &obj_; } | 217 Object* ObjectHandle() { return &obj_; } |
| 217 String* StringHandle() { return &str_; } | 218 String* StringHandle() { return &str_; } |
| 218 AbstractType* TypeHandle() { return &type_; } | 219 AbstractType* TypeHandle() { return &type_; } |
| 219 AbstractTypeArguments* TypeArgumentsHandle() { return &type_arguments_; } | 220 AbstractTypeArguments* TypeArgumentsHandle() { return &type_arguments_; } |
| 220 Array* TokensHandle() { return &tokens_; } | 221 Array* TokensHandle() { return &tokens_; } |
| 221 TokenStream* StreamHandle() { return &stream_; } | 222 TokenStream* StreamHandle() { return &stream_; } |
| 222 ExternalUint8Array* DataHandle() { return &data_; } | 223 ExternalUint8Array* DataHandle() { return &data_; } |
| 224 UnhandledException* ErrorHandle() { return &error_; } |
| 223 | 225 |
| 224 // Reads an object. | 226 // Reads an object. |
| 225 RawObject* ReadObject(); | 227 RawObject* ReadObject(); |
| 226 | 228 |
| 227 // Add object to backward references. | 229 // Add object to backward references. |
| 228 void AddBackRef(intptr_t id, Object* obj, DeserializeState state); | 230 void AddBackRef(intptr_t id, Object* obj, DeserializeState state); |
| 229 | 231 |
| 230 // Get an object from the backward references list. | 232 // Get an object from the backward references list. |
| 231 Object* GetBackRef(intptr_t id); | 233 Object* GetBackRef(intptr_t id); |
| 232 | 234 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 Isolate* isolate_; // Current isolate. | 310 Isolate* isolate_; // Current isolate. |
| 309 Class& cls_; // Temporary Class handle. | 311 Class& cls_; // Temporary Class handle. |
| 310 Object& obj_; // Temporary Object handle. | 312 Object& obj_; // Temporary Object handle. |
| 311 String& str_; // Temporary String handle. | 313 String& str_; // Temporary String handle. |
| 312 Library& library_; // Temporary library handle. | 314 Library& library_; // Temporary library handle. |
| 313 AbstractType& type_; // Temporary type handle. | 315 AbstractType& type_; // Temporary type handle. |
| 314 AbstractTypeArguments& type_arguments_; // Temporary type argument handle. | 316 AbstractTypeArguments& type_arguments_; // Temporary type argument handle. |
| 315 Array& tokens_; // Temporary tokens handle. | 317 Array& tokens_; // Temporary tokens handle. |
| 316 TokenStream& stream_; // Temporary token stream handle. | 318 TokenStream& stream_; // Temporary token stream handle. |
| 317 ExternalUint8Array& data_; // Temporary stream data handle. | 319 ExternalUint8Array& data_; // Temporary stream data handle. |
| 320 UnhandledException& error_; // Error handle. |
| 318 GrowableArray<BackRefNode*> backward_references_; | 321 GrowableArray<BackRefNode*> backward_references_; |
| 319 | 322 |
| 320 friend class ApiError; | 323 friend class ApiError; |
| 321 friend class Array; | 324 friend class Array; |
| 322 friend class Class; | 325 friend class Class; |
| 323 friend class Context; | 326 friend class Context; |
| 324 friend class ContextScope; | 327 friend class ContextScope; |
| 325 friend class Field; | 328 friend class Field; |
| 326 friend class ClosureData; | 329 friend class ClosureData; |
| 327 friend class RedirectionData; | 330 friend class RedirectionData; |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 private: | 591 private: |
| 589 SnapshotWriter* writer_; | 592 SnapshotWriter* writer_; |
| 590 bool as_references_; | 593 bool as_references_; |
| 591 | 594 |
| 592 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); | 595 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); |
| 593 }; | 596 }; |
| 594 | 597 |
| 595 } // namespace dart | 598 } // namespace dart |
| 596 | 599 |
| 597 #endif // VM_SNAPSHOT_H_ | 600 #endif // VM_SNAPSHOT_H_ |
| OLD | NEW |