Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 69969bdf28113dde6f0a47a23dd1db63536d4a0b..a52b7b992a0696e58a3eb2d5ccd49140b67249f7 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -2640,17 +2640,21 @@ void HGraphBuilder::BuildCreateAllocationMemento( |
HObjectAccess::ForAllocationMementoSite(), |
allocation_site); |
if (FLAG_allocation_site_pretenuring) { |
- HValue* memento_create_count = Add<HLoadNamedField>( |
+ // We want to add 1 to the memento create count. The field is actually a smi |
+ // bitfield, but the memento create count is in the lower 14 bits. Therefore |
+ // we don't need to mask and shift. |
+ STATIC_ASSERT(AllocationSite::MementoCreateCountBits::kShift == 0); |
+ HValue* pretenure_data = Add<HLoadNamedField>( |
allocation_site, HObjectAccess::ForAllocationSiteOffset( |
- AllocationSite::kMementoCreateCountOffset)); |
- memento_create_count = AddUncasted<HAdd>( |
- memento_create_count, graph()->GetConstant1()); |
+ AllocationSite::kPretenureDataOffset)); |
+ pretenure_data = AddUncasted<HAdd>( |
+ pretenure_data, graph()->GetConstant1()); |
// This smi value is reset to zero after every gc, overflow isn't a problem |
// since the counter is bounded by the new space size. |
- memento_create_count->ClearFlag(HValue::kCanOverflow); |
+ pretenure_data->ClearFlag(HValue::kCanOverflow); |
HStoreNamedField* store = Add<HStoreNamedField>( |
allocation_site, HObjectAccess::ForAllocationSiteOffset( |
- AllocationSite::kMementoCreateCountOffset), memento_create_count); |
+ AllocationSite::kPretenureDataOffset), pretenure_data); |
// No write barrier needed to store a smi. |
store->SkipWriteBarrier(); |
} |