Reviewers: Toon Verwaest,

Message:
PTAL

Description:
Fix JSObject::PrintTransitions.

BUG=347912
LOG=y

Please review this at https://codereview.chromium.org/183683005/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+34, -24 lines):
  M src/objects-printer.cc
  A + test/mjsunit/regress/regress-347912.js


Index: src/objects-printer.cc
diff --git a/src/objects-printer.cc b/src/objects-printer.cc
index e9fb83258a611360c9aab72b43f9c161feabfe5d..fb273d592790b625babae029ba1a96d1967874c3 100644
--- a/src/objects-printer.cc
+++ b/src/objects-printer.cc
@@ -400,28 +400,39 @@ void JSObject::PrintTransitions(FILE* out) {
   if (!map()->HasTransitionArray()) return;
   TransitionArray* transitions = map()->transitions();
   for (int i = 0; i < transitions->number_of_transitions(); i++) {
+    Name* key = transitions->GetKey(i);
     PrintF(out, "   ");
-    transitions->GetKey(i)->NamePrint(out);
+    key->NamePrint(out);
     PrintF(out, ": ");
-    switch (transitions->GetTargetDetails(i).type()) {
-      case FIELD: {
-        PrintF(out, " (transition to field)\n");
-        break;
+    if (key == GetHeap()->frozen_symbol()) {
+      PrintF(out, " (transition to frozen)\n");
+    } else if (key == GetHeap()->elements_transition_symbol()) {
+      PrintF(out, " (transition to ");
+      PrintElementsKind(out, transitions->GetTarget(i)->elements_kind());
+      PrintF(out, ")\n");
+    } else if (key == GetHeap()->observed_symbol()) {
+      PrintF(out, " (transition to Object.observe)\n");
+    } else {
+      switch (transitions->GetTargetDetails(i).type()) {
+        case FIELD: {
+          PrintF(out, " (transition to field)\n");
+          break;
+        }
+        case CONSTANT:
+          PrintF(out, " (transition to constant)\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;
       }
-      case CONSTANT:
-        PrintF(out, " (transition to constant)\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;
     }
   }
 }
Index: test/mjsunit/regress/regress-347912.js
diff --git a/test/mjsunit/regress/regress-347542.js b/test/mjsunit/regress/regress-347912.js
similarity index 68%
copy from test/mjsunit/regress/regress-347542.js
copy to test/mjsunit/regress/regress-347912.js
index 901d798fb7fbea45f0d9f3d8ba6c7a9846bf6dd6..b609e36c3d4981219abcd1c244ab46f849b2863b 100644
--- a/test/mjsunit/regress/regress-347542.js
+++ b/test/mjsunit/regress/regress-347912.js
@@ -4,8 +4,7 @@

 // Flags: --allow-natives-syntax

-function foo() {}
-foo();
-%OptimizeFunctionOnNextCall(foo);
-foo();
-%NeverOptimizeFunction(foo);
+var __v_4 = {};
+__v_2 = {};
+__v_2[1024] = 0;
+%DebugPrint(__v_4);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to