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

Side by Side Diff: src/builtins/builtins-constructor.cc

Issue 2445333002: Ensure slow properties for simple {__proto__:null} literals. (Closed)
Patch Set: addressing nits Created 3 years, 9 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
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/builtins/builtins-constructor.h" 5 #include "src/builtins/builtins-constructor.h"
6 #include "src/ast/ast.h" 6 #include "src/ast/ast.h"
7 #include "src/builtins/builtins-utils.h" 7 #include "src/builtins/builtins-utils.h"
8 #include "src/builtins/builtins.h" 8 #include "src/builtins/builtins.h"
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stub-assembler.h" 10 #include "src/code-stub-assembler.h"
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 Node* field = Load(MachineType::IntPtr(), boilerplate, offset.value()); 707 Node* field = Load(MachineType::IntPtr(), boilerplate, offset.value());
708 StoreNoWriteBarrier(MachineType::PointerRepresentation(), copy, 708 StoreNoWriteBarrier(MachineType::PointerRepresentation(), copy,
709 offset.value(), field); 709 offset.value(), field);
710 Goto(&loop_check); 710 Goto(&loop_check);
711 } 711 }
712 Bind(&loop_check); 712 Bind(&loop_check);
713 { 713 {
714 offset.Bind(IntPtrAdd(offset.value(), IntPtrConstant(kPointerSize))); 714 offset.Bind(IntPtrAdd(offset.value(), IntPtrConstant(kPointerSize)));
715 GotoIfNot(IntPtrGreaterThanOrEqual(offset.value(), end_offset), &loop_body); 715 GotoIfNot(IntPtrGreaterThanOrEqual(offset.value(), end_offset), &loop_body);
716 } 716 }
717
718 if (FLAG_allocation_site_pretenuring) { 717 if (FLAG_allocation_site_pretenuring) {
719 Node* memento = InnerAllocate(copy, object_size); 718 Node* memento = InnerAllocate(copy, object_size);
720 StoreMapNoWriteBarrier(memento, Heap::kAllocationMementoMapRootIndex); 719 StoreMapNoWriteBarrier(memento, Heap::kAllocationMementoMapRootIndex);
721 StoreObjectFieldNoWriteBarrier( 720 StoreObjectFieldNoWriteBarrier(
722 memento, AllocationMemento::kAllocationSiteOffset, allocation_site); 721 memento, AllocationMemento::kAllocationSiteOffset, allocation_site);
723 Node* memento_create_count = LoadObjectField( 722 Node* memento_create_count = LoadObjectField(
724 allocation_site, AllocationSite::kPretenureCreateCountOffset); 723 allocation_site, AllocationSite::kPretenureCreateCountOffset);
725 memento_create_count = 724 memento_create_count =
726 SmiAdd(memento_create_count, SmiConstant(Smi::FromInt(1))); 725 SmiAdd(memento_create_count, SmiConstant(Smi::FromInt(1)));
727 StoreObjectFieldNoWriteBarrier(allocation_site, 726 StoreObjectFieldNoWriteBarrier(allocation_site,
728 AllocationSite::kPretenureCreateCountOffset, 727 AllocationSite::kPretenureCreateCountOffset,
729 memento_create_count); 728 memento_create_count);
730 } 729 }
731 730
731 // Directly copy over the property store for dict-mode boilerplates.
732 Label dict_properties(this), done(this);
733 Branch(IsDictionaryMap(boilerplate_map), &dict_properties, &done);
734 Bind(&dict_properties);
735 {
736 Comment("Copy boilderplate property dict");
737 Node* boilerplate_properties = LoadProperties(boilerplate);
738 // TODO(cbruni): Use inner allocate for name dictionary
739 Node* properties = AllocateNameDictionary(
740 SmiUntag(GetCapacity<NameDictionary>(boilerplate_properties)));
741 CopyFixedArrayElements(FAST_ELEMENTS, boilerplate_properties, properties,
742 LoadFixedArrayBaseLength(boilerplate_properties),
743 SKIP_WRITE_BARRIER, SMI_PARAMETERS);
Toon Verwaest 2017/03/14 13:27:47 With black allocation I'm not sure this is safe if
Camillo Bruni 2017/03/17 16:40:55 Adding separate helper to make the contract cleare
744 StoreObjectField(copy, JSObject::kPropertiesOffset, properties);
745 Goto(&done);
746 }
747 Bind(&done);
748
732 // TODO(verwaest): Allocate and fill in double boxes. 749 // TODO(verwaest): Allocate and fill in double boxes.
733 return copy; 750 return copy;
734 } 751 }
735 752
736 void ConstructorBuiltinsAssembler::CreateFastCloneShallowObjectBuiltin( 753 void ConstructorBuiltinsAssembler::CreateFastCloneShallowObjectBuiltin(
737 int properties_count) { 754 int properties_count) {
738 DCHECK_GE(properties_count, 0); 755 DCHECK_GE(properties_count, 0);
739 DCHECK_LE(properties_count, kMaximumClonedShallowObjectProperties); 756 DCHECK_LE(properties_count, kMaximumClonedShallowObjectProperties);
740 Label call_runtime(this); 757 Label call_runtime(this);
741 Node* closure = Parameter(0); 758 Node* closure = Parameter(0);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 case 6: 802 case 6:
786 return FastCloneShallowObject6(); 803 return FastCloneShallowObject6();
787 default: 804 default:
788 UNREACHABLE(); 805 UNREACHABLE();
789 } 806 }
790 return Handle<Code>::null(); 807 return Handle<Code>::null();
791 } 808 }
792 809
793 } // namespace internal 810 } // namespace internal
794 } // namespace v8 811 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698