OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_MACHINE_OPERATOR_H_ | 5 #ifndef V8_COMPILER_MACHINE_OPERATOR_H_ |
6 #define V8_COMPILER_MACHINE_OPERATOR_H_ | 6 #define V8_COMPILER_MACHINE_OPERATOR_H_ |
7 | 7 |
8 #include "src/compiler/machine-type.h" | 8 #include "src/compiler/machine-type.h" |
9 #include "src/compiler/opcodes.h" | 9 #include "src/compiler/opcodes.h" |
10 #include "src/compiler/operator.h" | 10 #include "src/compiler/operator.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 SIMPLE(name, \ | 53 SIMPLE(name, \ |
54 Operator::kAssociative | Operator::kCommutative | Operator::kPure, 2, \ | 54 Operator::kAssociative | Operator::kCommutative | Operator::kPure, 2, \ |
55 1) | 55 1) |
56 #define BINOP_ACO(name) \ | 56 #define BINOP_ACO(name) \ |
57 SIMPLE(name, \ | 57 SIMPLE(name, \ |
58 Operator::kAssociative | Operator::kCommutative | Operator::kPure, 2, \ | 58 Operator::kAssociative | Operator::kCommutative | Operator::kPure, 2, \ |
59 2) | 59 2) |
60 #define UNOP(name) SIMPLE(name, Operator::kPure, 1, 1) | 60 #define UNOP(name) SIMPLE(name, Operator::kPure, 1, 1) |
61 | 61 |
62 #define WORD_SIZE(x) return is64() ? Word64##x() : Word32##x() | 62 #define WORD_SIZE(x) return is64() ? Word64##x() : Word32##x() |
| 63 #define INT_SIZE(x) return is64() ? Int64##x() : Int32##x() |
63 | 64 |
64 Operator* Load(MachineType rep) { // load [base + index] | 65 Operator* Load(MachineType rep) { // load [base + index] |
65 OP1(Load, MachineType, rep, Operator::kNoWrite, 2, 1); | 66 OP1(Load, MachineType, rep, Operator::kNoWrite, 2, 1); |
66 } | 67 } |
67 // store [base + index], value | 68 // store [base + index], value |
68 Operator* Store(MachineType rep, WriteBarrierKind kind) { | 69 Operator* Store(MachineType rep, WriteBarrierKind kind) { |
69 StoreRepresentation store_rep = {rep, kind}; | 70 StoreRepresentation store_rep = {rep, kind}; |
70 OP1(Store, StoreRepresentation, store_rep, Operator::kNoRead, 3, 0); | 71 OP1(Store, StoreRepresentation, store_rep, Operator::kNoRead, 3, 0); |
71 } | 72 } |
72 | 73 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 Operator* Int64Add() { BINOP_AC(Int64Add); } | 115 Operator* Int64Add() { BINOP_AC(Int64Add); } |
115 Operator* Int64Sub() { BINOP(Int64Sub); } | 116 Operator* Int64Sub() { BINOP(Int64Sub); } |
116 Operator* Int64Mul() { BINOP_AC(Int64Mul); } | 117 Operator* Int64Mul() { BINOP_AC(Int64Mul); } |
117 Operator* Int64Div() { BINOP(Int64Div); } | 118 Operator* Int64Div() { BINOP(Int64Div); } |
118 Operator* Int64UDiv() { BINOP(Int64UDiv); } | 119 Operator* Int64UDiv() { BINOP(Int64UDiv); } |
119 Operator* Int64Mod() { BINOP(Int64Mod); } | 120 Operator* Int64Mod() { BINOP(Int64Mod); } |
120 Operator* Int64UMod() { BINOP(Int64UMod); } | 121 Operator* Int64UMod() { BINOP(Int64UMod); } |
121 Operator* Int64LessThan() { BINOP(Int64LessThan); } | 122 Operator* Int64LessThan() { BINOP(Int64LessThan); } |
122 Operator* Int64LessThanOrEqual() { BINOP(Int64LessThanOrEqual); } | 123 Operator* Int64LessThanOrEqual() { BINOP(Int64LessThanOrEqual); } |
123 | 124 |
| 125 // Signed comparison of word-sized integer values, translates to int32/int64 |
| 126 // comparisons depending on the word-size of the machine. |
| 127 Operator* IntLessThan() { INT_SIZE(LessThan); } |
| 128 Operator* IntLessThanOrEqual() { INT_SIZE(LessThanOrEqual); } |
| 129 |
124 // Convert representation of integers between float64 and int32/uint32. | 130 // Convert representation of integers between float64 and int32/uint32. |
125 // The precise rounding mode and handling of out of range inputs are *not* | 131 // The precise rounding mode and handling of out of range inputs are *not* |
126 // defined for these operators, since they are intended only for use with | 132 // defined for these operators, since they are intended only for use with |
127 // integers. | 133 // integers. |
128 Operator* ChangeInt32ToFloat64() { UNOP(ChangeInt32ToFloat64); } | 134 Operator* ChangeInt32ToFloat64() { UNOP(ChangeInt32ToFloat64); } |
129 Operator* ChangeUint32ToFloat64() { UNOP(ChangeUint32ToFloat64); } | 135 Operator* ChangeUint32ToFloat64() { UNOP(ChangeUint32ToFloat64); } |
130 Operator* ChangeFloat64ToInt32() { UNOP(ChangeFloat64ToInt32); } | 136 Operator* ChangeFloat64ToInt32() { UNOP(ChangeFloat64ToInt32); } |
131 Operator* ChangeFloat64ToUint32() { UNOP(ChangeFloat64ToUint32); } | 137 Operator* ChangeFloat64ToUint32() { UNOP(ChangeFloat64ToUint32); } |
132 | 138 |
133 // Sign/zero extend int32/uint32 to int64/uint64. | 139 // Sign/zero extend int32/uint32 to int64/uint64. |
(...skipping 16 matching lines...) Expand all Loading... |
150 // Floating point comparisons complying to IEEE 754. | 156 // Floating point comparisons complying to IEEE 754. |
151 Operator* Float64Equal() { BINOP_C(Float64Equal); } | 157 Operator* Float64Equal() { BINOP_C(Float64Equal); } |
152 Operator* Float64LessThan() { BINOP(Float64LessThan); } | 158 Operator* Float64LessThan() { BINOP(Float64LessThan); } |
153 Operator* Float64LessThanOrEqual() { BINOP(Float64LessThanOrEqual); } | 159 Operator* Float64LessThanOrEqual() { BINOP(Float64LessThanOrEqual); } |
154 | 160 |
155 inline bool is32() const { return word_ == kRepWord32; } | 161 inline bool is32() const { return word_ == kRepWord32; } |
156 inline bool is64() const { return word_ == kRepWord64; } | 162 inline bool is64() const { return word_ == kRepWord64; } |
157 inline MachineType word() const { return word_; } | 163 inline MachineType word() const { return word_; } |
158 | 164 |
159 #undef WORD_SIZE | 165 #undef WORD_SIZE |
| 166 #undef INT_SIZE |
160 #undef UNOP | 167 #undef UNOP |
161 #undef BINOP | 168 #undef BINOP |
162 #undef OP1 | 169 #undef OP1 |
163 #undef SIMPLE | 170 #undef SIMPLE |
164 | 171 |
165 private: | 172 private: |
166 Zone* zone_; | 173 Zone* zone_; |
167 MachineType word_; | 174 MachineType word_; |
168 }; | 175 }; |
169 } | 176 } |
170 } | 177 } |
171 } // namespace v8::internal::compiler | 178 } // namespace v8::internal::compiler |
172 | 179 |
173 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 180 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
OLD | NEW |