| 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 12 matching lines...) Expand all Loading... |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "cpu-profiler-inl.h" | 30 #include "cpu-profiler-inl.h" |
| 31 | 31 |
| 32 #include "compiler.h" | 32 #include "compiler.h" |
| 33 #include "debug.h" |
| 33 #include "frames-inl.h" | 34 #include "frames-inl.h" |
| 34 #include "hashmap.h" | 35 #include "hashmap.h" |
| 35 #include "log-inl.h" | 36 #include "log-inl.h" |
| 36 #include "vm-state-inl.h" | 37 #include "vm-state-inl.h" |
| 37 | 38 |
| 38 #include "../include/v8-profiler.h" | 39 #include "../include/v8-profiler.h" |
| 39 | 40 |
| 40 namespace v8 { | 41 namespace v8 { |
| 41 namespace internal { | 42 namespace internal { |
| 42 | 43 |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 delete profiles_; | 431 delete profiles_; |
| 431 } | 432 } |
| 432 | 433 |
| 433 | 434 |
| 434 void CpuProfiler::ResetProfiles() { | 435 void CpuProfiler::ResetProfiles() { |
| 435 delete profiles_; | 436 delete profiles_; |
| 436 profiles_ = new CpuProfilesCollection(); | 437 profiles_ = new CpuProfilesCollection(); |
| 437 } | 438 } |
| 438 | 439 |
| 439 void CpuProfiler::StartProfiling(const char* title, bool record_samples) { | 440 void CpuProfiler::StartProfiling(const char* title, bool record_samples) { |
| 441 i::HandleScope scope(isolate_); |
| 442 v8::Local<v8::Context> context = v8::Debug::GetDebugContext(); |
| 443 v8::Context::Scope contextScope(context); |
| 440 if (profiles_->StartProfiling(title, next_profile_uid_++, record_samples)) { | 444 if (profiles_->StartProfiling(title, next_profile_uid_++, record_samples)) { |
| 441 StartProcessorIfNotStarted(); | 445 StartProcessorIfNotStarted(); |
| 442 } | 446 } |
| 443 processor_->AddCurrentStack(); | 447 processor_->AddCurrentStack(); |
| 444 } | 448 } |
| 445 | 449 |
| 446 | 450 |
| 447 void CpuProfiler::StartProfiling(String* title, bool record_samples) { | 451 void CpuProfiler::StartProfiling(String* title, bool record_samples) { |
| 448 StartProfiling(profiles_->GetName(title), record_samples); | 452 StartProfiling(profiles_->GetName(title), record_samples); |
| 449 } | 453 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 processor_->Join(); | 524 processor_->Join(); |
| 521 delete processor_; | 525 delete processor_; |
| 522 delete generator_; | 526 delete generator_; |
| 523 processor_ = NULL; | 527 processor_ = NULL; |
| 524 generator_ = NULL; | 528 generator_ = NULL; |
| 525 logger->logging_nesting_ = saved_logging_nesting_; | 529 logger->logging_nesting_ = saved_logging_nesting_; |
| 526 } | 530 } |
| 527 | 531 |
| 528 | 532 |
| 529 } } // namespace v8::internal | 533 } } // namespace v8::internal |
| OLD | NEW |