OLD | NEW |
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 4102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4113 | 4113 |
4114 | 4114 |
4115 void FastCloneShallowArrayStub::InitializeDescriptor( | 4115 void FastCloneShallowArrayStub::InitializeDescriptor( |
4116 CodeStubDescriptor* descriptor) { | 4116 CodeStubDescriptor* descriptor) { |
4117 FastCloneShallowArrayDescriptor call_descriptor(isolate()); | 4117 FastCloneShallowArrayDescriptor call_descriptor(isolate()); |
4118 descriptor->Initialize( | 4118 descriptor->Initialize( |
4119 Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry); | 4119 Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry); |
4120 } | 4120 } |
4121 | 4121 |
4122 | 4122 |
4123 void CreateWeakCellStub::InitializeDescriptor(CodeStubDescriptor* d) {} | |
4124 | |
4125 | |
4126 void RegExpConstructResultStub::InitializeDescriptor( | 4123 void RegExpConstructResultStub::InitializeDescriptor( |
4127 CodeStubDescriptor* descriptor) { | 4124 CodeStubDescriptor* descriptor) { |
4128 descriptor->Initialize( | 4125 descriptor->Initialize( |
4129 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry); | 4126 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry); |
4130 } | 4127 } |
4131 | 4128 |
4132 | 4129 |
4133 void TransitionElementsKindStub::InitializeDescriptor( | 4130 void TransitionElementsKindStub::InitializeDescriptor( |
4134 CodeStubDescriptor* descriptor) { | 4131 CodeStubDescriptor* descriptor) { |
4135 descriptor->Initialize( | 4132 descriptor->Initialize( |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4703 entry_hook(function, stack_pointer); | 4700 entry_hook(function, stack_pointer); |
4704 } | 4701 } |
4705 | 4702 |
4706 void CreateAllocationSiteStub::GenerateAssembly( | 4703 void CreateAllocationSiteStub::GenerateAssembly( |
4707 CodeStubAssembler* assembler) const { | 4704 CodeStubAssembler* assembler) const { |
4708 typedef compiler::Node Node; | 4705 typedef compiler::Node Node; |
4709 Node* size = assembler->IntPtrConstant(AllocationSite::kSize); | 4706 Node* size = assembler->IntPtrConstant(AllocationSite::kSize); |
4710 Node* site = assembler->Allocate(size, compiler::CodeAssembler::kPretenured); | 4707 Node* site = assembler->Allocate(size, compiler::CodeAssembler::kPretenured); |
4711 | 4708 |
4712 // Store the map | 4709 // Store the map |
4713 Node* map = | 4710 assembler->StoreObjectFieldRoot(site, AllocationSite::kMapOffset, |
4714 assembler->HeapConstant(isolate()->factory()->allocation_site_map()); | 4711 Heap::kAllocationSiteMapRootIndex); |
4715 assembler->StoreMapNoWriteBarrier(site, map); | |
4716 | 4712 |
4717 Node* kind = | 4713 Node* kind = |
4718 assembler->SmiConstant(Smi::FromInt(GetInitialFastElementsKind())); | 4714 assembler->SmiConstant(Smi::FromInt(GetInitialFastElementsKind())); |
4719 assembler->StoreObjectFieldNoWriteBarrier( | 4715 assembler->StoreObjectFieldNoWriteBarrier( |
4720 site, AllocationSite::kTransitionInfoOffset, kind); | 4716 site, AllocationSite::kTransitionInfoOffset, kind); |
4721 | 4717 |
4722 // Unlike literals, constructed arrays don't have nested sites | 4718 // Unlike literals, constructed arrays don't have nested sites |
4723 Node* zero = assembler->IntPtrConstant(0); | 4719 Node* zero = assembler->IntPtrConstant(0); |
4724 assembler->StoreObjectFieldNoWriteBarrier( | 4720 assembler->StoreObjectFieldNoWriteBarrier( |
4725 site, AllocationSite::kNestedSiteOffset, zero); | 4721 site, AllocationSite::kNestedSiteOffset, zero); |
4726 | 4722 |
4727 // Pretenuring calculation field. | 4723 // Pretenuring calculation field. |
4728 assembler->StoreObjectFieldNoWriteBarrier( | 4724 assembler->StoreObjectFieldNoWriteBarrier( |
4729 site, AllocationSite::kPretenureDataOffset, zero); | 4725 site, AllocationSite::kPretenureDataOffset, zero); |
4730 | 4726 |
4731 // Pretenuring memento creation count field. | 4727 // Pretenuring memento creation count field. |
4732 assembler->StoreObjectFieldNoWriteBarrier( | 4728 assembler->StoreObjectFieldNoWriteBarrier( |
4733 site, AllocationSite::kPretenureCreateCountOffset, zero); | 4729 site, AllocationSite::kPretenureCreateCountOffset, zero); |
4734 | 4730 |
4735 // Store an empty fixed array for the code dependency. | 4731 // Store an empty fixed array for the code dependency. |
4736 Node* empty_fixed_array = | 4732 assembler->StoreObjectFieldRoot(site, AllocationSite::kDependentCodeOffset, |
4737 assembler->HeapConstant(isolate()->factory()->empty_fixed_array()); | 4733 Heap::kEmptyFixedArrayRootIndex); |
4738 assembler->StoreObjectFieldNoWriteBarrier( | |
4739 site, AllocationSite::kDependentCodeOffset, empty_fixed_array); | |
4740 | 4734 |
4741 // Link the object to the allocation site list | 4735 // Link the object to the allocation site list |
4742 Node* site_list = assembler->ExternalConstant( | 4736 Node* site_list = assembler->ExternalConstant( |
4743 ExternalReference::allocation_sites_list_address(isolate())); | 4737 ExternalReference::allocation_sites_list_address(isolate())); |
4744 Node* next_site = assembler->LoadBufferObject(site_list, 0); | 4738 Node* next_site = assembler->LoadBufferObject(site_list, 0); |
4745 | 4739 |
4746 // TODO(mvstanton): This is a store to a weak pointer, which we may want to | 4740 // TODO(mvstanton): This is a store to a weak pointer, which we may want to |
4747 // mark as such in order to skip the write barrier, once we have a unified | 4741 // mark as such in order to skip the write barrier, once we have a unified |
4748 // system for weakness. For now we decided to keep it like this because having | 4742 // system for weakness. For now we decided to keep it like this because having |
4749 // an initial write barrier backed store makes this pointer strong until the | 4743 // an initial write barrier backed store makes this pointer strong until the |
4750 // next GC, and allocation sites are designed to survive several GCs anyway. | 4744 // next GC, and allocation sites are designed to survive several GCs anyway. |
4751 assembler->StoreObjectField(site, AllocationSite::kWeakNextOffset, next_site); | 4745 assembler->StoreObjectField(site, AllocationSite::kWeakNextOffset, next_site); |
4752 assembler->StoreNoWriteBarrier(MachineRepresentation::kTagged, site_list, | 4746 assembler->StoreNoWriteBarrier(MachineRepresentation::kTagged, site_list, |
4753 site); | 4747 site); |
4754 | 4748 |
4755 Node* feedback_vector = assembler->Parameter(Descriptor::kVector); | 4749 Node* feedback_vector = assembler->Parameter(Descriptor::kVector); |
4756 Node* slot = assembler->Parameter(Descriptor::kSlot); | 4750 Node* slot = assembler->Parameter(Descriptor::kSlot); |
4757 | 4751 |
4758 assembler->StoreFixedArrayElement(feedback_vector, slot, site, | 4752 assembler->StoreFixedArrayElement(feedback_vector, slot, site, |
4759 UPDATE_WRITE_BARRIER, | 4753 UPDATE_WRITE_BARRIER, |
4760 CodeStubAssembler::SMI_PARAMETERS); | 4754 CodeStubAssembler::SMI_PARAMETERS); |
4761 | 4755 |
4762 assembler->Return(site); | 4756 assembler->Return(site); |
4763 } | 4757 } |
4764 | 4758 |
| 4759 void CreateWeakCellStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
| 4760 assembler->Return(assembler->CreateWeakCellInFeedbackVector( |
| 4761 assembler->Parameter(Descriptor::kVector), |
| 4762 assembler->Parameter(Descriptor::kSlot), |
| 4763 assembler->Parameter(Descriptor::kValue))); |
| 4764 } |
| 4765 |
4765 void ArrayNoArgumentConstructorStub::GenerateAssembly( | 4766 void ArrayNoArgumentConstructorStub::GenerateAssembly( |
4766 CodeStubAssembler* assembler) const { | 4767 CodeStubAssembler* assembler) const { |
4767 typedef compiler::Node Node; | 4768 typedef compiler::Node Node; |
4768 Node* native_context = assembler->LoadObjectField( | 4769 Node* native_context = assembler->LoadObjectField( |
4769 assembler->Parameter(Descriptor::kFunction), JSFunction::kContextOffset); | 4770 assembler->Parameter(Descriptor::kFunction), JSFunction::kContextOffset); |
4770 bool track_allocation_site = | 4771 bool track_allocation_site = |
4771 AllocationSite::GetMode(elements_kind()) == TRACK_ALLOCATION_SITE && | 4772 AllocationSite::GetMode(elements_kind()) == TRACK_ALLOCATION_SITE && |
4772 override_mode() != DISABLE_ALLOCATION_SITES; | 4773 override_mode() != DISABLE_ALLOCATION_SITES; |
4773 Node* allocation_site = | 4774 Node* allocation_site = |
4774 track_allocation_site ? assembler->Parameter(Descriptor::kAllocationSite) | 4775 track_allocation_site ? assembler->Parameter(Descriptor::kAllocationSite) |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4923 if (type->Is(Type::UntaggedPointer())) { | 4924 if (type->Is(Type::UntaggedPointer())) { |
4924 return Representation::External(); | 4925 return Representation::External(); |
4925 } | 4926 } |
4926 | 4927 |
4927 DCHECK(!type->Is(Type::Untagged())); | 4928 DCHECK(!type->Is(Type::Untagged())); |
4928 return Representation::Tagged(); | 4929 return Representation::Tagged(); |
4929 } | 4930 } |
4930 | 4931 |
4931 } // namespace internal | 4932 } // namespace internal |
4932 } // namespace v8 | 4933 } // namespace v8 |
OLD | NEW |