| Index: vm/raw_object.h
|
| ===================================================================
|
| --- vm/raw_object.h (revision 2393)
|
| +++ vm/raw_object.h (working copy)
|
| @@ -101,6 +101,24 @@
|
| kSmiTagShift = 1,
|
| };
|
|
|
| +
|
| +/*
|
| + * The tags field which is a part of the object header uses the following
|
| + * bit fields for storing tags.
|
| + *
|
| + * bit 0 - SmiTag
|
| + * bit 1 - Mark bit.
|
| + * bit 2 - Canonical object.
|
| + * bit 3 - Created from a full snapshot.
|
| + */
|
| +class CanonicalObjectTag : public BitField<bool, 2, 1> {
|
| +};
|
| +
|
| +
|
| +class CreatedFromSnapshotTag : public BitField<bool, 3, 1> {
|
| +};
|
| +
|
| +
|
| #define SNAPSHOT_WRITER_SUPPORT() \
|
| void WriteTo( \
|
| SnapshotWriter* writer, intptr_t object_id, Snapshot::Kind kind); \
|
| @@ -166,6 +184,22 @@
|
| ptr()->class_ = reinterpret_cast<RawClass*>(header_bits ^ kMarked);
|
| }
|
|
|
| + // Support for object tags.
|
| + bool IsCanonical() const {
|
| + return CanonicalObjectTag::decode(ptr()->tags_);
|
| + }
|
| + void SetCanonical() {
|
| + intptr_t tags = ptr()->tags_;
|
| + ptr()->tags_ = CanonicalObjectTag::update(true, tags);
|
| + }
|
| + bool IsCreatedFromSnapshot() {
|
| + return CreatedFromSnapshotTag::decode(ptr()->tags_);
|
| + }
|
| + void SetCreatedFromSnapshot() {
|
| + intptr_t tags = ptr()->tags_;
|
| + ptr()->tags_ = CreatedFromSnapshotTag::update(true, tags);
|
| + }
|
| +
|
| void Validate() const;
|
| intptr_t Size() const;
|
| intptr_t VisitPointers(ObjectPointerVisitor* visitor);
|
| @@ -180,8 +214,17 @@
|
| return reinterpret_cast<uword>(raw_obj->ptr());
|
| }
|
|
|
| + static bool IsCreatedFromSnapshot(intptr_t value) {
|
| + return CreatedFromSnapshotTag::decode(value);
|
| + }
|
| +
|
| + static bool IsCanonical(intptr_t value) {
|
| + return CanonicalObjectTag::decode(value);
|
| + }
|
| +
|
| protected:
|
| RawClass* class_;
|
| + intptr_t tags_; // Various object tags (bits).
|
|
|
| private:
|
| enum {
|
| @@ -196,8 +239,6 @@
|
| reinterpret_cast<uword>(this) - kHeapObjectTag);
|
| }
|
|
|
| - intptr_t tags_; // Various object tags (bits).
|
| -
|
| friend class Object;
|
| friend class Array;
|
| friend class SnapshotWriter;
|
| @@ -343,7 +384,6 @@
|
| RawObject** from() {
|
| return reinterpret_cast<RawObject**>(&ptr()->length_);
|
| }
|
| - bool is_canonical_;
|
| RawSmi* length_;
|
|
|
| // Variable length data follows here.
|
|
|