[ignition] inline allocation site creation to call/constructor handlers.
BUG= Review-Url: https://codereview.chromium.org/2342533002 Cr-Commit-Position: refs/heads/master@{#39418}
This commit is contained in:
parent
ee50e89b40
commit
0bcef939dc
@ -4949,6 +4949,52 @@ void CodeStubAssembler::CheckEnumCache(Node* receiver, Label* use_cache,
|
||||
}
|
||||
}
|
||||
|
||||
Node* CodeStubAssembler::CreateAllocationSiteInFeedbackVector(
|
||||
Node* feedback_vector, Node* slot) {
|
||||
Node* size = IntPtrConstant(AllocationSite::kSize);
|
||||
Node* site = Allocate(size, CodeStubAssembler::kPretenured);
|
||||
|
||||
// Store the map
|
||||
StoreObjectFieldRoot(site, AllocationSite::kMapOffset,
|
||||
Heap::kAllocationSiteMapRootIndex);
|
||||
Node* kind = SmiConstant(Smi::FromInt(GetInitialFastElementsKind()));
|
||||
StoreObjectFieldNoWriteBarrier(site, AllocationSite::kTransitionInfoOffset,
|
||||
kind);
|
||||
|
||||
// Unlike literals, constructed arrays don't have nested sites
|
||||
Node* zero = IntPtrConstant(0);
|
||||
StoreObjectFieldNoWriteBarrier(site, AllocationSite::kNestedSiteOffset, zero);
|
||||
|
||||
// Pretenuring calculation field.
|
||||
StoreObjectFieldNoWriteBarrier(site, AllocationSite::kPretenureDataOffset,
|
||||
zero);
|
||||
|
||||
// Pretenuring memento creation count field.
|
||||
StoreObjectFieldNoWriteBarrier(
|
||||
site, AllocationSite::kPretenureCreateCountOffset, zero);
|
||||
|
||||
// Store an empty fixed array for the code dependency.
|
||||
StoreObjectFieldRoot(site, AllocationSite::kDependentCodeOffset,
|
||||
Heap::kEmptyFixedArrayRootIndex);
|
||||
|
||||
// Link the object to the allocation site list
|
||||
Node* site_list = ExternalConstant(
|
||||
ExternalReference::allocation_sites_list_address(isolate()));
|
||||
Node* next_site = 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.
|
||||
StoreObjectField(site, AllocationSite::kWeakNextOffset, next_site);
|
||||
StoreNoWriteBarrier(MachineRepresentation::kTagged, site_list, site);
|
||||
|
||||
StoreFixedArrayElement(feedback_vector, slot, site, UPDATE_WRITE_BARRIER,
|
||||
CodeStubAssembler::SMI_PARAMETERS);
|
||||
return site;
|
||||
}
|
||||
|
||||
Node* CodeStubAssembler::CreateWeakCellInFeedbackVector(Node* feedback_vector,
|
||||
Node* slot,
|
||||
Node* value) {
|
||||
|
@ -706,6 +706,10 @@ class CodeStubAssembler : public compiler::CodeAssembler {
|
||||
compiler::Node* feedback_vector, compiler::Node* slot,
|
||||
compiler::Node* value);
|
||||
|
||||
// Create a new AllocationSite and install it into a feedback vector.
|
||||
compiler::Node* CreateAllocationSiteInFeedbackVector(
|
||||
compiler::Node* feedback_vector, compiler::Node* slot);
|
||||
|
||||
compiler::Node* GetFixedAarrayAllocationSize(compiler::Node* element_count,
|
||||
ElementsKind kind,
|
||||
ParameterMode mode) {
|
||||
|
@ -5833,58 +5833,9 @@ void ProfileEntryHookStub::EntryHookTrampoline(intptr_t function,
|
||||
|
||||
void CreateAllocationSiteStub::GenerateAssembly(
|
||||
CodeStubAssembler* assembler) const {
|
||||
typedef compiler::Node Node;
|
||||
Node* size = assembler->IntPtrConstant(AllocationSite::kSize);
|
||||
Node* site = assembler->Allocate(size, CodeStubAssembler::kPretenured);
|
||||
|
||||
// Store the map
|
||||
assembler->StoreObjectFieldRoot(site, AllocationSite::kMapOffset,
|
||||
Heap::kAllocationSiteMapRootIndex);
|
||||
|
||||
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.
|
||||
assembler->StoreObjectFieldRoot(site, AllocationSite::kDependentCodeOffset,
|
||||
Heap::kEmptyFixedArrayRootIndex);
|
||||
|
||||
// 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);
|
||||
assembler->Return(assembler->CreateAllocationSiteInFeedbackVector(
|
||||
assembler->Parameter(Descriptor::kVector),
|
||||
assembler->Parameter(Descriptor::kSlot)));
|
||||
}
|
||||
|
||||
void CreateWeakCellStub::GenerateAssembly(CodeStubAssembler* assembler) const {
|
||||
|
@ -646,11 +646,8 @@ Node* InterpreterAssembler::CallJSWithFeedback(Node* function, Node* context,
|
||||
|
||||
Bind(&create_allocation_site);
|
||||
{
|
||||
// TODO(mythria): Inline the creation of the allocation site.
|
||||
CreateAllocationSiteStub create_stub(isolate());
|
||||
CallStub(create_stub.GetCallInterfaceDescriptor(),
|
||||
HeapConstant(create_stub.GetCode()), context,
|
||||
type_feedback_vector, SmiTag(slot_id));
|
||||
CreateAllocationSiteInFeedbackVector(type_feedback_vector,
|
||||
SmiTag(slot_id));
|
||||
|
||||
// Call using CallFunction builtin. CallICs have a PREMONOMORPHIC state.
|
||||
// They start collecting feedback only when a call is executed the second
|
||||
@ -835,14 +832,9 @@ Node* InterpreterAssembler::CallConstruct(Node* constructor, Node* context,
|
||||
|
||||
Bind(&create_allocation_site);
|
||||
{
|
||||
// TODO(mythria): Inline the creation of allocation site.
|
||||
CreateAllocationSiteStub create_stub(isolate());
|
||||
CallStub(create_stub.GetCallInterfaceDescriptor(),
|
||||
HeapConstant(create_stub.GetCode()), context,
|
||||
type_feedback_vector, SmiTag(slot_id));
|
||||
Node* feedback_element =
|
||||
LoadFixedArrayElement(type_feedback_vector, slot_id);
|
||||
allocation_feedback.Bind(feedback_element);
|
||||
Node* site = CreateAllocationSiteInFeedbackVector(
|
||||
type_feedback_vector, SmiTag(slot_id));
|
||||
allocation_feedback.Bind(site);
|
||||
Goto(&call_construct_function);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user