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