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 3172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3183 Handle<Object> handle() { | 3183 Handle<Object> handle() { |
3184 if (handle_.is_null()) { | 3184 if (handle_.is_null()) { |
3185 handle_ = FACTORY->NewNumber(double_value_, TENURED); | 3185 handle_ = FACTORY->NewNumber(double_value_, TENURED); |
3186 } | 3186 } |
3187 ASSERT(has_int32_value_ || !handle_->IsSmi()); | 3187 ASSERT(has_int32_value_ || !handle_->IsSmi()); |
3188 return handle_; | 3188 return handle_; |
3189 } | 3189 } |
3190 | 3190 |
3191 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } | 3191 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } |
3192 | 3192 |
| 3193 bool IsSpecialDouble() const { |
| 3194 return has_double_value_ && |
| 3195 (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || |
| 3196 FixedDoubleArray::is_the_hole_nan(double_value_) || |
| 3197 isnan(double_value_)); |
| 3198 } |
| 3199 |
3193 bool ImmortalImmovable() const { | 3200 bool ImmortalImmovable() const { |
3194 if (has_int32_value_) { | 3201 if (has_int32_value_) { |
3195 return false; | 3202 return false; |
3196 } | 3203 } |
3197 if (has_double_value_) { | 3204 if (has_double_value_) { |
3198 if (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || | 3205 if (IsSpecialDouble()) { |
3199 isnan(double_value_)) { | |
3200 return true; | 3206 return true; |
3201 } | 3207 } |
3202 return false; | 3208 return false; |
3203 } | 3209 } |
3204 | 3210 |
3205 ASSERT(!handle_.is_null()); | 3211 ASSERT(!handle_.is_null()); |
3206 Heap* heap = isolate()->heap(); | 3212 Heap* heap = isolate()->heap(); |
3207 // We should have handled minus_zero_value and nan_value in the | 3213 // We should have handled minus_zero_value and nan_value in the |
3208 // has_double_value_ clause above. | 3214 // has_double_value_ clause above. |
3209 // Dereferencing is safe to compare against immovable singletons. | 3215 // Dereferencing is safe to compare against immovable singletons. |
(...skipping 10 matching lines...) Expand all Loading... |
3220 } | 3226 } |
3221 | 3227 |
3222 virtual Representation RequiredInputRepresentation(int index) { | 3228 virtual Representation RequiredInputRepresentation(int index) { |
3223 return Representation::None(); | 3229 return Representation::None(); |
3224 } | 3230 } |
3225 | 3231 |
3226 virtual bool IsConvertibleToInteger() const { | 3232 virtual bool IsConvertibleToInteger() const { |
3227 return has_int32_value_; | 3233 return has_int32_value_; |
3228 } | 3234 } |
3229 | 3235 |
3230 virtual bool EmitAtUses() { return !representation().IsDouble(); } | 3236 virtual bool EmitAtUses() { |
| 3237 return !representation().IsDouble() || IsSpecialDouble(); |
| 3238 } |
3231 virtual void PrintDataTo(StringStream* stream); | 3239 virtual void PrintDataTo(StringStream* stream); |
3232 virtual HType CalculateInferredType(); | 3240 virtual HType CalculateInferredType(); |
3233 bool IsInteger() { return handle()->IsSmi(); } | 3241 bool IsInteger() { return handle()->IsSmi(); } |
3234 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; | 3242 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; |
3235 HConstant* CopyToTruncatedInt32(Zone* zone) const; | 3243 HConstant* CopyToTruncatedInt32(Zone* zone) const; |
3236 bool HasInteger32Value() const { return has_int32_value_; } | 3244 bool HasInteger32Value() const { return has_int32_value_; } |
3237 int32_t Integer32Value() const { | 3245 int32_t Integer32Value() const { |
3238 ASSERT(HasInteger32Value()); | 3246 ASSERT(HasInteger32Value()); |
3239 return int32_value_; | 3247 return int32_value_; |
3240 } | 3248 } |
3241 bool HasSmiValue() const { | 3249 bool HasSmiValue() const { |
3242 return HasInteger32Value() && Smi::IsValid(Integer32Value()); | 3250 return HasInteger32Value() && Smi::IsValid(Integer32Value()); |
3243 } | 3251 } |
3244 bool HasDoubleValue() const { return has_double_value_; } | 3252 bool HasDoubleValue() const { return has_double_value_; } |
3245 double DoubleValue() const { | 3253 double DoubleValue() const { |
3246 ASSERT(HasDoubleValue()); | 3254 ASSERT(HasDoubleValue()); |
3247 return double_value_; | 3255 return double_value_; |
3248 } | 3256 } |
| 3257 bool IsTheHole() const { |
| 3258 if (HasDoubleValue() && FixedDoubleArray::is_the_hole_nan(double_value_)) { |
| 3259 return true; |
| 3260 } |
| 3261 Heap* heap = isolate()->heap(); |
| 3262 if (!handle_.is_null() && *handle_ == heap->the_hole_value()) { |
| 3263 return true; |
| 3264 } |
| 3265 return false; |
| 3266 } |
3249 bool HasNumberValue() const { return has_double_value_; } | 3267 bool HasNumberValue() const { return has_double_value_; } |
3250 int32_t NumberValueAsInteger32() const { | 3268 int32_t NumberValueAsInteger32() const { |
3251 ASSERT(HasNumberValue()); | 3269 ASSERT(HasNumberValue()); |
3252 // Irrespective of whether a numeric HConstant can be safely | 3270 // Irrespective of whether a numeric HConstant can be safely |
3253 // represented as an int32, we store the (in some cases lossy) | 3271 // represented as an int32, we store the (in some cases lossy) |
3254 // representation of the number in int32_value_. | 3272 // representation of the number in int32_value_. |
3255 return int32_value_; | 3273 return int32_value_; |
3256 } | 3274 } |
3257 bool HasStringValue() const { | 3275 bool HasStringValue() const { |
3258 if (has_double_value_ || has_int32_value_) return false; | 3276 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_); | 5688 return IsFastSmiElementsKind(elements_kind_); |
5671 } | 5689 } |
5672 ElementsKind elements_kind() const { return elements_kind_; } | 5690 ElementsKind elements_kind() const { return elements_kind_; } |
5673 uint32_t index_offset() { return index_offset_; } | 5691 uint32_t index_offset() { return index_offset_; } |
5674 void SetIndexOffset(uint32_t index_offset) { index_offset_ = index_offset; } | 5692 void SetIndexOffset(uint32_t index_offset) { index_offset_ = index_offset; } |
5675 HValue* GetKey() { return key(); } | 5693 HValue* GetKey() { return key(); } |
5676 void SetKey(HValue* key) { SetOperandAt(1, key); } | 5694 void SetKey(HValue* key) { SetOperandAt(1, key); } |
5677 bool IsDehoisted() { return is_dehoisted_; } | 5695 bool IsDehoisted() { return is_dehoisted_; } |
5678 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } | 5696 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } |
5679 | 5697 |
| 5698 bool IsConstantHoleStore() { |
| 5699 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); |
| 5700 } |
| 5701 |
5680 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { | 5702 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { |
5681 ASSERT(side_effect == kChangesNewSpacePromotion); | 5703 ASSERT(side_effect == kChangesNewSpacePromotion); |
5682 new_space_dominator_ = dominator; | 5704 new_space_dominator_ = dominator; |
5683 } | 5705 } |
5684 | 5706 |
5685 HValue* new_space_dominator() const { return new_space_dominator_; } | 5707 HValue* new_space_dominator() const { return new_space_dominator_; } |
5686 | 5708 |
5687 bool NeedsWriteBarrier() { | 5709 bool NeedsWriteBarrier() { |
5688 if (value_is_smi()) { | 5710 if (value_is_smi()) { |
5689 return false; | 5711 return false; |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6449 virtual bool IsDeletable() const { return true; } | 6471 virtual bool IsDeletable() const { return true; } |
6450 }; | 6472 }; |
6451 | 6473 |
6452 | 6474 |
6453 #undef DECLARE_INSTRUCTION | 6475 #undef DECLARE_INSTRUCTION |
6454 #undef DECLARE_CONCRETE_INSTRUCTION | 6476 #undef DECLARE_CONCRETE_INSTRUCTION |
6455 | 6477 |
6456 } } // namespace v8::internal | 6478 } } // namespace v8::internal |
6457 | 6479 |
6458 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6480 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |