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

Side by Side Diff: src/isolate.cc

Issue 2918703002: Localize counter class member functions. (Closed)
Patch Set: Remove need for mutex to initialize counters. Created 3 years, 6 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/isolate.h" 5 #include "src/isolate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <fstream> // NOLINT(readability/streams) 9 #include <fstream> // NOLINT(readability/streams)
10 #include <sstream> 10 #include <sstream>
(...skipping 2619 matching lines...) Expand 10 before | Expand all | Expand 10 after
2630 handler->has_terminated_ = false; 2630 handler->has_terminated_ = false;
2631 handler->exception_ = pending_exception(); 2631 handler->exception_ = pending_exception();
2632 // Propagate to the external try-catch only if we got an actual message. 2632 // Propagate to the external try-catch only if we got an actual message.
2633 if (thread_local_top_.pending_message_obj_->IsTheHole(this)) return true; 2633 if (thread_local_top_.pending_message_obj_->IsTheHole(this)) return true;
2634 2634
2635 handler->message_obj_ = thread_local_top_.pending_message_obj_; 2635 handler->message_obj_ = thread_local_top_.pending_message_obj_;
2636 } 2636 }
2637 return true; 2637 return true;
2638 } 2638 }
2639 2639
2640 static base::LazyMutex initialize_counters_mutex = LAZY_MUTEX_INITIALIZER;
2641
2642 bool Isolate::InitializeCounters() { 2640 bool Isolate::InitializeCounters() {
2643 if (counters_ != nullptr) return false; 2641 if (counters_ != nullptr) return false;
2644 base::LockGuard<base::Mutex> guard(initialize_counters_mutex.Pointer());
2645 if (counters_ != nullptr) return false;
2646 counters_shared_ = std::make_shared<Counters>(this); 2642 counters_shared_ = std::make_shared<Counters>(this);
2647 counters_ = counters_shared_.get(); 2643 counters_ = counters_shared_.get();
2648 return true; 2644 return true;
2649 } 2645 }
2650 2646
2651 void Isolate::InitializeLoggingAndCounters() { 2647 void Isolate::InitializeLoggingAndCounters() {
2652 if (logger_ == NULL) { 2648 if (logger_ == NULL) {
2653 logger_ = new Logger(this); 2649 logger_ = new Logger(this);
2654 } 2650 }
2655 InitializeCounters(); 2651 InitializeCounters();
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
3787 // Then check whether this scope intercepts. 3783 // Then check whether this scope intercepts.
3788 if ((flag & intercept_mask_)) { 3784 if ((flag & intercept_mask_)) {
3789 intercepted_flags_ |= flag; 3785 intercepted_flags_ |= flag;
3790 return true; 3786 return true;
3791 } 3787 }
3792 return false; 3788 return false;
3793 } 3789 }
3794 3790
3795 } // namespace internal 3791 } // namespace internal
3796 } // namespace v8 3792 } // namespace v8
OLDNEW
« src/counters.cc ('K') | « src/counters.cc ('k') | test/unittests/counters-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698