| 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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 __ MaybeTraceAllocation(kArrayCid, R4, &slow_case); |
| 656 | 656 |
| 657 Heap::Space space = Heap::SpaceForAllocation(cid); | 657 Heap::Space space = Heap::kNew; |
| 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. |
| 666 __ LoadFromOffset(R0, R8, Heap::TopOffset(space)); | 666 __ LoadFromOffset(R0, R8, Heap::TopOffset(space)); |
| 667 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; | 667 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 __ 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::kNew; |
| 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. |
| 931 // R0: potential new object. | 931 // R0: potential new object. |
| 932 // R1: number of context variables. | 932 // R1: number of context variables. |
| 933 // R2: object size. | 933 // R2: object size. |
| 934 // R3: potential next object start. | 934 // R3: potential next object start. |
| 935 // R5: heap. | 935 // R5: heap. |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 __ ldr(R1, Address(SP)); | 1101 __ ldr(R1, Address(SP)); |
| 1102 // R1: instantiated type arguments. | 1102 // R1: instantiated type arguments. |
| 1103 } | 1103 } |
| 1104 Isolate* isolate = Isolate::Current(); | 1104 Isolate* isolate = Isolate::Current(); |
| 1105 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && | 1105 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && |
| 1106 !cls.TraceAllocation(isolate)) { | 1106 !cls.TraceAllocation(isolate)) { |
| 1107 Label slow_case; | 1107 Label slow_case; |
| 1108 // Allocate the object and update top to point to | 1108 // Allocate the object and update top to point to |
| 1109 // next object start and initialize the allocated object. | 1109 // next object start and initialize the allocated object. |
| 1110 // R1: instantiated type arguments (if is_cls_parameterized). | 1110 // R1: instantiated type arguments (if is_cls_parameterized). |
| 1111 Heap::Space space = Heap::SpaceForAllocation(cls.id()); | 1111 Heap::Space space = Heap::kNew; |
| 1112 __ ldr(R5, Address(THR, Thread::heap_offset())); | 1112 __ ldr(R5, Address(THR, Thread::heap_offset())); |
| 1113 __ ldr(R2, Address(R5, Heap::TopOffset(space))); | 1113 __ ldr(R2, Address(R5, Heap::TopOffset(space))); |
| 1114 __ AddImmediate(R3, R2, instance_size); | 1114 __ AddImmediate(R3, R2, instance_size); |
| 1115 // Check if the allocation fits into the remaining space. | 1115 // Check if the allocation fits into the remaining space. |
| 1116 // R2: potential new object start. | 1116 // R2: potential new object start. |
| 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) { |
| (...skipping 1108 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 |