OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3189 } | 3189 } |
3190 | 3190 |
3191 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } | 3191 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } |
3192 | 3192 |
3193 bool ImmortalImmovable() const { | 3193 bool ImmortalImmovable() const { |
3194 if (has_int32_value_) { | 3194 if (has_int32_value_) { |
3195 return false; | 3195 return false; |
3196 } | 3196 } |
3197 if (has_double_value_) { | 3197 if (has_double_value_) { |
3198 if (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || | 3198 if (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || |
3199 isnan(double_value_)) { | 3199 isnan(double_value_) || |
3200 FixedDoubleArray::is_the_hole_nan(double_value_)) { | |
3200 return true; | 3201 return true; |
3201 } | 3202 } |
3202 return false; | 3203 return false; |
3203 } | 3204 } |
3204 | 3205 |
3205 ASSERT(!handle_.is_null()); | 3206 ASSERT(!handle_.is_null()); |
3206 Heap* heap = isolate()->heap(); | 3207 Heap* heap = isolate()->heap(); |
3207 // We should have handled minus_zero_value and nan_value in the | 3208 // We should have handled minus_zero_value and nan_value in the |
3208 // has_double_value_ clause above. | 3209 // has_double_value_ clause above. |
3209 // Dereferencing is safe to compare against immovable singletons. | 3210 // Dereferencing is safe to compare against immovable singletons. |
(...skipping 10 matching lines...) Expand all Loading... | |
3220 } | 3221 } |
3221 | 3222 |
3222 virtual Representation RequiredInputRepresentation(int index) { | 3223 virtual Representation RequiredInputRepresentation(int index) { |
3223 return Representation::None(); | 3224 return Representation::None(); |
3224 } | 3225 } |
3225 | 3226 |
3226 virtual bool IsConvertibleToInteger() const { | 3227 virtual bool IsConvertibleToInteger() const { |
3227 return has_int32_value_; | 3228 return has_int32_value_; |
3228 } | 3229 } |
3229 | 3230 |
3230 virtual bool EmitAtUses() { return !representation().IsDouble(); } | 3231 virtual bool EmitAtUses() { |
3232 return !representation().IsDouble() || ImmortalImmovable(); | |
danno
2013/04/08 12:57:27
Maybe it's better to factor our the special cases
mvstanton
2013/04/08 16:10:14
I did this kind of refactoring but more in the met
| |
3233 } | |
3231 virtual void PrintDataTo(StringStream* stream); | 3234 virtual void PrintDataTo(StringStream* stream); |
3232 virtual HType CalculateInferredType(); | 3235 virtual HType CalculateInferredType(); |
3233 bool IsInteger() { return handle()->IsSmi(); } | 3236 bool IsInteger() { return handle()->IsSmi(); } |
3234 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; | 3237 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; |
3235 HConstant* CopyToTruncatedInt32(Zone* zone) const; | 3238 HConstant* CopyToTruncatedInt32(Zone* zone) const; |
3236 bool HasInteger32Value() const { return has_int32_value_; } | 3239 bool HasInteger32Value() const { return has_int32_value_; } |
3237 int32_t Integer32Value() const { | 3240 int32_t Integer32Value() const { |
3238 ASSERT(HasInteger32Value()); | 3241 ASSERT(HasInteger32Value()); |
3239 return int32_value_; | 3242 return int32_value_; |
3240 } | 3243 } |
3241 bool HasSmiValue() const { | 3244 bool HasSmiValue() const { |
3242 return HasInteger32Value() && Smi::IsValid(Integer32Value()); | 3245 return HasInteger32Value() && Smi::IsValid(Integer32Value()); |
3243 } | 3246 } |
3244 bool HasDoubleValue() const { return has_double_value_; } | 3247 bool HasDoubleValue() const { return has_double_value_; } |
3245 double DoubleValue() const { | 3248 double DoubleValue() const { |
3246 ASSERT(HasDoubleValue()); | 3249 ASSERT(HasDoubleValue()); |
3247 return double_value_; | 3250 return double_value_; |
3248 } | 3251 } |
3252 bool IsDoubleCanonicalHole() const { | |
3253 ASSERT(HasDoubleValue()); | |
3254 return FixedDoubleArray::is_the_hole_nan(double_value_); | |
3255 } | |
3249 bool HasNumberValue() const { return has_double_value_; } | 3256 bool HasNumberValue() const { return has_double_value_; } |
3250 int32_t NumberValueAsInteger32() const { | 3257 int32_t NumberValueAsInteger32() const { |
3251 ASSERT(HasNumberValue()); | 3258 ASSERT(HasNumberValue()); |
3252 // Irrespective of whether a numeric HConstant can be safely | 3259 // Irrespective of whether a numeric HConstant can be safely |
3253 // represented as an int32, we store the (in some cases lossy) | 3260 // represented as an int32, we store the (in some cases lossy) |
3254 // representation of the number in int32_value_. | 3261 // representation of the number in int32_value_. |
3255 return int32_value_; | 3262 return int32_value_; |
3256 } | 3263 } |
3257 bool HasStringValue() const { | 3264 bool HasStringValue() const { |
3258 if (has_double_value_ || has_int32_value_) return false; | 3265 if (has_double_value_ || has_int32_value_) return false; |
(...skipping 2411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5670 return IsFastSmiElementsKind(elements_kind_); | 5677 return IsFastSmiElementsKind(elements_kind_); |
5671 } | 5678 } |
5672 ElementsKind elements_kind() const { return elements_kind_; } | 5679 ElementsKind elements_kind() const { return elements_kind_; } |
5673 uint32_t index_offset() { return index_offset_; } | 5680 uint32_t index_offset() { return index_offset_; } |
5674 void SetIndexOffset(uint32_t index_offset) { index_offset_ = index_offset; } | 5681 void SetIndexOffset(uint32_t index_offset) { index_offset_ = index_offset; } |
5675 HValue* GetKey() { return key(); } | 5682 HValue* GetKey() { return key(); } |
5676 void SetKey(HValue* key) { SetOperandAt(1, key); } | 5683 void SetKey(HValue* key) { SetOperandAt(1, key); } |
5677 bool IsDehoisted() { return is_dehoisted_; } | 5684 bool IsDehoisted() { return is_dehoisted_; } |
5678 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } | 5685 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } |
5679 | 5686 |
5687 bool IsConstantHoleStore() { | |
5688 return value()->IsConstant() && | |
5689 HConstant::cast(value())->IsDoubleCanonicalHole(); | |
danno
2013/04/08 12:57:27
This predicate seems misleading... it checks only
mvstanton
2013/04/08 16:10:14
Done.
| |
5690 } | |
5691 | |
5680 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { | 5692 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { |
5681 ASSERT(side_effect == kChangesNewSpacePromotion); | 5693 ASSERT(side_effect == kChangesNewSpacePromotion); |
5682 new_space_dominator_ = dominator; | 5694 new_space_dominator_ = dominator; |
5683 } | 5695 } |
5684 | 5696 |
5685 HValue* new_space_dominator() const { return new_space_dominator_; } | 5697 HValue* new_space_dominator() const { return new_space_dominator_; } |
5686 | 5698 |
5687 bool NeedsWriteBarrier() { | 5699 bool NeedsWriteBarrier() { |
5688 if (value_is_smi()) { | 5700 if (value_is_smi()) { |
5689 return false; | 5701 return false; |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6449 virtual bool IsDeletable() const { return true; } | 6461 virtual bool IsDeletable() const { return true; } |
6450 }; | 6462 }; |
6451 | 6463 |
6452 | 6464 |
6453 #undef DECLARE_INSTRUCTION | 6465 #undef DECLARE_INSTRUCTION |
6454 #undef DECLARE_CONCRETE_INSTRUCTION | 6466 #undef DECLARE_CONCRETE_INSTRUCTION |
6455 | 6467 |
6456 } } // namespace v8::internal | 6468 } } // namespace v8::internal |
6457 | 6469 |
6458 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6470 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |