Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: src/ic/keyed-store-generic.cc

Issue 2688573003: [cleanup] CSA: add helpers for accessing details/value via key_index (Closed)
Patch Set: rebased Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ic/accessor-assembler.cc ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h" 10 #include "src/ic/accessor-assembler.h"
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 Label found(this), found_fast(this), found_dict(this), found_global(this); 532 Label found(this), found_fast(this), found_dict(this), found_global(this);
533 Variable var_meta_storage(this, MachineRepresentation::kTagged); 533 Variable var_meta_storage(this, MachineRepresentation::kTagged);
534 Variable var_entry(this, MachineType::PointerRepresentation()); 534 Variable var_entry(this, MachineType::PointerRepresentation());
535 TryLookupProperty(holder, holder_map, instance_type, name, &found_fast, 535 TryLookupProperty(holder, holder_map, instance_type, name, &found_fast,
536 &found_dict, &found_global, &var_meta_storage, 536 &found_dict, &found_global, &var_meta_storage,
537 &var_entry, &next_proto, bailout); 537 &var_entry, &next_proto, bailout);
538 Bind(&found_fast); 538 Bind(&found_fast);
539 { 539 {
540 Node* descriptors = var_meta_storage.value(); 540 Node* descriptors = var_meta_storage.value();
541 Node* name_index = var_entry.value(); 541 Node* name_index = var_entry.value();
542 // TODO(jkummerow): Add helper functions for accessing value and 542 Node* details =
543 // details by entry. 543 LoadDetailsByKeyIndex<DescriptorArray>(descriptors, name_index);
544 const int kNameToDetailsOffset = (DescriptorArray::kDescriptorDetails -
545 DescriptorArray::kDescriptorKey) *
546 kPointerSize;
547 Node* details = LoadAndUntagToWord32FixedArrayElement(
548 descriptors, name_index, kNameToDetailsOffset);
549 JumpIfDataProperty(details, &ok_to_write, readonly); 544 JumpIfDataProperty(details, &ok_to_write, readonly);
550 545
551 // Accessor case. 546 // Accessor case.
552 Variable var_details(this, MachineRepresentation::kWord32); 547 Variable var_details(this, MachineRepresentation::kWord32);
553 LoadPropertyFromFastObject(holder, holder_map, descriptors, name_index, 548 LoadPropertyFromFastObject(holder, holder_map, descriptors, name_index,
554 &var_details, var_accessor_pair); 549 &var_details, var_accessor_pair);
555 var_accessor_holder->Bind(holder); 550 var_accessor_holder->Bind(holder);
556 Goto(accessor); 551 Goto(accessor);
557 } 552 }
558 553
559 Bind(&found_dict); 554 Bind(&found_dict);
560 { 555 {
561 Node* dictionary = var_meta_storage.value(); 556 Node* dictionary = var_meta_storage.value();
562 Node* entry = var_entry.value(); 557 Node* entry = var_entry.value();
563 const int kNameToDetailsOffset = (NameDictionary::kEntryDetailsIndex - 558 Node* details =
564 NameDictionary::kEntryKeyIndex) * 559 LoadDetailsByKeyIndex<NameDictionary>(dictionary, entry);
565 kPointerSize;
566 Node* details = LoadAndUntagToWord32FixedArrayElement(
567 dictionary, entry, kNameToDetailsOffset);
568 JumpIfDataProperty(details, &ok_to_write, readonly); 560 JumpIfDataProperty(details, &ok_to_write, readonly);
569 561
570 // Accessor case. 562 // Accessor case.
571 const int kNameToValueOffset = (NameDictionary::kEntryValueIndex -
572 NameDictionary::kEntryKeyIndex) *
573 kPointerSize;
574 var_accessor_pair->Bind( 563 var_accessor_pair->Bind(
575 LoadFixedArrayElement(dictionary, entry, kNameToValueOffset)); 564 LoadValueByKeyIndex<NameDictionary>(dictionary, entry));
576 var_accessor_holder->Bind(holder); 565 var_accessor_holder->Bind(holder);
577 Goto(accessor); 566 Goto(accessor);
578 } 567 }
579 568
580 Bind(&found_global); 569 Bind(&found_global);
581 { 570 {
582 Node* dictionary = var_meta_storage.value(); 571 Node* dictionary = var_meta_storage.value();
583 Node* entry = var_entry.value(); 572 Node* entry = var_entry.value();
584 const int kNameToValueOffset = (GlobalDictionary::kEntryValueIndex -
585 GlobalDictionary::kEntryKeyIndex) *
586 kPointerSize;
587
588 Node* property_cell = 573 Node* property_cell =
589 LoadFixedArrayElement(dictionary, entry, kNameToValueOffset); 574 LoadValueByKeyIndex<GlobalDictionary>(dictionary, entry);
590
591 Node* value = 575 Node* value =
592 LoadObjectField(property_cell, PropertyCell::kValueOffset); 576 LoadObjectField(property_cell, PropertyCell::kValueOffset);
593 GotoIf(WordEqual(value, TheHoleConstant()), &next_proto); 577 GotoIf(WordEqual(value, TheHoleConstant()), &next_proto);
594 Node* details = LoadAndUntagToWord32ObjectField( 578 Node* details = LoadAndUntagToWord32ObjectField(
595 property_cell, PropertyCell::kDetailsOffset); 579 property_cell, PropertyCell::kDetailsOffset);
596 JumpIfDataProperty(details, &ok_to_write, readonly); 580 JumpIfDataProperty(details, &ok_to_write, readonly);
597 581
598 // Accessor case. 582 // Accessor case.
599 var_accessor_pair->Bind(value); 583 var_accessor_pair->Bind(value);
600 var_accessor_holder->Bind(holder); 584 var_accessor_holder->Bind(holder);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 // We checked for LAST_CUSTOM_ELEMENTS_RECEIVER before, which rules out 625 // We checked for LAST_CUSTOM_ELEMENTS_RECEIVER before, which rules out
642 // seeing global objects here (which would need special handling). 626 // seeing global objects here (which would need special handling).
643 627
644 Variable var_name_index(this, MachineType::PointerRepresentation()); 628 Variable var_name_index(this, MachineType::PointerRepresentation());
645 Label dictionary_found(this, &var_name_index), not_found(this); 629 Label dictionary_found(this, &var_name_index), not_found(this);
646 NameDictionaryLookup<NameDictionary>(properties, p->name, &dictionary_found, 630 NameDictionaryLookup<NameDictionary>(properties, p->name, &dictionary_found,
647 &var_name_index, &not_found); 631 &var_name_index, &not_found);
648 Bind(&dictionary_found); 632 Bind(&dictionary_found);
649 { 633 {
650 Label overwrite(this); 634 Label overwrite(this);
651 const int kNameToDetailsOffset = (NameDictionary::kEntryDetailsIndex - 635 Node* details = LoadDetailsByKeyIndex<NameDictionary>(
652 NameDictionary::kEntryKeyIndex) * 636 properties, var_name_index.value());
653 kPointerSize;
654 Node* details = LoadAndUntagToWord32FixedArrayElement(
655 properties, var_name_index.value(), kNameToDetailsOffset);
656 JumpIfDataProperty(details, &overwrite, &readonly); 637 JumpIfDataProperty(details, &overwrite, &readonly);
657 638
658 // Accessor case. 639 // Accessor case.
659 const int kNameToValueOffset = 640 var_accessor_pair.Bind(LoadValueByKeyIndex<NameDictionary>(
660 (NameDictionary::kEntryValueIndex - NameDictionary::kEntryKeyIndex) * 641 properties, var_name_index.value()));
661 kPointerSize;
662 var_accessor_pair.Bind(LoadFixedArrayElement(
663 properties, var_name_index.value(), kNameToValueOffset));
664 var_accessor_holder.Bind(receiver); 642 var_accessor_holder.Bind(receiver);
665 Goto(&accessor); 643 Goto(&accessor);
666 644
667 Bind(&overwrite); 645 Bind(&overwrite);
668 { 646 {
669 StoreFixedArrayElement(properties, var_name_index.value(), p->value, 647 StoreValueByKeyIndex<NameDictionary>(properties, var_name_index.value(),
670 UPDATE_WRITE_BARRIER, kNameToValueOffset); 648 p->value);
671 Return(p->value); 649 Return(p->value);
672 } 650 }
673 } 651 }
674 652
675 Bind(&not_found); 653 Bind(&not_found);
676 { 654 {
677 LookupPropertyOnPrototypeChain(receiver_map, p->name, &accessor, 655 LookupPropertyOnPrototypeChain(receiver_map, p->name, &accessor,
678 &var_accessor_pair, &var_accessor_holder, 656 &var_accessor_pair, &var_accessor_holder,
679 &readonly, slow); 657 &readonly, slow);
680 Add<NameDictionary>(properties, p->name, p->value, slow); 658 Add<NameDictionary>(properties, p->name, p->value, slow);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 Bind(&slow); 769 Bind(&slow);
792 { 770 {
793 Comment("KeyedStoreGeneric_slow"); 771 Comment("KeyedStoreGeneric_slow");
794 TailCallRuntime(Runtime::kSetProperty, context, receiver, name, value, 772 TailCallRuntime(Runtime::kSetProperty, context, receiver, name, value,
795 SmiConstant(language_mode)); 773 SmiConstant(language_mode));
796 } 774 }
797 } 775 }
798 776
799 } // namespace internal 777 } // namespace internal
800 } // namespace v8 778 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/accessor-assembler.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698