OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
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/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 | 681 |
682 // Check for maximum allowed length. | 682 // Check for maximum allowed length. |
683 const intptr_t max_len = | 683 const intptr_t max_len = |
684 reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements)); | 684 reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements)); |
685 __ CompareImmediate(R3, max_len); | 685 __ CompareImmediate(R3, max_len); |
686 __ b(&slow_case, GT); | 686 __ b(&slow_case, GT); |
687 | 687 |
688 const intptr_t cid = kArrayCid; | 688 const intptr_t cid = kArrayCid; |
689 NOT_IN_PRODUCT(__ MaybeTraceAllocation(cid, R4, &slow_case)); | 689 NOT_IN_PRODUCT(__ MaybeTraceAllocation(cid, R4, &slow_case)); |
690 | 690 |
691 const intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; | 691 const intptr_t fixed_size_plus_alignment_padding = |
692 __ LoadImmediate(R9, fixed_size); | 692 sizeof(RawArray) + kObjectAlignment - 1; |
693 __ add(R9, R9, Operand(R3, LSL, 1)); // R3 is a Smi. | 693 __ LoadImmediate(R9, fixed_size_plus_alignment_padding); |
| 694 __ add(R9, R9, Operand(R3, LSL, 1)); // R3 is a Smi. |
694 ASSERT(kSmiTagShift == 1); | 695 ASSERT(kSmiTagShift == 1); |
695 __ bic(R9, R9, Operand(kObjectAlignment - 1)); | 696 __ bic(R9, R9, Operand(kObjectAlignment - 1)); |
696 | 697 |
697 // R9: Allocation size. | 698 // R9: Allocation size. |
698 Heap::Space space = Heap::kNew; | 699 Heap::Space space = Heap::kNew; |
699 __ ldr(R8, Address(THR, Thread::heap_offset())); | 700 __ ldr(R8, Address(THR, Thread::heap_offset())); |
700 // Potential new object start. | 701 // Potential new object start. |
701 __ ldr(R0, Address(R8, Heap::TopOffset(space))); | 702 __ ldr(R0, Address(R8, Heap::TopOffset(space))); |
702 __ adds(NOTFP, R0, Operand(R9)); // Potential next object start. | 703 __ adds(NOTFP, R0, Operand(R9)); // Potential next object start. |
703 __ b(&slow_case, CS); // Branch if unsigned overflow. | 704 __ b(&slow_case, CS); // Branch if unsigned overflow. |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 // Called for inline allocation of contexts. | 903 // Called for inline allocation of contexts. |
903 // Input: | 904 // Input: |
904 // R1: number of context variables. | 905 // R1: number of context variables. |
905 // Output: | 906 // Output: |
906 // R0: new allocated RawContext object. | 907 // R0: new allocated RawContext object. |
907 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { | 908 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { |
908 if (FLAG_inline_alloc) { | 909 if (FLAG_inline_alloc) { |
909 Label slow_case; | 910 Label slow_case; |
910 // First compute the rounded instance size. | 911 // First compute the rounded instance size. |
911 // R1: number of context variables. | 912 // R1: number of context variables. |
912 intptr_t fixed_size = sizeof(RawContext) + kObjectAlignment - 1; | 913 intptr_t fixed_size_plus_alignment_padding = |
913 __ LoadImmediate(R2, fixed_size); | 914 sizeof(RawContext) + kObjectAlignment - 1; |
| 915 __ LoadImmediate(R2, fixed_size_plus_alignment_padding); |
914 __ add(R2, R2, Operand(R1, LSL, 2)); | 916 __ add(R2, R2, Operand(R1, LSL, 2)); |
915 ASSERT(kSmiTagShift == 1); | 917 ASSERT(kSmiTagShift == 1); |
916 __ bic(R2, R2, Operand(kObjectAlignment - 1)); | 918 __ bic(R2, R2, Operand(kObjectAlignment - 1)); |
917 | 919 |
918 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kContextCid, R8, &slow_case)); | 920 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kContextCid, R8, &slow_case)); |
919 // Now allocate the object. | 921 // Now allocate the object. |
920 // R1: number of context variables. | 922 // R1: number of context variables. |
921 // R2: object size. | 923 // R2: object size. |
922 const intptr_t cid = kContextCid; | 924 const intptr_t cid = kContextCid; |
923 Heap::Space space = Heap::kNew; | 925 Heap::Space space = Heap::kNew; |
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2313 } | 2315 } |
2314 | 2316 |
2315 | 2317 |
2316 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { | 2318 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { |
2317 __ bkpt(0); | 2319 __ bkpt(0); |
2318 } | 2320 } |
2319 | 2321 |
2320 } // namespace dart | 2322 } // namespace dart |
2321 | 2323 |
2322 #endif // defined TARGET_ARCH_ARM | 2324 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |