| OLD | NEW |
| 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 11 matching lines...) Expand all Loading... |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 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 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 33 | |
| 34 #include "frames-inl.h" | 32 #include "frames-inl.h" |
| 35 #include "hashmap.h" | 33 #include "hashmap.h" |
| 36 #include "log-inl.h" | 34 #include "log-inl.h" |
| 37 #include "vm-state-inl.h" | 35 #include "vm-state-inl.h" |
| 38 | 36 |
| 39 #include "../include/v8-profiler.h" | 37 #include "../include/v8-profiler.h" |
| 40 | 38 |
| 41 namespace v8 { | 39 namespace v8 { |
| 42 namespace internal { | 40 namespace internal { |
| 43 | 41 |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 processor_->Stop(); | 565 processor_->Stop(); |
| 568 processor_->Join(); | 566 processor_->Join(); |
| 569 delete processor_; | 567 delete processor_; |
| 570 delete generator_; | 568 delete generator_; |
| 571 processor_ = NULL; | 569 processor_ = NULL; |
| 572 NoBarrier_Store(&is_profiling_, false); | 570 NoBarrier_Store(&is_profiling_, false); |
| 573 generator_ = NULL; | 571 generator_ = NULL; |
| 574 logger->logging_nesting_ = saved_logging_nesting_; | 572 logger->logging_nesting_ = saved_logging_nesting_; |
| 575 } | 573 } |
| 576 | 574 |
| 577 } } // namespace v8::internal | |
| 578 | |
| 579 #endif // ENABLE_LOGGING_AND_PROFILING | |
| 580 | |
| 581 namespace v8 { | |
| 582 namespace internal { | |
| 583 | 575 |
| 584 void CpuProfiler::Setup() { | 576 void CpuProfiler::Setup() { |
| 585 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 586 Isolate* isolate = Isolate::Current(); | 577 Isolate* isolate = Isolate::Current(); |
| 587 if (isolate->cpu_profiler() == NULL) { | 578 if (isolate->cpu_profiler() == NULL) { |
| 588 isolate->set_cpu_profiler(new CpuProfiler()); | 579 isolate->set_cpu_profiler(new CpuProfiler()); |
| 589 } | 580 } |
| 590 #endif | |
| 591 } | 581 } |
| 592 | 582 |
| 593 | 583 |
| 594 void CpuProfiler::TearDown() { | 584 void CpuProfiler::TearDown() { |
| 595 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 596 Isolate* isolate = Isolate::Current(); | 585 Isolate* isolate = Isolate::Current(); |
| 597 if (isolate->cpu_profiler() != NULL) { | 586 if (isolate->cpu_profiler() != NULL) { |
| 598 delete isolate->cpu_profiler(); | 587 delete isolate->cpu_profiler(); |
| 599 } | 588 } |
| 600 isolate->set_cpu_profiler(NULL); | 589 isolate->set_cpu_profiler(NULL); |
| 601 #endif | |
| 602 } | 590 } |
| 603 | 591 |
| 604 } } // namespace v8::internal | 592 } } // namespace v8::internal |
| OLD | NEW |