Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index f98c025ddd3ec0de5ac66198180dd0765406d3cc..59b38d390f889271309d8680c4810d460c7b5443 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -8134,11 +8134,7 @@ 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) |
- // TODO(mvstanton): we don't need a whole integer to record pretenure |
- // decision. Consider sharing space with memento_found_count. |
- DECL_ACCESSORS(pretenure_decision, Smi) |
+ DECL_ACCESSORS(pretenure_data, Smi) |
DECL_ACCESSORS(dependent_code, DependentCode) |
DECL_ACCESSORS(weak_next, Object) |
@@ -8151,6 +8147,11 @@ class AllocationSite: public Struct { |
class UnusedBits: public BitField<int, 15, 14> {}; |
class DoNotInlineBit: public BitField<bool, 29, 1> {}; |
+ // Bitfields for pretenure_data |
+ class MementoCreateCountBits: public BitField<int, 0, 14> {}; |
+ class MementoFoundCountBits: public BitField<int, 15, 14> {}; |
+ class PretenureDecisionBits: public BitField<int, 28, 2> {}; |
+ |
// Increments the mementos found counter and returns true when the first |
// memento was found for a given allocation site. |
inline bool IncrementMementoFoundCount(); |
@@ -8158,17 +8159,55 @@ class AllocationSite: public Struct { |
inline void IncrementMementoCreateCount(); |
PretenureFlag GetPretenureMode() { |
- int mode = pretenure_decision()->value(); |
+ int mode = pretenure_decision(); |
// Zombie objects "decide" to be untenured. |
return (mode == kTenure) ? TENURED : NOT_TENURED; |
} |
+ int pretenure_decision() { |
+ int value = pretenure_data()->value(); |
+ return PretenureDecisionBits::decode(value); |
+ } |
+ |
+ void set_pretenure_decision(int decision) { |
+ int value = pretenure_data()->value(); |
+ set_pretenure_data( |
+ Smi::FromInt(PretenureDecisionBits::update(value, decision)), |
+ SKIP_WRITE_BARRIER); |
+ } |
+ |
+ int memento_found_count() { |
+ int value = pretenure_data()->value(); |
+ return MementoFoundCountBits::decode(value); |
+ } |
+ |
+ void set_memento_found_count(int count) { |
+ int value = pretenure_data()->value(); |
+ if (count >= MementoFoundCountBits::kMax) return; |
+ set_pretenure_data( |
+ Smi::FromInt(MementoFoundCountBits::update(value, count)), |
+ SKIP_WRITE_BARRIER); |
+ } |
+ |
+ int memento_create_count() { |
+ int value = pretenure_data()->value(); |
+ return MementoCreateCountBits::decode(value); |
+ } |
+ |
+ void set_memento_create_count(int count) { |
+ int value = pretenure_data()->value(); |
+ if (count >= MementoCreateCountBits::kMax) return; |
+ set_pretenure_data( |
+ Smi::FromInt(MementoCreateCountBits::update(value, count)), |
+ SKIP_WRITE_BARRIER); |
+ } |
+ |
// The pretenuring decision is made during gc, and the zombie state allows |
// us to recognize when an allocation site is just being kept alive because |
// a later traversal of new space may discover AllocationMementos that point |
// to this AllocationSite. |
bool IsZombie() { |
- return pretenure_decision()->value() == kZombie; |
+ return pretenure_decision() == kZombie; |
} |
inline void MarkZombie(); |
@@ -8226,13 +8265,10 @@ class AllocationSite: public Struct { |
static const int kTransitionInfoOffset = HeapObject::kHeaderSize; |
static const int kNestedSiteOffset = kTransitionInfoOffset + kPointerSize; |
- static const int kMementoFoundCountOffset = kNestedSiteOffset + kPointerSize; |
- static const int kMementoCreateCountOffset = |
- kMementoFoundCountOffset + kPointerSize; |
- static const int kPretenureDecisionOffset = |
- kMementoCreateCountOffset + kPointerSize; |
+ static const int kPretenureDataOffset = |
+ kNestedSiteOffset + kPointerSize; |
static const int kDependentCodeOffset = |
- kPretenureDecisionOffset + kPointerSize; |
+ kPretenureDataOffset + kPointerSize; |
static const int kWeakNextOffset = kDependentCodeOffset + kPointerSize; |
static const int kSize = kWeakNextOffset + kPointerSize; |
@@ -8249,7 +8285,7 @@ class AllocationSite: public Struct { |
private: |
inline DependentCode::DependencyGroup ToDependencyGroup(Reason reason); |
bool PretenuringDecisionMade() { |
- return pretenure_decision()->value() != kUndecided; |
+ return pretenure_decision() != kUndecided; |
} |
DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); |