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

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

Issue 169223005: 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
« no previous file with comments | « no previous file | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" // Needed here to get TARGET_ARCH_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after
2190 Label type_arguments_instantiated; 2190 Label type_arguments_instantiated;
2191 const intptr_t len = type_arguments().Length(); 2191 const intptr_t len = type_arguments().Length();
2192 if (type_arguments().IsRawInstantiatedRaw(len)) { 2192 if (type_arguments().IsRawInstantiatedRaw(len)) {
2193 __ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null())); 2193 __ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null()));
2194 __ cmp(instantiator_reg, ShifterOperand(IP)); 2194 __ cmp(instantiator_reg, ShifterOperand(IP));
2195 __ b(&type_arguments_instantiated, EQ); 2195 __ b(&type_arguments_instantiated, EQ);
2196 } 2196 }
2197 2197
2198 __ LoadObject(R2, type_arguments()); 2198 __ LoadObject(R2, type_arguments());
2199 __ ldr(R2, FieldAddress(R2, TypeArguments::instantiations_offset())); 2199 __ ldr(R2, FieldAddress(R2, TypeArguments::instantiations_offset()));
2200 __ ldr(R3, FieldAddress(R2, Array::length_offset()));
2201 __ AddImmediate(R2, Array::data_offset() - kHeapObjectTag); 2200 __ AddImmediate(R2, Array::data_offset() - kHeapObjectTag);
2202 __ add(R3, R2, ShifterOperand(R3, LSL, 1)); // R3 is Smi. 2201 // The instantiations cache is initialized with Object::zero_array() and is
2202 // therefore guaranteed to contain kNoInstantiator. No length check needed.
2203 Label loop, found, slow_case; 2203 Label loop, found, slow_case;
2204 __ Bind(&loop); 2204 __ Bind(&loop);
2205 __ cmp(R2, ShifterOperand(R3));
2206 __ b(&slow_case, CS); // Unsigned higher or equal.
2207 __ ldr(R1, Address(R2, 0 * kWordSize)); // Cached instantiator. 2205 __ ldr(R1, Address(R2, 0 * kWordSize)); // Cached instantiator.
2208 __ cmp(R1, ShifterOperand(R0)); 2206 __ cmp(R1, ShifterOperand(R0));
2209 __ b(&found, EQ); 2207 __ b(&found, EQ);
2208 __ AddImmediate(R2, 2 * kWordSize);
2210 __ CompareImmediate(R1, Smi::RawValue(StubCode::kNoInstantiator)); 2209 __ CompareImmediate(R1, Smi::RawValue(StubCode::kNoInstantiator));
2211 __ b(&slow_case, EQ); 2210 __ b(&loop, NE);
2212 __ AddImmediate(R2, 2 * kWordSize); 2211 __ b(&slow_case);
2213 __ b(&loop);
2214 __ Bind(&found); 2212 __ Bind(&found);
2215 __ ldr(R0, Address(R2, 1 * kWordSize)); // Cached instantiated args. 2213 __ ldr(R0, Address(R2, 1 * kWordSize)); // Cached instantiated args.
2216 __ b(&type_arguments_instantiated); 2214 __ b(&type_arguments_instantiated);
2217 2215
2218 __ Bind(&slow_case); 2216 __ Bind(&slow_case);
2219 // Instantiate non-null type arguments. 2217 // Instantiate non-null type arguments.
2220 // A runtime call to instantiate the type arguments is required. 2218 // A runtime call to instantiate the type arguments is required.
2221 __ PushObject(Object::ZoneHandle()); // Make room for the result. 2219 __ PushObject(Object::ZoneHandle()); // Make room for the result.
2222 __ PushObject(type_arguments()); 2220 __ PushObject(type_arguments());
2223 __ Push(instantiator_reg); // Push instantiator type arguments. 2221 __ Push(instantiator_reg); // Push instantiator type arguments.
(...skipping 2674 matching lines...) Expand 10 before | Expand all | Expand 10 after
4898 compiler->GenerateCall(token_pos(), 4896 compiler->GenerateCall(token_pos(),
4899 &label, 4897 &label,
4900 PcDescriptors::kOther, 4898 PcDescriptors::kOther,
4901 locs()); 4899 locs());
4902 __ Drop(2); // Discard type arguments and receiver. 4900 __ Drop(2); // Discard type arguments and receiver.
4903 } 4901 }
4904 4902
4905 } // namespace dart 4903 } // namespace dart
4906 4904
4907 #endif // defined TARGET_ARCH_ARM 4905 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698