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