Chromium Code Reviews| Index: src/objects-inl.h |
| diff --git a/src/objects-inl.h b/src/objects-inl.h |
| index 15c9c1f5ff197d5eb7851fb2ecf66baca8963d18..e912e69bc0e0b8dec321ddfa7279ba6d6899be59 100644 |
| --- a/src/objects-inl.h |
| +++ b/src/objects-inl.h |
| @@ -48,6 +48,7 @@ |
| #include "factory.h" |
| #include "incremental-marking.h" |
| #include "transitions-inl.h" |
| +#include "objects-visiting.h" |
|
Hannes Payer (out of office)
2014/01/10 11:17:29
alphabetic order
|
| namespace v8 { |
| namespace internal { |
| @@ -1304,9 +1305,8 @@ 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_pretenure_data(Smi::FromInt(0)); |
| + set_pretenure_create_count(Smi::FromInt(0)); |
| set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()), |
| SKIP_WRITE_BARRIER); |
| } |
| @@ -1315,7 +1315,7 @@ void AllocationSite::Initialize() { |
| void AllocationSite::MarkZombie() { |
| ASSERT(!IsZombie()); |
| Initialize(); |
| - set_pretenure_decision(Smi::FromInt(kZombie)); |
| + set_pretenure_decision(kZombie); |
| } |
| @@ -1367,35 +1367,50 @@ inline DependentCode::DependencyGroup AllocationSite::ToDependencyGroup( |
| } |
| +inline void AllocationSite::set_memento_found_count(int count) { |
| + int value = pretenure_data()->value(); |
| + // Verify that we can count more mementos than we can possibly find in one |
| + // new space collection. |
| + ASSERT((GetHeap()->MaxSemiSpaceSize() / |
| + (StaticVisitorBase::kMinObjectSizeInWords * kPointerSize + |
| + AllocationMemento::kSize)) < MementoFoundCountBits::kMax); |
| + ASSERT(count < MementoFoundCountBits::kMax); |
| + set_pretenure_data( |
| + Smi::FromInt(MementoFoundCountBits::update(value, count)), |
| + SKIP_WRITE_BARRIER); |
| +} |
| + |
| inline bool AllocationSite::IncrementMementoFoundCount() { |
| if (IsZombie()) return false; |
| - int value = memento_found_count()->value(); |
| - set_memento_found_count(Smi::FromInt(value + 1)); |
| + int value = memento_found_count(); |
| + set_memento_found_count(value + 1); |
| return value == 0; |
| } |
| inline void AllocationSite::IncrementMementoCreateCount() { |
| ASSERT(FLAG_allocation_site_pretenuring); |
| - int value = memento_create_count()->value(); |
| - set_memento_create_count(Smi::FromInt(value + 1)); |
| + int value = memento_create_count(); |
| + set_memento_create_count(value + 1); |
| } |
| inline bool AllocationSite::DigestPretenuringFeedback() { |
| bool decision_made = false; |
| if (!PretenuringDecisionMade()) { |
| - int create_count = memento_create_count()->value(); |
| + int create_count = memento_create_count(); |
| if (create_count >= kPretenureMinimumCreated) { |
| - int found_count = memento_found_count()->value(); |
| + int found_count = memento_found_count(); |
| double ratio = static_cast<double>(found_count) / create_count; |
| if (FLAG_trace_track_allocation_sites) { |
| PrintF("AllocationSite: %p (created, found, ratio) (%d, %d, %f)\n", |
| static_cast<void*>(this), create_count, found_count, ratio); |
| } |
| - int result = ratio >= kPretenureRatio ? kTenure : kDontTenure; |
| - set_pretenure_decision(Smi::FromInt(result)); |
| + PretenureDecision result = ratio >= kPretenureRatio |
| + ? kTenure |
| + : kDontTenure; |
| + set_pretenure_decision(result); |
| decision_made = true; |
| // TODO(mvstanton): if the decision represents a change, any dependent |
| // code registered for pretenuring changes should be deopted. |
| @@ -1403,8 +1418,8 @@ inline bool AllocationSite::DigestPretenuringFeedback() { |
| } |
| // Clear feedback calculation fields until the next gc. |
| - set_memento_found_count(Smi::FromInt(0)); |
| - set_memento_create_count(Smi::FromInt(0)); |
| + set_memento_found_count(0); |
| + set_memento_create_count(0); |
| return decision_made; |
| } |
| @@ -4598,10 +4613,9 @@ 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_TO_SMI(AllocationSite, pretenure_data, kPretenureDataOffset) |
| +ACCESSORS_TO_SMI(AllocationSite, pretenure_create_count, |
| + kPretenureCreateCountOffset) |
| ACCESSORS(AllocationSite, dependent_code, DependentCode, |
| kDependentCodeOffset) |
| ACCESSORS(AllocationSite, weak_next, Object, kWeakNextOffset) |