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 Type* NumberAdd(Type* lhs, Type* rhs); | 37 Type* NumberAdd(Type* lhs, Type* rhs); |
36 Type* NumberSubtract(Type* lhs, Type* rhs); | 38 Type* NumberSubtract(Type* lhs, Type* rhs); |
37 Type* NumberMultiply(Type* lhs, Type* rhs); | 39 Type* NumberMultiply(Type* lhs, Type* rhs); |
38 Type* NumberDivide(Type* lhs, Type* rhs); | 40 Type* NumberDivide(Type* lhs, Type* rhs); |
39 Type* NumberModulus(Type* lhs, Type* rhs); | 41 Type* NumberModulus(Type* lhs, Type* rhs); |
40 | 42 |
41 Type* NumberAbs(Type* type); | 43 Type* NumberAbs(Type* type); |
42 | 44 |
| 45 Type* TypeSigma(const Operator* sigma_op, Type* input); |
| 46 |
43 enum ComparisonOutcomeFlags { | 47 enum ComparisonOutcomeFlags { |
44 kComparisonTrue = 1, | 48 kComparisonTrue = 1, |
45 kComparisonFalse = 2, | 49 kComparisonFalse = 2, |
46 kComparisonUndefined = 4 | 50 kComparisonUndefined = 4 |
47 }; | 51 }; |
48 | 52 |
49 // Javascript binop typers. | 53 // Javascript binop typers. |
50 #define DECLARE_CASE(x) Type* Type##x(Type* lhs, Type* rhs); | 54 #define DECLARE_CASE(x) Type* Type##x(Type* lhs, Type* rhs); |
51 JS_SIMPLE_BINOP_LIST(DECLARE_CASE) | 55 JS_SIMPLE_BINOP_LIST(DECLARE_CASE) |
52 #undef DECLARE_CASE | 56 #undef DECLARE_CASE |
(...skipping 24 matching lines...) Expand all Loading... |
77 Type* singleton_false_; | 81 Type* singleton_false_; |
78 Type* singleton_true_; | 82 Type* singleton_true_; |
79 Type* singleton_the_hole_; | 83 Type* singleton_the_hole_; |
80 }; | 84 }; |
81 | 85 |
82 } // namespace compiler | 86 } // namespace compiler |
83 } // namespace internal | 87 } // namespace internal |
84 } // namespace v8 | 88 } // namespace v8 |
85 | 89 |
86 #endif // V8_COMPILER_OPERATION_TYPER_H_ | 90 #endif // V8_COMPILER_OPERATION_TYPER_H_ |
OLD | NEW |