v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
all-nodes.h
Go to the documentation of this file.
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_ALL_NODES_H_
6
#define V8_COMPILER_ALL_NODES_H_
7
8
#include "
src/compiler/node.h
"
9
#include "
src/utils/bit-vector.h
"
10
11
namespace
v8
{
12
namespace
internal
{
13
namespace
compiler {
14
15
// A helper utility that traverses the graph and gathers all nodes reachable
16
// from end.
17
class
AllNodes
{
18
public
:
19
// Constructor. Traverses the graph and builds the {reachable} set of nodes
20
// reachable from {end}. When {only_inputs} is true, find the nodes
21
// reachable through input edges; these are all live nodes.
22
AllNodes
(
Zone
* local_zone,
Node
*
end
,
const
TFGraph
* graph,
23
bool
only_inputs =
true
);
24
// Constructor. Traverses the graph and builds the {reachable} set of nodes
25
// reachable from the End node.
26
AllNodes
(
Zone
* local_zone,
const
TFGraph
* graph,
bool
only_inputs =
true
);
27
28
bool
IsLive
(
const
Node
* node)
const
{
29
CHECK
(
only_inputs_
);
30
return
IsReachable
(node);
31
}
32
33
bool
IsReachable
(
const
Node
* node)
const
{
34
if
(!node)
return
false
;
35
int
id
= node->id();
36
return
id
<
is_reachable_
.
length
() &&
is_reachable_
.
Contains
(
id
);
37
}
38
39
NodeVector
reachable
;
// Nodes reachable from end.
40
41
private
:
42
void
Mark
(
Zone
* local_zone,
Node
*
end
,
const
TFGraph
* graph);
43
44
BitVector
is_reachable_
;
45
const
bool
only_inputs_
;
46
};
47
48
}
// namespace compiler
49
}
// namespace internal
50
}
// namespace v8
51
52
#endif
// V8_COMPILER_ALL_NODES_H_
bit-vector.h
v8::internal::BitVector
Definition
bit-vector.h:16
v8::internal::BitVector::length
int length() const
Definition
bit-vector.h:257
v8::internal::BitVector::Contains
bool Contains(int i) const
Definition
bit-vector.h:180
v8::internal::ZoneVector< Node * >
v8::internal::Zone
Definition
zone.h:43
v8::internal::compiler::AllNodes
Definition
all-nodes.h:17
v8::internal::compiler::AllNodes::only_inputs_
const bool only_inputs_
Definition
all-nodes.h:45
v8::internal::compiler::AllNodes::is_reachable_
BitVector is_reachable_
Definition
all-nodes.h:44
v8::internal::compiler::AllNodes::reachable
NodeVector reachable
Definition
all-nodes.h:39
v8::internal::compiler::AllNodes::AllNodes
AllNodes(Zone *local_zone, Node *end, const TFGraph *graph, bool only_inputs=true)
Definition
all-nodes.cc:20
v8::internal::compiler::AllNodes::IsLive
bool IsLive(const Node *node) const
Definition
all-nodes.h:28
v8::internal::compiler::AllNodes::IsReachable
bool IsReachable(const Node *node) const
Definition
all-nodes.h:33
v8::internal::compiler::Node
Definition
node.h:41
v8::internal::compiler::TFGraph
Definition
turbofan-graph.h:32
end
int end
Definition
debug-coverage.cc:596
v8::internal::compiler::Mark
uint32_t Mark
Definition
node.h:26
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8
Definition
api-arguments-inl.h:19
node.h
CHECK
#define CHECK(condition)
Definition
logging.h:124
src
compiler
all-nodes.h
Generated on Sun Apr 6 2025 21:08:51 for v8 by
1.12.0