| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 4765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4776 FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); | 4776 FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); |
| 4777 __ ldr(elements_reg, | 4777 __ ldr(elements_reg, |
| 4778 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); | 4778 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); |
| 4779 __ CompareRoot(elements_reg, Heap::kEmptyFixedArrayRootIndex); | 4779 __ CompareRoot(elements_reg, Heap::kEmptyFixedArrayRootIndex); |
| 4780 __ b(ne, &check_capacity); | 4780 __ b(ne, &check_capacity); |
| 4781 | 4781 |
| 4782 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements); | 4782 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements); |
| 4783 __ AllocateInNewSpace(size, elements_reg, scratch1, scratch2, &slow, | 4783 __ AllocateInNewSpace(size, elements_reg, scratch1, scratch2, &slow, |
| 4784 TAG_OBJECT); | 4784 TAG_OBJECT); |
| 4785 | 4785 |
| 4786 // Initialize the new FixedDoubleArray. Leave elements unitialized for | 4786 // Initialize the new FixedDoubleArray. |
| 4787 // efficiency, they are guaranteed to be initialized before use. | |
| 4788 __ LoadRoot(scratch1, Heap::kFixedDoubleArrayMapRootIndex); | 4787 __ LoadRoot(scratch1, Heap::kFixedDoubleArrayMapRootIndex); |
| 4789 __ str(scratch1, FieldMemOperand(elements_reg, JSObject::kMapOffset)); | 4788 __ str(scratch1, FieldMemOperand(elements_reg, JSObject::kMapOffset)); |
| 4790 __ mov(scratch1, | 4789 __ mov(scratch1, |
| 4791 Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements))); | 4790 Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements))); |
| 4792 __ str(scratch1, | 4791 __ str(scratch1, |
| 4793 FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset)); | 4792 FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset)); |
| 4794 | 4793 |
| 4794 __ mov(scratch1, Operand(kHoleNanLower32)); |
| 4795 __ mov(scratch2, Operand(kHoleNanUpper32)); |
| 4796 for (int i = 1; i < JSArray::kPreallocatedArrayElements; i++) { |
| 4797 int offset = FixedDoubleArray::OffsetOfElementAt(i); |
| 4798 __ str(scratch1, FieldMemOperand(elements_reg, offset)); |
| 4799 __ str(scratch2, FieldMemOperand(elements_reg, offset + kPointerSize)); |
| 4800 } |
| 4801 |
| 4802 __ StoreNumberToDoubleElements(value_reg, |
| 4803 key_reg, |
| 4804 // All registers after this are overwritten. |
| 4805 elements_reg, |
| 4806 scratch1, |
| 4807 scratch2, |
| 4808 scratch3, |
| 4809 scratch4, |
| 4810 &transition_elements_kind); |
| 4811 |
| 4795 // Install the new backing store in the JSArray. | 4812 // Install the new backing store in the JSArray. |
| 4796 __ str(elements_reg, | 4813 __ str(elements_reg, |
| 4797 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); | 4814 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); |
| 4798 __ RecordWriteField(receiver_reg, JSObject::kElementsOffset, elements_reg, | 4815 __ RecordWriteField(receiver_reg, JSObject::kElementsOffset, elements_reg, |
| 4799 scratch1, kLRHasNotBeenSaved, kDontSaveFPRegs, | 4816 scratch1, kLRHasNotBeenSaved, kDontSaveFPRegs, |
| 4800 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 4817 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
| 4801 | 4818 |
| 4802 // Increment the length of the array. | 4819 // Increment the length of the array. |
| 4803 __ mov(length_reg, Operand(Smi::FromInt(1))); | 4820 __ mov(length_reg, Operand(Smi::FromInt(1))); |
| 4804 __ str(length_reg, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); | 4821 __ str(length_reg, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); |
| 4805 __ ldr(elements_reg, | 4822 __ ldr(elements_reg, |
| 4806 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); | 4823 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); |
| 4807 __ jmp(&finish_store); | 4824 __ Ret(); |
| 4808 | 4825 |
| 4809 __ bind(&check_capacity); | 4826 __ bind(&check_capacity); |
| 4810 // Make sure that the backing store can hold additional elements. | 4827 // Make sure that the backing store can hold additional elements. |
| 4811 __ ldr(scratch1, | 4828 __ ldr(scratch1, |
| 4812 FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset)); | 4829 FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset)); |
| 4813 __ cmp(length_reg, scratch1); | 4830 __ cmp(length_reg, scratch1); |
| 4814 __ b(hs, &slow); | 4831 __ b(hs, &slow); |
| 4815 | 4832 |
| 4816 // Grow the array and finish the store. | 4833 // Grow the array and finish the store. |
| 4817 __ add(length_reg, length_reg, Operand(Smi::FromInt(1))); | 4834 __ add(length_reg, length_reg, Operand(Smi::FromInt(1))); |
| 4818 __ str(length_reg, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); | 4835 __ str(length_reg, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); |
| 4819 __ jmp(&finish_store); | 4836 __ jmp(&finish_store); |
| 4820 | 4837 |
| 4821 __ bind(&slow); | 4838 __ bind(&slow); |
| 4822 Handle<Code> ic_slow = masm->isolate()->builtins()->KeyedStoreIC_Slow(); | 4839 Handle<Code> ic_slow = masm->isolate()->builtins()->KeyedStoreIC_Slow(); |
| 4823 __ Jump(ic_slow, RelocInfo::CODE_TARGET); | 4840 __ Jump(ic_slow, RelocInfo::CODE_TARGET); |
| 4824 } | 4841 } |
| 4825 } | 4842 } |
| 4826 | 4843 |
| 4827 | 4844 |
| 4828 #undef __ | 4845 #undef __ |
| 4829 | 4846 |
| 4830 } } // namespace v8::internal | 4847 } } // namespace v8::internal |
| 4831 | 4848 |
| 4832 #endif // V8_TARGET_ARCH_ARM | 4849 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |