OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_OPERATION_TYPER_H_ | 5 #ifndef V8_COMPILER_OPERATION_TYPER_H_ |
6 #define V8_COMPILER_OPERATION_TYPER_H_ | 6 #define V8_COMPILER_OPERATION_TYPER_H_ |
7 | 7 |
8 #include "src/base/flags.h" | 8 #include "src/base/flags.h" |
9 #include "src/compiler/opcodes.h" | 9 #include "src/compiler/opcodes.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 class Isolate; | 14 class Isolate; |
15 class RangeType; | 15 class RangeType; |
16 class Type; | 16 class Type; |
17 class TypeCache; | 17 class TypeCache; |
18 class Zone; | 18 class Zone; |
19 | 19 |
20 namespace compiler { | 20 namespace compiler { |
21 | 21 |
| 22 class Operator; |
| 23 |
22 class OperationTyper { | 24 class OperationTyper { |
23 public: | 25 public: |
24 OperationTyper(Isolate* isolate, Zone* zone); | 26 OperationTyper(Isolate* isolate, Zone* zone); |
25 | 27 |
26 // Typing Phi. | 28 // Typing Phi. |
27 Type* Merge(Type* left, Type* right); | 29 Type* Merge(Type* left, Type* right); |
28 | 30 |
29 Type* ToPrimitive(Type* type); | 31 Type* ToPrimitive(Type* type); |
30 | 32 |
31 // Helpers for number operation typing. | 33 // Helpers for number operation typing. |
32 Type* ToNumber(Type* type); | 34 Type* ToNumber(Type* type); |
33 Type* WeakenRange(Type* current_range, Type* previous_range); | 35 Type* WeakenRange(Type* current_range, Type* previous_range); |
34 | 36 |
35 // Number unary operators. | 37 // Number unary operators. |
36 #define DECLARE_METHOD(Name) Type* Name(Type* type); | 38 #define DECLARE_METHOD(Name) Type* Name(Type* type); |
37 SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_METHOD) | 39 SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_METHOD) |
38 #undef DECLARE_METHOD | 40 #undef DECLARE_METHOD |
39 | 41 |
40 // Number binary operators. | 42 // Number binary operators. |
41 #define DECLARE_METHOD(Name) Type* Name(Type* lhs, Type* rhs); | 43 #define DECLARE_METHOD(Name) Type* Name(Type* lhs, Type* rhs); |
42 SIMPLIFIED_NUMBER_BINOP_LIST(DECLARE_METHOD) | 44 SIMPLIFIED_NUMBER_BINOP_LIST(DECLARE_METHOD) |
43 SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_METHOD) | 45 SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_METHOD) |
44 #undef DECLARE_METHOD | 46 #undef DECLARE_METHOD |
45 | 47 |
| 48 Type* TypeTypeGuard(const Operator* sigma_op, Type* input); |
| 49 |
46 enum ComparisonOutcomeFlags { | 50 enum ComparisonOutcomeFlags { |
47 kComparisonTrue = 1, | 51 kComparisonTrue = 1, |
48 kComparisonFalse = 2, | 52 kComparisonFalse = 2, |
49 kComparisonUndefined = 4 | 53 kComparisonUndefined = 4 |
50 }; | 54 }; |
51 | 55 |
52 Type* singleton_false() const { return singleton_false_; } | 56 Type* singleton_false() const { return singleton_false_; } |
53 Type* singleton_true() const { return singleton_true_; } | 57 Type* singleton_true() const { return singleton_true_; } |
54 Type* singleton_the_hole() const { return singleton_the_hole_; } | 58 Type* singleton_the_hole() const { return singleton_the_hole_; } |
55 | 59 |
(...skipping 20 matching lines...) Expand all Loading... |
76 Type* singleton_the_hole_; | 80 Type* singleton_the_hole_; |
77 Type* signed32ish_; | 81 Type* signed32ish_; |
78 Type* unsigned32ish_; | 82 Type* unsigned32ish_; |
79 }; | 83 }; |
80 | 84 |
81 } // namespace compiler | 85 } // namespace compiler |
82 } // namespace internal | 86 } // namespace internal |
83 } // namespace v8 | 87 } // namespace v8 |
84 | 88 |
85 #endif // V8_COMPILER_OPERATION_TYPER_H_ | 89 #endif // V8_COMPILER_OPERATION_TYPER_H_ |
OLD | NEW |