Index: src/hydrogen-instructions.h |
=================================================================== |
--- src/hydrogen-instructions.h (revision 7737) |
+++ src/hydrogen-instructions.h (working copy) |
@@ -554,6 +554,8 @@ |
representation_ = r; |
} |
+ virtual bool IsConvertibleToInteger() const { return true; } |
+ |
HType type() const { return type_; } |
void set_type(HType type) { |
ASSERT(HasNoUses()); |
@@ -1922,7 +1924,8 @@ |
: inputs_(2), |
merged_index_(merged_index), |
phi_id_(-1), |
- is_live_(false) { |
+ is_live_(false), |
+ is_convertible_to_integer_(true) { |
for (int i = 0; i < Representation::kNumRepresentations; i++) { |
non_phi_uses_[i] = 0; |
indirect_uses_[i] = 0; |
@@ -2000,6 +2003,14 @@ |
} |
virtual Opcode opcode() const { return HValue::kPhi; } |
+ virtual bool IsConvertibleToInteger() const { |
+ return is_convertible_to_integer_; |
+ } |
+ |
+ void set_is_convertible_to_integer(bool b) { |
+ is_convertible_to_integer_ = b; |
+ } |
+ |
protected: |
virtual void DeleteFromGraph(); |
virtual void InternalSetOperandAt(int index, HValue* value) { |
@@ -2014,6 +2025,7 @@ |
int indirect_uses_[Representation::kNumRepresentations]; |
int phi_id_; |
bool is_live_; |
+ bool is_convertible_to_integer_; |
}; |
@@ -2044,6 +2056,14 @@ |
return Representation::None(); |
} |
+ virtual bool IsConvertibleToInteger() const { |
+ if (handle_->IsSmi()) return true; |
+ if (handle_->IsHeapNumber() && |
+ (HeapNumber::cast(*handle_)->value() == |
+ static_cast<double>(NumberToInt32(*handle_)))) return true; |
+ return false; |
+ } |
+ |
virtual bool EmitAtUses() { return !representation().IsDouble(); } |
virtual void PrintDataTo(StringStream* stream); |
virtual HType CalculateInferredType(); |