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

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

Issue 2445333002: Ensure slow properties for simple {__proto__:null} literals. (Closed)
Patch Set: fixing typo 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/ast/ast.h" 5 #include "src/ast/ast.h"
6 #include "src/builtins/builtins-constructor.h" 6 #include "src/builtins/builtins-constructor.h"
7 #include "src/builtins/builtins-utils-gen.h" 7 #include "src/builtins/builtins-utils-gen.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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 637
638 Node* ConstructorBuiltinsAssembler::EmitFastCloneShallowObject( 638 Node* ConstructorBuiltinsAssembler::EmitFastCloneShallowObject(
639 Label* call_runtime, Node* closure, Node* literals_index, 639 Label* call_runtime, Node* closure, Node* literals_index,
640 Node* properties_count) { 640 Node* properties_count) {
641 Node* cell = LoadObjectField(closure, JSFunction::kFeedbackVectorOffset); 641 Node* cell = LoadObjectField(closure, JSFunction::kFeedbackVectorOffset);
642 Node* feedback_vector = LoadObjectField(cell, Cell::kValueOffset); 642 Node* feedback_vector = LoadObjectField(cell, Cell::kValueOffset);
643 Node* allocation_site = LoadFixedArrayElement( 643 Node* allocation_site = LoadFixedArrayElement(
644 feedback_vector, literals_index, 0, CodeStubAssembler::SMI_PARAMETERS); 644 feedback_vector, literals_index, 0, CodeStubAssembler::SMI_PARAMETERS);
645 GotoIf(IsUndefined(allocation_site), call_runtime); 645 GotoIf(IsUndefined(allocation_site), call_runtime);
646 646
647 Node* boilerplate =
648 LoadObjectField(allocation_site, AllocationSite::kTransitionInfoOffset);
649 Node* boilerplate_map = LoadMap(boilerplate);
650 Variable properties(this, MachineRepresentation::kTagged,
651 EmptyFixedArrayConstant());
652 // Directly copy over the property store for dict-mode boilerplates.
653 Label dict_properties(this), allocate_object(this);
654 Branch(IsDictionaryMap(boilerplate_map), &dict_properties, &allocate_object);
655 Bind(&dict_properties);
656 {
657 properties.Bind(
658 CopyNameDictionary(LoadProperties(boilerplate), call_runtime));
659 Goto(&allocate_object);
660 }
661 Bind(&allocate_object);
662
647 // Calculate the object and allocation size based on the properties count. 663 // Calculate the object and allocation size based on the properties count.
648 Node* object_size = IntPtrAdd(WordShl(properties_count, kPointerSizeLog2), 664 Node* object_size = IntPtrAdd(WordShl(properties_count, kPointerSizeLog2),
649 IntPtrConstant(JSObject::kHeaderSize)); 665 IntPtrConstant(JSObject::kHeaderSize));
650 Node* allocation_size = object_size; 666 Node* allocation_size = object_size;
651 if (FLAG_allocation_site_pretenuring) { 667 if (FLAG_allocation_site_pretenuring) {
652 allocation_size = 668 allocation_size =
653 IntPtrAdd(object_size, IntPtrConstant(AllocationMemento::kSize)); 669 IntPtrAdd(object_size, IntPtrConstant(AllocationMemento::kSize));
654 } 670 }
655 Node* boilerplate = 671
656 LoadObjectField(allocation_site, AllocationSite::kTransitionInfoOffset);
657 Node* boilerplate_map = LoadMap(boilerplate);
658 Node* instance_size = LoadMapInstanceSize(boilerplate_map); 672 Node* instance_size = LoadMapInstanceSize(boilerplate_map);
659 Node* size_in_words = WordShr(object_size, kPointerSizeLog2); 673 Node* size_in_words = WordShr(object_size, kPointerSizeLog2);
660 GotoIfNot(WordEqual(instance_size, size_in_words), call_runtime); 674 GotoIfNot(WordEqual(instance_size, size_in_words), call_runtime);
661 675
662 Node* copy = AllocateInNewSpace(allocation_size); 676 Node* copy = AllocateInNewSpace(allocation_size);
663 677
678 StoreObjectFieldNoWriteBarrier(copy, JSObject::kPropertiesOffset,
679 properties.value());
Toon Verwaest 2017/03/20 14:47:11 Isn't this field overwritten by the initialization
664 // Copy boilerplate elements. 680 // Copy boilerplate elements.
665 Variable offset(this, MachineType::PointerRepresentation()); 681 Variable offset(this, MachineType::PointerRepresentation());
666 offset.Bind(IntPtrConstant(-kHeapObjectTag)); 682 offset.Bind(IntPtrConstant(-kHeapObjectTag));
667 Node* end_offset = IntPtrAdd(object_size, offset.value()); 683 Node* end_offset = IntPtrAdd(object_size, offset.value());
668 Label loop_body(this, &offset), loop_check(this, &offset); 684 Label loop_body(this, &offset), loop_check(this, &offset);
669 // We should always have an object size greater than zero. 685 // We should always have an object size greater than zero.
670 Goto(&loop_body); 686 Goto(&loop_body);
671 Bind(&loop_body); 687 Bind(&loop_body);
672 { 688 {
673 // The Allocate above guarantees that the copy lies in new space. This 689 // The Allocate above guarantees that the copy lies in new space. This
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 SHALLOW_OBJECT_BUILTIN(0); 748 SHALLOW_OBJECT_BUILTIN(0);
733 SHALLOW_OBJECT_BUILTIN(1); 749 SHALLOW_OBJECT_BUILTIN(1);
734 SHALLOW_OBJECT_BUILTIN(2); 750 SHALLOW_OBJECT_BUILTIN(2);
735 SHALLOW_OBJECT_BUILTIN(3); 751 SHALLOW_OBJECT_BUILTIN(3);
736 SHALLOW_OBJECT_BUILTIN(4); 752 SHALLOW_OBJECT_BUILTIN(4);
737 SHALLOW_OBJECT_BUILTIN(5); 753 SHALLOW_OBJECT_BUILTIN(5);
738 SHALLOW_OBJECT_BUILTIN(6); 754 SHALLOW_OBJECT_BUILTIN(6);
739 755
740 } // namespace internal 756 } // namespace internal
741 } // namespace v8 757 } // namespace v8
OLDNEW
« src/ast/ast.cc ('K') | « src/bootstrapper.cc ('k') | src/code-stub-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698