| 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/globals.h" | 9 #include "vm/globals.h" |
| 10 #include "vm/token.h" | 10 #include "vm/token.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 253 } |
| 254 | 254 |
| 255 bool IsNewObject() const { | 255 bool IsNewObject() const { |
| 256 uword addr = reinterpret_cast<uword>(this); | 256 uword addr = reinterpret_cast<uword>(this); |
| 257 return (addr & kNewObjectAlignmentOffset) == kNewObjectAlignmentOffset; | 257 return (addr & kNewObjectAlignmentOffset) == kNewObjectAlignmentOffset; |
| 258 } | 258 } |
| 259 bool IsOldObject() const { | 259 bool IsOldObject() const { |
| 260 uword addr = reinterpret_cast<uword>(this); | 260 uword addr = reinterpret_cast<uword>(this); |
| 261 return (addr & kNewObjectAlignmentOffset) == kOldObjectAlignmentOffset; | 261 return (addr & kNewObjectAlignmentOffset) == kOldObjectAlignmentOffset; |
| 262 } | 262 } |
| 263 bool IsVMHeapObject() const { |
| 264 // TODO(asiva): Need a better way to represent VM heap objects, for |
| 265 // now we use the premarked property for identifying objects in the |
| 266 // VM heap. |
| 267 ASSERT(IsHeapObject()); |
| 268 return IsMarked(); |
| 269 } |
| 263 | 270 |
| 264 // Support for GC marking bit. | 271 // Support for GC marking bit. |
| 265 bool IsMarked() const { | 272 bool IsMarked() const { |
| 266 return MarkBit::decode(ptr()->tags_); | 273 return MarkBit::decode(ptr()->tags_); |
| 267 } | 274 } |
| 268 void SetMarkBit() { | 275 void SetMarkBit() { |
| 269 ASSERT(!IsMarked()); | 276 ASSERT(!IsMarked()); |
| 270 uword tags = ptr()->tags_; | 277 uword tags = ptr()->tags_; |
| 271 ptr()->tags_ = MarkBit::update(true, tags); | 278 ptr()->tags_ = MarkBit::update(true, tags); |
| 272 } | 279 } |
| (...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1685 kExternalUint64ArrayCid == kExternalInt8ArrayCid + 8 && | 1692 kExternalUint64ArrayCid == kExternalInt8ArrayCid + 8 && |
| 1686 kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 9 && | 1693 kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 9 && |
| 1687 kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 10 && | 1694 kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 10 && |
| 1688 kStacktraceCid == kExternalInt8ArrayCid + 11); | 1695 kStacktraceCid == kExternalInt8ArrayCid + 11); |
| 1689 return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid); | 1696 return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid); |
| 1690 } | 1697 } |
| 1691 | 1698 |
| 1692 } // namespace dart | 1699 } // namespace dart |
| 1693 | 1700 |
| 1694 #endif // VM_RAW_OBJECT_H_ | 1701 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |