Index: src/layout-descriptor.cc |
diff --git a/src/layout-descriptor.cc b/src/layout-descriptor.cc |
index 70380ce1921eb567c8d5bd8b4e8d20308bfce67c..b9016472cd753a135674da63d3b75776e6f29313 100644 |
--- a/src/layout-descriptor.cc |
+++ b/src/layout-descriptor.cc |
@@ -256,5 +256,28 @@ bool LayoutDescriptorHelper::IsTagged( |
DCHECK(offset_in_bytes < *out_end_of_contiguous_region_offset); |
return tagged; |
} |
+ |
+ |
+#ifdef VERIFY_HEAP |
+bool LayoutDescriptor::IsConsistentWithMap(Map* map) { |
+ if (FLAG_unbox_double_fields) { |
+ DescriptorArray* descriptors = map->instance_descriptors(); |
+ int nof_descriptors = map->NumberOfOwnDescriptors(); |
+ for (int i = 0; i < nof_descriptors; i++) { |
+ PropertyDetails details = descriptors->GetDetails(i); |
+ if (details.type() != DATA) continue; |
+ FieldIndex field_index = FieldIndex::ForDescriptor(map, i); |
+ bool tagged_expected = |
+ !field_index.is_inobject() || !details.representation().IsDouble(); |
+ for (int bit = 0; bit < details.field_width_in_words(); bit++) { |
+ bool tagged_actual = IsTagged(details.field_index() + bit); |
+ DCHECK_EQ(tagged_expected, tagged_actual); |
+ if (tagged_actual != tagged_expected) return false; |
+ } |
+ } |
+ } |
+ return true; |
+} |
+#endif |
} |
} // namespace v8::internal |