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/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 5815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5826 void ProfileEntryHookStub::EntryHookTrampoline(intptr_t function, | 5826 void ProfileEntryHookStub::EntryHookTrampoline(intptr_t function, |
5827 intptr_t stack_pointer, | 5827 intptr_t stack_pointer, |
5828 Isolate* isolate) { | 5828 Isolate* isolate) { |
5829 FunctionEntryHook entry_hook = isolate->function_entry_hook(); | 5829 FunctionEntryHook entry_hook = isolate->function_entry_hook(); |
5830 DCHECK(entry_hook != NULL); | 5830 DCHECK(entry_hook != NULL); |
5831 entry_hook(function, stack_pointer); | 5831 entry_hook(function, stack_pointer); |
5832 } | 5832 } |
5833 | 5833 |
5834 void CreateAllocationSiteStub::GenerateAssembly( | 5834 void CreateAllocationSiteStub::GenerateAssembly( |
5835 CodeStubAssembler* assembler) const { | 5835 CodeStubAssembler* assembler) const { |
5836 typedef compiler::Node Node; | 5836 assembler->Return(assembler->CreateAllocationSiteInFeedbackVector( |
5837 Node* size = assembler->IntPtrConstant(AllocationSite::kSize); | 5837 assembler->Parameter(Descriptor::kVector), |
5838 Node* site = assembler->Allocate(size, CodeStubAssembler::kPretenured); | 5838 assembler->Parameter(Descriptor::kSlot))); |
5839 | |
5840 // Store the map | |
5841 assembler->StoreObjectFieldRoot(site, AllocationSite::kMapOffset, | |
5842 Heap::kAllocationSiteMapRootIndex); | |
5843 | |
5844 Node* kind = | |
5845 assembler->SmiConstant(Smi::FromInt(GetInitialFastElementsKind())); | |
5846 assembler->StoreObjectFieldNoWriteBarrier( | |
5847 site, AllocationSite::kTransitionInfoOffset, kind); | |
5848 | |
5849 // Unlike literals, constructed arrays don't have nested sites | |
5850 Node* zero = assembler->IntPtrConstant(0); | |
5851 assembler->StoreObjectFieldNoWriteBarrier( | |
5852 site, AllocationSite::kNestedSiteOffset, zero); | |
5853 | |
5854 // Pretenuring calculation field. | |
5855 assembler->StoreObjectFieldNoWriteBarrier( | |
5856 site, AllocationSite::kPretenureDataOffset, zero); | |
5857 | |
5858 // Pretenuring memento creation count field. | |
5859 assembler->StoreObjectFieldNoWriteBarrier( | |
5860 site, AllocationSite::kPretenureCreateCountOffset, zero); | |
5861 | |
5862 // Store an empty fixed array for the code dependency. | |
5863 assembler->StoreObjectFieldRoot(site, AllocationSite::kDependentCodeOffset, | |
5864 Heap::kEmptyFixedArrayRootIndex); | |
5865 | |
5866 // Link the object to the allocation site list | |
5867 Node* site_list = assembler->ExternalConstant( | |
5868 ExternalReference::allocation_sites_list_address(isolate())); | |
5869 Node* next_site = assembler->LoadBufferObject(site_list, 0); | |
5870 | |
5871 // TODO(mvstanton): This is a store to a weak pointer, which we may want to | |
5872 // mark as such in order to skip the write barrier, once we have a unified | |
5873 // system for weakness. For now we decided to keep it like this because having | |
5874 // an initial write barrier backed store makes this pointer strong until the | |
5875 // next GC, and allocation sites are designed to survive several GCs anyway. | |
5876 assembler->StoreObjectField(site, AllocationSite::kWeakNextOffset, next_site); | |
5877 assembler->StoreNoWriteBarrier(MachineRepresentation::kTagged, site_list, | |
5878 site); | |
5879 | |
5880 Node* feedback_vector = assembler->Parameter(Descriptor::kVector); | |
5881 Node* slot = assembler->Parameter(Descriptor::kSlot); | |
5882 | |
5883 assembler->StoreFixedArrayElement(feedback_vector, slot, site, | |
5884 UPDATE_WRITE_BARRIER, | |
5885 CodeStubAssembler::SMI_PARAMETERS); | |
5886 | |
5887 assembler->Return(site); | |
5888 } | 5839 } |
5889 | 5840 |
5890 void CreateWeakCellStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 5841 void CreateWeakCellStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
5891 assembler->Return(assembler->CreateWeakCellInFeedbackVector( | 5842 assembler->Return(assembler->CreateWeakCellInFeedbackVector( |
5892 assembler->Parameter(Descriptor::kVector), | 5843 assembler->Parameter(Descriptor::kVector), |
5893 assembler->Parameter(Descriptor::kSlot), | 5844 assembler->Parameter(Descriptor::kSlot), |
5894 assembler->Parameter(Descriptor::kValue))); | 5845 assembler->Parameter(Descriptor::kValue))); |
5895 } | 5846 } |
5896 | 5847 |
5897 void ArrayNoArgumentConstructorStub::GenerateAssembly( | 5848 void ArrayNoArgumentConstructorStub::GenerateAssembly( |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6083 | 6034 |
6084 if (type == MachineType::Pointer()) { | 6035 if (type == MachineType::Pointer()) { |
6085 return Representation::External(); | 6036 return Representation::External(); |
6086 } | 6037 } |
6087 | 6038 |
6088 return Representation::Tagged(); | 6039 return Representation::Tagged(); |
6089 } | 6040 } |
6090 | 6041 |
6091 } // namespace internal | 6042 } // namespace internal |
6092 } // namespace v8 | 6043 } // namespace v8 |
OLD | NEW |