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

Side by Side Diff: src/heap/embedder-tracing.h

Issue 2591383004: Reland "[heap] Ensure progress when incrementally marking wrappers" (Closed)
Patch Set: Remove unused method Created 3 years, 12 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/heap/embedder-tracing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef V8_HEAP_EMBEDDER_TRACING_H_ 5 #ifndef V8_HEAP_EMBEDDER_TRACING_H_
6 #define V8_HEAP_EMBEDDER_TRACING_H_ 6 #define V8_HEAP_EMBEDDER_TRACING_H_
7 7
8 #include "include/v8.h" 8 #include "include/v8.h"
9 #include "src/flags.h"
9 #include "src/globals.h" 10 #include "src/globals.h"
10 11
11 namespace v8 { 12 namespace v8 {
12 namespace internal { 13 namespace internal {
13 14
14 class Heap; 15 class Heap;
15 16
16 class V8_EXPORT_PRIVATE LocalEmbedderHeapTracer final { 17 class V8_EXPORT_PRIVATE LocalEmbedderHeapTracer final {
17 public: 18 public:
18 typedef std::pair<void*, void*> WrapperInfo; 19 typedef std::pair<void*, void*> WrapperInfo;
19 20
20 LocalEmbedderHeapTracer() : remote_tracer_(nullptr) {} 21 LocalEmbedderHeapTracer()
22 : remote_tracer_(nullptr), num_v8_marking_deque_was_empty_(0) {}
21 23
22 void SetRemoteTracer(EmbedderHeapTracer* tracer) { remote_tracer_ = tracer; } 24 void SetRemoteTracer(EmbedderHeapTracer* tracer) { remote_tracer_ = tracer; }
23 bool InUse() { return remote_tracer_ != nullptr; } 25 bool InUse() { return remote_tracer_ != nullptr; }
24 26
25 void TracePrologue(); 27 void TracePrologue();
26 void TraceEpilogue(); 28 void TraceEpilogue();
27 void AbortTracing(); 29 void AbortTracing();
28 void EnterFinalPause(); 30 void EnterFinalPause();
29 bool Trace(double deadline, 31 bool Trace(double deadline,
30 EmbedderHeapTracer::AdvanceTracingActions actions); 32 EmbedderHeapTracer::AdvanceTracingActions actions);
31 33
32 size_t NumberOfWrappersToTrace(); 34 size_t NumberOfWrappersToTrace();
33 size_t NumberOfCachedWrappersToTrace() { 35 size_t NumberOfCachedWrappersToTrace() {
34 return cached_wrappers_to_trace_.size(); 36 return cached_wrappers_to_trace_.size();
35 } 37 }
36 void AddWrapperToTrace(WrapperInfo entry) { 38 void AddWrapperToTrace(WrapperInfo entry) {
37 cached_wrappers_to_trace_.push_back(entry); 39 cached_wrappers_to_trace_.push_back(entry);
38 } 40 }
39 void ClearCachedWrappersToTrace() { cached_wrappers_to_trace_.clear(); } 41 void ClearCachedWrappersToTrace() { cached_wrappers_to_trace_.clear(); }
40 void RegisterWrappersWithRemoteTracer(); 42 void RegisterWrappersWithRemoteTracer();
41 43
42 // In order to avoid running out of memory we force tracing wrappers if there 44 // In order to avoid running out of memory we force tracing wrappers if there
43 // are too many of them. 45 // are too many of them.
44 bool RequiresImmediateWrapperProcessing(); 46 bool RequiresImmediateWrapperProcessing();
45 47
48 void NotifyV8MarkingDequeWasEmpty() { num_v8_marking_deque_was_empty_++; }
49 bool ShouldFinalizeIncrementalMarking() {
50 static const size_t kMaxIncrementalFixpointRounds = 3;
51 return !FLAG_incremental_marking_wrappers || !InUse() ||
52 NumberOfWrappersToTrace() == 0 ||
53 num_v8_marking_deque_was_empty_ > kMaxIncrementalFixpointRounds;
54 }
55
46 private: 56 private:
47 typedef std::vector<WrapperInfo> WrapperCache; 57 typedef std::vector<WrapperInfo> WrapperCache;
48 58
49 EmbedderHeapTracer* remote_tracer_; 59 EmbedderHeapTracer* remote_tracer_;
50 WrapperCache cached_wrappers_to_trace_; 60 WrapperCache cached_wrappers_to_trace_;
61 size_t num_v8_marking_deque_was_empty_;
51 }; 62 };
52 63
53 } // namespace internal 64 } // namespace internal
54 } // namespace v8 65 } // namespace v8
55 66
56 #endif // V8_HEAP_EMBEDDER_TRACING_H_ 67 #endif // V8_HEAP_EMBEDDER_TRACING_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap/embedder-tracing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698