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/keyed-store-generic.h" | 5 #include "src/ic/keyed-store-generic.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stub-assembler.h" | 8 #include "src/code-stub-assembler.h" |
9 #include "src/contexts.h" | 9 #include "src/contexts.h" |
10 #include "src/ic/accessor-assembler-impl.h" | 10 #include "src/ic/accessor-assembler-impl.h" |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 | 445 |
446 Bind(&if_bump_length_with_gap); | 446 Bind(&if_bump_length_with_gap); |
447 { | 447 { |
448 StoreElementWithCapacity(receiver, receiver_map, elements, elements_kind, | 448 StoreElementWithCapacity(receiver, receiver_map, elements, elements_kind, |
449 intptr_index, value, context, slow, | 449 intptr_index, value, context, slow, |
450 kBumpLengthWithGap); | 450 kBumpLengthWithGap); |
451 } | 451 } |
452 | 452 |
453 // Out-of-capacity accesses (index >= capacity) jump here. Additionally, | 453 // Out-of-capacity accesses (index >= capacity) jump here. Additionally, |
454 // an ElementsKind transition might be necessary. | 454 // an ElementsKind transition might be necessary. |
| 455 // The index can also be negative at this point! Jump to the runtime in that |
| 456 // case to convert it to a named property. |
455 Bind(&if_grow); | 457 Bind(&if_grow); |
456 { | 458 { |
457 Comment("Grow backing store"); | 459 Comment("Grow backing store"); |
458 // TODO(jkummerow): Support inline backing store growth. | 460 // TODO(jkummerow): Support inline backing store growth. |
459 Goto(slow); | 461 Goto(slow); |
460 } | 462 } |
461 | 463 |
462 // Any ElementsKind > LAST_FAST_ELEMENTS_KIND jumps here for further dispatch. | 464 // Any ElementsKind > LAST_FAST_ELEMENTS_KIND jumps here for further dispatch. |
463 Bind(&if_nonfast); | 465 Bind(&if_nonfast); |
464 { | 466 { |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 typedef StoreWithVectorDescriptor Descriptor; | 742 typedef StoreWithVectorDescriptor Descriptor; |
741 | 743 |
742 Node* receiver = Parameter(Descriptor::kReceiver); | 744 Node* receiver = Parameter(Descriptor::kReceiver); |
743 Node* name = Parameter(Descriptor::kName); | 745 Node* name = Parameter(Descriptor::kName); |
744 Node* value = Parameter(Descriptor::kValue); | 746 Node* value = Parameter(Descriptor::kValue); |
745 Node* slot = Parameter(Descriptor::kSlot); | 747 Node* slot = Parameter(Descriptor::kSlot); |
746 Node* vector = Parameter(Descriptor::kVector); | 748 Node* vector = Parameter(Descriptor::kVector); |
747 Node* context = Parameter(Descriptor::kContext); | 749 Node* context = Parameter(Descriptor::kContext); |
748 | 750 |
749 Variable var_index(this, MachineType::PointerRepresentation()); | 751 Variable var_index(this, MachineType::PointerRepresentation()); |
| 752 Variable var_unique(this, MachineRepresentation::kTagged); |
| 753 var_unique.Bind(name); // Dummy initialization. |
750 Label if_index(this), if_unique_name(this), slow(this); | 754 Label if_index(this), if_unique_name(this), slow(this); |
751 | 755 |
752 GotoIf(TaggedIsSmi(receiver), &slow); | 756 GotoIf(TaggedIsSmi(receiver), &slow); |
753 Node* receiver_map = LoadMap(receiver); | 757 Node* receiver_map = LoadMap(receiver); |
754 Node* instance_type = LoadMapInstanceType(receiver_map); | 758 Node* instance_type = LoadMapInstanceType(receiver_map); |
755 // Receivers requiring non-standard element accesses (interceptors, access | 759 // Receivers requiring non-standard element accesses (interceptors, access |
756 // checks, strings and string wrappers, proxies) are handled in the runtime. | 760 // checks, strings and string wrappers, proxies) are handled in the runtime. |
757 GotoIf(Int32LessThanOrEqual(instance_type, | 761 GotoIf(Int32LessThanOrEqual(instance_type, |
758 Int32Constant(LAST_CUSTOM_ELEMENTS_RECEIVER)), | 762 Int32Constant(LAST_CUSTOM_ELEMENTS_RECEIVER)), |
759 &slow); | 763 &slow); |
760 | 764 |
761 TryToName(name, &if_index, &var_index, &if_unique_name, &slow); | 765 TryToName(name, &if_index, &var_index, &if_unique_name, &var_unique, &slow); |
762 | 766 |
763 Bind(&if_index); | 767 Bind(&if_index); |
764 { | 768 { |
765 Comment("integer index"); | 769 Comment("integer index"); |
766 EmitGenericElementStore(receiver, receiver_map, instance_type, | 770 EmitGenericElementStore(receiver, receiver_map, instance_type, |
767 var_index.value(), value, context, &slow); | 771 var_index.value(), value, context, &slow); |
768 } | 772 } |
769 | 773 |
770 Bind(&if_unique_name); | 774 Bind(&if_unique_name); |
771 { | 775 { |
772 Comment("key is unique name"); | 776 Comment("key is unique name"); |
773 KeyedStoreGenericAssembler::StoreICParameters p(context, receiver, name, | 777 StoreICParameters p(context, receiver, var_unique.value(), value, slot, |
774 value, slot, vector); | 778 vector); |
775 EmitGenericPropertyStore(receiver, receiver_map, &p, &slow, language_mode); | 779 EmitGenericPropertyStore(receiver, receiver_map, &p, &slow, language_mode); |
776 } | 780 } |
777 | 781 |
778 Bind(&slow); | 782 Bind(&slow); |
779 { | 783 { |
780 Comment("KeyedStoreGeneric_slow"); | 784 Comment("KeyedStoreGeneric_slow"); |
781 TailCallRuntime(Runtime::kSetProperty, context, receiver, name, value, | 785 TailCallRuntime(Runtime::kSetProperty, context, receiver, name, value, |
782 SmiConstant(language_mode)); | 786 SmiConstant(language_mode)); |
783 } | 787 } |
784 } | 788 } |
785 | 789 |
786 } // namespace internal | 790 } // namespace internal |
787 } // namespace v8 | 791 } // namespace v8 |
OLD | NEW |