Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index 850a047ec2d113a952667c15d5ea014965403786..fce11a111fa04a5885c51d83fdc4a08c0f5d7255 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -101,6 +101,7 @@ class LChunkBuilder; |
V(EnterInlined) \ |
V(ExternalArrayLength) \ |
V(FixedArrayLength) \ |
+ V(ToInt32) \ |
V(ForceRepresentation) \ |
V(FunctionLiteral) \ |
V(GetCachedArrayIndex) \ |
@@ -991,6 +992,14 @@ class HUnaryOperation: public HTemplateInstruction<1> { |
SetOperandAt(0, value); |
} |
+ static HUnaryOperation* cast(HValue* value) { |
+ return reinterpret_cast<HUnaryOperation*>(value); |
+ } |
+ |
+ virtual bool CanTruncateToInt32() const { |
+ return CheckFlag(kTruncatingToInt32); |
+ } |
+ |
HValue* value() { return OperandAt(0); } |
virtual void PrintDataTo(StringStream* stream); |
}; |
@@ -1055,8 +1064,6 @@ class HChange: public HUnaryOperation { |
return from_; |
} |
- bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } |
- |
virtual void PrintDataTo(StringStream* stream); |
DECLARE_CONCRETE_INSTRUCTION(Change) |
@@ -1114,6 +1121,37 @@ class HClampToUint8: public HUnaryOperation { |
}; |
+class HToInt32: public HUnaryOperation { |
+ public: |
+ explicit HToInt32(HValue* value) |
+ : HUnaryOperation(value) { |
+ set_representation(Representation::Integer32()); |
+ SetFlag(kUseGVN); |
+ } |
+ |
+ virtual Representation RequiredInputRepresentation(int index) const { |
+ return Representation::None(); |
+ } |
+ |
+ virtual bool CanTruncateToInt32() const { |
+ return true; |
+ } |
+ |
+ virtual HValue* Canonicalize() { |
+ if (value()->representation().IsInteger32()) { |
+ return value(); |
+ } else { |
+ return this; |
+ } |
+ } |
+ |
+ DECLARE_CONCRETE_INSTRUCTION(ToInt32) |
+ |
+ protected: |
+ virtual bool DataEquals(HValue* other) { return true; } |
+}; |
+ |
+ |
class HSimulate: public HInstruction { |
public: |
HSimulate(int ast_id, int pop_count) |