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

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

Issue 2132803002: Megamorphic code cleanup. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « runtime/vm/stub_code.h ('k') | runtime/vm/stub_code_arm64.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" 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 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 const Register temp = R2; 2041 const Register temp = R2;
2042 const Register left = R1; 2042 const Register left = R1;
2043 const Register right = R0; 2043 const Register right = R0;
2044 __ ldr(left, Address(SP, 1 * kWordSize)); 2044 __ ldr(left, Address(SP, 1 * kWordSize));
2045 __ ldr(right, Address(SP, 0 * kWordSize)); 2045 __ ldr(right, Address(SP, 0 * kWordSize));
2046 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 2046 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
2047 __ Ret(); 2047 __ Ret();
2048 } 2048 }
2049 2049
2050 2050
2051 void StubCode::EmitMegamorphicLookup(Assembler* assembler) {
2052 __ LoadTaggedClassIdMayBeSmi(R0, R0);
2053 // R0: receiver cid as Smi.
2054 __ ldr(R2, FieldAddress(R9, MegamorphicCache::buckets_offset()));
2055 __ ldr(R1, FieldAddress(R9, MegamorphicCache::mask_offset()));
2056 // R2: cache buckets array.
2057 // R1: mask.
2058
2059 // Compute the table index.
2060 ASSERT(MegamorphicCache::kSpreadFactor == 7);
2061 // Use reverse substract to multiply with 7 == 8 - 1.
2062 __ rsb(R3, R0, Operand(R0, LSL, 3));
2063 // R3: probe.
2064
2065 Label loop, update, load_target_function;
2066 __ b(&loop);
2067
2068 __ Bind(&update);
2069 __ add(R3, R3, Operand(Smi::RawValue(1)));
2070 __ Bind(&loop);
2071 __ and_(R3, R3, Operand(R1));
2072 const intptr_t base = Array::data_offset();
2073 // R3 is smi tagged, but table entries are two words, so LSL 2.
2074 __ add(IP, R2, Operand(R3, LSL, 2));
2075 __ ldr(R6, FieldAddress(IP, base));
2076
2077 ASSERT(kIllegalCid == 0);
2078 __ tst(R6, Operand(R6));
2079 __ b(&load_target_function, EQ);
2080 __ cmp(R6, Operand(R0));
2081 __ b(&update, NE);
2082
2083 __ Bind(&load_target_function);
2084 // Call the target found in the cache. For a class id match, this is a
2085 // proper target for the given name and arguments descriptor. If the
2086 // illegal class id was found, the target is a cache miss handler that can
2087 // be invoked as a normal Dart function.
2088 __ add(IP, R2, Operand(R3, LSL, 2));
2089 __ ldr(R0, FieldAddress(IP, base + kWordSize));
2090 __ ldr(R4, FieldAddress(R9, MegamorphicCache::arguments_descriptor_offset()));
2091 __ ldr(R1, FieldAddress(R0, Function::entry_point_offset()));
2092 __ ldr(CODE_REG, FieldAddress(R0, Function::code_offset()));
2093 }
2094
2095
2096 // Called from megamorphic calls. 2051 // Called from megamorphic calls.
2097 // R0: receiver 2052 // R0: receiver
2098 // R9: MegamorphicCache (preserved) 2053 // R9: MegamorphicCache (preserved)
2099 // Result: 2054 // Result:
2100 // R1: target entry point 2055 // R1: target entry point
2101 // CODE_REG: target Code 2056 // CODE_REG: target Code
2102 // R4: arguments descriptor 2057 // R4: arguments descriptor
2103 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { 2058 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) {
2104 __ LoadTaggedClassIdMayBeSmi(R0, R0); 2059 __ LoadTaggedClassIdMayBeSmi(R0, R0);
2105 // R0: receiver cid as Smi. 2060 // R0: receiver cid as Smi.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
2226 } 2181 }
2227 2182
2228 2183
2229 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { 2184 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) {
2230 __ bkpt(0); 2185 __ bkpt(0);
2231 } 2186 }
2232 2187
2233 } // namespace dart 2188 } // namespace dart
2234 2189
2235 #endif // defined TARGET_ARCH_ARM 2190 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/stub_code.h ('k') | runtime/vm/stub_code_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698