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 16 matching lines...) Expand all Loading... |
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* NumericAdd(Type* lhs, Type* rhs); | 35 Type* NumericAdd(Type* lhs, Type* rhs); |
36 Type* NumericSubtract(Type* lhs, Type* rhs); | 36 Type* NumericSubtract(Type* lhs, Type* rhs); |
| 37 Type* NumericMultiply(Type* lhs, Type* rhs); |
| 38 Type* NumericDivide(Type* lhs, Type* rhs); |
| 39 Type* NumericModulus(Type* lhs, Type* rhs); |
37 | 40 |
38 enum ComparisonOutcomeFlags { | 41 enum ComparisonOutcomeFlags { |
39 kComparisonTrue = 1, | 42 kComparisonTrue = 1, |
40 kComparisonFalse = 2, | 43 kComparisonFalse = 2, |
41 kComparisonUndefined = 4 | 44 kComparisonUndefined = 4 |
42 }; | 45 }; |
43 | 46 |
44 // Javascript binop typers. | 47 // Javascript binop typers. |
45 #define DECLARE_CASE(x) Type* Type##x(Type* lhs, Type* rhs); | 48 #define DECLARE_CASE(x) Type* Type##x(Type* lhs, Type* rhs); |
46 JS_SIMPLE_BINOP_LIST(DECLARE_CASE) | 49 JS_SIMPLE_BINOP_LIST(DECLARE_CASE) |
47 #undef DECLARE_CASE | 50 #undef DECLARE_CASE |
48 | 51 |
49 Type* singleton_false() { return singleton_false_; } | 52 Type* singleton_false() { return singleton_false_; } |
50 Type* singleton_true() { return singleton_true_; } | 53 Type* singleton_true() { return singleton_true_; } |
51 Type* singleton_the_hole() { return singleton_the_hole_; } | 54 Type* singleton_the_hole() { return singleton_the_hole_; } |
52 | 55 |
53 private: | 56 private: |
54 typedef base::Flags<ComparisonOutcomeFlags> ComparisonOutcome; | 57 typedef base::Flags<ComparisonOutcomeFlags> ComparisonOutcome; |
55 | 58 |
56 ComparisonOutcome Invert(ComparisonOutcome); | 59 ComparisonOutcome Invert(ComparisonOutcome); |
57 Type* Invert(Type*); | 60 Type* Invert(Type*); |
58 Type* FalsifyUndefined(ComparisonOutcome); | 61 Type* FalsifyUndefined(ComparisonOutcome); |
59 | 62 |
60 Type* Rangify(Type*); | 63 Type* Rangify(Type*); |
61 Type* AddRanger(RangeType* lhs, RangeType* rhs); | 64 Type* AddRanger(RangeType* lhs, RangeType* rhs); |
62 Type* SubtractRanger(RangeType* lhs, RangeType* rhs); | 65 Type* SubtractRanger(RangeType* lhs, RangeType* rhs); |
| 66 Type* MultiplyRanger(Type* lhs, Type* rhs); |
63 Type* ModulusRanger(RangeType* lhs, RangeType* rhs); | 67 Type* ModulusRanger(RangeType* lhs, RangeType* rhs); |
64 | 68 |
65 Zone* zone() { return zone_; } | 69 Zone* zone() { return zone_; } |
66 | 70 |
67 Zone* zone_; | 71 Zone* zone_; |
68 TypeCache const& cache_; | 72 TypeCache const& cache_; |
69 | 73 |
70 Type* singleton_false_; | 74 Type* singleton_false_; |
71 Type* singleton_true_; | 75 Type* singleton_true_; |
72 Type* singleton_the_hole_; | 76 Type* singleton_the_hole_; |
73 }; | 77 }; |
74 | 78 |
75 } // namespace compiler | 79 } // namespace compiler |
76 } // namespace internal | 80 } // namespace internal |
77 } // namespace v8 | 81 } // namespace v8 |
78 | 82 |
79 #endif // V8_COMPILER_OPERATION_TYPER_H_ | 83 #endif // V8_COMPILER_OPERATION_TYPER_H_ |
OLD | NEW |