| 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 Verify(); | 441 Verify(); |
| 442 #endif | 442 #endif |
| 443 return may_overflow; | 443 return may_overflow; |
| 444 } | 444 } |
| 445 | 445 |
| 446 | 446 |
| 447 const char* HType::ToString() { | 447 const char* HType::ToString() { |
| 448 // Note: The c1visualizer syntax for locals allows only a sequence of the | 448 // Note: The c1visualizer syntax for locals allows only a sequence of the |
| 449 // following characters: A-Za-z0-9_-|: | 449 // following characters: A-Za-z0-9_-|: |
| 450 switch (type_) { | 450 switch (type_) { |
| 451 case kNone: return "none"; | |
| 452 case kTagged: return "tagged"; | 451 case kTagged: return "tagged"; |
| 453 case kTaggedPrimitive: return "primitive"; | 452 case kTaggedPrimitive: return "primitive"; |
| 454 case kTaggedNumber: return "number"; | 453 case kTaggedNumber: return "number"; |
| 455 case kSmi: return "smi"; | 454 case kSmi: return "smi"; |
| 456 case kHeapNumber: return "heap-number"; | 455 case kHeapNumber: return "heap-number"; |
| 457 case kString: return "string"; | 456 case kString: return "string"; |
| 458 case kBoolean: return "boolean"; | 457 case kBoolean: return "boolean"; |
| 459 case kNonPrimitive: return "non-primitive"; | 458 case kNonPrimitive: return "non-primitive"; |
| 460 case kJSArray: return "array"; | 459 case kJSArray: return "array"; |
| 461 case kJSObject: return "object"; | 460 case kJSObject: return "object"; |
| 461 case kUninitialized: return "uninitialized"; |
| 462 } | 462 } |
| 463 UNREACHABLE(); | 463 UNREACHABLE(); |
| 464 return "unreachable"; | 464 return "unreachable"; |
| 465 } | 465 } |
| 466 | 466 |
| 467 | 467 |
| 468 HType HType::TypeFromValue(Handle<Object> value) { | 468 HType HType::TypeFromValue(Handle<Object> value) { |
| 469 HType result = HType::Tagged(); | 469 HType result = HType::Tagged(); |
| 470 if (value->IsSmi()) { | 470 if (value->IsSmi()) { |
| 471 result = HType::Smi(); | 471 result = HType::Smi(); |
| (...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1625 | 1625 |
| 1626 // Return NULL to remove this instruction from the graph. | 1626 // Return NULL to remove this instruction from the graph. |
| 1627 return NULL; | 1627 return NULL; |
| 1628 } | 1628 } |
| 1629 } | 1629 } |
| 1630 return this; | 1630 return this; |
| 1631 } | 1631 } |
| 1632 | 1632 |
| 1633 | 1633 |
| 1634 HValue* HCheckInstanceType::Canonicalize() { | 1634 HValue* HCheckInstanceType::Canonicalize() { |
| 1635 if (check_ == IS_STRING && value()->type().IsString()) { | 1635 if (check_ == IS_STRING && |
| 1636 !value()->type().IsUninitialized() && |
| 1637 value()->type().IsString()) { |
| 1636 return NULL; | 1638 return NULL; |
| 1637 } | 1639 } |
| 1638 | 1640 |
| 1639 if (check_ == IS_INTERNALIZED_STRING && value()->IsConstant()) { | 1641 if (check_ == IS_INTERNALIZED_STRING && value()->IsConstant()) { |
| 1640 if (HConstant::cast(value())->HasInternalizedStringValue()) return NULL; | 1642 if (HConstant::cast(value())->HasInternalizedStringValue()) return NULL; |
| 1641 } | 1643 } |
| 1642 return this; | 1644 return this; |
| 1643 } | 1645 } |
| 1644 | 1646 |
| 1645 | 1647 |
| (...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2638 return BitCast<int64_t>(roundtrip_value) == BitCast<int64_t>(value); | 2640 return BitCast<int64_t>(roundtrip_value) == BitCast<int64_t>(value); |
| 2639 } | 2641 } |
| 2640 | 2642 |
| 2641 | 2643 |
| 2642 HConstant::HConstant(Handle<Object> handle, Representation r) | 2644 HConstant::HConstant(Handle<Object> handle, Representation r) |
| 2643 : handle_(handle), | 2645 : handle_(handle), |
| 2644 unique_id_(), | 2646 unique_id_(), |
| 2645 has_smi_value_(false), | 2647 has_smi_value_(false), |
| 2646 has_int32_value_(false), | 2648 has_int32_value_(false), |
| 2647 has_double_value_(false), | 2649 has_double_value_(false), |
| 2648 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 { |
| 2666 type_from_value_ = HType::TypeFromValue(handle_); |
| 2667 is_internalized_string_ = handle_->IsInternalizedString(); | 2667 is_internalized_string_ = handle_->IsInternalizedString(); |
| 2668 } | 2668 } |
| 2669 | 2669 |
| 2670 is_cell_ = !handle_.is_null() && | 2670 is_cell_ = !handle_.is_null() && |
| 2671 (handle_->IsCell() || handle_->IsPropertyCell()); | 2671 (handle_->IsCell() || handle_->IsPropertyCell()); |
| 2672 Initialize(r); | 2672 Initialize(r); |
| 2673 } | 2673 } |
| 2674 | 2674 |
| 2675 | 2675 |
| 2676 HConstant::HConstant(Handle<Object> handle, | 2676 HConstant::HConstant(Handle<Object> handle, |
| 2677 UniqueValueId unique_id, | 2677 UniqueValueId unique_id, |
| 2678 Representation r, | 2678 Representation r, |
| 2679 HType type, | 2679 HType type, |
| 2680 bool is_internalize_string, | 2680 bool is_internalize_string, |
| 2681 bool is_not_in_new_space, | 2681 bool is_not_in_new_space, |
| 2682 bool is_cell, | 2682 bool is_cell, |
| 2683 bool boolean_value) | 2683 bool boolean_value) |
| 2684 : handle_(handle), | 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 is_internalized_string_(is_internalize_string), |
| 2690 is_internalized_string_(is_internalize_string), | 2690 is_not_in_new_space_(is_not_in_new_space), |
| 2691 is_not_in_new_space_(is_not_in_new_space), | 2691 is_cell_(is_cell), |
| 2692 is_cell_(is_cell), | 2692 boolean_value_(boolean_value), |
| 2693 boolean_value_(boolean_value) { | 2693 type_from_value_(type) { |
| 2694 ASSERT(!handle.is_null()); | 2694 ASSERT(!handle.is_null()); |
| 2695 ASSERT(!type.IsUninitialized()); |
| 2695 ASSERT(!type.IsTaggedNumber()); | 2696 ASSERT(!type.IsTaggedNumber()); |
| 2696 set_type(type); | |
| 2697 Initialize(r); | 2697 Initialize(r); |
| 2698 } | 2698 } |
| 2699 | 2699 |
| 2700 | 2700 |
| 2701 HConstant::HConstant(int32_t integer_value, | 2701 HConstant::HConstant(int32_t integer_value, |
| 2702 Representation r, | 2702 Representation r, |
| 2703 bool is_not_in_new_space, | 2703 bool is_not_in_new_space, |
| 2704 Handle<Object> optional_handle) | 2704 Handle<Object> optional_handle) |
| 2705 : handle_(optional_handle), | 2705 : handle_(optional_handle), |
| 2706 unique_id_(), | 2706 unique_id_(), |
| 2707 has_smi_value_(Smi::IsValid(integer_value)), | 2707 has_int32_value_(true), |
| 2708 has_int32_value_(true), | 2708 has_double_value_(true), |
| 2709 has_double_value_(true), | 2709 is_internalized_string_(false), |
| 2710 has_external_reference_value_(false), | 2710 is_not_in_new_space_(is_not_in_new_space), |
| 2711 is_internalized_string_(false), | 2711 is_cell_(false), |
| 2712 is_not_in_new_space_(is_not_in_new_space), | 2712 boolean_value_(integer_value != 0), |
| 2713 is_cell_(false), | 2713 int32_value_(integer_value), |
| 2714 boolean_value_(integer_value != 0), | 2714 double_value_(FastI2D(integer_value)) { |
| 2715 int32_value_(integer_value), | 2715 has_smi_value_ = Smi::IsValid(int32_value_); |
| 2716 double_value_(FastI2D(integer_value)) { | |
| 2717 set_type(has_smi_value_ ? HType::Smi() : HType::TaggedNumber()); | |
| 2718 Initialize(r); | 2716 Initialize(r); |
| 2719 } | 2717 } |
| 2720 | 2718 |
| 2721 | 2719 |
| 2722 HConstant::HConstant(double double_value, | 2720 HConstant::HConstant(double double_value, |
| 2723 Representation r, | 2721 Representation r, |
| 2724 bool is_not_in_new_space, | 2722 bool is_not_in_new_space, |
| 2725 Handle<Object> optional_handle) | 2723 Handle<Object> optional_handle) |
| 2726 : handle_(optional_handle), | 2724 : handle_(optional_handle), |
| 2727 unique_id_(), | 2725 unique_id_(), |
| 2728 has_int32_value_(IsInteger32(double_value)), | 2726 has_int32_value_(IsInteger32(double_value)), |
| 2729 has_double_value_(true), | 2727 has_double_value_(true), |
| 2730 has_external_reference_value_(false), | 2728 is_internalized_string_(false), |
| 2731 is_internalized_string_(false), | 2729 is_not_in_new_space_(is_not_in_new_space), |
| 2732 is_not_in_new_space_(is_not_in_new_space), | 2730 is_cell_(false), |
| 2733 is_cell_(false), | 2731 boolean_value_(double_value != 0 && !std::isnan(double_value)), |
| 2734 boolean_value_(double_value != 0 && !std::isnan(double_value)), | 2732 int32_value_(DoubleToInt32(double_value)), |
| 2735 int32_value_(DoubleToInt32(double_value)), | 2733 double_value_(double_value) { |
| 2736 double_value_(double_value) { | |
| 2737 has_smi_value_ = has_int32_value_ && Smi::IsValid(int32_value_); | 2734 has_smi_value_ = has_int32_value_ && Smi::IsValid(int32_value_); |
| 2738 set_type(has_smi_value_ ? HType::Smi() : HType::TaggedNumber()); | |
| 2739 Initialize(r); | 2735 Initialize(r); |
| 2740 } | 2736 } |
| 2741 | 2737 |
| 2742 | 2738 |
| 2743 HConstant::HConstant(ExternalReference reference) | |
| 2744 : has_smi_value_(false), | |
| 2745 has_int32_value_(false), | |
| 2746 has_double_value_(false), | |
| 2747 has_external_reference_value_(true), | |
| 2748 is_internalized_string_(false), | |
| 2749 is_not_in_new_space_(true), | |
| 2750 is_cell_(false), | |
| 2751 boolean_value_(true), | |
| 2752 external_reference_value_(reference) { | |
| 2753 set_type(HType::None()); | |
| 2754 Initialize(Representation::External()); | |
| 2755 } | |
| 2756 | |
| 2757 | |
| 2758 void HConstant::Initialize(Representation r) { | 2739 void HConstant::Initialize(Representation r) { |
| 2759 if (r.IsNone()) { | 2740 if (r.IsNone()) { |
| 2760 if (has_smi_value_ && kSmiValueSize == 31) { | 2741 if (has_smi_value_ && kSmiValueSize == 31) { |
| 2761 r = Representation::Smi(); | 2742 r = Representation::Smi(); |
| 2762 } else if (has_int32_value_) { | 2743 } else if (has_int32_value_) { |
| 2763 r = Representation::Integer32(); | 2744 r = Representation::Integer32(); |
| 2764 } else if (has_double_value_) { | 2745 } else if (has_double_value_) { |
| 2765 r = Representation::Double(); | 2746 r = Representation::Double(); |
| 2766 } else if (has_external_reference_value_) { | |
| 2767 r = Representation::External(); | |
| 2768 } else { | 2747 } else { |
| 2769 r = Representation::Tagged(); | 2748 r = Representation::Tagged(); |
| 2770 } | 2749 } |
| 2771 } | 2750 } |
| 2772 set_representation(r); | 2751 set_representation(r); |
| 2773 SetFlag(kUseGVN); | 2752 SetFlag(kUseGVN); |
| 2774 } | 2753 } |
| 2775 | 2754 |
| 2776 | 2755 |
| 2777 bool HConstant::EmitAtUses() { | 2756 bool HConstant::EmitAtUses() { |
| 2778 ASSERT(IsLinked()); | 2757 ASSERT(IsLinked()); |
| 2779 if (block()->graph()->has_osr()) { | 2758 if (block()->graph()->has_osr()) { |
| 2780 return block()->graph()->IsStandardConstant(this); | 2759 return block()->graph()->IsStandardConstant(this); |
| 2781 } | 2760 } |
| 2782 if (IsCell()) return false; | 2761 if (IsCell()) return false; |
| 2783 if (representation().IsDouble()) return false; | 2762 if (representation().IsDouble()) return false; |
| 2784 return true; | 2763 return true; |
| 2785 } | 2764 } |
| 2786 | 2765 |
| 2787 | 2766 |
| 2788 HConstant* HConstant::CopyToRepresentation(Representation r, Zone* zone) const { | 2767 HConstant* HConstant::CopyToRepresentation(Representation r, Zone* zone) const { |
| 2789 if (r.IsSmi() && !has_smi_value_) return NULL; | 2768 if (r.IsSmi() && !has_smi_value_) return NULL; |
| 2790 if (r.IsInteger32() && !has_int32_value_) return NULL; | 2769 if (r.IsInteger32() && !has_int32_value_) return NULL; |
| 2791 if (r.IsDouble() && !has_double_value_) return NULL; | 2770 if (r.IsDouble() && !has_double_value_) return NULL; |
| 2792 if (r.IsExternal() && !has_external_reference_value_) return NULL; | |
| 2793 if (has_int32_value_) { | 2771 if (has_int32_value_) { |
| 2794 return new(zone) HConstant(int32_value_, r, is_not_in_new_space_, handle_); | 2772 return new(zone) HConstant(int32_value_, r, is_not_in_new_space_, handle_); |
| 2795 } | 2773 } |
| 2796 if (has_double_value_) { | 2774 if (has_double_value_) { |
| 2797 return new(zone) HConstant(double_value_, r, is_not_in_new_space_, handle_); | 2775 return new(zone) HConstant(double_value_, r, is_not_in_new_space_, handle_); |
| 2798 } | 2776 } |
| 2799 if (has_external_reference_value_) { | |
| 2800 return new(zone) HConstant(external_reference_value_); | |
| 2801 } | |
| 2802 ASSERT(!handle_.is_null()); | 2777 ASSERT(!handle_.is_null()); |
| 2803 return new(zone) HConstant(handle_, | 2778 return new(zone) HConstant(handle_, |
| 2804 unique_id_, | 2779 unique_id_, |
| 2805 r, | 2780 r, |
| 2806 type_, | 2781 type_from_value_, |
| 2807 is_internalized_string_, | 2782 is_internalized_string_, |
| 2808 is_not_in_new_space_, | 2783 is_not_in_new_space_, |
| 2809 is_cell_, | 2784 is_cell_, |
| 2810 boolean_value_); | 2785 boolean_value_); |
| 2811 } | 2786 } |
| 2812 | 2787 |
| 2813 | 2788 |
| 2814 Maybe<HConstant*> HConstant::CopyToTruncatedInt32(Zone* zone) { | 2789 Maybe<HConstant*> HConstant::CopyToTruncatedInt32(Zone* zone) { |
| 2815 HConstant* res = NULL; | 2790 HConstant* res = NULL; |
| 2816 if (has_int32_value_) { | 2791 if (has_int32_value_) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2844 } | 2819 } |
| 2845 return Maybe<HConstant*>(res != NULL, res); | 2820 return Maybe<HConstant*>(res != NULL, res); |
| 2846 } | 2821 } |
| 2847 | 2822 |
| 2848 | 2823 |
| 2849 void HConstant::PrintDataTo(StringStream* stream) { | 2824 void HConstant::PrintDataTo(StringStream* stream) { |
| 2850 if (has_int32_value_) { | 2825 if (has_int32_value_) { |
| 2851 stream->Add("%d ", int32_value_); | 2826 stream->Add("%d ", int32_value_); |
| 2852 } else if (has_double_value_) { | 2827 } else if (has_double_value_) { |
| 2853 stream->Add("%f ", FmtElm(double_value_)); | 2828 stream->Add("%f ", FmtElm(double_value_)); |
| 2854 } else if (has_external_reference_value_) { | |
| 2855 stream->Add("%p ", reinterpret_cast<void*>( | |
| 2856 external_reference_value_.address())); | |
| 2857 } else { | 2829 } else { |
| 2858 handle()->ShortPrint(stream); | 2830 handle()->ShortPrint(stream); |
| 2859 } | 2831 } |
| 2860 } | 2832 } |
| 2861 | 2833 |
| 2862 | 2834 |
| 2863 void HBinaryOperation::PrintDataTo(StringStream* stream) { | 2835 void HBinaryOperation::PrintDataTo(StringStream* stream) { |
| 2864 left()->PrintNameTo(stream); | 2836 left()->PrintNameTo(stream); |
| 2865 stream->Add(" "); | 2837 stream->Add(" "); |
| 2866 right()->PrintNameTo(stream); | 2838 right()->PrintNameTo(stream); |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3674 return HType::NonPrimitive(); | 3646 return HType::NonPrimitive(); |
| 3675 } | 3647 } |
| 3676 | 3648 |
| 3677 | 3649 |
| 3678 HType HCheckSmi::CalculateInferredType() { | 3650 HType HCheckSmi::CalculateInferredType() { |
| 3679 return HType::Smi(); | 3651 return HType::Smi(); |
| 3680 } | 3652 } |
| 3681 | 3653 |
| 3682 | 3654 |
| 3683 HType HPhi::CalculateInferredType() { | 3655 HType HPhi::CalculateInferredType() { |
| 3684 if (OperandCount() == 0) return HType::Tagged(); | 3656 HType result = HType::Uninitialized(); |
| 3685 HType result = OperandAt(0)->type(); | 3657 for (int i = 0; i < OperandCount(); ++i) { |
| 3686 for (int i = 1; i < OperandCount(); ++i) { | |
| 3687 HType current = OperandAt(i)->type(); | 3658 HType current = OperandAt(i)->type(); |
| 3688 result = result.Combine(current); | 3659 result = result.Combine(current); |
| 3689 } | 3660 } |
| 3690 return result; | 3661 return result; |
| 3691 } | 3662 } |
| 3692 | 3663 |
| 3693 | 3664 |
| 3665 HType HConstant::CalculateInferredType() { |
| 3666 if (has_int32_value_) { |
| 3667 return Smi::IsValid(int32_value_) ? HType::Smi() : HType::HeapNumber(); |
| 3668 } |
| 3669 if (has_double_value_) return HType::HeapNumber(); |
| 3670 ASSERT(!type_from_value_.IsUninitialized()); |
| 3671 return type_from_value_; |
| 3672 } |
| 3673 |
| 3674 |
| 3694 HType HCompareGeneric::CalculateInferredType() { | 3675 HType HCompareGeneric::CalculateInferredType() { |
| 3695 return HType::Boolean(); | 3676 return HType::Boolean(); |
| 3696 } | 3677 } |
| 3697 | 3678 |
| 3698 | 3679 |
| 3699 HType HInstanceOf::CalculateInferredType() { | 3680 HType HInstanceOf::CalculateInferredType() { |
| 3700 return HType::Boolean(); | 3681 return HType::Boolean(); |
| 3701 } | 3682 } |
| 3702 | 3683 |
| 3703 | 3684 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3740 Representation HUnaryMathOperation::RepresentationFromInputs() { | 3721 Representation HUnaryMathOperation::RepresentationFromInputs() { |
| 3741 Representation rep = representation(); | 3722 Representation rep = representation(); |
| 3742 // If any of the actual input representation is more general than what we | 3723 // If any of the actual input representation is more general than what we |
| 3743 // have so far but not Tagged, use that representation instead. | 3724 // have so far but not Tagged, use that representation instead. |
| 3744 Representation input_rep = value()->representation(); | 3725 Representation input_rep = value()->representation(); |
| 3745 if (!input_rep.IsTagged()) rep = rep.generalize(input_rep); | 3726 if (!input_rep.IsTagged()) rep = rep.generalize(input_rep); |
| 3746 return rep; | 3727 return rep; |
| 3747 } | 3728 } |
| 3748 | 3729 |
| 3749 | 3730 |
| 3731 HType HStringCharFromCode::CalculateInferredType() { |
| 3732 return HType::String(); |
| 3733 } |
| 3734 |
| 3735 |
| 3750 void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, | 3736 void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, |
| 3751 HValue* dominator) { | 3737 HValue* dominator) { |
| 3752 ASSERT(side_effect == kChangesNewSpacePromotion); | 3738 ASSERT(side_effect == kChangesNewSpacePromotion); |
| 3753 if (!FLAG_use_allocation_folding) return; | 3739 if (!FLAG_use_allocation_folding) return; |
| 3754 | 3740 |
| 3755 // Try to fold allocations together with their dominating allocations. | 3741 // Try to fold allocations together with their dominating allocations. |
| 3756 if (!dominator->IsAllocate()) { | 3742 if (!dominator->IsAllocate()) { |
| 3757 if (FLAG_trace_allocation_folding) { | 3743 if (FLAG_trace_allocation_folding) { |
| 3758 PrintF("#%d (%s) cannot fold into #%d (%s)\n", | 3744 PrintF("#%d (%s) cannot fold into #%d (%s)\n", |
| 3759 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); | 3745 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4368 } | 4354 } |
| 4369 return rep; | 4355 return rep; |
| 4370 } | 4356 } |
| 4371 | 4357 |
| 4372 | 4358 |
| 4373 bool HValue::HasNonSmiUse() { | 4359 bool HValue::HasNonSmiUse() { |
| 4374 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { | 4360 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { |
| 4375 // We check for observed_input_representation elsewhere. | 4361 // We check for observed_input_representation elsewhere. |
| 4376 Representation use_rep = | 4362 Representation use_rep = |
| 4377 it.value()->RequiredInputRepresentation(it.index()); | 4363 it.value()->RequiredInputRepresentation(it.index()); |
| 4378 if (!use_rep.IsNone() && | 4364 if (!use_rep.IsNone() && !use_rep.IsSmi()) return true; |
| 4379 !use_rep.IsSmi() && | |
| 4380 !use_rep.IsTagged()) { | |
| 4381 return true; | |
| 4382 } | |
| 4383 } | 4365 } |
| 4384 return false; | 4366 return false; |
| 4385 } | 4367 } |
| 4386 | 4368 |
| 4387 | 4369 |
| 4388 // Node-specific verification code is only included in debug mode. | 4370 // Node-specific verification code is only included in debug mode. |
| 4389 #ifdef DEBUG | 4371 #ifdef DEBUG |
| 4390 | 4372 |
| 4391 void HPhi::Verify() { | 4373 void HPhi::Verify() { |
| 4392 ASSERT(OperandCount() == block()->predecessors()->length()); | 4374 ASSERT(OperandCount() == block()->predecessors()->length()); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4531 ? kChangesBackingStoreFields : kDependsOnBackingStoreFields); | 4513 ? kChangesBackingStoreFields : kDependsOnBackingStoreFields); |
| 4532 break; | 4514 break; |
| 4533 case kElementsPointer: | 4515 case kElementsPointer: |
| 4534 instr->SetGVNFlag(is_store | 4516 instr->SetGVNFlag(is_store |
| 4535 ? kChangesElementsPointer : kDependsOnElementsPointer); | 4517 ? kChangesElementsPointer : kDependsOnElementsPointer); |
| 4536 break; | 4518 break; |
| 4537 case kMaps: | 4519 case kMaps: |
| 4538 instr->SetGVNFlag(is_store | 4520 instr->SetGVNFlag(is_store |
| 4539 ? kChangesMaps : kDependsOnMaps); | 4521 ? kChangesMaps : kDependsOnMaps); |
| 4540 break; | 4522 break; |
| 4541 case kExternalMemory: | |
| 4542 instr->SetGVNFlag(is_store | |
| 4543 ? kChangesExternalMemory : kDependsOnExternalMemory); | |
| 4544 break; | |
| 4545 } | 4523 } |
| 4546 } | 4524 } |
| 4547 | 4525 |
| 4548 | 4526 |
| 4549 void HObjectAccess::PrintTo(StringStream* stream) { | 4527 void HObjectAccess::PrintTo(StringStream* stream) { |
| 4550 stream->Add("."); | 4528 stream->Add("."); |
| 4551 | 4529 |
| 4552 switch (portion()) { | 4530 switch (portion()) { |
| 4553 case kArrayLengths: | 4531 case kArrayLengths: |
| 4554 stream->Add("%length"); | 4532 stream->Add("%length"); |
| 4555 break; | 4533 break; |
| 4556 case kElementsPointer: | 4534 case kElementsPointer: |
| 4557 stream->Add("%elements"); | 4535 stream->Add("%elements"); |
| 4558 break; | 4536 break; |
| 4559 case kMaps: | 4537 case kMaps: |
| 4560 stream->Add("%map"); | 4538 stream->Add("%map"); |
| 4561 break; | 4539 break; |
| 4562 case kDouble: // fall through | 4540 case kDouble: // fall through |
| 4563 case kInobject: | 4541 case kInobject: |
| 4564 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 4542 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
| 4565 stream->Add("[in-object]"); | 4543 stream->Add("[in-object]"); |
| 4566 break; | 4544 break; |
| 4567 case kBackingStore: | 4545 case kBackingStore: |
| 4568 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 4546 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
| 4569 stream->Add("[backing-store]"); | 4547 stream->Add("[backing-store]"); |
| 4570 break; | 4548 break; |
| 4571 case kExternalMemory: | |
| 4572 stream->Add("[external-memory]"); | |
| 4573 break; | |
| 4574 } | 4549 } |
| 4575 | 4550 |
| 4576 stream->Add("@%d", offset()); | 4551 stream->Add("@%d", offset()); |
| 4577 } | 4552 } |
| 4578 | 4553 |
| 4579 } } // namespace v8::internal | 4554 } } // namespace v8::internal |
| OLD | NEW |