| 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 RUNTIME_VM_OBJECT_H_ | 5 #ifndef RUNTIME_VM_OBJECT_H_ |
| 6 #define RUNTIME_VM_OBJECT_H_ | 6 #define RUNTIME_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 2609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2620 #else | 2620 #else |
| 2621 ASSERT(value >= 0); | 2621 ASSERT(value >= 0); |
| 2622 if (value > kMaxInstructionCount) { | 2622 if (value > kMaxInstructionCount) { |
| 2623 value = kMaxInstructionCount; | 2623 value = kMaxInstructionCount; |
| 2624 } | 2624 } |
| 2625 StoreNonPointer(&raw_ptr()->optimized_call_site_count_, | 2625 StoreNonPointer(&raw_ptr()->optimized_call_site_count_, |
| 2626 static_cast<uint16_t>(value)); | 2626 static_cast<uint16_t>(value)); |
| 2627 #endif | 2627 #endif |
| 2628 } | 2628 } |
| 2629 | 2629 |
| 2630 void* kernel_function() const { | 2630 intptr_t kernel_offset() const { |
| 2631 #if defined(DART_PRECOMPILED_RUNTIME) | 2631 #if defined(DART_PRECOMPILED_RUNTIME) |
| 2632 return NULL; | 2632 return 0; |
| 2633 #else | 2633 #else |
| 2634 return raw_ptr()->kernel_function_; | 2634 return raw_ptr()->kernel_offset_; |
| 2635 #endif | 2635 #endif |
| 2636 } | 2636 } |
| 2637 | 2637 |
| 2638 void set_kernel_function(void* kernel_function) const { | 2638 void set_kernel_offset(intptr_t kernel_offset) const { |
| 2639 #if !defined(DART_PRECOMPILED_RUNTIME) | 2639 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 2640 StoreNonPointer(&raw_ptr()->kernel_function_, kernel_function); | 2640 StoreNonPointer(&raw_ptr()->kernel_offset_, kernel_offset); |
| 2641 #endif | 2641 #endif |
| 2642 } | 2642 } |
| 2643 | 2643 |
| 2644 bool IsOptimizable() const; | 2644 bool IsOptimizable() const; |
| 2645 void SetIsOptimizable(bool value) const; | 2645 void SetIsOptimizable(bool value) const; |
| 2646 | 2646 |
| 2647 bool CanBeInlined() const; | 2647 bool CanBeInlined() const; |
| 2648 | 2648 |
| 2649 MethodRecognizer::Kind recognized_kind() const { | 2649 MethodRecognizer::Kind recognized_kind() const { |
| 2650 return RecognizedBits::decode(raw_ptr()->kind_tag_); | 2650 return RecognizedBits::decode(raw_ptr()->kind_tag_); |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3174 return DoubleInitializedBit::decode(raw_ptr()->kind_bits_); | 3174 return DoubleInitializedBit::decode(raw_ptr()->kind_bits_); |
| 3175 } | 3175 } |
| 3176 // Called in parser after allocating field, immutable property otherwise. | 3176 // Called in parser after allocating field, immutable property otherwise. |
| 3177 // Marks fields that are initialized with a simple double constant. | 3177 // Marks fields that are initialized with a simple double constant. |
| 3178 void set_is_double_initialized(bool value) const { | 3178 void set_is_double_initialized(bool value) const { |
| 3179 ASSERT(Thread::Current()->IsMutatorThread()); | 3179 ASSERT(Thread::Current()->IsMutatorThread()); |
| 3180 ASSERT(IsOriginal()); | 3180 ASSERT(IsOriginal()); |
| 3181 set_kind_bits(DoubleInitializedBit::update(value, raw_ptr()->kind_bits_)); | 3181 set_kind_bits(DoubleInitializedBit::update(value, raw_ptr()->kind_bits_)); |
| 3182 } | 3182 } |
| 3183 | 3183 |
| 3184 void* kernel_field() const { | 3184 intptr_t kernel_offset() const { |
| 3185 #if defined(DART_PRECOMPILED_RUNTIME) | 3185 #if defined(DART_PRECOMPILED_RUNTIME) |
| 3186 return NULL; | 3186 return NULL; |
| 3187 #else | 3187 #else |
| 3188 return raw_ptr()->kernel_field_; | 3188 return raw_ptr()->kernel_offset_; |
| 3189 #endif | 3189 #endif |
| 3190 } | 3190 } |
| 3191 | 3191 |
| 3192 void set_kernel_field(void* kernel_field) const { | 3192 void set_kernel_offset(intptr_t kernel_offset) const { |
| 3193 #if !defined(DART_PRECOMPILED_RUNTIME) | 3193 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 3194 StoreNonPointer(&raw_ptr()->kernel_field_, kernel_field); | 3194 StoreNonPointer(&raw_ptr()->kernel_offset_, kernel_offset); |
| 3195 #endif | 3195 #endif |
| 3196 } | 3196 } |
| 3197 | 3197 |
| 3198 | 3198 |
| 3199 inline intptr_t Offset() const; | 3199 inline intptr_t Offset() const; |
| 3200 // Called during class finalization. | 3200 // Called during class finalization. |
| 3201 inline void SetOffset(intptr_t offset_in_bytes) const; | 3201 inline void SetOffset(intptr_t offset_in_bytes) const; |
| 3202 | 3202 |
| 3203 inline RawInstance* StaticValue() const; | 3203 inline RawInstance* StaticValue() const; |
| 3204 inline void SetStaticValue(const Instance& value, | 3204 inline void SetStaticValue(const Instance& value, |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3598 intptr_t col_offset() const { return raw_ptr()->col_offset_; } | 3598 intptr_t col_offset() const { return raw_ptr()->col_offset_; } |
| 3599 | 3599 |
| 3600 // The load time in milliseconds since epoch. | 3600 // The load time in milliseconds since epoch. |
| 3601 int64_t load_timestamp() const { return raw_ptr()->load_timestamp_; } | 3601 int64_t load_timestamp() const { return raw_ptr()->load_timestamp_; } |
| 3602 | 3602 |
| 3603 RawArray* compile_time_constants() const { | 3603 RawArray* compile_time_constants() const { |
| 3604 return raw_ptr()->compile_time_constants_; | 3604 return raw_ptr()->compile_time_constants_; |
| 3605 } | 3605 } |
| 3606 void set_compile_time_constants(const Array& value) const; | 3606 void set_compile_time_constants(const Array& value) const; |
| 3607 | 3607 |
| 3608 const uint8_t* kernel_data() { return raw_ptr()->kernel_data_; } |
| 3609 void set_kernel_data(const uint8_t* kernel_data) const; |
| 3610 |
| 3611 intptr_t kernel_data_size() { return raw_ptr()->kernel_data_size_; } |
| 3612 void set_kernel_data_size(const intptr_t kernel_data_size) const; |
| 3613 |
| 3608 RawTypedData* kernel_string_offsets() const { | 3614 RawTypedData* kernel_string_offsets() const { |
| 3609 return raw_ptr()->kernel_string_offsets_; | 3615 return raw_ptr()->kernel_string_offsets_; |
| 3610 } | 3616 } |
| 3611 void set_kernel_string_offsets(const TypedData& offsets) const; | 3617 void set_kernel_string_offsets(const TypedData& offsets) const; |
| 3612 | 3618 |
| 3613 RawTypedData* kernel_string_data() const { | 3619 RawTypedData* kernel_string_data() const { |
| 3614 return raw_ptr()->kernel_string_data_; | 3620 return raw_ptr()->kernel_string_data_; |
| 3615 } | 3621 } |
| 3616 void set_kernel_string_data(const TypedData& data) const; | 3622 void set_kernel_string_data(const TypedData& data) const; |
| 3617 | 3623 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3836 // without a library prefix. | 3842 // without a library prefix. |
| 3837 RawObject* ResolveName(const String& name) const; | 3843 RawObject* ResolveName(const String& name) const; |
| 3838 | 3844 |
| 3839 void AddAnonymousClass(const Class& cls) const; | 3845 void AddAnonymousClass(const Class& cls) const; |
| 3840 | 3846 |
| 3841 void AddExport(const Namespace& ns) const; | 3847 void AddExport(const Namespace& ns) const; |
| 3842 | 3848 |
| 3843 void AddClassMetadata(const Class& cls, | 3849 void AddClassMetadata(const Class& cls, |
| 3844 const Object& tl_owner, | 3850 const Object& tl_owner, |
| 3845 TokenPosition token_pos, | 3851 TokenPosition token_pos, |
| 3846 kernel::TreeNode* kernel_node = NULL) const; | 3852 intptr_t kernel_offset = 0) const; |
| 3847 void AddFieldMetadata(const Field& field, | 3853 void AddFieldMetadata(const Field& field, |
| 3848 TokenPosition token_pos, | 3854 TokenPosition token_pos, |
| 3849 kernel::TreeNode* kernel_node = NULL) const; | 3855 intptr_t kernel_offset = 0) const; |
| 3850 void AddFunctionMetadata(const Function& func, | 3856 void AddFunctionMetadata(const Function& func, |
| 3851 TokenPosition token_pos, | 3857 TokenPosition token_pos, |
| 3852 kernel::TreeNode* kernel_node = NULL) const; | 3858 intptr_t kernel_offset = 0) const; |
| 3853 void AddLibraryMetadata(const Object& tl_owner, | 3859 void AddLibraryMetadata(const Object& tl_owner, |
| 3854 TokenPosition token_pos) const; | 3860 TokenPosition token_pos) const; |
| 3855 void AddTypeParameterMetadata(const TypeParameter& param, | 3861 void AddTypeParameterMetadata(const TypeParameter& param, |
| 3856 TokenPosition token_pos) const; | 3862 TokenPosition token_pos) const; |
| 3857 RawObject* GetMetadata(const Object& obj) const; | 3863 RawObject* GetMetadata(const Object& obj) const; |
| 3858 | 3864 |
| 3859 RawClass* toplevel_class() const { return raw_ptr()->toplevel_class_; } | 3865 RawClass* toplevel_class() const { return raw_ptr()->toplevel_class_; } |
| 3860 void set_toplevel_class(const Class& value) const; | 3866 void set_toplevel_class(const Class& value) const; |
| 3861 | 3867 |
| 3862 RawGrowableObjectArray* patch_classes() const { | 3868 RawGrowableObjectArray* patch_classes() const { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4011 static RawLibrary* NewLibraryHelper(const String& url, bool import_core_lib); | 4017 static RawLibrary* NewLibraryHelper(const String& url, bool import_core_lib); |
| 4012 RawObject* LookupEntry(const String& name, intptr_t* index) const; | 4018 RawObject* LookupEntry(const String& name, intptr_t* index) const; |
| 4013 | 4019 |
| 4014 void AllocatePrivateKey() const; | 4020 void AllocatePrivateKey() const; |
| 4015 | 4021 |
| 4016 RawString* MakeMetadataName(const Object& obj) const; | 4022 RawString* MakeMetadataName(const Object& obj) const; |
| 4017 RawField* GetMetadataField(const String& metaname) const; | 4023 RawField* GetMetadataField(const String& metaname) const; |
| 4018 void AddMetadata(const Object& owner, | 4024 void AddMetadata(const Object& owner, |
| 4019 const String& name, | 4025 const String& name, |
| 4020 TokenPosition token_pos, | 4026 TokenPosition token_pos, |
| 4021 kernel::TreeNode* kernel_node = NULL) const; | 4027 intptr_t kernel_offset = 0) const; |
| 4022 | 4028 |
| 4023 FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object); | 4029 FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object); |
| 4024 | 4030 |
| 4025 friend class Bootstrap; | 4031 friend class Bootstrap; |
| 4026 friend class Class; | 4032 friend class Class; |
| 4027 friend class Debugger; | 4033 friend class Debugger; |
| 4028 friend class DictionaryIterator; | 4034 friend class DictionaryIterator; |
| 4029 friend class Isolate; | 4035 friend class Isolate; |
| 4030 friend class LibraryDeserializationCluster; | 4036 friend class LibraryDeserializationCluster; |
| 4031 friend class Namespace; | 4037 friend class Namespace; |
| (...skipping 5024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9056 | 9062 |
| 9057 inline void TypeArguments::SetHash(intptr_t value) const { | 9063 inline void TypeArguments::SetHash(intptr_t value) const { |
| 9058 // This is only safe because we create a new Smi, which does not cause | 9064 // This is only safe because we create a new Smi, which does not cause |
| 9059 // heap allocation. | 9065 // heap allocation. |
| 9060 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 9066 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
| 9061 } | 9067 } |
| 9062 | 9068 |
| 9063 } // namespace dart | 9069 } // namespace dart |
| 9064 | 9070 |
| 9065 #endif // RUNTIME_VM_OBJECT_H_ | 9071 #endif // RUNTIME_VM_OBJECT_H_ |
| OLD | NEW |