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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // and filled with the hole values. | 107 // and filled with the hole values. |
108 static void AllocateEmptyJSArray(MacroAssembler* masm, | 108 static void AllocateEmptyJSArray(MacroAssembler* masm, |
109 Register array_function, | 109 Register array_function, |
110 Register result, | 110 Register result, |
111 Register scratch1, | 111 Register scratch1, |
112 Register scratch2, | 112 Register scratch2, |
113 Register scratch3, | 113 Register scratch3, |
114 Label* gc_required) { | 114 Label* gc_required) { |
115 const int initial_capacity = JSArray::kPreallocatedArrayElements; | 115 const int initial_capacity = JSArray::kPreallocatedArrayElements; |
116 STATIC_ASSERT(initial_capacity >= 0); | 116 STATIC_ASSERT(initial_capacity >= 0); |
117 // Load the initial map from the array function. | 117 __ LoadGlobalInitialConstructedArrayMap(array_function, scratch2, scratch1); |
118 __ ldr(scratch1, FieldMemOperand(array_function, | |
119 JSFunction::kPrototypeOrInitialMapOffset)); | |
120 | 118 |
121 // Allocate the JSArray object together with space for a fixed array with the | 119 // Allocate the JSArray object together with space for a fixed array with the |
122 // requested elements. | 120 // requested elements. |
123 int size = JSArray::kSize; | 121 int size = JSArray::kSize; |
124 if (initial_capacity > 0) { | 122 if (initial_capacity > 0) { |
125 size += FixedArray::SizeFor(initial_capacity); | 123 size += FixedArray::SizeFor(initial_capacity); |
126 } | 124 } |
127 __ AllocateInNewSpace(size, | 125 __ AllocateInNewSpace(size, |
128 result, | 126 result, |
129 scratch2, | 127 scratch2, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 Register array_function, // Array function. | 201 Register array_function, // Array function. |
204 Register array_size, // As a smi, cannot be 0. | 202 Register array_size, // As a smi, cannot be 0. |
205 Register result, | 203 Register result, |
206 Register elements_array_storage, | 204 Register elements_array_storage, |
207 Register elements_array_end, | 205 Register elements_array_end, |
208 Register scratch1, | 206 Register scratch1, |
209 Register scratch2, | 207 Register scratch2, |
210 bool fill_with_hole, | 208 bool fill_with_hole, |
211 Label* gc_required) { | 209 Label* gc_required) { |
212 // Load the initial map from the array function. | 210 // Load the initial map from the array function. |
213 __ ldr(elements_array_storage, | 211 __ LoadGlobalInitialConstructedArrayMap(array_function, scratch2, |
214 FieldMemOperand(array_function, | 212 elements_array_storage); |
215 JSFunction::kPrototypeOrInitialMapOffset)); | |
216 | 213 |
217 if (FLAG_debug_code) { // Assert that array size is not zero. | 214 if (FLAG_debug_code) { // Assert that array size is not zero. |
218 __ tst(array_size, array_size); | 215 __ tst(array_size, array_size); |
219 __ Assert(ne, "array size is unexpectedly 0"); | 216 __ Assert(ne, "array size is unexpectedly 0"); |
220 } | 217 } |
221 | 218 |
222 // Allocate the JSArray object together with space for a FixedArray with the | 219 // Allocate the JSArray object together with space for a FixedArray with the |
223 // requested number of elements. | 220 // requested number of elements. |
224 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); | 221 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); |
225 __ mov(elements_array_end, | 222 __ mov(elements_array_end, |
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 __ bind(&dont_adapt_arguments); | 1768 __ bind(&dont_adapt_arguments); |
1772 __ Jump(r3); | 1769 __ Jump(r3); |
1773 } | 1770 } |
1774 | 1771 |
1775 | 1772 |
1776 #undef __ | 1773 #undef __ |
1777 | 1774 |
1778 } } // namespace v8::internal | 1775 } } // namespace v8::internal |
1779 | 1776 |
1780 #endif // V8_TARGET_ARCH_ARM | 1777 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |