| 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_RAW_OBJECT_H_ | 5 #ifndef VM_RAW_OBJECT_H_ |
| 6 #define VM_RAW_OBJECT_H_ | 6 #define VM_RAW_OBJECT_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/atomic.h" | 9 #include "vm/atomic.h" |
| 10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 return MarkBit::decode(ptr()->tags_); | 323 return MarkBit::decode(ptr()->tags_); |
| 324 } | 324 } |
| 325 void SetMarkBit() { | 325 void SetMarkBit() { |
| 326 ASSERT(!IsMarked()); | 326 ASSERT(!IsMarked()); |
| 327 uword tags = ptr()->tags_; | 327 uword tags = ptr()->tags_; |
| 328 ptr()->tags_ = MarkBit::update(true, tags); | 328 ptr()->tags_ = MarkBit::update(true, tags); |
| 329 } | 329 } |
| 330 void ClearMarkBit() { | 330 void ClearMarkBit() { |
| 331 ASSERT(IsMarked()); | 331 ASSERT(IsMarked()); |
| 332 uword tags = ptr()->tags_; | 332 uword tags = ptr()->tags_; |
| 333 uword old_tags; | 333 ptr()->tags_ = MarkBit::update(false, tags); |
| 334 do { | |
| 335 old_tags = tags; | |
| 336 uword new_tags = MarkBit::update(false, old_tags); | |
| 337 tags = AtomicOperations::CompareAndSwapWord( | |
| 338 &ptr()->tags_, old_tags, new_tags); | |
| 339 } while (tags != old_tags); | |
| 340 } | 334 } |
| 341 | 335 |
| 342 // Support for GC watched bit. | 336 // Support for GC watched bit. |
| 343 bool IsWatched() const { | 337 bool IsWatched() const { |
| 344 return WatchedBit::decode(ptr()->tags_); | 338 return WatchedBit::decode(ptr()->tags_); |
| 345 } | 339 } |
| 346 void SetWatchedBit() { | 340 void SetWatchedBit() { |
| 347 ASSERT(!IsWatched()); | 341 ASSERT(!IsWatched()); |
| 348 uword tags = ptr()->tags_; | 342 uword tags = ptr()->tags_; |
| 349 ptr()->tags_ = WatchedBit::update(true, tags); | 343 ptr()->tags_ = WatchedBit::update(true, tags); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 } while (tags != old_tags); | 376 } while (tags != old_tags); |
| 383 } | 377 } |
| 384 | 378 |
| 385 // Support for GC remembered bit. | 379 // Support for GC remembered bit. |
| 386 bool IsRemembered() const { | 380 bool IsRemembered() const { |
| 387 return RememberedBit::decode(ptr()->tags_); | 381 return RememberedBit::decode(ptr()->tags_); |
| 388 } | 382 } |
| 389 void SetRememberedBit() { | 383 void SetRememberedBit() { |
| 390 ASSERT(!IsRemembered()); | 384 ASSERT(!IsRemembered()); |
| 391 uword tags = ptr()->tags_; | 385 uword tags = ptr()->tags_; |
| 392 uword old_tags; | 386 ptr()->tags_ = RememberedBit::update(true, tags); |
| 393 do { | |
| 394 old_tags = tags; | |
| 395 uword new_tags = RememberedBit::update(true, old_tags); | |
| 396 tags = AtomicOperations::CompareAndSwapWord( | |
| 397 &ptr()->tags_, old_tags, new_tags); | |
| 398 } while (tags != old_tags); | |
| 399 } | 387 } |
| 400 void ClearRememberedBit() { | 388 void ClearRememberedBit() { |
| 401 uword tags = ptr()->tags_; | 389 uword tags = ptr()->tags_; |
| 402 uword old_tags; | 390 ptr()->tags_ = RememberedBit::update(false, tags); |
| 403 do { | |
| 404 old_tags = tags; | |
| 405 uword new_tags = RememberedBit::update(false, old_tags); | |
| 406 tags = AtomicOperations::CompareAndSwapWord( | |
| 407 &ptr()->tags_, old_tags, new_tags); | |
| 408 } while (tags != old_tags); | |
| 409 } | 391 } |
| 410 | 392 |
| 411 bool IsDartInstance() { | 393 bool IsDartInstance() { |
| 412 return (!IsHeapObject() || (GetClassId() >= kInstanceCid)); | 394 return (!IsHeapObject() || (GetClassId() >= kInstanceCid)); |
| 413 } | 395 } |
| 414 bool IsFreeListElement() { | 396 bool IsFreeListElement() { |
| 415 return ((GetClassId() == kFreeListElement)); | 397 return ((GetClassId() == kFreeListElement)); |
| 416 } | 398 } |
| 417 | 399 |
| 418 intptr_t Size() const { | 400 intptr_t Size() const { |
| (...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2028 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2010 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
| 2029 kTypedDataInt8ArrayViewCid + 15); | 2011 kTypedDataInt8ArrayViewCid + 15); |
| 2030 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2012 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
| 2031 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2013 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
| 2032 return (kNullCid - kTypedDataInt8ArrayCid); | 2014 return (kNullCid - kTypedDataInt8ArrayCid); |
| 2033 } | 2015 } |
| 2034 | 2016 |
| 2035 } // namespace dart | 2017 } // namespace dart |
| 2036 | 2018 |
| 2037 #endif // VM_RAW_OBJECT_H_ | 2019 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |