| 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 <stdlib.h> | 5 #include <stdlib.h> |
| 6 | 6 |
| 7 #include <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/v8.h" | 10 #include "src/v8.h" |
| (...skipping 2651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2662 } | 2662 } |
| 2663 | 2663 |
| 2664 | 2664 |
| 2665 void Isolate::SetUseCounterCallback(v8::Isolate::UseCounterCallback callback) { | 2665 void Isolate::SetUseCounterCallback(v8::Isolate::UseCounterCallback callback) { |
| 2666 DCHECK(!use_counter_callback_); | 2666 DCHECK(!use_counter_callback_); |
| 2667 use_counter_callback_ = callback; | 2667 use_counter_callback_ = callback; |
| 2668 } | 2668 } |
| 2669 | 2669 |
| 2670 | 2670 |
| 2671 void Isolate::CountUsage(v8::Isolate::UseCounterFeature feature) { | 2671 void Isolate::CountUsage(v8::Isolate::UseCounterFeature feature) { |
| 2672 if (use_counter_callback_) { | 2672 // The counter callback may cause the embedder to call into V8, which is not |
| 2673 use_counter_callback_(reinterpret_cast<v8::Isolate*>(this), feature); | 2673 // generally possible during GC. |
| 2674 if (heap_.gc_state() == Heap::NOT_IN_GC) { |
| 2675 if (use_counter_callback_) { |
| 2676 HandleScope handle_scope(this); |
| 2677 use_counter_callback_(reinterpret_cast<v8::Isolate*>(this), feature); |
| 2678 } |
| 2679 } else { |
| 2680 heap_.IncrementDeferredCount(feature); |
| 2674 } | 2681 } |
| 2675 } | 2682 } |
| 2676 | 2683 |
| 2677 | 2684 |
| 2678 BasicBlockProfiler* Isolate::GetOrCreateBasicBlockProfiler() { | 2685 BasicBlockProfiler* Isolate::GetOrCreateBasicBlockProfiler() { |
| 2679 if (basic_block_profiler_ == NULL) { | 2686 if (basic_block_profiler_ == NULL) { |
| 2680 basic_block_profiler_ = new BasicBlockProfiler(); | 2687 basic_block_profiler_ = new BasicBlockProfiler(); |
| 2681 } | 2688 } |
| 2682 return basic_block_profiler_; | 2689 return basic_block_profiler_; |
| 2683 } | 2690 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2775 if (prev_ && prev_->Intercept(flag)) return true; | 2782 if (prev_ && prev_->Intercept(flag)) return true; |
| 2776 // Then check whether this scope intercepts. | 2783 // Then check whether this scope intercepts. |
| 2777 if ((flag & intercept_mask_)) { | 2784 if ((flag & intercept_mask_)) { |
| 2778 intercepted_flags_ |= flag; | 2785 intercepted_flags_ |= flag; |
| 2779 return true; | 2786 return true; |
| 2780 } | 2787 } |
| 2781 return false; | 2788 return false; |
| 2782 } | 2789 } |
| 2783 | 2790 |
| 2784 } } // namespace v8::internal | 2791 } } // namespace v8::internal |
| OLD | NEW |