Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index ad036871802b32b0ad9646e480fd43339444ce0f..ce9d473a9afc6778d68ab341f71ae0bf73011c11 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -3190,13 +3190,19 @@ class HConstant: public HTemplateInstruction<0> { |
bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } |
+ bool IsSpecialDouble() const { |
+ ASSERT(has_double_value_); |
danno
2013/04/08 20:51:21
Any reason this has to be an assert? Why not just
mvstanton
2013/04/09 07:13:08
Good idea, done.
|
+ return BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || |
+ isnan(double_value_) || |
+ IsDoubleCanonicalHole(); |
+ } |
+ |
bool ImmortalImmovable() const { |
if (has_int32_value_) { |
return false; |
} |
if (has_double_value_) { |
- if (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || |
- isnan(double_value_)) { |
+ if (IsSpecialDouble()) { |
return true; |
} |
return false; |
@@ -3227,7 +3233,9 @@ class HConstant: public HTemplateInstruction<0> { |
return has_int32_value_; |
} |
- virtual bool EmitAtUses() { return !representation().IsDouble(); } |
+ virtual bool EmitAtUses() { |
+ return !representation().IsDouble() || ImmortalImmovable(); |
danno
2013/04/08 20:51:21
|| IsSpecialDouble instead of || ImmortanImmovable
mvstanton
2013/04/09 07:13:08
Now I see, thanks.
|
+ } |
virtual void PrintDataTo(StringStream* stream); |
virtual HType CalculateInferredType(); |
bool IsInteger() { return handle()->IsSmi(); } |
@@ -3246,6 +3254,12 @@ class HConstant: public HTemplateInstruction<0> { |
ASSERT(HasDoubleValue()); |
return double_value_; |
} |
+ bool IsTheHole() const { |
+ if (HasDoubleValue() && IsDoubleCanonicalHole()) return true; |
+ Heap* heap = isolate()->heap(); |
+ if (!handle_.is_null() && *handle_ == heap->the_hole_value()) return true; |
+ return false; |
+ } |
bool HasNumberValue() const { return has_double_value_; } |
int32_t NumberValueAsInteger32() const { |
ASSERT(HasNumberValue()); |
@@ -3324,6 +3338,11 @@ class HConstant: public HTemplateInstruction<0> { |
virtual bool IsDeletable() const { return true; } |
+ bool IsDoubleCanonicalHole() const { |
+ ASSERT(HasDoubleValue()); |
+ return FixedDoubleArray::is_the_hole_nan(double_value_); |
danno
2013/04/08 20:51:21
Since this is only used once, it's probably fine j
mvstanton
2013/04/09 07:13:08
Also in IsSpecialDouble(), but that is okay, this
|
+ } |
+ |
// If this is a numerical constant, handle_ either points to to the |
// HeapObject the constant originated from or is null. If the |
// constant is non-numeric, handle_ always points to a valid |
@@ -5677,6 +5696,10 @@ class HStoreKeyed |
bool IsDehoisted() { return is_dehoisted_; } |
void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } |
+ bool IsConstantHoleStore() { |
+ return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); |
+ } |
+ |
virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { |
ASSERT(side_effect == kChangesNewSpacePromotion); |
new_space_dominator_ = dominator; |