Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Unified Diff: src/heap/embedder-tracing.h

Issue 2576453002: [heap] Create a thin wrapper around wrapper tracing in V8 to avoid misuse (Closed)
Patch Set: Include Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « BUILD.gn ('k') | src/heap/embedder-tracing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..60c85cd52f285a5d6c85794216a7da22a39fb00b
--- /dev/null
+++ b/src/heap/embedder-tracing.h
@@ -0,0 +1,56 @@
+// 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"
+#include "src/globals.h"
+
+namespace v8 {
+namespace internal {
+
+class Heap;
+
+class V8_EXPORT_PRIVATE 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 ClearCachedWrappersToTrace() { cached_wrappers_to_trace_.clear(); }
+ 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_;
+};
+
+} // namespace internal
+} // namespace v8
+
+#endif // V8_HEAP_EMBEDDER_TRACING_H_
« no previous file with comments | « BUILD.gn ('k') | src/heap/embedder-tracing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698