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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 class RawCapability; | 60 class RawCapability; |
61 class RawReceivePort; | 61 class RawReceivePort; |
62 class RawSendPort; | 62 class RawSendPort; |
63 class RawStacktrace; | 63 class RawStacktrace; |
64 class RawTokenStream; | 64 class RawTokenStream; |
65 class RawType; | 65 class RawType; |
66 class RawTypeRef; | 66 class RawTypeRef; |
67 class RawTypeParameter; | 67 class RawTypeParameter; |
68 class RawTypeArguments; | 68 class RawTypeArguments; |
69 class RawTwoByteString; | 69 class RawTwoByteString; |
| 70 class RawUnhandledException; |
70 class RawUnresolvedClass; | 71 class RawUnresolvedClass; |
71 class String; | 72 class String; |
72 class TokenStream; | 73 class TokenStream; |
73 class TypeArguments; | 74 class TypeArguments; |
74 class UnhandledException; | 75 class UnhandledException; |
75 | 76 |
76 // Serialized object header encoding is as follows: | 77 // Serialized object header encoding is as follows: |
77 // - Smi: the Smi value is written as is (last bit is not tagged). | 78 // - Smi: the Smi value is written as is (last bit is not tagged). |
78 // - VM object (from VM isolate): (object id in vm isolate | 0x3) | 79 // - VM object (from VM isolate): (object id in vm isolate | 0x3) |
79 // This valus is serialized as a negative number. | 80 // This valus is serialized as a negative number. |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 ObjectStore* object_store() const { return isolate_->object_store(); } | 242 ObjectStore* object_store() const { return isolate_->object_store(); } |
242 ClassTable* class_table() const { return isolate_->class_table(); } | 243 ClassTable* class_table() const { return isolate_->class_table(); } |
243 Object* ObjectHandle() { return &obj_; } | 244 Object* ObjectHandle() { return &obj_; } |
244 Array* ArrayHandle() { return &array_; } | 245 Array* ArrayHandle() { return &array_; } |
245 String* StringHandle() { return &str_; } | 246 String* StringHandle() { return &str_; } |
246 AbstractType* TypeHandle() { return &type_; } | 247 AbstractType* TypeHandle() { return &type_; } |
247 TypeArguments* TypeArgumentsHandle() { return &type_arguments_; } | 248 TypeArguments* TypeArgumentsHandle() { return &type_arguments_; } |
248 Array* TokensHandle() { return &tokens_; } | 249 Array* TokensHandle() { return &tokens_; } |
249 TokenStream* StreamHandle() { return &stream_; } | 250 TokenStream* StreamHandle() { return &stream_; } |
250 ExternalTypedData* DataHandle() { return &data_; } | 251 ExternalTypedData* DataHandle() { return &data_; } |
251 UnhandledException* ErrorHandle() { return &error_; } | |
252 | 252 |
253 // Reads an object. | 253 // Reads an object. |
254 RawObject* ReadObject(); | 254 RawObject* ReadObject(); |
255 | 255 |
256 // Add object to backward references. | 256 // Add object to backward references. |
257 void AddBackRef(intptr_t id, Object* obj, DeserializeState state); | 257 void AddBackRef(intptr_t id, Object* obj, DeserializeState state); |
258 | 258 |
259 // Get an object from the backward references list. | 259 // Get an object from the backward references list. |
260 Object* GetBackRef(intptr_t id); | 260 Object* GetBackRef(intptr_t id); |
261 | 261 |
(...skipping 30 matching lines...) Expand all Loading... |
292 RawLibraryPrefix* NewLibraryPrefix(); | 292 RawLibraryPrefix* NewLibraryPrefix(); |
293 RawNamespace* NewNamespace(); | 293 RawNamespace* NewNamespace(); |
294 RawScript* NewScript(); | 294 RawScript* NewScript(); |
295 RawLiteralToken* NewLiteralToken(); | 295 RawLiteralToken* NewLiteralToken(); |
296 RawGrowableObjectArray* NewGrowableObjectArray(); | 296 RawGrowableObjectArray* NewGrowableObjectArray(); |
297 RawFloat32x4* NewFloat32x4(float v0, float v1, float v2, float v3); | 297 RawFloat32x4* NewFloat32x4(float v0, float v1, float v2, float v3); |
298 RawInt32x4* NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3); | 298 RawInt32x4* NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3); |
299 RawFloat64x2* NewFloat64x2(double v0, double v1); | 299 RawFloat64x2* NewFloat64x2(double v0, double v1); |
300 RawApiError* NewApiError(); | 300 RawApiError* NewApiError(); |
301 RawLanguageError* NewLanguageError(); | 301 RawLanguageError* NewLanguageError(); |
| 302 RawUnhandledException* NewUnhandledException(); |
302 RawObject* NewInteger(int64_t value); | 303 RawObject* NewInteger(int64_t value); |
303 RawStacktrace* NewStacktrace(); | 304 RawStacktrace* NewStacktrace(); |
304 | 305 |
305 private: | 306 private: |
306 class BackRefNode : public ValueObject { | 307 class BackRefNode : public ValueObject { |
307 public: | 308 public: |
308 BackRefNode(Object* reference, DeserializeState state) | 309 BackRefNode(Object* reference, DeserializeState state) |
309 : reference_(reference), state_(state) {} | 310 : reference_(reference), state_(state) {} |
310 Object* reference() const { return reference_; } | 311 Object* reference() const { return reference_; } |
311 bool is_deserialized() const { return state_ == kIsDeserialized; } | 312 bool is_deserialized() const { return state_ == kIsDeserialized; } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 friend class LiteralToken; | 383 friend class LiteralToken; |
383 friend class PatchClass; | 384 friend class PatchClass; |
384 friend class Script; | 385 friend class Script; |
385 friend class Stacktrace; | 386 friend class Stacktrace; |
386 friend class TokenStream; | 387 friend class TokenStream; |
387 friend class Type; | 388 friend class Type; |
388 friend class TypeArguments; | 389 friend class TypeArguments; |
389 friend class TypeParameter; | 390 friend class TypeParameter; |
390 friend class TypeRef; | 391 friend class TypeRef; |
391 friend class UnresolvedClass; | 392 friend class UnresolvedClass; |
| 393 friend class UnhandledException; |
392 friend class WeakProperty; | 394 friend class WeakProperty; |
393 friend class MirrorReference; | 395 friend class MirrorReference; |
394 DISALLOW_COPY_AND_ASSIGN(SnapshotReader); | 396 DISALLOW_COPY_AND_ASSIGN(SnapshotReader); |
395 }; | 397 }; |
396 | 398 |
397 | 399 |
398 class BaseWriter { | 400 class BaseWriter { |
399 public: | 401 public: |
400 // Size of the snapshot. | 402 // Size of the snapshot. |
401 intptr_t BytesWritten() const { return stream_.bytes_written(); } | 403 intptr_t BytesWritten() const { return stream_.bytes_written(); } |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 private: | 700 private: |
699 SnapshotWriter* writer_; | 701 SnapshotWriter* writer_; |
700 bool as_references_; | 702 bool as_references_; |
701 | 703 |
702 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); | 704 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); |
703 }; | 705 }; |
704 | 706 |
705 } // namespace dart | 707 } // namespace dart |
706 | 708 |
707 #endif // VM_SNAPSHOT_H_ | 709 #endif // VM_SNAPSHOT_H_ |
OLD | NEW |