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

Side by Side Diff: src/cpu-profiler.cc

Issue 1337743002: Removing function filtering from the v8 sampling (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « no previous file | 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/cpu-profiler.h" 5 #include "src/cpu-profiler.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/cpu-profiler-inl.h" 8 #include "src/cpu-profiler-inl.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/frames-inl.h" 10 #include "src/frames-inl.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 void CpuProfiler::DeleteProfile(CpuProfile* profile) { 193 void CpuProfiler::DeleteProfile(CpuProfile* profile) {
194 profiles_->RemoveProfile(profile); 194 profiles_->RemoveProfile(profile);
195 delete profile; 195 delete profile;
196 if (profiles_->profiles()->is_empty() && !is_profiling_) { 196 if (profiles_->profiles()->is_empty() && !is_profiling_) {
197 // If this was the last profile, clean up all accessory data as well. 197 // If this was the last profile, clean up all accessory data as well.
198 ResetProfiles(); 198 ResetProfiles();
199 } 199 }
200 } 200 }
201 201
202 202
203 static bool FilterOutCodeCreateEvent(Logger::LogEventsAndTags tag) {
204 return FLAG_prof_browser_mode
205 && (tag != Logger::CALLBACK_TAG
206 && tag != Logger::FUNCTION_TAG
207 && tag != Logger::LAZY_COMPILE_TAG
208 && tag != Logger::REG_EXP_TAG
209 && tag != Logger::SCRIPT_TAG);
210 }
211
212
213 void CpuProfiler::CallbackEvent(Name* name, Address entry_point) { 203 void CpuProfiler::CallbackEvent(Name* name, Address entry_point) {
214 if (FilterOutCodeCreateEvent(Logger::CALLBACK_TAG)) return;
215 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); 204 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
216 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; 205 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
217 rec->start = entry_point; 206 rec->start = entry_point;
218 rec->entry = profiles_->NewCodeEntry( 207 rec->entry = profiles_->NewCodeEntry(
219 Logger::CALLBACK_TAG, 208 Logger::CALLBACK_TAG,
220 profiles_->GetName(name)); 209 profiles_->GetName(name));
221 rec->size = 1; 210 rec->size = 1;
222 processor_->Enqueue(evt_rec); 211 processor_->Enqueue(evt_rec);
223 } 212 }
224 213
225 214
226 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, 215 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
227 Code* code, 216 Code* code,
228 const char* name) { 217 const char* name) {
229 if (FilterOutCodeCreateEvent(tag)) return;
230 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); 218 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
231 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; 219 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
232 rec->start = code->address(); 220 rec->start = code->address();
233 rec->entry = profiles_->NewCodeEntry( 221 rec->entry = profiles_->NewCodeEntry(
234 tag, profiles_->GetFunctionName(name), CodeEntry::kEmptyNamePrefix, 222 tag, profiles_->GetFunctionName(name), CodeEntry::kEmptyNamePrefix,
235 CodeEntry::kEmptyResourceName, CpuProfileNode::kNoLineNumberInfo, 223 CodeEntry::kEmptyResourceName, CpuProfileNode::kNoLineNumberInfo,
236 CpuProfileNode::kNoColumnNumberInfo, NULL, code->instruction_start()); 224 CpuProfileNode::kNoColumnNumberInfo, NULL, code->instruction_start());
237 rec->size = code->ExecutableSize(); 225 rec->size = code->ExecutableSize();
238 processor_->Enqueue(evt_rec); 226 processor_->Enqueue(evt_rec);
239 } 227 }
240 228
241 229
242 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, 230 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
243 Code* code, 231 Code* code,
244 Name* name) { 232 Name* name) {
245 if (FilterOutCodeCreateEvent(tag)) return;
246 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); 233 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
247 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; 234 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
248 rec->start = code->address(); 235 rec->start = code->address();
249 rec->entry = profiles_->NewCodeEntry( 236 rec->entry = profiles_->NewCodeEntry(
250 tag, profiles_->GetFunctionName(name), CodeEntry::kEmptyNamePrefix, 237 tag, profiles_->GetFunctionName(name), CodeEntry::kEmptyNamePrefix,
251 CodeEntry::kEmptyResourceName, CpuProfileNode::kNoLineNumberInfo, 238 CodeEntry::kEmptyResourceName, CpuProfileNode::kNoLineNumberInfo,
252 CpuProfileNode::kNoColumnNumberInfo, NULL, code->instruction_start()); 239 CpuProfileNode::kNoColumnNumberInfo, NULL, code->instruction_start());
253 rec->size = code->ExecutableSize(); 240 rec->size = code->ExecutableSize();
254 processor_->Enqueue(evt_rec); 241 processor_->Enqueue(evt_rec);
255 } 242 }
256 243
257 244
258 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, 245 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code,
259 SharedFunctionInfo* shared, 246 SharedFunctionInfo* shared,
260 CompilationInfo* info, Name* script_name) { 247 CompilationInfo* info, Name* script_name) {
261 if (FilterOutCodeCreateEvent(tag)) return;
262 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); 248 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
263 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; 249 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
264 rec->start = code->address(); 250 rec->start = code->address();
265 rec->entry = profiles_->NewCodeEntry( 251 rec->entry = profiles_->NewCodeEntry(
266 tag, profiles_->GetFunctionName(shared->DebugName()), 252 tag, profiles_->GetFunctionName(shared->DebugName()),
267 CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name), 253 CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name),
268 CpuProfileNode::kNoLineNumberInfo, CpuProfileNode::kNoColumnNumberInfo, 254 CpuProfileNode::kNoLineNumberInfo, CpuProfileNode::kNoColumnNumberInfo,
269 NULL, code->instruction_start()); 255 NULL, code->instruction_start());
270 if (info) { 256 if (info) {
271 rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges()); 257 rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges());
272 rec->entry->set_inlined_function_infos(info->inlined_function_infos()); 258 rec->entry->set_inlined_function_infos(info->inlined_function_infos());
273 } 259 }
274 rec->entry->FillFunctionInfo(shared); 260 rec->entry->FillFunctionInfo(shared);
275 rec->size = code->ExecutableSize(); 261 rec->size = code->ExecutableSize();
276 processor_->Enqueue(evt_rec); 262 processor_->Enqueue(evt_rec);
277 } 263 }
278 264
279 265
280 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, 266 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code,
281 SharedFunctionInfo* shared, 267 SharedFunctionInfo* shared,
282 CompilationInfo* info, Name* script_name, 268 CompilationInfo* info, Name* script_name,
283 int line, int column) { 269 int line, int column) {
284 if (FilterOutCodeCreateEvent(tag)) return;
285 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); 270 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
286 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; 271 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
287 rec->start = code->address(); 272 rec->start = code->address();
288 Script* script = Script::cast(shared->script()); 273 Script* script = Script::cast(shared->script());
289 JITLineInfoTable* line_table = NULL; 274 JITLineInfoTable* line_table = NULL;
290 if (script) { 275 if (script) {
291 line_table = new JITLineInfoTable(); 276 line_table = new JITLineInfoTable();
292 for (RelocIterator it(code); !it.done(); it.next()) { 277 for (RelocIterator it(code); !it.done(); it.next()) {
293 RelocInfo::Mode mode = it.rinfo()->rmode(); 278 RelocInfo::Mode mode = it.rinfo()->rmode();
294 if (RelocInfo::IsPosition(mode)) { 279 if (RelocInfo::IsPosition(mode)) {
(...skipping 16 matching lines...) Expand all
311 } 296 }
312 rec->entry->FillFunctionInfo(shared); 297 rec->entry->FillFunctionInfo(shared);
313 rec->size = code->ExecutableSize(); 298 rec->size = code->ExecutableSize();
314 processor_->Enqueue(evt_rec); 299 processor_->Enqueue(evt_rec);
315 } 300 }
316 301
317 302
318 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, 303 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
319 Code* code, 304 Code* code,
320 int args_count) { 305 int args_count) {
321 if (FilterOutCodeCreateEvent(tag)) return;
322 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); 306 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
323 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; 307 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
324 rec->start = code->address(); 308 rec->start = code->address();
325 rec->entry = profiles_->NewCodeEntry( 309 rec->entry = profiles_->NewCodeEntry(
326 tag, profiles_->GetName(args_count), "args_count: ", 310 tag, profiles_->GetName(args_count), "args_count: ",
327 CodeEntry::kEmptyResourceName, CpuProfileNode::kNoLineNumberInfo, 311 CodeEntry::kEmptyResourceName, CpuProfileNode::kNoLineNumberInfo,
328 CpuProfileNode::kNoColumnNumberInfo, NULL, code->instruction_start()); 312 CpuProfileNode::kNoColumnNumberInfo, NULL, code->instruction_start());
329 rec->size = code->ExecutableSize(); 313 rec->size = code->ExecutableSize();
330 processor_->Enqueue(evt_rec); 314 processor_->Enqueue(evt_rec);
331 } 315 }
(...skipping 28 matching lines...) Expand all
360 processor_->Enqueue(evt_rec); 344 processor_->Enqueue(evt_rec);
361 processor_->AddDeoptStack(isolate_, pc, fp_to_sp_delta); 345 processor_->AddDeoptStack(isolate_, pc, fp_to_sp_delta);
362 } 346 }
363 347
364 348
365 void CpuProfiler::CodeDeleteEvent(Address from) { 349 void CpuProfiler::CodeDeleteEvent(Address from) {
366 } 350 }
367 351
368 352
369 void CpuProfiler::GetterCallbackEvent(Name* name, Address entry_point) { 353 void CpuProfiler::GetterCallbackEvent(Name* name, Address entry_point) {
370 if (FilterOutCodeCreateEvent(Logger::CALLBACK_TAG)) return;
371 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); 354 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
372 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; 355 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
373 rec->start = entry_point; 356 rec->start = entry_point;
374 rec->entry = profiles_->NewCodeEntry( 357 rec->entry = profiles_->NewCodeEntry(
375 Logger::CALLBACK_TAG, 358 Logger::CALLBACK_TAG,
376 profiles_->GetName(name), 359 profiles_->GetName(name),
377 "get "); 360 "get ");
378 rec->size = 1; 361 rec->size = 1;
379 processor_->Enqueue(evt_rec); 362 processor_->Enqueue(evt_rec);
380 } 363 }
381 364
382 365
383 void CpuProfiler::RegExpCodeCreateEvent(Code* code, String* source) { 366 void CpuProfiler::RegExpCodeCreateEvent(Code* code, String* source) {
384 if (FilterOutCodeCreateEvent(Logger::REG_EXP_TAG)) return;
385 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); 367 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
386 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; 368 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
387 rec->start = code->address(); 369 rec->start = code->address();
388 rec->entry = profiles_->NewCodeEntry( 370 rec->entry = profiles_->NewCodeEntry(
389 Logger::REG_EXP_TAG, profiles_->GetName(source), "RegExp: ", 371 Logger::REG_EXP_TAG, profiles_->GetName(source), "RegExp: ",
390 CodeEntry::kEmptyResourceName, CpuProfileNode::kNoLineNumberInfo, 372 CodeEntry::kEmptyResourceName, CpuProfileNode::kNoLineNumberInfo,
391 CpuProfileNode::kNoColumnNumberInfo, NULL, code->instruction_start()); 373 CpuProfileNode::kNoColumnNumberInfo, NULL, code->instruction_start());
392 rec->size = code->ExecutableSize(); 374 rec->size = code->ExecutableSize();
393 processor_->Enqueue(evt_rec); 375 processor_->Enqueue(evt_rec);
394 } 376 }
395 377
396 378
397 void CpuProfiler::SetterCallbackEvent(Name* name, Address entry_point) { 379 void CpuProfiler::SetterCallbackEvent(Name* name, Address entry_point) {
398 if (FilterOutCodeCreateEvent(Logger::CALLBACK_TAG)) return;
399 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); 380 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
400 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; 381 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
401 rec->start = entry_point; 382 rec->start = entry_point;
402 rec->entry = profiles_->NewCodeEntry( 383 rec->entry = profiles_->NewCodeEntry(
403 Logger::CALLBACK_TAG, 384 Logger::CALLBACK_TAG,
404 profiles_->GetName(name), 385 profiles_->GetName(name),
405 "set "); 386 "set ");
406 rec->size = 1; 387 rec->size = 1;
407 processor_->Enqueue(evt_rec); 388 processor_->Enqueue(evt_rec);
408 } 389 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 Builtins::Name id = static_cast<Builtins::Name>(i); 522 Builtins::Name id = static_cast<Builtins::Name>(i);
542 rec->start = builtins->builtin(id)->address(); 523 rec->start = builtins->builtin(id)->address();
543 rec->builtin_id = id; 524 rec->builtin_id = id;
544 processor_->Enqueue(evt_rec); 525 processor_->Enqueue(evt_rec);
545 } 526 }
546 } 527 }
547 528
548 529
549 } // namespace internal 530 } // namespace internal
550 } // namespace v8 531 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698