| 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 } | 472 } |
| 473 RawFunction* megamorphic_miss_function() const { | 473 RawFunction* megamorphic_miss_function() const { |
| 474 return megamorphic_miss_function_; | 474 return megamorphic_miss_function_; |
| 475 } | 475 } |
| 476 void SetMegamorphicMissHandler(const Code& code, const Function& func) { | 476 void SetMegamorphicMissHandler(const Code& code, const Function& func) { |
| 477 // Hold onto the code so it is traced and not detached from the function. | 477 // Hold onto the code so it is traced and not detached from the function. |
| 478 megamorphic_miss_code_ = code.raw(); | 478 megamorphic_miss_code_ = code.raw(); |
| 479 megamorphic_miss_function_ = func.raw(); | 479 megamorphic_miss_function_ = func.raw(); |
| 480 } | 480 } |
| 481 | 481 |
| 482 RawFunction* simple_instance_of_function() const { |
| 483 return simple_instance_of_function_; |
| 484 } |
| 485 RawFunction* simple_instance_of_true_function() const { |
| 486 return simple_instance_of_true_function_; |
| 487 } |
| 488 RawFunction* simple_instance_of_false_function() const { |
| 489 return simple_instance_of_false_function_; |
| 490 } |
| 491 |
| 482 // Visit all object pointers. | 492 // Visit all object pointers. |
| 483 void VisitObjectPointers(ObjectPointerVisitor* visitor); | 493 void VisitObjectPointers(ObjectPointerVisitor* visitor); |
| 484 | 494 |
| 485 // Called to initialize objects required by the vm but which invoke | 495 // Called to initialize objects required by the vm but which invoke |
| 486 // dart code. If an error occurs the error object is returned otherwise | 496 // dart code. If an error occurs the error object is returned otherwise |
| 487 // a null object is returned. | 497 // a null object is returned. |
| 488 RawError* PreallocateObjects(); | 498 RawError* PreallocateObjects(); |
| 489 | 499 |
| 490 void InitKnownObjects(); | 500 void InitKnownObjects(); |
| 491 | 501 |
| 492 static void Init(Isolate* isolate); | 502 static void Init(Isolate* isolate); |
| 493 | 503 |
| 494 void PrintToJSONObject(JSONObject* jsobj); | 504 void PrintToJSONObject(JSONObject* jsobj); |
| 495 | 505 |
| 496 private: | 506 private: |
| 497 ObjectStore(); | 507 ObjectStore(); |
| 498 | 508 |
| 509 // Finds a core library private method in Object. |
| 510 RawFunction* PrivateObjectLookup(const String& name); |
| 511 |
| 499 #define OBJECT_STORE_FIELD_LIST(V) \ | 512 #define OBJECT_STORE_FIELD_LIST(V) \ |
| 500 V(RawClass*, object_class_) \ | 513 V(RawClass*, object_class_) \ |
| 501 V(RawType*, object_type_) \ | 514 V(RawType*, object_type_) \ |
| 502 V(RawClass*, null_class_) \ | 515 V(RawClass*, null_class_) \ |
| 503 V(RawType*, null_type_) \ | 516 V(RawType*, null_type_) \ |
| 504 V(RawType*, function_type_) \ | 517 V(RawType*, function_type_) \ |
| 505 V(RawClass*, closure_class_) \ | 518 V(RawClass*, closure_class_) \ |
| 506 V(RawType*, number_type_) \ | 519 V(RawType*, number_type_) \ |
| 507 V(RawType*, int_type_) \ | 520 V(RawType*, int_type_) \ |
| 508 V(RawClass*, integer_implementation_class_) \ | 521 V(RawClass*, integer_implementation_class_) \ |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 V(RawGrowableObjectArray*, error_listeners_) \ | 578 V(RawGrowableObjectArray*, error_listeners_) \ |
| 566 V(RawContext*, empty_context_) \ | 579 V(RawContext*, empty_context_) \ |
| 567 V(RawInstance*, stack_overflow_) \ | 580 V(RawInstance*, stack_overflow_) \ |
| 568 V(RawInstance*, out_of_memory_) \ | 581 V(RawInstance*, out_of_memory_) \ |
| 569 V(RawUnhandledException*, preallocated_unhandled_exception_) \ | 582 V(RawUnhandledException*, preallocated_unhandled_exception_) \ |
| 570 V(RawStacktrace*, preallocated_stack_trace_) \ | 583 V(RawStacktrace*, preallocated_stack_trace_) \ |
| 571 V(RawFunction*, lookup_port_handler_) \ | 584 V(RawFunction*, lookup_port_handler_) \ |
| 572 V(RawTypedData*, empty_uint32_array_) \ | 585 V(RawTypedData*, empty_uint32_array_) \ |
| 573 V(RawFunction*, handle_message_function_) \ | 586 V(RawFunction*, handle_message_function_) \ |
| 574 V(RawArray*, library_load_error_table_) \ | 587 V(RawArray*, library_load_error_table_) \ |
| 588 V(RawFunction*, simple_instance_of_function_) \ |
| 589 V(RawFunction*, simple_instance_of_true_function_) \ |
| 590 V(RawFunction*, simple_instance_of_false_function_) \ |
| 591 V(RawArray*, compile_time_constants_) \ |
| 575 V(RawArray*, unique_dynamic_targets_) \ | 592 V(RawArray*, unique_dynamic_targets_) \ |
| 576 V(RawGrowableObjectArray*, token_objects_) \ | 593 V(RawGrowableObjectArray*, token_objects_) \ |
| 577 V(RawArray*, token_objects_map_) \ | 594 V(RawArray*, token_objects_map_) \ |
| 578 V(RawGrowableObjectArray*, megamorphic_cache_table_) \ | 595 V(RawGrowableObjectArray*, megamorphic_cache_table_) \ |
| 579 V(RawCode*, megamorphic_miss_code_) \ | 596 V(RawCode*, megamorphic_miss_code_) \ |
| 580 V(RawFunction*, megamorphic_miss_function_) \ | 597 V(RawFunction*, megamorphic_miss_function_) \ |
| 598 // Please remember the last entry must be referred in the 'to' function below. |
| 581 | 599 |
| 582 RawObject** from() { return reinterpret_cast<RawObject**>(&object_class_); } | 600 RawObject** from() { return reinterpret_cast<RawObject**>(&object_class_); } |
| 583 #define DECLARE_OBJECT_STORE_FIELD(type, name) \ | 601 #define DECLARE_OBJECT_STORE_FIELD(type, name) \ |
| 584 type name; | 602 type name; |
| 585 OBJECT_STORE_FIELD_LIST(DECLARE_OBJECT_STORE_FIELD) | 603 OBJECT_STORE_FIELD_LIST(DECLARE_OBJECT_STORE_FIELD) |
| 586 #undef DECLARE_OBJECT_STORE_FIELD | 604 #undef DECLARE_OBJECT_STORE_FIELD |
| 587 RawObject** to() { | 605 RawObject** to() { |
| 588 return reinterpret_cast<RawObject**>(&megamorphic_miss_function_); | 606 return reinterpret_cast<RawObject**>(&megamorphic_miss_function_); |
| 589 } | 607 } |
| 590 RawObject** to_snapshot(Snapshot::Kind kind) { | 608 RawObject** to_snapshot(Snapshot::Kind kind) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 606 | 624 |
| 607 friend class Serializer; | 625 friend class Serializer; |
| 608 friend class Deserializer; | 626 friend class Deserializer; |
| 609 | 627 |
| 610 DISALLOW_COPY_AND_ASSIGN(ObjectStore); | 628 DISALLOW_COPY_AND_ASSIGN(ObjectStore); |
| 611 }; | 629 }; |
| 612 | 630 |
| 613 } // namespace dart | 631 } // namespace dart |
| 614 | 632 |
| 615 #endif // VM_OBJECT_STORE_H_ | 633 #endif // VM_OBJECT_STORE_H_ |
| OLD | NEW |