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

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_ & RawObject::kFreeBit) == 1);
+ return reinterpret_cast<FreeListElement*>(next_ ^ RawObject::kFreeBit);
+ }
+ void set_next(FreeListElement* next) {
+ // Set the FreeBit.
+ uword addr = reinterpret_cast<uword>(next);
+ ASSERT((addr & RawObject::kFreeBit) == 0);
+ next_ = addr | RawObject::kFreeBit;
+ }
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 {
« no previous file with comments | « vm/assembler_macros_x64.cc ('k') | vm/intrinsifier_ia32.cc » ('j') | vm/stub_code_x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698