Home | History | Annotate | Download | only in src
      1 // 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_HYDROGEN_BCE_H_
      6 #define V8_HYDROGEN_BCE_H_
      7 
      8 #include "src/hydrogen.h"
      9 
     10 namespace v8 {
     11 namespace internal {
     12 
     13 
     14 class BoundsCheckBbData;
     15 class BoundsCheckKey;
     16 class 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 
     29 class 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 v8::internal
     50 
     51 #endif  // V8_HYDROGEN_BCE_H_
     52