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

Unified Diff: runtime/vm/raw_object.cc

Issue 792163003: Deletion barrier preparation: validate overwritten references. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
Index: runtime/vm/raw_object.cc
===================================================================
--- runtime/vm/raw_object.cc (revision 42249)
+++ runtime/vm/raw_object.cc (working copy)
@@ -14,6 +14,9 @@
namespace dart {
+#if defined(DEBUG)
+DEFINE_FLAG(bool, validate_overwrite, true, "Verify overwritten fields.");
+#endif // DEBUG
const intptr_t RawPcDescriptors::kFullRecSize =
sizeof(RawPcDescriptors::PcDescriptorRec);
@@ -35,6 +38,10 @@
if (!IsHeapObject()) {
return;
}
+ // Slightly more readable than a segfault.
+ if (this == reinterpret_cast<RawObject*>(kHeapObjectTag)) {
+ FATAL("RAW_NULL encountered");
+ }
// Validate that the tags_ field is sensible.
uword tags = ptr()->tags_;
intptr_t reserved = ReservedBits::decode(tags);
@@ -45,6 +52,10 @@
if (!isolate->class_table()->IsValidIndex(class_id)) {
FATAL1("Invalid class id encountered %" Pd "\n", class_id);
}
+ if (class_id == kNullCid && isolate->class_table()->At(class_id) == NULL) {
Ivan Posva 2015/01/02 17:09:39 ()
koda 2015/01/02 17:30:53 Done.
+ // Null class not yet initialized; skip.
+ return;
+ }
intptr_t size = SizeTag::decode(tags);
if (size != 0 && size != SizeFromClass()) {
FATAL1("Inconsistent class size encountered %" Pd "\n", size);
@@ -200,6 +211,22 @@
}
+#if defined(DEBUG)
+void RawObject::ValidateOverwrittenPointer(RawObject* raw) {
+ if (FLAG_validate_overwrite) {
+ raw->Validate(Isolate::Current());
+ }
+}
+
+
+void RawObject::ValidateOverwrittenSmi(RawSmi* raw) {
+ if (FLAG_validate_overwrite && raw->IsHeapObject() && raw != Object::null()) {
+ FATAL1("Expected smi/null, found: %" Px "\n", reinterpret_cast<uword>(raw));
+ }
+}
+#endif // DEBUG
+
+
intptr_t RawObject::VisitPointers(ObjectPointerVisitor* visitor) {
intptr_t size = 0;
NoHandleScope no_handles(visitor->isolate());
« runtime/vm/pages.cc ('K') | « runtime/vm/raw_object.h ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698