OLD | NEW |
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 2092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2103 } | 2103 } |
2104 | 2104 |
2105 | 2105 |
2106 // Called from switchable IC calls. | 2106 // Called from switchable IC calls. |
2107 // R0: receiver | 2107 // R0: receiver |
2108 // R9: ICData (preserved) | 2108 // R9: ICData (preserved) |
2109 // Result: | 2109 // Result: |
2110 // R1: target entry point | 2110 // R1: target entry point |
2111 // CODE_REG: target Code object | 2111 // CODE_REG: target Code object |
2112 // R4: arguments descriptor | 2112 // R4: arguments descriptor |
2113 void StubCode::GenerateICLookupStub(Assembler* assembler) { | 2113 void StubCode::GenerateICLookupThroughFunctionStub(Assembler* assembler) { |
2114 Label loop, found, miss; | 2114 Label loop, found, miss; |
2115 __ ldr(R4, FieldAddress(R9, ICData::arguments_descriptor_offset())); | 2115 __ ldr(R4, FieldAddress(R9, ICData::arguments_descriptor_offset())); |
2116 __ ldr(R8, FieldAddress(R9, ICData::ic_data_offset())); | 2116 __ ldr(R8, FieldAddress(R9, ICData::ic_data_offset())); |
2117 __ AddImmediate(R8, R8, Array::data_offset() - kHeapObjectTag); | 2117 __ AddImmediate(R8, R8, Array::data_offset() - kHeapObjectTag); |
2118 // R8: first IC entry | 2118 // R8: first IC entry |
2119 __ LoadTaggedClassIdMayBeSmi(R1, R0); | 2119 __ LoadTaggedClassIdMayBeSmi(R1, R0); |
2120 // R1: receiver cid as Smi | 2120 // R1: receiver cid as Smi |
2121 | 2121 |
2122 __ Bind(&loop); | 2122 __ Bind(&loop); |
2123 __ ldr(R2, Address(R8, 0)); | 2123 __ ldr(R2, Address(R8, 0)); |
(...skipping 13 matching lines...) Expand all Loading... |
2137 __ ldr(CODE_REG, FieldAddress(R0, Function::code_offset())); | 2137 __ ldr(CODE_REG, FieldAddress(R0, Function::code_offset())); |
2138 __ Ret(); | 2138 __ Ret(); |
2139 | 2139 |
2140 __ Bind(&miss); | 2140 __ Bind(&miss); |
2141 __ LoadIsolate(R2); | 2141 __ LoadIsolate(R2); |
2142 __ ldr(CODE_REG, Address(R2, Isolate::ic_miss_code_offset())); | 2142 __ ldr(CODE_REG, Address(R2, Isolate::ic_miss_code_offset())); |
2143 __ ldr(R1, FieldAddress(CODE_REG, Code::entry_point_offset())); | 2143 __ ldr(R1, FieldAddress(CODE_REG, Code::entry_point_offset())); |
2144 __ Ret(); | 2144 __ Ret(); |
2145 } | 2145 } |
2146 | 2146 |
| 2147 |
| 2148 void StubCode::GenerateICLookupThroughCodeStub(Assembler* assembler) { |
| 2149 Label loop, found, miss; |
| 2150 __ ldr(R4, FieldAddress(R9, ICData::arguments_descriptor_offset())); |
| 2151 __ ldr(R8, FieldAddress(R9, ICData::ic_data_offset())); |
| 2152 __ AddImmediate(R8, R8, Array::data_offset() - kHeapObjectTag); |
| 2153 // R8: first IC entry |
| 2154 __ LoadTaggedClassIdMayBeSmi(R1, R0); |
| 2155 // R1: receiver cid as Smi |
| 2156 |
| 2157 __ Bind(&loop); |
| 2158 __ ldr(R2, Address(R8, 0)); |
| 2159 __ cmp(R1, Operand(R2)); |
| 2160 __ b(&found, EQ); |
| 2161 __ CompareImmediate(R2, Smi::RawValue(kIllegalCid)); |
| 2162 __ b(&miss, EQ); |
| 2163 |
| 2164 const intptr_t entry_length = ICData::TestEntryLengthFor(1) * kWordSize; |
| 2165 __ AddImmediate(R8, entry_length); // Next entry. |
| 2166 __ b(&loop); |
| 2167 |
| 2168 __ Bind(&found); |
| 2169 const intptr_t code_offset = ICData::CodeIndexFor(1) * kWordSize; |
| 2170 const intptr_t entry_offset = ICData::EntryPointIndexFor(1) * kWordSize; |
| 2171 __ ldr(R1, Address(R8, entry_offset)); |
| 2172 __ ldr(CODE_REG, Address(R8, code_offset)); |
| 2173 __ Ret(); |
| 2174 |
| 2175 __ Bind(&miss); |
| 2176 __ LoadIsolate(R2); |
| 2177 __ ldr(CODE_REG, Address(R2, Isolate::ic_miss_code_offset())); |
| 2178 __ ldr(R1, FieldAddress(CODE_REG, Code::entry_point_offset())); |
| 2179 __ Ret(); |
| 2180 } |
| 2181 |
2147 } // namespace dart | 2182 } // namespace dart |
2148 | 2183 |
2149 #endif // defined TARGET_ARCH_ARM | 2184 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |