| 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" |
| 11 #include "vm/datastream.h" | 11 #include "vm/datastream.h" |
| 12 #include "vm/exceptions.h" | 12 #include "vm/exceptions.h" |
| 13 #include "vm/globals.h" | 13 #include "vm/globals.h" |
| 14 #include "vm/growable_array.h" | 14 #include "vm/growable_array.h" |
| 15 #include "vm/isolate.h" | 15 #include "vm/isolate.h" |
| 16 #include "vm/visitor.h" | 16 #include "vm/visitor.h" |
| 17 | 17 |
| 18 namespace dart { | 18 namespace dart { |
| 19 | 19 |
| 20 // Forward declarations. | 20 // Forward declarations. |
| 21 class AbstractType; | 21 class AbstractType; |
| 22 class Array; | 22 class Array; |
| 23 class Class; | 23 class Class; |
| 24 class ClassTable; | 24 class ClassTable; |
| 25 class Closure; |
| 25 class Code; | 26 class Code; |
| 26 class ExternalTypedData; | 27 class ExternalTypedData; |
| 27 class GrowableObjectArray; | 28 class GrowableObjectArray; |
| 28 class Heap; | 29 class Heap; |
| 29 class Instructions; | 30 class Instructions; |
| 30 class LanguageError; | 31 class LanguageError; |
| 31 class Library; | 32 class Library; |
| 32 class Object; | 33 class Object; |
| 33 class PassiveObject; | 34 class PassiveObject; |
| 34 class ObjectStore; | 35 class ObjectStore; |
| 35 class MegamorphicCache; | 36 class MegamorphicCache; |
| 36 class PageSpace; | 37 class PageSpace; |
| 37 class RawApiError; | 38 class RawApiError; |
| 38 class RawArray; | 39 class RawArray; |
| 39 class RawBigint; | 40 class RawBigint; |
| 40 class RawBoundedType; | 41 class RawBoundedType; |
| 41 class RawCapability; | 42 class RawCapability; |
| 42 class RawClass; | 43 class RawClass; |
| 44 class RawClosure; |
| 43 class RawClosureData; | 45 class RawClosureData; |
| 44 class RawContext; | 46 class RawContext; |
| 45 class RawContextScope; | 47 class RawContextScope; |
| 46 class RawDouble; | 48 class RawDouble; |
| 47 class RawExceptionHandlers; | 49 class RawExceptionHandlers; |
| 48 class RawField; | 50 class RawField; |
| 49 class RawFloat32x4; | 51 class RawFloat32x4; |
| 50 class RawFloat64x2; | 52 class RawFloat64x2; |
| 51 class RawFunction; | 53 class RawFunction; |
| 54 class RawFunctionType; |
| 52 class RawGrowableObjectArray; | 55 class RawGrowableObjectArray; |
| 53 class RawICData; | 56 class RawICData; |
| 54 class RawImmutableArray; | 57 class RawImmutableArray; |
| 55 class RawInstructions; | 58 class RawInstructions; |
| 56 class RawInt32x4; | 59 class RawInt32x4; |
| 57 class RawJSRegExp; | 60 class RawJSRegExp; |
| 58 class RawLanguageError; | 61 class RawLanguageError; |
| 59 class RawLibrary; | 62 class RawLibrary; |
| 60 class RawLibraryPrefix; | 63 class RawLibraryPrefix; |
| 61 class RawLinkedHashMap; | 64 class RawLinkedHashMap; |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 RawTokenStream* NewTokenStream(intptr_t len); | 408 RawTokenStream* NewTokenStream(intptr_t len); |
| 406 RawContext* NewContext(intptr_t num_variables); | 409 RawContext* NewContext(intptr_t num_variables); |
| 407 RawClass* NewClass(intptr_t class_id); | 410 RawClass* NewClass(intptr_t class_id); |
| 408 RawInstance* NewInstance(); | 411 RawInstance* NewInstance(); |
| 409 RawMint* NewMint(int64_t value); | 412 RawMint* NewMint(int64_t value); |
| 410 RawBigint* NewBigint(); | 413 RawBigint* NewBigint(); |
| 411 RawTypedData* NewTypedData(intptr_t class_id, intptr_t len); | 414 RawTypedData* NewTypedData(intptr_t class_id, intptr_t len); |
| 412 RawDouble* NewDouble(double value); | 415 RawDouble* NewDouble(double value); |
| 413 RawUnresolvedClass* NewUnresolvedClass(); | 416 RawUnresolvedClass* NewUnresolvedClass(); |
| 414 RawType* NewType(); | 417 RawType* NewType(); |
| 418 RawFunctionType* NewFunctionType(); |
| 415 RawTypeRef* NewTypeRef(); | 419 RawTypeRef* NewTypeRef(); |
| 416 RawTypeParameter* NewTypeParameter(); | 420 RawTypeParameter* NewTypeParameter(); |
| 417 RawBoundedType* NewBoundedType(); | 421 RawBoundedType* NewBoundedType(); |
| 418 RawMixinAppType* NewMixinAppType(); | 422 RawMixinAppType* NewMixinAppType(); |
| 419 RawPatchClass* NewPatchClass(); | 423 RawPatchClass* NewPatchClass(); |
| 424 RawClosure* NewClosure(); |
| 420 RawClosureData* NewClosureData(); | 425 RawClosureData* NewClosureData(); |
| 421 RawRedirectionData* NewRedirectionData(); | 426 RawRedirectionData* NewRedirectionData(); |
| 422 RawFunction* NewFunction(); | 427 RawFunction* NewFunction(); |
| 423 RawCode* NewCode(intptr_t pointer_offsets_length); | 428 RawCode* NewCode(intptr_t pointer_offsets_length); |
| 424 RawObjectPool* NewObjectPool(intptr_t length); | 429 RawObjectPool* NewObjectPool(intptr_t length); |
| 425 RawPcDescriptors* NewPcDescriptors(intptr_t length); | 430 RawPcDescriptors* NewPcDescriptors(intptr_t length); |
| 426 RawLocalVarDescriptors* NewLocalVarDescriptors(intptr_t num_entries); | 431 RawLocalVarDescriptors* NewLocalVarDescriptors(intptr_t num_entries); |
| 427 RawExceptionHandlers* NewExceptionHandlers(intptr_t num_entries); | 432 RawExceptionHandlers* NewExceptionHandlers(intptr_t num_entries); |
| 428 RawStackmap* NewStackmap(intptr_t length); | 433 RawStackmap* NewStackmap(intptr_t length); |
| 429 RawContextScope* NewContextScope(intptr_t num_variables); | 434 RawContextScope* NewContextScope(intptr_t num_variables); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 UnhandledException& error_; // Error handle. | 556 UnhandledException& error_; // Error handle. |
| 552 intptr_t max_vm_isolate_object_id_; | 557 intptr_t max_vm_isolate_object_id_; |
| 553 ZoneGrowableArray<BackRefNode>* backward_references_; | 558 ZoneGrowableArray<BackRefNode>* backward_references_; |
| 554 InstructionsReader* instructions_reader_; | 559 InstructionsReader* instructions_reader_; |
| 555 | 560 |
| 556 friend class ApiError; | 561 friend class ApiError; |
| 557 friend class Array; | 562 friend class Array; |
| 558 friend class Bigint; | 563 friend class Bigint; |
| 559 friend class BoundedType; | 564 friend class BoundedType; |
| 560 friend class Class; | 565 friend class Class; |
| 566 friend class Closure; |
| 561 friend class ClosureData; | 567 friend class ClosureData; |
| 562 friend class Code; | 568 friend class Code; |
| 563 friend class Context; | 569 friend class Context; |
| 564 friend class ContextScope; | 570 friend class ContextScope; |
| 565 friend class ExceptionHandlers; | 571 friend class ExceptionHandlers; |
| 566 friend class Field; | 572 friend class Field; |
| 567 friend class Function; | 573 friend class Function; |
| 568 friend class GrowableObjectArray; | 574 friend class GrowableObjectArray; |
| 569 friend class ICData; | 575 friend class ICData; |
| 570 friend class ImmutableArray; | 576 friend class ImmutableArray; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 581 friend class MixinAppType; | 587 friend class MixinAppType; |
| 582 friend class Namespace; | 588 friend class Namespace; |
| 583 friend class ObjectPool; | 589 friend class ObjectPool; |
| 584 friend class PatchClass; | 590 friend class PatchClass; |
| 585 friend class RedirectionData; | 591 friend class RedirectionData; |
| 586 friend class Script; | 592 friend class Script; |
| 587 friend class Stacktrace; | 593 friend class Stacktrace; |
| 588 friend class SubtypeTestCache; | 594 friend class SubtypeTestCache; |
| 589 friend class TokenStream; | 595 friend class TokenStream; |
| 590 friend class Type; | 596 friend class Type; |
| 597 friend class FunctionType; |
| 591 friend class TypeArguments; | 598 friend class TypeArguments; |
| 592 friend class TypeParameter; | 599 friend class TypeParameter; |
| 593 friend class TypeRef; | 600 friend class TypeRef; |
| 594 friend class UnhandledException; | 601 friend class UnhandledException; |
| 595 friend class UnresolvedClass; | 602 friend class UnresolvedClass; |
| 596 friend class WeakProperty; | 603 friend class WeakProperty; |
| 597 DISALLOW_COPY_AND_ASSIGN(SnapshotReader); | 604 DISALLOW_COPY_AND_ASSIGN(SnapshotReader); |
| 598 }; | 605 }; |
| 599 | 606 |
| 600 | 607 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 int32_t GetInstructionsId(RawInstructions* instructions) { | 921 int32_t GetInstructionsId(RawInstructions* instructions) { |
| 915 return instructions_writer_->GetOffsetFor(instructions); | 922 return instructions_writer_->GetOffsetFor(instructions); |
| 916 } | 923 } |
| 917 | 924 |
| 918 void SetInstructionsCode(RawInstructions* instructions, RawCode* code) { | 925 void SetInstructionsCode(RawInstructions* instructions, RawCode* code) { |
| 919 return instructions_writer_->SetInstructionsCode(instructions, code); | 926 return instructions_writer_->SetInstructionsCode(instructions, code); |
| 920 } | 927 } |
| 921 | 928 |
| 922 void WriteFunctionId(RawFunction* func, bool owner_is_class); | 929 void WriteFunctionId(RawFunction* func, bool owner_is_class); |
| 923 | 930 |
| 931 RawFunction* IsSerializableClosure(RawClosure* closure); |
| 932 |
| 933 void WriteStaticImplicitClosure(intptr_t object_id, |
| 934 RawFunction* func, |
| 935 intptr_t tags); |
| 936 |
| 924 protected: | 937 protected: |
| 925 bool CheckAndWritePredefinedObject(RawObject* raw); | 938 bool CheckAndWritePredefinedObject(RawObject* raw); |
| 926 bool HandleVMIsolateObject(RawObject* raw); | 939 bool HandleVMIsolateObject(RawObject* raw); |
| 927 | 940 |
| 928 void WriteClassId(RawClass* cls); | 941 void WriteClassId(RawClass* cls); |
| 929 void WriteStaticImplicitClosure(intptr_t object_id, | |
| 930 RawFunction* func, | |
| 931 intptr_t tags); | |
| 932 void WriteObjectImpl(RawObject* raw, bool as_reference); | 942 void WriteObjectImpl(RawObject* raw, bool as_reference); |
| 933 void WriteMarkedObjectImpl(RawObject* raw, | 943 void WriteMarkedObjectImpl(RawObject* raw, |
| 934 intptr_t tags, | 944 intptr_t tags, |
| 935 intptr_t object_id, | 945 intptr_t object_id, |
| 936 bool as_reference); | 946 bool as_reference); |
| 937 void WriteForwardedObjects(); | 947 void WriteForwardedObjects(); |
| 938 void ArrayWriteTo(intptr_t object_id, | 948 void ArrayWriteTo(intptr_t object_id, |
| 939 intptr_t array_kind, | 949 intptr_t array_kind, |
| 940 intptr_t tags, | 950 intptr_t tags, |
| 941 RawSmi* length, | 951 RawSmi* length, |
| 942 RawTypeArguments* type_arguments, | 952 RawTypeArguments* type_arguments, |
| 943 RawObject* data[], | 953 RawObject* data[], |
| 944 bool as_reference); | 954 bool as_reference); |
| 945 RawFunction* IsSerializableClosure(RawClass* cls, RawObject* obj); | |
| 946 RawClass* GetFunctionOwner(RawFunction* func); | 955 RawClass* GetFunctionOwner(RawFunction* func); |
| 947 void CheckForNativeFields(RawClass* cls); | 956 void CheckForNativeFields(RawClass* cls); |
| 948 void SetWriteException(Exceptions::ExceptionType type, const char* msg); | 957 void SetWriteException(Exceptions::ExceptionType type, const char* msg); |
| 949 void WriteInstance(RawObject* raw, | 958 void WriteInstance(RawObject* raw, |
| 950 RawClass* cls, | 959 RawClass* cls, |
| 951 intptr_t tags, | 960 intptr_t tags, |
| 952 intptr_t object_id, | 961 intptr_t object_id, |
| 953 bool as_reference); | 962 bool as_reference); |
| 954 bool AllowObjectsInDartLibrary(RawLibrary* library); | 963 bool AllowObjectsInDartLibrary(RawLibrary* library); |
| 955 intptr_t FindVmSnapshotObject(RawObject* rawobj); | 964 intptr_t FindVmSnapshotObject(RawObject* rawobj); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 private: | 1137 private: |
| 1129 SnapshotWriter* writer_; | 1138 SnapshotWriter* writer_; |
| 1130 bool as_references_; | 1139 bool as_references_; |
| 1131 | 1140 |
| 1132 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); | 1141 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); |
| 1133 }; | 1142 }; |
| 1134 | 1143 |
| 1135 } // namespace dart | 1144 } // namespace dart |
| 1136 | 1145 |
| 1137 #endif // VM_SNAPSHOT_H_ | 1146 #endif // VM_SNAPSHOT_H_ |
| OLD | NEW |