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

Side by Side Diff: src/code-stubs.cc

Issue 1888043006: Revert of Migrate FastCloneShallowObjectStub to TurboFan (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/code-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 3605 matching lines...) Expand 10 before | Expand all | Expand 10 after
3616 &if_keyisinvalid); 3616 &if_keyisinvalid);
3617 assembler->Bind(&if_keyispositivesmi); 3617 assembler->Bind(&if_keyispositivesmi);
3618 assembler->TailCallRuntime(Runtime::kLoadElementWithInterceptor, context, 3618 assembler->TailCallRuntime(Runtime::kLoadElementWithInterceptor, context,
3619 receiver, key); 3619 receiver, key);
3620 3620
3621 assembler->Bind(&if_keyisinvalid); 3621 assembler->Bind(&if_keyisinvalid);
3622 assembler->TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key, 3622 assembler->TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key,
3623 slot, vector); 3623 slot, vector);
3624 } 3624 }
3625 3625
3626 void FastCloneShallowObjectStub::GenerateAssembly(
3627 compiler::CodeStubAssembler* assembler) const {
3628 typedef compiler::CodeStubAssembler::Label Label;
3629 typedef compiler::Node Node;
3630 Label call_runtime(assembler);
3631 Node* closure = assembler->Parameter(0);
3632 Node* literals_index = assembler->Parameter(1);
3633
3634 Node* undefined = assembler->UndefinedConstant();
3635 Node* literals_array =
3636 assembler->LoadObjectField(closure, JSFunction::kLiteralsOffset);
3637 Node* allocation_site = assembler->LoadFixedArrayElementSmiIndex(
3638 literals_array, literals_index,
3639 LiteralsArray::kFirstLiteralIndex * kPointerSize);
3640 assembler->GotoIf(assembler->WordEqual(allocation_site, undefined),
3641 &call_runtime);
3642
3643 Node* boilerplate = assembler->LoadObjectField(
3644 allocation_site, AllocationSite::kTransitionInfoOffset);
3645
3646 int length = this->length();
3647 if (length == 0) {
3648 length = JSObject::kInitialGlobalObjectUnusedPropertiesCount;
3649 }
3650 int size = JSObject::kHeaderSize + length * kPointerSize;
3651 int object_size = size;
3652 if (FLAG_allocation_site_pretenuring) {
3653 size += AllocationMemento::kSize;
3654 }
3655
3656 Node* boilerplate_map = assembler->LoadMap(boilerplate);
3657 Node* instance_size = assembler->LoadMapInstanceSize(boilerplate_map);
3658 Node* size_in_words =
3659 assembler->Int32Constant(object_size >> kPointerSizeLog2);
3660 assembler->GotoUnless(assembler->Word32Equal(instance_size, size_in_words),
3661 &call_runtime);
3662
3663 Node* copy = assembler->Allocate(size);
3664
3665 for (int i = 0; i < size; i += kPointerSize) {
3666 // The Allocate above guarantees that the copy lies in new space. This
3667 // allows us to skip write barriers. This is necessary since we may also be
3668 // copying unboxed doubles.
3669 Node* field =
3670 assembler->LoadObjectField(boilerplate, i, MachineType::IntPtr());
3671 assembler->StoreObjectFieldNoWriteBarrier(
3672 copy, i, field, MachineType::PointerRepresentation());
3673 }
3674
3675 if (FLAG_allocation_site_pretenuring) {
3676 Node* memento = assembler->InnerAllocate(copy, object_size);
3677 assembler->StoreObjectFieldNoWriteBarrier(
3678 memento, HeapObject::kMapOffset,
3679 assembler->LoadRoot(Heap::kAllocationMementoMapRootIndex));
3680 assembler->StoreObjectFieldNoWriteBarrier(
3681 memento, AllocationMemento::kAllocationSiteOffset, allocation_site);
3682 Node* memento_create_count = assembler->LoadObjectField(
3683 allocation_site, AllocationSite::kPretenureCreateCountOffset);
3684 memento_create_count = assembler->SmiAdd(
3685 memento_create_count, assembler->SmiConstant(Smi::FromInt(1)));
3686 assembler->StoreObjectFieldNoWriteBarrier(
3687 allocation_site, AllocationSite::kPretenureCreateCountOffset,
3688 memento_create_count);
3689 }
3690
3691 // TODO(verwaest): Allocate and fill in double boxes.
3692 assembler->Return(copy);
3693
3694 assembler->Bind(&call_runtime);
3695 Node* constant_properties = assembler->Parameter(2);
3696 Node* flags = assembler->Parameter(3);
3697 Node* context = assembler->Parameter(4);
3698 assembler->TailCallRuntime(Runtime::kCreateObjectLiteral, context, closure,
3699 literals_index, constant_properties, flags);
3700 }
3701
3702 template<class StateType> 3626 template<class StateType>
3703 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) { 3627 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) {
3704 // Note: Although a no-op transition is semantically OK, it is hinting at a 3628 // Note: Although a no-op transition is semantically OK, it is hinting at a
3705 // bug somewhere in our state transition machinery. 3629 // bug somewhere in our state transition machinery.
3706 DCHECK(from != to); 3630 DCHECK(from != to);
3707 if (!FLAG_trace_ic) return; 3631 if (!FLAG_trace_ic) return;
3708 OFStream os(stdout); 3632 OFStream os(stdout);
3709 os << "["; 3633 os << "[";
3710 PrintBaseName(os); 3634 PrintBaseName(os);
3711 os << ": " << from << "=>" << to << "]" << std::endl; 3635 os << ": " << from << "=>" << to << "]" << std::endl;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
3834 3758
3835 3759
3836 void FastCloneShallowArrayStub::InitializeDescriptor( 3760 void FastCloneShallowArrayStub::InitializeDescriptor(
3837 CodeStubDescriptor* descriptor) { 3761 CodeStubDescriptor* descriptor) {
3838 FastCloneShallowArrayDescriptor call_descriptor(isolate()); 3762 FastCloneShallowArrayDescriptor call_descriptor(isolate());
3839 descriptor->Initialize( 3763 descriptor->Initialize(
3840 Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry); 3764 Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry);
3841 } 3765 }
3842 3766
3843 3767
3768 void FastCloneShallowObjectStub::InitializeDescriptor(
3769 CodeStubDescriptor* descriptor) {
3770 FastCloneShallowObjectDescriptor call_descriptor(isolate());
3771 descriptor->Initialize(
3772 Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry);
3773 }
3774
3775
3844 void CreateAllocationSiteStub::InitializeDescriptor(CodeStubDescriptor* d) {} 3776 void CreateAllocationSiteStub::InitializeDescriptor(CodeStubDescriptor* d) {}
3845 3777
3846 3778
3847 void CreateWeakCellStub::InitializeDescriptor(CodeStubDescriptor* d) {} 3779 void CreateWeakCellStub::InitializeDescriptor(CodeStubDescriptor* d) {}
3848 3780
3849 3781
3850 void RegExpConstructResultStub::InitializeDescriptor( 3782 void RegExpConstructResultStub::InitializeDescriptor(
3851 CodeStubDescriptor* descriptor) { 3783 CodeStubDescriptor* descriptor) {
3852 descriptor->Initialize( 3784 descriptor->Initialize(
3853 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry); 3785 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry);
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
4122 if (type->Is(Type::UntaggedPointer())) { 4054 if (type->Is(Type::UntaggedPointer())) {
4123 return Representation::External(); 4055 return Representation::External();
4124 } 4056 }
4125 4057
4126 DCHECK(!type->Is(Type::Untagged())); 4058 DCHECK(!type->Is(Type::Untagged()));
4127 return Representation::Tagged(); 4059 return Representation::Tagged();
4128 } 4060 }
4129 4061
4130 } // namespace internal 4062 } // namespace internal
4131 } // namespace v8 4063 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698