Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: vm/freelist.h

Issue 9072011: - Add a size field to the header. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 8 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 {

Powered by Google App Engine
This is Rietveld 408576698