Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Side by Side Diff: src/cpu-profiler.cc

Issue 12340052: Use boolean instead of Atomic32 for is_profiling_ flag (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/cpu-profiler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 484
485 void CpuProfiler::StartProcessorIfNotStarted() { 485 void CpuProfiler::StartProcessorIfNotStarted() {
486 if (processor_ == NULL) { 486 if (processor_ == NULL) {
487 Isolate* isolate = Isolate::Current(); 487 Isolate* isolate = Isolate::Current();
488 488
489 // Disable logging when using the new implementation. 489 // Disable logging when using the new implementation.
490 saved_logging_nesting_ = isolate->logger()->logging_nesting_; 490 saved_logging_nesting_ = isolate->logger()->logging_nesting_;
491 isolate->logger()->logging_nesting_ = 0; 491 isolate->logger()->logging_nesting_ = 0;
492 generator_ = new ProfileGenerator(profiles_); 492 generator_ = new ProfileGenerator(profiles_);
493 processor_ = new ProfilerEventsProcessor(generator_); 493 processor_ = new ProfilerEventsProcessor(generator_);
494 NoBarrier_Store(&is_profiling_, true); 494 is_profiling_ = true;
495 processor_->Start(); 495 processor_->Start();
496 // Enumerate stuff we already have in the heap. 496 // Enumerate stuff we already have in the heap.
497 if (isolate->heap()->HasBeenSetUp()) { 497 if (isolate->heap()->HasBeenSetUp()) {
498 if (!FLAG_prof_browser_mode) { 498 if (!FLAG_prof_browser_mode) {
499 bool saved_log_code_flag = FLAG_log_code; 499 bool saved_log_code_flag = FLAG_log_code;
500 FLAG_log_code = true; 500 FLAG_log_code = true;
501 isolate->logger()->LogCodeObjects(); 501 isolate->logger()->LogCodeObjects();
502 FLAG_log_code = saved_log_code_flag; 502 FLAG_log_code = saved_log_code_flag;
503 } 503 }
504 isolate->logger()->LogCompiledFunctions(); 504 isolate->logger()->LogCompiledFunctions();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 545
546 546
547 void CpuProfiler::StopProcessor() { 547 void CpuProfiler::StopProcessor() {
548 Logger* logger = Isolate::Current()->logger(); 548 Logger* logger = Isolate::Current()->logger();
549 Sampler* sampler = reinterpret_cast<Sampler*>(logger->ticker_); 549 Sampler* sampler = reinterpret_cast<Sampler*>(logger->ticker_);
550 sampler->DecreaseProfilingDepth(); 550 sampler->DecreaseProfilingDepth();
551 if (need_to_stop_sampler_) { 551 if (need_to_stop_sampler_) {
552 sampler->Stop(); 552 sampler->Stop();
553 need_to_stop_sampler_ = false; 553 need_to_stop_sampler_ = false;
554 } 554 }
555 NoBarrier_Store(&is_profiling_, false); 555 is_profiling_ = false;
556 processor_->Stop(); 556 processor_->Stop();
557 processor_->Join(); 557 processor_->Join();
558 delete processor_; 558 delete processor_;
559 delete generator_; 559 delete generator_;
560 processor_ = NULL; 560 processor_ = NULL;
561 generator_ = NULL; 561 generator_ = NULL;
562 logger->logging_nesting_ = saved_logging_nesting_; 562 logger->logging_nesting_ = saved_logging_nesting_;
563 } 563 }
564 564
565 565
566 void CpuProfiler::SetUp() { 566 void CpuProfiler::SetUp() {
567 Isolate* isolate = Isolate::Current(); 567 Isolate* isolate = Isolate::Current();
568 if (isolate->cpu_profiler() == NULL) { 568 if (isolate->cpu_profiler() == NULL) {
569 isolate->set_cpu_profiler(new CpuProfiler()); 569 isolate->set_cpu_profiler(new CpuProfiler());
570 } 570 }
571 } 571 }
572 572
573 573
574 void CpuProfiler::TearDown() { 574 void CpuProfiler::TearDown() {
575 Isolate* isolate = Isolate::Current(); 575 Isolate* isolate = Isolate::Current();
576 if (isolate->cpu_profiler() != NULL) { 576 if (isolate->cpu_profiler() != NULL) {
577 delete isolate->cpu_profiler(); 577 delete isolate->cpu_profiler();
578 } 578 }
579 isolate->set_cpu_profiler(NULL); 579 isolate->set_cpu_profiler(NULL);
580 } 580 }
581 581
582 } } // namespace v8::internal 582 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/cpu-profiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698