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