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

Side by Side Diff: runtime/vm/stub_code_arm.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_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 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 Assembler* assembler) { 2052 Assembler* assembler) {
2053 const Register temp = R2; 2053 const Register temp = R2;
2054 const Register left = R1; 2054 const Register left = R1;
2055 const Register right = R0; 2055 const Register right = R0;
2056 __ ldr(left, Address(SP, 1 * kWordSize)); 2056 __ ldr(left, Address(SP, 1 * kWordSize));
2057 __ ldr(right, Address(SP, 0 * kWordSize)); 2057 __ ldr(right, Address(SP, 0 * kWordSize));
2058 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 2058 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
2059 __ Ret(); 2059 __ Ret();
2060 } 2060 }
2061 2061
2062
2063 // Called from megamorphic calls.
2064 // R0: receiver.
2065 // R1: lookup cache.
2066 // Result:
2067 // R1: entry point.
2068 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) {
2069 __ LoadTaggedClassIdMayBeSmi(R0, R0);
2070 // R0: class ID of the receiver (smi).
2071 __ ldr(R2, FieldAddress(R1, MegamorphicCache::buckets_offset()));
2072 __ ldr(R1, FieldAddress(R1, MegamorphicCache::mask_offset()));
2073 // R2: cache buckets array.
2074 // R1: mask.
2075 __ mov(R3, Operand(R0));
2076
2077 Label loop, update, call_target_function;
2078 __ b(&loop);
2079
2080 __ Bind(&update);
2081 __ add(R3, R3, Operand(Smi::RawValue(1)));
2082 __ Bind(&loop);
2083 __ and_(R3, R3, Operand(R1));
2084 const intptr_t base = Array::data_offset();
2085 // R3 is smi tagged, but table entries are two words, so LSL 2.
2086 __ add(IP, R2, Operand(R3, LSL, 2));
2087 __ ldr(R4, FieldAddress(IP, base));
2088
2089 ASSERT(kIllegalCid == 0);
2090 __ tst(R4, Operand(R4));
2091 __ b(&call_target_function, EQ);
2092 __ cmp(R4, Operand(R0));
2093 __ b(&update, NE);
2094
2095 __ Bind(&call_target_function);
2096 // Call the target found in the cache. For a class id match, this is a
2097 // proper target for the given name and arguments descriptor. If the
2098 // illegal class id was found, the target is a cache miss handler that can
2099 // be invoked as a normal Dart function.
2100 __ add(IP, R2, Operand(R3, LSL, 2));
2101 __ ldr(R0, FieldAddress(IP, base + kWordSize));
2102 __ ldr(R1, FieldAddress(R0, Function::instructions_offset()));
2103 // TODO(srdjan): Evaluate performance impact of moving the instruction below
2104 // to the call site, instead of having it here.
2105 __ AddImmediate(R1, Instructions::HeaderSize() - kHeapObjectTag);
2106 __ Ret();
2107 }
2108
2062 } // namespace dart 2109 } // namespace dart
2063 2110
2064 #endif // defined TARGET_ARCH_ARM 2111 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698