• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_CRANKSHAFT_HYDROGEN_RANGE_ANALYSIS_H_
6 #define V8_CRANKSHAFT_HYDROGEN_RANGE_ANALYSIS_H_
7 
8 #include "src/base/compiler-specific.h"
9 #include "src/crankshaft/hydrogen.h"
10 
11 namespace v8 {
12 namespace internal {
13 
14 
15 class HRangeAnalysisPhase : public HPhase {
16  public:
HRangeAnalysisPhase(HGraph * graph)17   explicit HRangeAnalysisPhase(HGraph* graph)
18       : HPhase("H_Range analysis", graph), changed_ranges_(16, zone()),
19         in_worklist_(graph->GetMaximumValueID(), zone()),
20         worklist_(32, zone()) {}
21 
22   void Run();
23 
24  private:
25   PRINTF_FORMAT(2, 3) void TraceRange(const char* msg, ...);
26   void InferControlFlowRange(HCompareNumericAndBranch* test,
27                              HBasicBlock* dest);
28   void UpdateControlFlowRange(Token::Value op, HValue* value, HValue* other);
29   void InferRange(HValue* value);
30   void RollBackTo(int index);
31   void AddRange(HValue* value, Range* range);
AddToWorklist(HValue * value)32   void AddToWorklist(HValue* value) {
33     if (in_worklist_.Contains(value->id())) return;
34     in_worklist_.Add(value->id());
35     worklist_.Add(value, zone());
36   }
37   void PropagateMinusZeroChecks(HValue* value);
38   void PoisonRanges();
39 
40   ZoneList<HValue*> changed_ranges_;
41 
42   BitVector in_worklist_;
43   ZoneList<HValue*> worklist_;
44 
45   DISALLOW_COPY_AND_ASSIGN(HRangeAnalysisPhase);
46 };
47 
48 
49 }  // namespace internal
50 }  // namespace v8
51 
52 #endif  // V8_CRANKSHAFT_HYDROGEN_RANGE_ANALYSIS_H_
53