| 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 void CpuProfiler::ResetProfiles() { | 425 void CpuProfiler::ResetProfiles() { |
| 426 delete profiles_; | 426 delete profiles_; |
| 427 profiles_ = new CpuProfilesCollection(isolate()->heap()); | 427 profiles_ = new CpuProfilesCollection(isolate()->heap()); |
| 428 } | 428 } |
| 429 | 429 |
| 430 | 430 |
| 431 void CpuProfiler::StartProfiling(const char* title, bool record_samples) { | 431 void CpuProfiler::StartProfiling(const char* title, bool record_samples) { |
| 432 if (profiles_->StartProfiling(title, record_samples)) { | 432 if (profiles_->StartProfiling(title, record_samples)) { |
| 433 StartProcessorIfNotStarted(); | 433 StartProcessorIfNotStarted(); |
| 434 } | 434 } |
| 435 processor_->AddCurrentStack(isolate_); | |
| 436 } | 435 } |
| 437 | 436 |
| 438 | 437 |
| 439 void CpuProfiler::StartProfiling(String* title, bool record_samples) { | 438 void CpuProfiler::StartProfiling(String* title, bool record_samples) { |
| 440 StartProfiling(profiles_->GetName(title), record_samples); | 439 StartProfiling(profiles_->GetName(title), record_samples); |
| 441 } | 440 } |
| 442 | 441 |
| 443 | 442 |
| 444 void CpuProfiler::StartProcessorIfNotStarted() { | 443 void CpuProfiler::StartProcessorIfNotStarted() { |
| 445 if (processor_ == NULL) { | 444 if (processor_ == NULL) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 456 ASSERT(isolate_->heap()->HasBeenSetUp()); | 455 ASSERT(isolate_->heap()->HasBeenSetUp()); |
| 457 if (!FLAG_prof_browser_mode) { | 456 if (!FLAG_prof_browser_mode) { |
| 458 logger->LogCodeObjects(); | 457 logger->LogCodeObjects(); |
| 459 } | 458 } |
| 460 logger->LogCompiledFunctions(); | 459 logger->LogCompiledFunctions(); |
| 461 logger->LogAccessorCallbacks(); | 460 logger->LogAccessorCallbacks(); |
| 462 LogBuiltins(); | 461 LogBuiltins(); |
| 463 // Enable stack sampling. | 462 // Enable stack sampling. |
| 464 sampler->SetHasProcessingThread(true); | 463 sampler->SetHasProcessingThread(true); |
| 465 sampler->IncreaseProfilingDepth(); | 464 sampler->IncreaseProfilingDepth(); |
| 465 processor_->AddCurrentStack(isolate_); |
| 466 processor_->StartSynchronously(); | 466 processor_->StartSynchronously(); |
| 467 } | 467 } |
| 468 } | 468 } |
| 469 | 469 |
| 470 | 470 |
| 471 CpuProfile* CpuProfiler::StopProfiling(const char* title) { | 471 CpuProfile* CpuProfiler::StopProfiling(const char* title) { |
| 472 if (!is_profiling_) return NULL; | 472 if (!is_profiling_) return NULL; |
| 473 StopProcessorIfLastProfile(title); | 473 StopProcessorIfLastProfile(title); |
| 474 CpuProfile* result = profiles_->StopProfiling(title); | 474 CpuProfile* result = profiles_->StopProfiling(title); |
| 475 if (result != NULL) { | 475 if (result != NULL) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; | 515 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; |
| 516 Builtins::Name id = static_cast<Builtins::Name>(i); | 516 Builtins::Name id = static_cast<Builtins::Name>(i); |
| 517 rec->start = builtins->builtin(id)->address(); | 517 rec->start = builtins->builtin(id)->address(); |
| 518 rec->builtin_id = id; | 518 rec->builtin_id = id; |
| 519 processor_->Enqueue(evt_rec); | 519 processor_->Enqueue(evt_rec); |
| 520 } | 520 } |
| 521 } | 521 } |
| 522 | 522 |
| 523 | 523 |
| 524 } } // namespace v8::internal | 524 } } // namespace v8::internal |
| OLD | NEW |