Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: runtime/vm/object.h

Issue 2006793002: VM: Fix race between background compiler and guarded cid update. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/jit_optimizer.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 {
Florian Schneider 2016/05/23 19:26:32 Add the same assert as for guarded_cid()?
Vyacheslav Egorov (Google) 2016/05/24 10:57:49 Done.
3131 ASSERT(Thread::Current()->IsMutatorThread());
3132 StoreNonPointer(&raw_ptr()->guarded_cid_, cid); 3137 StoreNonPointer(&raw_ptr()->guarded_cid_, cid);
3133 } 3138 }
3134 static intptr_t guarded_cid_offset() { 3139 static intptr_t guarded_cid_offset() {
3135 return OFFSET_OF(RawField, guarded_cid_); 3140 return OFFSET_OF(RawField, guarded_cid_);
3136 } 3141 }
3137 // Return the list length that any list stored in this field is guaranteed 3142 // Return the list length that any list stored in this field is guaranteed
3138 // to have. If length is kUnknownFixedLength the length has not 3143 // to have. If length is kUnknownFixedLength the length has not
3139 // been determined. If length is kNoFixedLength this field has multiple 3144 // been determined. If length is kNoFixedLength this field has multiple
3140 // list lengths associated with it and cannot be predicted. 3145 // list lengths associated with it and cannot be predicted.
3141 intptr_t guarded_list_length() const; 3146 intptr_t guarded_list_length() const;
(...skipping 5553 matching lines...) Expand 10 before | Expand all | Expand 10 after
8695 8700
8696 inline void TypeArguments::SetHash(intptr_t value) const { 8701 inline void TypeArguments::SetHash(intptr_t value) const {
8697 // This is only safe because we create a new Smi, which does not cause 8702 // This is only safe because we create a new Smi, which does not cause
8698 // heap allocation. 8703 // heap allocation.
8699 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 8704 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
8700 } 8705 }
8701 8706
8702 } // namespace dart 8707 } // namespace dart
8703 8708
8704 #endif // VM_OBJECT_H_ 8709 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/jit_optimizer.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698