Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/type-feedback-vector.h" | 5 #include "src/type-feedback-vector.h" |
| 6 | 6 |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/ic/ic.h" | 8 #include "src/ic/ic.h" |
| 9 #include "src/ic/ic-state.h" | 9 #include "src/ic/ic-state.h" |
| 10 #include "src/objects.h" | 10 #include "src/objects.h" |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 Handle<Object> feedback_extra = handle(GetFeedbackExtra(), isolate); | 428 Handle<Object> feedback_extra = handle(GetFeedbackExtra(), isolate); |
| 429 if (!feedback_extra->IsFixedArray() || | 429 if (!feedback_extra->IsFixedArray() || |
| 430 FixedArray::cast(*feedback_extra)->length() != length) { | 430 FixedArray::cast(*feedback_extra)->length() != length) { |
| 431 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length); | 431 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length); |
| 432 SetFeedbackExtra(*array); | 432 SetFeedbackExtra(*array); |
| 433 return array; | 433 return array; |
| 434 } | 434 } |
| 435 return Handle<FixedArray>::cast(feedback_extra); | 435 return Handle<FixedArray>::cast(feedback_extra); |
| 436 } | 436 } |
| 437 | 437 |
| 438 | |
| 439 void FeedbackNexus::InstallHandlers(Handle<FixedArray> array, | 438 void FeedbackNexus::InstallHandlers(Handle<FixedArray> array, |
| 440 MapHandleList* maps, | 439 MapHandleList* maps, |
| 441 CodeHandleList* handlers) { | 440 List<Handle<Object>>* handlers) { |
| 442 int receiver_count = maps->length(); | 441 int receiver_count = maps->length(); |
| 443 for (int current = 0; current < receiver_count; ++current) { | 442 for (int current = 0; current < receiver_count; ++current) { |
| 444 Handle<Map> map = maps->at(current); | 443 Handle<Map> map = maps->at(current); |
| 445 Handle<WeakCell> cell = Map::WeakCellForMap(map); | 444 Handle<WeakCell> cell = Map::WeakCellForMap(map); |
| 446 array->set(current * 2, *cell); | 445 array->set(current * 2, *cell); |
| 447 array->set(current * 2 + 1, *handlers->at(current)); | 446 array->set(current * 2 + 1, *handlers->at(current)); |
| 448 } | 447 } |
| 449 } | 448 } |
| 450 | 449 |
| 451 | 450 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 657 FeedbackNexus::ConfigureMegamorphic(); | 656 FeedbackNexus::ConfigureMegamorphic(); |
| 658 } | 657 } |
| 659 | 658 |
| 660 | 659 |
| 661 void CallICNexus::ConfigureMegamorphic(int call_count) { | 660 void CallICNexus::ConfigureMegamorphic(int call_count) { |
| 662 SetFeedback(*TypeFeedbackVector::MegamorphicSentinel(GetIsolate()), | 661 SetFeedback(*TypeFeedbackVector::MegamorphicSentinel(GetIsolate()), |
| 663 SKIP_WRITE_BARRIER); | 662 SKIP_WRITE_BARRIER); |
| 664 SetFeedbackExtra(Smi::FromInt(call_count), SKIP_WRITE_BARRIER); | 663 SetFeedbackExtra(Smi::FromInt(call_count), SKIP_WRITE_BARRIER); |
| 665 } | 664 } |
| 666 | 665 |
| 667 | |
| 668 void LoadICNexus::ConfigureMonomorphic(Handle<Map> receiver_map, | 666 void LoadICNexus::ConfigureMonomorphic(Handle<Map> receiver_map, |
| 669 Handle<Code> handler) { | 667 Handle<Object> handler) { |
| 670 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); | 668 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); |
| 671 SetFeedback(*cell); | 669 SetFeedback(*cell); |
| 672 SetFeedbackExtra(*handler); | 670 SetFeedbackExtra(*handler); |
| 673 } | 671 } |
| 674 | 672 |
| 675 void LoadGlobalICNexus::ConfigureUninitialized() { | 673 void LoadGlobalICNexus::ConfigureUninitialized() { |
| 676 Isolate* isolate = GetIsolate(); | 674 Isolate* isolate = GetIsolate(); |
| 677 SetFeedback(isolate->heap()->empty_weak_cell(), SKIP_WRITE_BARRIER); | 675 SetFeedback(isolate->heap()->empty_weak_cell(), SKIP_WRITE_BARRIER); |
| 678 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(isolate), | 676 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(isolate), |
| 679 SKIP_WRITE_BARRIER); | 677 SKIP_WRITE_BARRIER); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 723 SetFeedback(*cell); | 721 SetFeedback(*cell); |
| 724 SetFeedbackExtra(*handler); | 722 SetFeedbackExtra(*handler); |
| 725 } else { | 723 } else { |
| 726 Handle<FixedArray> array = EnsureExtraArrayOfSize(2); | 724 Handle<FixedArray> array = EnsureExtraArrayOfSize(2); |
| 727 SetFeedback(*name); | 725 SetFeedback(*name); |
| 728 array->set(0, *cell); | 726 array->set(0, *cell); |
| 729 array->set(1, *handler); | 727 array->set(1, *handler); |
| 730 } | 728 } |
| 731 } | 729 } |
| 732 | 730 |
| 733 | |
| 734 void LoadICNexus::ConfigurePolymorphic(MapHandleList* maps, | 731 void LoadICNexus::ConfigurePolymorphic(MapHandleList* maps, |
| 735 CodeHandleList* handlers) { | 732 List<Handle<Object>>* handlers) { |
| 736 Isolate* isolate = GetIsolate(); | 733 Isolate* isolate = GetIsolate(); |
| 737 int receiver_count = maps->length(); | 734 int receiver_count = maps->length(); |
| 738 Handle<FixedArray> array = EnsureArrayOfSize(receiver_count * 2); | 735 Handle<FixedArray> array = EnsureArrayOfSize(receiver_count * 2); |
| 739 InstallHandlers(array, maps, handlers); | 736 InstallHandlers(array, maps, handlers); |
| 740 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(isolate), | 737 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(isolate), |
| 741 SKIP_WRITE_BARRIER); | 738 SKIP_WRITE_BARRIER); |
| 742 } | 739 } |
| 743 | 740 |
| 744 void KeyedLoadICNexus::ConfigurePolymorphic(Handle<Name> name, | 741 void KeyedLoadICNexus::ConfigurePolymorphic(Handle<Name> name, |
| 745 MapHandleList* maps, | 742 MapHandleList* maps, |
| 746 CodeHandleList* handlers) { | 743 List<Handle<Object>>* handlers) { |
| 747 int receiver_count = maps->length(); | 744 int receiver_count = maps->length(); |
| 748 DCHECK(receiver_count > 1); | 745 DCHECK(receiver_count > 1); |
| 749 Handle<FixedArray> array; | 746 Handle<FixedArray> array; |
| 750 if (name.is_null()) { | 747 if (name.is_null()) { |
| 751 array = EnsureArrayOfSize(receiver_count * 2); | 748 array = EnsureArrayOfSize(receiver_count * 2); |
| 752 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(GetIsolate()), | 749 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(GetIsolate()), |
| 753 SKIP_WRITE_BARRIER); | 750 SKIP_WRITE_BARRIER); |
| 754 } else { | 751 } else { |
| 755 array = EnsureExtraArrayOfSize(receiver_count * 2); | 752 array = EnsureExtraArrayOfSize(receiver_count * 2); |
| 756 SetFeedback(*name); | 753 SetFeedback(*name); |
| 757 } | 754 } |
| 758 | 755 |
| 759 InstallHandlers(array, maps, handlers); | 756 InstallHandlers(array, maps, handlers); |
| 760 } | 757 } |
| 761 | 758 |
| 762 | |
| 763 void StoreICNexus::ConfigurePolymorphic(MapHandleList* maps, | 759 void StoreICNexus::ConfigurePolymorphic(MapHandleList* maps, |
| 764 CodeHandleList* handlers) { | 760 List<Handle<Object>>* handlers) { |
| 765 Isolate* isolate = GetIsolate(); | 761 Isolate* isolate = GetIsolate(); |
| 766 int receiver_count = maps->length(); | 762 int receiver_count = maps->length(); |
| 767 Handle<FixedArray> array = EnsureArrayOfSize(receiver_count * 2); | 763 Handle<FixedArray> array = EnsureArrayOfSize(receiver_count * 2); |
| 768 InstallHandlers(array, maps, handlers); | 764 InstallHandlers(array, maps, handlers); |
| 769 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(isolate), | 765 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(isolate), |
| 770 SKIP_WRITE_BARRIER); | 766 SKIP_WRITE_BARRIER); |
| 771 } | 767 } |
| 772 | 768 |
| 773 | |
| 774 void KeyedStoreICNexus::ConfigurePolymorphic(Handle<Name> name, | 769 void KeyedStoreICNexus::ConfigurePolymorphic(Handle<Name> name, |
| 775 MapHandleList* maps, | 770 MapHandleList* maps, |
| 776 CodeHandleList* handlers) { | 771 List<Handle<Object>>* handlers) { |
| 777 int receiver_count = maps->length(); | 772 int receiver_count = maps->length(); |
| 778 DCHECK(receiver_count > 1); | 773 DCHECK(receiver_count > 1); |
| 779 Handle<FixedArray> array; | 774 Handle<FixedArray> array; |
| 780 if (name.is_null()) { | 775 if (name.is_null()) { |
| 781 array = EnsureArrayOfSize(receiver_count * 2); | 776 array = EnsureArrayOfSize(receiver_count * 2); |
| 782 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(GetIsolate()), | 777 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(GetIsolate()), |
| 783 SKIP_WRITE_BARRIER); | 778 SKIP_WRITE_BARRIER); |
| 784 } else { | 779 } else { |
| 785 array = EnsureExtraArrayOfSize(receiver_count * 2); | 780 array = EnsureExtraArrayOfSize(receiver_count * 2); |
| 786 SetFeedback(*name); | 781 SetFeedback(*name); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 808 Handle<Map> transitioned_map = transitioned_maps->at(i); | 803 Handle<Map> transitioned_map = transitioned_maps->at(i); |
| 809 cell = Map::WeakCellForMap(transitioned_map); | 804 cell = Map::WeakCellForMap(transitioned_map); |
| 810 array->set((i * 3) + 1, *cell); | 805 array->set((i * 3) + 1, *cell); |
| 811 } else { | 806 } else { |
| 812 array->set((i * 3) + 1, *undefined_value); | 807 array->set((i * 3) + 1, *undefined_value); |
| 813 } | 808 } |
| 814 array->set((i * 3) + 2, *handlers->at(i)); | 809 array->set((i * 3) + 2, *handlers->at(i)); |
| 815 } | 810 } |
| 816 } | 811 } |
| 817 | 812 |
| 813 namespace { | |
| 814 | |
| 815 int GetStepSize(FixedArray* array, Isolate* isolate) { | |
| 816 // The array should be of the form | |
| 817 // [map, handler, map, handler, ...] | |
| 818 // or | |
| 819 // [map, map, handler, map, map, handler, ...] | |
| 820 // where "map" is either a WeakCell or |undefined|, | |
| 821 // and "handler" is either a Code object or a Smi. | |
| 822 DCHECK(array->length() >= 2); | |
| 823 Object* second = array->get(1); | |
| 824 if (second->IsWeakCell() || second->IsUndefined(isolate)) return 3; | |
| 825 DCHECK(second->IsCode() || second->IsSmi()); | |
| 826 return 2; | |
| 827 } | |
| 828 | |
| 829 #ifdef DEBUG // Only used by DCHECKs below. | |
| 830 bool IsHandler(Object* object) { | |
| 831 return object->IsSmi() || | |
| 832 (object->IsCode() && Code::cast(object)->kind() == Code::HANDLER); | |
|
Igor Sheludko
2016/07/15 10:44:18
... && Code::cast(object)->is_handler());
Jakob Kummerow
2016/07/15 14:16:42
Done.
| |
| 833 #endif | |
| 834 } | |
| 835 | |
| 836 } // namespace | |
| 818 | 837 |
| 819 int FeedbackNexus::ExtractMaps(MapHandleList* maps) const { | 838 int FeedbackNexus::ExtractMaps(MapHandleList* maps) const { |
| 820 Isolate* isolate = GetIsolate(); | 839 Isolate* isolate = GetIsolate(); |
| 821 Object* feedback = GetFeedback(); | 840 Object* feedback = GetFeedback(); |
| 822 bool is_named_feedback = IsPropertyNameFeedback(feedback); | 841 bool is_named_feedback = IsPropertyNameFeedback(feedback); |
| 823 if (feedback->IsFixedArray() || is_named_feedback) { | 842 if (feedback->IsFixedArray() || is_named_feedback) { |
| 824 int found = 0; | 843 int found = 0; |
| 825 if (is_named_feedback) { | 844 if (is_named_feedback) { |
| 826 feedback = GetFeedbackExtra(); | 845 feedback = GetFeedbackExtra(); |
| 827 } | 846 } |
| 828 FixedArray* array = FixedArray::cast(feedback); | 847 FixedArray* array = FixedArray::cast(feedback); |
| 829 // The array should be of the form | 848 int increment = GetStepSize(array, isolate); |
| 830 // [map, handler, map, handler, ...] | |
| 831 // or | |
| 832 // [map, map, handler, map, map, handler, ...] | |
| 833 DCHECK(array->length() >= 2); | |
| 834 int increment = array->get(1)->IsCode() ? 2 : 3; | |
| 835 for (int i = 0; i < array->length(); i += increment) { | 849 for (int i = 0; i < array->length(); i += increment) { |
| 836 DCHECK(array->get(i)->IsWeakCell()); | 850 DCHECK(array->get(i)->IsWeakCell()); |
| 837 WeakCell* cell = WeakCell::cast(array->get(i)); | 851 WeakCell* cell = WeakCell::cast(array->get(i)); |
| 838 if (!cell->cleared()) { | 852 if (!cell->cleared()) { |
| 839 Map* map = Map::cast(cell->value()); | 853 Map* map = Map::cast(cell->value()); |
| 840 maps->Add(handle(map, isolate)); | 854 maps->Add(handle(map, isolate)); |
| 841 found++; | 855 found++; |
| 842 } | 856 } |
| 843 } | 857 } |
| 844 return found; | 858 return found; |
| 845 } else if (feedback->IsWeakCell()) { | 859 } else if (feedback->IsWeakCell()) { |
| 846 WeakCell* cell = WeakCell::cast(feedback); | 860 WeakCell* cell = WeakCell::cast(feedback); |
| 847 if (!cell->cleared()) { | 861 if (!cell->cleared()) { |
| 848 Map* map = Map::cast(cell->value()); | 862 Map* map = Map::cast(cell->value()); |
| 849 maps->Add(handle(map, isolate)); | 863 maps->Add(handle(map, isolate)); |
| 850 return 1; | 864 return 1; |
| 851 } | 865 } |
| 852 } | 866 } |
| 853 | 867 |
| 854 return 0; | 868 return 0; |
| 855 } | 869 } |
| 856 | 870 |
| 857 | 871 MaybeHandle<Object> FeedbackNexus::FindHandlerForMap(Handle<Map> map) const { |
| 858 MaybeHandle<Code> FeedbackNexus::FindHandlerForMap(Handle<Map> map) const { | |
| 859 Object* feedback = GetFeedback(); | 872 Object* feedback = GetFeedback(); |
| 873 Isolate* isolate = GetIsolate(); | |
| 860 bool is_named_feedback = IsPropertyNameFeedback(feedback); | 874 bool is_named_feedback = IsPropertyNameFeedback(feedback); |
| 861 if (feedback->IsFixedArray() || is_named_feedback) { | 875 if (feedback->IsFixedArray() || is_named_feedback) { |
| 862 if (is_named_feedback) { | 876 if (is_named_feedback) { |
| 863 feedback = GetFeedbackExtra(); | 877 feedback = GetFeedbackExtra(); |
| 864 } | 878 } |
| 865 FixedArray* array = FixedArray::cast(feedback); | 879 FixedArray* array = FixedArray::cast(feedback); |
| 866 DCHECK(array->length() >= 2); | 880 int increment = GetStepSize(array, isolate); |
| 867 int increment = array->get(1)->IsCode() ? 2 : 3; | |
| 868 for (int i = 0; i < array->length(); i += increment) { | 881 for (int i = 0; i < array->length(); i += increment) { |
| 869 DCHECK(array->get(i)->IsWeakCell()); | 882 DCHECK(array->get(i)->IsWeakCell()); |
| 870 WeakCell* cell = WeakCell::cast(array->get(i)); | 883 WeakCell* cell = WeakCell::cast(array->get(i)); |
| 871 if (!cell->cleared()) { | 884 if (!cell->cleared()) { |
| 872 Map* array_map = Map::cast(cell->value()); | 885 Map* array_map = Map::cast(cell->value()); |
| 873 if (array_map == *map) { | 886 if (array_map == *map) { |
| 874 Code* code = Code::cast(array->get(i + increment - 1)); | 887 Object* code = array->get(i + increment - 1); |
| 875 DCHECK(code->kind() == Code::HANDLER); | 888 DCHECK(IsHandler(code)); |
| 876 return handle(code); | 889 return handle(code, isolate); |
| 877 } | 890 } |
| 878 } | 891 } |
| 879 } | 892 } |
| 880 } else if (feedback->IsWeakCell()) { | 893 } else if (feedback->IsWeakCell()) { |
| 881 WeakCell* cell = WeakCell::cast(feedback); | 894 WeakCell* cell = WeakCell::cast(feedback); |
| 882 if (!cell->cleared()) { | 895 if (!cell->cleared()) { |
| 883 Map* cell_map = Map::cast(cell->value()); | 896 Map* cell_map = Map::cast(cell->value()); |
| 884 if (cell_map == *map) { | 897 if (cell_map == *map) { |
| 885 Code* code = Code::cast(GetFeedbackExtra()); | 898 Object* code = GetFeedbackExtra(); |
| 886 DCHECK(code->kind() == Code::HANDLER); | 899 DCHECK(IsHandler(code)); |
| 887 return handle(code); | 900 return handle(code, isolate); |
| 888 } | 901 } |
| 889 } | 902 } |
| 890 } | 903 } |
| 891 | 904 |
| 892 return MaybeHandle<Code>(); | 905 return MaybeHandle<Code>(); |
| 893 } | 906 } |
| 894 | 907 |
| 895 | 908 bool FeedbackNexus::FindHandlers(List<Handle<Object>>* code_list, |
| 896 bool FeedbackNexus::FindHandlers(CodeHandleList* code_list, int length) const { | 909 int length) const { |
| 897 Object* feedback = GetFeedback(); | 910 Object* feedback = GetFeedback(); |
| 911 Isolate* isolate = GetIsolate(); | |
| 898 int count = 0; | 912 int count = 0; |
| 899 bool is_named_feedback = IsPropertyNameFeedback(feedback); | 913 bool is_named_feedback = IsPropertyNameFeedback(feedback); |
| 900 if (feedback->IsFixedArray() || is_named_feedback) { | 914 if (feedback->IsFixedArray() || is_named_feedback) { |
| 901 if (is_named_feedback) { | 915 if (is_named_feedback) { |
| 902 feedback = GetFeedbackExtra(); | 916 feedback = GetFeedbackExtra(); |
| 903 } | 917 } |
| 904 FixedArray* array = FixedArray::cast(feedback); | 918 FixedArray* array = FixedArray::cast(feedback); |
| 905 // The array should be of the form | 919 int increment = GetStepSize(array, isolate); |
| 906 // [map, handler, map, handler, ...] | |
| 907 // or | |
| 908 // [map, map, handler, map, map, handler, ...] | |
| 909 // Be sure to skip handlers whose maps have been cleared. | |
| 910 DCHECK(array->length() >= 2); | |
| 911 int increment = array->get(1)->IsCode() ? 2 : 3; | |
| 912 for (int i = 0; i < array->length(); i += increment) { | 920 for (int i = 0; i < array->length(); i += increment) { |
| 913 DCHECK(array->get(i)->IsWeakCell()); | 921 DCHECK(array->get(i)->IsWeakCell()); |
| 914 WeakCell* cell = WeakCell::cast(array->get(i)); | 922 WeakCell* cell = WeakCell::cast(array->get(i)); |
| 923 // Be sure to skip handlers whose maps have been cleared. | |
| 915 if (!cell->cleared()) { | 924 if (!cell->cleared()) { |
| 916 Code* code = Code::cast(array->get(i + increment - 1)); | 925 Object* code = array->get(i + increment - 1); |
| 917 DCHECK(code->kind() == Code::HANDLER); | 926 DCHECK(IsHandler(code)); |
| 918 code_list->Add(handle(code)); | 927 code_list->Add(handle(code, isolate)); |
| 919 count++; | 928 count++; |
| 920 } | 929 } |
| 921 } | 930 } |
| 922 } else if (feedback->IsWeakCell()) { | 931 } else if (feedback->IsWeakCell()) { |
| 923 WeakCell* cell = WeakCell::cast(feedback); | 932 WeakCell* cell = WeakCell::cast(feedback); |
| 924 if (!cell->cleared()) { | 933 if (!cell->cleared()) { |
| 925 Code* code = Code::cast(GetFeedbackExtra()); | 934 Object* code = GetFeedbackExtra(); |
| 926 DCHECK(code->kind() == Code::HANDLER); | 935 DCHECK(IsHandler(code)); |
| 927 code_list->Add(handle(code)); | 936 code_list->Add(handle(code, isolate)); |
| 928 count++; | 937 count++; |
| 929 } | 938 } |
| 930 } | 939 } |
| 931 return count == length; | 940 return count == length; |
| 932 } | 941 } |
| 933 | 942 |
| 934 | 943 |
| 935 void LoadICNexus::Clear(Code* host) { LoadIC::Clear(GetIsolate(), host, this); } | 944 void LoadICNexus::Clear(Code* host) { LoadIC::Clear(GetIsolate(), host, this); } |
| 936 | 945 |
| 937 void LoadGlobalICNexus::Clear(Code* host) { | 946 void LoadGlobalICNexus::Clear(Code* host) { |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 967 | 976 |
| 968 | 977 |
| 969 void KeyedStoreICNexus::Clear(Code* host) { | 978 void KeyedStoreICNexus::Clear(Code* host) { |
| 970 KeyedStoreIC::Clear(GetIsolate(), host, this); | 979 KeyedStoreIC::Clear(GetIsolate(), host, this); |
| 971 } | 980 } |
| 972 | 981 |
| 973 | 982 |
| 974 KeyedAccessStoreMode KeyedStoreICNexus::GetKeyedAccessStoreMode() const { | 983 KeyedAccessStoreMode KeyedStoreICNexus::GetKeyedAccessStoreMode() const { |
| 975 KeyedAccessStoreMode mode = STANDARD_STORE; | 984 KeyedAccessStoreMode mode = STANDARD_STORE; |
| 976 MapHandleList maps; | 985 MapHandleList maps; |
| 977 CodeHandleList handlers; | 986 List<Handle<Object>> handlers; |
| 978 | 987 |
| 979 if (GetKeyType() == PROPERTY) return mode; | 988 if (GetKeyType() == PROPERTY) return mode; |
| 980 | 989 |
| 981 ExtractMaps(&maps); | 990 ExtractMaps(&maps); |
| 982 FindHandlers(&handlers, maps.length()); | 991 FindHandlers(&handlers, maps.length()); |
| 983 for (int i = 0; i < handlers.length(); i++) { | 992 for (int i = 0; i < handlers.length(); i++) { |
| 984 // The first handler that isn't the slow handler will have the bits we need. | 993 // The first handler that isn't the slow handler will have the bits we need. |
| 985 Handle<Code> handler = handlers.at(i); | 994 Handle<Code> handler = Handle<Code>::cast(handlers.at(i)); |
| 986 CodeStub::Major major_key = CodeStub::MajorKeyFromKey(handler->stub_key()); | 995 CodeStub::Major major_key = CodeStub::MajorKeyFromKey(handler->stub_key()); |
| 987 uint32_t minor_key = CodeStub::MinorKeyFromKey(handler->stub_key()); | 996 uint32_t minor_key = CodeStub::MinorKeyFromKey(handler->stub_key()); |
| 988 CHECK(major_key == CodeStub::KeyedStoreSloppyArguments || | 997 CHECK(major_key == CodeStub::KeyedStoreSloppyArguments || |
| 989 major_key == CodeStub::StoreFastElement || | 998 major_key == CodeStub::StoreFastElement || |
| 990 major_key == CodeStub::StoreElement || | 999 major_key == CodeStub::StoreElement || |
| 991 major_key == CodeStub::ElementsTransitionAndStore || | 1000 major_key == CodeStub::ElementsTransitionAndStore || |
| 992 major_key == CodeStub::NoCache); | 1001 major_key == CodeStub::NoCache); |
| 993 if (major_key != CodeStub::NoCache) { | 1002 if (major_key != CodeStub::NoCache) { |
| 994 mode = CommonStoreModeBits::decode(minor_key); | 1003 mode = CommonStoreModeBits::decode(minor_key); |
| 995 break; | 1004 break; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1009 | 1018 |
| 1010 IcCheckType KeyedStoreICNexus::GetKeyType() const { | 1019 IcCheckType KeyedStoreICNexus::GetKeyType() const { |
| 1011 Object* feedback = GetFeedback(); | 1020 Object* feedback = GetFeedback(); |
| 1012 if (feedback == *TypeFeedbackVector::MegamorphicSentinel(GetIsolate())) { | 1021 if (feedback == *TypeFeedbackVector::MegamorphicSentinel(GetIsolate())) { |
| 1013 return static_cast<IcCheckType>(Smi::cast(GetFeedbackExtra())->value()); | 1022 return static_cast<IcCheckType>(Smi::cast(GetFeedbackExtra())->value()); |
| 1014 } | 1023 } |
| 1015 return IsPropertyNameFeedback(feedback) ? PROPERTY : ELEMENT; | 1024 return IsPropertyNameFeedback(feedback) ? PROPERTY : ELEMENT; |
| 1016 } | 1025 } |
| 1017 } // namespace internal | 1026 } // namespace internal |
| 1018 } // namespace v8 | 1027 } // namespace v8 |
| OLD | NEW |