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/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 if (is_cls_parameterized) { | 1100 if (is_cls_parameterized) { |
1101 __ ldr(R1, Address(SP)); | 1101 __ ldr(R1, Address(SP)); |
1102 // R1: instantiated type arguments. | 1102 // R1: instantiated type arguments. |
1103 } | 1103 } |
1104 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && | 1104 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && |
1105 !cls.trace_allocation()) { | 1105 !cls.trace_allocation()) { |
1106 Label slow_case; | 1106 Label slow_case; |
1107 // Allocate the object and update top to point to | 1107 // Allocate the object and update top to point to |
1108 // next object start and initialize the allocated object. | 1108 // next object start and initialize the allocated object. |
1109 // R1: instantiated type arguments (if is_cls_parameterized). | 1109 // R1: instantiated type arguments (if is_cls_parameterized). |
1110 Heap* heap = Isolate::Current()->heap(); | |
1111 Heap::Space space = Heap::SpaceForAllocation(cls.id()); | 1110 Heap::Space space = Heap::SpaceForAllocation(cls.id()); |
1112 __ LoadImmediate(R5, heap->TopAddress(space)); | 1111 __ ldr(R5, Address(THR, Thread::heap_offset())); |
1113 __ ldr(R2, Address(R5)); | 1112 __ ldr(R2, Address(R5, Heap::TopOffset(space))); |
1114 __ AddImmediate(R3, R2, instance_size); | 1113 __ AddImmediate(R3, R2, instance_size); |
1115 // Check if the allocation fits into the remaining space. | 1114 // Check if the allocation fits into the remaining space. |
1116 // R2: potential new object start. | 1115 // R2: potential new object start. |
1117 // R3: potential next object start. | 1116 // R3: potential next object start. |
1118 __ LoadImmediate(TMP, heap->EndAddress(space)); | 1117 // R5: heap. |
1119 __ ldr(TMP, Address(TMP)); | 1118 __ ldr(TMP, Address(R5, Heap::EndOffset(space))); |
1120 __ CompareRegisters(R3, TMP); | 1119 __ CompareRegisters(R3, TMP); |
1121 if (FLAG_use_slow_path) { | 1120 if (FLAG_use_slow_path) { |
1122 __ b(&slow_case); | 1121 __ b(&slow_case); |
1123 } else { | 1122 } else { |
1124 __ b(&slow_case, CS); // Unsigned higher or equal. | 1123 __ b(&slow_case, CS); // Unsigned higher or equal. |
1125 } | 1124 } |
1126 __ str(R3, Address(R5)); | 1125 __ str(R3, Address(R5, Heap::TopOffset(space))); |
1127 __ UpdateAllocationStats(cls.id(), space); | 1126 __ UpdateAllocationStats(cls.id(), space, /* inline_isolate = */ false); |
1128 | 1127 |
1129 // R2: new object start. | 1128 // R2: new object start. |
1130 // R3: next object start. | 1129 // R3: next object start. |
1131 // R1: new object type arguments (if is_cls_parameterized). | 1130 // R1: new object type arguments (if is_cls_parameterized). |
1132 // Set the tags. | 1131 // Set the tags. |
1133 uword tags = 0; | 1132 uword tags = 0; |
1134 tags = RawObject::SizeTag::update(instance_size, tags); | 1133 tags = RawObject::SizeTag::update(instance_size, tags); |
1135 ASSERT(cls.id() != kIllegalCid); | 1134 ASSERT(cls.id() != kIllegalCid); |
1136 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 1135 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
1137 __ LoadImmediate(R0, tags); | 1136 __ LoadImmediate(R0, tags); |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2155 // Result: | 2154 // Result: |
2156 // R1: entry point. | 2155 // R1: entry point. |
2157 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { | 2156 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
2158 EmitMegamorphicLookup(assembler, R0, R1, R1); | 2157 EmitMegamorphicLookup(assembler, R0, R1, R1); |
2159 __ ret(); | 2158 __ ret(); |
2160 } | 2159 } |
2161 | 2160 |
2162 } // namespace dart | 2161 } // namespace dart |
2163 | 2162 |
2164 #endif // defined TARGET_ARCH_ARM64 | 2163 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |