v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
loop-peeling.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_LOOP_PEELING_H_
6#define V8_COMPILER_LOOP_PEELING_H_
7
11
12namespace v8 {
13namespace internal {
14namespace compiler {
15
16class NodeOriginTable;
17class SourcePositionTable;
18
19// Represents the output of peeling a loop, which is basically the mapping
20// from the body of the loop to the corresponding nodes in the peeled
21// iteration.
23 public:
24 // Maps {node} to its corresponding copy in the peeled iteration, if
25 // the node was part of the body of the loop. Returns {node} otherwise.
26 Node* map(Node* node);
27
28 protected:
29 PeeledIteration() = default;
30};
31
33
34// Implements loop peeling.
36 public:
37 LoopPeeler(TFGraph* graph, CommonOperatorBuilder* common, LoopTree* loop_tree,
39 NodeOriginTable* node_origins)
40 : graph_(graph),
41 common_(common),
42 loop_tree_(loop_tree),
43 tmp_zone_(tmp_zone),
44 source_positions_(source_positions),
45 node_origins_(node_origins) {}
46 bool CanPeel(LoopTree::Loop* loop) {
47 return LoopFinder::HasMarkedExits(loop_tree_, loop);
48 }
50 void PeelInnerLoopsOfTree();
51
52 static void EliminateLoopExits(TFGraph* graph, Zone* tmp_zone);
53 static void EliminateLoopExit(Node* loop);
54 static const size_t kMaxPeeledNodes = 1000;
55
56 private:
63
64 void PeelInnerLoops(LoopTree::Loop* loop);
65};
66
67
68} // namespace compiler
69} // namespace internal
70} // namespace v8
71
72#endif // V8_COMPILER_LOOP_PEELING_H_
CommonOperatorBuilder *const common_
SourcePositionTable *const source_positions_
LoopPeeler(TFGraph *graph, CommonOperatorBuilder *common, LoopTree *loop_tree, Zone *tmp_zone, SourcePositionTable *source_positions, NodeOriginTable *node_origins)
NodeOriginTable *const node_origins_
bool CanPeel(LoopTree::Loop *loop)
SourcePositionTable * source_positions
std::map< const std::string, const std::string > map
#define NON_EXPORTED_BASE(code)
#define V8_EXPORT_PRIVATE
Definition macros.h:460
TFGraph * graph_