blob: e819ffc403cc49c947dfe099c003bae902acff06 [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// Copyright 2013 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_CRANKSHAFT_HYDROGEN_BCE_H_
6#define V8_CRANKSHAFT_HYDROGEN_BCE_H_
7
8#include "src/crankshaft/hydrogen.h"
9
10namespace v8 {
11namespace internal {
12
13
14class BoundsCheckBbData;
15class BoundsCheckKey;
16class BoundsCheckTable : private ZoneHashMap {
17 public:
18 explicit BoundsCheckTable(Zone* zone);
19
20 INLINE(BoundsCheckBbData** LookupOrInsert(BoundsCheckKey* key, Zone* zone));
21 INLINE(void Insert(BoundsCheckKey* key, BoundsCheckBbData* data, Zone* zone));
22 INLINE(void Delete(BoundsCheckKey* key));
23
24 private:
25 DISALLOW_COPY_AND_ASSIGN(BoundsCheckTable);
26};
27
28
29class HBoundsCheckEliminationPhase : public HPhase {
30 public:
31 explicit HBoundsCheckEliminationPhase(HGraph* graph)
32 : HPhase("H_Bounds checks elimination", graph), table_(zone()) { }
33
34 void Run() {
35 EliminateRedundantBoundsChecks(graph()->entry_block());
36 }
37
38 private:
39 void EliminateRedundantBoundsChecks(HBasicBlock* bb);
40 BoundsCheckBbData* PreProcessBlock(HBasicBlock* bb);
41 void PostProcessBlock(HBasicBlock* bb, BoundsCheckBbData* data);
42
43 BoundsCheckTable table_;
44
45 DISALLOW_COPY_AND_ASSIGN(HBoundsCheckEliminationPhase);
46};
47
48
49} // namespace internal
50} // namespace v8
51
52#endif // V8_CRANKSHAFT_HYDROGEN_BCE_H_