OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
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 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2156 } | 2156 } |
2157 | 2157 |
2158 | 2158 |
2159 // Called from switchable IC calls. | 2159 // Called from switchable IC calls. |
2160 // R0: receiver | 2160 // R0: receiver |
2161 // R5: ICData (preserved) | 2161 // R5: ICData (preserved) |
2162 // Result: | 2162 // Result: |
2163 // R1: target entry point | 2163 // R1: target entry point |
2164 // CODE_REG: target Code object | 2164 // CODE_REG: target Code object |
2165 // R4: arguments descriptor | 2165 // R4: arguments descriptor |
2166 void StubCode::GenerateICLookupStub(Assembler* assembler) { | 2166 void StubCode::GenerateICLookupThroughFunctionStub(Assembler* assembler) { |
2167 Label loop, found, miss; | 2167 Label loop, found, miss; |
2168 __ ldr(R4, FieldAddress(R5, ICData::arguments_descriptor_offset())); | 2168 __ ldr(R4, FieldAddress(R5, ICData::arguments_descriptor_offset())); |
2169 __ ldr(R8, FieldAddress(R5, ICData::ic_data_offset())); | 2169 __ ldr(R8, FieldAddress(R5, ICData::ic_data_offset())); |
2170 __ AddImmediate(R8, R8, Array::data_offset() - kHeapObjectTag); | 2170 __ AddImmediate(R8, R8, Array::data_offset() - kHeapObjectTag); |
2171 // R8: first IC entry | 2171 // R8: first IC entry |
2172 __ LoadTaggedClassIdMayBeSmi(R1, R0); | 2172 __ LoadTaggedClassIdMayBeSmi(R1, R0); |
2173 // R1: receiver cid as Smi | 2173 // R1: receiver cid as Smi |
2174 | 2174 |
2175 __ Bind(&loop); | 2175 __ Bind(&loop); |
2176 __ ldr(R2, Address(R8, 0)); | 2176 __ ldr(R2, Address(R8, 0)); |
(...skipping 13 matching lines...) Expand all Loading... |
2190 __ ldr(CODE_REG, FieldAddress(R0, Function::code_offset())); | 2190 __ ldr(CODE_REG, FieldAddress(R0, Function::code_offset())); |
2191 __ ret(); | 2191 __ ret(); |
2192 | 2192 |
2193 __ Bind(&miss); | 2193 __ Bind(&miss); |
2194 __ LoadIsolate(R2); | 2194 __ LoadIsolate(R2); |
2195 __ ldr(CODE_REG, Address(R2, Isolate::ic_miss_code_offset())); | 2195 __ ldr(CODE_REG, Address(R2, Isolate::ic_miss_code_offset())); |
2196 __ ldr(R1, FieldAddress(CODE_REG, Code::entry_point_offset())); | 2196 __ ldr(R1, FieldAddress(CODE_REG, Code::entry_point_offset())); |
2197 __ ret(); | 2197 __ ret(); |
2198 } | 2198 } |
2199 | 2199 |
| 2200 |
| 2201 void StubCode::GenerateICLookupThroughCodeStub(Assembler* assembler) { |
| 2202 Label loop, found, miss; |
| 2203 __ ldr(R4, FieldAddress(R5, ICData::arguments_descriptor_offset())); |
| 2204 __ ldr(R8, FieldAddress(R5, ICData::ic_data_offset())); |
| 2205 __ AddImmediate(R8, R8, Array::data_offset() - kHeapObjectTag); |
| 2206 // R8: first IC entry |
| 2207 __ LoadTaggedClassIdMayBeSmi(R1, R0); |
| 2208 // R1: receiver cid as Smi |
| 2209 |
| 2210 __ Bind(&loop); |
| 2211 __ ldr(R2, Address(R8, 0)); |
| 2212 __ cmp(R1, Operand(R2)); |
| 2213 __ b(&found, EQ); |
| 2214 __ CompareImmediate(R2, Smi::RawValue(kIllegalCid)); |
| 2215 __ b(&miss, EQ); |
| 2216 |
| 2217 const intptr_t entry_length = ICData::TestEntryLengthFor(1) * kWordSize; |
| 2218 __ AddImmediate(R8, R8, entry_length); // Next entry. |
| 2219 __ b(&loop); |
| 2220 |
| 2221 __ Bind(&found); |
| 2222 const intptr_t code_offset = ICData::CodeIndexFor(1) * kWordSize; |
| 2223 const intptr_t entry_offset = ICData::EntryPointIndexFor(1) * kWordSize; |
| 2224 __ ldr(R1, Address(R8, entry_offset)); |
| 2225 __ ldr(CODE_REG, Address(R8, code_offset)); |
| 2226 __ ret(); |
| 2227 |
| 2228 __ Bind(&miss); |
| 2229 __ LoadIsolate(R2); |
| 2230 __ ldr(CODE_REG, Address(R2, Isolate::ic_miss_code_offset())); |
| 2231 __ ldr(R1, FieldAddress(CODE_REG, Code::entry_point_offset())); |
| 2232 __ ret(); |
| 2233 } |
| 2234 |
2200 } // namespace dart | 2235 } // namespace dart |
2201 | 2236 |
2202 #endif // defined TARGET_ARCH_ARM64 | 2237 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |