| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 running_(true), | 51 running_(true), |
| 52 ticks_buffer_(sizeof(TickSampleEventRecord), | 52 ticks_buffer_(sizeof(TickSampleEventRecord), |
| 53 kTickSamplesBufferChunkSize, | 53 kTickSamplesBufferChunkSize, |
| 54 kTickSamplesBufferChunksCount), | 54 kTickSamplesBufferChunksCount), |
| 55 enqueue_order_(0) { | 55 enqueue_order_(0) { |
| 56 } | 56 } |
| 57 | 57 |
| 58 | 58 |
| 59 void ProfilerEventsProcessor::CallbackCreateEvent(Logger::LogEventsAndTags tag, | 59 void ProfilerEventsProcessor::CallbackCreateEvent(Logger::LogEventsAndTags tag, |
| 60 const char* prefix, | 60 const char* prefix, |
| 61 String* name, | 61 Name* name, |
| 62 Address start) { | 62 Address start) { |
| 63 if (FilterOutCodeCreateEvent(tag)) return; | 63 if (FilterOutCodeCreateEvent(tag)) return; |
| 64 CodeEventsContainer evt_rec; | 64 CodeEventsContainer evt_rec; |
| 65 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; | 65 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
| 66 rec->type = CodeEventRecord::CODE_CREATION; | 66 rec->type = CodeEventRecord::CODE_CREATION; |
| 67 rec->order = ++enqueue_order_; | 67 rec->order = ++enqueue_order_; |
| 68 rec->start = start; | 68 rec->start = start; |
| 69 rec->entry = generator_->NewCodeEntry(tag, prefix, name); | 69 rec->entry = generator_->NewCodeEntry(tag, prefix, name); |
| 70 rec->size = 1; | 70 rec->size = 1; |
| 71 rec->shared = NULL; | 71 rec->shared = NULL; |
| 72 events_buffer_.Enqueue(evt_rec); | 72 events_buffer_.Enqueue(evt_rec); |
| 73 } | 73 } |
| 74 | 74 |
| 75 | 75 |
| 76 void ProfilerEventsProcessor::CodeCreateEvent(Logger::LogEventsAndTags tag, | 76 void ProfilerEventsProcessor::CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 77 String* name, | 77 Name* name, |
| 78 String* resource_name, | 78 String* resource_name, |
| 79 int line_number, | 79 int line_number, |
| 80 Address start, | 80 Address start, |
| 81 unsigned size, | 81 unsigned size, |
| 82 Address shared) { | 82 Address shared) { |
| 83 if (FilterOutCodeCreateEvent(tag)) return; | 83 if (FilterOutCodeCreateEvent(tag)) return; |
| 84 CodeEventsContainer evt_rec; | 84 CodeEventsContainer evt_rec; |
| 85 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; | 85 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
| 86 rec->type = CodeEventRecord::CODE_CREATION; | 86 rec->type = CodeEventRecord::CODE_CREATION; |
| 87 rec->order = ++enqueue_order_; | 87 rec->order = ++enqueue_order_; |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 delete profile; | 335 delete profile; |
| 336 } | 336 } |
| 337 | 337 |
| 338 | 338 |
| 339 bool CpuProfiler::HasDetachedProfiles() { | 339 bool CpuProfiler::HasDetachedProfiles() { |
| 340 ASSERT(Isolate::Current()->cpu_profiler() != NULL); | 340 ASSERT(Isolate::Current()->cpu_profiler() != NULL); |
| 341 return Isolate::Current()->cpu_profiler()->profiles_->HasDetachedProfiles(); | 341 return Isolate::Current()->cpu_profiler()->profiles_->HasDetachedProfiles(); |
| 342 } | 342 } |
| 343 | 343 |
| 344 | 344 |
| 345 void CpuProfiler::CallbackEvent(String* name, Address entry_point) { | 345 void CpuProfiler::CallbackEvent(Name* name, Address entry_point) { |
| 346 Isolate::Current()->cpu_profiler()->processor_->CallbackCreateEvent( | 346 Isolate::Current()->cpu_profiler()->processor_->CallbackCreateEvent( |
| 347 Logger::CALLBACK_TAG, CodeEntry::kEmptyNamePrefix, name, entry_point); | 347 Logger::CALLBACK_TAG, CodeEntry::kEmptyNamePrefix, name, entry_point); |
| 348 } | 348 } |
| 349 | 349 |
| 350 | 350 |
| 351 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, | 351 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 352 Code* code, const char* comment) { | 352 Code* code, const char* comment) { |
| 353 Isolate::Current()->cpu_profiler()->processor_->CodeCreateEvent( | 353 Isolate::Current()->cpu_profiler()->processor_->CodeCreateEvent( |
| 354 tag, comment, code->address(), code->ExecutableSize()); | 354 tag, comment, code->address(), code->ExecutableSize()); |
| 355 } | 355 } |
| 356 | 356 |
| 357 | 357 |
| 358 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, | 358 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 359 Code* code, String* name) { | 359 Code* code, Name* name) { |
| 360 Isolate* isolate = Isolate::Current(); | 360 Isolate* isolate = Isolate::Current(); |
| 361 isolate->cpu_profiler()->processor_->CodeCreateEvent( | 361 isolate->cpu_profiler()->processor_->CodeCreateEvent( |
| 362 tag, | 362 tag, |
| 363 name, | 363 name, |
| 364 isolate->heap()->empty_string(), | 364 isolate->heap()->empty_string(), |
| 365 v8::CpuProfileNode::kNoLineNumberInfo, | 365 v8::CpuProfileNode::kNoLineNumberInfo, |
| 366 code->address(), | 366 code->address(), |
| 367 code->ExecutableSize(), | 367 code->ExecutableSize(), |
| 368 NULL); | 368 NULL); |
| 369 } | 369 } |
| 370 | 370 |
| 371 | 371 |
| 372 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, | 372 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 373 Code* code, | 373 Code* code, |
| 374 SharedFunctionInfo* shared, | 374 SharedFunctionInfo* shared, |
| 375 String* name) { | 375 Name* name) { |
| 376 Isolate* isolate = Isolate::Current(); | 376 Isolate* isolate = Isolate::Current(); |
| 377 isolate->cpu_profiler()->processor_->CodeCreateEvent( | 377 isolate->cpu_profiler()->processor_->CodeCreateEvent( |
| 378 tag, | 378 tag, |
| 379 name, | 379 name, |
| 380 isolate->heap()->empty_string(), | 380 isolate->heap()->empty_string(), |
| 381 v8::CpuProfileNode::kNoLineNumberInfo, | 381 v8::CpuProfileNode::kNoLineNumberInfo, |
| 382 code->address(), | 382 code->address(), |
| 383 code->ExecutableSize(), | 383 code->ExecutableSize(), |
| 384 shared->address()); | 384 shared->address()); |
| 385 } | 385 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 void CpuProfiler::CodeDeleteEvent(Address from) { | 418 void CpuProfiler::CodeDeleteEvent(Address from) { |
| 419 } | 419 } |
| 420 | 420 |
| 421 | 421 |
| 422 void CpuProfiler::SharedFunctionInfoMoveEvent(Address from, Address to) { | 422 void CpuProfiler::SharedFunctionInfoMoveEvent(Address from, Address to) { |
| 423 CpuProfiler* profiler = Isolate::Current()->cpu_profiler(); | 423 CpuProfiler* profiler = Isolate::Current()->cpu_profiler(); |
| 424 profiler->processor_->SharedFunctionInfoMoveEvent(from, to); | 424 profiler->processor_->SharedFunctionInfoMoveEvent(from, to); |
| 425 } | 425 } |
| 426 | 426 |
| 427 | 427 |
| 428 void CpuProfiler::GetterCallbackEvent(String* name, Address entry_point) { | 428 void CpuProfiler::GetterCallbackEvent(Name* name, Address entry_point) { |
| 429 Isolate::Current()->cpu_profiler()->processor_->CallbackCreateEvent( | 429 Isolate::Current()->cpu_profiler()->processor_->CallbackCreateEvent( |
| 430 Logger::CALLBACK_TAG, "get ", name, entry_point); | 430 Logger::CALLBACK_TAG, "get ", name, entry_point); |
| 431 } | 431 } |
| 432 | 432 |
| 433 | 433 |
| 434 void CpuProfiler::RegExpCodeCreateEvent(Code* code, String* source) { | 434 void CpuProfiler::RegExpCodeCreateEvent(Code* code, String* source) { |
| 435 Isolate::Current()->cpu_profiler()->processor_->RegExpCodeCreateEvent( | 435 Isolate::Current()->cpu_profiler()->processor_->RegExpCodeCreateEvent( |
| 436 Logger::REG_EXP_TAG, | 436 Logger::REG_EXP_TAG, |
| 437 "RegExp: ", | 437 "RegExp: ", |
| 438 source, | 438 source, |
| 439 code->address(), | 439 code->address(), |
| 440 code->ExecutableSize()); | 440 code->ExecutableSize()); |
| 441 } | 441 } |
| 442 | 442 |
| 443 | 443 |
| 444 void CpuProfiler::SetterCallbackEvent(String* name, Address entry_point) { | 444 void CpuProfiler::SetterCallbackEvent(Name* name, Address entry_point) { |
| 445 Isolate::Current()->cpu_profiler()->processor_->CallbackCreateEvent( | 445 Isolate::Current()->cpu_profiler()->processor_->CallbackCreateEvent( |
| 446 Logger::CALLBACK_TAG, "set ", name, entry_point); | 446 Logger::CALLBACK_TAG, "set ", name, entry_point); |
| 447 } | 447 } |
| 448 | 448 |
| 449 | 449 |
| 450 CpuProfiler::CpuProfiler() | 450 CpuProfiler::CpuProfiler() |
| 451 : profiles_(new CpuProfilesCollection()), | 451 : profiles_(new CpuProfilesCollection()), |
| 452 next_profile_uid_(1), | 452 next_profile_uid_(1), |
| 453 token_enumerator_(new TokenEnumerator()), | 453 token_enumerator_(new TokenEnumerator()), |
| 454 generator_(NULL), | 454 generator_(NULL), |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 | 573 |
| 574 void CpuProfiler::TearDown() { | 574 void CpuProfiler::TearDown() { |
| 575 Isolate* isolate = Isolate::Current(); | 575 Isolate* isolate = Isolate::Current(); |
| 576 if (isolate->cpu_profiler() != NULL) { | 576 if (isolate->cpu_profiler() != NULL) { |
| 577 delete isolate->cpu_profiler(); | 577 delete isolate->cpu_profiler(); |
| 578 } | 578 } |
| 579 isolate->set_cpu_profiler(NULL); | 579 isolate->set_cpu_profiler(NULL); |
| 580 } | 580 } |
| 581 | 581 |
| 582 } } // namespace v8::internal | 582 } } // namespace v8::internal |
| OLD | NEW |