Chromium Code Reviews| 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_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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 440 static RawClass* type_arguments_class() { return type_arguments_class_; } | 440 static RawClass* type_arguments_class() { return type_arguments_class_; } |
| 441 static RawClass* patch_class_class() { return patch_class_class_; } | 441 static RawClass* patch_class_class() { return patch_class_class_; } |
| 442 static RawClass* function_class() { return function_class_; } | 442 static RawClass* function_class() { return function_class_; } |
| 443 static RawClass* closure_data_class() { return closure_data_class_; } | 443 static RawClass* closure_data_class() { return closure_data_class_; } |
| 444 static RawClass* redirection_data_class() { return redirection_data_class_; } | 444 static RawClass* redirection_data_class() { return redirection_data_class_; } |
| 445 static RawClass* field_class() { return field_class_; } | 445 static RawClass* field_class() { return field_class_; } |
| 446 static RawClass* literal_token_class() { return literal_token_class_; } | 446 static RawClass* literal_token_class() { return literal_token_class_; } |
| 447 static RawClass* token_stream_class() { return token_stream_class_; } | 447 static RawClass* token_stream_class() { return token_stream_class_; } |
| 448 static RawClass* script_class() { return script_class_; } | 448 static RawClass* script_class() { return script_class_; } |
| 449 static RawClass* library_class() { return library_class_; } | 449 static RawClass* library_class() { return library_class_; } |
| 450 static RawClass* library_prefix_class() { return library_prefix_class_; } | |
| 451 static RawClass* namespace_class() { return namespace_class_; } | 450 static RawClass* namespace_class() { return namespace_class_; } |
| 452 static RawClass* code_class() { return code_class_; } | 451 static RawClass* code_class() { return code_class_; } |
| 453 static RawClass* instructions_class() { return instructions_class_; } | 452 static RawClass* instructions_class() { return instructions_class_; } |
| 454 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; } | 453 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; } |
| 455 static RawClass* stackmap_class() { return stackmap_class_; } | 454 static RawClass* stackmap_class() { return stackmap_class_; } |
| 456 static RawClass* var_descriptors_class() { return var_descriptors_class_; } | 455 static RawClass* var_descriptors_class() { return var_descriptors_class_; } |
| 457 static RawClass* exception_handlers_class() { | 456 static RawClass* exception_handlers_class() { |
| 458 return exception_handlers_class_; | 457 return exception_handlers_class_; |
| 459 } | 458 } |
| 460 static RawClass* deopt_info_class() { return deopt_info_class_; } | 459 static RawClass* deopt_info_class() { return deopt_info_class_; } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 591 static RawClass* type_arguments_class_; // Class of TypeArguments vm object. | 590 static RawClass* type_arguments_class_; // Class of TypeArguments vm object. |
| 592 static RawClass* patch_class_class_; // Class of the PatchClass vm object. | 591 static RawClass* patch_class_class_; // Class of the PatchClass vm object. |
| 593 static RawClass* function_class_; // Class of the Function vm object. | 592 static RawClass* function_class_; // Class of the Function vm object. |
| 594 static RawClass* closure_data_class_; // Class of ClosureData vm obj. | 593 static RawClass* closure_data_class_; // Class of ClosureData vm obj. |
| 595 static RawClass* redirection_data_class_; // Class of RedirectionData vm obj. | 594 static RawClass* redirection_data_class_; // Class of RedirectionData vm obj. |
| 596 static RawClass* field_class_; // Class of the Field vm object. | 595 static RawClass* field_class_; // Class of the Field vm object. |
| 597 static RawClass* literal_token_class_; // Class of LiteralToken vm object. | 596 static RawClass* literal_token_class_; // Class of LiteralToken vm object. |
| 598 static RawClass* token_stream_class_; // Class of the TokenStream vm object. | 597 static RawClass* token_stream_class_; // Class of the TokenStream vm object. |
| 599 static RawClass* script_class_; // Class of the Script vm object. | 598 static RawClass* script_class_; // Class of the Script vm object. |
| 600 static RawClass* library_class_; // Class of the Library vm object. | 599 static RawClass* library_class_; // Class of the Library vm object. |
| 601 static RawClass* library_prefix_class_; // Class of Library prefix vm object. | |
| 602 static RawClass* namespace_class_; // Class of Namespace vm object. | 600 static RawClass* namespace_class_; // Class of Namespace vm object. |
| 603 static RawClass* code_class_; // Class of the Code vm object. | 601 static RawClass* code_class_; // Class of the Code vm object. |
| 604 static RawClass* instructions_class_; // Class of the Instructions vm object. | 602 static RawClass* instructions_class_; // Class of the Instructions vm object. |
| 605 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. | 603 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. |
| 606 static RawClass* stackmap_class_; // Class of Stackmap vm object. | 604 static RawClass* stackmap_class_; // Class of Stackmap vm object. |
| 607 static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors. | 605 static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors. |
| 608 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. | 606 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. |
| 609 static RawClass* deopt_info_class_; // Class of DeoptInfo. | 607 static RawClass* deopt_info_class_; // Class of DeoptInfo. |
| 610 static RawClass* context_class_; // Class of the Context vm object. | 608 static RawClass* context_class_; // Class of the Context vm object. |
| 611 static RawClass* context_scope_class_; // Class of ContextScope vm object. | 609 static RawClass* context_scope_class_; // Class of ContextScope vm object. |
| (...skipping 1992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2604 | 2602 |
| 2605 void Register() const; | 2603 void Register() const; |
| 2606 | 2604 |
| 2607 bool IsDebuggable() const { | 2605 bool IsDebuggable() const { |
| 2608 return raw_ptr()->debuggable_; | 2606 return raw_ptr()->debuggable_; |
| 2609 } | 2607 } |
| 2610 void set_debuggable(bool value) const { | 2608 void set_debuggable(bool value) const { |
| 2611 raw_ptr()->debuggable_ = value; | 2609 raw_ptr()->debuggable_ = value; |
| 2612 } | 2610 } |
| 2613 | 2611 |
| 2612 bool IsDeferred() const { | |
|
Ivan Posva
2014/03/27 07:38:48
The deferred state is not part of the library. It
hausner
2014/03/27 20:45:39
When I started this change I thought we'd need to
| |
| 2613 return raw_ptr()->deferred_load_; | |
| 2614 } | |
| 2615 void set_deferred_load() const { | |
| 2616 raw_ptr()->deferred_load_ = true; | |
| 2617 } | |
| 2618 | |
| 2619 | |
| 2614 bool IsCoreLibrary() const { | 2620 bool IsCoreLibrary() const { |
| 2615 return raw() == CoreLibrary(); | 2621 return raw() == CoreLibrary(); |
| 2616 } | 2622 } |
| 2617 | 2623 |
| 2618 static RawLibrary* LookupLibrary(const String& url); | 2624 static RawLibrary* LookupLibrary(const String& url); |
| 2619 static RawLibrary* GetLibrary(intptr_t index); | 2625 static RawLibrary* GetLibrary(intptr_t index); |
| 2620 | 2626 |
| 2621 static void InitCoreLibrary(Isolate* isolate); | 2627 static void InitCoreLibrary(Isolate* isolate); |
| 2622 static void InitNativeWrappersLibrary(Isolate* isolate); | 2628 static void InitNativeWrappersLibrary(Isolate* isolate); |
| 2623 | 2629 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2700 | 2706 |
| 2701 friend class Bootstrap; | 2707 friend class Bootstrap; |
| 2702 friend class Class; | 2708 friend class Class; |
| 2703 friend class Debugger; | 2709 friend class Debugger; |
| 2704 friend class DictionaryIterator; | 2710 friend class DictionaryIterator; |
| 2705 friend class Namespace; | 2711 friend class Namespace; |
| 2706 friend class Object; | 2712 friend class Object; |
| 2707 }; | 2713 }; |
| 2708 | 2714 |
| 2709 | 2715 |
| 2710 class LibraryPrefix : public Object { | |
| 2711 public: | |
| 2712 RawString* name() const { return raw_ptr()->name_; } | |
| 2713 virtual RawString* DictionaryName() const { return name(); } | |
| 2714 | |
| 2715 RawArray* imports() const { return raw_ptr()->imports_; } | |
| 2716 intptr_t num_imports() const { return raw_ptr()->num_imports_; } | |
| 2717 | |
| 2718 bool ContainsLibrary(const Library& library) const; | |
| 2719 RawLibrary* GetLibrary(int index) const; | |
| 2720 void AddImport(const Namespace& import) const; | |
| 2721 RawObject* LookupObject(const String& name) const; | |
| 2722 RawClass* LookupClass(const String& class_name) const; | |
| 2723 | |
| 2724 static intptr_t InstanceSize() { | |
| 2725 return RoundedAllocationSize(sizeof(RawLibraryPrefix)); | |
| 2726 } | |
| 2727 | |
| 2728 static RawLibraryPrefix* New(const String& name, const Namespace& import); | |
| 2729 | |
| 2730 private: | |
| 2731 static const int kInitialSize = 2; | |
| 2732 static const int kIncrementSize = 2; | |
| 2733 | |
| 2734 void set_name(const String& value) const; | |
| 2735 void set_imports(const Array& value) const; | |
| 2736 void set_num_imports(intptr_t value) const; | |
| 2737 | |
| 2738 static RawLibraryPrefix* New(); | |
| 2739 | |
| 2740 FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Object); | |
| 2741 friend class Class; | |
| 2742 }; | |
| 2743 | |
| 2744 | |
| 2745 // A Namespace contains the names in a library dictionary, filtered by | 2716 // A Namespace contains the names in a library dictionary, filtered by |
| 2746 // the show/hide combinators. | 2717 // the show/hide combinators. |
| 2747 class Namespace : public Object { | 2718 class Namespace : public Object { |
| 2748 public: | 2719 public: |
| 2749 RawLibrary* library() const { return raw_ptr()->library_; } | 2720 RawLibrary* library() const { return raw_ptr()->library_; } |
| 2750 RawArray* show_names() const { return raw_ptr()->show_names_; } | 2721 RawArray* show_names() const { return raw_ptr()->show_names_; } |
| 2751 RawArray* hide_names() const { return raw_ptr()->hide_names_; } | 2722 RawArray* hide_names() const { return raw_ptr()->hide_names_; } |
| 2752 | 2723 |
| 2753 void AddMetadata(intptr_t token_pos, const Class& owner_class); | 2724 void AddMetadata(intptr_t token_pos, const Class& owner_class); |
| 2754 RawObject* GetMetadata() const; | 2725 RawObject* GetMetadata() const; |
| (...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4099 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); | 4070 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); |
| 4100 friend class Class; | 4071 friend class Class; |
| 4101 friend class Closure; | 4072 friend class Closure; |
| 4102 friend class SnapshotWriter; | 4073 friend class SnapshotWriter; |
| 4103 friend class StubCode; | 4074 friend class StubCode; |
| 4104 friend class TypedDataView; | 4075 friend class TypedDataView; |
| 4105 friend class DeferredObject; | 4076 friend class DeferredObject; |
| 4106 }; | 4077 }; |
| 4107 | 4078 |
| 4108 | 4079 |
| 4080 class LibraryPrefix : public Instance { | |
| 4081 public: | |
| 4082 RawString* name() const { return raw_ptr()->name_; } | |
| 4083 virtual RawString* DictionaryName() const { return name(); } | |
| 4084 | |
| 4085 RawArray* imports() const { return raw_ptr()->imports_; } | |
| 4086 intptr_t num_imports() const { return raw_ptr()->num_imports_; } | |
| 4087 | |
| 4088 bool ContainsLibrary(const Library& library) const; | |
| 4089 RawLibrary* GetLibrary(int index) const; | |
| 4090 void AddImport(const Namespace& import) const; | |
| 4091 RawObject* LookupObject(const String& name) const; | |
| 4092 RawClass* LookupClass(const String& class_name) const; | |
| 4093 | |
| 4094 bool is_deferred_load() const { return raw_ptr()->is_deferred_load_; } | |
|
Ivan Posva
2014/03/27 07:38:48
Maybe just is_deferred?
hausner
2014/03/27 20:45:39
I think in the places where is_deferred_load() is
| |
| 4095 bool is_loaded() const { return raw_ptr()->is_loaded_; } | |
| 4096 void LoadLibrary() const; | |
| 4097 | |
| 4098 // Return the list of code objects that were compiled when this | |
| 4099 // prefix was not yet loaded. These code objects will be thrown | |
|
Ivan Posva
2014/03/27 07:38:48
thrown away -> invalidated
hausner
2014/03/27 20:45:39
Done.
| |
| 4100 // away when the prefix is loaded. | |
| 4101 RawArray* dependent_code() const; | |
| 4102 void set_dependent_code(const Array& array) const; | |
| 4103 | |
| 4104 // Add the given code object to the list of dependent ones. | |
| 4105 void RegisterDependentCode(const Code& code) const; | |
| 4106 void NukeDependentCode() const; | |
|
Ivan Posva
2014/03/27 07:38:48
InvalidateDependentCode
hausner
2014/03/27 20:45:39
Nukular-free zone? Done.
| |
| 4107 | |
| 4108 static intptr_t InstanceSize() { | |
| 4109 return RoundedAllocationSize(sizeof(RawLibraryPrefix)); | |
| 4110 } | |
| 4111 | |
| 4112 static RawLibraryPrefix* New(const String& name, | |
| 4113 const Namespace& import, | |
| 4114 bool deferred_load); | |
| 4115 | |
| 4116 private: | |
| 4117 static const int kInitialSize = 2; | |
| 4118 static const int kIncrementSize = 2; | |
| 4119 | |
| 4120 void set_name(const String& value) const; | |
| 4121 void set_imports(const Array& value) const; | |
| 4122 void set_num_imports(intptr_t value) const; | |
| 4123 void set_is_loaded() const; | |
| 4124 | |
| 4125 static RawLibraryPrefix* New(); | |
| 4126 | |
| 4127 FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Instance); | |
| 4128 friend class Class; | |
| 4129 }; | |
| 4130 | |
| 4131 | |
| 4109 // AbstractType is an abstract superclass. | 4132 // AbstractType is an abstract superclass. |
| 4110 // Subclasses of AbstractType are Type and TypeParameter. | 4133 // Subclasses of AbstractType are Type and TypeParameter. |
| 4111 class AbstractType : public Instance { | 4134 class AbstractType : public Instance { |
| 4112 public: | 4135 public: |
| 4113 virtual bool IsFinalized() const; | 4136 virtual bool IsFinalized() const; |
| 4114 virtual bool IsBeingFinalized() const; | 4137 virtual bool IsBeingFinalized() const; |
| 4115 virtual bool IsMalformed() const; | 4138 virtual bool IsMalformed() const; |
| 4116 virtual bool IsMalbounded() const; | 4139 virtual bool IsMalbounded() const; |
| 4117 virtual bool IsMalformedOrMalbounded() const; | 4140 virtual bool IsMalformedOrMalbounded() const; |
| 4118 virtual RawLanguageError* error() const; | 4141 virtual RawLanguageError* error() const; |
| (...skipping 2627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6746 | 6769 |
| 6747 | 6770 |
| 6748 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6771 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6749 intptr_t index) { | 6772 intptr_t index) { |
| 6750 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6773 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6751 } | 6774 } |
| 6752 | 6775 |
| 6753 } // namespace dart | 6776 } // namespace dart |
| 6754 | 6777 |
| 6755 #endif // VM_OBJECT_H_ | 6778 #endif // VM_OBJECT_H_ |
| OLD | NEW |