| 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 -1; |
| 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3172 return DoubleInitializedBit::decode(raw_ptr()->kind_bits_); | 3172 return DoubleInitializedBit::decode(raw_ptr()->kind_bits_); |
| 3173 } | 3173 } |
| 3174 // Called in parser after allocating field, immutable property otherwise. | 3174 // Called in parser after allocating field, immutable property otherwise. |
| 3175 // Marks fields that are initialized with a simple double constant. | 3175 // Marks fields that are initialized with a simple double constant. |
| 3176 void set_is_double_initialized(bool value) const { | 3176 void set_is_double_initialized(bool value) const { |
| 3177 ASSERT(Thread::Current()->IsMutatorThread()); | 3177 ASSERT(Thread::Current()->IsMutatorThread()); |
| 3178 ASSERT(IsOriginal()); | 3178 ASSERT(IsOriginal()); |
| 3179 set_kind_bits(DoubleInitializedBit::update(value, raw_ptr()->kind_bits_)); | 3179 set_kind_bits(DoubleInitializedBit::update(value, raw_ptr()->kind_bits_)); |
| 3180 } | 3180 } |
| 3181 | 3181 |
| 3182 void* kernel_field() const { | 3182 intptr_t kernel_offset() const { |
| 3183 #if defined(DART_PRECOMPILED_RUNTIME) | 3183 #if defined(DART_PRECOMPILED_RUNTIME) |
| 3184 return NULL; | 3184 return NULL; |
| 3185 #else | 3185 #else |
| 3186 return raw_ptr()->kernel_field_; | 3186 return raw_ptr()->kernel_offset_; |
| 3187 #endif | 3187 #endif |
| 3188 } | 3188 } |
| 3189 | 3189 |
| 3190 void set_kernel_field(void* kernel_field) const { | 3190 void set_kernel_offset(intptr_t kernel_offset) const { |
| 3191 #if !defined(DART_PRECOMPILED_RUNTIME) | 3191 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 3192 StoreNonPointer(&raw_ptr()->kernel_field_, kernel_field); | 3192 StoreNonPointer(&raw_ptr()->kernel_offset_, kernel_offset); |
| 3193 #endif | 3193 #endif |
| 3194 } | 3194 } |
| 3195 | 3195 |
| 3196 | 3196 |
| 3197 inline intptr_t Offset() const; | 3197 inline intptr_t Offset() const; |
| 3198 // Called during class finalization. | 3198 // Called during class finalization. |
| 3199 inline void SetOffset(intptr_t offset_in_bytes) const; | 3199 inline void SetOffset(intptr_t offset_in_bytes) const; |
| 3200 | 3200 |
| 3201 inline RawInstance* StaticValue() const; | 3201 inline RawInstance* StaticValue() const; |
| 3202 inline void SetStaticValue(const Instance& value, | 3202 inline void SetStaticValue(const Instance& value, |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3596 intptr_t col_offset() const { return raw_ptr()->col_offset_; } | 3596 intptr_t col_offset() const { return raw_ptr()->col_offset_; } |
| 3597 | 3597 |
| 3598 // The load time in milliseconds since epoch. | 3598 // The load time in milliseconds since epoch. |
| 3599 int64_t load_timestamp() const { return raw_ptr()->load_timestamp_; } | 3599 int64_t load_timestamp() const { return raw_ptr()->load_timestamp_; } |
| 3600 | 3600 |
| 3601 RawArray* compile_time_constants() const { | 3601 RawArray* compile_time_constants() const { |
| 3602 return raw_ptr()->compile_time_constants_; | 3602 return raw_ptr()->compile_time_constants_; |
| 3603 } | 3603 } |
| 3604 void set_compile_time_constants(const Array& value) const; | 3604 void set_compile_time_constants(const Array& value) const; |
| 3605 | 3605 |
| 3606 const uint8_t* kernel_data() { return raw_ptr()->kernel_data_; } |
| 3607 void set_kernel_data(const uint8_t* kernel_data) const; |
| 3608 |
| 3609 intptr_t kernel_data_size() { return raw_ptr()->kernel_data_size_; } |
| 3610 void set_kernel_data_size(const intptr_t kernel_data_size) const; |
| 3611 |
| 3606 RawTypedData* kernel_string_offsets() const { | 3612 RawTypedData* kernel_string_offsets() const { |
| 3607 return raw_ptr()->kernel_string_offsets_; | 3613 return raw_ptr()->kernel_string_offsets_; |
| 3608 } | 3614 } |
| 3609 void set_kernel_string_offsets(const TypedData& offsets) const; | 3615 void set_kernel_string_offsets(const TypedData& offsets) const; |
| 3610 | 3616 |
| 3611 RawTypedData* kernel_string_data() const { | 3617 RawTypedData* kernel_string_data() const { |
| 3612 return raw_ptr()->kernel_string_data_; | 3618 return raw_ptr()->kernel_string_data_; |
| 3613 } | 3619 } |
| 3614 void set_kernel_string_data(const TypedData& data) const; | 3620 void set_kernel_string_data(const TypedData& data) const; |
| 3615 | 3621 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3833 // without a library prefix. | 3839 // without a library prefix. |
| 3834 RawObject* ResolveName(const String& name) const; | 3840 RawObject* ResolveName(const String& name) const; |
| 3835 | 3841 |
| 3836 void AddAnonymousClass(const Class& cls) const; | 3842 void AddAnonymousClass(const Class& cls) const; |
| 3837 | 3843 |
| 3838 void AddExport(const Namespace& ns) const; | 3844 void AddExport(const Namespace& ns) const; |
| 3839 | 3845 |
| 3840 void AddClassMetadata(const Class& cls, | 3846 void AddClassMetadata(const Class& cls, |
| 3841 const Object& tl_owner, | 3847 const Object& tl_owner, |
| 3842 TokenPosition token_pos, | 3848 TokenPosition token_pos, |
| 3843 kernel::TreeNode* kernel_node = NULL) const; | 3849 intptr_t kernel_offset = -1) const; |
| 3844 void AddFieldMetadata(const Field& field, | 3850 void AddFieldMetadata(const Field& field, |
| 3845 TokenPosition token_pos, | 3851 TokenPosition token_pos, |
| 3846 kernel::TreeNode* kernel_node = NULL) const; | 3852 intptr_t kernel_offset = -1) const; |
| 3847 void AddFunctionMetadata(const Function& func, | 3853 void AddFunctionMetadata(const Function& func, |
| 3848 TokenPosition token_pos, | 3854 TokenPosition token_pos, |
| 3849 kernel::TreeNode* kernel_node = NULL) const; | 3855 intptr_t kernel_offset = -1) const; |
| 3850 void AddLibraryMetadata(const Object& tl_owner, | 3856 void AddLibraryMetadata(const Object& tl_owner, |
| 3851 TokenPosition token_pos) const; | 3857 TokenPosition token_pos) const; |
| 3852 void AddTypeParameterMetadata(const TypeParameter& param, | 3858 void AddTypeParameterMetadata(const TypeParameter& param, |
| 3853 TokenPosition token_pos) const; | 3859 TokenPosition token_pos) const; |
| 3854 RawObject* GetMetadata(const Object& obj) const; | 3860 RawObject* GetMetadata(const Object& obj) const; |
| 3855 | 3861 |
| 3856 RawClass* toplevel_class() const { return raw_ptr()->toplevel_class_; } | 3862 RawClass* toplevel_class() const { return raw_ptr()->toplevel_class_; } |
| 3857 void set_toplevel_class(const Class& value) const; | 3863 void set_toplevel_class(const Class& value) const; |
| 3858 | 3864 |
| 3859 RawGrowableObjectArray* patch_classes() const { | 3865 RawGrowableObjectArray* patch_classes() const { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4008 static RawLibrary* NewLibraryHelper(const String& url, bool import_core_lib); | 4014 static RawLibrary* NewLibraryHelper(const String& url, bool import_core_lib); |
| 4009 RawObject* LookupEntry(const String& name, intptr_t* index) const; | 4015 RawObject* LookupEntry(const String& name, intptr_t* index) const; |
| 4010 | 4016 |
| 4011 void AllocatePrivateKey() const; | 4017 void AllocatePrivateKey() const; |
| 4012 | 4018 |
| 4013 RawString* MakeMetadataName(const Object& obj) const; | 4019 RawString* MakeMetadataName(const Object& obj) const; |
| 4014 RawField* GetMetadataField(const String& metaname) const; | 4020 RawField* GetMetadataField(const String& metaname) const; |
| 4015 void AddMetadata(const Object& owner, | 4021 void AddMetadata(const Object& owner, |
| 4016 const String& name, | 4022 const String& name, |
| 4017 TokenPosition token_pos, | 4023 TokenPosition token_pos, |
| 4018 kernel::TreeNode* kernel_node = NULL) const; | 4024 intptr_t kernel_offset = -1) const; |
| 4019 | 4025 |
| 4020 FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object); | 4026 FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object); |
| 4021 | 4027 |
| 4022 friend class Bootstrap; | 4028 friend class Bootstrap; |
| 4023 friend class Class; | 4029 friend class Class; |
| 4024 friend class Debugger; | 4030 friend class Debugger; |
| 4025 friend class DictionaryIterator; | 4031 friend class DictionaryIterator; |
| 4026 friend class Isolate; | 4032 friend class Isolate; |
| 4027 friend class LibraryDeserializationCluster; | 4033 friend class LibraryDeserializationCluster; |
| 4028 friend class Namespace; | 4034 friend class Namespace; |
| (...skipping 5024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9053 | 9059 |
| 9054 inline void TypeArguments::SetHash(intptr_t value) const { | 9060 inline void TypeArguments::SetHash(intptr_t value) const { |
| 9055 // This is only safe because we create a new Smi, which does not cause | 9061 // This is only safe because we create a new Smi, which does not cause |
| 9056 // heap allocation. | 9062 // heap allocation. |
| 9057 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 9063 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
| 9058 } | 9064 } |
| 9059 | 9065 |
| 9060 } // namespace dart | 9066 } // namespace dart |
| 9061 | 9067 |
| 9062 #endif // RUNTIME_VM_OBJECT_H_ | 9068 #endif // RUNTIME_VM_OBJECT_H_ |
| OLD | NEW |