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

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

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 unified diff | Download patch
« no previous file with comments | « src/heap/embedder-tracing.h ('k') | src/heap/heap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "src/heap/embedder-tracing.h"
6
7 #include "src/base/logging.h"
8
9 namespace v8 {
10 namespace internal {
11
12 void LocalEmbedderHeapTracer::TracePrologue() {
13 if (!InUse()) return;
14
15 CHECK(cached_wrappers_to_trace_.empty());
16 remote_tracer_->TracePrologue();
17 }
18
19 void LocalEmbedderHeapTracer::TraceEpilogue() {
20 if (!InUse()) return;
21
22 CHECK(cached_wrappers_to_trace_.empty());
23 remote_tracer_->TraceEpilogue();
24 }
25
26 void LocalEmbedderHeapTracer::AbortTracing() {
27 if (!InUse()) return;
28
29 cached_wrappers_to_trace_.clear();
30 remote_tracer_->AbortTracing();
31 }
32
33 void LocalEmbedderHeapTracer::EnterFinalPause() {
34 if (!InUse()) return;
35
36 remote_tracer_->EnterFinalPause();
37 }
38
39 bool LocalEmbedderHeapTracer::Trace(
40 double deadline, EmbedderHeapTracer::AdvanceTracingActions actions) {
41 if (!InUse()) return false;
42
43 RegisterWrappersWithRemoteTracer();
44 return remote_tracer_->AdvanceTracing(deadline, actions);
45 }
46
47 size_t LocalEmbedderHeapTracer::NumberOfWrappersToTrace() {
48 return (InUse())
49 ? cached_wrappers_to_trace_.size() +
50 remote_tracer_->NumberOfWrappersToTrace()
51 : 0;
52 }
53
54 void LocalEmbedderHeapTracer::RegisterWrappersWithRemoteTracer() {
55 if (!InUse()) return;
56
57 if (cached_wrappers_to_trace_.empty()) {
58 return;
59 }
60
61 remote_tracer_->RegisterV8References(cached_wrappers_to_trace_);
62 cached_wrappers_to_trace_.clear();
63 }
64
65 bool LocalEmbedderHeapTracer::RequiresImmediateWrapperProcessing() {
66 const size_t kTooManyWrappers = 16000;
67 return cached_wrappers_to_trace_.size() > kTooManyWrappers;
68 }
69
70 } // namespace internal
71 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/embedder-tracing.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698