OLD | NEW |
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 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2555 code_aging_helper_ = NULL; | 2555 code_aging_helper_ = NULL; |
2556 delete stats_table_; | 2556 delete stats_table_; |
2557 stats_table_ = NULL; | 2557 stats_table_ = NULL; |
2558 | 2558 |
2559 delete materialized_object_store_; | 2559 delete materialized_object_store_; |
2560 materialized_object_store_ = NULL; | 2560 materialized_object_store_ = NULL; |
2561 | 2561 |
2562 delete logger_; | 2562 delete logger_; |
2563 logger_ = NULL; | 2563 logger_ = NULL; |
2564 | 2564 |
2565 delete counters_; | |
2566 counters_ = NULL; | 2565 counters_ = NULL; |
2567 | 2566 |
2568 delete handle_scope_implementer_; | 2567 delete handle_scope_implementer_; |
2569 handle_scope_implementer_ = NULL; | 2568 handle_scope_implementer_ = NULL; |
2570 | 2569 |
2571 delete code_tracer(); | 2570 delete code_tracer(); |
2572 set_code_tracer(NULL); | 2571 set_code_tracer(NULL); |
2573 | 2572 |
2574 delete compilation_cache_; | 2573 delete compilation_cache_; |
2575 compilation_cache_ = NULL; | 2574 compilation_cache_ = NULL; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2641 handler->has_terminated_ = false; | 2640 handler->has_terminated_ = false; |
2642 handler->exception_ = pending_exception(); | 2641 handler->exception_ = pending_exception(); |
2643 // Propagate to the external try-catch only if we got an actual message. | 2642 // Propagate to the external try-catch only if we got an actual message. |
2644 if (thread_local_top_.pending_message_obj_->IsTheHole(this)) return true; | 2643 if (thread_local_top_.pending_message_obj_->IsTheHole(this)) return true; |
2645 | 2644 |
2646 handler->message_obj_ = thread_local_top_.pending_message_obj_; | 2645 handler->message_obj_ = thread_local_top_.pending_message_obj_; |
2647 } | 2646 } |
2648 return true; | 2647 return true; |
2649 } | 2648 } |
2650 | 2649 |
| 2650 static base::LazyMutex initialize_counters_mutex = LAZY_MUTEX_INITIALIZER; |
| 2651 |
| 2652 bool Isolate::InitializeCounters() { |
| 2653 if (counters_ != NULL) return false; |
| 2654 base::LockGuard<base::Mutex> guard(initialize_counters_mutex.Pointer()); |
| 2655 if (counters_ != NULL) return false; |
| 2656 counters_shared_ = std::make_shared<Counters>(this); |
| 2657 counters_ = counters_shared_.get(); |
| 2658 return true; |
| 2659 } |
2651 | 2660 |
2652 void Isolate::InitializeLoggingAndCounters() { | 2661 void Isolate::InitializeLoggingAndCounters() { |
2653 if (logger_ == NULL) { | 2662 if (logger_ == NULL) { |
2654 logger_ = new Logger(this); | 2663 logger_ = new Logger(this); |
2655 } | 2664 } |
2656 if (counters_ == NULL) { | 2665 InitializeCounters(); |
2657 counters_ = new Counters(this); | |
2658 } | |
2659 } | 2666 } |
2660 | 2667 |
2661 | 2668 |
2662 bool Isolate::Init(Deserializer* des) { | 2669 bool Isolate::Init(Deserializer* des) { |
2663 TRACE_ISOLATE(init); | 2670 TRACE_ISOLATE(init); |
2664 | 2671 |
2665 stress_deopt_count_ = FLAG_deopt_every_n_times; | 2672 stress_deopt_count_ = FLAG_deopt_every_n_times; |
2666 | 2673 |
2667 has_fatal_error_ = false; | 2674 has_fatal_error_ = false; |
2668 | 2675 |
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3774 // Then check whether this scope intercepts. | 3781 // Then check whether this scope intercepts. |
3775 if ((flag & intercept_mask_)) { | 3782 if ((flag & intercept_mask_)) { |
3776 intercepted_flags_ |= flag; | 3783 intercepted_flags_ |= flag; |
3777 return true; | 3784 return true; |
3778 } | 3785 } |
3779 return false; | 3786 return false; |
3780 } | 3787 } |
3781 | 3788 |
3782 } // namespace internal | 3789 } // namespace internal |
3783 } // namespace v8 | 3790 } // namespace v8 |
OLD | NEW |