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

Side by Side Diff: runtime/vm/intermediate_language_mips.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" // Needed here to get TARGET_ARCH_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2151 // the type arguments. 2151 // the type arguments.
2152 Label type_arguments_instantiated; 2152 Label type_arguments_instantiated;
2153 const intptr_t len = type_arguments().Length(); 2153 const intptr_t len = type_arguments().Length();
2154 if (type_arguments().IsRawInstantiatedRaw(len)) { 2154 if (type_arguments().IsRawInstantiatedRaw(len)) {
2155 __ BranchEqual(instantiator_reg, reinterpret_cast<int32_t>(Object::null()), 2155 __ BranchEqual(instantiator_reg, reinterpret_cast<int32_t>(Object::null()),
2156 &type_arguments_instantiated); 2156 &type_arguments_instantiated);
2157 } 2157 }
2158 2158
2159 __ LoadObject(T2, type_arguments()); 2159 __ LoadObject(T2, type_arguments());
2160 __ lw(T2, FieldAddress(T2, TypeArguments::instantiations_offset())); 2160 __ lw(T2, FieldAddress(T2, TypeArguments::instantiations_offset()));
2161 __ lw(T3, FieldAddress(T2, Array::length_offset()));
2162 __ AddImmediate(T2, Array::data_offset() - kHeapObjectTag); 2161 __ AddImmediate(T2, Array::data_offset() - kHeapObjectTag);
2163 __ sll(TMP, T3, 1); // T3 is Smi. 2162 // The instantiations cache is initialized with Object::zero_array() and is
2164 __ addu(T3, T2, TMP); 2163 // therefore guaranteed to contain kNoInstantiator. No length check needed.
2165 Label loop, found, slow_case; 2164 Label loop, found, slow_case;
2166 __ Bind(&loop); 2165 __ Bind(&loop);
2167 __ BranchUnsignedGreaterEqual(T2, T3, &slow_case);
2168 __ lw(T1, Address(T2, 0 * kWordSize)); // Cached instantiator. 2166 __ lw(T1, Address(T2, 0 * kWordSize)); // Cached instantiator.
2169 __ beq(T1, T0, &found); 2167 __ beq(T1, T0, &found);
2170 __ BranchEqual(T1, Smi::RawValue(StubCode::kNoInstantiator), &slow_case); 2168 __ BranchEqual(T1, Smi::RawValue(StubCode::kNoInstantiator), &slow_case);
2171 __ b(&loop); 2169 __ b(&loop);
2172 __ delay_slot()->addiu(T2, T2, Immediate(2 * kWordSize)); 2170 __ delay_slot()->addiu(T2, T2, Immediate(2 * kWordSize));
2173 __ Bind(&found); 2171 __ Bind(&found);
2174 __ lw(T0, Address(T2, 1 * kWordSize)); // Cached instantiated args. 2172 __ lw(T0, Address(T2, 1 * kWordSize)); // Cached instantiated args.
2175 __ b(&type_arguments_instantiated); 2173 __ b(&type_arguments_instantiated);
2176 2174
2177 __ Bind(&slow_case); 2175 __ Bind(&slow_case);
(...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after
4172 compiler->GenerateCall(token_pos(), 4170 compiler->GenerateCall(token_pos(),
4173 &label, 4171 &label,
4174 PcDescriptors::kOther, 4172 PcDescriptors::kOther,
4175 locs()); 4173 locs());
4176 __ Drop(2); // Discard type arguments and receiver. 4174 __ Drop(2); // Discard type arguments and receiver.
4177 } 4175 }
4178 4176
4179 } // namespace dart 4177 } // namespace dart
4180 4178
4181 #endif // defined TARGET_ARCH_MIPS 4179 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698