Revision: 22842
Author:   [email protected]
Date:     Tue Aug  5 07:08:39 2014 UTC
Log:      Move anonymous function name beautifying out of v8.

[email protected], [email protected]

Review URL: https://codereview.chromium.org/425223004
http://code.google.com/p/v8/source/detail?r=22842

Modified:
 /branches/bleeding_edge/src/profile-generator.cc
 /branches/bleeding_edge/src/profile-generator.h
 /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc
 /branches/bleeding_edge/test/cctest/test-heap-profiler.cc
 /branches/bleeding_edge/test/cctest/test-profile-generator.cc

=======================================
--- /branches/bleeding_edge/src/profile-generator.cc Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/profile-generator.cc Tue Aug 5 07:08:39 2014 UTC
@@ -107,17 +107,12 @@


 const char* StringsStorage::GetFunctionName(Name* name) {
-  return BeautifyFunctionName(GetName(name));
+  return GetName(name);
 }


 const char* StringsStorage::GetFunctionName(const char* name) {
-  return BeautifyFunctionName(GetCopy(name));
-}
-
-
-const char* StringsStorage::BeautifyFunctionName(const char* name) {
-  return (*name == 0) ? ProfileGenerator::kAnonymousFunctionName : name;
+  return GetCopy(name);
 }


@@ -552,8 +547,6 @@
 }


-const char* const ProfileGenerator::kAnonymousFunctionName =
-    "(anonymous function)";
 const char* const ProfileGenerator::kProgramEntryName =
     "(program)";
 const char* const ProfileGenerator::kIdleEntryName =
=======================================
--- /branches/bleeding_edge/src/profile-generator.h Mon Jun 30 13:25:46 2014 UTC +++ /branches/bleeding_edge/src/profile-generator.h Tue Aug 5 07:08:39 2014 UTC
@@ -34,7 +34,6 @@
   static const int kMaxNameSize = 1024;

   static bool StringsMatch(void* key1, void* key2);
-  const char* BeautifyFunctionName(const char* name);
   const char* AddOrDisposeString(char* str, int len);
   HashMap::Entry* GetEntry(const char* str, int len);

@@ -313,7 +312,6 @@

   CodeMap* code_map() { return &code_map_; }

-  static const char* const kAnonymousFunctionName;
   static const char* const kProgramEntryName;
   static const char* const kIdleEntryName;
   static const char* const kGarbageCollectorEntryName;
=======================================
--- /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc Fri Jul 11 09:06:12 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc Tue Aug 5 07:08:39 2014 UTC
@@ -1629,15 +1629,13 @@
       const_cast<v8::CpuProfileNode*>(current))->Print(0);
   // The tree should look like this:
   //  0   (root) 0 #1
-  //  0    (anonymous function) 19 #2 no reason script_b:1
+  //  0    "" 19 #2 no reason script_b:1
   //  0      baz 19 #3 TryCatchStatement script_b:3
   //  0        foo 18 #4 TryCatchStatement script_a:2
   //  1          bar 18 #5 no reason script_a:3
   const v8::CpuProfileNode* root = profile->GetTopDownRoot();
-  const v8::CpuProfileNode* script = GetChild(env->GetIsolate(), root,
-      ProfileGenerator::kAnonymousFunctionName);
-  CheckFunctionDetails(env->GetIsolate(), script,
- ProfileGenerator::kAnonymousFunctionName, "script_b",
+  const v8::CpuProfileNode* script = GetChild(env->GetIsolate(), root, "");
+  CheckFunctionDetails(env->GetIsolate(), script, "", "script_b",
                        script_b->GetUnboundScript()->GetId(), 1, 1);
const v8::CpuProfileNode* baz = GetChild(env->GetIsolate(), script, "baz");
   CheckFunctionDetails(env->GetIsolate(), baz, "baz", "script_b",
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Mon Aug 4 18:17:54 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Tue Aug 5 07:08:39 2014 UTC
@@ -2410,7 +2410,7 @@
     "for (var i = 0; i < 3; ++i)\n"
     "    a.shift();\n");

-  const char* names[] = { "(anonymous function)" };
+  const char* names[] = {""};
   AllocationTracker* tracker =
reinterpret_cast<i::HeapProfiler*>(heap_profiler)->allocation_tracker();
   CHECK_NE(NULL, tracker);
@@ -2445,8 +2445,7 @@
   // Print for better diagnostics in case of failure.
   tracker->trace_tree()->Print(tracker);

-  const char* names[] =
-      { "(anonymous function)", "start", "f_0_0", "f_0_1", "f_0_2" };
+  const char* names[] = {"", "start", "f_0_0", "f_0_1", "f_0_2"};
   AllocationTraceNode* node =
       FindNode(tracker, Vector<const char*>(names, ARRAY_SIZE(names)));
   CHECK_NE(NULL, node);
@@ -2481,7 +2480,7 @@
   LocalContext env;

   v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
-  const char* names[] = { "(anonymous function)", "start", "f_0", "f_1" };
+  const char* names[] = {"", "start", "f_0", "f_1"};
   // First check that normally all allocations are recorded.
   {
     heap_profiler->StartTrackingHeapObjects(true);
=======================================
--- /branches/bleeding_edge/test/cctest/test-profile-generator.cc Fri Jun 13 16:43:27 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-profile-generator.cc Tue Aug 5 07:08:39 2014 UTC
@@ -572,14 +572,14 @@
   const_cast<ProfileNode*>(current)->Print(0);
   // The tree should look like this:
   //  (root)
-  //   (anonymous function)
+  //   ""
   //     a
   //       b
   //         c
   // There can also be:
   //           startProfiling
   // if the sampler managed to get a tick.
-  current = PickChild(current, "(anonymous function)");
+  current = PickChild(current, "");
   CHECK_NE(NULL, const_cast<ProfileNode*>(current));
   current = PickChild(current, "a");
   CHECK_NE(NULL, const_cast<ProfileNode*>(current));
@@ -651,13 +651,13 @@
       const_cast<v8::CpuProfileNode*>(current))->Print(0);
   // The tree should look like this:
   //  (root)
-  //   (anonymous function)
+  //   ""
   //     b
   //       a
   // There can also be:
   //         startProfiling
   // if the sampler managed to get a tick.
- current = PickChild(current, i::ProfileGenerator::kAnonymousFunctionName);
+  current = PickChild(current, "");
   CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current));

   current = PickChild(current, "b");
@@ -760,10 +760,10 @@
       const_cast<v8::CpuProfileNode*>(current))->Print(0);
   // The tree should look like this:
   //  (root)
-  //   (anonymous function)
+  //   ""
   //     kTryFinally
   //       kTryCatch
- current = PickChild(current, i::ProfileGenerator::kAnonymousFunctionName);
+  current = PickChild(current, "");
   CHECK_NE(NULL, const_cast<v8::CpuProfileNode*>(current));

   current = PickChild(current, "TryFinally");

--
--
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/d/optout.

Reply via email to