| 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 27 matching lines...) Expand all Loading... |
| 38 class RawCapability; | 38 class RawCapability; |
| 39 class RawClass; | 39 class RawClass; |
| 40 class RawClosureData; | 40 class RawClosureData; |
| 41 class RawContext; | 41 class RawContext; |
| 42 class RawDouble; | 42 class RawDouble; |
| 43 class RawField; | 43 class RawField; |
| 44 class RawFloat32x4; | 44 class RawFloat32x4; |
| 45 class RawFloat64x2; | 45 class RawFloat64x2; |
| 46 class RawFunction; | 46 class RawFunction; |
| 47 class RawGrowableObjectArray; | 47 class RawGrowableObjectArray; |
| 48 class RawICData; |
| 48 class RawImmutableArray; | 49 class RawImmutableArray; |
| 50 class RawInstructions; |
| 49 class RawInt32x4; | 51 class RawInt32x4; |
| 50 class RawLanguageError; | 52 class RawLanguageError; |
| 51 class RawLibrary; | 53 class RawLibrary; |
| 52 class RawLibraryPrefix; | 54 class RawLibraryPrefix; |
| 53 class RawLinkedHashMap; | 55 class RawLinkedHashMap; |
| 54 class RawLiteralToken; | 56 class RawLiteralToken; |
| 57 class RawMegamorphicCache; |
| 55 class RawMint; | 58 class RawMint; |
| 56 class RawMixinAppType; | 59 class RawMixinAppType; |
| 57 class RawBigint; | 60 class RawBigint; |
| 58 class RawNamespace; | 61 class RawNamespace; |
| 59 class RawObject; | 62 class RawObject; |
| 63 class RawObjectPool; |
| 60 class RawOneByteString; | 64 class RawOneByteString; |
| 61 class RawPatchClass; | 65 class RawPatchClass; |
| 62 class RawReceivePort; | 66 class RawReceivePort; |
| 63 class RawRedirectionData; | 67 class RawRedirectionData; |
| 64 class RawScript; | 68 class RawScript; |
| 65 class RawSendPort; | 69 class RawSendPort; |
| 66 class RawSmi; | 70 class RawSmi; |
| 67 class RawStacktrace; | 71 class RawStacktrace; |
| 72 class RawSubtypeTestCache; |
| 68 class RawTokenStream; | 73 class RawTokenStream; |
| 69 class RawTwoByteString; | 74 class RawTwoByteString; |
| 70 class RawType; | 75 class RawType; |
| 71 class RawTypeArguments; | 76 class RawTypeArguments; |
| 72 class RawTypedData; | 77 class RawTypedData; |
| 73 class RawTypeParameter; | 78 class RawTypeParameter; |
| 74 class RawTypeRef; | 79 class RawTypeRef; |
| 75 class RawUnhandledException; | 80 class RawUnhandledException; |
| 76 class RawUnresolvedClass; | 81 class RawUnresolvedClass; |
| 77 class String; | 82 class String; |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 PassiveObject* PassiveObjectHandle() { return &pobj_; } | 306 PassiveObject* PassiveObjectHandle() { return &pobj_; } |
| 302 Array* ArrayHandle() { return &array_; } | 307 Array* ArrayHandle() { return &array_; } |
| 303 String* StringHandle() { return &str_; } | 308 String* StringHandle() { return &str_; } |
| 304 AbstractType* TypeHandle() { return &type_; } | 309 AbstractType* TypeHandle() { return &type_; } |
| 305 TypeArguments* TypeArgumentsHandle() { return &type_arguments_; } | 310 TypeArguments* TypeArgumentsHandle() { return &type_arguments_; } |
| 306 Array* TokensHandle() { return &tokens_; } | 311 Array* TokensHandle() { return &tokens_; } |
| 307 TokenStream* StreamHandle() { return &stream_; } | 312 TokenStream* StreamHandle() { return &stream_; } |
| 308 ExternalTypedData* DataHandle() { return &data_; } | 313 ExternalTypedData* DataHandle() { return &data_; } |
| 309 TypedData* TypedDataHandle() { return &typed_data_; } | 314 TypedData* TypedDataHandle() { return &typed_data_; } |
| 310 Snapshot::Kind kind() const { return kind_; } | 315 Snapshot::Kind kind() const { return kind_; } |
| 311 bool allow_code() const { return false; } | 316 bool snapshot_code() const { return snapshot_code_; } |
| 312 | 317 |
| 313 // Reads an object. | 318 // Reads an object. |
| 314 RawObject* ReadObject(); | 319 RawObject* ReadObject(); |
| 315 | 320 |
| 316 // Add object to backward references. | 321 // Add object to backward references. |
| 317 void AddBackRef(intptr_t id, | 322 void AddBackRef(intptr_t id, |
| 318 Object* obj, | 323 Object* obj, |
| 319 DeserializeState state, | 324 DeserializeState state, |
| 320 bool defer_canonicalization = false); | 325 bool defer_canonicalization = false); |
| 321 | 326 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 350 RawUnresolvedClass* NewUnresolvedClass(); | 355 RawUnresolvedClass* NewUnresolvedClass(); |
| 351 RawType* NewType(); | 356 RawType* NewType(); |
| 352 RawTypeRef* NewTypeRef(); | 357 RawTypeRef* NewTypeRef(); |
| 353 RawTypeParameter* NewTypeParameter(); | 358 RawTypeParameter* NewTypeParameter(); |
| 354 RawBoundedType* NewBoundedType(); | 359 RawBoundedType* NewBoundedType(); |
| 355 RawMixinAppType* NewMixinAppType(); | 360 RawMixinAppType* NewMixinAppType(); |
| 356 RawPatchClass* NewPatchClass(); | 361 RawPatchClass* NewPatchClass(); |
| 357 RawClosureData* NewClosureData(); | 362 RawClosureData* NewClosureData(); |
| 358 RawRedirectionData* NewRedirectionData(); | 363 RawRedirectionData* NewRedirectionData(); |
| 359 RawFunction* NewFunction(); | 364 RawFunction* NewFunction(); |
| 365 RawCode* NewCode(intptr_t pointer_offsets_length); |
| 366 RawObjectPool* NewObjectPool(intptr_t length); |
| 367 RawICData* NewICData(); |
| 368 RawMegamorphicCache* NewMegamorphicCache(); |
| 369 RawSubtypeTestCache* NewSubtypeTestCache(); |
| 360 RawField* NewField(); | 370 RawField* NewField(); |
| 361 RawLibrary* NewLibrary(); | 371 RawLibrary* NewLibrary(); |
| 362 RawLibraryPrefix* NewLibraryPrefix(); | 372 RawLibraryPrefix* NewLibraryPrefix(); |
| 363 RawNamespace* NewNamespace(); | 373 RawNamespace* NewNamespace(); |
| 364 RawScript* NewScript(); | 374 RawScript* NewScript(); |
| 365 RawLiteralToken* NewLiteralToken(); | 375 RawLiteralToken* NewLiteralToken(); |
| 366 RawGrowableObjectArray* NewGrowableObjectArray(); | 376 RawGrowableObjectArray* NewGrowableObjectArray(); |
| 367 RawFloat32x4* NewFloat32x4(float v0, float v1, float v2, float v3); | 377 RawFloat32x4* NewFloat32x4(float v0, float v1, float v2, float v3); |
| 368 RawInt32x4* NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3); | 378 RawInt32x4* NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3); |
| 369 RawFloat64x2* NewFloat64x2(double v0, double v1); | 379 RawFloat64x2* NewFloat64x2(double v0, double v1); |
| 370 RawApiError* NewApiError(); | 380 RawApiError* NewApiError(); |
| 371 RawLanguageError* NewLanguageError(); | 381 RawLanguageError* NewLanguageError(); |
| 372 RawUnhandledException* NewUnhandledException(); | 382 RawUnhandledException* NewUnhandledException(); |
| 373 RawObject* NewInteger(int64_t value); | 383 RawObject* NewInteger(int64_t value); |
| 374 RawStacktrace* NewStacktrace(); | 384 RawStacktrace* NewStacktrace(); |
| 375 | 385 |
| 386 RawInstructions* GetInstructionsById(int32_t id); |
| 387 |
| 376 protected: | 388 protected: |
| 377 SnapshotReader(const uint8_t* buffer, | 389 SnapshotReader(const uint8_t* buffer, |
| 378 intptr_t size, | 390 intptr_t size, |
| 379 Snapshot::Kind kind, | 391 Snapshot::Kind kind, |
| 380 ZoneGrowableArray<BackRefNode>* backward_references, | 392 ZoneGrowableArray<BackRefNode>* backward_references, |
| 381 Isolate* isolate, | 393 Isolate* isolate, |
| 382 Zone* zone); | 394 Zone* zone); |
| 383 ~SnapshotReader() { } | 395 ~SnapshotReader() { } |
| 384 | 396 |
| 385 ZoneGrowableArray<BackRefNode>* GetBackwardReferenceTable() const { | 397 ZoneGrowableArray<BackRefNode>* GetBackwardReferenceTable() const { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 458 |
| 447 intptr_t NextAvailableObjectId() const; | 459 intptr_t NextAvailableObjectId() const; |
| 448 | 460 |
| 449 void SetReadException(const char* msg); | 461 void SetReadException(const char* msg); |
| 450 | 462 |
| 451 RawObject* VmIsolateSnapshotObject(intptr_t index) const; | 463 RawObject* VmIsolateSnapshotObject(intptr_t index) const; |
| 452 | 464 |
| 453 bool is_vm_isolate() const; | 465 bool is_vm_isolate() const; |
| 454 | 466 |
| 455 Snapshot::Kind kind_; // Indicates type of snapshot(full, script, message). | 467 Snapshot::Kind kind_; // Indicates type of snapshot(full, script, message). |
| 468 bool snapshot_code_; |
| 456 Isolate* isolate_; // Current isolate. | 469 Isolate* isolate_; // Current isolate. |
| 457 Zone* zone_; // Zone for allocations while reading snapshot. | 470 Zone* zone_; // Zone for allocations while reading snapshot. |
| 458 Heap* heap_; // Heap of the current isolate. | 471 Heap* heap_; // Heap of the current isolate. |
| 459 PageSpace* old_space_; // Old space of the current isolate. | 472 PageSpace* old_space_; // Old space of the current isolate. |
| 460 Class& cls_; // Temporary Class handle. | 473 Class& cls_; // Temporary Class handle. |
| 461 Object& obj_; // Temporary Object handle. | 474 Object& obj_; // Temporary Object handle. |
| 462 PassiveObject& pobj_; // Temporary PassiveObject handle. | 475 PassiveObject& pobj_; // Temporary PassiveObject handle. |
| 463 Array& array_; // Temporary Array handle. | 476 Array& array_; // Temporary Array handle. |
| 464 Field& field_; // Temporary Field handle. | 477 Field& field_; // Temporary Field handle. |
| 465 String& str_; // Temporary String handle. | 478 String& str_; // Temporary String handle. |
| 466 Library& library_; // Temporary library handle. | 479 Library& library_; // Temporary library handle. |
| 467 AbstractType& type_; // Temporary type handle. | 480 AbstractType& type_; // Temporary type handle. |
| 468 TypeArguments& type_arguments_; // Temporary type argument handle. | 481 TypeArguments& type_arguments_; // Temporary type argument handle. |
| 469 Array& tokens_; // Temporary tokens handle. | 482 Array& tokens_; // Temporary tokens handle. |
| 470 TokenStream& stream_; // Temporary token stream handle. | 483 TokenStream& stream_; // Temporary token stream handle. |
| 471 ExternalTypedData& data_; // Temporary stream data handle. | 484 ExternalTypedData& data_; // Temporary stream data handle. |
| 472 TypedData& typed_data_; // Temporary typed data handle. | 485 TypedData& typed_data_; // Temporary typed data handle. |
| 473 UnhandledException& error_; // Error handle. | 486 UnhandledException& error_; // Error handle. |
| 474 intptr_t max_vm_isolate_object_id_; | 487 intptr_t max_vm_isolate_object_id_; |
| 475 ZoneGrowableArray<BackRefNode>* backward_references_; | 488 ZoneGrowableArray<BackRefNode>* backward_references_; |
| 476 | 489 |
| 477 friend class ApiError; | 490 friend class ApiError; |
| 478 friend class Array; | 491 friend class Array; |
| 492 friend class Bigint; |
| 479 friend class BoundedType; | 493 friend class BoundedType; |
| 480 friend class MixinAppType; | |
| 481 friend class Class; | 494 friend class Class; |
| 495 friend class ClosureData; |
| 496 friend class Code; |
| 482 friend class Context; | 497 friend class Context; |
| 483 friend class ContextScope; | 498 friend class ContextScope; |
| 499 friend class ExceptionHandlers; |
| 484 friend class Field; | 500 friend class Field; |
| 485 friend class ClosureData; | |
| 486 friend class RedirectionData; | |
| 487 friend class Function; | 501 friend class Function; |
| 488 friend class GrowableObjectArray; | 502 friend class GrowableObjectArray; |
| 489 friend class LinkedHashMap; | 503 friend class ICData; |
| 490 friend class ImmutableArray; | 504 friend class ImmutableArray; |
| 491 friend class JSRegExp; | 505 friend class JSRegExp; |
| 492 friend class LanguageError; | 506 friend class LanguageError; |
| 493 friend class Library; | 507 friend class Library; |
| 494 friend class LibraryPrefix; | 508 friend class LibraryPrefix; |
| 509 friend class LinkedHashMap; |
| 510 friend class LiteralToken; |
| 511 friend class LocalVarDescriptors; |
| 512 friend class MegamorphicCache; |
| 513 friend class MirrorReference; |
| 514 friend class MixinAppType; |
| 495 friend class Namespace; | 515 friend class Namespace; |
| 496 friend class Bigint; | 516 friend class ObjectPool; |
| 497 friend class LiteralToken; | |
| 498 friend class PatchClass; | 517 friend class PatchClass; |
| 518 friend class RedirectionData; |
| 499 friend class Script; | 519 friend class Script; |
| 500 friend class Stacktrace; | 520 friend class Stacktrace; |
| 521 friend class SubtypeTestCache; |
| 501 friend class TokenStream; | 522 friend class TokenStream; |
| 502 friend class Type; | 523 friend class Type; |
| 503 friend class TypeArguments; | 524 friend class TypeArguments; |
| 504 friend class TypeParameter; | 525 friend class TypeParameter; |
| 505 friend class TypeRef; | 526 friend class TypeRef; |
| 527 friend class UnhandledException; |
| 506 friend class UnresolvedClass; | 528 friend class UnresolvedClass; |
| 507 friend class UnhandledException; | |
| 508 friend class WeakProperty; | 529 friend class WeakProperty; |
| 509 friend class MirrorReference; | |
| 510 friend class ExceptionHandlers; | |
| 511 friend class LocalVarDescriptors; | |
| 512 DISALLOW_COPY_AND_ASSIGN(SnapshotReader); | 530 DISALLOW_COPY_AND_ASSIGN(SnapshotReader); |
| 513 }; | 531 }; |
| 514 | 532 |
| 515 | 533 |
| 516 class VmIsolateSnapshotReader : public SnapshotReader { | 534 class VmIsolateSnapshotReader : public SnapshotReader { |
| 517 public: | 535 public: |
| 518 VmIsolateSnapshotReader(const uint8_t* buffer, intptr_t size, Zone* zone); | 536 VmIsolateSnapshotReader(const uint8_t* buffer, intptr_t size, Zone* zone); |
| 519 ~VmIsolateSnapshotReader(); | 537 ~VmIsolateSnapshotReader(); |
| 520 | 538 |
| 521 RawApiError* ReadVmIsolateSnapshot(); | 539 RawApiError* ReadVmIsolateSnapshot(); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 }; | 733 }; |
| 716 | 734 |
| 717 | 735 |
| 718 class SnapshotWriter : public BaseWriter { | 736 class SnapshotWriter : public BaseWriter { |
| 719 protected: | 737 protected: |
| 720 SnapshotWriter(Snapshot::Kind kind, | 738 SnapshotWriter(Snapshot::Kind kind, |
| 721 uint8_t** buffer, | 739 uint8_t** buffer, |
| 722 ReAlloc alloc, | 740 ReAlloc alloc, |
| 723 intptr_t initial_size, | 741 intptr_t initial_size, |
| 724 ForwardList* forward_list, | 742 ForwardList* forward_list, |
| 725 bool can_send_any_object); | 743 bool can_send_any_object, |
| 744 bool snapshot_code); |
| 726 | 745 |
| 727 public: | 746 public: |
| 728 // Snapshot kind. | 747 // Snapshot kind. |
| 729 Snapshot::Kind kind() const { return kind_; } | 748 Snapshot::Kind kind() const { return kind_; } |
| 730 bool allow_code() const { return false; } | |
| 731 | 749 |
| 732 // Serialize an object into the buffer. | 750 // Serialize an object into the buffer. |
| 733 void WriteObject(RawObject* raw); | 751 void WriteObject(RawObject* raw); |
| 734 | 752 |
| 735 uword GetObjectTags(RawObject* raw); | 753 uword GetObjectTags(RawObject* raw); |
| 736 | 754 |
| 737 Exceptions::ExceptionType exception_type() const { | 755 Exceptions::ExceptionType exception_type() const { |
| 738 return exception_type_; | 756 return exception_type_; |
| 739 } | 757 } |
| 740 void set_exception_type(Exceptions::ExceptionType type) { | 758 void set_exception_type(Exceptions::ExceptionType type) { |
| 741 exception_type_ = type; | 759 exception_type_ = type; |
| 742 } | 760 } |
| 743 const char* exception_msg() const { return exception_msg_; } | 761 const char* exception_msg() const { return exception_msg_; } |
| 744 void set_exception_msg(const char* msg) { | 762 void set_exception_msg(const char* msg) { |
| 745 exception_msg_ = msg; | 763 exception_msg_ = msg; |
| 746 } | 764 } |
| 747 bool can_send_any_object() const { return can_send_any_object_; } | 765 bool can_send_any_object() const { return can_send_any_object_; } |
| 766 bool snapshot_code() const { return snapshot_code_; } |
| 748 void ThrowException(Exceptions::ExceptionType type, const char* msg); | 767 void ThrowException(Exceptions::ExceptionType type, const char* msg); |
| 749 | 768 |
| 750 // Write a version string for the snapshot. | 769 // Write a version string for the snapshot. |
| 751 void WriteVersion(); | 770 void WriteVersion(); |
| 752 | 771 |
| 753 static intptr_t FirstObjectId(); | 772 static intptr_t FirstObjectId(); |
| 754 | 773 |
| 774 int32_t GetInstructionsId(RawInstructions* instructions) { return 0; } |
| 775 |
| 755 protected: | 776 protected: |
| 756 void UnmarkAll() { | 777 void UnmarkAll() { |
| 757 if (!unmarked_objects_ && forward_list_ != NULL) { | 778 if (!unmarked_objects_ && forward_list_ != NULL) { |
| 758 forward_list_->UnmarkAll(); | 779 forward_list_->UnmarkAll(); |
| 759 unmarked_objects_ = true; | 780 unmarked_objects_ = true; |
| 760 } | 781 } |
| 761 } | 782 } |
| 762 | 783 |
| 763 bool CheckAndWritePredefinedObject(RawObject* raw); | 784 bool CheckAndWritePredefinedObject(RawObject* raw); |
| 764 void HandleVMIsolateObject(RawObject* raw); | 785 void HandleVMIsolateObject(RawObject* raw); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 private: | 825 private: |
| 805 Snapshot::Kind kind_; | 826 Snapshot::Kind kind_; |
| 806 Isolate* isolate_; | 827 Isolate* isolate_; |
| 807 ObjectStore* object_store_; // Object store for common classes. | 828 ObjectStore* object_store_; // Object store for common classes. |
| 808 ClassTable* class_table_; // Class table for the class index to class lookup. | 829 ClassTable* class_table_; // Class table for the class index to class lookup. |
| 809 ForwardList* forward_list_; | 830 ForwardList* forward_list_; |
| 810 Exceptions::ExceptionType exception_type_; // Exception type. | 831 Exceptions::ExceptionType exception_type_; // Exception type. |
| 811 const char* exception_msg_; // Message associated with exception. | 832 const char* exception_msg_; // Message associated with exception. |
| 812 bool unmarked_objects_; // True if marked objects have been unmarked. | 833 bool unmarked_objects_; // True if marked objects have been unmarked. |
| 813 bool can_send_any_object_; // True if any Dart instance can be sent. | 834 bool can_send_any_object_; // True if any Dart instance can be sent. |
| 835 bool snapshot_code_; |
| 814 | 836 |
| 815 friend class FullSnapshotWriter; | 837 friend class FullSnapshotWriter; |
| 816 friend class RawArray; | 838 friend class RawArray; |
| 817 friend class RawClass; | 839 friend class RawClass; |
| 818 friend class RawClosureData; | 840 friend class RawClosureData; |
| 841 friend class RawExceptionHandlers; |
| 819 friend class RawGrowableObjectArray; | 842 friend class RawGrowableObjectArray; |
| 820 friend class RawLinkedHashMap; | |
| 821 friend class RawImmutableArray; | 843 friend class RawImmutableArray; |
| 844 friend class RawInstructions; |
| 822 friend class RawJSRegExp; | 845 friend class RawJSRegExp; |
| 823 friend class RawLibrary; | 846 friend class RawLibrary; |
| 847 friend class RawLinkedHashMap; |
| 824 friend class RawLiteralToken; | 848 friend class RawLiteralToken; |
| 849 friend class RawLocalVarDescriptors; |
| 825 friend class RawMirrorReference; | 850 friend class RawMirrorReference; |
| 851 friend class RawObjectPool; |
| 826 friend class RawReceivePort; | 852 friend class RawReceivePort; |
| 827 friend class RawScript; | 853 friend class RawScript; |
| 828 friend class RawStacktrace; | 854 friend class RawStacktrace; |
| 855 friend class RawSubtypeTestCache; |
| 829 friend class RawTokenStream; | 856 friend class RawTokenStream; |
| 830 friend class RawTypeArguments; | 857 friend class RawTypeArguments; |
| 831 friend class RawUserTag; | 858 friend class RawUserTag; |
| 832 friend class RawExceptionHandlers; | |
| 833 friend class RawLocalVarDescriptors; | |
| 834 friend class SnapshotWriterVisitor; | 859 friend class SnapshotWriterVisitor; |
| 835 friend class WriteInlinedObjectVisitor; | 860 friend class WriteInlinedObjectVisitor; |
| 836 DISALLOW_COPY_AND_ASSIGN(SnapshotWriter); | 861 DISALLOW_COPY_AND_ASSIGN(SnapshotWriter); |
| 837 }; | 862 }; |
| 838 | 863 |
| 839 | 864 |
| 840 class FullSnapshotWriter { | 865 class FullSnapshotWriter { |
| 841 public: | 866 public: |
| 842 static const intptr_t kInitialSize = 64 * KB; | 867 static const intptr_t kInitialSize = 64 * KB; |
| 843 FullSnapshotWriter(uint8_t** vm_isolate_snapshot_buffer, | 868 FullSnapshotWriter(uint8_t** vm_isolate_snapshot_buffer, |
| 844 uint8_t** isolate_snapshot_buffer, | 869 uint8_t** isolate_snapshot_buffer, |
| 845 ReAlloc alloc); | 870 ReAlloc alloc, |
| 871 bool snapshot_code); |
| 846 ~FullSnapshotWriter(); | 872 ~FullSnapshotWriter(); |
| 847 | 873 |
| 848 uint8_t** vm_isolate_snapshot_buffer() { | 874 uint8_t** vm_isolate_snapshot_buffer() { |
| 849 return vm_isolate_snapshot_buffer_; | 875 return vm_isolate_snapshot_buffer_; |
| 850 } | 876 } |
| 851 | 877 |
| 852 uint8_t** isolate_snapshot_buffer() { | 878 uint8_t** isolate_snapshot_buffer() { |
| 853 return isolate_snapshot_buffer_; | 879 return isolate_snapshot_buffer_; |
| 854 } | 880 } |
| 855 | 881 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 872 | 898 |
| 873 Isolate* isolate_; | 899 Isolate* isolate_; |
| 874 uint8_t** vm_isolate_snapshot_buffer_; | 900 uint8_t** vm_isolate_snapshot_buffer_; |
| 875 uint8_t** isolate_snapshot_buffer_; | 901 uint8_t** isolate_snapshot_buffer_; |
| 876 ReAlloc alloc_; | 902 ReAlloc alloc_; |
| 877 intptr_t vm_isolate_snapshot_size_; | 903 intptr_t vm_isolate_snapshot_size_; |
| 878 intptr_t isolate_snapshot_size_; | 904 intptr_t isolate_snapshot_size_; |
| 879 ForwardList* forward_list_; | 905 ForwardList* forward_list_; |
| 880 Array& scripts_; | 906 Array& scripts_; |
| 881 Array& symbol_table_; | 907 Array& symbol_table_; |
| 908 bool snapshot_code_; |
| 882 | 909 |
| 883 DISALLOW_COPY_AND_ASSIGN(FullSnapshotWriter); | 910 DISALLOW_COPY_AND_ASSIGN(FullSnapshotWriter); |
| 884 }; | 911 }; |
| 885 | 912 |
| 886 | 913 |
| 914 class PrecompiledSnapshotWriter : public FullSnapshotWriter { |
| 915 public: |
| 916 PrecompiledSnapshotWriter(uint8_t** vm_isolate_snapshot_buffer, |
| 917 uint8_t** isolate_snapshot_buffer, |
| 918 ReAlloc alloc); |
| 919 ~PrecompiledSnapshotWriter(); |
| 920 }; |
| 921 |
| 922 |
| 887 class ScriptSnapshotWriter : public SnapshotWriter { | 923 class ScriptSnapshotWriter : public SnapshotWriter { |
| 888 public: | 924 public: |
| 889 static const intptr_t kInitialSize = 64 * KB; | 925 static const intptr_t kInitialSize = 64 * KB; |
| 890 ScriptSnapshotWriter(uint8_t** buffer, ReAlloc alloc); | 926 ScriptSnapshotWriter(uint8_t** buffer, ReAlloc alloc); |
| 891 ~ScriptSnapshotWriter() { } | 927 ~ScriptSnapshotWriter() { } |
| 892 | 928 |
| 893 // Writes a partial snapshot of the script. | 929 // Writes a partial snapshot of the script. |
| 894 void WriteScriptSnapshot(const Library& lib); | 930 void WriteScriptSnapshot(const Library& lib); |
| 895 | 931 |
| 896 private: | 932 private: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 private: | 970 private: |
| 935 SnapshotWriter* writer_; | 971 SnapshotWriter* writer_; |
| 936 bool as_references_; | 972 bool as_references_; |
| 937 | 973 |
| 938 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); | 974 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); |
| 939 }; | 975 }; |
| 940 | 976 |
| 941 } // namespace dart | 977 } // namespace dart |
| 942 | 978 |
| 943 #endif // VM_SNAPSHOT_H_ | 979 #endif // VM_SNAPSHOT_H_ |
| OLD | NEW |