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/base/flags.h" | 8 #include "src/base/flags.h" |
9 #include "src/machine-type.h" | 9 #include "src/machine-type.h" |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 bool IsSupported() const { return op_ != nullptr; } | 25 bool IsSupported() const { return op_ != nullptr; } |
26 const Operator* op() const { | 26 const Operator* op() const { |
27 DCHECK_NOT_NULL(op_); | 27 DCHECK_NOT_NULL(op_); |
28 return op_; | 28 return op_; |
29 } | 29 } |
30 | 30 |
31 private: | 31 private: |
32 const Operator* const op_; | 32 const Operator* const op_; |
33 }; | 33 }; |
34 | 34 |
35 | |
36 // Supported float64 to int32 truncation modes. | |
37 enum class TruncationMode : uint8_t { | |
38 kJavaScript, // ES6 section 7.1.5 | |
39 kRoundToZero // Round towards zero. Implementation defined for NaN and ovf. | |
40 }; | |
41 | |
42 V8_INLINE size_t hash_value(TruncationMode mode) { | |
43 return static_cast<uint8_t>(mode); | |
44 } | |
45 | |
46 std::ostream& operator<<(std::ostream&, TruncationMode); | |
47 | |
48 TruncationMode TruncationModeOf(Operator const*); | |
49 | |
50 | |
51 // Supported write barrier modes. | 35 // Supported write barrier modes. |
52 enum WriteBarrierKind { | 36 enum WriteBarrierKind { |
53 kNoWriteBarrier, | 37 kNoWriteBarrier, |
54 kMapWriteBarrier, | 38 kMapWriteBarrier, |
55 kPointerWriteBarrier, | 39 kPointerWriteBarrier, |
56 kFullWriteBarrier | 40 kFullWriteBarrier |
57 }; | 41 }; |
58 | 42 |
59 std::ostream& operator<<(std::ostream& os, WriteBarrierKind); | 43 std::ostream& operator<<(std::ostream& os, WriteBarrierKind); |
60 | 44 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 const Operator* Int64LessThan(); | 200 const Operator* Int64LessThan(); |
217 const Operator* Int64LessThanOrEqual(); | 201 const Operator* Int64LessThanOrEqual(); |
218 const Operator* Uint64Div(); | 202 const Operator* Uint64Div(); |
219 const Operator* Uint64LessThan(); | 203 const Operator* Uint64LessThan(); |
220 const Operator* Uint64LessThanOrEqual(); | 204 const Operator* Uint64LessThanOrEqual(); |
221 const Operator* Uint64Mod(); | 205 const Operator* Uint64Mod(); |
222 | 206 |
223 // This operator reinterprets the bits of a word as tagged pointer. | 207 // This operator reinterprets the bits of a word as tagged pointer. |
224 const Operator* BitcastWordToTagged(); | 208 const Operator* BitcastWordToTagged(); |
225 | 209 |
| 210 // JavaScript float64 to int32/uint32 truncation. |
| 211 const Operator* TruncateFloat64ToWord32(); |
| 212 |
226 // These operators change the representation of numbers while preserving the | 213 // These operators change the representation of numbers while preserving the |
227 // value of the number. Narrowing operators assume the input is representable | 214 // value of the number. Narrowing operators assume the input is representable |
228 // in the target type and are *not* defined for other inputs. | 215 // in the target type and are *not* defined for other inputs. |
229 // Use narrowing change operators only when there is a static guarantee that | 216 // Use narrowing change operators only when there is a static guarantee that |
230 // the input value is representable in the target value. | 217 // the input value is representable in the target value. |
231 const Operator* ChangeFloat32ToFloat64(); | 218 const Operator* ChangeFloat32ToFloat64(); |
232 const Operator* ChangeFloat64ToInt32(); // narrowing | 219 const Operator* ChangeFloat64ToInt32(); // narrowing |
233 const Operator* ChangeFloat64ToUint32(); // narrowing | 220 const Operator* ChangeFloat64ToUint32(); // narrowing |
234 const Operator* TruncateFloat64ToUint32(); | 221 const Operator* TruncateFloat64ToUint32(); |
235 const Operator* TruncateFloat32ToInt32(); | 222 const Operator* TruncateFloat32ToInt32(); |
236 const Operator* TruncateFloat32ToUint32(); | 223 const Operator* TruncateFloat32ToUint32(); |
237 const Operator* TryTruncateFloat32ToInt64(); | 224 const Operator* TryTruncateFloat32ToInt64(); |
238 const Operator* TryTruncateFloat64ToInt64(); | 225 const Operator* TryTruncateFloat64ToInt64(); |
239 const Operator* TryTruncateFloat32ToUint64(); | 226 const Operator* TryTruncateFloat32ToUint64(); |
240 const Operator* TryTruncateFloat64ToUint64(); | 227 const Operator* TryTruncateFloat64ToUint64(); |
241 const Operator* ChangeInt32ToFloat64(); | 228 const Operator* ChangeInt32ToFloat64(); |
242 const Operator* ChangeInt32ToInt64(); | 229 const Operator* ChangeInt32ToInt64(); |
243 const Operator* ChangeUint32ToFloat64(); | 230 const Operator* ChangeUint32ToFloat64(); |
244 const Operator* ChangeUint32ToUint64(); | 231 const Operator* ChangeUint32ToUint64(); |
245 | 232 |
246 // These operators truncate or round numbers, both changing the representation | 233 // These operators truncate or round numbers, both changing the representation |
247 // of the number and mapping multiple input values onto the same output value. | 234 // of the number and mapping multiple input values onto the same output value. |
248 const Operator* TruncateFloat64ToFloat32(); | 235 const Operator* TruncateFloat64ToFloat32(); |
249 const Operator* TruncateFloat64ToInt32(TruncationMode); | |
250 const Operator* TruncateInt64ToInt32(); | 236 const Operator* TruncateInt64ToInt32(); |
| 237 const Operator* RoundFloat64ToInt32(); |
251 const Operator* RoundInt32ToFloat32(); | 238 const Operator* RoundInt32ToFloat32(); |
252 const Operator* RoundInt64ToFloat32(); | 239 const Operator* RoundInt64ToFloat32(); |
253 const Operator* RoundInt64ToFloat64(); | 240 const Operator* RoundInt64ToFloat64(); |
254 const Operator* RoundUint32ToFloat32(); | 241 const Operator* RoundUint32ToFloat32(); |
255 const Operator* RoundUint64ToFloat32(); | 242 const Operator* RoundUint64ToFloat32(); |
256 const Operator* RoundUint64ToFloat64(); | 243 const Operator* RoundUint64ToFloat64(); |
257 | 244 |
258 // These operators reinterpret the bits of a floating point number as an | 245 // These operators reinterpret the bits of a floating point number as an |
259 // integer and vice versa. | 246 // integer and vice versa. |
260 const Operator* BitcastFloat32ToInt32(); | 247 const Operator* BitcastFloat32ToInt32(); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 }; | 372 }; |
386 | 373 |
387 | 374 |
388 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) | 375 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) |
389 | 376 |
390 } // namespace compiler | 377 } // namespace compiler |
391 } // namespace internal | 378 } // namespace internal |
392 } // namespace v8 | 379 } // namespace v8 |
393 | 380 |
394 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 381 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
OLD | NEW |