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

Unified Diff: vm/raw_object.cc

Issue 8898034: - Implement the old sweeper. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years 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
« no previous file with comments | « vm/raw_object.h ('k') | vm/verifier.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/raw_object.cc
===================================================================
--- vm/raw_object.cc (revision 2478)
+++ vm/raw_object.cc (working copy)
@@ -4,6 +4,7 @@
#include "vm/raw_object.h"
+#include "vm/freelist.h"
#include "vm/isolate.h"
#include "vm/object.h"
#include "vm/visitor.h"
@@ -32,9 +33,18 @@
ASSERT(IsHeapObject());
RawClass* raw_class = ptr()->class_;
+ if (IsMarked()) {
+ // If the object is marked we need to remove the marking bits from the
+ // raw_class which we loaded above.
+ uword header_bits = reinterpret_cast<uword>(raw_class);
+ header_bits = (header_bits & ~kMarkingMask) | kNotMarked;
+ raw_class = reinterpret_cast<RawClass*>(header_bits);
+ }
intptr_t instance_size = raw_class->ptr()->instance_size_;
+ ObjectKind instance_kind = raw_class->ptr()->instance_kind_;
+
if (instance_size == 0) {
- switch (raw_class->ptr()->instance_kind_) {
+ switch (instance_kind) {
case kTokenStream: {
const RawTokenStream* raw_tokens =
reinterpret_cast<const RawTokenStream*>(this);
@@ -174,6 +184,13 @@
}
CLASS_LIST_NO_OBJECT(RAW_VISITPOINTERS)
#undef RAW_VISITPOINTERS
+ case kFreeListElement: {
+ // Nothing to visit for free list elements.
+ uword addr = RawObject::ToAddr(this);
+ FreeListElement* element = reinterpret_cast<FreeListElement*>(addr);
+ size = element->Size();
+ break;
+ }
default:
OS::Print("Kind: %d\n", kind);
UNREACHABLE();
« no previous file with comments | « vm/raw_object.h ('k') | vm/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698