| 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 { |
| 23 kNone = 0, |
| 24 kAsync, |
| 25 kCore, |
| 26 kCollection, |
| 27 kCollectionDev, |
| 28 kCrypto, |
| 29 kIsolate, |
| 30 kJson, |
| 31 kMath, |
| 32 kMirrors, |
| 33 kTypedData, |
| 34 kUtf, |
| 35 kUri, |
| 36 }; |
| 37 |
| 22 ~ObjectStore(); | 38 ~ObjectStore(); |
| 23 | 39 |
| 24 RawClass* object_class() const { | 40 RawClass* object_class() const { |
| 25 ASSERT(object_class_ != Object::null()); | 41 ASSERT(object_class_ != Object::null()); |
| 26 return object_class_; | 42 return object_class_; |
| 27 } | 43 } |
| 28 void set_object_class(const Class& value) { object_class_ = value.raw(); } | 44 void set_object_class(const Class& value) { object_class_ = value.raw(); } |
| 29 static intptr_t object_class_offset() { | 45 static intptr_t object_class_offset() { |
| 30 return OFFSET_OF(ObjectStore, object_class_); | 46 return OFFSET_OF(ObjectStore, object_class_); |
| 31 } | 47 } |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 void set_symbol_table(const Array& value) { symbol_table_ = value.raw(); } | 248 void set_symbol_table(const Array& value) { symbol_table_ = value.raw(); } |
| 233 | 249 |
| 234 RawArray* canonical_type_arguments() const { | 250 RawArray* canonical_type_arguments() const { |
| 235 return canonical_type_arguments_; | 251 return canonical_type_arguments_; |
| 236 } | 252 } |
| 237 void set_canonical_type_arguments(const Array& value) { | 253 void set_canonical_type_arguments(const Array& value) { |
| 238 canonical_type_arguments_ = value.raw(); | 254 canonical_type_arguments_ = value.raw(); |
| 239 } | 255 } |
| 240 | 256 |
| 241 RawLibrary* async_library() const { return async_library_; } | 257 RawLibrary* async_library() const { return async_library_; } |
| 242 void set_async_library(const Library& value) { | 258 RawLibrary* builtin_library() const { return builtin_library_; } |
| 243 async_library_ = value.raw(); | |
| 244 } | |
| 245 | |
| 246 RawLibrary* builtin_library() const { | |
| 247 return builtin_library_; | |
| 248 } | |
| 249 void set_builtin_library(const Library& value) { | |
| 250 builtin_library_ = value.raw(); | |
| 251 } | |
| 252 | |
| 253 RawLibrary* core_library() const { return core_library_; } | 259 RawLibrary* core_library() const { return core_library_; } |
| 254 void set_core_library(const Library& value) { | 260 RawLibrary* collection_library() const { return collection_library_; } |
| 255 core_library_ = value.raw(); | |
| 256 } | |
| 257 | |
| 258 RawLibrary* core_impl_library() const { return core_impl_library_; } | |
| 259 void set_core_impl_library(const Library& value) { | |
| 260 core_impl_library_ = value.raw(); | |
| 261 } | |
| 262 | |
| 263 RawLibrary* collection_library() const { | |
| 264 return collection_library_; | |
| 265 } | |
| 266 void set_collection_library(const Library& value) { | |
| 267 collection_library_ = value.raw(); | |
| 268 } | |
| 269 | |
| 270 RawLibrary* collection_dev_library() const { | 261 RawLibrary* collection_dev_library() const { |
| 271 return collection_dev_library_; | 262 return collection_dev_library_; |
| 272 } | 263 } |
| 273 void set_collection_dev_library(const Library& value) { | 264 RawLibrary* crypto_library() const { return crypto_library_; } |
| 274 collection_dev_library_ = value.raw(); | 265 RawLibrary* isolate_library() const { return isolate_library_; } |
| 266 RawLibrary* json_library() const { return json_library_; } |
| 267 RawLibrary* math_library() const { return math_library_; } |
| 268 RawLibrary* mirrors_library() const { return mirrors_library_; } |
| 269 RawLibrary* typed_data_library() const { return typed_data_library_; } |
| 270 RawLibrary* uri_library() const { return uri_library_; } |
| 271 RawLibrary* utf_library() const { return utf_library_; } |
| 272 void set_bootstrap_library(intptr_t index, const Library& value) { |
| 273 switch (index) { |
| 274 case kAsync: |
| 275 async_library_ = value.raw(); |
| 276 break; |
| 277 case kCore: |
| 278 core_library_ = value.raw(); |
| 279 break; |
| 280 case kCollection: |
| 281 collection_library_ = value.raw(); |
| 282 break; |
| 283 case kCollectionDev: |
| 284 collection_dev_library_ = value.raw(); |
| 285 break; |
| 286 case kCrypto: |
| 287 crypto_library_ = value.raw(); |
| 288 break; |
| 289 case kIsolate: |
| 290 isolate_library_ = value.raw(); |
| 291 break; |
| 292 case kJson: |
| 293 json_library_ = value.raw(); |
| 294 break; |
| 295 case kMath: |
| 296 math_library_ = value.raw(); |
| 297 break; |
| 298 case kMirrors: |
| 299 mirrors_library_ = value.raw(); |
| 300 break; |
| 301 case kTypedData: |
| 302 typed_data_library_ = value.raw(); |
| 303 break; |
| 304 case kUtf: |
| 305 utf_library_ = value.raw(); |
| 306 break; |
| 307 case kUri: |
| 308 uri_library_ = value.raw(); |
| 309 break; |
| 310 default: |
| 311 UNREACHABLE(); |
| 312 } |
| 275 } | 313 } |
| 276 | 314 |
| 277 RawLibrary* crypto_library() const { | 315 void set_builtin_library(const Library& value) { |
| 278 return crypto_library_; | 316 builtin_library_ = value.raw(); |
| 279 } | |
| 280 void set_crypto_library(const Library& value) { | |
| 281 crypto_library_ = value.raw(); | |
| 282 } | |
| 283 | |
| 284 RawLibrary* isolate_library() const { | |
| 285 return isolate_library_; | |
| 286 } | |
| 287 void set_isolate_library(const Library& value) { | |
| 288 isolate_library_ = value.raw(); | |
| 289 } | |
| 290 | |
| 291 RawLibrary* json_library() const { | |
| 292 return json_library_; | |
| 293 } | |
| 294 void set_json_library(const Library& value) { | |
| 295 json_library_ = value.raw(); | |
| 296 } | |
| 297 | |
| 298 RawLibrary* math_library() const { | |
| 299 return math_library_; | |
| 300 } | |
| 301 void set_math_library(const Library& value) { | |
| 302 math_library_ = value.raw(); | |
| 303 } | |
| 304 | |
| 305 RawLibrary* mirrors_library() const { return mirrors_library_; } | |
| 306 void set_mirrors_library(const Library& value) { | |
| 307 mirrors_library_ = value.raw(); | |
| 308 } | 317 } |
| 309 | 318 |
| 310 RawLibrary* native_wrappers_library() const { | 319 RawLibrary* native_wrappers_library() const { |
| 311 return native_wrappers_library_; | 320 return native_wrappers_library_; |
| 312 } | 321 } |
| 313 void set_native_wrappers_library(const Library& value) { | 322 void set_native_wrappers_library(const Library& value) { |
| 314 native_wrappers_library_ = value.raw(); | 323 native_wrappers_library_ = value.raw(); |
| 315 } | 324 } |
| 316 | 325 |
| 317 RawLibrary* root_library() const { return root_library_; } | 326 RawLibrary* root_library() const { return root_library_; } |
| 318 void set_root_library(const Library& value) { | 327 void set_root_library(const Library& value) { |
| 319 root_library_ = value.raw(); | 328 root_library_ = value.raw(); |
| 320 } | 329 } |
| 321 | 330 |
| 322 RawLibrary* typed_data_library() const { | |
| 323 return typed_data_library_; | |
| 324 } | |
| 325 void set_typed_data_library(const Library& value) { | |
| 326 typed_data_library_ = value.raw(); | |
| 327 } | |
| 328 | |
| 329 RawLibrary* uri_library() const { | |
| 330 return uri_library_; | |
| 331 } | |
| 332 void set_uri_library(const Library& value) { | |
| 333 uri_library_ = value.raw(); | |
| 334 } | |
| 335 | |
| 336 RawLibrary* utf_library() const { | |
| 337 return utf_library_; | |
| 338 } | |
| 339 void set_utf_library(const Library& value) { | |
| 340 utf_library_ = value.raw(); | |
| 341 } | |
| 342 | |
| 343 RawGrowableObjectArray* libraries() const { return libraries_; } | 331 RawGrowableObjectArray* libraries() const { return libraries_; } |
| 344 void set_libraries(const GrowableObjectArray& value) { | 332 void set_libraries(const GrowableObjectArray& value) { |
| 345 libraries_ = value.raw(); | 333 libraries_ = value.raw(); |
| 346 } | 334 } |
| 347 | 335 |
| 348 RawGrowableObjectArray* pending_classes() const { return pending_classes_; } | 336 RawGrowableObjectArray* pending_classes() const { return pending_classes_; } |
| 349 void set_pending_classes(const GrowableObjectArray& value) { | 337 void set_pending_classes(const GrowableObjectArray& value) { |
| 350 ASSERT(!value.IsNull()); | 338 ASSERT(!value.IsNull()); |
| 351 pending_classes_ = value.raw(); | 339 pending_classes_ = value.raw(); |
| 352 } | 340 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 RawClass* uint32x4_class_; | 454 RawClass* uint32x4_class_; |
| 467 RawArray* typed_data_classes_; | 455 RawArray* typed_data_classes_; |
| 468 RawClass* stacktrace_class_; | 456 RawClass* stacktrace_class_; |
| 469 RawClass* jsregexp_class_; | 457 RawClass* jsregexp_class_; |
| 470 RawClass* weak_property_class_; | 458 RawClass* weak_property_class_; |
| 471 RawArray* symbol_table_; | 459 RawArray* symbol_table_; |
| 472 RawArray* canonical_type_arguments_; | 460 RawArray* canonical_type_arguments_; |
| 473 RawLibrary* async_library_; | 461 RawLibrary* async_library_; |
| 474 RawLibrary* builtin_library_; | 462 RawLibrary* builtin_library_; |
| 475 RawLibrary* core_library_; | 463 RawLibrary* core_library_; |
| 476 RawLibrary* core_impl_library_; | |
| 477 RawLibrary* collection_library_; | 464 RawLibrary* collection_library_; |
| 478 RawLibrary* collection_dev_library_; | 465 RawLibrary* collection_dev_library_; |
| 479 RawLibrary* crypto_library_; | 466 RawLibrary* crypto_library_; |
| 480 RawLibrary* isolate_library_; | 467 RawLibrary* isolate_library_; |
| 481 RawLibrary* json_library_; | 468 RawLibrary* json_library_; |
| 482 RawLibrary* math_library_; | 469 RawLibrary* math_library_; |
| 483 RawLibrary* mirrors_library_; | 470 RawLibrary* mirrors_library_; |
| 484 RawLibrary* native_wrappers_library_; | 471 RawLibrary* native_wrappers_library_; |
| 485 RawLibrary* root_library_; | 472 RawLibrary* root_library_; |
| 486 RawLibrary* typed_data_library_; | 473 RawLibrary* typed_data_library_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 501 RawObject** to() { return reinterpret_cast<RawObject**>(&keyword_symbols_); } | 488 RawObject** to() { return reinterpret_cast<RawObject**>(&keyword_symbols_); } |
| 502 | 489 |
| 503 friend class SnapshotReader; | 490 friend class SnapshotReader; |
| 504 | 491 |
| 505 DISALLOW_COPY_AND_ASSIGN(ObjectStore); | 492 DISALLOW_COPY_AND_ASSIGN(ObjectStore); |
| 506 }; | 493 }; |
| 507 | 494 |
| 508 } // namespace dart | 495 } // namespace dart |
| 509 | 496 |
| 510 #endif // VM_OBJECT_STORE_H_ | 497 #endif // VM_OBJECT_STORE_H_ |
| OLD | NEW |