| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/ic/accessor-assembler.h" | 5 #include "src/ic/accessor-assembler.h" |
| 6 #include "src/ic/accessor-assembler-impl.h" | 6 #include "src/ic/accessor-assembler-impl.h" |
| 7 | 7 |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/ic/handler-configuration.h" | 10 #include "src/ic/handler-configuration.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 GotoUnless( | 190 GotoUnless( |
| 191 WordEqual(handler_kind, IntPtrConstant(LoadHandler::kForElements)), | 191 WordEqual(handler_kind, IntPtrConstant(LoadHandler::kForElements)), |
| 192 &property); | 192 &property); |
| 193 | 193 |
| 194 Comment("element_load"); | 194 Comment("element_load"); |
| 195 Node* intptr_index = TryToIntptr(p->name, miss); | 195 Node* intptr_index = TryToIntptr(p->name, miss); |
| 196 Node* elements = LoadElements(holder); | 196 Node* elements = LoadElements(holder); |
| 197 Node* is_jsarray_condition = | 197 Node* is_jsarray_condition = |
| 198 IsSetWord<LoadHandler::IsJsArrayBits>(handler_word); | 198 IsSetWord<LoadHandler::IsJsArrayBits>(handler_word); |
| 199 Node* elements_kind = | 199 Node* elements_kind = |
| 200 DecodeWord<LoadHandler::ElementsKindBits>(handler_word); | 200 DecodeWord32FromWord<LoadHandler::ElementsKindBits>(handler_word); |
| 201 Label if_hole(this), unimplemented_elements_kind(this); | 201 Label if_hole(this), unimplemented_elements_kind(this); |
| 202 Label* out_of_bounds = miss; | 202 Label* out_of_bounds = miss; |
| 203 EmitElementLoad(holder, elements, elements_kind, intptr_index, | 203 EmitElementLoad(holder, elements, elements_kind, intptr_index, |
| 204 is_jsarray_condition, &if_hole, &rebox_double, | 204 is_jsarray_condition, &if_hole, &rebox_double, |
| 205 &var_double_value, &unimplemented_elements_kind, | 205 &var_double_value, &unimplemented_elements_kind, |
| 206 out_of_bounds, miss); | 206 out_of_bounds, miss); |
| 207 | 207 |
| 208 Bind(&unimplemented_elements_kind); | 208 Bind(&unimplemented_elements_kind); |
| 209 { | 209 { |
| 210 // Smi handlers should only be installed for supported elements kinds. | 210 // Smi handlers should only be installed for supported elements kinds. |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 | 775 |
| 776 void AccessorAssemblerImpl::EmitElementLoad( | 776 void AccessorAssemblerImpl::EmitElementLoad( |
| 777 Node* object, Node* elements, Node* elements_kind, Node* intptr_index, | 777 Node* object, Node* elements, Node* elements_kind, Node* intptr_index, |
| 778 Node* is_jsarray_condition, Label* if_hole, Label* rebox_double, | 778 Node* is_jsarray_condition, Label* if_hole, Label* rebox_double, |
| 779 Variable* var_double_value, Label* unimplemented_elements_kind, | 779 Variable* var_double_value, Label* unimplemented_elements_kind, |
| 780 Label* out_of_bounds, Label* miss) { | 780 Label* out_of_bounds, Label* miss) { |
| 781 Label if_typed_array(this), if_fast_packed(this), if_fast_holey(this), | 781 Label if_typed_array(this), if_fast_packed(this), if_fast_holey(this), |
| 782 if_fast_double(this), if_fast_holey_double(this), if_nonfast(this), | 782 if_fast_double(this), if_fast_holey_double(this), if_nonfast(this), |
| 783 if_dictionary(this); | 783 if_dictionary(this); |
| 784 GotoIf( | 784 GotoIf( |
| 785 IntPtrGreaterThan(elements_kind, IntPtrConstant(LAST_FAST_ELEMENTS_KIND)), | 785 Int32GreaterThan(elements_kind, Int32Constant(LAST_FAST_ELEMENTS_KIND)), |
| 786 &if_nonfast); | 786 &if_nonfast); |
| 787 | 787 |
| 788 EmitFastElementsBoundsCheck(object, elements, intptr_index, | 788 EmitFastElementsBoundsCheck(object, elements, intptr_index, |
| 789 is_jsarray_condition, out_of_bounds); | 789 is_jsarray_condition, out_of_bounds); |
| 790 int32_t kinds[] = {// Handled by if_fast_packed. | 790 int32_t kinds[] = {// Handled by if_fast_packed. |
| 791 FAST_SMI_ELEMENTS, FAST_ELEMENTS, | 791 FAST_SMI_ELEMENTS, FAST_ELEMENTS, |
| 792 // Handled by if_fast_holey. | 792 // Handled by if_fast_holey. |
| 793 FAST_HOLEY_SMI_ELEMENTS, FAST_HOLEY_ELEMENTS, | 793 FAST_HOLEY_SMI_ELEMENTS, FAST_HOLEY_ELEMENTS, |
| 794 // Handled by if_fast_double. | 794 // Handled by if_fast_double. |
| 795 FAST_DOUBLE_ELEMENTS, | 795 FAST_DOUBLE_ELEMENTS, |
| 796 // Handled by if_fast_holey_double. | 796 // Handled by if_fast_holey_double. |
| 797 FAST_HOLEY_DOUBLE_ELEMENTS}; | 797 FAST_HOLEY_DOUBLE_ELEMENTS}; |
| 798 Label* labels[] = {// FAST_{SMI,}_ELEMENTS | 798 Label* labels[] = {// FAST_{SMI,}_ELEMENTS |
| 799 &if_fast_packed, &if_fast_packed, | 799 &if_fast_packed, &if_fast_packed, |
| 800 // FAST_HOLEY_{SMI,}_ELEMENTS | 800 // FAST_HOLEY_{SMI,}_ELEMENTS |
| 801 &if_fast_holey, &if_fast_holey, | 801 &if_fast_holey, &if_fast_holey, |
| 802 // FAST_DOUBLE_ELEMENTS | 802 // FAST_DOUBLE_ELEMENTS |
| 803 &if_fast_double, | 803 &if_fast_double, |
| 804 // FAST_HOLEY_DOUBLE_ELEMENTS | 804 // FAST_HOLEY_DOUBLE_ELEMENTS |
| 805 &if_fast_holey_double}; | 805 &if_fast_holey_double}; |
| 806 Switch(TruncateWordToWord32(elements_kind), unimplemented_elements_kind, | 806 Switch(elements_kind, unimplemented_elements_kind, kinds, labels, |
| 807 kinds, labels, arraysize(kinds)); | 807 arraysize(kinds)); |
| 808 | 808 |
| 809 Bind(&if_fast_packed); | 809 Bind(&if_fast_packed); |
| 810 { | 810 { |
| 811 Comment("fast packed elements"); | 811 Comment("fast packed elements"); |
| 812 Return(LoadFixedArrayElement(elements, intptr_index, 0, INTPTR_PARAMETERS)); | 812 Return(LoadFixedArrayElement(elements, intptr_index, 0, INTPTR_PARAMETERS)); |
| 813 } | 813 } |
| 814 | 814 |
| 815 Bind(&if_fast_holey); | 815 Bind(&if_fast_holey); |
| 816 { | 816 { |
| 817 Comment("fast holey elements"); | 817 Comment("fast holey elements"); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 835 Node* value = LoadFixedDoubleArrayElement(elements, intptr_index, | 835 Node* value = LoadFixedDoubleArrayElement(elements, intptr_index, |
| 836 MachineType::Float64(), 0, | 836 MachineType::Float64(), 0, |
| 837 INTPTR_PARAMETERS, if_hole); | 837 INTPTR_PARAMETERS, if_hole); |
| 838 var_double_value->Bind(value); | 838 var_double_value->Bind(value); |
| 839 Goto(rebox_double); | 839 Goto(rebox_double); |
| 840 } | 840 } |
| 841 | 841 |
| 842 Bind(&if_nonfast); | 842 Bind(&if_nonfast); |
| 843 { | 843 { |
| 844 STATIC_ASSERT(LAST_ELEMENTS_KIND == LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND); | 844 STATIC_ASSERT(LAST_ELEMENTS_KIND == LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND); |
| 845 GotoIf(IntPtrGreaterThanOrEqual( | 845 GotoIf(Int32GreaterThanOrEqual( |
| 846 elements_kind, | 846 elements_kind, |
| 847 IntPtrConstant(FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND)), | 847 Int32Constant(FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND)), |
| 848 &if_typed_array); | 848 &if_typed_array); |
| 849 GotoIf(IntPtrEqual(elements_kind, IntPtrConstant(DICTIONARY_ELEMENTS)), | 849 GotoIf(Word32Equal(elements_kind, Int32Constant(DICTIONARY_ELEMENTS)), |
| 850 &if_dictionary); | 850 &if_dictionary); |
| 851 Goto(unimplemented_elements_kind); | 851 Goto(unimplemented_elements_kind); |
| 852 } | 852 } |
| 853 | 853 |
| 854 Bind(&if_dictionary); | 854 Bind(&if_dictionary); |
| 855 { | 855 { |
| 856 Comment("dictionary elements"); | 856 Comment("dictionary elements"); |
| 857 GotoIf(IntPtrLessThan(intptr_index, IntPtrConstant(0)), out_of_bounds); | 857 GotoIf(IntPtrLessThan(intptr_index, IntPtrConstant(0)), out_of_bounds); |
| 858 Variable var_entry(this, MachineType::PointerRepresentation()); | 858 Variable var_entry(this, MachineType::PointerRepresentation()); |
| 859 Label if_found(this); | 859 Label if_found(this); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 &int32_elements, &float32_elements, &float64_elements}; | 906 &int32_elements, &float32_elements, &float64_elements}; |
| 907 int32_t elements_kinds[] = { | 907 int32_t elements_kinds[] = { |
| 908 UINT8_ELEMENTS, UINT8_CLAMPED_ELEMENTS, INT8_ELEMENTS, | 908 UINT8_ELEMENTS, UINT8_CLAMPED_ELEMENTS, INT8_ELEMENTS, |
| 909 UINT16_ELEMENTS, INT16_ELEMENTS, UINT32_ELEMENTS, | 909 UINT16_ELEMENTS, INT16_ELEMENTS, UINT32_ELEMENTS, |
| 910 INT32_ELEMENTS, FLOAT32_ELEMENTS, FLOAT64_ELEMENTS}; | 910 INT32_ELEMENTS, FLOAT32_ELEMENTS, FLOAT64_ELEMENTS}; |
| 911 const size_t kTypedElementsKindCount = | 911 const size_t kTypedElementsKindCount = |
| 912 LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND - | 912 LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND - |
| 913 FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND + 1; | 913 FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND + 1; |
| 914 DCHECK_EQ(kTypedElementsKindCount, arraysize(elements_kinds)); | 914 DCHECK_EQ(kTypedElementsKindCount, arraysize(elements_kinds)); |
| 915 DCHECK_EQ(kTypedElementsKindCount, arraysize(elements_kind_labels)); | 915 DCHECK_EQ(kTypedElementsKindCount, arraysize(elements_kind_labels)); |
| 916 Switch(TruncateWordToWord32(elements_kind), miss, elements_kinds, | 916 Switch(elements_kind, miss, elements_kinds, elements_kind_labels, |
| 917 elements_kind_labels, kTypedElementsKindCount); | 917 kTypedElementsKindCount); |
| 918 Bind(&uint8_elements); | 918 Bind(&uint8_elements); |
| 919 { | 919 { |
| 920 Comment("UINT8_ELEMENTS"); // Handles UINT8_CLAMPED_ELEMENTS too. | 920 Comment("UINT8_ELEMENTS"); // Handles UINT8_CLAMPED_ELEMENTS too. |
| 921 Node* element = Load(MachineType::Uint8(), backing_store, intptr_index); | 921 Node* element = Load(MachineType::Uint8(), backing_store, intptr_index); |
| 922 Return(SmiFromWord32(element)); | 922 Return(SmiFromWord32(element)); |
| 923 } | 923 } |
| 924 Bind(&int8_elements); | 924 Bind(&int8_elements); |
| 925 { | 925 { |
| 926 Comment("INT8_ELEMENTS"); | 926 Comment("INT8_ELEMENTS"); |
| 927 Node* element = Load(MachineType::Int8(), backing_store, intptr_index); | 927 Node* element = Load(MachineType::Int8(), backing_store, intptr_index); |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 // Try looking up the property on the receiver; if unsuccessful, look | 1390 // Try looking up the property on the receiver; if unsuccessful, look |
| 1391 // for a handler in the stub cache. | 1391 // for a handler in the stub cache. |
| 1392 Comment("DescriptorArray lookup"); | 1392 Comment("DescriptorArray lookup"); |
| 1393 | 1393 |
| 1394 // Skip linear search if there are too many descriptors. | 1394 // Skip linear search if there are too many descriptors. |
| 1395 // TODO(jkummerow): Consider implementing binary search. | 1395 // TODO(jkummerow): Consider implementing binary search. |
| 1396 // See also TryLookupProperty() which has the same limitation. | 1396 // See also TryLookupProperty() which has the same limitation. |
| 1397 const int32_t kMaxLinear = 210; | 1397 const int32_t kMaxLinear = 210; |
| 1398 Label stub_cache(this); | 1398 Label stub_cache(this); |
| 1399 Node* bitfield3 = LoadMapBitField3(receiver_map); | 1399 Node* bitfield3 = LoadMapBitField3(receiver_map); |
| 1400 Node* nof = DecodeWord32<Map::NumberOfOwnDescriptorsBits>(bitfield3); | 1400 Node* nof = |
| 1401 GotoIf(Uint32LessThan(Int32Constant(kMaxLinear), nof), &stub_cache); | 1401 DecodeWordFromWord32<Map::NumberOfOwnDescriptorsBits>(bitfield3); |
| 1402 GotoIf(UintPtrLessThan(IntPtrConstant(kMaxLinear), nof), &stub_cache); |
| 1402 Node* descriptors = LoadMapDescriptors(receiver_map); | 1403 Node* descriptors = LoadMapDescriptors(receiver_map); |
| 1403 Variable var_name_index(this, MachineType::PointerRepresentation()); | 1404 Variable var_name_index(this, MachineType::PointerRepresentation()); |
| 1404 Label if_descriptor_found(this); | 1405 Label if_descriptor_found(this); |
| 1405 DescriptorLookupLinear(key, descriptors, nof, &if_descriptor_found, | 1406 DescriptorLookupLinear(key, descriptors, nof, &if_descriptor_found, |
| 1406 &var_name_index, &stub_cache); | 1407 &var_name_index, &stub_cache); |
| 1407 | 1408 |
| 1408 Bind(&if_descriptor_found); | 1409 Bind(&if_descriptor_found); |
| 1409 { | 1410 { |
| 1410 LoadPropertyFromFastObject(receiver, receiver_map, descriptors, | 1411 LoadPropertyFromFastObject(receiver, receiver_map, descriptors, |
| 1411 var_name_index.value(), &var_details, | 1412 var_name_index.value(), &var_details, |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1826 void AccessorAssembler::GenerateKeyedStoreICTrampolineTF( | 1827 void AccessorAssembler::GenerateKeyedStoreICTrampolineTF( |
| 1827 CodeAssemblerState* state, LanguageMode language_mode) { | 1828 CodeAssemblerState* state, LanguageMode language_mode) { |
| 1828 AccessorAssemblerImpl assembler(state); | 1829 AccessorAssemblerImpl assembler(state); |
| 1829 assembler.GenerateKeyedStoreICTrampolineTF(language_mode); | 1830 assembler.GenerateKeyedStoreICTrampolineTF(language_mode); |
| 1830 } | 1831 } |
| 1831 | 1832 |
| 1832 #undef ACCESSOR_ASSEMBLER_PUBLIC_INTERFACE | 1833 #undef ACCESSOR_ASSEMBLER_PUBLIC_INTERFACE |
| 1833 | 1834 |
| 1834 } // namespace internal | 1835 } // namespace internal |
| 1835 } // namespace v8 | 1836 } // namespace v8 |
| OLD | NEW |