| 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_OBJECT_STORE_H_ | 5 #ifndef VM_OBJECT_STORE_H_ |
| 6 #define VM_OBJECT_STORE_H_ | 6 #define VM_OBJECT_STORE_H_ |
| 7 | 7 |
| 8 #include "vm/object.h" | 8 #include "vm/object.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 // Forward declarations. | 12 // Forward declarations. |
| 13 class Isolate; | 13 class Isolate; |
| 14 class ObjectPointerVisitor; | 14 class ObjectPointerVisitor; |
| 15 | 15 |
| 16 // The object store is a per isolate instance which stores references to | 16 // The object store is a per isolate instance which stores references to |
| 17 // objects used by the VM. | 17 // objects used by the VM. |
| 18 // TODO(iposva): Move the actual store into the object heap for quick handling | 18 // TODO(iposva): Move the actual store into the object heap for quick handling |
| 19 // by snapshots eventually. | 19 // by snapshots eventually. |
| 20 class ObjectStore { | 20 class ObjectStore { |
| 21 public: | 21 public: |
| 22 enum { | 22 enum { |
| 23 kNone = 0, | 23 kNone = 0, |
| 24 kAsync, | 24 kAsync, |
| 25 kCore, | 25 kCore, |
| 26 kCollection, | 26 kCollection, |
| 27 kCollectionDev, | 27 kCollectionDev, |
| 28 kCrypto, | |
| 29 kIsolate, | 28 kIsolate, |
| 30 kJson, | 29 kJson, |
| 31 kMath, | 30 kMath, |
| 32 kMirrors, | 31 kMirrors, |
| 33 kTypedData, | 32 kTypedData, |
| 34 kUtf, | 33 kUtf, |
| 35 kUri, | |
| 36 }; | 34 }; |
| 37 | 35 |
| 38 ~ObjectStore(); | 36 ~ObjectStore(); |
| 39 | 37 |
| 40 RawClass* object_class() const { | 38 RawClass* object_class() const { |
| 41 ASSERT(object_class_ != Object::null()); | 39 ASSERT(object_class_ != Object::null()); |
| 42 return object_class_; | 40 return object_class_; |
| 43 } | 41 } |
| 44 void set_object_class(const Class& value) { object_class_ = value.raw(); } | 42 void set_object_class(const Class& value) { object_class_ = value.raw(); } |
| 45 static intptr_t object_class_offset() { | 43 static intptr_t object_class_offset() { |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 canonical_type_arguments_ = value.raw(); | 252 canonical_type_arguments_ = value.raw(); |
| 255 } | 253 } |
| 256 | 254 |
| 257 RawLibrary* async_library() const { return async_library_; } | 255 RawLibrary* async_library() const { return async_library_; } |
| 258 RawLibrary* builtin_library() const { return builtin_library_; } | 256 RawLibrary* builtin_library() const { return builtin_library_; } |
| 259 RawLibrary* core_library() const { return core_library_; } | 257 RawLibrary* core_library() const { return core_library_; } |
| 260 RawLibrary* collection_library() const { return collection_library_; } | 258 RawLibrary* collection_library() const { return collection_library_; } |
| 261 RawLibrary* collection_dev_library() const { | 259 RawLibrary* collection_dev_library() const { |
| 262 return collection_dev_library_; | 260 return collection_dev_library_; |
| 263 } | 261 } |
| 264 RawLibrary* crypto_library() const { return crypto_library_; } | |
| 265 RawLibrary* isolate_library() const { return isolate_library_; } | 262 RawLibrary* isolate_library() const { return isolate_library_; } |
| 266 RawLibrary* json_library() const { return json_library_; } | 263 RawLibrary* json_library() const { return json_library_; } |
| 267 RawLibrary* math_library() const { return math_library_; } | 264 RawLibrary* math_library() const { return math_library_; } |
| 268 RawLibrary* mirrors_library() const { return mirrors_library_; } | 265 RawLibrary* mirrors_library() const { return mirrors_library_; } |
| 269 RawLibrary* typed_data_library() const { return typed_data_library_; } | 266 RawLibrary* typed_data_library() const { return typed_data_library_; } |
| 270 RawLibrary* utf_library() const { return utf_library_; } | 267 RawLibrary* utf_library() const { return utf_library_; } |
| 271 void set_bootstrap_library(intptr_t index, const Library& value) { | 268 void set_bootstrap_library(intptr_t index, const Library& value) { |
| 272 switch (index) { | 269 switch (index) { |
| 273 case kAsync: | 270 case kAsync: |
| 274 async_library_ = value.raw(); | 271 async_library_ = value.raw(); |
| 275 break; | 272 break; |
| 276 case kCore: | 273 case kCore: |
| 277 core_library_ = value.raw(); | 274 core_library_ = value.raw(); |
| 278 break; | 275 break; |
| 279 case kCollection: | 276 case kCollection: |
| 280 collection_library_ = value.raw(); | 277 collection_library_ = value.raw(); |
| 281 break; | 278 break; |
| 282 case kCollectionDev: | 279 case kCollectionDev: |
| 283 collection_dev_library_ = value.raw(); | 280 collection_dev_library_ = value.raw(); |
| 284 break; | 281 break; |
| 285 case kCrypto: | |
| 286 crypto_library_ = value.raw(); | |
| 287 break; | |
| 288 case kIsolate: | 282 case kIsolate: |
| 289 isolate_library_ = value.raw(); | 283 isolate_library_ = value.raw(); |
| 290 break; | 284 break; |
| 291 case kJson: | 285 case kJson: |
| 292 json_library_ = value.raw(); | 286 json_library_ = value.raw(); |
| 293 break; | 287 break; |
| 294 case kMath: | 288 case kMath: |
| 295 math_library_ = value.raw(); | 289 math_library_ = value.raw(); |
| 296 break; | 290 break; |
| 297 case kMirrors: | 291 case kMirrors: |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 RawClass* stacktrace_class_; | 446 RawClass* stacktrace_class_; |
| 453 RawClass* jsregexp_class_; | 447 RawClass* jsregexp_class_; |
| 454 RawClass* weak_property_class_; | 448 RawClass* weak_property_class_; |
| 455 RawArray* symbol_table_; | 449 RawArray* symbol_table_; |
| 456 RawArray* canonical_type_arguments_; | 450 RawArray* canonical_type_arguments_; |
| 457 RawLibrary* async_library_; | 451 RawLibrary* async_library_; |
| 458 RawLibrary* builtin_library_; | 452 RawLibrary* builtin_library_; |
| 459 RawLibrary* core_library_; | 453 RawLibrary* core_library_; |
| 460 RawLibrary* collection_library_; | 454 RawLibrary* collection_library_; |
| 461 RawLibrary* collection_dev_library_; | 455 RawLibrary* collection_dev_library_; |
| 462 RawLibrary* crypto_library_; | |
| 463 RawLibrary* isolate_library_; | 456 RawLibrary* isolate_library_; |
| 464 RawLibrary* json_library_; | 457 RawLibrary* json_library_; |
| 465 RawLibrary* math_library_; | 458 RawLibrary* math_library_; |
| 466 RawLibrary* mirrors_library_; | 459 RawLibrary* mirrors_library_; |
| 467 RawLibrary* native_wrappers_library_; | 460 RawLibrary* native_wrappers_library_; |
| 468 RawLibrary* root_library_; | 461 RawLibrary* root_library_; |
| 469 RawLibrary* typed_data_library_; | 462 RawLibrary* typed_data_library_; |
| 470 RawLibrary* utf_library_; | 463 RawLibrary* utf_library_; |
| 471 RawGrowableObjectArray* libraries_; | 464 RawGrowableObjectArray* libraries_; |
| 472 RawGrowableObjectArray* pending_classes_; | 465 RawGrowableObjectArray* pending_classes_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 483 RawObject** to() { return reinterpret_cast<RawObject**>(&keyword_symbols_); } | 476 RawObject** to() { return reinterpret_cast<RawObject**>(&keyword_symbols_); } |
| 484 | 477 |
| 485 friend class SnapshotReader; | 478 friend class SnapshotReader; |
| 486 | 479 |
| 487 DISALLOW_COPY_AND_ASSIGN(ObjectStore); | 480 DISALLOW_COPY_AND_ASSIGN(ObjectStore); |
| 488 }; | 481 }; |
| 489 | 482 |
| 490 } // namespace dart | 483 } // namespace dart |
| 491 | 484 |
| 492 #endif // VM_OBJECT_STORE_H_ | 485 #endif // VM_OBJECT_STORE_H_ |
| OLD | NEW |