| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 // R1: array element type (either NULL or an instantiated type). | 610 // R1: array element type (either NULL or an instantiated type). |
| 611 // NOTE: R2 cannot be clobbered here as the caller relies on it being saved. | 611 // NOTE: R2 cannot be clobbered here as the caller relies on it being saved. |
| 612 // The newly allocated object is returned in R0. | 612 // The newly allocated object is returned in R0. |
| 613 void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { | 613 void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { |
| 614 Label slow_case; | 614 Label slow_case; |
| 615 if (FLAG_inline_alloc) { | 615 if (FLAG_inline_alloc) { |
| 616 // Compute the size to be allocated, it is based on the array length | 616 // Compute the size to be allocated, it is based on the array length |
| 617 // and is computed as: | 617 // and is computed as: |
| 618 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). | 618 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). |
| 619 // Assert that length is a Smi. | 619 // Assert that length is a Smi. |
| 620 |
| 621 // TODO(zra): Fix code below before enabling. |
| 622 __ b(&slow_case); |
| 620 __ tsti(R2, kSmiTagMask); | 623 __ tsti(R2, kSmiTagMask); |
| 621 if (FLAG_use_slow_path) { | 624 if (FLAG_use_slow_path) { |
| 622 __ b(&slow_case); | 625 __ b(&slow_case); |
| 623 } else { | 626 } else { |
| 624 __ b(&slow_case, NE); | 627 __ b(&slow_case, NE); |
| 625 } | 628 } |
| 629 __ cmp(R2, Operand(0)); |
| 630 __ b(&slow_case, LT); |
| 626 __ LoadFieldFromOffset(R8, CTX, Context::isolate_offset(), kNoPP); | 631 __ LoadFieldFromOffset(R8, CTX, Context::isolate_offset(), kNoPP); |
| 627 __ LoadFromOffset(R8, R8, Isolate::heap_offset(), kNoPP); | 632 __ LoadFromOffset(R8, R8, Isolate::heap_offset(), kNoPP); |
| 628 __ LoadFromOffset(R8, R8, Heap::new_space_offset(), kNoPP); | 633 __ LoadFromOffset(R8, R8, Heap::new_space_offset(), kNoPP); |
| 629 | 634 |
| 630 // Calculate and align allocation size. | 635 // Calculate and align allocation size. |
| 631 // Load new object start and calculate next object start. | 636 // Load new object start and calculate next object start. |
| 632 // R1: array element type. | 637 // R1: array element type. |
| 633 // R2: array length as Smi. | 638 // R2: array length as Smi. |
| 634 // R8: points to new space object. | 639 // R8: points to new space object. |
| 635 __ LoadFromOffset(R0, R8, Scavenger::top_offset(), kNoPP); | 640 __ LoadFromOffset(R0, R8, Scavenger::top_offset(), kNoPP); |
| 636 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; | 641 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; |
| 637 __ LoadImmediate(R3, fixed_size, kNoPP); | 642 __ LoadImmediate(R3, fixed_size, kNoPP); |
| 638 __ add(R3, R3, Operand(R2, LSL, 2)); // R2 is Smi. | 643 __ add(R3, R3, Operand(R2, LSL, 2)); // R2 is Smi. |
| 639 ASSERT(kSmiTagShift == 1); | 644 ASSERT(kSmiTagShift == 1); |
| 640 __ andi(R3, R3, ~(kObjectAlignment - 1)); | 645 __ andi(R3, R3, ~(kObjectAlignment - 1)); |
| 641 __ add(R7, R3, Operand(R0)); | 646 __ adds(R7, R3, Operand(R0)); |
| 647 __ b(&slow_case, VS); |
| 642 | 648 |
| 643 // Check if the allocation fits into the remaining space. | 649 // Check if the allocation fits into the remaining space. |
| 644 // R0: potential new object start. | 650 // R0: potential new object start. |
| 645 // R1: array element type. | 651 // R1: array element type. |
| 646 // R2: array length as Smi. | 652 // R2: array length as Smi. |
| 647 // R3: array size. | 653 // R3: array size. |
| 648 // R7: potential next object start. | 654 // R7: potential next object start. |
| 649 // R8: points to new space object. | 655 // R8: points to new space object. |
| 650 __ LoadFromOffset(TMP, R8, Scavenger::end_offset(), kNoPP); | 656 __ LoadFromOffset(TMP, R8, Scavenger::end_offset(), kNoPP); |
| 651 __ CompareRegisters(R7, TMP); | 657 __ CompareRegisters(R7, TMP); |
| (...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 const Register right = R0; | 1919 const Register right = R0; |
| 1914 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); | 1920 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); |
| 1915 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); | 1921 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); |
| 1916 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 1922 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 1917 __ ret(); | 1923 __ ret(); |
| 1918 } | 1924 } |
| 1919 | 1925 |
| 1920 } // namespace dart | 1926 } // namespace dart |
| 1921 | 1927 |
| 1922 #endif // defined TARGET_ARCH_ARM64 | 1928 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |