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 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 if (FLAG_inline_alloc) { | 905 if (FLAG_inline_alloc) { |
906 Label slow_case; | 906 Label slow_case; |
907 // First compute the rounded instance size. | 907 // First compute the rounded instance size. |
908 // R1: number of context variables. | 908 // R1: number of context variables. |
909 intptr_t fixed_size = sizeof(RawContext) + kObjectAlignment - 1; | 909 intptr_t fixed_size = sizeof(RawContext) + kObjectAlignment - 1; |
910 __ LoadImmediate(R2, fixed_size); | 910 __ LoadImmediate(R2, fixed_size); |
911 __ add(R2, R2, Operand(R1, LSL, 3)); | 911 __ add(R2, R2, Operand(R1, LSL, 3)); |
912 ASSERT(kSmiTagShift == 1); | 912 ASSERT(kSmiTagShift == 1); |
913 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1))); | 913 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1))); |
914 | 914 |
| 915 __ MaybeTraceAllocation(kContextCid, R4, &slow_case, |
| 916 /* inline_isolate = */ false); |
915 // Now allocate the object. | 917 // Now allocate the object. |
916 // R1: number of context variables. | 918 // R1: number of context variables. |
917 // R2: object size. | 919 // R2: object size. |
918 const intptr_t cid = kContextCid; | 920 const intptr_t cid = kContextCid; |
919 Heap::Space space = Heap::SpaceForAllocation(cid); | 921 Heap::Space space = Heap::SpaceForAllocation(cid); |
920 __ LoadIsolate(R5); | 922 __ LoadIsolate(R5); |
921 __ ldr(R5, Address(R5, Isolate::heap_offset())); | 923 __ ldr(R5, Address(R5, Isolate::heap_offset())); |
922 __ ldr(R0, Address(R5, Heap::TopOffset(space))); | 924 __ ldr(R0, Address(R5, Heap::TopOffset(space))); |
923 __ add(R3, R2, Operand(R0)); | 925 __ add(R3, R2, Operand(R0)); |
924 // Check if the allocation fits into the remaining space. | 926 // Check if the allocation fits into the remaining space. |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 // kInlineInstanceSize is a constant used as a threshold for determining | 1084 // kInlineInstanceSize is a constant used as a threshold for determining |
1083 // when the object initialization should be done as a loop or as | 1085 // when the object initialization should be done as a loop or as |
1084 // straight line code. | 1086 // straight line code. |
1085 const int kInlineInstanceSize = 12; | 1087 const int kInlineInstanceSize = 12; |
1086 const intptr_t instance_size = cls.instance_size(); | 1088 const intptr_t instance_size = cls.instance_size(); |
1087 ASSERT(instance_size > 0); | 1089 ASSERT(instance_size > 0); |
1088 if (is_cls_parameterized) { | 1090 if (is_cls_parameterized) { |
1089 __ ldr(R1, Address(SP)); | 1091 __ ldr(R1, Address(SP)); |
1090 // R1: instantiated type arguments. | 1092 // R1: instantiated type arguments. |
1091 } | 1093 } |
| 1094 Isolate* isolate = Isolate::Current(); |
1092 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && | 1095 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && |
1093 !cls.trace_allocation()) { | 1096 !cls.TraceAllocation(isolate)) { |
1094 Label slow_case; | 1097 Label slow_case; |
1095 // Allocate the object and update top to point to | 1098 // Allocate the object and update top to point to |
1096 // next object start and initialize the allocated object. | 1099 // next object start and initialize the allocated object. |
1097 // R1: instantiated type arguments (if is_cls_parameterized). | 1100 // R1: instantiated type arguments (if is_cls_parameterized). |
1098 Heap::Space space = Heap::SpaceForAllocation(cls.id()); | 1101 Heap::Space space = Heap::SpaceForAllocation(cls.id()); |
1099 __ ldr(R5, Address(THR, Thread::heap_offset())); | 1102 __ ldr(R5, Address(THR, Thread::heap_offset())); |
1100 __ ldr(R2, Address(R5, Heap::TopOffset(space))); | 1103 __ ldr(R2, Address(R5, Heap::TopOffset(space))); |
1101 __ AddImmediate(R3, R2, instance_size); | 1104 __ AddImmediate(R3, R2, instance_size); |
1102 // Check if the allocation fits into the remaining space. | 1105 // Check if the allocation fits into the remaining space. |
1103 // R2: potential new object start. | 1106 // R2: potential new object start. |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2136 // Result: | 2139 // Result: |
2137 // R1: entry point. | 2140 // R1: entry point. |
2138 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { | 2141 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
2139 EmitMegamorphicLookup(assembler, R0, R1, R1); | 2142 EmitMegamorphicLookup(assembler, R0, R1, R1); |
2140 __ ret(); | 2143 __ ret(); |
2141 } | 2144 } |
2142 | 2145 |
2143 } // namespace dart | 2146 } // namespace dart |
2144 | 2147 |
2145 #endif // defined TARGET_ARCH_ARM64 | 2148 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |