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

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

Issue 1125623003: Move megamorphic lookup code to stub instead of inlining. Preformance loss < 5%, instruction size r… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 7 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_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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 2237 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 const Register temp1 = T2; 2248 const Register temp1 = T2;
2249 const Register temp2 = T3; 2249 const Register temp2 = T3;
2250 const Register left = T1; 2250 const Register left = T1;
2251 const Register right = T0; 2251 const Register right = T0;
2252 __ lw(left, Address(SP, 1 * kWordSize)); 2252 __ lw(left, Address(SP, 1 * kWordSize));
2253 __ lw(right, Address(SP, 0 * kWordSize)); 2253 __ lw(right, Address(SP, 0 * kWordSize));
2254 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); 2254 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2);
2255 __ Ret(); 2255 __ Ret();
2256 } 2256 }
2257 2257
2258
2259 // Called from megamorphic calls.
2260 // T0: receiver.
2261 // T1: lookup cache.
2262 // Result:
2263 // T1: entry point.
2264 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) {
2265 __ LoadTaggedClassIdMayBeSmi(T0, T0);
2266 // T0: class ID of the receiver (smi).
2267 __ lw(T2, FieldAddress(T1, MegamorphicCache::buckets_offset()));
2268 __ lw(T1, FieldAddress(T1, MegamorphicCache::mask_offset()));
2269 // T2: cache buckets array.
2270 // T1: mask.
2271 __ mov(T3, T0);
2272
2273 Label loop, update, call_target_function;
2274 __ b(&loop);
2275
2276 __ Bind(&update);
2277 __ addiu(T3, T3, Immediate(Smi::RawValue(1)));
2278 __ Bind(&loop);
2279 __ and_(T3, T3, T1);
2280 const intptr_t base = Array::data_offset();
2281 // T3 is smi tagged, but table entries are two words, so LSL 2.
2282 __ sll(TMP, T3, 2);
2283 __ addu(TMP, T2, TMP);
2284 __ lw(T4, FieldAddress(TMP, base));
2285
2286 ASSERT(kIllegalCid == 0);
2287 __ beq(T4, ZR, &call_target_function);
2288 __ bne(T4, T0, &update);
2289
2290 __ Bind(&call_target_function);
2291 // Call the target found in the cache. For a class id match, this is a
2292 // proper target for the given name and arguments descriptor. If the
2293 // illegal class id was found, the target is a cache miss handler that can
2294 // be invoked as a normal Dart function.
2295 __ sll(T1, T3, 2);
2296 __ addu(T1, T2, T1);
2297 __ lw(T0, FieldAddress(T1, base + kWordSize));
2298
2299 __ lw(T1, FieldAddress(T0, Function::instructions_offset()));
2300 // TODO(srdjan): Evaluate performance impact of moving the instruction below
2301 // to the call site, instead of having it here.
2302 __ AddImmediate(T1, Instructions::HeaderSize() - kHeapObjectTag);
2303 __ Ret();
2304 }
2305
2258 } // namespace dart 2306 } // namespace dart
2259 2307
2260 #endif // defined TARGET_ARCH_MIPS 2308 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698