| 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 3181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3192 Handle<Object> optional_handle = Handle<Object>::null()); | 3192 Handle<Object> optional_handle = Handle<Object>::null()); |
| 3193 HConstant(Handle<Object> handle, | 3193 HConstant(Handle<Object> handle, |
| 3194 UniqueValueId unique_id, | 3194 UniqueValueId unique_id, |
| 3195 Representation r, | 3195 Representation r, |
| 3196 HType type, | 3196 HType type, |
| 3197 bool is_internalized_string, | 3197 bool is_internalized_string, |
| 3198 bool boolean_value); | 3198 bool boolean_value); |
| 3199 | 3199 |
| 3200 Handle<Object> handle() { | 3200 Handle<Object> handle() { |
| 3201 if (handle_.is_null()) { | 3201 if (handle_.is_null()) { |
| 3202 handle_ = FACTORY->NewNumber(double_value_, pretenure()); | 3202 // The calculation for not_in_new_space_ must be revisited |
| 3203 // if the handle isn't created TENURED here. |
| 3204 handle_ = FACTORY->NewNumber(double_value_, TENURED); |
| 3203 } | 3205 } |
| 3204 ALLOW_HANDLE_DEREF(Isolate::Current(), "smi check"); | 3206 ALLOW_HANDLE_DEREF(Isolate::Current(), "smi check"); |
| 3205 ASSERT(has_int32_value_ || !handle_->IsSmi()); | 3207 ASSERT(has_int32_value_ || !handle_->IsSmi()); |
| 3206 return handle_; | 3208 return handle_; |
| 3207 } | 3209 } |
| 3208 | 3210 |
| 3209 bool IsSpecialDouble() const { | 3211 bool IsSpecialDouble() const { |
| 3210 return has_double_value_ && | 3212 return has_double_value_ && |
| 3211 (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || | 3213 (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || |
| 3212 FixedDoubleArray::is_the_hole_nan(double_value_) || | 3214 FixedDoubleArray::is_the_hole_nan(double_value_) || |
| 3213 std::isnan(double_value_)); | 3215 std::isnan(double_value_)); |
| 3214 } | 3216 } |
| 3215 | 3217 |
| 3216 bool InNewSpace() const { | 3218 bool GuaranteedInOldSpace() const { return guaranteed_in_old_space_; } |
| 3217 if (!handle_.is_null()) { | |
| 3218 ALLOW_HANDLE_DEREF(isolate(), "using raw address"); | |
| 3219 return isolate()->heap()->InNewSpace(*handle_); | |
| 3220 } | |
| 3221 // If the handle wasn't created yet, then we have a number. | |
| 3222 // If the handle is created it'll be tenured in old space. | |
| 3223 ASSERT(pretenure() == TENURED); | |
| 3224 return false; | |
| 3225 } | |
| 3226 | 3219 |
| 3227 bool ImmortalImmovable() const { | 3220 bool ImmortalImmovable() const { |
| 3228 if (has_int32_value_) { | 3221 if (has_int32_value_) { |
| 3229 return false; | 3222 return false; |
| 3230 } | 3223 } |
| 3231 if (has_double_value_) { | 3224 if (has_double_value_) { |
| 3232 if (IsSpecialDouble()) { | 3225 if (IsSpecialDouble()) { |
| 3233 return true; | 3226 return true; |
| 3234 } | 3227 } |
| 3235 return false; | 3228 return false; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3348 return !other_constant->handle_.is_null() && | 3341 return !other_constant->handle_.is_null() && |
| 3349 unique_id_ == other_constant->unique_id_; | 3342 unique_id_ == other_constant->unique_id_; |
| 3350 } | 3343 } |
| 3351 } | 3344 } |
| 3352 | 3345 |
| 3353 private: | 3346 private: |
| 3354 void Initialize(Representation r); | 3347 void Initialize(Representation r); |
| 3355 | 3348 |
| 3356 virtual bool IsDeletable() const { return true; } | 3349 virtual bool IsDeletable() const { return true; } |
| 3357 | 3350 |
| 3351 void set_guaranteed_in_old_space(bool value) { |
| 3352 guaranteed_in_old_space_ = value; |
| 3353 } |
| 3354 |
| 3358 // If this is a numerical constant, handle_ either points to to the | 3355 // If this is a numerical constant, handle_ either points to to the |
| 3359 // HeapObject the constant originated from or is null. If the | 3356 // HeapObject the constant originated from or is null. If the |
| 3360 // constant is non-numeric, handle_ always points to a valid | 3357 // constant is non-numeric, handle_ always points to a valid |
| 3361 // constant HeapObject. | 3358 // constant HeapObject. |
| 3362 static PretenureFlag pretenure() { return TENURED; } | |
| 3363 | |
| 3364 Handle<Object> handle_; | 3359 Handle<Object> handle_; |
| 3365 UniqueValueId unique_id_; | 3360 UniqueValueId unique_id_; |
| 3366 | 3361 |
| 3367 // We store the HConstant in the most specific form safely possible. | 3362 // We store the HConstant in the most specific form safely possible. |
| 3368 // The two flags, has_int32_value_ and has_double_value_ tell us if | 3363 // The two flags, has_int32_value_ and has_double_value_ tell us if |
| 3369 // int32_value_ and double_value_ hold valid, safe representations | 3364 // int32_value_ and double_value_ hold valid, safe representations |
| 3370 // of the constant. has_int32_value_ implies has_double_value_ but | 3365 // of the constant. has_int32_value_ implies has_double_value_ but |
| 3371 // not the converse. | 3366 // not the converse. |
| 3372 bool has_int32_value_ : 1; | 3367 bool has_int32_value_ : 1; |
| 3373 bool has_double_value_ : 1; | 3368 bool has_double_value_ : 1; |
| 3374 bool is_internalized_string_ : 1; // TODO(yangguo): make this part of HType. | 3369 bool is_internalized_string_ : 1; // TODO(yangguo): make this part of HType. |
| 3375 bool boolean_value_ : 1; | 3370 bool boolean_value_ : 1; |
| 3371 bool guaranteed_in_old_space_ : 1; |
| 3376 int32_t int32_value_; | 3372 int32_t int32_value_; |
| 3377 double double_value_; | 3373 double double_value_; |
| 3378 HType type_from_value_; | 3374 HType type_from_value_; |
| 3379 }; | 3375 }; |
| 3380 | 3376 |
| 3381 | 3377 |
| 3382 class HBinaryOperation: public HTemplateInstruction<3> { | 3378 class HBinaryOperation: public HTemplateInstruction<3> { |
| 3383 public: | 3379 public: |
| 3384 HBinaryOperation(HValue* context, HValue* left, HValue* right) | 3380 HBinaryOperation(HValue* context, HValue* left, HValue* right) |
| 3385 : observed_output_representation_(Representation::None()) { | 3381 : observed_output_representation_(Representation::None()) { |
| (...skipping 3174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6560 virtual bool IsDeletable() const { return true; } | 6556 virtual bool IsDeletable() const { return true; } |
| 6561 }; | 6557 }; |
| 6562 | 6558 |
| 6563 | 6559 |
| 6564 #undef DECLARE_INSTRUCTION | 6560 #undef DECLARE_INSTRUCTION |
| 6565 #undef DECLARE_CONCRETE_INSTRUCTION | 6561 #undef DECLARE_CONCRETE_INSTRUCTION |
| 6566 | 6562 |
| 6567 } } // namespace v8::internal | 6563 } } // namespace v8::internal |
| 6568 | 6564 |
| 6569 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6565 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |