hydrogen-range-analysis.h 1.36 KB
Newer Older
1
// Copyright 2013 the V8 project authors. All rights reserved.
2 3
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
4 5 6 7

#ifndef V8_HYDROGEN_RANGE_ANALYSIS_H_
#define V8_HYDROGEN_RANGE_ANALYSIS_H_

8
#include "src/hydrogen.h"
9 10 11 12 13 14 15 16

namespace v8 {
namespace internal {


class HRangeAnalysisPhase : public HPhase {
 public:
  explicit HRangeAnalysisPhase(HGraph* graph)
17 18 19
      : HPhase("H_Range analysis", graph), changed_ranges_(16, zone()),
        in_worklist_(graph->GetMaximumValueID(), zone()),
        worklist_(32, zone()) {}
20

21
  void Run();
22 23 24

 private:
  void TraceRange(const char* msg, ...);
25 26
  void InferControlFlowRange(HCompareNumericAndBranch* test,
                             HBasicBlock* dest);
27 28 29 30
  void UpdateControlFlowRange(Token::Value op, HValue* value, HValue* other);
  void InferRange(HValue* value);
  void RollBackTo(int index);
  void AddRange(HValue* value, Range* range);
31 32 33 34 35 36
  void AddToWorklist(HValue* value) {
    if (in_worklist_.Contains(value->id())) return;
    in_worklist_.Add(value->id());
    worklist_.Add(value, zone());
  }
  void PropagateMinusZeroChecks(HValue* value);
37
  void PoisonRanges();
38 39

  ZoneList<HValue*> changed_ranges_;
40 41 42 43 44

  BitVector in_worklist_;
  ZoneList<HValue*> worklist_;

  DISALLOW_COPY_AND_ASSIGN(HRangeAnalysisPhase);
45 46 47 48 49 50
};


} }  // namespace v8::internal

#endif  // V8_HYDROGEN_RANGE_ANALYSIS_H_