Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: runtime/vm/snapshot.h

Issue 1318803002: Toward precompiled snapshots. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: READ_POINTERS Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 22 matching lines...) Expand all
33 class PageSpace; 33 class PageSpace;
34 class RawApiError; 34 class RawApiError;
35 class RawArray; 35 class RawArray;
36 class RawBigint; 36 class RawBigint;
37 class RawBoundedType; 37 class RawBoundedType;
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 RawExceptionHandlers;
43 class RawField; 44 class RawField;
44 class RawFloat32x4; 45 class RawFloat32x4;
45 class RawFloat64x2; 46 class RawFloat64x2;
46 class RawFunction; 47 class RawFunction;
47 class RawGrowableObjectArray; 48 class RawGrowableObjectArray;
48 class RawICData; 49 class RawICData;
49 class RawImmutableArray; 50 class RawImmutableArray;
50 class RawInstructions; 51 class RawInstructions;
51 class RawInt32x4; 52 class RawInt32x4;
52 class RawLanguageError; 53 class RawLanguageError;
53 class RawLibrary; 54 class RawLibrary;
54 class RawLibraryPrefix; 55 class RawLibraryPrefix;
55 class RawLinkedHashMap; 56 class RawLinkedHashMap;
56 class RawLiteralToken; 57 class RawLiteralToken;
58 class RawLocalVarDescriptors;
57 class RawMegamorphicCache; 59 class RawMegamorphicCache;
58 class RawMint; 60 class RawMint;
59 class RawMixinAppType; 61 class RawMixinAppType;
60 class RawBigint; 62 class RawBigint;
61 class RawNamespace; 63 class RawNamespace;
62 class RawObject; 64 class RawObject;
63 class RawObjectPool; 65 class RawObjectPool;
64 class RawOneByteString; 66 class RawOneByteString;
65 class RawPatchClass; 67 class RawPatchClass;
68 class RawPcDescriptors;
66 class RawReceivePort; 69 class RawReceivePort;
67 class RawRedirectionData; 70 class RawRedirectionData;
68 class RawScript; 71 class RawScript;
69 class RawSendPort; 72 class RawSendPort;
70 class RawSmi; 73 class RawSmi;
74 class RawStackmap;
71 class RawStacktrace; 75 class RawStacktrace;
72 class RawSubtypeTestCache; 76 class RawSubtypeTestCache;
73 class RawTokenStream; 77 class RawTokenStream;
74 class RawTwoByteString; 78 class RawTwoByteString;
75 class RawType; 79 class RawType;
76 class RawTypeArguments; 80 class RawTypeArguments;
77 class RawTypedData; 81 class RawTypedData;
78 class RawTypeParameter; 82 class RawTypeParameter;
79 class RawTypeRef; 83 class RawTypeRef;
80 class RawUnhandledException; 84 class RawUnhandledException;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 292 }
289 293
290 private: 294 private:
291 Object* reference_; 295 Object* reference_;
292 DeserializeState state_; 296 DeserializeState state_;
293 bool defer_canonicalization_; 297 bool defer_canonicalization_;
294 ZoneGrowableArray<intptr_t>* patch_records_; 298 ZoneGrowableArray<intptr_t>* patch_records_;
295 }; 299 };
296 300
297 301
302 class InstructionsReader : public ZoneAllocated {
303 public:
304 explicit InstructionsReader(const uint8_t* buffer)
305 : buffer_(buffer) {
306 ASSERT(buffer != NULL);
307 ASSERT(Utils::IsAligned(reinterpret_cast<uword>(buffer),
308 OS::PreferredCodeAlignment()));
309 }
310
311 RawInstructions* GetInstructionsAt(int32_t offset, uword expected_tags);
312
313 private:
314 const uint8_t* buffer_;
315
316 DISALLOW_COPY_AND_ASSIGN(InstructionsReader);
317 };
318
319
298 // Reads a snapshot into objects. 320 // Reads a snapshot into objects.
299 class SnapshotReader : public BaseReader { 321 class SnapshotReader : public BaseReader {
300 public: 322 public:
301 Zone* zone() const { return zone_; } 323 Zone* zone() const { return zone_; }
302 Isolate* isolate() const { return isolate_; } 324 Isolate* isolate() const { return isolate_; }
303 Heap* heap() const { return heap_; } 325 Heap* heap() const { return heap_; }
304 ObjectStore* object_store() const { return isolate_->object_store(); } 326 ObjectStore* object_store() const { return isolate_->object_store(); }
305 ClassTable* class_table() const { return isolate_->class_table(); } 327 ClassTable* class_table() const { return isolate_->class_table(); }
306 PassiveObject* PassiveObjectHandle() { return &pobj_; } 328 PassiveObject* PassiveObjectHandle() { return &pobj_; }
307 Array* ArrayHandle() { return &array_; } 329 Array* ArrayHandle() { return &array_; }
308 String* StringHandle() { return &str_; } 330 String* StringHandle() { return &str_; }
309 AbstractType* TypeHandle() { return &type_; } 331 AbstractType* TypeHandle() { return &type_; }
310 TypeArguments* TypeArgumentsHandle() { return &type_arguments_; } 332 TypeArguments* TypeArgumentsHandle() { return &type_arguments_; }
311 Array* TokensHandle() { return &tokens_; } 333 Array* TokensHandle() { return &tokens_; }
312 TokenStream* StreamHandle() { return &stream_; } 334 TokenStream* StreamHandle() { return &stream_; }
313 ExternalTypedData* DataHandle() { return &data_; } 335 ExternalTypedData* DataHandle() { return &data_; }
314 TypedData* TypedDataHandle() { return &typed_data_; } 336 TypedData* TypedDataHandle() { return &typed_data_; }
337 Code* CodeHandle() { return &code_; }
315 Snapshot::Kind kind() const { return kind_; } 338 Snapshot::Kind kind() const { return kind_; }
316 bool snapshot_code() const { return snapshot_code_; } 339 bool snapshot_code() const { return snapshot_code_; }
317 340
318 // Reads an object. 341 // Reads an object.
319 RawObject* ReadObject(); 342 RawObject* ReadObject();
320 343
321 // Add object to backward references. 344 // Add object to backward references.
322 void AddBackRef(intptr_t id, 345 void AddBackRef(intptr_t id,
323 Object* obj, 346 Object* obj,
324 DeserializeState state, 347 DeserializeState state,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 RawTypeRef* NewTypeRef(); 380 RawTypeRef* NewTypeRef();
358 RawTypeParameter* NewTypeParameter(); 381 RawTypeParameter* NewTypeParameter();
359 RawBoundedType* NewBoundedType(); 382 RawBoundedType* NewBoundedType();
360 RawMixinAppType* NewMixinAppType(); 383 RawMixinAppType* NewMixinAppType();
361 RawPatchClass* NewPatchClass(); 384 RawPatchClass* NewPatchClass();
362 RawClosureData* NewClosureData(); 385 RawClosureData* NewClosureData();
363 RawRedirectionData* NewRedirectionData(); 386 RawRedirectionData* NewRedirectionData();
364 RawFunction* NewFunction(); 387 RawFunction* NewFunction();
365 RawCode* NewCode(intptr_t pointer_offsets_length); 388 RawCode* NewCode(intptr_t pointer_offsets_length);
366 RawObjectPool* NewObjectPool(intptr_t length); 389 RawObjectPool* NewObjectPool(intptr_t length);
390 RawPcDescriptors* NewPcDescriptors(intptr_t length);
391 RawLocalVarDescriptors* NewLocalVarDescriptors(intptr_t num_entries);
392 RawExceptionHandlers* NewExceptionHandlers(intptr_t num_entries);
393 RawStackmap* NewStackmap(intptr_t length);
367 RawICData* NewICData(); 394 RawICData* NewICData();
368 RawMegamorphicCache* NewMegamorphicCache(); 395 RawMegamorphicCache* NewMegamorphicCache();
369 RawSubtypeTestCache* NewSubtypeTestCache(); 396 RawSubtypeTestCache* NewSubtypeTestCache();
397 RawLinkedHashMap* NewLinkedHashMap();
370 RawField* NewField(); 398 RawField* NewField();
371 RawLibrary* NewLibrary(); 399 RawLibrary* NewLibrary();
372 RawLibraryPrefix* NewLibraryPrefix(); 400 RawLibraryPrefix* NewLibraryPrefix();
373 RawNamespace* NewNamespace(); 401 RawNamespace* NewNamespace();
374 RawScript* NewScript(); 402 RawScript* NewScript();
375 RawLiteralToken* NewLiteralToken(); 403 RawLiteralToken* NewLiteralToken();
376 RawGrowableObjectArray* NewGrowableObjectArray(); 404 RawGrowableObjectArray* NewGrowableObjectArray();
377 RawFloat32x4* NewFloat32x4(float v0, float v1, float v2, float v3); 405 RawFloat32x4* NewFloat32x4(float v0, float v1, float v2, float v3);
378 RawInt32x4* NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3); 406 RawInt32x4* NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3);
379 RawFloat64x2* NewFloat64x2(double v0, double v1); 407 RawFloat64x2* NewFloat64x2(double v0, double v1);
380 RawApiError* NewApiError(); 408 RawApiError* NewApiError();
381 RawLanguageError* NewLanguageError(); 409 RawLanguageError* NewLanguageError();
382 RawUnhandledException* NewUnhandledException(); 410 RawUnhandledException* NewUnhandledException();
383 RawObject* NewInteger(int64_t value); 411 RawObject* NewInteger(int64_t value);
384 RawStacktrace* NewStacktrace(); 412 RawStacktrace* NewStacktrace();
385 413
386 RawInstructions* GetInstructionsById(int32_t id); 414 RawInstructions* GetInstructionsAt(int32_t offset, uword expected_tags) {
415 return instructions_reader_->GetInstructionsAt(offset, expected_tags);
416 }
417
418 const uint8_t* instructions_buffer_;
387 419
388 protected: 420 protected:
389 SnapshotReader(const uint8_t* buffer, 421 SnapshotReader(const uint8_t* buffer,
390 intptr_t size, 422 intptr_t size,
423 const uint8_t* instructions_buffer,
391 Snapshot::Kind kind, 424 Snapshot::Kind kind,
392 ZoneGrowableArray<BackRefNode>* backward_references, 425 ZoneGrowableArray<BackRefNode>* backward_references,
393 Isolate* isolate, 426 Isolate* isolate,
394 Zone* zone); 427 Zone* zone);
395 ~SnapshotReader() { } 428 ~SnapshotReader() { }
396 429
397 ZoneGrowableArray<BackRefNode>* GetBackwardReferenceTable() const { 430 ZoneGrowableArray<BackRefNode>* GetBackwardReferenceTable() const {
398 return backward_references_; 431 return backward_references_;
399 } 432 }
400 void ResetBackwardReferenceTable() { backward_references_ = NULL; } 433 void ResetBackwardReferenceTable() { backward_references_ = NULL; }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 Array& array_; // Temporary Array handle. 509 Array& array_; // Temporary Array handle.
477 Field& field_; // Temporary Field handle. 510 Field& field_; // Temporary Field handle.
478 String& str_; // Temporary String handle. 511 String& str_; // Temporary String handle.
479 Library& library_; // Temporary library handle. 512 Library& library_; // Temporary library handle.
480 AbstractType& type_; // Temporary type handle. 513 AbstractType& type_; // Temporary type handle.
481 TypeArguments& type_arguments_; // Temporary type argument handle. 514 TypeArguments& type_arguments_; // Temporary type argument handle.
482 Array& tokens_; // Temporary tokens handle. 515 Array& tokens_; // Temporary tokens handle.
483 TokenStream& stream_; // Temporary token stream handle. 516 TokenStream& stream_; // Temporary token stream handle.
484 ExternalTypedData& data_; // Temporary stream data handle. 517 ExternalTypedData& data_; // Temporary stream data handle.
485 TypedData& typed_data_; // Temporary typed data handle. 518 TypedData& typed_data_; // Temporary typed data handle.
519 Code& code_; // Temporary code handle.
486 UnhandledException& error_; // Error handle. 520 UnhandledException& error_; // Error handle.
487 intptr_t max_vm_isolate_object_id_; 521 intptr_t max_vm_isolate_object_id_;
488 ZoneGrowableArray<BackRefNode>* backward_references_; 522 ZoneGrowableArray<BackRefNode>* backward_references_;
523 InstructionsReader* instructions_reader_;
489 524
490 friend class ApiError; 525 friend class ApiError;
491 friend class Array; 526 friend class Array;
492 friend class Bigint; 527 friend class Bigint;
493 friend class BoundedType; 528 friend class BoundedType;
494 friend class Class; 529 friend class Class;
495 friend class ClosureData; 530 friend class ClosureData;
496 friend class Code; 531 friend class Code;
497 friend class Context; 532 friend class Context;
498 friend class ContextScope; 533 friend class ContextScope;
499 friend class ExceptionHandlers; 534 friend class ExceptionHandlers;
500 friend class Field; 535 friend class Field;
501 friend class Function; 536 friend class Function;
502 friend class GrowableObjectArray; 537 friend class GrowableObjectArray;
503 friend class ICData; 538 friend class ICData;
504 friend class ImmutableArray; 539 friend class ImmutableArray;
540 friend class Instructions;
505 friend class JSRegExp; 541 friend class JSRegExp;
506 friend class LanguageError; 542 friend class LanguageError;
507 friend class Library; 543 friend class Library;
508 friend class LibraryPrefix; 544 friend class LibraryPrefix;
509 friend class LinkedHashMap; 545 friend class LinkedHashMap;
510 friend class LiteralToken; 546 friend class LiteralToken;
511 friend class LocalVarDescriptors; 547 friend class LocalVarDescriptors;
512 friend class MegamorphicCache; 548 friend class MegamorphicCache;
513 friend class MirrorReference; 549 friend class MirrorReference;
514 friend class MixinAppType; 550 friend class MixinAppType;
(...skipping 11 matching lines...) Expand all
526 friend class TypeRef; 562 friend class TypeRef;
527 friend class UnhandledException; 563 friend class UnhandledException;
528 friend class UnresolvedClass; 564 friend class UnresolvedClass;
529 friend class WeakProperty; 565 friend class WeakProperty;
530 DISALLOW_COPY_AND_ASSIGN(SnapshotReader); 566 DISALLOW_COPY_AND_ASSIGN(SnapshotReader);
531 }; 567 };
532 568
533 569
534 class VmIsolateSnapshotReader : public SnapshotReader { 570 class VmIsolateSnapshotReader : public SnapshotReader {
535 public: 571 public:
536 VmIsolateSnapshotReader(const uint8_t* buffer, intptr_t size, Zone* zone); 572 VmIsolateSnapshotReader(const uint8_t* buffer,
573 intptr_t size,
574 const uint8_t* instructions_buffer,
575 Zone* zone);
537 ~VmIsolateSnapshotReader(); 576 ~VmIsolateSnapshotReader();
538 577
539 RawApiError* ReadVmIsolateSnapshot(); 578 RawApiError* ReadVmIsolateSnapshot();
540 579
541 private: 580 private:
542 DISALLOW_COPY_AND_ASSIGN(VmIsolateSnapshotReader); 581 DISALLOW_COPY_AND_ASSIGN(VmIsolateSnapshotReader);
543 }; 582 };
544 583
545 584
546 class IsolateSnapshotReader : public SnapshotReader { 585 class IsolateSnapshotReader : public SnapshotReader {
547 public: 586 public:
548 IsolateSnapshotReader(const uint8_t* buffer, 587 IsolateSnapshotReader(const uint8_t* buffer,
549 intptr_t size, 588 intptr_t size,
589 const uint8_t* instructions_buffer,
550 Isolate* isolate, 590 Isolate* isolate,
551 Zone* zone); 591 Zone* zone);
552 ~IsolateSnapshotReader(); 592 ~IsolateSnapshotReader();
553 593
554 private: 594 private:
555 DISALLOW_COPY_AND_ASSIGN(IsolateSnapshotReader); 595 DISALLOW_COPY_AND_ASSIGN(IsolateSnapshotReader);
556 }; 596 };
557 597
558 598
559 class ScriptSnapshotReader : public SnapshotReader { 599 class ScriptSnapshotReader : public SnapshotReader {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 766
727 const intptr_t first_object_id_; 767 const intptr_t first_object_id_;
728 GrowableArray<Node*> nodes_; 768 GrowableArray<Node*> nodes_;
729 intptr_t first_unprocessed_object_id_; 769 intptr_t first_unprocessed_object_id_;
730 770
731 friend class FullSnapshotWriter; 771 friend class FullSnapshotWriter;
732 DISALLOW_COPY_AND_ASSIGN(ForwardList); 772 DISALLOW_COPY_AND_ASSIGN(ForwardList);
733 }; 773 };
734 774
735 775
776 class InstructionsWriter : public ZoneAllocated {
777 public:
778 InstructionsWriter(uint8_t** buffer,
779 ReAlloc alloc,
780 intptr_t initial_size)
781 : stream_(buffer, alloc, initial_size) {
782 ASSERT(buffer != NULL);
783 ASSERT(alloc != NULL);
784 }
785
786 // Size of the snapshot.
787 intptr_t BytesWritten() const { return stream_.bytes_written(); }
788
789 int32_t GetOffsetFor(RawInstructions* instructions);
790
791 private:
792 WriteStream stream_;
793
794 DISALLOW_COPY_AND_ASSIGN(InstructionsWriter);
795 };
796
797
736 class SnapshotWriter : public BaseWriter { 798 class SnapshotWriter : public BaseWriter {
737 protected: 799 protected:
738 SnapshotWriter(Snapshot::Kind kind, 800 SnapshotWriter(Snapshot::Kind kind,
739 uint8_t** buffer, 801 uint8_t** buffer,
740 ReAlloc alloc, 802 ReAlloc alloc,
741 intptr_t initial_size, 803 intptr_t initial_size,
742 ForwardList* forward_list, 804 ForwardList* forward_list,
805 InstructionsWriter* instructions_writer,
743 bool can_send_any_object, 806 bool can_send_any_object,
744 bool snapshot_code); 807 bool snapshot_code,
808 bool vm_isolate_is_symbolic);
745 809
746 public: 810 public:
747 // Snapshot kind. 811 // Snapshot kind.
748 Snapshot::Kind kind() const { return kind_; } 812 Snapshot::Kind kind() const { return kind_; }
749 813
750 // Serialize an object into the buffer. 814 // Serialize an object into the buffer.
751 void WriteObject(RawObject* raw); 815 void WriteObject(RawObject* raw);
752 816
753 uword GetObjectTags(RawObject* raw); 817 uword GetObjectTags(RawObject* raw);
754 818
755 Exceptions::ExceptionType exception_type() const { 819 Exceptions::ExceptionType exception_type() const {
756 return exception_type_; 820 return exception_type_;
757 } 821 }
758 void set_exception_type(Exceptions::ExceptionType type) { 822 void set_exception_type(Exceptions::ExceptionType type) {
759 exception_type_ = type; 823 exception_type_ = type;
760 } 824 }
761 const char* exception_msg() const { return exception_msg_; } 825 const char* exception_msg() const { return exception_msg_; }
762 void set_exception_msg(const char* msg) { 826 void set_exception_msg(const char* msg) {
763 exception_msg_ = msg; 827 exception_msg_ = msg;
764 } 828 }
765 bool can_send_any_object() const { return can_send_any_object_; } 829 bool can_send_any_object() const { return can_send_any_object_; }
766 bool snapshot_code() const { return snapshot_code_; } 830 bool snapshot_code() const { return snapshot_code_; }
831 bool vm_isolate_is_symbolic() const { return vm_isolate_is_symbolic_; }
767 void ThrowException(Exceptions::ExceptionType type, const char* msg); 832 void ThrowException(Exceptions::ExceptionType type, const char* msg);
768 833
769 // Write a version string for the snapshot. 834 // Write a version string for the snapshot.
770 void WriteVersion(); 835 void WriteVersion();
771 836
772 static intptr_t FirstObjectId(); 837 static intptr_t FirstObjectId();
773 838
774 int32_t GetInstructionsId(RawInstructions* instructions) { return 0; } 839 int32_t GetInstructionsId(RawInstructions* instructions) {
840 return instructions_writer_->GetOffsetFor(instructions);
841 }
775 842
776 protected: 843 protected:
777 void UnmarkAll() { 844 void UnmarkAll() {
778 if (!unmarked_objects_ && forward_list_ != NULL) { 845 if (!unmarked_objects_ && forward_list_ != NULL) {
779 forward_list_->UnmarkAll(); 846 forward_list_->UnmarkAll();
780 unmarked_objects_ = true; 847 unmarked_objects_ = true;
781 } 848 }
782 } 849 }
783 850
784 bool CheckAndWritePredefinedObject(RawObject* raw); 851 bool CheckAndWritePredefinedObject(RawObject* raw);
785 void HandleVMIsolateObject(RawObject* raw); 852 bool HandleVMIsolateObject(RawObject* raw);
786 853
787 void WriteClassId(RawClass* cls); 854 void WriteClassId(RawClass* cls);
788 void WriteStaticImplicitClosure(intptr_t object_id, 855 void WriteStaticImplicitClosure(intptr_t object_id,
789 RawFunction* func, 856 RawFunction* func,
790 intptr_t tags); 857 intptr_t tags);
791 void WriteObjectImpl(RawObject* raw, bool as_reference); 858 void WriteObjectImpl(RawObject* raw, bool as_reference);
792 void WriteObjectRef(RawObject* raw); 859 void WriteObjectRef(RawObject* raw);
793 void WriteInlinedObject(RawObject* raw); 860 void WriteInlinedObject(RawObject* raw);
794 void WriteForwardedObjects(); 861 void WriteForwardedObjects();
795 void ArrayWriteTo(intptr_t object_id, 862 void ArrayWriteTo(intptr_t object_id,
(...skipping 25 matching lines...) Expand all
821 888
822 Isolate* isolate() const { return isolate_; } 889 Isolate* isolate() const { return isolate_; }
823 ObjectStore* object_store() const { return object_store_; } 890 ObjectStore* object_store() const { return object_store_; }
824 891
825 private: 892 private:
826 Snapshot::Kind kind_; 893 Snapshot::Kind kind_;
827 Isolate* isolate_; 894 Isolate* isolate_;
828 ObjectStore* object_store_; // Object store for common classes. 895 ObjectStore* object_store_; // Object store for common classes.
829 ClassTable* class_table_; // Class table for the class index to class lookup. 896 ClassTable* class_table_; // Class table for the class index to class lookup.
830 ForwardList* forward_list_; 897 ForwardList* forward_list_;
898 InstructionsWriter* instructions_writer_;
831 Exceptions::ExceptionType exception_type_; // Exception type. 899 Exceptions::ExceptionType exception_type_; // Exception type.
832 const char* exception_msg_; // Message associated with exception. 900 const char* exception_msg_; // Message associated with exception.
833 bool unmarked_objects_; // True if marked objects have been unmarked. 901 bool unmarked_objects_; // True if marked objects have been unmarked.
834 bool can_send_any_object_; // True if any Dart instance can be sent. 902 bool can_send_any_object_; // True if any Dart instance can be sent.
835 bool snapshot_code_; 903 bool snapshot_code_;
904 bool vm_isolate_is_symbolic_;
836 905
837 friend class FullSnapshotWriter; 906 friend class FullSnapshotWriter;
838 friend class RawArray; 907 friend class RawArray;
839 friend class RawClass; 908 friend class RawClass;
840 friend class RawClosureData; 909 friend class RawClosureData;
841 friend class RawExceptionHandlers; 910 friend class RawExceptionHandlers;
842 friend class RawGrowableObjectArray; 911 friend class RawGrowableObjectArray;
843 friend class RawImmutableArray; 912 friend class RawImmutableArray;
844 friend class RawInstructions; 913 friend class RawInstructions;
845 friend class RawJSRegExp; 914 friend class RawJSRegExp;
(...skipping 14 matching lines...) Expand all
860 friend class WriteInlinedObjectVisitor; 929 friend class WriteInlinedObjectVisitor;
861 DISALLOW_COPY_AND_ASSIGN(SnapshotWriter); 930 DISALLOW_COPY_AND_ASSIGN(SnapshotWriter);
862 }; 931 };
863 932
864 933
865 class FullSnapshotWriter { 934 class FullSnapshotWriter {
866 public: 935 public:
867 static const intptr_t kInitialSize = 64 * KB; 936 static const intptr_t kInitialSize = 64 * KB;
868 FullSnapshotWriter(uint8_t** vm_isolate_snapshot_buffer, 937 FullSnapshotWriter(uint8_t** vm_isolate_snapshot_buffer,
869 uint8_t** isolate_snapshot_buffer, 938 uint8_t** isolate_snapshot_buffer,
939 uint8_t** instructions_snapshot_buffer,
870 ReAlloc alloc, 940 ReAlloc alloc,
871 bool snapshot_code); 941 bool snapshot_code,
942 bool vm_isolate_is_symbolic);
872 ~FullSnapshotWriter(); 943 ~FullSnapshotWriter();
873 944
874 uint8_t** vm_isolate_snapshot_buffer() { 945 uint8_t** vm_isolate_snapshot_buffer() {
875 return vm_isolate_snapshot_buffer_; 946 return vm_isolate_snapshot_buffer_;
876 } 947 }
877 948
878 uint8_t** isolate_snapshot_buffer() { 949 uint8_t** isolate_snapshot_buffer() {
879 return isolate_snapshot_buffer_; 950 return isolate_snapshot_buffer_;
880 } 951 }
881 952
882 // Writes a full snapshot of the Isolate. 953 // Writes a full snapshot of the Isolate.
883 void WriteFullSnapshot(); 954 void WriteFullSnapshot();
884 955
885 intptr_t VmIsolateSnapshotSize() const { 956 intptr_t VmIsolateSnapshotSize() const {
886 return vm_isolate_snapshot_size_; 957 return vm_isolate_snapshot_size_;
887 } 958 }
888 intptr_t IsolateSnapshotSize() const { 959 intptr_t IsolateSnapshotSize() const {
889 return isolate_snapshot_size_; 960 return isolate_snapshot_size_;
890 } 961 }
962 intptr_t InstructionsSnapshotSize() const {
963 return instructions_snapshot_size_;
964 }
891 965
892 private: 966 private:
893 // Writes a snapshot of the VM Isolate. 967 // Writes a snapshot of the VM Isolate.
894 void WriteVmIsolateSnapshot(); 968 void WriteVmIsolateSnapshot();
895 969
896 // Writes a full snapshot of a regular Dart Isolate. 970 // Writes a full snapshot of a regular Dart Isolate.
897 void WriteIsolateFullSnapshot(); 971 void WriteIsolateFullSnapshot();
898 972
899 Isolate* isolate_; 973 Isolate* isolate_;
900 uint8_t** vm_isolate_snapshot_buffer_; 974 uint8_t** vm_isolate_snapshot_buffer_;
901 uint8_t** isolate_snapshot_buffer_; 975 uint8_t** isolate_snapshot_buffer_;
976 uint8_t** instructions_snapshot_buffer_;
902 ReAlloc alloc_; 977 ReAlloc alloc_;
903 intptr_t vm_isolate_snapshot_size_; 978 intptr_t vm_isolate_snapshot_size_;
904 intptr_t isolate_snapshot_size_; 979 intptr_t isolate_snapshot_size_;
980 intptr_t instructions_snapshot_size_;
905 ForwardList* forward_list_; 981 ForwardList* forward_list_;
982 InstructionsWriter* instructions_writer_;
906 Array& scripts_; 983 Array& scripts_;
907 Array& symbol_table_; 984 Array& symbol_table_;
908 bool snapshot_code_; 985 bool snapshot_code_;
986 bool vm_isolate_is_symbolic_;
909 987
910 DISALLOW_COPY_AND_ASSIGN(FullSnapshotWriter); 988 DISALLOW_COPY_AND_ASSIGN(FullSnapshotWriter);
911 }; 989 };
912 990
913 991
914 class PrecompiledSnapshotWriter : public FullSnapshotWriter { 992 class PrecompiledSnapshotWriter : public FullSnapshotWriter {
915 public: 993 public:
916 PrecompiledSnapshotWriter(uint8_t** vm_isolate_snapshot_buffer, 994 PrecompiledSnapshotWriter(uint8_t** vm_isolate_snapshot_buffer,
917 uint8_t** isolate_snapshot_buffer, 995 uint8_t** isolate_snapshot_buffer,
996 uint8_t** instructions_snapshot_buffer,
918 ReAlloc alloc); 997 ReAlloc alloc);
919 ~PrecompiledSnapshotWriter(); 998 ~PrecompiledSnapshotWriter();
920 }; 999 };
921 1000
922 1001
923 class ScriptSnapshotWriter : public SnapshotWriter { 1002 class ScriptSnapshotWriter : public SnapshotWriter {
924 public: 1003 public:
925 static const intptr_t kInitialSize = 64 * KB; 1004 static const intptr_t kInitialSize = 64 * KB;
926 ScriptSnapshotWriter(uint8_t** buffer, ReAlloc alloc); 1005 ScriptSnapshotWriter(uint8_t** buffer, ReAlloc alloc);
927 ~ScriptSnapshotWriter() { } 1006 ~ScriptSnapshotWriter() { }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 private: 1049 private:
971 SnapshotWriter* writer_; 1050 SnapshotWriter* writer_;
972 bool as_references_; 1051 bool as_references_;
973 1052
974 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); 1053 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor);
975 }; 1054 };
976 1055
977 } // namespace dart 1056 } // namespace dart
978 1057
979 #endif // VM_SNAPSHOT_H_ 1058 #endif // VM_SNAPSHOT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698