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