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
10
11namespace v8 {
12namespace internal {
13namespace compiler {
14
15class JSGraph;
16
18 public:
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) {}
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.
54 size_t size_;
55 };
56
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:
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
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
Zone * zone_
const int size_
Definition assembler.cc:132
V8_INLINE const Operation & Get(const Graph &graph, OpIndex index)
Definition graph.h:1231
#define V8_EXPORT_PRIVATE
Definition macros.h:460