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