Revision: 3795
Author: [email protected]
Date: Thu Feb  4 07:20:03 2010
Log: Provide more logging data when building bolerplates.

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

Modified:
 /branches/experimental/partial_snapshots/src/compiler.cc
 /branches/experimental/partial_snapshots/src/compiler.h
 /branches/experimental/partial_snapshots/test/cctest/cctest.status

=======================================
--- /branches/experimental/partial_snapshots/src/compiler.cc Wed Feb 3 02:52:22 2010 +++ /branches/experimental/partial_snapshots/src/compiler.cc Thu Feb 4 07:20:03 2010
@@ -398,28 +398,12 @@
   }

 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT
- // Log the code generation. If source information is available include script - // name and line number. Check explicit whether logging is enabled as finding
-  // the line number is not for free.
-  if (Logger::is_logging() || OProfileAgent::is_enabled()) {
-    Handle<String> func_name(name->length() > 0 ?
-                             *name : shared->inferred_name());
-    if (script->name()->IsString()) {
-      int line_num = GetScriptLineNumber(script, start_position) + 1;
-      LOG(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *func_name,
-                          String::cast(script->name()), line_num));
-      OProfileAgent::CreateNativeCodeRegion(*func_name,
-                                            String::cast(script->name()),
-                                            line_num,
-                                            code->instruction_start(),
-                                            code->instruction_size());
-    } else {
-      LOG(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *func_name));
-      OProfileAgent::CreateNativeCodeRegion(*func_name,
-                                            code->instruction_start(),
-                                            code->instruction_size());
-    }
-  }
+  LogCodeCreateEvent(Logger::LAZY_COMPILE_TAG,
+                     name,
+                     Handle<String>(shared->inferred_name()),
+                     start_position,
+                     script,
+                     code);
 #endif

   // Update the shared function info with the compiled code.
@@ -513,12 +497,14 @@
     }

     // Function compilation complete.
-    LOG(CodeCreateEvent(Logger::FUNCTION_TAG, *code, *literal->name()));
-
-#ifdef ENABLE_OPROFILE_AGENT
-    OProfileAgent::CreateNativeCodeRegion(*literal->name(),
-                                          code->instruction_start(),
-                                          code->instruction_size());
+
+#if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT
+    LogCodeCreateEvent(Logger::FUNCTION_TAG,
+                       literal->name(),
+                       literal->inferred_name(),
+                       literal->start_position(),
+                       script,
+                       code);
 #endif
   }

@@ -566,4 +552,35 @@
 }


+#if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT
+void Compiler::LogCodeCreateEvent(Logger::LogEventsAndTags tag,
+                                  Handle<String> name,
+                                  Handle<String> inferred_name,
+                                  int start_position,
+                                  Handle<Script> script,
+                                  Handle<Code> code) {
+  // Log the code generation. If source information is available
+  // include script name and line number. Check explicitly whether
+  // logging is enabled as finding the line number is not free.
+  if (Logger::is_logging() || OProfileAgent::is_enabled()) {
+    Handle<String> func_name(name->length() > 0 ? *name : *inferred_name);
+    if (script->name()->IsString()) {
+      int line_num = GetScriptLineNumber(script, start_position) + 1;
+      LOG(CodeCreateEvent(tag, *code, *func_name,
+                          String::cast(script->name()), line_num));
+      OProfileAgent::CreateNativeCodeRegion(*func_name,
+                                            String::cast(script->name()),
+                                            line_num,
+                                            code->instruction_start(),
+                                            code->instruction_size());
+    } else {
+      LOG(CodeCreateEvent(tag, *code, *func_name));
+      OProfileAgent::CreateNativeCodeRegion(*func_name,
+                                            code->instruction_start(),
+                                            code->instruction_size());
+    }
+  }
+}
+#endif
+
 } }  // namespace v8::internal
=======================================
--- /branches/experimental/partial_snapshots/src/compiler.h Wed Feb 3 02:52:22 2010 +++ /branches/experimental/partial_snapshots/src/compiler.h Thu Feb 4 07:20:03 2010
@@ -120,6 +120,17 @@
                               FunctionLiteral* lit,
                               bool is_toplevel,
                               Handle<Script> script);
+
+ private:
+
+#if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT
+  static void LogCodeCreateEvent(Logger::LogEventsAndTags tag,
+                                 Handle<String> name,
+                                 Handle<String> inferred_name,
+                                 int start_position,
+                                 Handle<Script> script,
+                                 Handle<Code> code);
+#endif
 };


=======================================
--- /branches/experimental/partial_snapshots/test/cctest/cctest.status Wed Feb 3 02:52:22 2010 +++ /branches/experimental/partial_snapshots/test/cctest/cctest.status Thu Feb 4 07:20:03 2010
@@ -38,9 +38,6 @@
 test-serialize/TestThatAlwaysFails: FAIL
 test-serialize/DependentTestThatAlwaysFails: FAIL

-# BUG(): Test doesn't work for some functions from regexp.js.
-test-log/EquivalenceOfLoggingAndTraversal: (PASS || FAIL)
-
 [ $arch == arm ]

 # BUG(240): Test seems flaky on ARM.

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

Reply via email to