| 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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 | 555 |
| 556 | 556 |
| 557 void CpuProfiler::StopProcessor() { | 557 void CpuProfiler::StopProcessor() { |
| 558 Logger* logger = Isolate::Current()->logger(); | 558 Logger* logger = Isolate::Current()->logger(); |
| 559 Sampler* sampler = reinterpret_cast<Sampler*>(logger->ticker_); | 559 Sampler* sampler = reinterpret_cast<Sampler*>(logger->ticker_); |
| 560 sampler->DecreaseProfilingDepth(); | 560 sampler->DecreaseProfilingDepth(); |
| 561 if (need_to_stop_sampler_) { | 561 if (need_to_stop_sampler_) { |
| 562 sampler->Stop(); | 562 sampler->Stop(); |
| 563 need_to_stop_sampler_ = false; | 563 need_to_stop_sampler_ = false; |
| 564 } | 564 } |
| 565 NoBarrier_Store(&is_profiling_, false); |
| 565 processor_->Stop(); | 566 processor_->Stop(); |
| 566 processor_->Join(); | 567 processor_->Join(); |
| 567 delete processor_; | 568 delete processor_; |
| 568 delete generator_; | 569 delete generator_; |
| 569 processor_ = NULL; | 570 processor_ = NULL; |
| 570 NoBarrier_Store(&is_profiling_, false); | |
| 571 generator_ = NULL; | 571 generator_ = NULL; |
| 572 logger->logging_nesting_ = saved_logging_nesting_; | 572 logger->logging_nesting_ = saved_logging_nesting_; |
| 573 } | 573 } |
| 574 | 574 |
| 575 | 575 |
| 576 void CpuProfiler::Setup() { | 576 void CpuProfiler::Setup() { |
| 577 Isolate* isolate = Isolate::Current(); | 577 Isolate* isolate = Isolate::Current(); |
| 578 if (isolate->cpu_profiler() == NULL) { | 578 if (isolate->cpu_profiler() == NULL) { |
| 579 isolate->set_cpu_profiler(new CpuProfiler()); | 579 isolate->set_cpu_profiler(new CpuProfiler()); |
| 580 } | 580 } |
| 581 } | 581 } |
| 582 | 582 |
| 583 | 583 |
| 584 void CpuProfiler::TearDown() { | 584 void CpuProfiler::TearDown() { |
| 585 Isolate* isolate = Isolate::Current(); | 585 Isolate* isolate = Isolate::Current(); |
| 586 if (isolate->cpu_profiler() != NULL) { | 586 if (isolate->cpu_profiler() != NULL) { |
| 587 delete isolate->cpu_profiler(); | 587 delete isolate->cpu_profiler(); |
| 588 } | 588 } |
| 589 isolate->set_cpu_profiler(NULL); | 589 isolate->set_cpu_profiler(NULL); |
| 590 } | 590 } |
| 591 | 591 |
| 592 } } // namespace v8::internal | 592 } } // namespace v8::internal |
| OLD | NEW |