| 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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 | 687 |
| 688 // Check for maximum allowed length. | 688 // Check for maximum allowed length. |
| 689 const intptr_t max_len = | 689 const intptr_t max_len = |
| 690 reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements)); | 690 reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements)); |
| 691 __ CompareImmediate(R3, max_len); | 691 __ CompareImmediate(R3, max_len); |
| 692 __ b(&slow_case, GT); | 692 __ b(&slow_case, GT); |
| 693 | 693 |
| 694 const intptr_t cid = kArrayCid; | 694 const intptr_t cid = kArrayCid; |
| 695 NOT_IN_PRODUCT(__ MaybeTraceAllocation(cid, R4, &slow_case)); | 695 NOT_IN_PRODUCT(__ MaybeTraceAllocation(cid, R4, &slow_case)); |
| 696 | 696 |
| 697 const intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; | 697 const intptr_t fixed_size_plus_alignment_padding = |
| 698 __ LoadImmediate(R9, fixed_size); | 698 sizeof(RawArray) + kObjectAlignment - 1; |
| 699 __ add(R9, R9, Operand(R3, LSL, 1)); // R3 is a Smi. | 699 __ LoadImmediate(R9, fixed_size_plus_alignment_padding); |
| 700 __ add(R9, R9, Operand(R3, LSL, 1)); // R3 is a Smi. |
| 700 ASSERT(kSmiTagShift == 1); | 701 ASSERT(kSmiTagShift == 1); |
| 701 __ bic(R9, R9, Operand(kObjectAlignment - 1)); | 702 __ bic(R9, R9, Operand(kObjectAlignment - 1)); |
| 702 | 703 |
| 703 // R9: Allocation size. | 704 // R9: Allocation size. |
| 704 Heap::Space space = Heap::kNew; | 705 Heap::Space space = Heap::kNew; |
| 705 __ ldr(R8, Address(THR, Thread::heap_offset())); | 706 __ ldr(R8, Address(THR, Thread::heap_offset())); |
| 706 // Potential new object start. | 707 // Potential new object start. |
| 707 __ ldr(R0, Address(R8, Heap::TopOffset(space))); | 708 __ ldr(R0, Address(R8, Heap::TopOffset(space))); |
| 708 __ adds(NOTFP, R0, Operand(R9)); // Potential next object start. | 709 __ adds(NOTFP, R0, Operand(R9)); // Potential next object start. |
| 709 __ b(&slow_case, CS); // Branch if unsigned overflow. | 710 __ b(&slow_case, CS); // Branch if unsigned overflow. |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 // Called for inline allocation of contexts. | 909 // Called for inline allocation of contexts. |
| 909 // Input: | 910 // Input: |
| 910 // R1: number of context variables. | 911 // R1: number of context variables. |
| 911 // Output: | 912 // Output: |
| 912 // R0: new allocated RawContext object. | 913 // R0: new allocated RawContext object. |
| 913 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { | 914 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { |
| 914 if (FLAG_inline_alloc) { | 915 if (FLAG_inline_alloc) { |
| 915 Label slow_case; | 916 Label slow_case; |
| 916 // First compute the rounded instance size. | 917 // First compute the rounded instance size. |
| 917 // R1: number of context variables. | 918 // R1: number of context variables. |
| 918 intptr_t fixed_size = sizeof(RawContext) + kObjectAlignment - 1; | 919 intptr_t fixed_size_plus_alignment_padding = |
| 919 __ LoadImmediate(R2, fixed_size); | 920 sizeof(RawContext) + kObjectAlignment - 1; |
| 921 __ LoadImmediate(R2, fixed_size_plus_alignment_padding); |
| 920 __ add(R2, R2, Operand(R1, LSL, 2)); | 922 __ add(R2, R2, Operand(R1, LSL, 2)); |
| 921 ASSERT(kSmiTagShift == 1); | 923 ASSERT(kSmiTagShift == 1); |
| 922 __ bic(R2, R2, Operand(kObjectAlignment - 1)); | 924 __ bic(R2, R2, Operand(kObjectAlignment - 1)); |
| 923 | 925 |
| 924 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kContextCid, R8, &slow_case)); | 926 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kContextCid, R8, &slow_case)); |
| 925 // Now allocate the object. | 927 // Now allocate the object. |
| 926 // R1: number of context variables. | 928 // R1: number of context variables. |
| 927 // R2: object size. | 929 // R2: object size. |
| 928 const intptr_t cid = kContextCid; | 930 const intptr_t cid = kContextCid; |
| 929 Heap::Space space = Heap::kNew; | 931 Heap::Space space = Heap::kNew; |
| (...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2324 } | 2326 } |
| 2325 | 2327 |
| 2326 | 2328 |
| 2327 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { | 2329 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { |
| 2328 __ bkpt(0); | 2330 __ bkpt(0); |
| 2329 } | 2331 } |
| 2330 | 2332 |
| 2331 } // namespace dart | 2333 } // namespace dart |
| 2332 | 2334 |
| 2333 #endif // defined TARGET_ARCH_ARM | 2335 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |