Remove obsolete method ProfileTree::AddPathFromStart and the corresponding test.
authorloislo <loislo@chromium.org>
Wed, 11 Feb 2015 07:26:59 +0000 (23:26 -0800)
committerCommit bot <commit-bot@chromium.org>
Wed, 11 Feb 2015 07:27:09 +0000 (07:27 +0000)
BUG=
LOG=n

Review URL: https://codereview.chromium.org/907353003

Cr-Commit-Position: refs/heads/master@{#26565}

src/profile-generator.cc
src/profile-generator.h
test/cctest/test-profile-generator.cc

index ac3df176ca8d55a65262b7c29f45cf759f7eda94..777be3fbd143a38844d6c13452b60c17e06d9b08 100644 (file)
@@ -325,23 +325,6 @@ ProfileNode* ProfileTree::AddPathFromEnd(const Vector<CodeEntry*>& path,
 }
 
 
-void ProfileTree::AddPathFromStart(const Vector<CodeEntry*>& path,
-                                   int src_line) {
-  ProfileNode* node = root_;
-  for (CodeEntry** entry = path.start();
-       entry != path.start() + path.length();
-       ++entry) {
-    if (*entry != NULL) {
-      node = node->FindOrAddChild(*entry);
-    }
-  }
-  node->IncrementSelfTicks();
-  if (src_line != v8::CpuProfileNode::kNoLineNumberInfo) {
-    node->IncrementLineTicks(src_line);
-  }
-}
-
-
 struct NodesPair {
   NodesPair(ProfileNode* src, ProfileNode* dst)
       : src(src), dst(dst) { }
index 17ec10b44d3ac9fd311e2786fda159893504132c..679e9298124f5d7e06cae14aac48d52cea38ddda 100644 (file)
@@ -198,8 +198,6 @@ class ProfileTree {
   ProfileNode* AddPathFromEnd(
       const Vector<CodeEntry*>& path,
       int src_line = v8::CpuProfileNode::kNoLineNumberInfo);
-  void AddPathFromStart(const Vector<CodeEntry*>& path,
-                        int src_line = v8::CpuProfileNode::kNoLineNumberInfo);
   ProfileNode* root() const { return root_; }
   unsigned next_node_id() { return next_node_id_++; }
 
index 8943833c27fd38d1995e295ec5cd409edb23dad8..0a2c7a562576d3c25092a3c180904616683e0690 100644 (file)
@@ -117,64 +117,6 @@ class ProfileTreeTestHelper {
 
 }  // namespace
 
-TEST(ProfileTreeAddPathFromStart) {
-  CodeEntry entry1(i::Logger::FUNCTION_TAG, "aaa");
-  CodeEntry entry2(i::Logger::FUNCTION_TAG, "bbb");
-  CodeEntry entry3(i::Logger::FUNCTION_TAG, "ccc");
-  ProfileTree tree;
-  ProfileTreeTestHelper helper(&tree);
-  CHECK(!helper.Walk(&entry1));
-  CHECK(!helper.Walk(&entry2));
-  CHECK(!helper.Walk(&entry3));
-
-  CodeEntry* path[] = {NULL, &entry1, NULL, &entry2, NULL, NULL, &entry3, NULL};
-  Vector<CodeEntry*> path_vec(path, sizeof(path) / sizeof(path[0]));
-  tree.AddPathFromStart(path_vec);
-  CHECK(!helper.Walk(&entry2));
-  CHECK(!helper.Walk(&entry3));
-  ProfileNode* node1 = helper.Walk(&entry1);
-  CHECK(node1);
-  CHECK_EQ(0u, node1->self_ticks());
-  CHECK(!helper.Walk(&entry1, &entry1));
-  CHECK(!helper.Walk(&entry1, &entry3));
-  ProfileNode* node2 = helper.Walk(&entry1, &entry2);
-  CHECK(node2);
-  CHECK_NE(node1, node2);
-  CHECK_EQ(0u, node2->self_ticks());
-  CHECK(!helper.Walk(&entry1, &entry2, &entry1));
-  CHECK(!helper.Walk(&entry1, &entry2, &entry2));
-  ProfileNode* node3 = helper.Walk(&entry1, &entry2, &entry3);
-  CHECK(node3);
-  CHECK_NE(node1, node3);
-  CHECK_NE(node2, node3);
-  CHECK_EQ(1u, node3->self_ticks());
-
-  tree.AddPathFromStart(path_vec);
-  CHECK_EQ(node1, helper.Walk(&entry1));
-  CHECK_EQ(node2, helper.Walk(&entry1, &entry2));
-  CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3));
-  CHECK_EQ(0u, node1->self_ticks());
-  CHECK_EQ(0u, node2->self_ticks());
-  CHECK_EQ(2u, node3->self_ticks());
-
-  CodeEntry* path2[] = {&entry1, &entry2, &entry2};
-  Vector<CodeEntry*> path2_vec(path2, sizeof(path2) / sizeof(path2[0]));
-  tree.AddPathFromStart(path2_vec);
-  CHECK(!helper.Walk(&entry2));
-  CHECK(!helper.Walk(&entry3));
-  CHECK_EQ(node1, helper.Walk(&entry1));
-  CHECK(!helper.Walk(&entry1, &entry1));
-  CHECK(!helper.Walk(&entry1, &entry3));
-  CHECK_EQ(node2, helper.Walk(&entry1, &entry2));
-  CHECK(!helper.Walk(&entry1, &entry2, &entry1));
-  CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3));
-  CHECK_EQ(2u, node3->self_ticks());
-  ProfileNode* node4 = helper.Walk(&entry1, &entry2, &entry2);
-  CHECK(node4);
-  CHECK_NE(node3, node4);
-  CHECK_EQ(1u, node4->self_ticks());
-}
-
 
 TEST(ProfileTreeAddPathFromEnd) {
   CodeEntry entry1(i::Logger::FUNCTION_TAG, "aaa");
@@ -247,7 +189,7 @@ TEST(ProfileTreeCalculateTotalTicks) {
       e1_path, sizeof(e1_path) / sizeof(e1_path[0]));
 
   ProfileTree single_child_tree;
-  single_child_tree.AddPathFromStart(e1_path_vec);
+  single_child_tree.AddPathFromEnd(e1_path_vec);
   single_child_tree.root()->IncrementSelfTicks();
   CHECK_EQ(1u, single_child_tree.root()->self_ticks());
   ProfileTreeTestHelper single_child_helper(&single_child_tree);
@@ -257,17 +199,17 @@ TEST(ProfileTreeCalculateTotalTicks) {
   CHECK_EQ(1u, node1->self_ticks());
 
   CodeEntry entry2(i::Logger::FUNCTION_TAG, "bbb");
-  CodeEntry* e1_e2_path[] = {&entry1, &entry2};
-  Vector<CodeEntry*> e1_e2_path_vec(
-      e1_e2_path, sizeof(e1_e2_path) / sizeof(e1_e2_path[0]));
+  CodeEntry* e2_e1_path[] = {&entry2, &entry1};
+  Vector<CodeEntry*> e2_e1_path_vec(e2_e1_path,
+                                    sizeof(e2_e1_path) / sizeof(e2_e1_path[0]));
 
   ProfileTree flat_tree;
   ProfileTreeTestHelper flat_helper(&flat_tree);
-  flat_tree.AddPathFromStart(e1_path_vec);
-  flat_tree.AddPathFromStart(e1_path_vec);
-  flat_tree.AddPathFromStart(e1_e2_path_vec);
-  flat_tree.AddPathFromStart(e1_e2_path_vec);
-  flat_tree.AddPathFromStart(e1_e2_path_vec);
+  flat_tree.AddPathFromEnd(e1_path_vec);
+  flat_tree.AddPathFromEnd(e1_path_vec);
+  flat_tree.AddPathFromEnd(e2_e1_path_vec);
+  flat_tree.AddPathFromEnd(e2_e1_path_vec);
+  flat_tree.AddPathFromEnd(e2_e1_path_vec);
   // Results in {root,0,0} -> {entry1,0,2} -> {entry2,0,3}
   CHECK_EQ(0u, flat_tree.root()->self_ticks());
   node1 = flat_helper.Walk(&entry1);
@@ -290,16 +232,16 @@ TEST(ProfileTreeCalculateTotalTicks) {
 
   ProfileTree wide_tree;
   ProfileTreeTestHelper wide_helper(&wide_tree);
-  wide_tree.AddPathFromStart(e1_path_vec);
-  wide_tree.AddPathFromStart(e1_path_vec);
-  wide_tree.AddPathFromStart(e1_e2_path_vec);
-  wide_tree.AddPathFromStart(e2_path_vec);
-  wide_tree.AddPathFromStart(e2_path_vec);
-  wide_tree.AddPathFromStart(e2_path_vec);
-  wide_tree.AddPathFromStart(e3_path_vec);
-  wide_tree.AddPathFromStart(e3_path_vec);
-  wide_tree.AddPathFromStart(e3_path_vec);
-  wide_tree.AddPathFromStart(e3_path_vec);
+  wide_tree.AddPathFromEnd(e1_path_vec);
+  wide_tree.AddPathFromEnd(e1_path_vec);
+  wide_tree.AddPathFromEnd(e2_e1_path_vec);
+  wide_tree.AddPathFromEnd(e2_path_vec);
+  wide_tree.AddPathFromEnd(e2_path_vec);
+  wide_tree.AddPathFromEnd(e2_path_vec);
+  wide_tree.AddPathFromEnd(e3_path_vec);
+  wide_tree.AddPathFromEnd(e3_path_vec);
+  wide_tree.AddPathFromEnd(e3_path_vec);
+  wide_tree.AddPathFromEnd(e3_path_vec);
   // Results in            -> {entry1,0,2} -> {entry2,0,1}
   //            {root,0,0} -> {entry2,0,3}
   //                       -> {entry3,0,4}