5 #ifndef V8_HEAP_EMBEDDER_TRACING_H_ 6 #define V8_HEAP_EMBEDDER_TRACING_H_ 8 #include "include/v8.h" 10 #include "src/globals.h" 20 typedef std::pair<void*, void*> WrapperInfo;
21 typedef std::vector<WrapperInfo> WrapperCache;
28 void TracePossibleWrapper(
JSObject* js_object);
30 void AddWrapperInfoForTesting(WrapperInfo info);
33 static constexpr
size_t kWrapperCacheSize = 1000;
35 void FlushWrapperCacheIfFull();
38 WrapperCache wrapper_cache_;
44 if (remote_tracer_) remote_tracer_->isolate_ =
nullptr;
47 bool InUse()
const {
return remote_tracer_ !=
nullptr; }
48 EmbedderHeapTracer* remote_tracer()
const {
return remote_tracer_; }
50 void SetRemoteTracer(EmbedderHeapTracer* tracer);
53 void EnterFinalPause();
54 bool Trace(
double deadline);
55 bool IsRemoteTracingDone();
57 void NotifyV8MarkingWorklistWasEmpty() {
58 num_v8_marking_worklist_was_empty_++;
61 bool ShouldFinalizeIncrementalMarking() {
62 static const size_t kMaxIncrementalFixpointRounds = 3;
63 return !FLAG_incremental_marking_wrappers || !InUse() ||
64 (IsRemoteTracingDone() && embedder_worklist_empty_) ||
65 num_v8_marking_worklist_was_empty_ > kMaxIncrementalFixpointRounds;
68 void SetEmbedderStackStateForNextFinalization(
69 EmbedderHeapTracer::EmbedderStackState stack_state);
71 void SetEmbedderWorklistEmpty(
bool is_empty) {
72 embedder_worklist_empty_ = is_empty;
76 Isolate*
const isolate_;
77 EmbedderHeapTracer* remote_tracer_ =
nullptr;
79 size_t num_v8_marking_worklist_was_empty_ = 0;
80 EmbedderHeapTracer::EmbedderStackState embedder_stack_state_ =
81 EmbedderHeapTracer::kUnknown;
85 bool embedder_worklist_empty_ =
false;
87 friend class EmbedderStackStateScope;
93 EmbedderHeapTracer::EmbedderStackState stack_state)
94 : local_tracer_(local_tracer),
95 old_stack_state_(local_tracer_->embedder_stack_state_) {
96 local_tracer_->embedder_stack_state_ = stack_state;
100 local_tracer_->embedder_stack_state_ = old_stack_state_;
105 const EmbedderHeapTracer::EmbedderStackState old_stack_state_;
111 #endif // V8_HEAP_EMBEDDER_TRACING_H_