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

Unified Diff: src/objects-printer.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-inl.h ('k') | src/transitions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-printer.cc
diff --git a/src/objects-printer.cc b/src/objects-printer.cc
index 3fd1579ba5212161202ffa803d4d6c3a9a72ba1a..1b31c1bfffe7a4408889e3527a0797e516c9ea63 100644
--- a/src/objects-printer.cc
+++ b/src/objects-printer.cc
@@ -432,8 +432,9 @@ void Map::MapPrint(std::ostream& os) { // NOLINT
if (FLAG_unbox_double_fields) {
os << "\n - layout descriptor: " << Brief(layout_descriptor());
}
- if (HasTransitionArray()) {
- os << "\n - transitions: " << Brief(transitions());
+ if (TransitionArray::NumberOfTransitions(raw_transitions()) > 0) {
+ os << "\n - transitions: ";
+ TransitionArray::PrintTransitions(os, raw_transitions());
}
os << "\n - prototype: " << Brief(prototype());
os << "\n - constructor: " << Brief(GetConstructor());
@@ -1138,19 +1139,20 @@ void DescriptorArray::PrintDescriptors(std::ostream& os) { // NOLINT
void TransitionArray::Print() {
OFStream os(stdout);
- this->PrintTransitions(os);
+ TransitionArray::PrintTransitions(os, this);
os << std::flush;
}
-void TransitionArray::PrintTransitions(std::ostream& os,
+void TransitionArray::PrintTransitions(std::ostream& os, Object* transitions,
bool print_header) { // NOLINT
+ int num_transitions = NumberOfTransitions(transitions);
if (print_header) {
- os << "Transition array " << number_of_transitions() << "\n";
+ os << "Transition array " << num_transitions << "\n";
}
- for (int i = 0; i < number_of_transitions(); i++) {
- Name* key = GetKey(i);
- Map* target = GetTarget(i);
+ for (int i = 0; i < num_transitions; i++) {
+ Name* key = GetKey(transitions, i);
+ Map* target = GetTarget(transitions, i);
os << " ";
#ifdef OBJECT_PRINT
key->NamePrint(os);
@@ -1158,16 +1160,17 @@ void TransitionArray::PrintTransitions(std::ostream& os,
key->ShortPrint(os);
#endif
os << ": ";
- if (key == GetHeap()->nonextensible_symbol()) {
+ Heap* heap = key->GetHeap();
+ if (key == heap->nonextensible_symbol()) {
os << " (transition to non-extensible)";
- } else if (key == GetHeap()->sealed_symbol()) {
+ } else if (key == heap->sealed_symbol()) {
os << " (transition to sealed)";
- } else if (key == GetHeap()->frozen_symbol()) {
+ } else if (key == heap->frozen_symbol()) {
os << " (transition to frozen)";
- } else if (key == GetHeap()->elements_transition_symbol()) {
+ } else if (key == heap->elements_transition_symbol()) {
os << " (transition to " << ElementsKindToString(target->elements_kind())
<< ")";
- } else if (key == GetHeap()->observed_symbol()) {
+ } else if (key == heap->observed_symbol()) {
os << " (transition to Object.observe)";
} else {
PropertyDetails details = GetTargetDetails(key, target);
@@ -1177,7 +1180,9 @@ void TransitionArray::PrintTransitions(std::ostream& os,
}
os << (details.kind() == kData ? "data" : "accessor");
if (details.location() == kDescriptor) {
- os << " " << Brief(GetTargetValue(i));
+ Object* value =
+ target->instance_descriptors()->GetValue(target->LastAdded());
+ os << " " << Brief(value);
}
os << "), attrs: " << details.attributes();
}
@@ -1187,8 +1192,7 @@ void TransitionArray::PrintTransitions(std::ostream& os,
void JSObject::PrintTransitions(std::ostream& os) { // NOLINT
- if (!map()->HasTransitionArray()) return;
- map()->transitions()->PrintTransitions(os, false);
+ TransitionArray::PrintTransitions(os, map()->raw_transitions());
}
#endif // defined(DEBUG) || defined(OBJECT_PRINT)
} } // namespace v8::internal
« no previous file with comments | « src/objects-inl.h ('k') | src/transitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698