| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 // Compute the size to be allocated, it is based on the array length | 567 // Compute the size to be allocated, it is based on the array length |
| 568 // and is computed as: | 568 // and is computed as: |
| 569 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). | 569 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). |
| 570 // Assert that length is a Smi. | 570 // Assert that length is a Smi. |
| 571 __ testq(R10, Immediate(kSmiTagMask)); | 571 __ testq(R10, Immediate(kSmiTagMask)); |
| 572 if (FLAG_use_slow_path) { | 572 if (FLAG_use_slow_path) { |
| 573 __ jmp(&slow_case); | 573 __ jmp(&slow_case); |
| 574 } else { | 574 } else { |
| 575 __ j(NOT_ZERO, &slow_case); | 575 __ j(NOT_ZERO, &slow_case); |
| 576 } | 576 } |
| 577 __ cmpq(R10, Immediate(0)); |
| 578 __ j(LESS, &slow_case); |
| 579 |
| 580 // Check for maximum allowed length. |
| 581 const Immediate& max_len = |
| 582 Immediate(reinterpret_cast<int64_t>(Smi::New(Array::kMaxElements))); |
| 583 __ cmpq(R10, max_len); |
| 584 __ j(GREATER, &slow_case); |
| 585 |
| 577 __ movq(R13, FieldAddress(CTX, Context::isolate_offset())); | 586 __ movq(R13, FieldAddress(CTX, Context::isolate_offset())); |
| 578 __ movq(R13, Address(R13, Isolate::heap_offset())); | 587 __ movq(R13, Address(R13, Isolate::heap_offset())); |
| 579 __ movq(R13, Address(R13, Heap::new_space_offset())); | 588 __ movq(R13, Address(R13, Heap::new_space_offset())); |
| 580 | 589 |
| 581 // Calculate and align allocation size. | 590 // Calculate and align allocation size. |
| 582 // Load new object start and calculate next object start. | 591 // Load new object start and calculate next object start. |
| 583 // RBX: array element type. | 592 // RBX: array element type. |
| 584 // R10: Array length as Smi. | 593 // R10: Array length as Smi. |
| 585 // R13: Points to new space object. | 594 // R13: Points to new space object. |
| 586 __ movq(RAX, Address(R13, Scavenger::top_offset())); | 595 __ movq(RAX, Address(R13, Scavenger::top_offset())); |
| 587 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; | 596 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; |
| 588 __ leaq(R12, Address(R10, TIMES_4, fixed_size)); // R10 is Smi. | 597 __ leaq(R12, Address(R10, TIMES_4, fixed_size)); // R10 is Smi. |
| 589 ASSERT(kSmiTagShift == 1); | 598 ASSERT(kSmiTagShift == 1); |
| 590 __ andq(R12, Immediate(-kObjectAlignment)); | 599 __ andq(R12, Immediate(-kObjectAlignment)); |
| 591 __ leaq(R12, Address(RAX, R12, TIMES_1, 0)); | 600 __ addq(R12, RAX); |
| 601 __ j(CARRY, &slow_case); |
| 592 | 602 |
| 593 // Check if the allocation fits into the remaining space. | 603 // Check if the allocation fits into the remaining space. |
| 594 // RAX: potential new object start. | 604 // RAX: potential new object start. |
| 595 // R12: potential next object start. | 605 // R12: potential next object start. |
| 596 // RBX: array element type. | 606 // RBX: array element type. |
| 597 // R10: Array length as Smi. | 607 // R10: Array length as Smi. |
| 598 // R13: Points to new space object. | 608 // R13: Points to new space object. |
| 599 __ cmpq(R12, Address(R13, Scavenger::end_offset())); | 609 __ cmpq(R12, Address(R13, Scavenger::end_offset())); |
| 600 __ j(ABOVE_EQUAL, &slow_case); | 610 __ j(ABOVE_EQUAL, &slow_case); |
| 601 | 611 |
| (...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1837 | 1847 |
| 1838 __ movq(left, Address(RSP, 2 * kWordSize)); | 1848 __ movq(left, Address(RSP, 2 * kWordSize)); |
| 1839 __ movq(right, Address(RSP, 1 * kWordSize)); | 1849 __ movq(right, Address(RSP, 1 * kWordSize)); |
| 1840 GenerateIdenticalWithNumberCheckStub(assembler, left, right); | 1850 GenerateIdenticalWithNumberCheckStub(assembler, left, right); |
| 1841 __ ret(); | 1851 __ ret(); |
| 1842 } | 1852 } |
| 1843 | 1853 |
| 1844 } // namespace dart | 1854 } // namespace dart |
| 1845 | 1855 |
| 1846 #endif // defined TARGET_ARCH_X64 | 1856 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |