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/opcodes.h" | 8 #include "src/compiler/opcodes.h" |
9 #include "src/compiler/operator.h" | 9 #include "src/compiler/operator.h" |
10 #include "src/zone.h" | 10 #include "src/zone.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 Operator* Int64Mul() { BINOP_AC(Int64Mul); } | 129 Operator* Int64Mul() { BINOP_AC(Int64Mul); } |
130 Operator* Int64Div() { BINOP(Int64Div); } | 130 Operator* Int64Div() { BINOP(Int64Div); } |
131 Operator* Int64UDiv() { BINOP(Int64UDiv); } | 131 Operator* Int64UDiv() { BINOP(Int64UDiv); } |
132 Operator* Int64Mod() { BINOP(Int64Mod); } | 132 Operator* Int64Mod() { BINOP(Int64Mod); } |
133 Operator* Int64UMod() { BINOP(Int64UMod); } | 133 Operator* Int64UMod() { BINOP(Int64UMod); } |
134 Operator* Int64LessThan() { BINOP(Int64LessThan); } | 134 Operator* Int64LessThan() { BINOP(Int64LessThan); } |
135 Operator* Int64LessThanOrEqual() { BINOP(Int64LessThanOrEqual); } | 135 Operator* Int64LessThanOrEqual() { BINOP(Int64LessThanOrEqual); } |
136 | 136 |
137 Operator* ConvertInt32ToInt64() { UNOP(ConvertInt32ToInt64); } | 137 Operator* ConvertInt32ToInt64() { UNOP(ConvertInt32ToInt64); } |
138 Operator* ConvertInt64ToInt32() { UNOP(ConvertInt64ToInt32); } | 138 Operator* ConvertInt64ToInt32() { UNOP(ConvertInt64ToInt32); } |
| 139 |
| 140 // Convert representation of integers between float64 and int32/uint32. |
| 141 // The precise rounding mode and handling of out of range inputs are *not* |
| 142 // defined for these operators, since they are intended only for use with |
| 143 // integers. |
| 144 // TODO(titzer): rename ConvertXXX to ChangeXXX in machine operators. |
139 Operator* ConvertInt32ToFloat64() { UNOP(ConvertInt32ToFloat64); } | 145 Operator* ConvertInt32ToFloat64() { UNOP(ConvertInt32ToFloat64); } |
140 Operator* ConvertUint32ToFloat64() { UNOP(ConvertUint32ToFloat64); } | 146 Operator* ConvertUint32ToFloat64() { UNOP(ConvertUint32ToFloat64); } |
141 // TODO(titzer): add rounding mode to floating point conversion. | |
142 Operator* ConvertFloat64ToInt32() { UNOP(ConvertFloat64ToInt32); } | 147 Operator* ConvertFloat64ToInt32() { UNOP(ConvertFloat64ToInt32); } |
143 Operator* ConvertFloat64ToUint32() { UNOP(ConvertFloat64ToUint32); } | 148 Operator* ConvertFloat64ToUint32() { UNOP(ConvertFloat64ToUint32); } |
144 | 149 |
145 // TODO(titzer): do we need different rounding modes for float arithmetic? | 150 // Floating point operators always operate with IEEE 754 round-to-nearest. |
146 Operator* Float64Add() { BINOP_C(Float64Add); } | 151 Operator* Float64Add() { BINOP_C(Float64Add); } |
147 Operator* Float64Sub() { BINOP(Float64Sub); } | 152 Operator* Float64Sub() { BINOP(Float64Sub); } |
148 Operator* Float64Mul() { BINOP_C(Float64Mul); } | 153 Operator* Float64Mul() { BINOP_C(Float64Mul); } |
149 Operator* Float64Div() { BINOP(Float64Div); } | 154 Operator* Float64Div() { BINOP(Float64Div); } |
150 Operator* Float64Mod() { BINOP(Float64Mod); } | 155 Operator* Float64Mod() { BINOP(Float64Mod); } |
| 156 |
| 157 // Floating point comparisons complying to IEEE 754. |
151 Operator* Float64Equal() { BINOP_C(Float64Equal); } | 158 Operator* Float64Equal() { BINOP_C(Float64Equal); } |
152 Operator* Float64LessThan() { BINOP(Float64LessThan); } | 159 Operator* Float64LessThan() { BINOP(Float64LessThan); } |
153 Operator* Float64LessThanOrEqual() { BINOP(Float64LessThanOrEqual); } | 160 Operator* Float64LessThanOrEqual() { BINOP(Float64LessThanOrEqual); } |
154 | 161 |
155 inline bool is32() const { return word_ == kMachineWord32; } | 162 inline bool is32() const { return word_ == kMachineWord32; } |
156 inline bool is64() const { return word_ == kMachineWord64; } | 163 inline bool is64() const { return word_ == kMachineWord64; } |
157 inline MachineRepresentation word() const { return word_; } | 164 inline MachineRepresentation word() const { return word_; } |
158 | 165 |
159 static inline MachineRepresentation pointer_rep() { | 166 static inline MachineRepresentation pointer_rep() { |
160 return kPointerSize == 8 ? kMachineWord64 : kMachineWord32; | 167 return kPointerSize == 8 ? kMachineWord64 : kMachineWord32; |
161 } | 168 } |
162 | 169 |
163 #undef WORD_SIZE | 170 #undef WORD_SIZE |
164 #undef UNOP | 171 #undef UNOP |
165 #undef BINOP | 172 #undef BINOP |
166 #undef OP1 | 173 #undef OP1 |
167 #undef SIMPLE | 174 #undef SIMPLE |
168 | 175 |
169 private: | 176 private: |
170 Zone* zone_; | 177 Zone* zone_; |
171 MachineRepresentation word_; | 178 MachineRepresentation word_; |
172 }; | 179 }; |
173 } | 180 } |
174 } | 181 } |
175 } // namespace v8::internal::compiler | 182 } // namespace v8::internal::compiler |
176 | 183 |
177 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 184 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
OLD | NEW |