Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index 3b486e7130635676283c95594480712f696765d8..37ca6c6767db106e18588f08f878e13299caa5c6 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -972,7 +972,7 @@ class HValue : public ZoneObject { |
virtual Representation RepresentationFromInputs() { |
return representation(); |
} |
- Representation RepresentationFromUses(); |
+ virtual Representation RepresentationFromUses(); |
Representation RepresentationFromUseRequirements(); |
bool HasNonSmiUse(); |
virtual void UpdateRepresentation(Representation new_rep, |
@@ -2656,6 +2656,7 @@ class HUnaryMathOperation V8_FINAL : public HTemplateInstruction<2> { |
virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
virtual HValue* Canonicalize() V8_OVERRIDE; |
+ virtual Representation RepresentationFromUses() V8_OVERRIDE; |
virtual Representation RepresentationFromInputs() V8_OVERRIDE; |
BuiltinFunctionId op() const { return op_; } |
@@ -2670,6 +2671,15 @@ class HUnaryMathOperation V8_FINAL : public HTemplateInstruction<2> { |
} |
private: |
+ // Indicates if we support a double (and int32) output for Math.floor and |
+ // Math.round. |
+ bool SupportsFlexibleFloorAndRound() const { |
+#ifdef V8_TARGET_ARCH_ARM64 |
+ return true; |
+#else |
+ return false; |
+#endif |
+ } |
HUnaryMathOperation(HValue* context, HValue* value, BuiltinFunctionId op) |
: HTemplateInstruction<2>(HType::TaggedNumber()), op_(op) { |
SetOperandAt(0, context); |
@@ -2677,6 +2687,12 @@ class HUnaryMathOperation V8_FINAL : public HTemplateInstruction<2> { |
switch (op) { |
case kMathFloor: |
case kMathRound: |
+ if (SupportsFlexibleFloorAndRound()) { |
+ SetFlag(kFlexibleRepresentation); |
+ } else { |
+ set_representation(Representation::Integer32()); |
+ } |
+ break; |
case kMathClz32: |
set_representation(Representation::Integer32()); |
break; |