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.
5 #ifndef V8_COMPILER_CONTROL_FLOW_OPTIMIZER_H_
6 #define V8_COMPILER_CONTROL_FLOW_OPTIMIZER_H_
8 #include "src/compiler/node-marker.h"
9 #include "src/zone-containers.h"
15 // Forward declarations.
16 class CommonOperatorBuilder;
19 class MachineOperatorBuilder;
23 class ControlFlowOptimizer FINAL {
25 ControlFlowOptimizer(JSGraph* jsgraph, Zone* zone);
30 void Enqueue(Node* node);
31 void VisitNode(Node* node);
32 void VisitBranch(Node* node);
34 bool TryBuildSwitch(Node* node);
35 bool TryCloneBranch(Node* node);
37 CommonOperatorBuilder* common() const;
39 JSGraph* jsgraph() const { return jsgraph_; }
40 MachineOperatorBuilder* machine() const;
41 Zone* zone() const { return zone_; }
43 JSGraph* const jsgraph_;
44 ZoneQueue<Node*> queue_;
45 NodeMarker<bool> queued_;
48 DISALLOW_COPY_AND_ASSIGN(ControlFlowOptimizer);
51 } // namespace compiler
52 } // namespace internal
55 #endif // V8_COMPILER_CONTROL_FLOW_OPTIMIZER_H_