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

Unified Diff: src/objects-printer.cc

Issue 10697015: Separating transitions from descriptors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Using WhitenessWitness in TransitionArray code. Created 8 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 | « src/objects-inl.h ('k') | src/profile-generator.cc » ('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 2e58c0949e5020c85008cc9621f4a071a3b2f82e..679e9dc90c3dde50dddbf23d3453b2dcdaa13058 100644
--- a/src/objects-printer.cc
+++ b/src/objects-printer.cc
@@ -273,15 +273,11 @@ void JSObject::PrintProperties(FILE* out) {
descs->GetCallbacksObject(i)->ShortPrint(out);
PrintF(out, " (callback)\n");
break;
- case MAP_TRANSITION:
- PrintF(out, "(map transition)\n");
- break;
- case CONSTANT_TRANSITION:
- PrintF(out, "(constant transition)\n");
- break;
case NORMAL: // only in slow mode
case HANDLER: // only in lookup results, not in descriptors
case INTERCEPTOR: // only in lookup results, not in descriptors
+ // There are no transitions in the descriptor array.
+ case TRANSITION:
case NONEXISTENT:
UNREACHABLE();
break;
@@ -408,6 +404,37 @@ void JSObject::PrintElements(FILE* out) {
}
+void JSObject::PrintTransitions(FILE* out) {
+ if (!map()->HasTransitionArray()) return;
+ TransitionArray* transitions = map()->transitions();
+ for (int i = 0; i < transitions->number_of_transitions(); i++) {
+ PrintF(out, " ");
+ transitions->GetKey(i)->StringPrint(out);
+ PrintF(out, ": ");
+ switch (transitions->GetTargetDetails(i).type()) {
+ case FIELD: {
+ PrintF(out, " (transition to field)\n");
+ break;
+ }
+ case CONSTANT_FUNCTION:
+ PrintF(out, " (transition to constant function)\n");
+ break;
+ case CALLBACKS:
+ PrintF(out, " (transition to callback)\n");
+ break;
+ // Values below are never in the target descriptor array.
+ case NORMAL:
+ case HANDLER:
+ case INTERCEPTOR:
+ case TRANSITION:
+ case NONEXISTENT:
+ UNREACHABLE();
+ break;
+ }
+ }
+}
+
+
void JSObject::JSObjectPrint(FILE* out) {
PrintF(out, "%p: [JSObject]\n", reinterpret_cast<void*>(this));
PrintF(out, " - map = %p [", reinterpret_cast<void*>(map()));
@@ -417,11 +444,9 @@ void JSObject::JSObjectPrint(FILE* out) {
PrintF(out,
"]\n - prototype = %p\n",
reinterpret_cast<void*>(GetPrototype()));
- PrintF(out,
- " - elements transition to = %p\n",
- reinterpret_cast<void*>(map()->elements_transition_map()));
PrintF(out, " {\n");
PrintProperties(out);
+ PrintTransitions(out);
PrintElements(out);
PrintF(out, " }\n");
}
@@ -537,6 +562,10 @@ void Map::MapPrint(FILE* out) {
}
PrintF(out, " - instance descriptors: ");
instance_descriptors()->ShortPrint(out);
+ if (HasTransitionArray()) {
+ PrintF(out, "\n - transitions: ");
+ transitions()->ShortPrint(out);
+ }
PrintF(out, "\n - prototype: ");
prototype()->ShortPrint(out);
PrintF(out, "\n - constructor: ");
@@ -1024,6 +1053,37 @@ void DescriptorArray::PrintDescriptors(FILE* out) {
}
+void TransitionArray::PrintTransitions(FILE* out) {
+ PrintF(out, "Transition array %d\n", number_of_transitions());
+ for (int i = 0; i < number_of_transitions(); i++) {
+ PrintF(out, " %d: ", i);
+ GetKey(i)->StringPrint(out);
+ PrintF(out, ": ");
+ switch (GetTargetDetails(i).type()) {
+ case FIELD: {
+ PrintF(out, " (transition to field)\n");
+ break;
+ }
+ case CONSTANT_FUNCTION:
+ PrintF(out, " (transition to constant function)\n");
+ break;
+ case CALLBACKS:
+ PrintF(out, " (transition to callback)\n");
+ break;
+ // Values below are never in the target descriptor array.
+ case NORMAL:
+ case HANDLER:
+ case INTERCEPTOR:
+ case TRANSITION:
+ case NONEXISTENT:
+ UNREACHABLE();
+ break;
+ }
+ }
+ PrintF(out, "\n");
+}
+
+
#endif // OBJECT_PRINT
« no previous file with comments | « src/objects-inl.h ('k') | src/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698