OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef V8_HEAP_EMBEDDER_TRACING_H_ |
| 6 #define V8_HEAP_EMBEDDER_TRACING_H_ |
| 7 |
| 8 #include "include/v8.h" |
| 9 #include "src/globals.h" |
| 10 |
| 11 namespace v8 { |
| 12 namespace internal { |
| 13 |
| 14 class Heap; |
| 15 |
| 16 class V8_EXPORT_PRIVATE LocalEmbedderHeapTracer final { |
| 17 public: |
| 18 typedef std::pair<void*, void*> WrapperInfo; |
| 19 |
| 20 LocalEmbedderHeapTracer() : remote_tracer_(nullptr) {} |
| 21 |
| 22 void SetRemoteTracer(EmbedderHeapTracer* tracer) { remote_tracer_ = tracer; } |
| 23 bool InUse() { return remote_tracer_ != nullptr; } |
| 24 |
| 25 void TracePrologue(); |
| 26 void TraceEpilogue(); |
| 27 void AbortTracing(); |
| 28 void EnterFinalPause(); |
| 29 bool Trace(double deadline, |
| 30 EmbedderHeapTracer::AdvanceTracingActions actions); |
| 31 |
| 32 size_t NumberOfWrappersToTrace(); |
| 33 size_t NumberOfCachedWrappersToTrace() { |
| 34 return cached_wrappers_to_trace_.size(); |
| 35 } |
| 36 void AddWrapperToTrace(WrapperInfo entry) { |
| 37 cached_wrappers_to_trace_.push_back(entry); |
| 38 } |
| 39 void ClearCachedWrappersToTrace() { cached_wrappers_to_trace_.clear(); } |
| 40 void RegisterWrappersWithRemoteTracer(); |
| 41 |
| 42 // In order to avoid running out of memory we force tracing wrappers if there |
| 43 // are too many of them. |
| 44 bool RequiresImmediateWrapperProcessing(); |
| 45 |
| 46 private: |
| 47 typedef std::vector<WrapperInfo> WrapperCache; |
| 48 |
| 49 EmbedderHeapTracer* remote_tracer_; |
| 50 WrapperCache cached_wrappers_to_trace_; |
| 51 }; |
| 52 |
| 53 } // namespace internal |
| 54 } // namespace v8 |
| 55 |
| 56 #endif // V8_HEAP_EMBEDDER_TRACING_H_ |
OLD | NEW |