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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 } | 214 } |
215 | 215 |
216 // Allocate the JSArray object together with space for a FixedArray with the | 216 // Allocate the JSArray object together with space for a FixedArray with the |
217 // requested number of elements. | 217 // requested number of elements. |
218 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); | 218 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); |
219 __ mov(elements_array_end, | 219 __ mov(elements_array_end, |
220 Operand((JSArray::kSize + FixedArray::kHeaderSize) / kPointerSize)); | 220 Operand((JSArray::kSize + FixedArray::kHeaderSize) / kPointerSize)); |
221 __ add(elements_array_end, | 221 __ add(elements_array_end, |
222 elements_array_end, | 222 elements_array_end, |
223 Operand(array_size, ASR, kSmiTagSize)); | 223 Operand(array_size, ASR, kSmiTagSize)); |
224 __ AllocateInNewSpace( | 224 __ Allocate(elements_array_end, |
225 elements_array_end, | 225 result, |
226 result, | 226 scratch1, |
227 scratch1, | 227 scratch2, |
228 scratch2, | 228 gc_required, |
229 gc_required, | 229 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); |
230 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); | |
231 | 230 |
232 // Allocated the JSArray. Now initialize the fields except for the elements | 231 // Allocated the JSArray. Now initialize the fields except for the elements |
233 // array. | 232 // array. |
234 // result: JSObject | 233 // result: JSObject |
235 // elements_array_storage: initial map | 234 // elements_array_storage: initial map |
236 // array_size: size of array (smi) | 235 // array_size: size of array (smi) |
237 __ str(elements_array_storage, FieldMemOperand(result, JSObject::kMapOffset)); | 236 __ str(elements_array_storage, FieldMemOperand(result, JSObject::kMapOffset)); |
238 __ LoadRoot(elements_array_storage, Heap::kEmptyFixedArrayRootIndex); | 237 __ LoadRoot(elements_array_storage, Heap::kEmptyFixedArrayRootIndex); |
239 __ str(elements_array_storage, | 238 __ str(elements_array_storage, |
240 FieldMemOperand(result, JSArray::kPropertiesOffset)); | 239 FieldMemOperand(result, JSArray::kPropertiesOffset)); |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 __ pop(r2); | 866 __ pop(r2); |
868 __ pop(r1); | 867 __ pop(r1); |
869 | 868 |
870 __ bind(&allocate); | 869 __ bind(&allocate); |
871 } | 870 } |
872 | 871 |
873 // Now allocate the JSObject on the heap. | 872 // Now allocate the JSObject on the heap. |
874 // r1: constructor function | 873 // r1: constructor function |
875 // r2: initial map | 874 // r2: initial map |
876 __ ldrb(r3, FieldMemOperand(r2, Map::kInstanceSizeOffset)); | 875 __ ldrb(r3, FieldMemOperand(r2, Map::kInstanceSizeOffset)); |
877 __ AllocateInNewSpace(r3, r4, r5, r6, &rt_call, SIZE_IN_WORDS); | 876 __ Allocate(r3, r4, r5, r6, &rt_call, SIZE_IN_WORDS); |
878 | 877 |
879 // Allocated the JSObject, now initialize the fields. Map is set to | 878 // Allocated the JSObject, now initialize the fields. Map is set to |
880 // initial map and properties and elements are set to empty fixed array. | 879 // initial map and properties and elements are set to empty fixed array. |
881 // r1: constructor function | 880 // r1: constructor function |
882 // r2: initial map | 881 // r2: initial map |
883 // r3: object size | 882 // r3: object size |
884 // r4: JSObject (not tagged) | 883 // r4: JSObject (not tagged) |
885 __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex); | 884 __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex); |
886 __ mov(r5, r4); | 885 __ mov(r5, r4); |
887 ASSERT_EQ(0 * kPointerSize, JSObject::kMapOffset); | 886 ASSERT_EQ(0 * kPointerSize, JSObject::kMapOffset); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 __ b(eq, &allocated); | 941 __ b(eq, &allocated); |
943 __ Assert(pl, "Property allocation count failed."); | 942 __ Assert(pl, "Property allocation count failed."); |
944 | 943 |
945 // Scale the number of elements by pointer size and add the header for | 944 // Scale the number of elements by pointer size and add the header for |
946 // FixedArrays to the start of the next object calculation from above. | 945 // FixedArrays to the start of the next object calculation from above. |
947 // r1: constructor | 946 // r1: constructor |
948 // r3: number of elements in properties array | 947 // r3: number of elements in properties array |
949 // r4: JSObject | 948 // r4: JSObject |
950 // r5: start of next object | 949 // r5: start of next object |
951 __ add(r0, r3, Operand(FixedArray::kHeaderSize / kPointerSize)); | 950 __ add(r0, r3, Operand(FixedArray::kHeaderSize / kPointerSize)); |
952 __ AllocateInNewSpace( | 951 __ Allocate( |
953 r0, | 952 r0, |
954 r5, | 953 r5, |
955 r6, | 954 r6, |
956 r2, | 955 r2, |
957 &undo_allocation, | 956 &undo_allocation, |
958 static_cast<AllocationFlags>(RESULT_CONTAINS_TOP | SIZE_IN_WORDS)); | 957 static_cast<AllocationFlags>(RESULT_CONTAINS_TOP | SIZE_IN_WORDS)); |
959 | 958 |
960 // Initialize the FixedArray. | 959 // Initialize the FixedArray. |
961 // r1: constructor | 960 // r1: constructor |
962 // r3: number of elements in properties array | 961 // r3: number of elements in properties array |
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1906 __ bind(&dont_adapt_arguments); | 1905 __ bind(&dont_adapt_arguments); |
1907 __ Jump(r3); | 1906 __ Jump(r3); |
1908 } | 1907 } |
1909 | 1908 |
1910 | 1909 |
1911 #undef __ | 1910 #undef __ |
1912 | 1911 |
1913 } } // namespace v8::internal | 1912 } } // namespace v8::internal |
1914 | 1913 |
1915 #endif // V8_TARGET_ARCH_ARM | 1914 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |