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 3812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3823 // Check for the empty array, and preallocate a small backing store if | 3823 // Check for the empty array, and preallocate a small backing store if |
3824 // possible. | 3824 // possible. |
3825 __ lw(length_reg, | 3825 __ lw(length_reg, |
3826 FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); | 3826 FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); |
3827 __ lw(elements_reg, | 3827 __ lw(elements_reg, |
3828 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); | 3828 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); |
3829 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); | 3829 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); |
3830 __ Branch(&check_capacity, ne, elements_reg, Operand(at)); | 3830 __ Branch(&check_capacity, ne, elements_reg, Operand(at)); |
3831 | 3831 |
3832 int size = FixedArray::SizeFor(JSArray::kPreallocatedArrayElements); | 3832 int size = FixedArray::SizeFor(JSArray::kPreallocatedArrayElements); |
3833 __ AllocateInNewSpace(size, elements_reg, scratch, scratch2, &slow, | 3833 __ Allocate(size, elements_reg, scratch, scratch2, &slow, TAG_OBJECT); |
3834 TAG_OBJECT); | |
3835 | 3834 |
3836 __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); | 3835 __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); |
3837 __ sw(scratch, FieldMemOperand(elements_reg, JSObject::kMapOffset)); | 3836 __ sw(scratch, FieldMemOperand(elements_reg, JSObject::kMapOffset)); |
3838 __ li(scratch, Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements))); | 3837 __ li(scratch, Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements))); |
3839 __ sw(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); | 3838 __ sw(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); |
3840 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); | 3839 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); |
3841 for (int i = 1; i < JSArray::kPreallocatedArrayElements; ++i) { | 3840 for (int i = 1; i < JSArray::kPreallocatedArrayElements; ++i) { |
3842 __ sw(scratch, FieldMemOperand(elements_reg, FixedArray::SizeFor(i))); | 3841 __ sw(scratch, FieldMemOperand(elements_reg, FixedArray::SizeFor(i))); |
3843 } | 3842 } |
3844 | 3843 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3974 // Check for the empty array, and preallocate a small backing store if | 3973 // Check for the empty array, and preallocate a small backing store if |
3975 // possible. | 3974 // possible. |
3976 __ lw(length_reg, | 3975 __ lw(length_reg, |
3977 FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); | 3976 FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); |
3978 __ lw(elements_reg, | 3977 __ lw(elements_reg, |
3979 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); | 3978 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); |
3980 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); | 3979 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); |
3981 __ Branch(&check_capacity, ne, elements_reg, Operand(at)); | 3980 __ Branch(&check_capacity, ne, elements_reg, Operand(at)); |
3982 | 3981 |
3983 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements); | 3982 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements); |
3984 __ AllocateInNewSpace(size, elements_reg, scratch1, scratch2, &slow, | 3983 __ Allocate(size, elements_reg, scratch1, scratch2, &slow, TAG_OBJECT); |
3985 TAG_OBJECT); | |
3986 | 3984 |
3987 // Initialize the new FixedDoubleArray. | 3985 // Initialize the new FixedDoubleArray. |
3988 __ LoadRoot(scratch1, Heap::kFixedDoubleArrayMapRootIndex); | 3986 __ LoadRoot(scratch1, Heap::kFixedDoubleArrayMapRootIndex); |
3989 __ sw(scratch1, FieldMemOperand(elements_reg, JSObject::kMapOffset)); | 3987 __ sw(scratch1, FieldMemOperand(elements_reg, JSObject::kMapOffset)); |
3990 __ li(scratch1, Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements))); | 3988 __ li(scratch1, Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements))); |
3991 __ sw(scratch1, | 3989 __ sw(scratch1, |
3992 FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset)); | 3990 FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset)); |
3993 | 3991 |
3994 __ mov(scratch1, elements_reg); | 3992 __ mov(scratch1, elements_reg); |
3995 __ StoreNumberToDoubleElements(value_reg, | 3993 __ StoreNumberToDoubleElements(value_reg, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4039 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 4037 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
4040 } | 4038 } |
4041 } | 4039 } |
4042 | 4040 |
4043 | 4041 |
4044 #undef __ | 4042 #undef __ |
4045 | 4043 |
4046 } } // namespace v8::internal | 4044 } } // namespace v8::internal |
4047 | 4045 |
4048 #endif // V8_TARGET_ARCH_MIPS | 4046 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |