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

Unified Diff: src/code-stubs.cc

Issue 2184073002: [stubs] Port CreateAllocationSiteStub to Turbofan (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index b1b6cb7eb42c7f9a29a2641b43bb4d252920f65f..bb593d6e6ead79ae8f6656b0a5032eee5bb6dec4 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -4120,9 +4120,6 @@ void FastCloneShallowArrayStub::InitializeDescriptor(
}
-void CreateAllocationSiteStub::InitializeDescriptor(CodeStubDescriptor* d) {}
-
-
void CreateWeakCellStub::InitializeDescriptor(CodeStubDescriptor* d) {}
@@ -4706,6 +4703,65 @@ void ProfileEntryHookStub::EntryHookTrampoline(intptr_t function,
entry_hook(function, stack_pointer);
}
+void CreateAllocationSiteStub::GenerateAssembly(
+ CodeStubAssembler* assembler) const {
+ typedef compiler::Node Node;
+ Node* size = assembler->IntPtrConstant(AllocationSite::kSize);
+ Node* site = assembler->Allocate(size, compiler::CodeAssembler::kPretenured);
+
+ // Store the map
+ Node* map =
+ assembler->HeapConstant(isolate()->factory()->allocation_site_map());
+ assembler->StoreMapNoWriteBarrier(site, map);
+
+ Node* kind =
+ assembler->SmiConstant(Smi::FromInt(GetInitialFastElementsKind()));
+ assembler->StoreObjectFieldNoWriteBarrier(
+ site, AllocationSite::kTransitionInfoOffset, kind);
+
+ // Unlike literals, constructed arrays don't have nested sites
+ Node* zero = assembler->IntPtrConstant(0);
+ assembler->StoreObjectFieldNoWriteBarrier(
+ site, AllocationSite::kNestedSiteOffset, zero);
+
+ // Pretenuring calculation field.
+ assembler->StoreObjectFieldNoWriteBarrier(
+ site, AllocationSite::kPretenureDataOffset, zero);
+
+ // Pretenuring memento creation count field.
+ assembler->StoreObjectFieldNoWriteBarrier(
+ site, AllocationSite::kPretenureCreateCountOffset, zero);
+
+ // Store an empty fixed array for the code dependency.
+ Node* empty_fixed_array =
+ assembler->HeapConstant(isolate()->factory()->empty_fixed_array());
+ assembler->StoreObjectFieldNoWriteBarrier(
+ site, AllocationSite::kDependentCodeOffset, empty_fixed_array);
+
+ // Link the object to the allocation site list
+ Node* site_list = assembler->ExternalConstant(
+ ExternalReference::allocation_sites_list_address(isolate()));
+ Node* next_site = assembler->LoadBufferObject(site_list, 0);
+
+ // TODO(mvstanton): This is a store to a weak pointer, which we may want to
+ // mark as such in order to skip the write barrier, once we have a unified
+ // system for weakness. For now we decided to keep it like this because having
+ // an initial write barrier backed store makes this pointer strong until the
+ // next GC, and allocation sites are designed to survive several GCs anyway.
+ assembler->StoreObjectField(site, AllocationSite::kWeakNextOffset, next_site);
+ assembler->StoreNoWriteBarrier(MachineRepresentation::kTagged, site_list,
+ site);
+
+ Node* feedback_vector = assembler->Parameter(Descriptor::kVector);
+ Node* slot = assembler->Parameter(Descriptor::kSlot);
+
+ assembler->StoreFixedArrayElement(feedback_vector, slot, site,
+ UPDATE_WRITE_BARRIER,
+ CodeStubAssembler::SMI_PARAMETERS);
+
+ assembler->Return(site);
+}
+
void ArrayNoArgumentConstructorStub::GenerateAssembly(
CodeStubAssembler* assembler) const {
typedef compiler::Node Node;
« 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