Index: src/compiler/machine-operator.h |
diff --git a/src/compiler/machine-operator.h b/src/compiler/machine-operator.h |
index 288006c509e824328a886cef1c7cb70b81d11829..0c055b8732f79390b8a59f74f570750cc4247f93 100644 |
--- a/src/compiler/machine-operator.h |
+++ b/src/compiler/machine-operator.h |
@@ -16,8 +16,9 @@ namespace compiler { |
struct MachineOperatorGlobalCache; |
class Operator; |
+ |
// For operators that are not supported on all platforms. |
-class OptionalOperator { |
+class OptionalOperator final { |
public: |
explicit OptionalOperator(const Operator* op) : op_(op) {} |
@@ -28,9 +29,25 @@ class OptionalOperator { |
} |
private: |
- const Operator* op_; |
+ const Operator* const op_; |
+}; |
+ |
+ |
+// Supported float64 to int32 truncation modes. |
+enum class TruncationMode : uint8_t { |
+ kJavaScript, // ES6 section 7.1.5 |
+ kRoundToZero // Round towards zero. Implementation defined for NaN and ovf. |
}; |
+V8_INLINE size_t hash_value(TruncationMode mode) { |
+ return static_cast<uint8_t>(mode); |
+} |
+ |
+std::ostream& operator<<(std::ostream&, TruncationMode); |
+ |
+TruncationMode TruncationModeOf(Operator const*); |
+ |
+ |
// Supported write barrier modes. |
enum WriteBarrierKind { kNoWriteBarrier, kFullWriteBarrier }; |
@@ -175,7 +192,7 @@ class MachineOperatorBuilder final : public ZoneObject { |
// These operators truncate numbers, both changing the representation of |
// the number and mapping multiple input values onto the same output value. |
const Operator* TruncateFloat64ToFloat32(); |
- const Operator* TruncateFloat64ToInt32(); // JavaScript semantics. |
+ const Operator* TruncateFloat64ToInt32(TruncationMode); |
const Operator* TruncateInt64ToInt32(); |
// Floating point operators always operate with IEEE 754 round-to-nearest |