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

Unified Diff: src/objects-debug.cc

Issue 980573002: Simplify and compact transitions storage (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix -Werror=pedantic ( rebase Created 5 years, 10 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 | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-debug.cc
diff --git a/src/objects-debug.cc b/src/objects-debug.cc
index 78a07c737e41a2553c1052c2e55a38ee002f073f..b6353314b22c8695cbfa1d63350f27d11d4c1558 100644
--- a/src/objects-debug.cc
+++ b/src/objects-debug.cc
@@ -320,10 +320,8 @@ void Map::MapVerify() {
VerifyHeapPointer(prototype());
VerifyHeapPointer(instance_descriptors());
SLOW_DCHECK(instance_descriptors()->IsSortedNoDuplicates());
- if (HasTransitionArray()) {
- SLOW_DCHECK(transitions()->IsSortedNoDuplicates());
- SLOW_DCHECK(transitions()->IsConsistentWithBackPointers(this));
- }
+ SLOW_DCHECK(TransitionArray::IsSortedNoDuplicates(this));
+ SLOW_DCHECK(TransitionArray::IsConsistentWithBackPointers(this));
// TODO(ishell): turn it back to SLOW_DCHECK.
CHECK(!FLAG_unbox_double_fields ||
layout_descriptor()->IsConsistentWithMap(this));
@@ -344,7 +342,6 @@ void Map::VerifyOmittedMapChecks() {
if (!FLAG_omit_map_checks_for_leaf_maps) return;
if (!is_stable() ||
is_deprecated() ||
- HasTransitionArray() ||
is_dictionary_map()) {
CHECK_EQ(0, dependent_code()->number_of_entries(
DependentCode::kPrototypeCheckGroup));
@@ -1208,14 +1205,28 @@ bool TransitionArray::IsSortedNoDuplicates(int valid_entries) {
}
+// static
+bool TransitionArray::IsSortedNoDuplicates(Map* map) {
+ Object* raw_transitions = map->raw_transitions();
+ if (IsFullTransitionArray(raw_transitions)) {
+ return TransitionArray::cast(raw_transitions)->IsSortedNoDuplicates();
+ }
+ // Simple and non-existent transitions are always sorted.
+ return true;
+}
+
+
static bool CheckOneBackPointer(Map* current_map, Object* target) {
return !target->IsMap() || Map::cast(target)->GetBackPointer() == current_map;
}
-bool TransitionArray::IsConsistentWithBackPointers(Map* current_map) {
- for (int i = 0; i < number_of_transitions(); ++i) {
- if (!CheckOneBackPointer(current_map, GetTarget(i))) return false;
+// static
+bool TransitionArray::IsConsistentWithBackPointers(Map* map) {
+ Object* transitions = map->raw_transitions();
+ for (int i = 0; i < TransitionArray::NumberOfTransitions(transitions); ++i) {
+ Map* target = TransitionArray::GetTarget(transitions, i);
+ if (!CheckOneBackPointer(map, target)) return false;
}
return true;
}
« no previous file with comments | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698