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 3821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3832 // Check for the empty array, and preallocate a small backing store if | 3832 // Check for the empty array, and preallocate a small backing store if |
3833 // possible. | 3833 // possible. |
3834 __ ldr(length_reg, | 3834 __ ldr(length_reg, |
3835 FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); | 3835 FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); |
3836 __ ldr(elements_reg, | 3836 __ ldr(elements_reg, |
3837 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); | 3837 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); |
3838 __ CompareRoot(elements_reg, Heap::kEmptyFixedArrayRootIndex); | 3838 __ CompareRoot(elements_reg, Heap::kEmptyFixedArrayRootIndex); |
3839 __ b(ne, &check_capacity); | 3839 __ b(ne, &check_capacity); |
3840 | 3840 |
3841 int size = FixedArray::SizeFor(JSArray::kPreallocatedArrayElements); | 3841 int size = FixedArray::SizeFor(JSArray::kPreallocatedArrayElements); |
3842 __ AllocateInNewSpace(size, elements_reg, scratch, scratch2, &slow, | 3842 __ Allocate(size, elements_reg, scratch, scratch2, &slow, TAG_OBJECT); |
3843 TAG_OBJECT); | |
3844 | 3843 |
3845 __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); | 3844 __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); |
3846 __ str(scratch, FieldMemOperand(elements_reg, JSObject::kMapOffset)); | 3845 __ str(scratch, FieldMemOperand(elements_reg, JSObject::kMapOffset)); |
3847 __ mov(scratch, Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements))); | 3846 __ mov(scratch, Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements))); |
3848 __ str(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); | 3847 __ str(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); |
3849 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); | 3848 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); |
3850 for (int i = 1; i < JSArray::kPreallocatedArrayElements; ++i) { | 3849 for (int i = 1; i < JSArray::kPreallocatedArrayElements; ++i) { |
3851 __ str(scratch, FieldMemOperand(elements_reg, FixedArray::SizeFor(i))); | 3850 __ str(scratch, FieldMemOperand(elements_reg, FixedArray::SizeFor(i))); |
3852 } | 3851 } |
3853 | 3852 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3986 // Check for the empty array, and preallocate a small backing store if | 3985 // Check for the empty array, and preallocate a small backing store if |
3987 // possible. | 3986 // possible. |
3988 __ ldr(length_reg, | 3987 __ ldr(length_reg, |
3989 FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); | 3988 FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); |
3990 __ ldr(elements_reg, | 3989 __ ldr(elements_reg, |
3991 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); | 3990 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); |
3992 __ CompareRoot(elements_reg, Heap::kEmptyFixedArrayRootIndex); | 3991 __ CompareRoot(elements_reg, Heap::kEmptyFixedArrayRootIndex); |
3993 __ b(ne, &check_capacity); | 3992 __ b(ne, &check_capacity); |
3994 | 3993 |
3995 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements); | 3994 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements); |
3996 __ AllocateInNewSpace(size, elements_reg, scratch1, scratch2, &slow, | 3995 __ Allocate(size, elements_reg, scratch1, scratch2, &slow, TAG_OBJECT); |
3997 TAG_OBJECT); | |
3998 | 3996 |
3999 // Initialize the new FixedDoubleArray. | 3997 // Initialize the new FixedDoubleArray. |
4000 __ LoadRoot(scratch1, Heap::kFixedDoubleArrayMapRootIndex); | 3998 __ LoadRoot(scratch1, Heap::kFixedDoubleArrayMapRootIndex); |
4001 __ str(scratch1, FieldMemOperand(elements_reg, JSObject::kMapOffset)); | 3999 __ str(scratch1, FieldMemOperand(elements_reg, JSObject::kMapOffset)); |
4002 __ mov(scratch1, | 4000 __ mov(scratch1, |
4003 Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements))); | 4001 Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements))); |
4004 __ str(scratch1, | 4002 __ str(scratch1, |
4005 FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset)); | 4003 FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset)); |
4006 | 4004 |
4007 __ mov(scratch1, elements_reg); | 4005 __ mov(scratch1, elements_reg); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4054 __ Jump(ic_slow, RelocInfo::CODE_TARGET); | 4052 __ Jump(ic_slow, RelocInfo::CODE_TARGET); |
4055 } | 4053 } |
4056 } | 4054 } |
4057 | 4055 |
4058 | 4056 |
4059 #undef __ | 4057 #undef __ |
4060 | 4058 |
4061 } } // namespace v8::internal | 4059 } } // namespace v8::internal |
4062 | 4060 |
4063 #endif // V8_TARGET_ARCH_ARM | 4061 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |