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 |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // Typing Phi. | 26 // Typing Phi. |
27 Type* Merge(Type* left, Type* right); | 27 Type* Merge(Type* left, Type* right); |
28 | 28 |
29 Type* ToPrimitive(Type* type); | 29 Type* ToPrimitive(Type* type); |
30 | 30 |
31 // Helpers for number operation typing. | 31 // Helpers for number operation typing. |
32 Type* ToNumber(Type* type); | 32 Type* ToNumber(Type* type); |
33 Type* WeakenRange(Type* current_range, Type* previous_range); | 33 Type* WeakenRange(Type* current_range, Type* previous_range); |
34 | 34 |
35 Type* NumberAdd(Type* lhs, Type* rhs); | 35 // Number unary operators. |
36 Type* NumberSubtract(Type* lhs, Type* rhs); | 36 #define DECLARE_METHOD(Name) Type* Name(Type* type); |
37 Type* NumberMultiply(Type* lhs, Type* rhs); | 37 SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_METHOD) |
38 Type* NumberDivide(Type* lhs, Type* rhs); | 38 #undef DECLARE_METHOD |
39 Type* NumberModulus(Type* lhs, Type* rhs); | |
40 | 39 |
41 Type* NumberAbs(Type* type); | 40 // Number binary operators. |
| 41 #define DECLARE_METHOD(Name) Type* Name(Type* lhs, Type* rhs); |
| 42 SIMPLIFIED_NUMBER_BINOP_LIST(DECLARE_METHOD) |
| 43 SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_METHOD) |
| 44 #undef DECLARE_METHOD |
42 | 45 |
43 enum ComparisonOutcomeFlags { | 46 enum ComparisonOutcomeFlags { |
44 kComparisonTrue = 1, | 47 kComparisonTrue = 1, |
45 kComparisonFalse = 2, | 48 kComparisonFalse = 2, |
46 kComparisonUndefined = 4 | 49 kComparisonUndefined = 4 |
47 }; | 50 }; |
48 | 51 |
49 // Javascript binop typers. | 52 Type* singleton_false() const { return singleton_false_; } |
50 #define DECLARE_CASE(x) Type* Type##x(Type* lhs, Type* rhs); | 53 Type* singleton_true() const { return singleton_true_; } |
51 JS_SIMPLE_BINOP_LIST(DECLARE_CASE) | 54 Type* singleton_the_hole() const { return singleton_the_hole_; } |
52 #undef DECLARE_CASE | |
53 | |
54 Type* singleton_false() { return singleton_false_; } | |
55 Type* singleton_true() { return singleton_true_; } | |
56 Type* singleton_the_hole() { return singleton_the_hole_; } | |
57 | 55 |
58 private: | 56 private: |
59 typedef base::Flags<ComparisonOutcomeFlags> ComparisonOutcome; | 57 typedef base::Flags<ComparisonOutcomeFlags> ComparisonOutcome; |
60 | 58 |
61 ComparisonOutcome Invert(ComparisonOutcome); | 59 ComparisonOutcome Invert(ComparisonOutcome); |
62 Type* Invert(Type*); | 60 Type* Invert(Type*); |
63 Type* FalsifyUndefined(ComparisonOutcome); | 61 Type* FalsifyUndefined(ComparisonOutcome); |
64 | 62 |
65 Type* Rangify(Type*); | 63 Type* Rangify(Type*); |
66 Type* AddRanger(double lhs_min, double lhs_max, double rhs_min, | 64 Type* AddRanger(double lhs_min, double lhs_max, double rhs_min, |
67 double rhs_max); | 65 double rhs_max); |
68 Type* SubtractRanger(RangeType* lhs, RangeType* rhs); | 66 Type* SubtractRanger(RangeType* lhs, RangeType* rhs); |
69 Type* MultiplyRanger(Type* lhs, Type* rhs); | 67 Type* MultiplyRanger(Type* lhs, Type* rhs); |
70 | 68 |
71 Zone* zone() { return zone_; } | 69 Zone* zone() const { return zone_; } |
72 | 70 |
73 Zone* zone_; | 71 Zone* const zone_; |
74 TypeCache const& cache_; | 72 TypeCache const& cache_; |
75 | 73 |
76 Type* singleton_false_; | 74 Type* singleton_false_; |
77 Type* singleton_true_; | 75 Type* singleton_true_; |
78 Type* singleton_the_hole_; | 76 Type* singleton_the_hole_; |
| 77 Type* signed32ish_; |
| 78 Type* unsigned32ish_; |
79 }; | 79 }; |
80 | 80 |
81 } // namespace compiler | 81 } // namespace compiler |
82 } // namespace internal | 82 } // namespace internal |
83 } // namespace v8 | 83 } // namespace v8 |
84 | 84 |
85 #endif // V8_COMPILER_OPERATION_TYPER_H_ | 85 #endif // V8_COMPILER_OPERATION_TYPER_H_ |
OLD | NEW |