Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: test/cctest/test-profile-generator.cc

Issue 3426008: Show RegExp calls in the profile. (Closed)
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/profile-generator-inl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // 2 //
3 // Tests of profiles generator and utilities. 3 // Tests of profiles generator and utilities.
4 4
5 #ifdef ENABLE_LOGGING_AND_PROFILING 5 #ifdef ENABLE_LOGGING_AND_PROFILING
6 6
7 #include "v8.h" 7 #include "v8.h"
8 #include "profile-generator-inl.h" 8 #include "profile-generator-inl.h"
9 #include "cctest.h" 9 #include "cctest.h"
10 #include "../include/v8-profiler.h" 10 #include "../include/v8-profiler.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 ProfileNode* childNode3 = node.FindOrAddChild(&entry3); 82 ProfileNode* childNode3 = node.FindOrAddChild(&entry3);
83 CHECK_NE(NULL, childNode3); 83 CHECK_NE(NULL, childNode3);
84 CHECK_NE(childNode1, childNode3); 84 CHECK_NE(childNode1, childNode3);
85 CHECK_NE(childNode2, childNode3); 85 CHECK_NE(childNode2, childNode3);
86 CHECK_EQ(childNode1, node.FindOrAddChild(&entry1)); 86 CHECK_EQ(childNode1, node.FindOrAddChild(&entry1));
87 CHECK_EQ(childNode2, node.FindOrAddChild(&entry2)); 87 CHECK_EQ(childNode2, node.FindOrAddChild(&entry2));
88 CHECK_EQ(childNode3, node.FindOrAddChild(&entry3)); 88 CHECK_EQ(childNode3, node.FindOrAddChild(&entry3));
89 } 89 }
90 90
91 91
92 TEST(ProfileNodeFindOrAddChildForSameFunction) {
93 ProfileNode node(NULL, NULL);
94 CodeEntry entry1(i::Logger::FUNCTION_TAG, "", "aaa", "", 0,
95 TokenEnumerator::kNoSecurityToken);
96 ProfileNode* childNode1 = node.FindOrAddChild(&entry1);
97 CHECK_NE(NULL, childNode1);
98 CHECK_EQ(childNode1, node.FindOrAddChild(&entry1));
99 // The same function again.
100 CodeEntry entry2(i::Logger::FUNCTION_TAG, "", "aaa", "", 0,
101 TokenEnumerator::kNoSecurityToken);
102 CHECK_EQ(childNode1, node.FindOrAddChild(&entry2));
103 // Now with a different security token.
104 CodeEntry entry3(i::Logger::FUNCTION_TAG, "", "aaa", "", 0,
105 TokenEnumerator::kNoSecurityToken + 1);
106 CHECK_EQ(childNode1, node.FindOrAddChild(&entry3));
107 }
108
109
92 namespace { 110 namespace {
93 111
94 class ProfileTreeTestHelper { 112 class ProfileTreeTestHelper {
95 public: 113 public:
96 explicit ProfileTreeTestHelper(const ProfileTree* tree) 114 explicit ProfileTreeTestHelper(const ProfileTree* tree)
97 : tree_(tree) { } 115 : tree_(tree) { }
98 116
99 ProfileNode* Walk(CodeEntry* entry1, 117 ProfileNode* Walk(CodeEntry* entry1,
100 CodeEntry* entry2 = NULL, 118 CodeEntry* entry2 = NULL,
101 CodeEntry* entry3 = NULL) { 119 CodeEntry* entry3 = NULL) {
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 CHECK(collection.StartProfiling(title.start(), i + 1)); // UID must be > 0. 804 CHECK(collection.StartProfiling(title.start(), i + 1)); // UID must be > 0.
787 titles[i] = title.start(); 805 titles[i] = title.start();
788 } 806 }
789 CHECK(!collection.StartProfiling( 807 CHECK(!collection.StartProfiling(
790 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1)); 808 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1));
791 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) 809 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i)
792 i::DeleteArray(titles[i]); 810 i::DeleteArray(titles[i]);
793 } 811 }
794 812
795 #endif // ENABLE_LOGGING_AND_PROFILING 813 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW
« no previous file with comments | « src/profile-generator-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698