OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_TYPER_H_ | 5 #ifndef V8_COMPILER_TYPER_H_ |
6 #define V8_COMPILER_TYPER_H_ | 6 #define V8_COMPILER_TYPER_H_ |
7 | 7 |
| 8 #include "src/base/flags.h" |
8 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
9 #include "src/types.h" | 10 #include "src/types.h" |
10 | 11 |
11 namespace v8 { | 12 namespace v8 { |
12 namespace internal { | 13 namespace internal { |
13 | 14 |
14 // Forward declarations. | 15 // Forward declarations. |
| 16 class CompilationDependencies; |
15 class ZoneTypeCache; | 17 class ZoneTypeCache; |
16 | 18 |
17 namespace compiler { | 19 namespace compiler { |
18 | 20 |
19 | 21 |
20 class Typer { | 22 class Typer { |
21 public: | 23 public: |
22 Typer(Isolate* isolate, Graph* graph, | 24 // Flags that control the mode of operation. |
| 25 enum Flag { |
| 26 kNoFlags = 0u, |
| 27 kDeoptimizationEnabled = 1u << 0, |
| 28 }; |
| 29 typedef base::Flags<Flag> Flags; |
| 30 |
| 31 Typer(Isolate* isolate, Graph* graph, Flags flags = kNoFlags, |
| 32 CompilationDependencies* dependencies = nullptr, |
23 Type::FunctionType* function_type = nullptr); | 33 Type::FunctionType* function_type = nullptr); |
24 ~Typer(); | 34 ~Typer(); |
25 | 35 |
26 void Run(); | 36 void Run(); |
27 // TODO(bmeurer,jarin): Remove this once we have a notion of "roots" on Graph. | 37 // TODO(bmeurer,jarin): Remove this once we have a notion of "roots" on Graph. |
28 void Run(const ZoneVector<Node*>& roots); | 38 void Run(const ZoneVector<Node*>& roots); |
29 | 39 |
30 private: | 40 private: |
31 class Visitor; | 41 class Visitor; |
32 class Decorator; | 42 class Decorator; |
33 | 43 |
34 Graph* graph() const { return graph_; } | 44 Graph* graph() const { return graph_; } |
35 Zone* zone() const { return graph()->zone(); } | 45 Zone* zone() const { return graph()->zone(); } |
36 Isolate* isolate() const { return isolate_; } | 46 Isolate* isolate() const { return isolate_; } |
| 47 Flags flags() const { return flags_; } |
| 48 CompilationDependencies* dependencies() const { return dependencies_; } |
37 Type::FunctionType* function_type() const { return function_type_; } | 49 Type::FunctionType* function_type() const { return function_type_; } |
38 | 50 |
39 Isolate* const isolate_; | 51 Isolate* const isolate_; |
40 Graph* const graph_; | 52 Graph* const graph_; |
| 53 Flags const flags_; |
| 54 CompilationDependencies* const dependencies_; |
41 Type::FunctionType* function_type_; | 55 Type::FunctionType* function_type_; |
42 Decorator* decorator_; | 56 Decorator* decorator_; |
43 ZoneTypeCache const& cache_; | 57 ZoneTypeCache const& cache_; |
44 | 58 |
45 Type* singleton_false_; | 59 Type* singleton_false_; |
46 Type* singleton_true_; | 60 Type* singleton_true_; |
47 Type* signed32ish_; | 61 Type* signed32ish_; |
48 Type* unsigned32ish_; | 62 Type* unsigned32ish_; |
49 Type* falsish_; | 63 Type* falsish_; |
50 Type* truish_; | 64 Type* truish_; |
51 | 65 |
52 DISALLOW_COPY_AND_ASSIGN(Typer); | 66 DISALLOW_COPY_AND_ASSIGN(Typer); |
53 }; | 67 }; |
54 | 68 |
| 69 DEFINE_OPERATORS_FOR_FLAGS(Typer::Flags) |
| 70 |
55 } // namespace compiler | 71 } // namespace compiler |
56 } // namespace internal | 72 } // namespace internal |
57 } // namespace v8 | 73 } // namespace v8 |
58 | 74 |
59 #endif // V8_COMPILER_TYPER_H_ | 75 #endif // V8_COMPILER_TYPER_H_ |
OLD | NEW |