V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
graph-trimmer.h
1
// Copyright 2015 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
#ifndef V8_COMPILER_GRAPH_TRIMMER_H_
6
#define V8_COMPILER_GRAPH_TRIMMER_H_
7
8
#include "src/compiler/node-marker.h"
9
#include "src/globals.h"
10
11
namespace
v8
{
12
namespace
internal {
13
namespace
compiler {
14
15
// Forward declarations.
16
class
Graph;
17
18
// Trims dead nodes from the node graph.
19
class
V8_EXPORT_PRIVATE
GraphTrimmer
final {
20
public
:
21
GraphTrimmer
(
Zone
* zone,
Graph
* graph);
22
~
GraphTrimmer
();
23
24
// Trim nodes in the {graph} that are not reachable from {graph->end()}.
25
void
TrimGraph();
26
27
// Trim nodes in the {graph} that are not reachable from either {graph->end()}
28
// or any of the roots in the sequence [{begin},{end}[.
29
template
<
typename
ForwardIterator>
30
void
TrimGraph(ForwardIterator begin, ForwardIterator end) {
31
while
(begin != end) {
32
Node
*
const
node = *begin++;
33
if
(!node->IsDead()) MarkAsLive(node);
34
}
35
TrimGraph();
36
}
37
38
private
:
39
V8_INLINE
bool
IsLive(
Node
*
const
node) {
return
is_live_.Get(node); }
40
V8_INLINE
void
MarkAsLive(
Node
*
const
node) {
41
DCHECK(!node->IsDead());
42
if
(!IsLive(node)) {
43
is_live_.Set(node,
true
);
44
live_.push_back(node);
45
}
46
}
47
48
Graph
* graph()
const
{
return
graph_; }
49
50
Graph
*
const
graph_;
51
NodeMarker<bool>
is_live_;
52
NodeVector
live_;
53
54
DISALLOW_COPY_AND_ASSIGN(
GraphTrimmer
);
55
};
56
57
}
// namespace compiler
58
}
// namespace internal
59
}
// namespace v8
60
61
#endif // V8_COMPILER_GRAPH_TRIMMER_H_
v8::internal::compiler::NodeMarker< bool >
v8::internal::compiler::GraphTrimmer
Definition:
graph-trimmer.h:19
v8
Definition:
libplatform.h:13
v8::internal::Zone
Definition:
zone.h:42
v8::internal::compiler::Graph
Definition:
graph.h:35
v8::internal::compiler::Node
Definition:
node.h:43
v8::internal::ZoneVector
Definition:
node-cache.h:17
v8
src
compiler
graph-trimmer.h
Generated on Tue Dec 25 2018 14:38:35 by
1.8.14