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

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

Issue 2032153003: Use clustered serialization for full snapshots. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: round2 Created 4 years, 5 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
« no previous file with comments | « runtime/vm/dart_entry.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 } 497 }
498 static const Type& dynamic_type() { 498 static const Type& dynamic_type() {
499 ASSERT(dynamic_type_ != NULL); 499 ASSERT(dynamic_type_ != NULL);
500 return *dynamic_type_; 500 return *dynamic_type_;
501 } 501 }
502 static const Type& void_type() { 502 static const Type& void_type() {
503 ASSERT(void_type_ != NULL); 503 ASSERT(void_type_ != NULL);
504 return *void_type_; 504 return *void_type_;
505 } 505 }
506 506
507 static void InitVmIsolateSnapshotObjectTable(intptr_t len); 507 static void set_vm_isolate_snapshot_object_table(const Array& table);
508 508
509 static RawClass* class_class() { return class_class_; } 509 static RawClass* class_class() { return class_class_; }
510 static RawClass* dynamic_class() { return dynamic_class_; } 510 static RawClass* dynamic_class() { return dynamic_class_; }
511 static RawClass* void_class() { return void_class_; } 511 static RawClass* void_class() { return void_class_; }
512 static RawClass* unresolved_class_class() { return unresolved_class_class_; } 512 static RawClass* unresolved_class_class() { return unresolved_class_class_; }
513 static RawClass* type_arguments_class() { return type_arguments_class_; } 513 static RawClass* type_arguments_class() { return type_arguments_class_; }
514 static RawClass* patch_class_class() { return patch_class_class_; } 514 static RawClass* patch_class_class() { return patch_class_class_; }
515 static RawClass* function_class() { return function_class_; } 515 static RawClass* function_class() { return function_class_; }
516 static RawClass* closure_data_class() { return closure_data_class_; } 516 static RawClass* closure_data_class() { return closure_data_class_; }
517 static RawClass* redirection_data_class() { return redirection_data_class_; } 517 static RawClass* redirection_data_class() { return redirection_data_class_; }
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 static LanguageError* speculative_inlining_error_; 828 static LanguageError* speculative_inlining_error_;
829 static LanguageError* background_compilation_error_; 829 static LanguageError* background_compilation_error_;
830 static Array* vm_isolate_snapshot_object_table_; 830 static Array* vm_isolate_snapshot_object_table_;
831 static Type* dynamic_type_; 831 static Type* dynamic_type_;
832 static Type* void_type_; 832 static Type* void_type_;
833 833
834 friend void ClassTable::Register(const Class& cls); 834 friend void ClassTable::Register(const Class& cls);
835 friend void RawObject::Validate(Isolate* isolate) const; 835 friend void RawObject::Validate(Isolate* isolate) const;
836 friend class Closure; 836 friend class Closure;
837 friend class SnapshotReader; 837 friend class SnapshotReader;
838 friend class InstanceDeserializationCluster;
838 friend class OneByteString; 839 friend class OneByteString;
839 friend class TwoByteString; 840 friend class TwoByteString;
840 friend class ExternalOneByteString; 841 friend class ExternalOneByteString;
841 friend class ExternalTwoByteString; 842 friend class ExternalTwoByteString;
842 friend class Thread; 843 friend class Thread;
843 844
844 #define REUSABLE_FRIEND_DECLARATION(name) \ 845 #define REUSABLE_FRIEND_DECLARATION(name) \
845 friend class Reusable##name##HandleScope; 846 friend class Reusable##name##HandleScope;
846 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) 847 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION)
847 #undef REUSABLE_FRIEND_DECLARATION 848 #undef REUSABLE_FRIEND_DECLARATION
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after
2210 bool is_static_call); 2211 bool is_static_call);
2211 2212
2212 static void WriteSentinel(const Array& data, intptr_t test_entry_length); 2213 static void WriteSentinel(const Array& data, intptr_t test_entry_length);
2213 2214
2214 // A cache of VM heap allocated preinitialized empty ic data entry arrays. 2215 // A cache of VM heap allocated preinitialized empty ic data entry arrays.
2215 static RawArray* cached_icdata_arrays_[kCachedICDataArrayCount]; 2216 static RawArray* cached_icdata_arrays_[kCachedICDataArrayCount];
2216 2217
2217 FINAL_HEAP_OBJECT_IMPLEMENTATION(ICData, Object); 2218 FINAL_HEAP_OBJECT_IMPLEMENTATION(ICData, Object);
2218 friend class Class; 2219 friend class Class;
2219 friend class SnapshotWriter; 2220 friend class SnapshotWriter;
2221 friend class Serializer;
2222 friend class Deserializer;
2220 }; 2223 };
2221 2224
2222 2225
2223 class Function : public Object { 2226 class Function : public Object {
2224 public: 2227 public:
2225 RawString* name() const { return raw_ptr()->name_; } 2228 RawString* name() const { return raw_ptr()->name_; }
2226 RawString* UserVisibleName() const; // Same as scrubbed name. 2229 RawString* UserVisibleName() const; // Same as scrubbed name.
2227 RawString* QualifiedScrubbedName() const { 2230 RawString* QualifiedScrubbedName() const {
2228 return QualifiedName(kScrubbedName); 2231 return QualifiedName(kScrubbedName);
2229 } 2232 }
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
3328 void set_kind_bits(uint8_t value) const { 3331 void set_kind_bits(uint8_t value) const {
3329 StoreNonPointer(&raw_ptr()->kind_bits_, value); 3332 StoreNonPointer(&raw_ptr()->kind_bits_, value);
3330 } 3333 }
3331 3334
3332 static RawField* New(); 3335 static RawField* New();
3333 3336
3334 FINAL_HEAP_OBJECT_IMPLEMENTATION(Field, Object); 3337 FINAL_HEAP_OBJECT_IMPLEMENTATION(Field, Object);
3335 friend class Class; 3338 friend class Class;
3336 friend class HeapProfiler; 3339 friend class HeapProfiler;
3337 friend class RawField; 3340 friend class RawField;
3341 friend class FieldSerializationCluster;
3338 }; 3342 };
3339 3343
3340 3344
3341 class LiteralToken : public Object { 3345 class LiteralToken : public Object {
3342 public: 3346 public:
3343 Token::Kind kind() const { return raw_ptr()->kind_; } 3347 Token::Kind kind() const { return raw_ptr()->kind_; }
3344 RawString* literal() const { return raw_ptr()->literal_; } 3348 RawString* literal() const { return raw_ptr()->literal_; }
3345 RawObject* value() const { return raw_ptr()->value_; } 3349 RawObject* value() const { return raw_ptr()->value_; }
3346 3350
3347 static intptr_t InstanceSize() { 3351 static intptr_t InstanceSize() {
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
3852 3856
3853 FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object); 3857 FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object);
3854 3858
3855 friend class Bootstrap; 3859 friend class Bootstrap;
3856 friend class Class; 3860 friend class Class;
3857 friend class Debugger; 3861 friend class Debugger;
3858 friend class Isolate; 3862 friend class Isolate;
3859 friend class DictionaryIterator; 3863 friend class DictionaryIterator;
3860 friend class Namespace; 3864 friend class Namespace;
3861 friend class Object; 3865 friend class Object;
3866 friend class LibraryDeserializationCluster;
3862 }; 3867 };
3863 3868
3864 3869
3865 // A Namespace contains the names in a library dictionary, filtered by 3870 // A Namespace contains the names in a library dictionary, filtered by
3866 // the show/hide combinators. 3871 // the show/hide combinators.
3867 class Namespace : public Object { 3872 class Namespace : public Object {
3868 public: 3873 public:
3869 RawLibrary* library() const { return raw_ptr()->library_; } 3874 RawLibrary* library() const { return raw_ptr()->library_; }
3870 RawArray* show_names() const { return raw_ptr()->show_names_; } 3875 RawArray* show_names() const { return raw_ptr()->show_names_; }
3871 RawArray* hide_names() const { return raw_ptr()->hide_names_; } 3876 RawArray* hide_names() const { return raw_ptr()->hide_names_; }
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
4853 4858
4854 // New is a private method as RawInstruction and RawCode objects should 4859 // New is a private method as RawInstruction and RawCode objects should
4855 // only be created using the Code::FinalizeCode method. This method creates 4860 // only be created using the Code::FinalizeCode method. This method creates
4856 // the RawInstruction and RawCode objects, sets up the pointer offsets 4861 // the RawInstruction and RawCode objects, sets up the pointer offsets
4857 // and links the two in a GC safe manner. 4862 // and links the two in a GC safe manner.
4858 static RawCode* New(intptr_t pointer_offsets_length); 4863 static RawCode* New(intptr_t pointer_offsets_length);
4859 4864
4860 FINAL_HEAP_OBJECT_IMPLEMENTATION(Code, Object); 4865 FINAL_HEAP_OBJECT_IMPLEMENTATION(Code, Object);
4861 friend class Class; 4866 friend class Class;
4862 friend class SnapshotWriter; 4867 friend class SnapshotWriter;
4868 friend class FunctionSerializationCluster;
4869 friend class CodeSerializationCluster;
4863 friend class CodePatcher; // for set_instructions 4870 friend class CodePatcher; // for set_instructions
4864 friend class Precompiler; // for set_instructions 4871 friend class Precompiler; // for set_instructions
4865 // So that the RawFunction pointer visitor can determine whether code the 4872 // So that the RawFunction pointer visitor can determine whether code the
4866 // function points to is optimized. 4873 // function points to is optimized.
4867 friend class RawFunction; 4874 friend class RawFunction;
4868 }; 4875 };
4869 4876
4870 4877
4871 class Context : public Object { 4878 class Context : public Object {
4872 public: 4879 public:
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
5406 // TODO(iposva): Determine if this gets in the way of Smi. 5413 // TODO(iposva): Determine if this gets in the way of Smi.
5407 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); 5414 HEAP_OBJECT_IMPLEMENTATION(Instance, Object);
5408 friend class ByteBuffer; 5415 friend class ByteBuffer;
5409 friend class Class; 5416 friend class Class;
5410 friend class Closure; 5417 friend class Closure;
5411 friend class DeferredObject; 5418 friend class DeferredObject;
5412 friend class RegExp; 5419 friend class RegExp;
5413 friend class SnapshotWriter; 5420 friend class SnapshotWriter;
5414 friend class StubCode; 5421 friend class StubCode;
5415 friend class TypedDataView; 5422 friend class TypedDataView;
5423 friend class InstanceSerializationCluster;
5424 friend class InstanceDeserializationCluster;
5425 friend class ClassDeserializationCluster; // vtable
5416 }; 5426 };
5417 5427
5418 5428
5419 class LibraryPrefix : public Instance { 5429 class LibraryPrefix : public Instance {
5420 public: 5430 public:
5421 RawString* name() const { return raw_ptr()->name_; } 5431 RawString* name() const { return raw_ptr()->name_; }
5422 virtual RawString* DictionaryName() const { return name(); } 5432 virtual RawString* DictionaryName() const { return name(); }
5423 5433
5424 RawArray* imports() const { return raw_ptr()->imports_; } 5434 RawArray* imports() const { return raw_ptr()->imports_; }
5425 intptr_t num_imports() const { return raw_ptr()->num_imports_; } 5435 intptr_t num_imports() const { return raw_ptr()->num_imports_; }
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after
6779 friend class StringSlice; // SetHash 6789 friend class StringSlice; // SetHash
6780 template<typename CharType> friend class CharArray; // SetHash 6790 template<typename CharType> friend class CharArray; // SetHash
6781 friend class ConcatString; // SetHash 6791 friend class ConcatString; // SetHash
6782 friend class OneByteString; 6792 friend class OneByteString;
6783 friend class TwoByteString; 6793 friend class TwoByteString;
6784 friend class ExternalOneByteString; 6794 friend class ExternalOneByteString;
6785 friend class ExternalTwoByteString; 6795 friend class ExternalTwoByteString;
6786 // So that SkippedCodeFunctions can print a debug string from a NoHandleScope. 6796 // So that SkippedCodeFunctions can print a debug string from a NoHandleScope.
6787 friend class SkippedCodeFunctions; 6797 friend class SkippedCodeFunctions;
6788 friend class RawOneByteString; 6798 friend class RawOneByteString;
6799 friend class RODataSerializationCluster; // SetHash
6789 }; 6800 };
6790 6801
6791 6802
6792 class OneByteString : public AllStatic { 6803 class OneByteString : public AllStatic {
6793 public: 6804 public:
6794 static uint16_t CharAt(const String& str, intptr_t index) { 6805 static uint16_t CharAt(const String& str, intptr_t index) {
6795 ASSERT((index >= 0) && (index < str.Length())); 6806 ASSERT((index >= 0) && (index < str.Length()));
6796 ASSERT(str.IsOneByteString()); 6807 ASSERT(str.IsOneByteString());
6797 return raw_ptr(str)->data()[index]; 6808 return raw_ptr(str)->data()[index];
6798 } 6809 }
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
8125 8136
8126 // Keep this in sync with Dart implementation (lib/compact_hash.dart). 8137 // Keep this in sync with Dart implementation (lib/compact_hash.dart).
8127 static const intptr_t kInitialIndexBits = 3; 8138 static const intptr_t kInitialIndexBits = 3;
8128 static const intptr_t kInitialIndexSize = 1 << (kInitialIndexBits + 1); 8139 static const intptr_t kInitialIndexSize = 1 << (kInitialIndexBits + 1);
8129 8140
8130 // Allocate a map, but leave all fields set to null. 8141 // Allocate a map, but leave all fields set to null.
8131 // Used during deserialization (since map might contain itself as key/value). 8142 // Used during deserialization (since map might contain itself as key/value).
8132 static RawLinkedHashMap* NewUninitialized(Heap::Space space = Heap::kNew); 8143 static RawLinkedHashMap* NewUninitialized(Heap::Space space = Heap::kNew);
8133 8144
8134 friend class Class; 8145 friend class Class;
8146 friend class LinkedHashMapDeserializationCluster;
8135 }; 8147 };
8136 8148
8137 8149
8138 class Closure : public Instance { 8150 class Closure : public Instance {
8139 public: 8151 public:
8140 RawFunction* function() const { return raw_ptr()->function_; } 8152 RawFunction* function() const { return raw_ptr()->function_; }
8141 void set_function(const Function& function) const { 8153 void set_function(const Function& function) const {
8142 // TODO(regis): Only used from deferred_objects.cc. Remove once fixed. 8154 // TODO(regis): Only used from deferred_objects.cc. Remove once fixed.
8143 StorePointer(&raw_ptr()->function_, function.raw()); 8155 StorePointer(&raw_ptr()->function_, function.raw());
8144 } 8156 }
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
8726 8738
8727 inline void TypeArguments::SetHash(intptr_t value) const { 8739 inline void TypeArguments::SetHash(intptr_t value) const {
8728 // This is only safe because we create a new Smi, which does not cause 8740 // This is only safe because we create a new Smi, which does not cause
8729 // heap allocation. 8741 // heap allocation.
8730 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 8742 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
8731 } 8743 }
8732 8744
8733 } // namespace dart 8745 } // namespace dart
8734 8746
8735 #endif // VM_OBJECT_H_ 8747 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_entry.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698