| 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_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 // Compute the size to be allocated, it is based on the array length | 606 // Compute the size to be allocated, it is based on the array length |
| 607 // and is computed as: | 607 // and is computed as: |
| 608 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). | 608 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). |
| 609 // Assert that length is a Smi. | 609 // Assert that length is a Smi. |
| 610 __ tst(R2, ShifterOperand(kSmiTagMask)); | 610 __ tst(R2, ShifterOperand(kSmiTagMask)); |
| 611 if (FLAG_use_slow_path) { | 611 if (FLAG_use_slow_path) { |
| 612 __ b(&slow_case); | 612 __ b(&slow_case); |
| 613 } else { | 613 } else { |
| 614 __ b(&slow_case, NE); | 614 __ b(&slow_case, NE); |
| 615 } | 615 } |
| 616 __ cmp(R2, ShifterOperand(0)); |
| 617 __ b(&slow_case, LT); |
| 618 |
| 619 // Check for maximum allowed length. |
| 620 const intptr_t max_len = |
| 621 reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements)); |
| 622 __ CompareImmediate(R2, max_len); |
| 623 __ b(&slow_case, GT); |
| 624 |
| 616 __ ldr(R8, FieldAddress(CTX, Context::isolate_offset())); | 625 __ ldr(R8, FieldAddress(CTX, Context::isolate_offset())); |
| 617 __ LoadFromOffset(kWord, R8, R8, Isolate::heap_offset()); | 626 __ LoadFromOffset(kWord, R8, R8, Isolate::heap_offset()); |
| 618 __ LoadFromOffset(kWord, R8, R8, Heap::new_space_offset()); | 627 __ LoadFromOffset(kWord, R8, R8, Heap::new_space_offset()); |
| 619 | 628 |
| 620 // Calculate and align allocation size. | 629 // Calculate and align allocation size. |
| 621 // Load new object start and calculate next object start. | 630 // Load new object start and calculate next object start. |
| 622 // R1: array element type. | 631 // R1: array element type. |
| 623 // R2: array length as Smi. | 632 // R2: array length as Smi. |
| 624 // R8: points to new space object. | 633 // R8: points to new space object. |
| 625 __ LoadFromOffset(kWord, R0, R8, Scavenger::top_offset()); | 634 __ LoadFromOffset(kWord, R0, R8, Scavenger::top_offset()); |
| 626 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; | 635 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; |
| 627 __ LoadImmediate(R3, fixed_size); | 636 __ LoadImmediate(R3, fixed_size); |
| 628 __ add(R3, R3, ShifterOperand(R2, LSL, 1)); // R2 is Smi. | 637 __ add(R3, R3, ShifterOperand(R2, LSL, 1)); // R2 is Smi. |
| 629 ASSERT(kSmiTagShift == 1); | 638 ASSERT(kSmiTagShift == 1); |
| 630 __ bic(R3, R3, ShifterOperand(kObjectAlignment - 1)); | 639 __ bic(R3, R3, ShifterOperand(kObjectAlignment - 1)); |
| 631 __ add(R7, R3, ShifterOperand(R0)); | 640 __ adds(R7, R3, ShifterOperand(R0)); |
| 641 __ b(&slow_case, VS); |
| 632 | 642 |
| 633 // Check if the allocation fits into the remaining space. | 643 // Check if the allocation fits into the remaining space. |
| 634 // R0: potential new object start. | 644 // R0: potential new object start. |
| 635 // R1: array element type. | 645 // R1: array element type. |
| 636 // R2: array length as Smi. | 646 // R2: array length as Smi. |
| 637 // R3: array size. | 647 // R3: array size. |
| 638 // R7: potential next object start. | 648 // R7: potential next object start. |
| 639 // R8: points to new space object. | 649 // R8: points to new space object. |
| 640 __ LoadFromOffset(kWord, IP, R8, Scavenger::end_offset()); | 650 __ LoadFromOffset(kWord, IP, R8, Scavenger::end_offset()); |
| 641 __ cmp(R7, ShifterOperand(IP)); | 651 __ cmp(R7, ShifterOperand(IP)); |
| (...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1846 const Register right = R0; | 1856 const Register right = R0; |
| 1847 __ ldr(left, Address(SP, 1 * kWordSize)); | 1857 __ ldr(left, Address(SP, 1 * kWordSize)); |
| 1848 __ ldr(right, Address(SP, 0 * kWordSize)); | 1858 __ ldr(right, Address(SP, 0 * kWordSize)); |
| 1849 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 1859 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 1850 __ Ret(); | 1860 __ Ret(); |
| 1851 } | 1861 } |
| 1852 | 1862 |
| 1853 } // namespace dart | 1863 } // namespace dart |
| 1854 | 1864 |
| 1855 #endif // defined TARGET_ARCH_ARM | 1865 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |