diff options
Diffstat (limited to 'deps/v8/src/compiler/machine-operator.h')
-rw-r--r-- | deps/v8/src/compiler/machine-operator.h | 54 |
1 files changed, 42 insertions, 12 deletions
diff --git a/deps/v8/src/compiler/machine-operator.h b/deps/v8/src/compiler/machine-operator.h index d4f9ffa0fdc..aa4f2dcf2ca 100644 --- a/deps/v8/src/compiler/machine-operator.h +++ b/deps/v8/src/compiler/machine-operator.h @@ -18,7 +18,6 @@ namespace internal { namespace compiler { // Forward declarations. -struct MachineOperatorGlobalCache; class Operator; @@ -181,6 +180,16 @@ V8_EXPORT_PRIVATE S8x16ShuffleParameter const& S8x16ShuffleParameterOf( StackCheckKind StackCheckKindOf(Operator const* op) V8_WARN_UNUSED_RESULT; +// ShiftKind::kShiftOutZeros means that it is guaranteed that the bits shifted +// out of the left operand are all zeros. If this is not the case, undefined +// behavior (i.e., incorrect optimizations) will happen. +// This is mostly useful for Smi untagging. +enum class ShiftKind { kNormal, kShiftOutZeros }; + +size_t hash_value(ShiftKind); +V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, ShiftKind); +ShiftKind ShiftKindOf(Operator const*) V8_WARN_UNUSED_RESULT; + // Interface for building machine-level operators. These operators are // machine-level but machine-independent and thus define a language suitable // for generating code to run on architectures such as ia32, x64, arm, etc. @@ -211,13 +220,15 @@ class V8_EXPORT_PRIVATE MachineOperatorBuilder final kWord64ReverseBits = 1u << 17, kInt32AbsWithOverflow = 1u << 20, kInt64AbsWithOverflow = 1u << 21, - kAllOptionalOps = kFloat32RoundDown | kFloat64RoundDown | kFloat32RoundUp | - kFloat64RoundUp | kFloat32RoundTruncate | - kFloat64RoundTruncate | kFloat64RoundTiesAway | - kFloat32RoundTiesEven | kFloat64RoundTiesEven | - kWord32Ctz | kWord64Ctz | kWord32Popcnt | kWord64Popcnt | - kWord32ReverseBits | kWord64ReverseBits | - kInt32AbsWithOverflow | kInt64AbsWithOverflow + kWord32Rol = 1u << 22, + kWord64Rol = 1u << 23, + kAllOptionalOps = + kFloat32RoundDown | kFloat64RoundDown | kFloat32RoundUp | + kFloat64RoundUp | kFloat32RoundTruncate | kFloat64RoundTruncate | + kFloat64RoundTiesAway | kFloat32RoundTiesEven | kFloat64RoundTiesEven | + kWord32Ctz | kWord64Ctz | kWord32Popcnt | kWord64Popcnt | + kWord32ReverseBits | kWord64ReverseBits | kInt32AbsWithOverflow | + kInt64AbsWithOverflow | kWord32Rol | kWord64Rol }; using Flags = base::Flags<Flag, unsigned>; @@ -294,7 +305,12 @@ class V8_EXPORT_PRIVATE MachineOperatorBuilder final const Operator* Word32Xor(); const Operator* Word32Shl(); const Operator* Word32Shr(); - const Operator* Word32Sar(); + const Operator* Word32Sar(ShiftKind kind); + const Operator* Word32Sar() { return Word32Sar(ShiftKind::kNormal); } + const Operator* Word32SarShiftOutZeros() { + return Word32Sar(ShiftKind::kShiftOutZeros); + } + const OptionalOperator Word32Rol(); const Operator* Word32Ror(); const Operator* Word32Equal(); const Operator* Word32Clz(); @@ -319,7 +335,12 @@ class V8_EXPORT_PRIVATE MachineOperatorBuilder final const Operator* Word64Xor(); const Operator* Word64Shl(); const Operator* Word64Shr(); - const Operator* Word64Sar(); + const Operator* Word64Sar(ShiftKind kind); + const Operator* Word64Sar() { return Word64Sar(ShiftKind::kNormal); } + const Operator* Word64SarShiftOutZeros() { + return Word64Sar(ShiftKind::kShiftOutZeros); + } + const OptionalOperator Word64Rol(); const Operator* Word64Ror(); const Operator* Word64Clz(); const OptionalOperator Word64Ctz(); @@ -553,6 +574,8 @@ class V8_EXPORT_PRIVATE MachineOperatorBuilder final const Operator* F64x2Le(); const Operator* F64x2Qfma(); const Operator* F64x2Qfms(); + const Operator* F64x2Pmin(); + const Operator* F64x2Pmax(); const Operator* F32x4Splat(); const Operator* F32x4ExtractLane(int32_t); @@ -577,6 +600,8 @@ class V8_EXPORT_PRIVATE MachineOperatorBuilder final const Operator* F32x4Le(); const Operator* F32x4Qfma(); const Operator* F32x4Qfms(); + const Operator* F32x4Pmin(); + const Operator* F32x4Pmax(); const Operator* I64x2Splat(); const Operator* I64x2SplatI32Pair(); @@ -842,7 +867,6 @@ class V8_EXPORT_PRIVATE MachineOperatorBuilder final V(Word, Xor) \ V(Word, Shl) \ V(Word, Shr) \ - V(Word, Sar) \ V(Word, Ror) \ V(Word, Clz) \ V(Word, Equal) \ @@ -865,9 +889,15 @@ class V8_EXPORT_PRIVATE MachineOperatorBuilder final #undef PSEUDO_OP #undef PSEUDO_OP_LIST + const Operator* WordSar(ShiftKind kind = ShiftKind::kNormal) { + return Is32() ? Word32Sar(kind) : Word64Sar(kind); + } + const Operator* WordSarShiftOutZeros() { + return WordSar(ShiftKind::kShiftOutZeros); + } + private: Zone* zone_; - MachineOperatorGlobalCache const& cache_; MachineRepresentation const word_; Flags const flags_; AlignmentRequirements const alignment_requirements_; |