Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: runtime/vm/stub_code_arm.cc

Issue 167683002: Simplify type argument instantiation cache lookup by introducing an array (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/compiler.h" 10 #include "vm/compiler.h"
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 // The generated code is different if the class is parameterized. 1103 // The generated code is different if the class is parameterized.
1104 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; 1104 const bool is_cls_parameterized = cls.NumTypeArguments() > 0;
1105 ASSERT(!is_cls_parameterized || 1105 ASSERT(!is_cls_parameterized ||
1106 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); 1106 (cls.type_arguments_field_offset() != Class::kNoTypeArguments));
1107 // kInlineInstanceSize is a constant used as a threshold for determining 1107 // kInlineInstanceSize is a constant used as a threshold for determining
1108 // when the object initialization should be done as a loop or as 1108 // when the object initialization should be done as a loop or as
1109 // straight line code. 1109 // straight line code.
1110 const int kInlineInstanceSize = 12; 1110 const int kInlineInstanceSize = 12;
1111 const intptr_t instance_size = cls.instance_size(); 1111 const intptr_t instance_size = cls.instance_size();
1112 ASSERT(instance_size > 0); 1112 ASSERT(instance_size > 0);
1113 Label slow_case_with_type_arguments; 1113 if (is_cls_parameterized) {
1114 __ ldr(R1, Address(SP, 0));
1115 // R1: instantiated type arguments.
1116 }
1114 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size)) { 1117 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size)) {
1115 Label slow_case_reload_type_arguments; 1118 Label slow_case;
1116 if (is_cls_parameterized) {
1117 __ ldr(R1, Address(SP, 0));
1118 // R1: instantiated type arguments.
1119 }
1120 // Allocate the object and update top to point to 1119 // Allocate the object and update top to point to
1121 // next object start and initialize the allocated object. 1120 // next object start and initialize the allocated object.
1122 // R1: instantiated type arguments (if is_cls_parameterized). 1121 // R1: instantiated type arguments (if is_cls_parameterized).
1123 Heap* heap = Isolate::Current()->heap(); 1122 Heap* heap = Isolate::Current()->heap();
1124 __ LoadImmediate(R5, heap->TopAddress()); 1123 __ LoadImmediate(R5, heap->TopAddress());
1125 __ ldr(R2, Address(R5, 0)); 1124 __ ldr(R2, Address(R5, 0));
1126 __ AddImmediate(R3, R2, instance_size); 1125 __ AddImmediate(R3, R2, instance_size);
1127 // Check if the allocation fits into the remaining space. 1126 // Check if the allocation fits into the remaining space.
1128 // R2: potential new object start. 1127 // R2: potential new object start.
1129 // R3: potential next object start. 1128 // R3: potential next object start.
1130 __ LoadImmediate(IP, heap->EndAddress()); 1129 __ LoadImmediate(IP, heap->EndAddress());
1131 __ ldr(IP, Address(IP, 0)); 1130 __ ldr(IP, Address(IP, 0));
1132 __ cmp(R3, ShifterOperand(IP)); 1131 __ cmp(R3, ShifterOperand(IP));
1133 if (FLAG_use_slow_path) { 1132 if (FLAG_use_slow_path) {
1134 __ b(&slow_case_with_type_arguments); 1133 __ b(&slow_case);
1135 } else { 1134 } else {
1136 __ b(&slow_case_with_type_arguments, CS); // Unsigned higher or equal. 1135 __ b(&slow_case, CS); // Unsigned higher or equal.
1137 } 1136 }
1138 __ str(R3, Address(R5, 0)); 1137 __ str(R3, Address(R5, 0));
1139 __ UpdateAllocationStats(cls.id(), R5); 1138 __ UpdateAllocationStats(cls.id(), R5);
1140 1139
1141 // R2: new object start. 1140 // R2: new object start.
1142 // R3: next object start. 1141 // R3: next object start.
1143 // R1: new object type arguments (if is_cls_parameterized). 1142 // R1: new object type arguments (if is_cls_parameterized).
1144 // Set the tags. 1143 // Set the tags.
1145 uword tags = 0; 1144 uword tags = 0;
1146 tags = RawObject::SizeTag::update(instance_size, tags); 1145 tags = RawObject::SizeTag::update(instance_size, tags);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 // R1: new object type arguments. 1186 // R1: new object type arguments.
1188 // Set the type arguments in the new object. 1187 // Set the type arguments in the new object.
1189 __ StoreToOffset(kWord, R1, R2, cls.type_arguments_field_offset()); 1188 __ StoreToOffset(kWord, R1, R2, cls.type_arguments_field_offset());
1190 } 1189 }
1191 // Done allocating and initializing the instance. 1190 // Done allocating and initializing the instance.
1192 // R2: new object still missing its heap tag. 1191 // R2: new object still missing its heap tag.
1193 __ add(R0, R2, ShifterOperand(kHeapObjectTag)); 1192 __ add(R0, R2, ShifterOperand(kHeapObjectTag));
1194 // R0: new object. 1193 // R0: new object.
1195 __ Ret(); 1194 __ Ret();
1196 1195
1197 __ Bind(&slow_case_reload_type_arguments); 1196 __ Bind(&slow_case);
1198 } 1197 }
1199 if (is_cls_parameterized) {
1200 __ ldr(R1, Address(SP, 0));
1201 }
1202 __ Bind(&slow_case_with_type_arguments);
1203 // If is_cls_parameterized: 1198 // If is_cls_parameterized:
1204 // R1: new object type arguments. 1199 // R1: new object type arguments.
1205 // Create a stub frame as we are pushing some objects on the stack before 1200 // Create a stub frame as we are pushing some objects on the stack before
1206 // calling into the runtime. 1201 // calling into the runtime.
1207 __ EnterStubFrame(true); // Uses pool pointer to pass cls to runtime. 1202 __ EnterStubFrame(true); // Uses pool pointer to pass cls to runtime.
1208 __ LoadImmediate(R2, reinterpret_cast<intptr_t>(Object::null())); 1203 __ LoadImmediate(R2, reinterpret_cast<intptr_t>(Object::null()));
1209 __ Push(R2); // Setup space on stack for return value. 1204 __ Push(R2); // Setup space on stack for return value.
1210 __ PushObject(cls); // Push class of object to be allocated. 1205 __ PushObject(cls); // Push class of object to be allocated.
1211 if (is_cls_parameterized) { 1206 if (is_cls_parameterized) {
1212 // Push type arguments. 1207 // Push type arguments.
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
2098 const Register right = R0; 2093 const Register right = R0;
2099 __ ldr(left, Address(SP, 1 * kWordSize)); 2094 __ ldr(left, Address(SP, 1 * kWordSize));
2100 __ ldr(right, Address(SP, 0 * kWordSize)); 2095 __ ldr(right, Address(SP, 0 * kWordSize));
2101 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 2096 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
2102 __ Ret(); 2097 __ Ret();
2103 } 2098 }
2104 2099
2105 } // namespace dart 2100 } // namespace dart
2106 2101
2107 #endif // defined TARGET_ARCH_ARM 2102 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698