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

Unified Diff: runtime/vm/object.h

Issue 2160953002: Add a verification step which iterates over the heap and verifies that all canonical objects are co… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address code review comments. Created 4 years, 5 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
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 082e6aa3e8e0050c4e5e16782ffb94716f504ecd..913e7d27a1df84d244d43dd12e22899e0420b74c 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -5245,6 +5245,11 @@ class Instance : public Object {
virtual bool CheckAndCanonicalizeFields(Thread* thread,
const char** error_str) const;
+#if defined(DEBUG)
+ // Check if instance is canonical.
+ virtual bool CheckIsCanonical(Thread* thread) const;
+#endif // DEBUG
+
RawObject* GetField(const Field& field) const {
return *FieldAddr(field);
}
@@ -5479,6 +5484,14 @@ class AbstractType : public Instance {
// Return the canonical version of this type.
virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const;
+#if defined(DEBUG)
+ // Check if abstract type is canonical.
+ virtual bool CheckIsCanonical(Thread* thread) const {
+ UNREACHABLE();
+ return false;
+ }
+#endif // DEBUG
+
// Return the object associated with the receiver in the trail or
// AbstractType::null() if the receiver is not contained in the trail.
RawAbstractType* OnlyBuddyInTrail(TrailPtr trail) const;
@@ -5670,6 +5683,10 @@ class Type : public AbstractType {
const Class& new_owner,
TrailPtr trail = NULL) const;
virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const;
+#if defined(DEBUG)
+ // Check if type is canonical.
+ virtual bool CheckIsCanonical(Thread* thread) const;
+#endif // DEBUG
virtual RawString* EnumerateURIs() const;
virtual intptr_t Hash() const;
@@ -5798,6 +5815,10 @@ class TypeRef : public AbstractType {
const Class& new_owner,
TrailPtr trail = NULL) const;
virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const;
+#if defined(DEBUG)
+ // Check if typeref is canonical.
+ virtual bool CheckIsCanonical(Thread* thread) const;
+#endif // DEBUG
virtual RawString* EnumerateURIs() const;
virtual intptr_t Hash() const;
@@ -5873,6 +5894,12 @@ class TypeParameter : public AbstractType {
virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const {
return raw();
}
+#if defined(DEBUG)
+ // Check if type parameter is canonical.
+ virtual bool CheckIsCanonical(Thread* thread) const {
+ return true;
+ }
+#endif // DEBUG
virtual RawString* EnumerateURIs() const;
virtual intptr_t Hash() const;
@@ -5963,6 +5990,12 @@ class BoundedType : public AbstractType {
virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const {
return raw();
}
+#if defined(DEBUG)
+ // Check if bounded type is canonical.
+ virtual bool CheckIsCanonical(Thread* thread) const {
+ return true;
+ }
+#endif // DEBUG
virtual RawString* EnumerateURIs() const;
virtual intptr_t Hash() const;
@@ -6051,6 +6084,11 @@ class Number : public Instance {
virtual RawInstance* CheckAndCanonicalize(Thread* thread,
const char** error_str) const;
+#if defined(DEBUG)
+ // Check if number is canonical.
+ virtual bool CheckIsCanonical(Thread* thread) const;
+#endif // DEBUG
+
private:
OBJECT_IMPLEMENTATION(Number, Instance);
@@ -6527,6 +6565,11 @@ class String : public Instance {
virtual RawInstance* CheckAndCanonicalize(Thread* thread,
const char** error_str) const;
+#if defined(DEBUG)
+ // Check if string is canonical.
+ virtual bool CheckIsCanonical(Thread* thread) const;
+#endif // DEBUG
+
bool IsSymbol() const { return raw()->IsCanonical(); }
bool IsOneByteString() const {
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698