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/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 // when the object initialization should be done as a loop or as | 1056 // when the object initialization should be done as a loop or as |
1057 // straight line code. | 1057 // straight line code. |
1058 const int kInlineInstanceSize = 12; | 1058 const int kInlineInstanceSize = 12; |
1059 const intptr_t instance_size = cls.instance_size(); | 1059 const intptr_t instance_size = cls.instance_size(); |
1060 ASSERT(instance_size > 0); | 1060 ASSERT(instance_size > 0); |
1061 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && | 1061 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && |
1062 !cls.trace_allocation()) { | 1062 !cls.trace_allocation()) { |
1063 Label slow_case; | 1063 Label slow_case; |
1064 // Allocate the object and update top to point to | 1064 // Allocate the object and update top to point to |
1065 // next object start and initialize the allocated object. | 1065 // next object start and initialize the allocated object. |
1066 Heap* heap = Isolate::Current()->heap(); | |
1067 Heap::Space space = Heap::SpaceForAllocation(cls.id()); | 1066 Heap::Space space = Heap::SpaceForAllocation(cls.id()); |
1068 __ LoadImmediate(R5, heap->TopAddress(space)); | 1067 __ ldr(R5, Address(THR, Thread::heap_offset())); |
1069 __ ldr(R0, Address(R5, 0)); | 1068 __ ldr(R0, Address(R5, Heap::TopOffset(space))); |
1070 __ AddImmediate(R1, R0, instance_size); | 1069 __ AddImmediate(R1, R0, instance_size); |
1071 // Check if the allocation fits into the remaining space. | 1070 // Check if the allocation fits into the remaining space. |
1072 // R0: potential new object start. | 1071 // R0: potential new object start. |
1073 // R1: potential next object start. | 1072 // R1: potential next object start. |
1074 __ LoadImmediate(IP, heap->EndAddress(space)); | 1073 // R5: heap. |
1075 __ ldr(IP, Address(IP, 0)); | 1074 __ ldr(IP, Address(R5, Heap::EndOffset(space))); |
1076 __ cmp(R1, Operand(IP)); | 1075 __ cmp(R1, Operand(IP)); |
1077 if (FLAG_use_slow_path) { | 1076 if (FLAG_use_slow_path) { |
1078 __ b(&slow_case); | 1077 __ b(&slow_case); |
1079 } else { | 1078 } else { |
1080 __ b(&slow_case, CS); // Unsigned higher or equal. | 1079 __ b(&slow_case, CS); // Unsigned higher or equal. |
1081 } | 1080 } |
1082 __ str(R1, Address(R5, 0)); | 1081 __ str(R1, Address(R5, Heap::TopOffset(space))); |
1083 | 1082 |
1084 // Load the address of the allocation stats table. We split up the load | 1083 // Load the address of the allocation stats table. We split up the load |
1085 // and the increment so that the dependent load is not too nearby. | 1084 // and the increment so that the dependent load is not too nearby. |
1086 __ LoadAllocationStatsAddress(R5, cls.id()); | 1085 __ LoadAllocationStatsAddress(R5, cls.id(), /* inline_isolate = */ false); |
1087 | 1086 |
1088 // R0: new object start. | 1087 // R0: new object start. |
1089 // R1: next object start. | 1088 // R1: next object start. |
1090 // R5: allocation stats table. | 1089 // R5: allocation stats table. |
1091 // Set the tags. | 1090 // Set the tags. |
1092 uword tags = 0; | 1091 uword tags = 0; |
1093 tags = RawObject::SizeTag::update(instance_size, tags); | 1092 tags = RawObject::SizeTag::update(instance_size, tags); |
1094 ASSERT(cls.id() != kIllegalCid); | 1093 ASSERT(cls.id() != kIllegalCid); |
1095 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 1094 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
1096 __ LoadImmediate(R2, tags); | 1095 __ LoadImmediate(R2, tags); |
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2096 // Result: | 2095 // Result: |
2097 // R1: entry point. | 2096 // R1: entry point. |
2098 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { | 2097 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
2099 EmitMegamorphicLookup(assembler, R0, R1, R1); | 2098 EmitMegamorphicLookup(assembler, R0, R1, R1); |
2100 __ Ret(); | 2099 __ Ret(); |
2101 } | 2100 } |
2102 | 2101 |
2103 } // namespace dart | 2102 } // namespace dart |
2104 | 2103 |
2105 #endif // defined TARGET_ARCH_ARM | 2104 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |