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

Side by Side Diff: test/cctest/test-cpu-profiler.cc

Issue 14471035: Avoid unnecessary indirection when creating CodeEntries (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed nit Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/profile-generator.h ('k') | test/cctest/test-profile-generator.cc » ('j') | 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 30 matching lines...) Expand all
41 using i::ProfileNode; 41 using i::ProfileNode;
42 using i::ProfilerEventsProcessor; 42 using i::ProfilerEventsProcessor;
43 using i::ScopedVector; 43 using i::ScopedVector;
44 using i::TokenEnumerator; 44 using i::TokenEnumerator;
45 using i::Vector; 45 using i::Vector;
46 46
47 47
48 TEST(StartStop) { 48 TEST(StartStop) {
49 CpuProfilesCollection profiles; 49 CpuProfilesCollection profiles;
50 ProfileGenerator generator(&profiles); 50 ProfileGenerator generator(&profiles);
51 ProfilerEventsProcessor processor(&generator); 51 ProfilerEventsProcessor processor(&generator, &profiles);
52 processor.Start(); 52 processor.Start();
53 processor.Stop(); 53 processor.Stop();
54 processor.Join(); 54 processor.Join();
55 } 55 }
56 56
57 static inline i::Address ToAddress(int n) { 57 static inline i::Address ToAddress(int n) {
58 return reinterpret_cast<i::Address>(n); 58 return reinterpret_cast<i::Address>(n);
59 } 59 }
60 60
61 static void EnqueueTickSampleEvent(ProfilerEventsProcessor* proc, 61 static void EnqueueTickSampleEvent(ProfilerEventsProcessor* proc,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 TEST(CodeEvents) { 98 TEST(CodeEvents) {
99 CcTest::InitializeVM(); 99 CcTest::InitializeVM();
100 i::Isolate* isolate = i::Isolate::Current(); 100 i::Isolate* isolate = i::Isolate::Current();
101 i::Heap* heap = isolate->heap(); 101 i::Heap* heap = isolate->heap();
102 i::Factory* factory = isolate->factory(); 102 i::Factory* factory = isolate->factory();
103 TestSetup test_setup; 103 TestSetup test_setup;
104 CpuProfilesCollection profiles; 104 CpuProfilesCollection profiles;
105 profiles.StartProfiling("", 1, false); 105 profiles.StartProfiling("", 1, false);
106 ProfileGenerator generator(&profiles); 106 ProfileGenerator generator(&profiles);
107 ProfilerEventsProcessor processor(&generator); 107 ProfilerEventsProcessor processor(&generator, &profiles);
108 processor.Start(); 108 processor.Start();
109 109
110 // Enqueue code creation events. 110 // Enqueue code creation events.
111 i::HandleScope scope(isolate); 111 i::HandleScope scope(isolate);
112 const char* aaa_str = "aaa"; 112 const char* aaa_str = "aaa";
113 i::Handle<i::String> aaa_name = factory->NewStringFromAscii( 113 i::Handle<i::String> aaa_name = factory->NewStringFromAscii(
114 i::Vector<const char>(aaa_str, i::StrLength(aaa_str))); 114 i::Vector<const char>(aaa_str, i::StrLength(aaa_str)));
115 processor.CodeCreateEvent(i::Logger::FUNCTION_TAG, 115 processor.CodeCreateEvent(i::Logger::FUNCTION_TAG,
116 *aaa_name, 116 *aaa_name,
117 heap->empty_string(), 117 heap->empty_string(),
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 template<typename T> 158 template<typename T>
159 static int CompareProfileNodes(const T* p1, const T* p2) { 159 static int CompareProfileNodes(const T* p1, const T* p2) {
160 return strcmp((*p1)->entry()->name(), (*p2)->entry()->name()); 160 return strcmp((*p1)->entry()->name(), (*p2)->entry()->name());
161 } 161 }
162 162
163 TEST(TickEvents) { 163 TEST(TickEvents) {
164 TestSetup test_setup; 164 TestSetup test_setup;
165 CpuProfilesCollection profiles; 165 CpuProfilesCollection profiles;
166 profiles.StartProfiling("", 1, false); 166 profiles.StartProfiling("", 1, false);
167 ProfileGenerator generator(&profiles); 167 ProfileGenerator generator(&profiles);
168 ProfilerEventsProcessor processor(&generator); 168 ProfilerEventsProcessor processor(&generator, &profiles);
169 processor.Start(); 169 processor.Start();
170 170
171 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, 171 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG,
172 "bbb", 172 "bbb",
173 ToAddress(0x1200), 173 ToAddress(0x1200),
174 0x80); 174 0x80);
175 processor.CodeCreateEvent(i::Logger::STUB_TAG, 5, ToAddress(0x1300), 0x10); 175 processor.CodeCreateEvent(i::Logger::STUB_TAG, 5, ToAddress(0x1300), 0x10);
176 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, 176 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG,
177 "ddd", 177 "ddd",
178 ToAddress(0x1400), 178 ToAddress(0x1400),
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 222 }
223 223
224 224
225 // http://code.google.com/p/v8/issues/detail?id=1398 225 // http://code.google.com/p/v8/issues/detail?id=1398
226 // Long stacks (exceeding max frames limit) must not be erased. 226 // Long stacks (exceeding max frames limit) must not be erased.
227 TEST(Issue1398) { 227 TEST(Issue1398) {
228 TestSetup test_setup; 228 TestSetup test_setup;
229 CpuProfilesCollection profiles; 229 CpuProfilesCollection profiles;
230 profiles.StartProfiling("", 1, false); 230 profiles.StartProfiling("", 1, false);
231 ProfileGenerator generator(&profiles); 231 ProfileGenerator generator(&profiles);
232 ProfilerEventsProcessor processor(&generator); 232 ProfilerEventsProcessor processor(&generator, &profiles);
233 processor.Start(); 233 processor.Start();
234 234
235 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, 235 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG,
236 "bbb", 236 "bbb",
237 ToAddress(0x1200), 237 ToAddress(0x1200),
238 0x80); 238 0x80);
239 239
240 i::TickSample* sample = processor.TickSampleEvent(); 240 i::TickSample* sample = processor.TickSampleEvent();
241 sample->pc = ToAddress(0x1200); 241 sample->pc = ToAddress(0x1200);
242 sample->tos = 0; 242 sample->tos = 0;
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 538
539 const char* barBranch[] = { "bar", "delay", "loop" }; 539 const char* barBranch[] = { "bar", "delay", "loop" };
540 CheckSimpleBranch(fooNode, barBranch, ARRAY_SIZE(barBranch)); 540 CheckSimpleBranch(fooNode, barBranch, ARRAY_SIZE(barBranch));
541 const char* bazBranch[] = { "baz", "delay", "loop" }; 541 const char* bazBranch[] = { "baz", "delay", "loop" };
542 CheckSimpleBranch(fooNode, bazBranch, ARRAY_SIZE(bazBranch)); 542 CheckSimpleBranch(fooNode, bazBranch, ARRAY_SIZE(bazBranch));
543 const char* delayBranch[] = { "delay", "loop" }; 543 const char* delayBranch[] = { "delay", "loop" };
544 CheckSimpleBranch(fooNode, delayBranch, ARRAY_SIZE(delayBranch)); 544 CheckSimpleBranch(fooNode, delayBranch, ARRAY_SIZE(delayBranch));
545 545
546 cpu_profiler->DeleteAllCpuProfiles(); 546 cpu_profiler->DeleteAllCpuProfiles();
547 } 547 }
OLDNEW
« no previous file with comments | « src/profile-generator.h ('k') | test/cctest/test-profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698