From 3c95790f32ab32465bd83718600b1f4a31c648ed Mon Sep 17 00:00:00 2001 From: "mvstanton@chromium.org" Date: Fri, 22 Nov 2013 07:34:21 +0000 Subject: [PATCH] Pretenuring calculation fields in AllocationSite. AllocationSite-based pretenuring needs additional fields to carry out calculations. R=hpayer@chromium.org Review URL: https://codereview.chromium.org/43603002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17986 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/code-stubs-hydrogen.cc | 16 ++++++++++++++++ src/heap-snapshot-generator.cc | 9 +++++++++ src/objects-inl.h | 7 +++++++ src/objects-printer.cc | 6 ++++++ src/objects.h | 11 ++++++++++- 5 files changed, 48 insertions(+), 1 deletion(-) diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc index 0e690cb..3d42483 100644 --- a/src/code-stubs-hydrogen.cc +++ b/src/code-stubs-hydrogen.cc @@ -511,6 +511,22 @@ HValue* CodeStubGraphBuilder::BuildCodeStub() { AllocationSite::kNestedSiteOffset), graph()->GetConstant0()); + // Pretenuring calculation fields. + Add(object, + HObjectAccess::ForAllocationSiteOffset( + AllocationSite::kMementoFoundCountOffset), + graph()->GetConstant0()); + + Add(object, + HObjectAccess::ForAllocationSiteOffset( + AllocationSite::kMementoCreateCountOffset), + graph()->GetConstant0()); + + Add(object, + HObjectAccess::ForAllocationSiteOffset( + AllocationSite::kPretenureDecisionOffset), + graph()->GetConstant0()); + // Store an empty fixed array for the code dependency. HConstant* empty_fixed_array = Add(isolate()->factory()->empty_fixed_array()); diff --git a/src/heap-snapshot-generator.cc b/src/heap-snapshot-generator.cc index b7b7f22..7e74d86 100644 --- a/src/heap-snapshot-generator.cc +++ b/src/heap-snapshot-generator.cc @@ -1526,6 +1526,15 @@ void V8HeapExplorer::ExtractAllocationSiteReferences(int entry, AllocationSite::kTransitionInfoOffset); SetInternalReference(site, entry, "nested_site", site->nested_site(), AllocationSite::kNestedSiteOffset); + SetInternalReference(site, entry, "memento_found_count", + site->memento_found_count(), + AllocationSite::kMementoFoundCountOffset); + SetInternalReference(site, entry, "memento_create_count", + site->memento_create_count(), + AllocationSite::kMementoCreateCountOffset); + SetInternalReference(site, entry, "pretenure_decision", + site->pretenure_decision(), + AllocationSite::kPretenureDecisionOffset); SetInternalReference(site, entry, "dependent_code", site->dependent_code(), AllocationSite::kDependentCodeOffset); } diff --git a/src/objects-inl.h b/src/objects-inl.h index fa6b6f3..7064ea9 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -1314,6 +1314,9 @@ void AllocationSite::Initialize() { set_transition_info(Smi::FromInt(0)); SetElementsKind(GetInitialFastElementsKind()); set_nested_site(Smi::FromInt(0)); + set_memento_create_count(Smi::FromInt(0)); + set_memento_found_count(Smi::FromInt(0)); + set_pretenure_decision(Smi::FromInt(0)); set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()), SKIP_WRITE_BARRIER); } @@ -4548,6 +4551,10 @@ ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset) ACCESSORS(AllocationSite, transition_info, Object, kTransitionInfoOffset) ACCESSORS(AllocationSite, nested_site, Object, kNestedSiteOffset) +ACCESSORS_TO_SMI(AllocationSite, memento_found_count, kMementoFoundCountOffset) +ACCESSORS_TO_SMI(AllocationSite, memento_create_count, + kMementoCreateCountOffset) +ACCESSORS_TO_SMI(AllocationSite, pretenure_decision, kPretenureDecisionOffset) ACCESSORS(AllocationSite, dependent_code, DependentCode, kDependentCodeOffset) ACCESSORS(AllocationSite, weak_next, Object, kWeakNextOffset) diff --git a/src/objects-printer.cc b/src/objects-printer.cc index 5260193..9f1b939 100644 --- a/src/objects-printer.cc +++ b/src/objects-printer.cc @@ -1125,6 +1125,12 @@ void AllocationSite::AllocationSitePrint(FILE* out) { dependent_code()->ShortPrint(out); PrintF(out, "\n - nested site: "); nested_site()->ShortPrint(out); + PrintF(out, "\n - memento found count: "); + memento_found_count()->ShortPrint(out); + PrintF(out, "\n - memento create count: "); + memento_create_count()->ShortPrint(out); + PrintF(out, "\n - pretenure decision: "); + pretenure_decision()->ShortPrint(out); PrintF(out, "\n - transition_info: "); if (transition_info()->IsSmi()) { ElementsKind kind = GetElementsKind(); diff --git a/src/objects.h b/src/objects.h index a5f5b52..cf4c80b 100644 --- a/src/objects.h +++ b/src/objects.h @@ -8111,6 +8111,9 @@ class AllocationSite: public Struct { // walked in a particular order. So [[1, 2], 1, 2] will have one // nested_site, but [[1, 2], 3, [4]] will have a list of two. DECL_ACCESSORS(nested_site, Object) + DECL_ACCESSORS(memento_found_count, Smi) + DECL_ACCESSORS(memento_create_count, Smi) + DECL_ACCESSORS(pretenure_decision, Smi) DECL_ACCESSORS(dependent_code, DependentCode) DECL_ACCESSORS(weak_next, Object) @@ -8178,7 +8181,13 @@ class AllocationSite: public Struct { static const int kTransitionInfoOffset = HeapObject::kHeaderSize; static const int kNestedSiteOffset = kTransitionInfoOffset + kPointerSize; - static const int kDependentCodeOffset = kNestedSiteOffset + kPointerSize; + static const int kMementoFoundCountOffset = kNestedSiteOffset + kPointerSize; + static const int kMementoCreateCountOffset = + kMementoFoundCountOffset + kPointerSize; + static const int kPretenureDecisionOffset = + kMementoCreateCountOffset + kPointerSize; + static const int kDependentCodeOffset = + kPretenureDecisionOffset + kPointerSize; static const int kWeakNextOffset = kDependentCodeOffset + kPointerSize; static const int kSize = kWeakNextOffset + kPointerSize; -- 2.7.4