| Index: src/hydrogen.cc | 
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc | 
| index b6498b1dbbce8786fa2d021df5196e7e274e0df6..76c5ca0a4df7835fcf4489500c7f5afd229ee54f 100644 | 
| --- a/src/hydrogen.cc | 
| +++ b/src/hydrogen.cc | 
| @@ -2237,25 +2237,8 @@ HInnerAllocatedObject* HGraphBuilder::BuildJSArrayHeader(HValue* array, | 
| length_field); | 
|  | 
| if (mode == TRACK_ALLOCATION_SITE) { | 
| -    BuildCreateAllocationMemento(array, | 
| -                                 JSArray::kSize, | 
| -                                 allocation_site_payload); | 
| -    if (FLAG_allocation_site_pretenuring) { | 
| -      // TODO(mvstanton): move this code into BuildCreateAllocationMemento when | 
| -      // constructed arrays also pay attention to pretenuring. | 
| -      HObjectAccess access = | 
| -          HObjectAccess::ForAllocationSiteOffset( | 
| -              AllocationSite::kMementoCreateCountOffset); | 
| -      HValue* create_info = Add<HLoadNamedField>(allocation_site_payload, | 
| -                                                 access); | 
| -      HInstruction* new_create_info = | 
| -          AddUncasted<HAdd>(create_info, graph()->GetConstant1()); | 
| -      new_create_info->ClearFlag(HValue::kCanOverflow); | 
| -      HStoreNamedField* store = Add<HStoreNamedField>(allocation_site_payload, | 
| -                                                      access, new_create_info); | 
| -      // No write barrier needed to store a smi. | 
| -      store->SkipWriteBarrier(); | 
| -    } | 
| +    BuildCreateAllocationMemento( | 
| +        array, Add<HConstant>(JSArray::kSize), allocation_site_payload); | 
| } | 
|  | 
| int elements_location = JSArray::kSize; | 
| @@ -2263,9 +2246,10 @@ HInnerAllocatedObject* HGraphBuilder::BuildJSArrayHeader(HValue* array, | 
| elements_location += AllocationMemento::kSize; | 
| } | 
|  | 
| -  HValue* elements = Add<HInnerAllocatedObject>(array, elements_location); | 
| +  HInnerAllocatedObject* elements = Add<HInnerAllocatedObject>( | 
| +      array, Add<HConstant>(elements_location)); | 
| Add<HStoreNamedField>(array, HObjectAccess::ForElementsPointer(), elements); | 
| -  return static_cast<HInnerAllocatedObject*>(elements); | 
| +  return elements; | 
| } | 
|  | 
|  | 
| @@ -2495,7 +2479,8 @@ HValue* HGraphBuilder::BuildCloneShallowArray(HValue* boilerplate, | 
|  | 
| // Create an allocation site info if requested. | 
| if (mode == TRACK_ALLOCATION_SITE) { | 
| -    BuildCreateAllocationMemento(object, JSArray::kSize, allocation_site); | 
| +    BuildCreateAllocationMemento( | 
| +        object, Add<HConstant>(JSArray::kSize), allocation_site); | 
| } | 
|  | 
| if (length > 0) { | 
| @@ -2588,18 +2573,31 @@ void HGraphBuilder::BuildCompareNil( | 
| } | 
|  | 
|  | 
| -HValue* HGraphBuilder::BuildCreateAllocationMemento(HValue* previous_object, | 
| -                                                    int previous_object_size, | 
| -                                                    HValue* alloc_site) { | 
| -  ASSERT(alloc_site != NULL); | 
| -  HInnerAllocatedObject* alloc_memento = Add<HInnerAllocatedObject>( | 
| +void HGraphBuilder::BuildCreateAllocationMemento( | 
| +    HValue* previous_object, | 
| +    HValue* previous_object_size, | 
| +    HValue* allocation_site) { | 
| +  ASSERT(allocation_site != NULL); | 
| +  HInnerAllocatedObject* allocation_memento = Add<HInnerAllocatedObject>( | 
| previous_object, previous_object_size); | 
| -  Handle<Map> alloc_memento_map = | 
| -      isolate()->factory()->allocation_memento_map(); | 
| -  AddStoreMapConstant(alloc_memento, alloc_memento_map); | 
| -  HObjectAccess access = HObjectAccess::ForAllocationMementoSite(); | 
| -  Add<HStoreNamedField>(alloc_memento, access, alloc_site); | 
| -  return alloc_memento; | 
| +  AddStoreMapConstant( | 
| +      allocation_memento, isolate()->factory()->allocation_memento_map()); | 
| +  Add<HStoreNamedField>( | 
| +      allocation_memento, | 
| +      HObjectAccess::ForAllocationMementoSite(), | 
| +      allocation_site); | 
| +  if (FLAG_allocation_site_pretenuring) { | 
| +    HValue* memento_create_count = Add<HLoadNamedField>( | 
| +        allocation_site, HObjectAccess::ForAllocationSiteOffset( | 
| +            AllocationSite::kMementoCreateCountOffset)); | 
| +    memento_create_count = AddUncasted<HAdd>( | 
| +        memento_create_count, graph()->GetConstant1()); | 
| +    HStoreNamedField* store = Add<HStoreNamedField>( | 
| +        allocation_site, HObjectAccess::ForAllocationSiteOffset( | 
| +            AllocationSite::kMementoCreateCountOffset), memento_create_count); | 
| +    // No write barrier needed to store a smi. | 
| +    store->SkipWriteBarrier(); | 
| +  } | 
| } | 
|  | 
|  | 
|  |