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

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

Issue 2592403002: [heap] Ensure progress when incrementally marking wrappers (Closed)
Patch Set: Remove max iterations to 10 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 | « src/heap/embedder-tracing.h ('k') | src/heap/incremental-marking.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 #include "src/heap/embedder-tracing.h" 5 #include "src/heap/embedder-tracing.h"
6 6
7 #include "src/base/logging.h" 7 #include "src/base/logging.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
11 11
12 void LocalEmbedderHeapTracer::TracePrologue() { 12 void LocalEmbedderHeapTracer::TracePrologue() {
13 if (!InUse()) return; 13 if (!InUse()) return;
14 14
15 CHECK(cached_wrappers_to_trace_.empty()); 15 CHECK(cached_wrappers_to_trace_.empty());
16 num_v8_marking_deque_was_empty_ = 0;
17 in_final_pause_ = false;
16 remote_tracer_->TracePrologue(); 18 remote_tracer_->TracePrologue();
17 } 19 }
18 20
19 void LocalEmbedderHeapTracer::TraceEpilogue() { 21 void LocalEmbedderHeapTracer::TraceEpilogue() {
20 if (!InUse()) return; 22 if (!InUse()) return;
21 23
22 CHECK(cached_wrappers_to_trace_.empty()); 24 CHECK(cached_wrappers_to_trace_.empty());
23 remote_tracer_->TraceEpilogue(); 25 remote_tracer_->TraceEpilogue();
24 } 26 }
25 27
26 void LocalEmbedderHeapTracer::AbortTracing() { 28 void LocalEmbedderHeapTracer::AbortTracing() {
27 if (!InUse()) return; 29 if (!InUse()) return;
28 30
29 cached_wrappers_to_trace_.clear(); 31 cached_wrappers_to_trace_.clear();
30 remote_tracer_->AbortTracing(); 32 remote_tracer_->AbortTracing();
31 } 33 }
32 34
33 void LocalEmbedderHeapTracer::EnterFinalPause() { 35 void LocalEmbedderHeapTracer::EnterFinalPause() {
34 if (!InUse()) return; 36 if (!InUse()) return;
35 37
38 in_final_pause_ = true;
36 remote_tracer_->EnterFinalPause(); 39 remote_tracer_->EnterFinalPause();
37 } 40 }
38 41
39 bool LocalEmbedderHeapTracer::Trace( 42 bool LocalEmbedderHeapTracer::Trace(
40 double deadline, EmbedderHeapTracer::AdvanceTracingActions actions) { 43 double deadline, EmbedderHeapTracer::AdvanceTracingActions actions) {
41 if (!InUse()) return false; 44 if (!InUse()) return false;
42 45
43 RegisterWrappersWithRemoteTracer(); 46 RegisterWrappersWithRemoteTracer();
44 return remote_tracer_->AdvanceTracing(deadline, actions); 47 return (in_final_pause_ ||
48 (num_v8_marking_deque_was_empty_ <= kMaxIncrementalMarkingRounds))
49 ? remote_tracer_->AdvanceTracing(deadline, actions)
50 : false;
45 } 51 }
46 52
47 size_t LocalEmbedderHeapTracer::NumberOfWrappersToTrace() { 53 size_t LocalEmbedderHeapTracer::NumberOfWrappersToTrace() {
48 return (InUse()) 54 return (InUse())
49 ? cached_wrappers_to_trace_.size() + 55 ? cached_wrappers_to_trace_.size() +
50 remote_tracer_->NumberOfWrappersToTrace() 56 remote_tracer_->NumberOfWrappersToTrace()
51 : 0; 57 : 0;
52 } 58 }
53 59
54 void LocalEmbedderHeapTracer::RegisterWrappersWithRemoteTracer() { 60 void LocalEmbedderHeapTracer::RegisterWrappersWithRemoteTracer() {
55 if (!InUse()) return; 61 if (!InUse()) return;
56 62
57 if (cached_wrappers_to_trace_.empty()) { 63 if (cached_wrappers_to_trace_.empty()) {
58 return; 64 return;
59 } 65 }
60 66
61 remote_tracer_->RegisterV8References(cached_wrappers_to_trace_); 67 remote_tracer_->RegisterV8References(cached_wrappers_to_trace_);
62 cached_wrappers_to_trace_.clear(); 68 cached_wrappers_to_trace_.clear();
63 } 69 }
64 70
65 bool LocalEmbedderHeapTracer::RequiresImmediateWrapperProcessing() { 71 bool LocalEmbedderHeapTracer::RequiresImmediateWrapperProcessing() {
66 const size_t kTooManyWrappers = 16000; 72 const size_t kTooManyWrappers = 16000;
67 return cached_wrappers_to_trace_.size() > kTooManyWrappers; 73 return cached_wrappers_to_trace_.size() > kTooManyWrappers;
68 } 74 }
69 75
70 } // namespace internal 76 } // namespace internal
71 } // namespace v8 77 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/embedder-tracing.h ('k') | src/heap/incremental-marking.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698