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

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

Issue 2568713002: [stubs] Fixing issues found by machine graph verifier in code stubs. (Closed)
Patch Set: Addressing nits Created 4 years 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') | no next file » | 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-impl.h" 10 #include "src/ic/accessor-assembler-impl.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 void KeyedStoreGenericAssembler::TryRewriteElements( 111 void KeyedStoreGenericAssembler::TryRewriteElements(
112 Node* receiver, Node* receiver_map, Node* elements, Node* native_context, 112 Node* receiver, Node* receiver_map, Node* elements, Node* native_context,
113 ElementsKind from_kind, ElementsKind to_kind, Label* bailout) { 113 ElementsKind from_kind, ElementsKind to_kind, Label* bailout) {
114 DCHECK(IsFastPackedElementsKind(from_kind)); 114 DCHECK(IsFastPackedElementsKind(from_kind));
115 ElementsKind holey_from_kind = GetHoleyElementsKind(from_kind); 115 ElementsKind holey_from_kind = GetHoleyElementsKind(from_kind);
116 ElementsKind holey_to_kind = GetHoleyElementsKind(to_kind); 116 ElementsKind holey_to_kind = GetHoleyElementsKind(to_kind);
117 if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) { 117 if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) {
118 TrapAllocationMemento(receiver, bailout); 118 TrapAllocationMemento(receiver, bailout);
119 } 119 }
120 Label perform_transition(this), check_holey_map(this); 120 Label perform_transition(this), check_holey_map(this);
121 Variable var_target_map(this, MachineType::PointerRepresentation()); 121 Variable var_target_map(this, MachineRepresentation::kTagged);
122 // Check if the receiver has the default |from_kind| map. 122 // Check if the receiver has the default |from_kind| map.
123 { 123 {
124 Node* packed_map = 124 Node* packed_map =
125 LoadContextElement(native_context, Context::ArrayMapIndex(from_kind)); 125 LoadContextElement(native_context, Context::ArrayMapIndex(from_kind));
126 GotoIf(WordNotEqual(receiver_map, packed_map), &check_holey_map); 126 GotoIf(WordNotEqual(receiver_map, packed_map), &check_holey_map);
127 var_target_map.Bind( 127 var_target_map.Bind(
128 LoadContextElement(native_context, Context::ArrayMapIndex(to_kind))); 128 LoadContextElement(native_context, Context::ArrayMapIndex(to_kind)));
129 Goto(&perform_transition); 129 Goto(&perform_transition);
130 } 130 }
131 131
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
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); 537 descriptors, name_index, kNameToDetailsOffset, INTPTR_PARAMETERS);
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); 556 dictionary, entry, kNameToDetailsOffset, INTPTR_PARAMETERS);
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( 563 var_accessor_pair->Bind(LoadFixedArrayElement(
564 LoadFixedArrayElement(dictionary, entry, kNameToValueOffset)); 564 dictionary, entry, kNameToValueOffset, INTPTR_PARAMETERS));
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 = 577 Node* property_cell = LoadFixedArrayElement(
578 LoadFixedArrayElement(dictionary, entry, kNameToValueOffset); 578 dictionary, entry, kNameToValueOffset, INTPTR_PARAMETERS);
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
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, &not_found); 636 &var_name_index, &not_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);
645 JumpIfDataProperty(details, &overwrite, &readonly); 646 JumpIfDataProperty(details, &overwrite, &readonly);
646 647
647 // Accessor case. 648 // Accessor case.
648 const int kNameToValueOffset = 649 const int kNameToValueOffset =
649 (NameDictionary::kEntryValueIndex - NameDictionary::kEntryKeyIndex) * 650 (NameDictionary::kEntryValueIndex - NameDictionary::kEntryKeyIndex) *
650 kPointerSize; 651 kPointerSize;
651 var_accessor_pair.Bind(LoadFixedArrayElement( 652 var_accessor_pair.Bind(
652 properties, var_name_index.value(), kNameToValueOffset)); 653 LoadFixedArrayElement(properties, var_name_index.value(),
654 kNameToValueOffset, INTPTR_PARAMETERS));
653 var_accessor_holder.Bind(receiver); 655 var_accessor_holder.Bind(receiver);
654 Goto(&accessor); 656 Goto(&accessor);
655 657
656 Bind(&overwrite); 658 Bind(&overwrite);
657 { 659 {
658 StoreFixedArrayElement(properties, var_name_index.value(), p->value, 660 StoreFixedArrayElement(properties, var_name_index.value(), p->value,
659 UPDATE_WRITE_BARRIER, kNameToValueOffset, 661 UPDATE_WRITE_BARRIER, kNameToValueOffset,
660 INTPTR_PARAMETERS); 662 INTPTR_PARAMETERS);
661 Return(p->value); 663 Return(p->value);
662 } 664 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 Bind(&slow); 781 Bind(&slow);
780 { 782 {
781 Comment("KeyedStoreGeneric_slow"); 783 Comment("KeyedStoreGeneric_slow");
782 TailCallRuntime(Runtime::kSetProperty, context, receiver, name, value, 784 TailCallRuntime(Runtime::kSetProperty, context, receiver, name, value,
783 SmiConstant(language_mode)); 785 SmiConstant(language_mode));
784 } 786 }
785 } 787 }
786 788
787 } // namespace internal 789 } // namespace internal
788 } // namespace v8 790 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/accessor-assembler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698