Revision: 6074
Author: [email protected]
Date: Fri Dec 17 06:16:00 2010
Log: Extend code printing:

o Add --print-unopt-code to print unoptimized code before printing
  optimized code based on it. This is useful to see the states of ICs
  and the effects of code patching.

o Use debug function names in disassembly output.

Review URL: http://codereview.chromium.org/5959003
http://code.google.com/p/v8/source/detail?r=6074

Modified:
 /branches/bleeding_edge/src/codegen.cc
 /branches/bleeding_edge/src/flag-definitions.h

=======================================
--- /branches/bleeding_edge/src/codegen.cc      Tue Dec  7 03:31:57 2010
+++ /branches/bleeding_edge/src/codegen.cc      Fri Dec 17 06:16:00 2010
@@ -215,8 +215,17 @@
       }
       PrintF("\n\n");
     }
-    PrintF("--- Code ---\n");
-    code->Disassemble(*function->name()->ToCString());
+    if (info->IsOptimizing()) {
+      if (FLAG_print_unopt_code) {
+        PrintF("--- Unoptimized code ---\n");
+        info->closure()->shared()->code()->Disassemble(
+            *function->debug_name()->ToCString());
+      }
+      PrintF("--- Optimized code ---\n");
+    } else {
+      PrintF("--- Code ---\n");
+    }
+    code->Disassemble(*function->debug_name()->ToCString());
   }
 #endif  // ENABLE_DISASSEMBLER
 }
=======================================
--- /branches/bleeding_edge/src/flag-definitions.h      Thu Dec 16 05:24:23 2010
+++ /branches/bleeding_edge/src/flag-definitions.h      Fri Dec 17 06:16:00 2010
@@ -503,6 +503,8 @@
 // codegen-ia32.cc / codegen-arm.cc
 DEFINE_bool(print_code, false, "print generated code")
 DEFINE_bool(print_opt_code, false, "print optimized code")
+DEFINE_bool(print_unopt_code, false, "print unoptimized code before "
+            "printing optimized code based on it")
 DEFINE_bool(print_code_verbose, false, "print more information for code")
 DEFINE_bool(print_builtin_code, false, "print generated code for builtins")

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to