Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index 0d5ca5f983668e6c7c36c8c1217a7d141046c4cf..4974f9c827f761eb31d4b25d7e4929ad98b612ee 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -7,6 +7,7 @@ |
#include "include/dart_api.h" |
#include "platform/assert.h" |
#include "vm/assembler.h" |
+#include "vm/become.h" |
#include "vm/cpu.h" |
#include "vm/bit_vector.h" |
#include "vm/bootstrap.h" |
@@ -562,6 +563,13 @@ void Object::InitOnce(Isolate* isolate) { |
cls.set_is_finalized(); |
cls.set_is_type_finalized(); |
+ // Allocate and initialize the forwarding corpse class. |
+ cls = Class::New<ForwardingCorpse::FakeInstance>(kForwardingCorpse); |
+ cls.set_num_type_arguments(0); |
+ cls.set_num_own_type_arguments(0); |
+ cls.set_is_finalized(); |
+ cls.set_is_type_finalized(); |
+ |
// Allocate and initialize the sentinel values of Null class. |
{ |
*sentinel_ ^= |
@@ -929,6 +937,8 @@ class PremarkingVisitor : public ObjectVisitor { |
void VisitObject(RawObject* obj) { |
// Free list elements should never be marked. |
ASSERT(!obj->IsMarked()); |
+ // No forwarding corpses in the VM isolate. |
+ ASSERT(!obj->IsForwardingCorpse()); |
if (!obj->IsFreeListElement()) { |
ASSERT(obj->IsVMHeapObject()); |
obj->SetMarkBitUnsynchronized(); |
@@ -1000,6 +1010,13 @@ void Object::FinalizeVMIsolate(Isolate* isolate) { |
cls = isolate->object_store()->one_byte_string_class(); |
cls.set_name(Symbols::OneByteString()); |
+ // Set up names for the pseudo-classes for free list elements and forwarding |
+ // corpses. Mainly this makes VM debugging easier. |
+ cls = isolate->class_table()->At(kFreeListElement); |
+ cls.set_name(Symbols::FreeListElement()); |
+ cls = isolate->class_table()->At(kForwardingCorpse); |
+ cls.set_name(Symbols::ForwardingCorpse()); |
+ |
{ |
ASSERT(isolate == Dart::vm_isolate()); |
WritableVMIsolateScope scope(Thread::Current()); |
@@ -1080,6 +1097,7 @@ void Object::VerifyBuiltinVtables() { |
} |
} |
ASSERT(builtin_vtables_[kFreeListElement] == 0); |
+ ASSERT(builtin_vtables_[kForwardingCorpse] == 0); |
#endif |
} |
@@ -1916,8 +1934,6 @@ RawObject* Object::Clone(const Object& orig, Heap::Space space) { |
RawString* Class::Name() const { |
- // TODO(turnidge): This assert fails for the fake kFreeListElement class. |
- // Fix this. |
ASSERT(raw_ptr()->name_ != String::null()); |
return raw_ptr()->name_; |
} |