| 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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 __ cmp(R2, Operand(0)); | 645 __ cmp(R2, Operand(0)); |
| 646 __ b(&slow_case, LT); | 646 __ b(&slow_case, LT); |
| 647 | 647 |
| 648 // Check for maximum allowed length. | 648 // Check for maximum allowed length. |
| 649 const intptr_t max_len = | 649 const intptr_t max_len = |
| 650 reinterpret_cast<intptr_t>(Smi::New(Array::kMaxElements)); | 650 reinterpret_cast<intptr_t>(Smi::New(Array::kMaxElements)); |
| 651 __ CompareImmediate(R2, max_len); | 651 __ CompareImmediate(R2, max_len); |
| 652 __ b(&slow_case, GT); | 652 __ b(&slow_case, GT); |
| 653 | 653 |
| 654 const intptr_t cid = kArrayCid; | 654 const intptr_t cid = kArrayCid; |
| 655 __ MaybeTraceAllocation(kArrayCid, R4, &slow_case); | 655 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kArrayCid, R4, &slow_case)); |
| 656 | 656 |
| 657 Heap::Space space = Heap::SpaceForAllocation(cid); | 657 Heap::Space space = Heap::SpaceForAllocation(cid); |
| 658 __ LoadIsolate(R8); | 658 __ LoadIsolate(R8); |
| 659 __ ldr(R8, Address(R8, Isolate::heap_offset())); | 659 __ ldr(R8, Address(R8, Isolate::heap_offset())); |
| 660 | 660 |
| 661 // Calculate and align allocation size. | 661 // Calculate and align allocation size. |
| 662 // Load new object start and calculate next object start. | 662 // Load new object start and calculate next object start. |
| 663 // R1: array element type. | 663 // R1: array element type. |
| 664 // R2: array length as Smi. | 664 // R2: array length as Smi. |
| 665 // R8: heap. | 665 // R8: heap. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 686 __ b(&slow_case, CS); // Branch if unsigned higher or equal. | 686 __ b(&slow_case, CS); // Branch if unsigned higher or equal. |
| 687 | 687 |
| 688 // Successfully allocated the object(s), now update top to point to | 688 // Successfully allocated the object(s), now update top to point to |
| 689 // next object start and initialize the object. | 689 // next object start and initialize the object. |
| 690 // R0: potential new object start. | 690 // R0: potential new object start. |
| 691 // R3: array size. | 691 // R3: array size. |
| 692 // R7: potential next object start. | 692 // R7: potential next object start. |
| 693 // R8: heap. | 693 // R8: heap. |
| 694 __ StoreToOffset(R7, R8, Heap::TopOffset(space)); | 694 __ StoreToOffset(R7, R8, Heap::TopOffset(space)); |
| 695 __ add(R0, R0, Operand(kHeapObjectTag)); | 695 __ add(R0, R0, Operand(kHeapObjectTag)); |
| 696 __ UpdateAllocationStatsWithSize(cid, R3, space); | 696 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R3, space)); |
| 697 | 697 |
| 698 // R0: new object start as a tagged pointer. | 698 // R0: new object start as a tagged pointer. |
| 699 // R1: array element type. | 699 // R1: array element type. |
| 700 // R2: array length as Smi. | 700 // R2: array length as Smi. |
| 701 // R3: array size. | 701 // R3: array size. |
| 702 // R7: new object end address. | 702 // R7: new object end address. |
| 703 | 703 |
| 704 // Store the type argument field. | 704 // Store the type argument field. |
| 705 __ StoreIntoObjectOffsetNoBarrier( | 705 __ StoreIntoObjectOffsetNoBarrier( |
| 706 R0, Array::type_arguments_offset(), R1); | 706 R0, Array::type_arguments_offset(), R1); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 if (FLAG_inline_alloc) { | 910 if (FLAG_inline_alloc) { |
| 911 Label slow_case; | 911 Label slow_case; |
| 912 // First compute the rounded instance size. | 912 // First compute the rounded instance size. |
| 913 // R1: number of context variables. | 913 // R1: number of context variables. |
| 914 intptr_t fixed_size = sizeof(RawContext) + kObjectAlignment - 1; | 914 intptr_t fixed_size = sizeof(RawContext) + kObjectAlignment - 1; |
| 915 __ LoadImmediate(R2, fixed_size); | 915 __ LoadImmediate(R2, fixed_size); |
| 916 __ add(R2, R2, Operand(R1, LSL, 3)); | 916 __ add(R2, R2, Operand(R1, LSL, 3)); |
| 917 ASSERT(kSmiTagShift == 1); | 917 ASSERT(kSmiTagShift == 1); |
| 918 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1))); | 918 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1))); |
| 919 | 919 |
| 920 __ MaybeTraceAllocation(kContextCid, R4, &slow_case); | 920 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kContextCid, R4, &slow_case)); |
| 921 // Now allocate the object. | 921 // Now allocate the object. |
| 922 // R1: number of context variables. | 922 // R1: number of context variables. |
| 923 // R2: object size. | 923 // R2: object size. |
| 924 const intptr_t cid = kContextCid; | 924 const intptr_t cid = kContextCid; |
| 925 Heap::Space space = Heap::SpaceForAllocation(cid); | 925 Heap::Space space = Heap::SpaceForAllocation(cid); |
| 926 __ LoadIsolate(R5); | 926 __ LoadIsolate(R5); |
| 927 __ ldr(R5, Address(R5, Isolate::heap_offset())); | 927 __ ldr(R5, Address(R5, Isolate::heap_offset())); |
| 928 __ ldr(R0, Address(R5, Heap::TopOffset(space))); | 928 __ ldr(R0, Address(R5, Heap::TopOffset(space))); |
| 929 __ add(R3, R2, Operand(R0)); | 929 __ add(R3, R2, Operand(R0)); |
| 930 // Check if the allocation fits into the remaining space. | 930 // Check if the allocation fits into the remaining space. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 943 | 943 |
| 944 // Successfully allocated the object, now update top to point to | 944 // Successfully allocated the object, now update top to point to |
| 945 // next object start and initialize the object. | 945 // next object start and initialize the object. |
| 946 // R0: new object. | 946 // R0: new object. |
| 947 // R1: number of context variables. | 947 // R1: number of context variables. |
| 948 // R2: object size. | 948 // R2: object size. |
| 949 // R3: next object start. | 949 // R3: next object start. |
| 950 // R5: heap. | 950 // R5: heap. |
| 951 __ str(R3, Address(R5, Heap::TopOffset(space))); | 951 __ str(R3, Address(R5, Heap::TopOffset(space))); |
| 952 __ add(R0, R0, Operand(kHeapObjectTag)); | 952 __ add(R0, R0, Operand(kHeapObjectTag)); |
| 953 __ UpdateAllocationStatsWithSize(cid, R2, space); | 953 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R2, space)); |
| 954 | 954 |
| 955 // Calculate the size tag. | 955 // Calculate the size tag. |
| 956 // R0: new object. | 956 // R0: new object. |
| 957 // R1: number of context variables. | 957 // R1: number of context variables. |
| 958 // R2: object size. | 958 // R2: object size. |
| 959 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; | 959 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; |
| 960 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); | 960 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); |
| 961 // If no size tag overflow, shift R2 left, else set R2 to zero. | 961 // If no size tag overflow, shift R2 left, else set R2 to zero. |
| 962 __ LslImmediate(TMP, R2, shift); | 962 __ LslImmediate(TMP, R2, shift); |
| 963 __ csel(R2, TMP, R2, LS); | 963 __ csel(R2, TMP, R2, LS); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 // R3: potential next object start. | 1117 // R3: potential next object start. |
| 1118 // R5: heap. | 1118 // R5: heap. |
| 1119 __ ldr(TMP, Address(R5, Heap::EndOffset(space))); | 1119 __ ldr(TMP, Address(R5, Heap::EndOffset(space))); |
| 1120 __ CompareRegisters(R3, TMP); | 1120 __ CompareRegisters(R3, TMP); |
| 1121 if (FLAG_use_slow_path) { | 1121 if (FLAG_use_slow_path) { |
| 1122 __ b(&slow_case); | 1122 __ b(&slow_case); |
| 1123 } else { | 1123 } else { |
| 1124 __ b(&slow_case, CS); // Unsigned higher or equal. | 1124 __ b(&slow_case, CS); // Unsigned higher or equal. |
| 1125 } | 1125 } |
| 1126 __ str(R3, Address(R5, Heap::TopOffset(space))); | 1126 __ str(R3, Address(R5, Heap::TopOffset(space))); |
| 1127 __ UpdateAllocationStats(cls.id(), space); | 1127 NOT_IN_PRODUCT(__ UpdateAllocationStats(cls.id(), space)); |
| 1128 | 1128 |
| 1129 // R2: new object start. | 1129 // R2: new object start. |
| 1130 // R3: next object start. | 1130 // R3: next object start. |
| 1131 // R1: new object type arguments (if is_cls_parameterized). | 1131 // R1: new object type arguments (if is_cls_parameterized). |
| 1132 // Set the tags. | 1132 // Set the tags. |
| 1133 uword tags = 0; | 1133 uword tags = 0; |
| 1134 tags = RawObject::SizeTag::update(instance_size, tags); | 1134 tags = RawObject::SizeTag::update(instance_size, tags); |
| 1135 ASSERT(cls.id() != kIllegalCid); | 1135 ASSERT(cls.id() != kIllegalCid); |
| 1136 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 1136 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
| 1137 __ LoadImmediate(R0, tags); | 1137 __ LoadImmediate(R0, tags); |
| (...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2230 } | 2230 } |
| 2231 | 2231 |
| 2232 | 2232 |
| 2233 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { | 2233 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { |
| 2234 __ brk(0); | 2234 __ brk(0); |
| 2235 } | 2235 } |
| 2236 | 2236 |
| 2237 } // namespace dart | 2237 } // namespace dart |
| 2238 | 2238 |
| 2239 #endif // defined TARGET_ARCH_ARM64 | 2239 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |