Chromium Code Reviews| Index: src/heap/embedder-tracing.h |
| diff --git a/src/heap/embedder-tracing.h b/src/heap/embedder-tracing.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..59f5a623236fa51a008d2646f0c987ab48c62d91 |
| --- /dev/null |
| +++ b/src/heap/embedder-tracing.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright 2016 the V8 project authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef V8_HEAP_EMBEDDER_TRACING_H_ |
| +#define V8_HEAP_EMBEDDER_TRACING_H_ |
| + |
| +#include "include/v8.h" |
| + |
| +namespace v8 { |
| +namespace internal { |
| + |
| +class Heap; |
| + |
| +class LocalEmbedderHeapTracer final { |
| + public: |
| + typedef std::pair<void*, void*> WrapperInfo; |
| + |
| + LocalEmbedderHeapTracer() : remote_tracer_(nullptr) {} |
| + |
| + void SetRemoteTracer(EmbedderHeapTracer* tracer) { remote_tracer_ = tracer; } |
| + bool InUse() { return remote_tracer_ != nullptr; } |
| + |
| + void TracePrologue(); |
| + void TraceEpilogue(); |
| + void AbortTracing(); |
| + void EnterFinalPause(); |
| + bool Trace(double deadline, |
| + EmbedderHeapTracer::AdvanceTracingActions actions); |
| + |
| + size_t NumberOfWrappersToTrace(); |
| + size_t NumberOfCachedWrappersToTrace() { |
| + return cached_wrappers_to_trace_.size(); |
| + } |
| + void AddWrapperToTrace(WrapperInfo entry) { |
| + cached_wrappers_to_trace_.push_back(entry); |
| + } |
| + void RegisterWrappersWithRemoteTracer(); |
| + |
| + // In order to avoid running out of memory we force tracing wrappers if there |
| + // are too many of them. |
| + bool RequiresImmediateWrapperProcessing(); |
| + |
| + private: |
| + typedef std::vector<WrapperInfo> WrapperCache; |
| + |
| + EmbedderHeapTracer* remote_tracer_; |
| + WrapperCache cached_wrappers_to_trace_; |
|
Hannes Payer (out of office)
2016/12/19 16:50:05
How about wrappers_to_trace_? It's simpler.
Michael Lippautz
2016/12/19 17:01:24
I want to indicate that this is just the cached v8
|
| +}; |
| + |
| +} // namespace internal |
| +} // namespace v8 |
| + |
| +#endif // V8_HEAP_EMBEDDER_TRACING_H_ |