Chromium Code Reviews| Index: vm/freelist.h |
| =================================================================== |
| --- vm/freelist.h (revision 2918) |
| +++ vm/freelist.h (working copy) |
| @@ -20,8 +20,17 @@ |
| // the address following the next_ field. |
| class FreeListElement { |
| public: |
| - FreeListElement* next() const { return next_; } |
| - void set_next(FreeListElement* next) { next_ = next; } |
| + FreeListElement* next() const { |
| + // Clear the FreeBit. |
| + ASSERT((next_ & 1) == 1); |
| + return reinterpret_cast<FreeListElement*>(next_ ^ 1); |
|
turnidge
2012/01/04 01:06:17
Should this use the constant RawObject::kFreeBit?
Ivan Posva
2012/01/04 07:59:42
Done. In any case this use here should only be tem
|
| + } |
| + void set_next(FreeListElement* next) { |
| + // Set the FreeBit. |
| + uword addr = reinterpret_cast<uword>(next); |
| + ASSERT((addr & 1) == 0); |
| + next_ = addr | 1; |
|
turnidge
2012/01/04 01:06:17
Same as above.
Ivan Posva
2012/01/04 07:59:42
ditto.
|
| + } |
| intptr_t Size() const { |
| if (class_ == minimal_element_class_) { |
| @@ -42,7 +51,7 @@ |
| private: |
| // This layout mirrors the layout of RawObject. |
| RawClass* class_; |
| - FreeListElement* next_; |
| + uword next_; |
| // Returns the address of the embedded size. |
| intptr_t* SizeAddress() const { |