Reviewers: Hannes Payer,
Message:
PTAL. TGIF. MVS.
Description:
Pretenuring calculation fields in AllocationSite.
AllocationSite-based pretenuring needs additional fields to carry out
calculations.
Please review this at https://codereview.chromium.org/43603002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+54, -22 lines):
M src/code-stubs-hydrogen.cc
M src/hydrogen-instructions.h
M src/objects-inl.h
M src/objects-printer.cc
M src/objects.h
Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index
88af4665b684410fa046ec6dd662ceb0dc2e6fd1..6858294b99c17778228f6db4b1e6456dc30c763f
100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -371,7 +371,8 @@ HValue*
CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
undefined);
checker.Then();
- HObjectAccess access = HObjectAccess::ForAllocationSiteTransitionInfo();
+ HObjectAccess access = HObjectAccess::ForAllocationSiteOffset(
+ AllocationSite::kTransitionInfoOffset);
HInstruction* boilerplate = Add<HLoadNamedField>(allocation_site,
access);
HValue* push_value;
if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) {
@@ -440,7 +441,8 @@ HValue*
CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
undefined);
checker.And();
- HObjectAccess access = HObjectAccess::ForAllocationSiteTransitionInfo();
+ HObjectAccess access = HObjectAccess::ForAllocationSiteOffset(
+ AllocationSite::kTransitionInfoOffset);
HInstruction* boilerplate = Add<HLoadNamedField>(allocation_site,
access);
int size = JSObject::kHeaderSize + casted_stub()->length() *
kPointerSize;
@@ -500,12 +502,30 @@ HValue*
CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
// Store the payload (smi elements kind)
HValue* initial_elements_kind =
Add<HConstant>(GetInitialFastElementsKind());
Add<HStoreNamedField>(object,
- HObjectAccess::ForAllocationSiteTransitionInfo(),
+ HObjectAccess::ForAllocationSiteOffset(
+ AllocationSite::kTransitionInfoOffset),
initial_elements_kind);
// Unlike literals, constructed arrays don't have nested sites
Add<HStoreNamedField>(object,
- HObjectAccess::ForAllocationSiteNestedSite(),
+ HObjectAccess::ForAllocationSiteOffset(
+ AllocationSite::kNestedSiteOffset),
+ graph()->GetConstant0());
+
+ // Pretenuring calculation fields.
+ Add<HStoreNamedField>(object,
+ HObjectAccess::ForAllocationSiteOffset(
+ AllocationSite::kMementoFoundCountOffset),
+ graph()->GetConstant0());
+
+ Add<HStoreNamedField>(object,
+ HObjectAccess::ForAllocationSiteOffset(
+ AllocationSite::kMementoCreateCountOffset),
+ graph()->GetConstant0());
+
+ Add<HStoreNamedField>(object,
+ HObjectAccess::ForAllocationSiteOffset(
+ AllocationSite::kPretenureDecisionOffset),
graph()->GetConstant0());
// Store an empty fixed array for the code dependency.
@@ -513,7 +533,8 @@ HValue*
CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
Add<HConstant>(isolate()->factory()->empty_fixed_array());
HStoreNamedField* store = Add<HStoreNamedField>(
object,
- HObjectAccess::ForAllocationSiteDependentCode(),
+ HObjectAccess::ForAllocationSiteOffset(
+ AllocationSite::kDependentCodeOffset),
empty_fixed_array);
// Link the object to the allocation site list
@@ -522,8 +543,8 @@ HValue*
CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
HValue* site = Add<HLoadNamedField>(site_list,
HObjectAccess::ForAllocationSiteList());
store = Add<HStoreNamedField>(object,
- HObjectAccess::ForAllocationSiteWeakNext(),
- site);
+
HObjectAccess::ForAllocationSiteOffset(AllocationSite::kWeakNextOffset),
+ site);
store->SkipWriteBarrier();
Add<HStoreNamedField>(site_list, HObjectAccess::ForAllocationSiteList(),
object);
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index
7df1aae544f6311163976d6d47807ed7b204b776..6f0700ead9688e6dd15297181372edc76c6d8181
100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -5786,20 +5786,9 @@ class HObjectAccess V8_FINAL {
? Representation::Smi() : Representation::Tagged());
}
- static HObjectAccess ForAllocationSiteTransitionInfo() {
- return HObjectAccess(kInobject, AllocationSite::kTransitionInfoOffset);
- }
-
- static HObjectAccess ForAllocationSiteNestedSite() {
- return HObjectAccess(kInobject, AllocationSite::kNestedSiteOffset);
- }
-
- static HObjectAccess ForAllocationSiteDependentCode() {
- return HObjectAccess(kInobject, AllocationSite::kDependentCodeOffset);
- }
-
- static HObjectAccess ForAllocationSiteWeakNext() {
- return HObjectAccess(kInobject, AllocationSite::kWeakNextOffset);
+ static HObjectAccess ForAllocationSiteOffset(int offset) {
+ ASSERT(offset < AllocationSite::kSize);
+ return HObjectAccess(kInobject, offset);
}
static HObjectAccess ForAllocationSiteList() {
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index
006aff394c20cd517c516e0823424f3aa42c9c80..ff0855d0a2b2bf6ae1ec701346c7c3c61573a0b7
100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1332,6 +1332,9 @@ bool JSObject::ShouldTrackAllocationInfo() {
void AllocationSite::Initialize() {
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);
}
@@ -4552,6 +4555,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)
Index: src/objects-printer.cc
diff --git a/src/objects-printer.cc b/src/objects-printer.cc
index
60c1ef4c38e2c21d7a4d52799dc82744def79055..7d0be12d5cc689950534b9010c8d041a51260be9
100644
--- a/src/objects-printer.cc
+++ b/src/objects-printer.cc
@@ -1124,6 +1124,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()->IsCell()) {
Cell* cell = Cell::cast(transition_info());
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
267ef133abc43373b84b02fbd9c3e8e63b2ce85a..4bddefbf76ef689309e1677aa85e0d2e10ffe76e
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -8020,6 +8020,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)
@@ -8059,7 +8062,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;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.