| 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 2622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2633 } | 2633 } |
| 2634 | 2634 |
| 2635 | 2635 |
| 2636 static bool IsInteger32(double value) { | 2636 static bool IsInteger32(double value) { |
| 2637 double roundtrip_value = static_cast<double>(static_cast<int32_t>(value)); | 2637 double roundtrip_value = static_cast<double>(static_cast<int32_t>(value)); |
| 2638 return BitCast<int64_t>(roundtrip_value) == BitCast<int64_t>(value); | 2638 return BitCast<int64_t>(roundtrip_value) == BitCast<int64_t>(value); |
| 2639 } | 2639 } |
| 2640 | 2640 |
| 2641 | 2641 |
| 2642 HConstant::HConstant(Handle<Object> handle, Representation r) | 2642 HConstant::HConstant(Handle<Object> handle, Representation r) |
| 2643 : handle_(handle), | 2643 : HTemplateInstruction<0>(HType::TypeFromValue(handle)), |
| 2644 handle_(handle), |
| 2644 unique_id_(), | 2645 unique_id_(), |
| 2645 has_smi_value_(false), | 2646 has_smi_value_(false), |
| 2646 has_int32_value_(false), | 2647 has_int32_value_(false), |
| 2647 has_double_value_(false), | 2648 has_double_value_(false), |
| 2648 has_external_reference_value_(false), | 2649 has_external_reference_value_(false), |
| 2649 is_internalized_string_(false), | 2650 is_internalized_string_(false), |
| 2650 is_not_in_new_space_(true), | 2651 is_not_in_new_space_(true), |
| 2651 is_cell_(false), | 2652 is_cell_(false), |
| 2652 boolean_value_(handle->BooleanValue()) { | 2653 boolean_value_(handle->BooleanValue()) { |
| 2653 set_type(HType::TypeFromValue(handle)); | |
| 2654 | |
| 2655 if (handle_->IsHeapObject()) { | 2654 if (handle_->IsHeapObject()) { |
| 2656 Heap* heap = Handle<HeapObject>::cast(handle)->GetHeap(); | 2655 Heap* heap = Handle<HeapObject>::cast(handle)->GetHeap(); |
| 2657 is_not_in_new_space_ = !heap->InNewSpace(*handle); | 2656 is_not_in_new_space_ = !heap->InNewSpace(*handle); |
| 2658 } | 2657 } |
| 2659 if (handle_->IsNumber()) { | 2658 if (handle_->IsNumber()) { |
| 2660 double n = handle_->Number(); | 2659 double n = handle_->Number(); |
| 2661 has_int32_value_ = IsInteger32(n); | 2660 has_int32_value_ = IsInteger32(n); |
| 2662 int32_value_ = DoubleToInt32(n); | 2661 int32_value_ = DoubleToInt32(n); |
| 2663 has_smi_value_ = has_int32_value_ && Smi::IsValid(int32_value_); | 2662 has_smi_value_ = has_int32_value_ && Smi::IsValid(int32_value_); |
| 2664 double_value_ = n; | 2663 double_value_ = n; |
| 2665 has_double_value_ = true; | 2664 has_double_value_ = true; |
| 2666 } else { | 2665 } else { |
| 2667 is_internalized_string_ = handle_->IsInternalizedString(); | 2666 is_internalized_string_ = handle_->IsInternalizedString(); |
| 2668 } | 2667 } |
| 2669 | 2668 |
| 2670 is_cell_ = !handle_.is_null() && | 2669 is_cell_ = !handle_.is_null() && |
| 2671 (handle_->IsCell() || handle_->IsPropertyCell()); | 2670 (handle_->IsCell() || handle_->IsPropertyCell()); |
| 2672 Initialize(r); | 2671 Initialize(r); |
| 2673 } | 2672 } |
| 2674 | 2673 |
| 2675 | 2674 |
| 2676 HConstant::HConstant(Handle<Object> handle, | 2675 HConstant::HConstant(Handle<Object> handle, |
| 2677 UniqueValueId unique_id, | 2676 UniqueValueId unique_id, |
| 2678 Representation r, | 2677 Representation r, |
| 2679 HType type, | 2678 HType type, |
| 2680 bool is_internalize_string, | 2679 bool is_internalize_string, |
| 2681 bool is_not_in_new_space, | 2680 bool is_not_in_new_space, |
| 2682 bool is_cell, | 2681 bool is_cell, |
| 2683 bool boolean_value) | 2682 bool boolean_value) |
| 2684 : handle_(handle), | 2683 : HTemplateInstruction<0>(type), |
| 2684 handle_(handle), |
| 2685 unique_id_(unique_id), | 2685 unique_id_(unique_id), |
| 2686 has_smi_value_(false), | 2686 has_smi_value_(false), |
| 2687 has_int32_value_(false), | 2687 has_int32_value_(false), |
| 2688 has_double_value_(false), | 2688 has_double_value_(false), |
| 2689 has_external_reference_value_(false), | 2689 has_external_reference_value_(false), |
| 2690 is_internalized_string_(is_internalize_string), | 2690 is_internalized_string_(is_internalize_string), |
| 2691 is_not_in_new_space_(is_not_in_new_space), | 2691 is_not_in_new_space_(is_not_in_new_space), |
| 2692 is_cell_(is_cell), | 2692 is_cell_(is_cell), |
| 2693 boolean_value_(boolean_value) { | 2693 boolean_value_(boolean_value) { |
| 2694 ASSERT(!handle.is_null()); | 2694 ASSERT(!handle.is_null()); |
| 2695 ASSERT(!type.IsTaggedNumber()); | 2695 ASSERT(!type.IsTaggedNumber()); |
| 2696 set_type(type); | |
| 2697 Initialize(r); | 2696 Initialize(r); |
| 2698 } | 2697 } |
| 2699 | 2698 |
| 2700 | 2699 |
| 2701 HConstant::HConstant(int32_t integer_value, | 2700 HConstant::HConstant(int32_t integer_value, |
| 2702 Representation r, | 2701 Representation r, |
| 2703 bool is_not_in_new_space, | 2702 bool is_not_in_new_space, |
| 2704 Handle<Object> optional_handle) | 2703 Handle<Object> optional_handle) |
| 2705 : handle_(optional_handle), | 2704 : handle_(optional_handle), |
| 2706 unique_id_(), | 2705 unique_id_(), |
| (...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4500 break; | 4499 break; |
| 4501 case kExternalMemory: | 4500 case kExternalMemory: |
| 4502 stream->Add("[external-memory]"); | 4501 stream->Add("[external-memory]"); |
| 4503 break; | 4502 break; |
| 4504 } | 4503 } |
| 4505 | 4504 |
| 4506 stream->Add("@%d", offset()); | 4505 stream->Add("@%d", offset()); |
| 4507 } | 4506 } |
| 4508 | 4507 |
| 4509 } } // namespace v8::internal | 4508 } } // namespace v8::internal |
| OLD | NEW |