Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Unified Diff: src/compiler/machine-operator.h

Issue 1225993002: [turbofan] Add TruncationMode for TruncateFloat64ToInt32. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/machine-operator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/machine-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698