OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/heap/embedder-tracing.h" | 5 #include "src/heap/embedder-tracing.h" |
6 | 6 |
7 #include "src/base/logging.h" | 7 #include "src/base/logging.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 23 matching lines...) Expand all Loading... |
34 void LocalEmbedderHeapTracer::EnterFinalPause() { | 34 void LocalEmbedderHeapTracer::EnterFinalPause() { |
35 if (!InUse()) return; | 35 if (!InUse()) return; |
36 | 36 |
37 remote_tracer_->EnterFinalPause(); | 37 remote_tracer_->EnterFinalPause(); |
38 } | 38 } |
39 | 39 |
40 bool LocalEmbedderHeapTracer::Trace( | 40 bool LocalEmbedderHeapTracer::Trace( |
41 double deadline, EmbedderHeapTracer::AdvanceTracingActions actions) { | 41 double deadline, EmbedderHeapTracer::AdvanceTracingActions actions) { |
42 if (!InUse()) return false; | 42 if (!InUse()) return false; |
43 | 43 |
44 RegisterWrappersWithRemoteTracer(); | 44 DCHECK_EQ(0, NumberOfCachedWrappersToTrace()); |
45 return remote_tracer_->AdvanceTracing(deadline, actions); | 45 return remote_tracer_->AdvanceTracing(deadline, actions); |
46 } | 46 } |
47 | 47 |
48 size_t LocalEmbedderHeapTracer::NumberOfWrappersToTrace() { | 48 size_t LocalEmbedderHeapTracer::NumberOfWrappersToTrace() { |
49 return (InUse()) | 49 return (InUse()) |
50 ? cached_wrappers_to_trace_.size() + | 50 ? cached_wrappers_to_trace_.size() + |
51 remote_tracer_->NumberOfWrappersToTrace() | 51 remote_tracer_->NumberOfWrappersToTrace() |
52 : 0; | 52 : 0; |
53 } | 53 } |
54 | 54 |
55 void LocalEmbedderHeapTracer::RegisterWrappersWithRemoteTracer() { | 55 void LocalEmbedderHeapTracer::RegisterWrappersWithRemoteTracer() { |
56 if (!InUse()) return; | 56 if (!InUse()) return; |
57 | 57 |
58 if (cached_wrappers_to_trace_.empty()) { | 58 if (cached_wrappers_to_trace_.empty()) { |
59 return; | 59 return; |
60 } | 60 } |
61 | 61 |
62 remote_tracer_->RegisterV8References(cached_wrappers_to_trace_); | 62 remote_tracer_->RegisterV8References(cached_wrappers_to_trace_); |
63 cached_wrappers_to_trace_.clear(); | 63 cached_wrappers_to_trace_.clear(); |
64 } | 64 } |
65 | 65 |
66 bool LocalEmbedderHeapTracer::RequiresImmediateWrapperProcessing() { | 66 bool LocalEmbedderHeapTracer::RequiresImmediateWrapperProcessing() { |
67 const size_t kTooManyWrappers = 16000; | 67 const size_t kTooManyWrappers = 16000; |
68 return cached_wrappers_to_trace_.size() > kTooManyWrappers; | 68 return cached_wrappers_to_trace_.size() > kTooManyWrappers; |
69 } | 69 } |
70 | 70 |
71 } // namespace internal | 71 } // namespace internal |
72 } // namespace v8 | 72 } // namespace v8 |
OLD | NEW |