Chromium Code Reviews| Index: src/compiler/machine-operator.h |
| diff --git a/src/compiler/machine-operator.h b/src/compiler/machine-operator.h |
| index 8a16fcaae98a2614b33f7da284ea103664124262..442aeced8295efcfb051d0da5e186e03d7605c55 100644 |
| --- a/src/compiler/machine-operator.h |
| +++ b/src/compiler/machine-operator.h |
| @@ -16,6 +16,20 @@ namespace compiler { |
| struct MachineOperatorGlobalCache; |
| class Operator; |
| +// For operators that are not supported on all platforms. |
| +class OptionalOperator { |
| + public: |
| + explicit OptionalOperator(const Operator* op) : op_(op) {} |
| + |
| + bool supported() const { return op_ != nullptr; } |
|
Benedikt Meurer
2015/05/07 04:48:38
Nit: Can we rename this to Supported() or IsSuppor
titzer
2015/05/11 11:55:29
Done.
|
| + const Operator* op() const { |
| + DCHECK_NOT_NULL(op_); |
| + return op_; |
| + } |
| + |
| + private: |
| + const Operator* op_; |
| +}; |
| // Supported write barrier modes. |
| enum WriteBarrierKind { kNoWriteBarrier, kFullWriteBarrier }; |
| @@ -85,7 +99,10 @@ class MachineOperatorBuilder final : public ZoneObject { |
| kFloat64RoundTiesAway = 1u << 8, |
| kInt32DivIsSafe = 1u << 9, |
| kUint32DivIsSafe = 1u << 10, |
| - kWord32ShiftIsSafe = 1u << 11 |
| + kWord32ShiftIsSafe = 1u << 11, |
| + kAllOptionalOps = kFloat32Abs | kFloat32Max | kFloat32Min | kFloat64Abs | |
| + kFloat64Max | kFloat64Min | kFloat64RoundDown | |
| + kFloat64RoundTruncate | kFloat64RoundTiesAway |
| }; |
| typedef base::Flags<Flag, unsigned> Flags; |
| @@ -188,32 +205,23 @@ class MachineOperatorBuilder final : public ZoneObject { |
| const Operator* Float64LessThanOrEqual(); |
| // Floating point min/max complying to IEEE 754 (single-precision). |
| - const Operator* Float32Max(); |
| - const Operator* Float32Min(); |
| - bool HasFloat32Max() { return flags_ & kFloat32Max; } |
| - bool HasFloat32Min() { return flags_ & kFloat32Min; } |
| + const OptionalOperator Float32Max(); |
| + const OptionalOperator Float32Min(); |
| // Floating point min/max complying to IEEE 754 (double-precision). |
| - const Operator* Float64Max(); |
| - const Operator* Float64Min(); |
| - bool HasFloat64Max() { return flags_ & kFloat64Max; } |
| - bool HasFloat64Min() { return flags_ & kFloat64Min; } |
| + const OptionalOperator Float64Max(); |
| + const OptionalOperator Float64Min(); |
| // Floating point abs complying to IEEE 754 (single-precision). |
| - const Operator* Float32Abs(); |
| - bool HasFloat32Abs() const { return flags_ & kFloat32Abs; } |
| + const OptionalOperator Float32Abs(); |
| // Floating point abs complying to IEEE 754 (double-precision). |
| - const Operator* Float64Abs(); |
| - bool HasFloat64Abs() const { return flags_ & kFloat64Abs; } |
| + const OptionalOperator Float64Abs(); |
| // Floating point rounding. |
| - const Operator* Float64RoundDown(); |
| - const Operator* Float64RoundTruncate(); |
| - const Operator* Float64RoundTiesAway(); |
| - bool HasFloat64RoundDown() { return flags_ & kFloat64RoundDown; } |
| - bool HasFloat64RoundTruncate() { return flags_ & kFloat64RoundTruncate; } |
| - bool HasFloat64RoundTiesAway() { return flags_ & kFloat64RoundTiesAway; } |
| + const OptionalOperator Float64RoundDown(); |
| + const OptionalOperator Float64RoundTruncate(); |
| + const OptionalOperator Float64RoundTiesAway(); |
| // Floating point bit representation. |
| const Operator* Float64ExtractLowWord32(); |