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 { |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 | 491 |
492 // Called to initialize objects required by the vm but which invoke | 492 // Called to initialize objects required by the vm but which invoke |
493 // dart code. If an error occurs the error object is returned otherwise | 493 // dart code. If an error occurs the error object is returned otherwise |
494 // a null object is returned. | 494 // a null object is returned. |
495 RawError* PreallocateObjects(); | 495 RawError* PreallocateObjects(); |
496 | 496 |
497 void InitKnownObjects(); | 497 void InitKnownObjects(); |
498 | 498 |
499 static void Init(Isolate* isolate); | 499 static void Init(Isolate* isolate); |
500 | 500 |
| 501 void PrintToJSONObject(JSONObject* jsobj); |
| 502 |
501 private: | 503 private: |
502 ObjectStore(); | 504 ObjectStore(); |
503 | 505 |
| 506 #define OBJECT_STORE_FIELD_LIST(V) \ |
| 507 V(RawClass*, object_class_) \ |
| 508 V(RawType*, object_type_) \ |
| 509 V(RawClass*, null_class_) \ |
| 510 V(RawType*, null_type_) \ |
| 511 V(RawType*, function_type_) \ |
| 512 V(RawClass*, closure_class_) \ |
| 513 V(RawType*, number_type_) \ |
| 514 V(RawType*, int_type_) \ |
| 515 V(RawClass*, integer_implementation_class_) \ |
| 516 V(RawClass*, smi_class_) \ |
| 517 V(RawType*, smi_type_) \ |
| 518 V(RawClass*, mint_class_) \ |
| 519 V(RawType*, mint_type_) \ |
| 520 V(RawClass*, bigint_class_) \ |
| 521 V(RawClass*, double_class_) \ |
| 522 V(RawType*, double_type_) \ |
| 523 V(RawType*, float32x4_type_) \ |
| 524 V(RawType*, int32x4_type_) \ |
| 525 V(RawType*, float64x2_type_) \ |
| 526 V(RawType*, string_type_) \ |
| 527 V(RawClass*, future_class_) \ |
| 528 V(RawClass*, completer_class_) \ |
| 529 V(RawClass*, stream_iterator_class_) \ |
| 530 V(RawClass*, symbol_class_) \ |
| 531 V(RawClass*, one_byte_string_class_) \ |
| 532 V(RawClass*, two_byte_string_class_) \ |
| 533 V(RawClass*, external_one_byte_string_class_) \ |
| 534 V(RawClass*, external_two_byte_string_class_) \ |
| 535 V(RawType*, bool_type_) \ |
| 536 V(RawClass*, bool_class_) \ |
| 537 V(RawClass*, array_class_) \ |
| 538 V(RawType*, array_type_) \ |
| 539 V(RawClass*, immutable_array_class_) \ |
| 540 V(RawClass*, growable_object_array_class_) \ |
| 541 V(RawClass*, linked_hash_map_class_) \ |
| 542 V(RawClass*, float32x4_class_) \ |
| 543 V(RawClass*, int32x4_class_) \ |
| 544 V(RawClass*, float64x2_class_) \ |
| 545 V(RawClass*, error_class_) \ |
| 546 V(RawClass*, weak_property_class_) \ |
| 547 V(RawArray*, symbol_table_) \ |
| 548 V(RawArray*, canonical_types_) \ |
| 549 V(RawArray*, canonical_type_arguments_) \ |
| 550 V(RawLibrary*, async_library_) \ |
| 551 V(RawLibrary*, builtin_library_) \ |
| 552 V(RawLibrary*, core_library_) \ |
| 553 V(RawLibrary*, collection_library_) \ |
| 554 V(RawLibrary*, convert_library_) \ |
| 555 V(RawLibrary*, developer_library_) \ |
| 556 V(RawLibrary*, internal_library_) \ |
| 557 V(RawLibrary*, isolate_library_) \ |
| 558 V(RawLibrary*, math_library_) \ |
| 559 V(RawLibrary*, mirrors_library_) \ |
| 560 V(RawLibrary*, native_wrappers_library_) \ |
| 561 V(RawLibrary*, profiler_library_) \ |
| 562 V(RawLibrary*, root_library_) \ |
| 563 V(RawLibrary*, typed_data_library_) \ |
| 564 V(RawLibrary*, vmservice_library_) \ |
| 565 V(RawGrowableObjectArray*, libraries_) \ |
| 566 V(RawArray*, libraries_map_) \ |
| 567 V(RawGrowableObjectArray*, closure_functions_) \ |
| 568 V(RawGrowableObjectArray*, pending_classes_) \ |
| 569 V(RawGrowableObjectArray*, pending_deferred_loads_) \ |
| 570 V(RawGrowableObjectArray*, resume_capabilities_) \ |
| 571 V(RawGrowableObjectArray*, exit_listeners_) \ |
| 572 V(RawGrowableObjectArray*, error_listeners_) \ |
| 573 V(RawContext*, empty_context_) \ |
| 574 V(RawInstance*, stack_overflow_) \ |
| 575 V(RawInstance*, out_of_memory_) \ |
| 576 V(RawUnhandledException*, preallocated_unhandled_exception_) \ |
| 577 V(RawStacktrace*, preallocated_stack_trace_) \ |
| 578 V(RawFunction*, lookup_port_handler_) \ |
| 579 V(RawTypedData*, empty_uint32_array_) \ |
| 580 V(RawFunction*, handle_message_function_) \ |
| 581 V(RawArray*, library_load_error_table_) \ |
| 582 V(RawArray*, compile_time_constants_) \ |
| 583 V(RawArray*, unique_dynamic_targets_) \ |
| 584 V(RawGrowableObjectArray*, token_objects_) \ |
| 585 V(RawArray*, token_objects_map_) \ |
| 586 V(RawGrowableObjectArray*, megamorphic_cache_table_) \ |
| 587 V(RawCode*, megamorphic_miss_code_) \ |
| 588 V(RawFunction*, megamorphic_miss_function_) \ |
| 589 |
504 RawObject** from() { return reinterpret_cast<RawObject**>(&object_class_); } | 590 RawObject** from() { return reinterpret_cast<RawObject**>(&object_class_); } |
505 RawClass* object_class_; | 591 #define DECLARE_OBJECT_STORE_FIELD(type, name) \ |
506 RawType* object_type_; | 592 type name; |
507 RawClass* null_class_; | 593 OBJECT_STORE_FIELD_LIST(DECLARE_OBJECT_STORE_FIELD) |
508 RawType* null_type_; | 594 #undef DECLARE_OBJECT_STORE_FIELD |
509 RawType* function_type_; | |
510 RawClass* closure_class_; | |
511 RawType* number_type_; | |
512 RawType* int_type_; | |
513 RawClass* integer_implementation_class_; | |
514 RawClass* smi_class_; | |
515 RawType* smi_type_; | |
516 RawClass* mint_class_; | |
517 RawType* mint_type_; | |
518 RawClass* bigint_class_; | |
519 RawClass* double_class_; | |
520 RawType* double_type_; | |
521 RawType* float32x4_type_; | |
522 RawType* int32x4_type_; | |
523 RawType* float64x2_type_; | |
524 RawType* string_type_; | |
525 RawClass* future_class_; | |
526 RawClass* completer_class_; | |
527 RawClass* stream_iterator_class_; | |
528 RawClass* symbol_class_; | |
529 RawClass* one_byte_string_class_; | |
530 RawClass* two_byte_string_class_; | |
531 RawClass* external_one_byte_string_class_; | |
532 RawClass* external_two_byte_string_class_; | |
533 RawType* bool_type_; | |
534 RawClass* bool_class_; | |
535 RawClass* array_class_; | |
536 RawType* array_type_; | |
537 RawClass* immutable_array_class_; | |
538 RawClass* growable_object_array_class_; | |
539 RawClass* linked_hash_map_class_; | |
540 RawClass* float32x4_class_; | |
541 RawClass* int32x4_class_; | |
542 RawClass* float64x2_class_; | |
543 RawClass* error_class_; | |
544 RawClass* weak_property_class_; | |
545 RawArray* symbol_table_; | |
546 RawArray* canonical_types_; | |
547 RawArray* canonical_type_arguments_; | |
548 RawLibrary* async_library_; | |
549 RawLibrary* builtin_library_; | |
550 RawLibrary* core_library_; | |
551 RawLibrary* collection_library_; | |
552 RawLibrary* convert_library_; | |
553 RawLibrary* developer_library_; | |
554 RawLibrary* internal_library_; | |
555 RawLibrary* isolate_library_; | |
556 RawLibrary* math_library_; | |
557 RawLibrary* mirrors_library_; | |
558 RawLibrary* native_wrappers_library_; | |
559 RawLibrary* profiler_library_; | |
560 RawLibrary* root_library_; | |
561 RawLibrary* typed_data_library_; | |
562 RawLibrary* vmservice_library_; | |
563 RawGrowableObjectArray* libraries_; | |
564 RawArray* libraries_map_; | |
565 RawGrowableObjectArray* closure_functions_; | |
566 RawGrowableObjectArray* pending_classes_; | |
567 RawGrowableObjectArray* pending_deferred_loads_; | |
568 RawGrowableObjectArray* resume_capabilities_; | |
569 RawGrowableObjectArray* exit_listeners_; | |
570 RawGrowableObjectArray* error_listeners_; | |
571 RawContext* empty_context_; | |
572 RawInstance* stack_overflow_; | |
573 RawInstance* out_of_memory_; | |
574 RawUnhandledException* preallocated_unhandled_exception_; | |
575 RawStacktrace* preallocated_stack_trace_; | |
576 RawFunction* lookup_port_handler_; | |
577 RawTypedData* empty_uint32_array_; | |
578 RawFunction* handle_message_function_; | |
579 RawArray* library_load_error_table_; | |
580 RawArray* compile_time_constants_; | |
581 RawArray* unique_dynamic_targets_; | |
582 RawGrowableObjectArray* token_objects_; | |
583 RawArray* token_objects_map_; | |
584 RawGrowableObjectArray* megamorphic_cache_table_; | |
585 RawCode* megamorphic_miss_code_; | |
586 RawFunction* megamorphic_miss_function_; | |
587 RawObject** to() { | 595 RawObject** to() { |
588 return reinterpret_cast<RawObject**>(&megamorphic_miss_function_); | 596 return reinterpret_cast<RawObject**>(&megamorphic_miss_function_); |
589 } | 597 } |
590 RawObject** to_snapshot(Snapshot::Kind kind) { | 598 RawObject** to_snapshot(Snapshot::Kind kind) { |
591 switch (kind) { | 599 switch (kind) { |
592 case Snapshot::kCore: | 600 case Snapshot::kCore: |
593 return reinterpret_cast<RawObject**>(&compile_time_constants_); | 601 return reinterpret_cast<RawObject**>(&compile_time_constants_); |
594 case Snapshot::kAppWithJIT: | 602 case Snapshot::kAppWithJIT: |
595 case Snapshot::kAppNoJIT: | 603 case Snapshot::kAppNoJIT: |
596 return to(); | 604 return to(); |
(...skipping 10 matching lines...) Expand all Loading... |
607 friend class FullSnapshotWriter; | 615 friend class FullSnapshotWriter; |
608 friend class SnapshotReader; | 616 friend class SnapshotReader; |
609 friend class VmIsolateSnapshotReader; | 617 friend class VmIsolateSnapshotReader; |
610 | 618 |
611 DISALLOW_COPY_AND_ASSIGN(ObjectStore); | 619 DISALLOW_COPY_AND_ASSIGN(ObjectStore); |
612 }; | 620 }; |
613 | 621 |
614 } // namespace dart | 622 } // namespace dart |
615 | 623 |
616 #endif // VM_OBJECT_STORE_H_ | 624 #endif // VM_OBJECT_STORE_H_ |
OLD | NEW |