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