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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 Bind(&found_fast); | 527 Bind(&found_fast); |
528 { | 528 { |
529 Node* descriptors = var_meta_storage.value(); | 529 Node* descriptors = var_meta_storage.value(); |
530 Node* name_index = var_entry.value(); | 530 Node* name_index = var_entry.value(); |
531 // TODO(jkummerow): Add helper functions for accessing value and | 531 // TODO(jkummerow): Add helper functions for accessing value and |
532 // details by entry. | 532 // details by entry. |
533 const int kNameToDetailsOffset = (DescriptorArray::kDescriptorDetails - | 533 const int kNameToDetailsOffset = (DescriptorArray::kDescriptorDetails - |
534 DescriptorArray::kDescriptorKey) * | 534 DescriptorArray::kDescriptorKey) * |
535 kPointerSize; | 535 kPointerSize; |
536 Node* details = LoadAndUntagToWord32FixedArrayElement( | 536 Node* details = LoadAndUntagToWord32FixedArrayElement( |
537 descriptors, name_index, kNameToDetailsOffset, INTPTR_PARAMETERS); | 537 descriptors, name_index, kNameToDetailsOffset); |
538 JumpIfDataProperty(details, &ok_to_write, readonly); | 538 JumpIfDataProperty(details, &ok_to_write, readonly); |
539 | 539 |
540 // Accessor case. | 540 // Accessor case. |
541 Variable var_details(this, MachineRepresentation::kWord32); | 541 Variable var_details(this, MachineRepresentation::kWord32); |
542 LoadPropertyFromFastObject(holder, holder_map, descriptors, name_index, | 542 LoadPropertyFromFastObject(holder, holder_map, descriptors, name_index, |
543 &var_details, var_accessor_pair); | 543 &var_details, var_accessor_pair); |
544 var_accessor_holder->Bind(holder); | 544 var_accessor_holder->Bind(holder); |
545 Goto(accessor); | 545 Goto(accessor); |
546 } | 546 } |
547 | 547 |
548 Bind(&found_dict); | 548 Bind(&found_dict); |
549 { | 549 { |
550 Node* dictionary = var_meta_storage.value(); | 550 Node* dictionary = var_meta_storage.value(); |
551 Node* entry = var_entry.value(); | 551 Node* entry = var_entry.value(); |
552 const int kNameToDetailsOffset = (NameDictionary::kEntryDetailsIndex - | 552 const int kNameToDetailsOffset = (NameDictionary::kEntryDetailsIndex - |
553 NameDictionary::kEntryKeyIndex) * | 553 NameDictionary::kEntryKeyIndex) * |
554 kPointerSize; | 554 kPointerSize; |
555 Node* details = LoadAndUntagToWord32FixedArrayElement( | 555 Node* details = LoadAndUntagToWord32FixedArrayElement( |
556 dictionary, entry, kNameToDetailsOffset, INTPTR_PARAMETERS); | 556 dictionary, entry, kNameToDetailsOffset); |
557 JumpIfDataProperty(details, &ok_to_write, readonly); | 557 JumpIfDataProperty(details, &ok_to_write, readonly); |
558 | 558 |
559 // Accessor case. | 559 // Accessor case. |
560 const int kNameToValueOffset = (NameDictionary::kEntryValueIndex - | 560 const int kNameToValueOffset = (NameDictionary::kEntryValueIndex - |
561 NameDictionary::kEntryKeyIndex) * | 561 NameDictionary::kEntryKeyIndex) * |
562 kPointerSize; | 562 kPointerSize; |
563 var_accessor_pair->Bind(LoadFixedArrayElement( | 563 var_accessor_pair->Bind( |
564 dictionary, entry, kNameToValueOffset, INTPTR_PARAMETERS)); | 564 LoadFixedArrayElement(dictionary, entry, kNameToValueOffset)); |
565 var_accessor_holder->Bind(holder); | 565 var_accessor_holder->Bind(holder); |
566 Goto(accessor); | 566 Goto(accessor); |
567 } | 567 } |
568 | 568 |
569 Bind(&found_global); | 569 Bind(&found_global); |
570 { | 570 { |
571 Node* dictionary = var_meta_storage.value(); | 571 Node* dictionary = var_meta_storage.value(); |
572 Node* entry = var_entry.value(); | 572 Node* entry = var_entry.value(); |
573 const int kNameToValueOffset = (GlobalDictionary::kEntryValueIndex - | 573 const int kNameToValueOffset = (GlobalDictionary::kEntryValueIndex - |
574 GlobalDictionary::kEntryKeyIndex) * | 574 GlobalDictionary::kEntryKeyIndex) * |
575 kPointerSize; | 575 kPointerSize; |
576 | 576 |
577 Node* property_cell = LoadFixedArrayElement( | 577 Node* property_cell = |
578 dictionary, entry, kNameToValueOffset, INTPTR_PARAMETERS); | 578 LoadFixedArrayElement(dictionary, entry, kNameToValueOffset); |
579 | 579 |
580 Node* value = | 580 Node* value = |
581 LoadObjectField(property_cell, PropertyCell::kValueOffset); | 581 LoadObjectField(property_cell, PropertyCell::kValueOffset); |
582 GotoIf(WordEqual(value, TheHoleConstant()), &next_proto); | 582 GotoIf(WordEqual(value, TheHoleConstant()), &next_proto); |
583 Node* details = LoadAndUntagToWord32ObjectField( | 583 Node* details = LoadAndUntagToWord32ObjectField( |
584 property_cell, PropertyCell::kDetailsOffset); | 584 property_cell, PropertyCell::kDetailsOffset); |
585 JumpIfDataProperty(details, &ok_to_write, readonly); | 585 JumpIfDataProperty(details, &ok_to_write, readonly); |
586 | 586 |
587 // Accessor case. | 587 // Accessor case. |
588 var_accessor_pair->Bind(value); | 588 var_accessor_pair->Bind(value); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 Label dictionary_found(this, &var_name_index), not_found(this); | 634 Label dictionary_found(this, &var_name_index), not_found(this); |
635 NameDictionaryLookup<NameDictionary>(properties, p->name, &dictionary_found, | 635 NameDictionaryLookup<NameDictionary>(properties, p->name, &dictionary_found, |
636 &var_name_index, ¬_found); | 636 &var_name_index, ¬_found); |
637 Bind(&dictionary_found); | 637 Bind(&dictionary_found); |
638 { | 638 { |
639 Label overwrite(this); | 639 Label overwrite(this); |
640 const int kNameToDetailsOffset = (NameDictionary::kEntryDetailsIndex - | 640 const int kNameToDetailsOffset = (NameDictionary::kEntryDetailsIndex - |
641 NameDictionary::kEntryKeyIndex) * | 641 NameDictionary::kEntryKeyIndex) * |
642 kPointerSize; | 642 kPointerSize; |
643 Node* details = LoadAndUntagToWord32FixedArrayElement( | 643 Node* details = LoadAndUntagToWord32FixedArrayElement( |
644 properties, var_name_index.value(), kNameToDetailsOffset, | 644 properties, var_name_index.value(), kNameToDetailsOffset); |
645 INTPTR_PARAMETERS); | |
646 JumpIfDataProperty(details, &overwrite, &readonly); | 645 JumpIfDataProperty(details, &overwrite, &readonly); |
647 | 646 |
648 // Accessor case. | 647 // Accessor case. |
649 const int kNameToValueOffset = | 648 const int kNameToValueOffset = |
650 (NameDictionary::kEntryValueIndex - NameDictionary::kEntryKeyIndex) * | 649 (NameDictionary::kEntryValueIndex - NameDictionary::kEntryKeyIndex) * |
651 kPointerSize; | 650 kPointerSize; |
652 var_accessor_pair.Bind( | 651 var_accessor_pair.Bind(LoadFixedArrayElement( |
653 LoadFixedArrayElement(properties, var_name_index.value(), | 652 properties, var_name_index.value(), kNameToValueOffset)); |
654 kNameToValueOffset, INTPTR_PARAMETERS)); | |
655 var_accessor_holder.Bind(receiver); | 653 var_accessor_holder.Bind(receiver); |
656 Goto(&accessor); | 654 Goto(&accessor); |
657 | 655 |
658 Bind(&overwrite); | 656 Bind(&overwrite); |
659 { | 657 { |
660 StoreFixedArrayElement(properties, var_name_index.value(), p->value, | 658 StoreFixedArrayElement(properties, var_name_index.value(), p->value, |
661 UPDATE_WRITE_BARRIER, kNameToValueOffset, | 659 UPDATE_WRITE_BARRIER, kNameToValueOffset); |
662 INTPTR_PARAMETERS); | |
663 Return(p->value); | 660 Return(p->value); |
664 } | 661 } |
665 } | 662 } |
666 | 663 |
667 Bind(¬_found); | 664 Bind(¬_found); |
668 { | 665 { |
669 LookupPropertyOnPrototypeChain(receiver_map, p->name, &accessor, | 666 LookupPropertyOnPrototypeChain(receiver_map, p->name, &accessor, |
670 &var_accessor_pair, &var_accessor_holder, | 667 &var_accessor_pair, &var_accessor_holder, |
671 &readonly, slow); | 668 &readonly, slow); |
672 Add<NameDictionary>(properties, p->name, p->value, slow); | 669 Add<NameDictionary>(properties, p->name, p->value, slow); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 Bind(&slow); | 778 Bind(&slow); |
782 { | 779 { |
783 Comment("KeyedStoreGeneric_slow"); | 780 Comment("KeyedStoreGeneric_slow"); |
784 TailCallRuntime(Runtime::kSetProperty, context, receiver, name, value, | 781 TailCallRuntime(Runtime::kSetProperty, context, receiver, name, value, |
785 SmiConstant(language_mode)); | 782 SmiConstant(language_mode)); |
786 } | 783 } |
787 } | 784 } |
788 | 785 |
789 } // namespace internal | 786 } // namespace internal |
790 } // namespace v8 | 787 } // namespace v8 |
OLD | NEW |