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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 class Object { | 223 class Object { |
| 224 public: | 224 public: |
| 225 virtual ~Object() { } | 225 virtual ~Object() { } |
| 226 | 226 |
| 227 RawObject* raw() const { return raw_; } | 227 RawObject* raw() const { return raw_; } |
| 228 void operator=(RawObject* value) { | 228 void operator=(RawObject* value) { |
| 229 initializeHandle(this, value); | 229 initializeHandle(this, value); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void set_tags(intptr_t value) const { | 232 void set_tags(intptr_t value) const { |
| 233 ASSERT(!IsNull()); | |
| 233 // TODO(asiva): Remove the capability of setting tags in general. The mask | 234 // TODO(asiva): Remove the capability of setting tags in general. The mask |
| 234 // here only allows for canonical and from_snapshot flags to be set. | 235 // here only allows for canonical and from_snapshot flags to be set. |
|
koda
2014/09/02 04:18:31
Before masking (i.e., ignoring part of the input..
| |
| 235 ASSERT(!IsNull()); | 236 value = value & 0x0000000c; |
| 236 uword tags = raw()->ptr()->tags_ & ~0x0000000c; | 237 uword tags = raw()->ptr()->tags_; |
| 237 raw()->ptr()->tags_ = tags | (value & 0x0000000c); | 238 uword old_tags; |
| 239 do { | |
| 240 old_tags = tags; | |
| 241 uword new_tags = (old_tags & ~0x0000000c) | value; | |
| 242 tags = AtomicOperations::CompareAndSwapWord( | |
| 243 &raw()->ptr()->tags_, old_tags, new_tags); | |
| 244 } while (tags != old_tags); | |
| 238 } | 245 } |
| 239 void SetCreatedFromSnapshot() const { | 246 void SetCreatedFromSnapshot() const { |
| 240 ASSERT(!IsNull()); | 247 ASSERT(!IsNull()); |
| 241 raw()->SetCreatedFromSnapshot(); | 248 raw()->SetCreatedFromSnapshot(); |
| 242 } | 249 } |
| 243 bool IsCanonical() const { | 250 bool IsCanonical() const { |
| 244 ASSERT(!IsNull()); | 251 ASSERT(!IsNull()); |
| 245 return raw()->IsCanonical(); | 252 return raw()->IsCanonical(); |
| 246 } | 253 } |
| 247 void SetCanonical() const { | 254 void SetCanonical() const { |
| (...skipping 7161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7409 | 7416 |
| 7410 | 7417 |
| 7411 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7418 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 7412 intptr_t index) { | 7419 intptr_t index) { |
| 7413 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7420 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 7414 } | 7421 } |
| 7415 | 7422 |
| 7416 } // namespace dart | 7423 } // namespace dart |
| 7417 | 7424 |
| 7418 #endif // VM_OBJECT_H_ | 7425 #endif // VM_OBJECT_H_ |
| OLD | NEW |