| Index: src/x64/code-stubs-x64.cc
 | 
| diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
 | 
| index 6bef42f28eb56b74f628e1c1ecf6ca284f667f08..a0424acd03af9f4b54adfe3352f989bd9be56154 100644
 | 
| --- a/src/x64/code-stubs-x64.cc
 | 
| +++ b/src/x64/code-stubs-x64.cc
 | 
| @@ -2442,6 +2442,68 @@ void StringLengthStub::Generate(MacroAssembler* masm) {
 | 
|  }
 | 
|  
 | 
|  
 | 
| +void StoreArrayLengthStub::Generate(MacroAssembler* masm) {
 | 
| +  // ----------- S t a t e -------------
 | 
| +  //  -- rax    : value
 | 
| +  //  -- rcx    : key
 | 
| +  //  -- rdx    : receiver
 | 
| +  //  -- rsp[0] : return address
 | 
| +  // -----------------------------------
 | 
| +  //
 | 
| +  // This accepts as a receiver anything JSArray::SetElementsLength accepts
 | 
| +  // (currently anything except for external arrays which means anything with
 | 
| +  // elements of FixedArray type).  Value must be a number, but only smis are
 | 
| +  // accepted as the most common case.
 | 
| +
 | 
| +  Label miss;
 | 
| +
 | 
| +  Register receiver = rdx;
 | 
| +  Register value = rax;
 | 
| +  Register scratch = rbx;
 | 
| +  if (kind() == Code::KEYED_STORE_IC) {
 | 
| +    __ Cmp(rcx, masm->isolate()->factory()->length_symbol());
 | 
| +  }
 | 
| +
 | 
| +  // Check that the receiver isn't a smi.
 | 
| +  __ JumpIfSmi(receiver, &miss);
 | 
| +
 | 
| +  // Check that the object is a JS array.
 | 
| +  __ CmpObjectType(receiver, JS_ARRAY_TYPE, scratch);
 | 
| +  __ j(not_equal, &miss);
 | 
| +
 | 
| +  // Check that elements are FixedArray.
 | 
| +  // We rely on StoreIC_ArrayLength below to deal with all types of
 | 
| +  // fast elements (including COW).
 | 
| +  __ movq(scratch, FieldOperand(receiver, JSArray::kElementsOffset));
 | 
| +  __ CmpObjectType(scratch, FIXED_ARRAY_TYPE, scratch);
 | 
| +  __ j(not_equal, &miss);
 | 
| +
 | 
| +  // Check that the array has fast properties, otherwise the length
 | 
| +  // property might have been redefined.
 | 
| +  __ movq(scratch, FieldOperand(receiver, JSArray::kPropertiesOffset));
 | 
| +  __ CompareRoot(FieldOperand(scratch, FixedArray::kMapOffset),
 | 
| +                 Heap::kHashTableMapRootIndex);
 | 
| +  __ j(equal, &miss);
 | 
| +
 | 
| +  // Check that value is a smi.
 | 
| +  __ JumpIfNotSmi(value, &miss);
 | 
| +
 | 
| +  // Prepare tail call to StoreIC_ArrayLength.
 | 
| +  __ pop(scratch);
 | 
| +  __ push(receiver);
 | 
| +  __ push(value);
 | 
| +  __ push(scratch);  // return address
 | 
| +
 | 
| +  ExternalReference ref =
 | 
| +      ExternalReference(IC_Utility(IC::kStoreIC_ArrayLength), masm->isolate());
 | 
| +  __ TailCallExternalReference(ref, 2, 1);
 | 
| +
 | 
| +  __ bind(&miss);
 | 
| +
 | 
| +  StubCompiler::GenerateStoreMiss(masm, kind());
 | 
| +}
 | 
| +
 | 
| +
 | 
|  void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
 | 
|    // The key is in rdx and the parameter count is in rax.
 | 
|  
 | 
| 
 |