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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 __ pop(rdi); | 213 __ pop(rdi); |
214 __ pop(rax); | 214 __ pop(rax); |
215 | 215 |
216 __ bind(&allocate); | 216 __ bind(&allocate); |
217 } | 217 } |
218 | 218 |
219 // Now allocate the JSObject on the heap. | 219 // Now allocate the JSObject on the heap. |
220 __ movzxbq(rdi, FieldOperand(rax, Map::kInstanceSizeOffset)); | 220 __ movzxbq(rdi, FieldOperand(rax, Map::kInstanceSizeOffset)); |
221 __ shl(rdi, Immediate(kPointerSizeLog2)); | 221 __ shl(rdi, Immediate(kPointerSizeLog2)); |
222 // rdi: size of new object | 222 // rdi: size of new object |
223 __ AllocateInNewSpace(rdi, | 223 __ Allocate(rdi, |
224 rbx, | 224 rbx, |
225 rdi, | 225 rdi, |
226 no_reg, | 226 no_reg, |
227 &rt_call, | 227 &rt_call, |
228 NO_ALLOCATION_FLAGS); | 228 NO_ALLOCATION_FLAGS); |
229 // Allocated the JSObject, now initialize the fields. | 229 // Allocated the JSObject, now initialize the fields. |
230 // rax: initial map | 230 // rax: initial map |
231 // rbx: JSObject (not HeapObject tagged - the actual address). | 231 // rbx: JSObject (not HeapObject tagged - the actual address). |
232 // rdi: start of next object | 232 // rdi: start of next object |
233 __ movq(Operand(rbx, JSObject::kMapOffset), rax); | 233 __ movq(Operand(rbx, JSObject::kMapOffset), rax); |
234 __ LoadRoot(rcx, Heap::kEmptyFixedArrayRootIndex); | 234 __ LoadRoot(rcx, Heap::kEmptyFixedArrayRootIndex); |
235 __ movq(Operand(rbx, JSObject::kPropertiesOffset), rcx); | 235 __ movq(Operand(rbx, JSObject::kPropertiesOffset), rcx); |
236 __ movq(Operand(rbx, JSObject::kElementsOffset), rcx); | 236 __ movq(Operand(rbx, JSObject::kElementsOffset), rcx); |
237 // Set extra fields in the newly allocated object. | 237 // Set extra fields in the newly allocated object. |
238 // rax: initial map | 238 // rax: initial map |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 __ subq(rdx, rcx); | 280 __ subq(rdx, rcx); |
281 // Done if no extra properties are to be allocated. | 281 // Done if no extra properties are to be allocated. |
282 __ j(zero, &allocated); | 282 __ j(zero, &allocated); |
283 __ Assert(positive, "Property allocation count failed."); | 283 __ Assert(positive, "Property allocation count failed."); |
284 | 284 |
285 // Scale the number of elements by pointer size and add the header for | 285 // Scale the number of elements by pointer size and add the header for |
286 // FixedArrays to the start of the next object calculation from above. | 286 // FixedArrays to the start of the next object calculation from above. |
287 // rbx: JSObject | 287 // rbx: JSObject |
288 // rdi: start of next object (will be start of FixedArray) | 288 // rdi: start of next object (will be start of FixedArray) |
289 // rdx: number of elements in properties array | 289 // rdx: number of elements in properties array |
290 __ AllocateInNewSpace(FixedArray::kHeaderSize, | 290 __ Allocate(FixedArray::kHeaderSize, |
291 times_pointer_size, | 291 times_pointer_size, |
292 rdx, | 292 rdx, |
293 rdi, | 293 rdi, |
294 rax, | 294 rax, |
295 no_reg, | 295 no_reg, |
296 &undo_allocation, | 296 &undo_allocation, |
297 RESULT_CONTAINS_TOP); | 297 RESULT_CONTAINS_TOP); |
298 | 298 |
299 // Initialize the FixedArray. | 299 // Initialize the FixedArray. |
300 // rbx: JSObject | 300 // rbx: JSObject |
301 // rdi: FixedArray | 301 // rdi: FixedArray |
302 // rdx: number of elements | 302 // rdx: number of elements |
303 // rax: start of next object | 303 // rax: start of next object |
304 __ LoadRoot(rcx, Heap::kFixedArrayMapRootIndex); | 304 __ LoadRoot(rcx, Heap::kFixedArrayMapRootIndex); |
305 __ movq(Operand(rdi, HeapObject::kMapOffset), rcx); // setup the map | 305 __ movq(Operand(rdi, HeapObject::kMapOffset), rcx); // setup the map |
306 __ Integer32ToSmi(rdx, rdx); | 306 __ Integer32ToSmi(rdx, rdx); |
307 __ movq(Operand(rdi, FixedArray::kLengthOffset), rdx); // and length | 307 __ movq(Operand(rdi, FixedArray::kLengthOffset), rdx); // and length |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 | 1205 |
1206 if (FLAG_debug_code) { // Assert that array size is not zero. | 1206 if (FLAG_debug_code) { // Assert that array size is not zero. |
1207 __ testq(array_size, array_size); | 1207 __ testq(array_size, array_size); |
1208 __ Assert(not_zero, "array size is unexpectedly 0"); | 1208 __ Assert(not_zero, "array size is unexpectedly 0"); |
1209 } | 1209 } |
1210 | 1210 |
1211 // Allocate the JSArray object together with space for a FixedArray with the | 1211 // Allocate the JSArray object together with space for a FixedArray with the |
1212 // requested elements. | 1212 // requested elements. |
1213 SmiIndex index = | 1213 SmiIndex index = |
1214 masm->SmiToIndex(kScratchRegister, array_size, kPointerSizeLog2); | 1214 masm->SmiToIndex(kScratchRegister, array_size, kPointerSizeLog2); |
1215 __ AllocateInNewSpace(JSArray::kSize + FixedArray::kHeaderSize, | 1215 __ Allocate(JSArray::kSize + FixedArray::kHeaderSize, |
1216 index.scale, | 1216 index.scale, |
1217 index.reg, | 1217 index.reg, |
1218 result, | 1218 result, |
1219 elements_array_end, | 1219 elements_array_end, |
1220 scratch, | 1220 scratch, |
1221 gc_required, | 1221 gc_required, |
1222 TAG_OBJECT); | 1222 TAG_OBJECT); |
1223 | 1223 |
1224 // Allocated the JSArray. Now initialize the fields except for the elements | 1224 // Allocated the JSArray. Now initialize the fields except for the elements |
1225 // array. | 1225 // array. |
1226 // result: JSObject | 1226 // result: JSObject |
1227 // elements_array: initial map | 1227 // elements_array: initial map |
1228 // elements_array_end: start of next object | 1228 // elements_array_end: start of next object |
1229 // array_size: size of array (smi) | 1229 // array_size: size of array (smi) |
1230 Factory* factory = masm->isolate()->factory(); | 1230 Factory* factory = masm->isolate()->factory(); |
1231 __ movq(FieldOperand(result, JSObject::kMapOffset), elements_array); | 1231 __ movq(FieldOperand(result, JSObject::kMapOffset), elements_array); |
1232 __ Move(elements_array, factory->empty_fixed_array()); | 1232 __ Move(elements_array, factory->empty_fixed_array()); |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1893 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1893 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
1894 generator.Generate(); | 1894 generator.Generate(); |
1895 } | 1895 } |
1896 | 1896 |
1897 | 1897 |
1898 #undef __ | 1898 #undef __ |
1899 | 1899 |
1900 } } // namespace v8::internal | 1900 } } // namespace v8::internal |
1901 | 1901 |
1902 #endif // V8_TARGET_ARCH_X64 | 1902 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |