| 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/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 | 716 |
| 717 Heap::Space space = Heap::kNew; | 717 Heap::Space space = Heap::kNew; |
| 718 __ ldr(R8, Address(THR, Thread::heap_offset())); | 718 __ ldr(R8, Address(THR, Thread::heap_offset())); |
| 719 | 719 |
| 720 // Calculate and align allocation size. | 720 // Calculate and align allocation size. |
| 721 // Load new object start and calculate next object start. | 721 // Load new object start and calculate next object start. |
| 722 // R1: array element type. | 722 // R1: array element type. |
| 723 // R2: array length as Smi. | 723 // R2: array length as Smi. |
| 724 // R8: heap. | 724 // R8: heap. |
| 725 __ LoadFromOffset(R0, R8, Heap::TopOffset(space)); | 725 __ LoadFromOffset(R0, R8, Heap::TopOffset(space)); |
| 726 intptr_t fixed_size_plus_alignment_padding = | 726 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; |
| 727 sizeof(RawArray) + kObjectAlignment - 1; | 727 __ LoadImmediate(R3, fixed_size); |
| 728 __ LoadImmediate(R3, fixed_size_plus_alignment_padding); | |
| 729 __ add(R3, R3, Operand(R2, LSL, 2)); // R2 is Smi. | 728 __ add(R3, R3, Operand(R2, LSL, 2)); // R2 is Smi. |
| 730 ASSERT(kSmiTagShift == 1); | 729 ASSERT(kSmiTagShift == 1); |
| 731 __ andi(R3, R3, Immediate(~(kObjectAlignment - 1))); | 730 __ andi(R3, R3, Immediate(~(kObjectAlignment - 1))); |
| 732 // R0: potential new object start. | 731 // R0: potential new object start. |
| 733 // R3: object size in bytes. | 732 // R3: object size in bytes. |
| 734 __ adds(R7, R3, Operand(R0)); | 733 __ adds(R7, R3, Operand(R0)); |
| 735 __ b(&slow_case, CS); // Branch if unsigned overflow. | 734 __ b(&slow_case, CS); // Branch if unsigned overflow. |
| 736 | 735 |
| 737 // Check if the allocation fits into the remaining space. | 736 // Check if the allocation fits into the remaining space. |
| 738 // R0: potential new object start. | 737 // R0: potential new object start. |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 // Called for inline allocation of contexts. | 962 // Called for inline allocation of contexts. |
| 964 // Input: | 963 // Input: |
| 965 // R1: number of context variables. | 964 // R1: number of context variables. |
| 966 // Output: | 965 // Output: |
| 967 // R0: new allocated RawContext object. | 966 // R0: new allocated RawContext object. |
| 968 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { | 967 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { |
| 969 if (FLAG_inline_alloc) { | 968 if (FLAG_inline_alloc) { |
| 970 Label slow_case; | 969 Label slow_case; |
| 971 // First compute the rounded instance size. | 970 // First compute the rounded instance size. |
| 972 // R1: number of context variables. | 971 // R1: number of context variables. |
| 973 intptr_t fixed_size_plus_alignment_padding = | 972 intptr_t fixed_size = sizeof(RawContext) + kObjectAlignment - 1; |
| 974 sizeof(RawContext) + kObjectAlignment - 1; | 973 __ LoadImmediate(R2, fixed_size); |
| 975 __ LoadImmediate(R2, fixed_size_plus_alignment_padding); | |
| 976 __ add(R2, R2, Operand(R1, LSL, 3)); | 974 __ add(R2, R2, Operand(R1, LSL, 3)); |
| 977 ASSERT(kSmiTagShift == 1); | 975 ASSERT(kSmiTagShift == 1); |
| 978 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1))); | 976 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1))); |
| 979 | 977 |
| 980 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kContextCid, R4, &slow_case)); | 978 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kContextCid, R4, &slow_case)); |
| 981 // Now allocate the object. | 979 // Now allocate the object. |
| 982 // R1: number of context variables. | 980 // R1: number of context variables. |
| 983 // R2: object size. | 981 // R2: object size. |
| 984 const intptr_t cid = kContextCid; | 982 const intptr_t cid = kContextCid; |
| 985 Heap::Space space = Heap::kNew; | 983 Heap::Space space = Heap::kNew; |
| (...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2297 | 2295 |
| 2298 // Called from switchable IC calls. | 2296 // Called from switchable IC calls. |
| 2299 // R0: receiver | 2297 // R0: receiver |
| 2300 // R5: SingleTargetCache | 2298 // R5: SingleTargetCache |
| 2301 // Passed to target: | 2299 // Passed to target: |
| 2302 // CODE_REG: target Code object | 2300 // CODE_REG: target Code object |
| 2303 void StubCode::GenerateSingleTargetCallStub(Assembler* assembler) { | 2301 void StubCode::GenerateSingleTargetCallStub(Assembler* assembler) { |
| 2304 Label miss; | 2302 Label miss; |
| 2305 __ LoadClassIdMayBeSmi(R1, R0); | 2303 __ LoadClassIdMayBeSmi(R1, R0); |
| 2306 __ ldr(R2, FieldAddress(R5, SingleTargetCache::lower_limit_offset()), | 2304 __ ldr(R2, FieldAddress(R5, SingleTargetCache::lower_limit_offset()), |
| 2307 kUnsignedHalfword); | 2305 kUnsignedWord); |
| 2308 __ ldr(R3, FieldAddress(R5, SingleTargetCache::upper_limit_offset()), | 2306 __ ldr(R3, FieldAddress(R5, SingleTargetCache::upper_limit_offset()), |
| 2309 kUnsignedHalfword); | 2307 kUnsignedWord); |
| 2310 | 2308 |
| 2311 __ cmp(R1, Operand(R2)); | 2309 __ cmp(R1, Operand(R2)); |
| 2312 __ b(&miss, LT); | 2310 __ b(&miss, LT); |
| 2313 __ cmp(R1, Operand(R3)); | 2311 __ cmp(R1, Operand(R3)); |
| 2314 __ b(&miss, GT); | 2312 __ b(&miss, GT); |
| 2315 | 2313 |
| 2316 __ ldr(R1, FieldAddress(R5, SingleTargetCache::entry_point_offset())); | 2314 __ ldr(R1, FieldAddress(R5, SingleTargetCache::entry_point_offset())); |
| 2317 __ ldr(CODE_REG, FieldAddress(R5, SingleTargetCache::target_offset())); | 2315 __ ldr(CODE_REG, FieldAddress(R5, SingleTargetCache::target_offset())); |
| 2318 __ br(R1); | 2316 __ br(R1); |
| 2319 | 2317 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2363 } | 2361 } |
| 2364 | 2362 |
| 2365 | 2363 |
| 2366 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { | 2364 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { |
| 2367 __ brk(0); | 2365 __ brk(0); |
| 2368 } | 2366 } |
| 2369 | 2367 |
| 2370 } // namespace dart | 2368 } // namespace dart |
| 2371 | 2369 |
| 2372 #endif // defined TARGET_ARCH_ARM64 | 2370 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |