| 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" | |
| 9 #include "src/compiler/graph.h" | 8 #include "src/compiler/graph.h" |
| 10 #include "src/compiler/operation-typer.h" | 9 #include "src/compiler/operation-typer.h" |
| 11 #include "src/types.h" | 10 #include "src/types.h" |
| 12 | 11 |
| 13 namespace v8 { | 12 namespace v8 { |
| 14 namespace internal { | 13 namespace internal { |
| 15 | 14 |
| 16 // Forward declarations. | 15 // Forward declarations. |
| 17 class CompilationDependencies; | |
| 18 class TypeCache; | 16 class TypeCache; |
| 19 | 17 |
| 20 namespace compiler { | 18 namespace compiler { |
| 21 | 19 |
| 22 class LoopVariableOptimizer; | 20 class LoopVariableOptimizer; |
| 23 class OperationTyper; | 21 class OperationTyper; |
| 24 | 22 |
| 25 class Typer { | 23 class Typer { |
| 26 public: | 24 public: |
| 27 // Flags that control the mode of operation. | 25 Typer(Isolate* isolate, Graph* graph); |
| 28 enum Flag { | |
| 29 kNoFlags = 0u, | |
| 30 kDeoptimizationEnabled = 1u << 0, | |
| 31 }; | |
| 32 typedef base::Flags<Flag> Flags; | |
| 33 | |
| 34 Typer(Isolate* isolate, Graph* graph, Flags flags = kNoFlags, | |
| 35 CompilationDependencies* dependencies = nullptr); | |
| 36 ~Typer(); | 26 ~Typer(); |
| 37 | 27 |
| 38 void Run(); | 28 void Run(); |
| 39 // TODO(bmeurer,jarin): Remove this once we have a notion of "roots" on Graph. | 29 // TODO(bmeurer,jarin): Remove this once we have a notion of "roots" on Graph. |
| 40 void Run(const ZoneVector<Node*>& roots, | 30 void Run(const ZoneVector<Node*>& roots, |
| 41 LoopVariableOptimizer* induction_vars); | 31 LoopVariableOptimizer* induction_vars); |
| 42 | 32 |
| 43 private: | 33 private: |
| 44 class Visitor; | 34 class Visitor; |
| 45 class Decorator; | 35 class Decorator; |
| 46 | 36 |
| 47 Graph* graph() const { return graph_; } | 37 Graph* graph() const { return graph_; } |
| 48 Zone* zone() const { return graph()->zone(); } | 38 Zone* zone() const { return graph()->zone(); } |
| 49 Isolate* isolate() const { return isolate_; } | 39 Isolate* isolate() const { return isolate_; } |
| 50 Flags flags() const { return flags_; } | |
| 51 CompilationDependencies* dependencies() const { return dependencies_; } | |
| 52 OperationTyper* operation_typer() { return &operation_typer_; } | 40 OperationTyper* operation_typer() { return &operation_typer_; } |
| 53 | 41 |
| 54 Isolate* const isolate_; | 42 Isolate* const isolate_; |
| 55 Graph* const graph_; | 43 Graph* const graph_; |
| 56 Flags const flags_; | |
| 57 CompilationDependencies* const dependencies_; | |
| 58 Decorator* decorator_; | 44 Decorator* decorator_; |
| 59 TypeCache const& cache_; | 45 TypeCache const& cache_; |
| 60 OperationTyper operation_typer_; | 46 OperationTyper operation_typer_; |
| 61 | 47 |
| 62 Type* singleton_false_; | 48 Type* singleton_false_; |
| 63 Type* singleton_true_; | 49 Type* singleton_true_; |
| 64 Type* singleton_the_hole_; | 50 Type* singleton_the_hole_; |
| 65 Type* signed32ish_; | 51 Type* signed32ish_; |
| 66 Type* unsigned32ish_; | 52 Type* unsigned32ish_; |
| 67 Type* falsish_; | 53 Type* falsish_; |
| 68 Type* truish_; | 54 Type* truish_; |
| 69 | 55 |
| 70 DISALLOW_COPY_AND_ASSIGN(Typer); | 56 DISALLOW_COPY_AND_ASSIGN(Typer); |
| 71 }; | 57 }; |
| 72 | 58 |
| 73 DEFINE_OPERATORS_FOR_FLAGS(Typer::Flags) | |
| 74 | |
| 75 } // namespace compiler | 59 } // namespace compiler |
| 76 } // namespace internal | 60 } // namespace internal |
| 77 } // namespace v8 | 61 } // namespace v8 |
| 78 | 62 |
| 79 #endif // V8_COMPILER_TYPER_H_ | 63 #endif // V8_COMPILER_TYPER_H_ |
| OLD | NEW |