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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 gc_required, | 129 gc_required, |
130 TAG_OBJECT); | 130 TAG_OBJECT); |
131 | 131 |
132 // Allocated the JSArray. Now initialize the fields except for the elements | 132 // Allocated the JSArray. Now initialize the fields except for the elements |
133 // array. | 133 // array. |
134 // result: JSObject | 134 // result: JSObject |
135 // scratch1: initial map | 135 // scratch1: initial map |
136 // scratch2: start of next object | 136 // scratch2: start of next object |
137 __ str(scratch1, FieldMemOperand(result, JSObject::kMapOffset)); | 137 __ str(scratch1, FieldMemOperand(result, JSObject::kMapOffset)); |
138 __ LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex); | 138 __ LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex); |
139 __ str(scratch1, FieldMemOperand(result, JSArray::kPropertiesOffset)); | |
140 // Field JSArray::kElementsOffset is initialized later. | 139 // Field JSArray::kElementsOffset is initialized later. |
141 __ mov(scratch3, Operand(0, RelocInfo::NONE)); | 140 __ mov(scratch3, Operand(0, RelocInfo::NONE)); |
142 __ str(scratch3, FieldMemOperand(result, JSArray::kLengthOffset)); | 141 __ str(scratch3, FieldMemOperand(result, JSArray::kLengthOffset)); |
142 // scratch1: empty FixedArray | |
143 __ str(scratch1, FieldMemOperand(result, JSArray::kPropertiesOffset)); | |
143 | 144 |
144 if (initial_capacity == 0) { | 145 if (initial_capacity == 0) { |
145 __ str(scratch1, FieldMemOperand(result, JSArray::kElementsOffset)); | 146 __ str(scratch1, FieldMemOperand(result, JSArray::kElementsOffset)); |
146 return; | 147 return; |
147 } | 148 } |
148 | 149 |
149 // Calculate the location of the elements array and set elements array member | 150 // Calculate the location of the elements array and set elements array member |
150 // of the JSArray. | 151 // of the JSArray. |
151 // result: JSObject | 152 // result: JSObject |
152 // scratch2: start of next object | 153 // scratch2: start of next object |
153 __ add(scratch1, result, Operand(JSArray::kSize)); | 154 __ add(scratch1, result, Operand(JSArray::kSize)); |
154 __ str(scratch1, FieldMemOperand(result, JSArray::kElementsOffset)); | 155 __ str(scratch1, FieldMemOperand(result, JSArray::kElementsOffset)); |
155 | 156 |
157 __ LoadRoot(scratch3, Heap::kFixedArrayMapRootIndex); | |
ulan
2012/01/27 13:19:11
In this case it seems to reduce readability. I thi
| |
158 | |
156 // Clear the heap tag on the elements array. | 159 // Clear the heap tag on the elements array. |
157 __ sub(scratch1, scratch1, Operand(kHeapObjectTag)); | 160 __ sub(scratch1, scratch1, Operand(kHeapObjectTag)); |
158 | 161 |
159 // Initialize the FixedArray and fill it with holes. FixedArray length is | 162 // Initialize the FixedArray and fill it with holes. FixedArray length is |
160 // stored as a smi. | 163 // stored as a smi. |
161 // result: JSObject | 164 // result: JSObject |
162 // scratch1: elements array (untagged) | 165 // scratch1: elements array (untagged) |
163 // scratch2: start of next object | 166 // scratch2: start of next object |
164 __ LoadRoot(scratch3, Heap::kFixedArrayMapRootIndex); | 167 // scratch3: FixedArray map |
165 STATIC_ASSERT(0 * kPointerSize == FixedArray::kMapOffset); | 168 STATIC_ASSERT(0 * kPointerSize == FixedArray::kMapOffset); |
166 __ str(scratch3, MemOperand(scratch1, kPointerSize, PostIndex)); | 169 __ str(scratch3, MemOperand(scratch1, kPointerSize, PostIndex)); |
167 __ mov(scratch3, Operand(Smi::FromInt(initial_capacity))); | 170 __ mov(scratch3, Operand(Smi::FromInt(initial_capacity))); |
168 STATIC_ASSERT(1 * kPointerSize == FixedArray::kLengthOffset); | 171 STATIC_ASSERT(1 * kPointerSize == FixedArray::kLengthOffset); |
169 __ str(scratch3, MemOperand(scratch1, kPointerSize, PostIndex)); | 172 __ str(scratch3, MemOperand(scratch1, kPointerSize, PostIndex)); |
170 | 173 |
171 // Fill the FixedArray with the hole value. Inline the code if short. | 174 // Fill the FixedArray with the hole value. Inline the code if short. |
172 STATIC_ASSERT(2 * kPointerSize == FixedArray::kHeaderSize); | 175 STATIC_ASSERT(2 * kPointerSize == FixedArray::kHeaderSize); |
173 __ LoadRoot(scratch3, Heap::kTheHoleValueRootIndex); | 176 __ LoadRoot(scratch3, Heap::kTheHoleValueRootIndex); |
174 static const int kLoopUnfoldLimit = 4; | 177 static const int kLoopUnfoldLimit = 4; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
245 __ str(array_size, FieldMemOperand(result, JSArray::kLengthOffset)); | 248 __ str(array_size, FieldMemOperand(result, JSArray::kLengthOffset)); |
246 | 249 |
247 // Calculate the location of the elements array and set elements array member | 250 // Calculate the location of the elements array and set elements array member |
248 // of the JSArray. | 251 // of the JSArray. |
249 // result: JSObject | 252 // result: JSObject |
250 // array_size: size of array (smi) | 253 // array_size: size of array (smi) |
251 __ add(elements_array_storage, result, Operand(JSArray::kSize)); | 254 __ add(elements_array_storage, result, Operand(JSArray::kSize)); |
252 __ str(elements_array_storage, | 255 __ str(elements_array_storage, |
253 FieldMemOperand(result, JSArray::kElementsOffset)); | 256 FieldMemOperand(result, JSArray::kElementsOffset)); |
254 | 257 |
258 __ LoadRoot(scratch1, Heap::kFixedArrayMapRootIndex); | |
ulan
2012/01/27 13:19:11
Ditto.
| |
259 | |
255 // Clear the heap tag on the elements array. | 260 // Clear the heap tag on the elements array. |
256 STATIC_ASSERT(kSmiTag == 0); | 261 STATIC_ASSERT(kSmiTag == 0); |
257 __ sub(elements_array_storage, | 262 __ sub(elements_array_storage, |
258 elements_array_storage, | 263 elements_array_storage, |
259 Operand(kHeapObjectTag)); | 264 Operand(kHeapObjectTag)); |
260 // Initialize the fixed array and fill it with holes. FixedArray length is | 265 // Initialize the fixed array and fill it with holes. FixedArray length is |
261 // stored as a smi. | 266 // stored as a smi. |
262 // result: JSObject | 267 // result: JSObject |
263 // elements_array_storage: elements array (untagged) | 268 // elements_array_storage: elements array (untagged) |
264 // array_size: size of array (smi) | 269 // array_size: size of array (smi) |
265 __ LoadRoot(scratch1, Heap::kFixedArrayMapRootIndex); | 270 // scratch1: FixedArray map |
266 ASSERT_EQ(0 * kPointerSize, FixedArray::kMapOffset); | 271 ASSERT_EQ(0 * kPointerSize, FixedArray::kMapOffset); |
267 __ str(scratch1, MemOperand(elements_array_storage, kPointerSize, PostIndex)); | 272 __ str(scratch1, MemOperand(elements_array_storage, kPointerSize, PostIndex)); |
268 STATIC_ASSERT(kSmiTag == 0); | 273 STATIC_ASSERT(kSmiTag == 0); |
269 ASSERT_EQ(1 * kPointerSize, FixedArray::kLengthOffset); | 274 ASSERT_EQ(1 * kPointerSize, FixedArray::kLengthOffset); |
270 __ str(array_size, | 275 __ str(array_size, |
271 MemOperand(elements_array_storage, kPointerSize, PostIndex)); | 276 MemOperand(elements_array_storage, kPointerSize, PostIndex)); |
272 | 277 |
273 // Calculate elements array and elements array end. | 278 // Calculate elements array and elements array end. |
274 // result: JSObject | 279 // result: JSObject |
275 // elements_array_storage: elements array element storage | 280 // elements_array_storage: elements array element storage |
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1769 __ bind(&dont_adapt_arguments); | 1774 __ bind(&dont_adapt_arguments); |
1770 __ Jump(r3); | 1775 __ Jump(r3); |
1771 } | 1776 } |
1772 | 1777 |
1773 | 1778 |
1774 #undef __ | 1779 #undef __ |
1775 | 1780 |
1776 } } // namespace v8::internal | 1781 } } // namespace v8::internal |
1777 | 1782 |
1778 #endif // V8_TARGET_ARCH_ARM | 1783 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |