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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 int elements_size = 0; | 326 int elements_size = 0; |
327 if (length > 0) { | 327 if (length > 0) { |
328 elements_size = mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS | 328 elements_size = mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
329 ? FixedDoubleArray::SizeFor(length) | 329 ? FixedDoubleArray::SizeFor(length) |
330 : FixedArray::SizeFor(length); | 330 : FixedArray::SizeFor(length); |
331 } | 331 } |
332 int size = JSArray::kSize + elements_size; | 332 int size = JSArray::kSize + elements_size; |
333 | 333 |
334 // Allocate both the JS array and the elements array in one big | 334 // Allocate both the JS array and the elements array in one big |
335 // allocation. This avoids multiple limit checks. | 335 // allocation. This avoids multiple limit checks. |
336 __ AllocateInNewSpace(size, rax, rbx, rdx, fail, TAG_OBJECT); | 336 AllocationFlags flags = TAG_OBJECT; |
| 337 if (mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS) { |
| 338 flags = static_cast<AllocationFlags>(DOUBLE_ALIGNMENT | flags); |
| 339 } |
| 340 __ AllocateInNewSpace(size, rax, rbx, rdx, fail, flags); |
337 | 341 |
338 // Copy the JS array part. | 342 // Copy the JS array part. |
339 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { | 343 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { |
340 if ((i != JSArray::kElementsOffset) || (length == 0)) { | 344 if ((i != JSArray::kElementsOffset) || (length == 0)) { |
341 __ movq(rbx, FieldOperand(rcx, i)); | 345 __ movq(rbx, FieldOperand(rcx, i)); |
342 __ movq(FieldOperand(rax, i), rbx); | 346 __ movq(FieldOperand(rax, i), rbx); |
343 } | 347 } |
344 } | 348 } |
345 | 349 |
346 if (length > 0) { | 350 if (length > 0) { |
(...skipping 6134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6481 #endif | 6485 #endif |
6482 | 6486 |
6483 __ Ret(); | 6487 __ Ret(); |
6484 } | 6488 } |
6485 | 6489 |
6486 #undef __ | 6490 #undef __ |
6487 | 6491 |
6488 } } // namespace v8::internal | 6492 } } // namespace v8::internal |
6489 | 6493 |
6490 #endif // V8_TARGET_ARCH_X64 | 6494 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |