a288d060a6350fc74be513ac95dab6daaa049ecf
[platform/upstream/nodejs.git] / deps / v8 / src / compiler / typer.h
1 // Copyright 2014 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_COMPILER_TYPER_H_
6 #define V8_COMPILER_TYPER_H_
7
8 #include "src/compiler/graph.h"
9 #include "src/compiler/opcodes.h"
10 #include "src/types.h"
11
12 namespace v8 {
13 namespace internal {
14 namespace compiler {
15
16 // Forward declarations.
17 class LazyTypeCache;
18
19
20 class Typer {
21  public:
22   Typer(Isolate* isolate, Graph* graph, MaybeHandle<Context> context);
23   ~Typer();
24
25   void Run();
26
27   Graph* graph() { return graph_; }
28   MaybeHandle<Context> context() { return context_; }
29   Zone* zone() { return graph_->zone(); }
30   Isolate* isolate() { return isolate_; }
31
32  private:
33   class Visitor;
34   class Decorator;
35
36   Isolate* isolate_;
37   Graph* graph_;
38   MaybeHandle<Context> context_;
39   Decorator* decorator_;
40
41   Zone* zone_;
42   Type* boolean_or_number;
43   Type* undefined_or_null;
44   Type* undefined_or_number;
45   Type* negative_signed32;
46   Type* non_negative_signed32;
47   Type* singleton_false;
48   Type* singleton_true;
49   Type* singleton_zero;
50   Type* singleton_one;
51   Type* zero_or_one;
52   Type* zeroish;
53   Type* signed32ish;
54   Type* unsigned32ish;
55   Type* falsish;
56   Type* truish;
57   Type* integer;
58   Type* weakint;
59   Type* number_fun0_;
60   Type* number_fun1_;
61   Type* number_fun2_;
62   Type* weakint_fun1_;
63   Type* random_fun_;
64   LazyTypeCache* cache_;
65
66   ZoneVector<double> weaken_min_limits_;
67   ZoneVector<double> weaken_max_limits_;
68   DISALLOW_COPY_AND_ASSIGN(Typer);
69 };
70
71 }  // namespace compiler
72 }  // namespace internal
73 }  // namespace v8
74
75 #endif  // V8_COMPILER_TYPER_H_