| Index: src/ia32/ic-ia32.cc
|
| diff --git a/src/ia32/ic-ia32.cc b/src/ia32/ic-ia32.cc
|
| index 6c663617e84a5c4e13e272d223626e4c88eb2037..e5802c99d93770ad5fc5c86f1ebefbcd49deb760 100644
|
| --- a/src/ia32/ic-ia32.cc
|
| +++ b/src/ia32/ic-ia32.cc
|
| @@ -1449,6 +1449,57 @@ void StoreIC::GenerateMiss(MacroAssembler* masm) {
|
| }
|
|
|
|
|
| +void StoreIC::GenerateArrayLength(MacroAssembler* masm) {
|
| + // ----------- S t a t e -------------
|
| + // -- eax : value
|
| + // -- ecx : name
|
| + // -- edx : receiver
|
| + // -- esp[0] : return address
|
| + // -----------------------------------
|
| + //
|
| + // This accepts as a receiver anything JSObject::SetElementsLength accepts
|
| + // (currently anything except for external and pixel arrays which means
|
| + // anything with elements of FixedArray type.), but currently is restricted
|
| + // to JSArray.
|
| + // Value must be a number, but only smis are accepted as the most common case.
|
| +
|
| + Label miss;
|
| +
|
| + Register receiver = edx;
|
| + Register value = eax;
|
| + Register scratch = ebx;
|
| +
|
| + // Check that the receiver isn't a smi.
|
| + __ test(receiver, Immediate(kSmiTagMask));
|
| + __ j(zero, &miss, not_taken);
|
| +
|
| + // Check that the object is a JS array.
|
| + __ CmpObjectType(receiver, JS_ARRAY_TYPE, scratch);
|
| + __ j(not_equal, &miss, not_taken);
|
| +
|
| + // Check that elements are FixedArray.
|
| + __ mov(scratch, FieldOperand(receiver, JSArray::kElementsOffset));
|
| + __ CmpObjectType(scratch, FIXED_ARRAY_TYPE, scratch);
|
| + __ j(not_equal, &miss, not_taken);
|
| +
|
| + // Check that value is a smi.
|
| + __ test(value, Immediate(kSmiTagMask));
|
| + __ j(not_zero, &miss, not_taken);
|
| +
|
| + // Prepare tail call to StoreIC_ArrayLength.
|
| + __ pop(scratch);
|
| + __ push(receiver);
|
| + __ push(value);
|
| + __ push(scratch); // return address
|
| +
|
| + __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_ArrayLength)), 2, 1);
|
| +
|
| + __ bind(&miss);
|
| +
|
| + GenerateMiss(masm);
|
| +}
|
| +
|
| +
|
| // Defined in ic.cc.
|
| Object* KeyedStoreIC_Miss(Arguments args);
|
|
|
|
|