| 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 2531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2542 has_smi_value_(Smi::IsValid(integer_value)), | 2542 has_smi_value_(Smi::IsValid(integer_value)), |
| 2543 has_int32_value_(true), | 2543 has_int32_value_(true), |
| 2544 has_double_value_(true), | 2544 has_double_value_(true), |
| 2545 has_external_reference_value_(false), | 2545 has_external_reference_value_(false), |
| 2546 is_internalized_string_(false), | 2546 is_internalized_string_(false), |
| 2547 is_not_in_new_space_(is_not_in_new_space), | 2547 is_not_in_new_space_(is_not_in_new_space), |
| 2548 is_cell_(false), | 2548 is_cell_(false), |
| 2549 boolean_value_(integer_value != 0), | 2549 boolean_value_(integer_value != 0), |
| 2550 int32_value_(integer_value), | 2550 int32_value_(integer_value), |
| 2551 double_value_(FastI2D(integer_value)) { | 2551 double_value_(FastI2D(integer_value)) { |
| 2552 set_type(has_smi_value_ ? HType::Smi() : HType::TaggedNumber()); | 2552 // It's possible to create a constant with a value in Smi-range but stored |
| 2553 // in a (pre-existing) HeapNumber. See crbug.com/349878. |
| 2554 bool could_be_heapobject = r.IsTagged() && !object.handle().is_null(); |
| 2555 bool is_smi = has_smi_value_ && !could_be_heapobject; |
| 2556 set_type(is_smi ? HType::Smi() : HType::TaggedNumber()); |
| 2553 Initialize(r); | 2557 Initialize(r); |
| 2554 } | 2558 } |
| 2555 | 2559 |
| 2556 | 2560 |
| 2557 HConstant::HConstant(double double_value, | 2561 HConstant::HConstant(double double_value, |
| 2558 Representation r, | 2562 Representation r, |
| 2559 bool is_not_in_new_space, | 2563 bool is_not_in_new_space, |
| 2560 Unique<Object> object) | 2564 Unique<Object> object) |
| 2561 : object_(object), | 2565 : object_(object), |
| 2562 has_int32_value_(IsInteger32(double_value)), | 2566 has_int32_value_(IsInteger32(double_value)), |
| 2563 has_double_value_(true), | 2567 has_double_value_(true), |
| 2564 has_external_reference_value_(false), | 2568 has_external_reference_value_(false), |
| 2565 is_internalized_string_(false), | 2569 is_internalized_string_(false), |
| 2566 is_not_in_new_space_(is_not_in_new_space), | 2570 is_not_in_new_space_(is_not_in_new_space), |
| 2567 is_cell_(false), | 2571 is_cell_(false), |
| 2568 boolean_value_(double_value != 0 && !std::isnan(double_value)), | 2572 boolean_value_(double_value != 0 && !std::isnan(double_value)), |
| 2569 int32_value_(DoubleToInt32(double_value)), | 2573 int32_value_(DoubleToInt32(double_value)), |
| 2570 double_value_(double_value) { | 2574 double_value_(double_value) { |
| 2571 has_smi_value_ = has_int32_value_ && Smi::IsValid(int32_value_); | 2575 has_smi_value_ = has_int32_value_ && Smi::IsValid(int32_value_); |
| 2572 set_type(has_smi_value_ ? HType::Smi() : HType::TaggedNumber()); | 2576 // It's possible to create a constant with a value in Smi-range but stored |
| 2577 // in a (pre-existing) HeapNumber. See crbug.com/349878. |
| 2578 bool could_be_heapobject = r.IsTagged() && !object.handle().is_null(); |
| 2579 bool is_smi = has_smi_value_ && !could_be_heapobject; |
| 2580 set_type(is_smi ? HType::Smi() : HType::TaggedNumber()); |
| 2573 Initialize(r); | 2581 Initialize(r); |
| 2574 } | 2582 } |
| 2575 | 2583 |
| 2576 | 2584 |
| 2577 HConstant::HConstant(ExternalReference reference) | 2585 HConstant::HConstant(ExternalReference reference) |
| 2578 : HTemplateInstruction<0>(HType::None()), | 2586 : HTemplateInstruction<0>(HType::None()), |
| 2579 object_(Unique<Object>(Handle<Object>::null())), | 2587 object_(Unique<Object>(Handle<Object>::null())), |
| 2580 has_smi_value_(false), | 2588 has_smi_value_(false), |
| 2581 has_int32_value_(false), | 2589 has_int32_value_(false), |
| 2582 has_double_value_(false), | 2590 has_double_value_(false), |
| (...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4468 break; | 4476 break; |
| 4469 case kExternalMemory: | 4477 case kExternalMemory: |
| 4470 stream->Add("[external-memory]"); | 4478 stream->Add("[external-memory]"); |
| 4471 break; | 4479 break; |
| 4472 } | 4480 } |
| 4473 | 4481 |
| 4474 stream->Add("@%d", offset()); | 4482 stream->Add("@%d", offset()); |
| 4475 } | 4483 } |
| 4476 | 4484 |
| 4477 } } // namespace v8::internal | 4485 } } // namespace v8::internal |
| OLD | NEW |