v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
redundancy-elimination.h
Go to the documentation of this file.
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
#ifndef V8_COMPILER_REDUNDANCY_ELIMINATION_H_
6
#define V8_COMPILER_REDUNDANCY_ELIMINATION_H_
7
8
#include "
src/compiler/graph-reducer.h
"
9
#include "
src/compiler/machine-operator.h
"
10
11
namespace
v8
{
12
namespace
internal
{
13
namespace
compiler {
14
15
class
JSGraph;
16
17
class
V8_EXPORT_PRIVATE
RedundancyElimination
final :
public
AdvancedReducer
{
18
public
:
19
RedundancyElimination
(
Editor
* editor,
JSGraph
*
jsgraph
,
Zone
* zone);
20
~RedundancyElimination
() final;
21
RedundancyElimination
(const
RedundancyElimination
&) = delete;
22
RedundancyElimination
& operator=(const
RedundancyElimination
&) = delete;
23
24
const
char
* reducer_name()
const override
{
return
"RedundancyElimination"
; }
25
26
Reduction
Reduce(
Node
* node)
final
;
27
28
private
:
29
struct
Check
{
30
Check
(
Node
* node,
Check
* next) : node(node), next(next) {}
31
Node
*
node
;
32
Check
*
next
;
33
};
34
35
class
EffectPathChecks
final {
36
public
:
37
static
EffectPathChecks
* Copy(
Zone
* zone,
EffectPathChecks
const
* checks);
38
static
EffectPathChecks
const
* Empty(
Zone
* zone);
39
bool
Equals(
EffectPathChecks
const
* that)
const
;
40
void
Merge(
EffectPathChecks
const
* that);
41
42
EffectPathChecks
const
* AddCheck(
Zone
* zone,
Node
* node)
const
;
43
Node
* LookupCheck(
Node
* node,
JSGraph
*
jsgraph
)
const
;
44
Node
* LookupBoundsCheckFor(
Node
* node)
const
;
45
46
private
:
47
friend
Zone
;
48
49
EffectPathChecks
(
Check
* head,
size_t
size) : head_(head),
size_
(size) {}
50
51
// We keep track of the list length so that we can find the longest
52
// common tail easily.
53
Check
*
head_
;
54
size_t
size_
;
55
};
56
57
class
PathChecksForEffectNodes
final {
58
public
:
59
explicit
PathChecksForEffectNodes
(
Zone
* zone) : info_for_node_(zone) {}
60
EffectPathChecks
const
*
Get
(
Node
* node)
const
;
61
void
Set
(
Node
* node,
EffectPathChecks
const
* checks);
62
63
private
:
64
ZoneVector<EffectPathChecks const*>
info_for_node_
;
65
};
66
67
Reduction
ReduceCheckNode(
Node
* node);
68
Reduction
ReduceEffectPhi(
Node
* node);
69
Reduction
ReduceSpeculativeNumberComparison(
Node
* node);
70
Reduction
ReduceSpeculativeNumberOperation(
Node
* node);
71
Reduction
ReduceStart(
Node
* node);
72
Reduction
ReduceOtherNode(
Node
* node);
73
74
Reduction
TakeChecksFromFirstEffect(
Node
* node);
75
Reduction
UpdateChecks(
Node
* node,
EffectPathChecks
const
* checks);
76
77
Zone
*
zone
()
const
{
return
zone_
; }
78
79
PathChecksForEffectNodes
node_checks_
;
80
JSGraph
*
jsgraph_
;
81
Zone
*
const
zone_
;
82
};
83
84
}
// namespace compiler
85
}
// namespace internal
86
}
// namespace v8
87
88
#endif
// V8_COMPILER_REDUNDANCY_ELIMINATION_H_
jsgraph
JSGraph * jsgraph
Definition
add-type-assertions-reducer.cc:16
v8::Set
Definition
v8-container.h:148
v8::internal::ZoneVector
Definition
zone-containers.h:53
v8::internal::Zone
Definition
zone.h:43
v8::internal::compiler::AdvancedReducer::Editor
Definition
graph-reducer.h:85
v8::internal::compiler::AdvancedReducer
Definition
graph-reducer.h:82
v8::internal::compiler::JSGraph
Definition
js-graph.h:27
v8::internal::compiler::Node
Definition
node.h:41
v8::internal::compiler::Reduction
Definition
graph-reducer.h:34
v8::internal::compiler::RedundancyElimination::EffectPathChecks
Definition
redundancy-elimination.h:35
v8::internal::compiler::RedundancyElimination::EffectPathChecks::Zone
friend Zone
Definition
redundancy-elimination.h:47
v8::internal::compiler::RedundancyElimination::EffectPathChecks::head_
Check * head_
Definition
redundancy-elimination.h:53
v8::internal::compiler::RedundancyElimination::EffectPathChecks::EffectPathChecks
EffectPathChecks(Check *head, size_t size)
Definition
redundancy-elimination.h:49
v8::internal::compiler::RedundancyElimination::EffectPathChecks::size_
size_t size_
Definition
redundancy-elimination.h:54
v8::internal::compiler::RedundancyElimination::PathChecksForEffectNodes
Definition
redundancy-elimination.h:57
v8::internal::compiler::RedundancyElimination::PathChecksForEffectNodes::PathChecksForEffectNodes
PathChecksForEffectNodes(Zone *zone)
Definition
redundancy-elimination.h:59
v8::internal::compiler::RedundancyElimination::PathChecksForEffectNodes::info_for_node_
ZoneVector< EffectPathChecks const * > info_for_node_
Definition
redundancy-elimination.h:64
v8::internal::compiler::RedundancyElimination
Definition
redundancy-elimination.h:17
v8::internal::compiler::RedundancyElimination::zone
Zone * zone() const
Definition
redundancy-elimination.h:77
v8::internal::compiler::RedundancyElimination::node_checks_
PathChecksForEffectNodes node_checks_
Definition
redundancy-elimination.h:79
v8::internal::compiler::RedundancyElimination::zone_
Zone *const zone_
Definition
redundancy-elimination.h:81
v8::internal::compiler::RedundancyElimination::jsgraph_
JSGraph * jsgraph_
Definition
redundancy-elimination.h:80
v8::internal::compiler::RedundancyElimination::~RedundancyElimination
~RedundancyElimination() final
zone_
Zone * zone_
Definition
code-generator-arm.cc:230
size_
const int size_
Definition
assembler.cc:132
graph-reducer.h
machine-operator.h
v8::internal::compiler::turboshaft::Get
V8_INLINE const Operation & Get(const Graph &graph, OpIndex index)
Definition
graph.h:1231
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8
Definition
api-arguments-inl.h:19
V8_EXPORT_PRIVATE
#define V8_EXPORT_PRIVATE
Definition
macros.h:460
v8::internal::compiler::RedundancyElimination::Check
Definition
redundancy-elimination.h:29
v8::internal::compiler::RedundancyElimination::Check::Check
Check(Node *node, Check *next)
Definition
redundancy-elimination.h:30
v8::internal::compiler::RedundancyElimination::Check::node
Node * node
Definition
redundancy-elimination.h:31
v8::internal::compiler::RedundancyElimination::Check::next
Check * next
Definition
redundancy-elimination.h:32
src
compiler
redundancy-elimination.h
Generated on Sun Apr 6 2025 21:08:52 for v8 by
1.12.0