| 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 3107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3118 void set_has_initializer(bool has_initializer) const { | 3118 void set_has_initializer(bool has_initializer) const { |
| 3119 ASSERT(IsOriginal()); | 3119 ASSERT(IsOriginal()); |
| 3120 ASSERT(Thread::Current()->IsMutatorThread()); | 3120 ASSERT(Thread::Current()->IsMutatorThread()); |
| 3121 set_kind_bits(HasInitializerBit::update(has_initializer, | 3121 set_kind_bits(HasInitializerBit::update(has_initializer, |
| 3122 raw_ptr()->kind_bits_)); | 3122 raw_ptr()->kind_bits_)); |
| 3123 } | 3123 } |
| 3124 | 3124 |
| 3125 // Return class id that any non-null value read from this field is guaranteed | 3125 // Return class id that any non-null value read from this field is guaranteed |
| 3126 // to have or kDynamicCid if such class id is not known. | 3126 // to have or kDynamicCid if such class id is not known. |
| 3127 // Stores to this field must update this information hence the name. | 3127 // Stores to this field must update this information hence the name. |
| 3128 intptr_t guarded_cid() const { return raw_ptr()->guarded_cid_; } | 3128 intptr_t guarded_cid() const { |
| 3129 #if defined(DEGUG) |
| 3130 Thread* thread = Thread::Current(); |
| 3131 ASSERT(!IsOriginal() || thread->IsMutator() || thread->IsAtSafepoint()); |
| 3132 #endif |
| 3133 return raw_ptr()->guarded_cid_; |
| 3134 } |
| 3129 | 3135 |
| 3130 void set_guarded_cid(intptr_t cid) const { | 3136 void set_guarded_cid(intptr_t cid) const { |
| 3131 ASSERT(Thread::Current()->IsMutatorThread()); | 3137 #if defined(DEGUG) |
| 3138 Thread* thread = Thread::Current(); |
| 3139 ASSERT(!IsOriginal() || thread->IsMutator() || thread->IsAtSafepoint()); |
| 3140 #endif |
| 3132 StoreNonPointer(&raw_ptr()->guarded_cid_, cid); | 3141 StoreNonPointer(&raw_ptr()->guarded_cid_, cid); |
| 3133 } | 3142 } |
| 3134 static intptr_t guarded_cid_offset() { | 3143 static intptr_t guarded_cid_offset() { |
| 3135 return OFFSET_OF(RawField, guarded_cid_); | 3144 return OFFSET_OF(RawField, guarded_cid_); |
| 3136 } | 3145 } |
| 3137 // Return the list length that any list stored in this field is guaranteed | 3146 // Return the list length that any list stored in this field is guaranteed |
| 3138 // to have. If length is kUnknownFixedLength the length has not | 3147 // to have. If length is kUnknownFixedLength the length has not |
| 3139 // been determined. If length is kNoFixedLength this field has multiple | 3148 // been determined. If length is kNoFixedLength this field has multiple |
| 3140 // list lengths associated with it and cannot be predicted. | 3149 // list lengths associated with it and cannot be predicted. |
| 3141 intptr_t guarded_list_length() const; | 3150 intptr_t guarded_list_length() const; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3206 // Code objects are held weakly via an indirection through WeakProperty. | 3215 // Code objects are held weakly via an indirection through WeakProperty. |
| 3207 RawArray* dependent_code() const; | 3216 RawArray* dependent_code() const; |
| 3208 void set_dependent_code(const Array& array) const; | 3217 void set_dependent_code(const Array& array) const; |
| 3209 | 3218 |
| 3210 // Add the given code object to the list of dependent ones. | 3219 // Add the given code object to the list of dependent ones. |
| 3211 void RegisterDependentCode(const Code& code) const; | 3220 void RegisterDependentCode(const Code& code) const; |
| 3212 | 3221 |
| 3213 // Deoptimize all dependent code objects. | 3222 // Deoptimize all dependent code objects. |
| 3214 void DeoptimizeDependentCode() const; | 3223 void DeoptimizeDependentCode() const; |
| 3215 | 3224 |
| 3225 // Used by background compiler to check consistency of field copy with its |
| 3226 // original. |
| 3227 bool IsConsistentWith(const Field& field) const; |
| 3228 |
| 3216 bool IsUninitialized() const; | 3229 bool IsUninitialized() const; |
| 3217 | 3230 |
| 3218 void EvaluateInitializer() const; | 3231 void EvaluateInitializer() const; |
| 3219 | 3232 |
| 3220 RawFunction* PrecompiledInitializer() const { | 3233 RawFunction* PrecompiledInitializer() const { |
| 3221 return raw_ptr()->initializer_.precompiled_; | 3234 return raw_ptr()->initializer_.precompiled_; |
| 3222 } | 3235 } |
| 3223 void SetPrecompiledInitializer(const Function& initializer) const; | 3236 void SetPrecompiledInitializer(const Function& initializer) const; |
| 3224 bool HasPrecompiledInitializer() const; | 3237 bool HasPrecompiledInitializer() const; |
| 3225 | 3238 |
| (...skipping 5469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8695 | 8708 |
| 8696 inline void TypeArguments::SetHash(intptr_t value) const { | 8709 inline void TypeArguments::SetHash(intptr_t value) const { |
| 8697 // This is only safe because we create a new Smi, which does not cause | 8710 // This is only safe because we create a new Smi, which does not cause |
| 8698 // heap allocation. | 8711 // heap allocation. |
| 8699 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8712 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
| 8700 } | 8713 } |
| 8701 | 8714 |
| 8702 } // namespace dart | 8715 } // namespace dart |
| 8703 | 8716 |
| 8704 #endif // VM_OBJECT_H_ | 8717 #endif // VM_OBJECT_H_ |
| OLD | NEW |