Chromium Code Reviews| Index: src/x64/ic-x64.cc |
| diff --git a/src/x64/ic-x64.cc b/src/x64/ic-x64.cc |
| index b3a94227af3a5159fb5649c863f86e8395c0e7a0..68dea69afa15c52df8c26998bb4d3835666bfc73 100644 |
| --- a/src/x64/ic-x64.cc |
| +++ b/src/x64/ic-x64.cc |
| @@ -1397,11 +1397,10 @@ void StoreIC::GenerateArrayLength(MacroAssembler* masm) { |
| // -- rsp[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. |
| + // 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; |
| @@ -1423,6 +1422,13 @@ void StoreIC::GenerateArrayLength(MacroAssembler* masm) { |
| __ 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. |
| + Handle<Map> map = masm->isolate()->factory()->hash_table_map(); |
| + __ movq(scratch, FieldOperand(receiver, JSArray::kPropertiesOffset)); |
| + __ Cmp(FieldOperand(scratch, FixedArray::kMapOffset), map); |
|
Sven Panne
2011/12/14 09:48:12
We can probably use CompareRoot here.
Michael Starzinger
2011/12/14 10:10:15
Done.
|
| + __ j(equal, &miss); |
| + |
| // Check that value is a smi. |
| __ JumpIfNotSmi(value, &miss); |