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_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2137 } | 2137 } |
2138 | 2138 |
2139 | 2139 |
2140 // Called from switchable IC calls. | 2140 // Called from switchable IC calls. |
2141 // RDI: receiver | 2141 // RDI: receiver |
2142 // RBX: ICData (preserved) | 2142 // RBX: ICData (preserved) |
2143 // Result: | 2143 // Result: |
2144 // RCX: target entry point | 2144 // RCX: target entry point |
2145 // CODE_REG: target Code object | 2145 // CODE_REG: target Code object |
2146 // R10: arguments descriptor | 2146 // R10: arguments descriptor |
2147 void StubCode::GenerateICLookupStub(Assembler* assembler) { | 2147 void StubCode::GenerateICLookupThroughFunctionStub(Assembler* assembler) { |
2148 Label loop, found, miss; | 2148 Label loop, found, miss; |
2149 | 2149 |
2150 __ movq(R13, FieldAddress(RBX, ICData::ic_data_offset())); | 2150 __ movq(R13, FieldAddress(RBX, ICData::ic_data_offset())); |
2151 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset())); | 2151 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset())); |
2152 __ leaq(R13, FieldAddress(R13, Array::data_offset())); | 2152 __ leaq(R13, FieldAddress(R13, Array::data_offset())); |
2153 // R13: first IC entry | 2153 // R13: first IC entry |
2154 __ LoadTaggedClassIdMayBeSmi(RAX, RDI); | 2154 __ LoadTaggedClassIdMayBeSmi(RAX, RDI); |
2155 // RAX: receiver cid as Smi | 2155 // RAX: receiver cid as Smi |
2156 | 2156 |
2157 __ Bind(&loop); | 2157 __ Bind(&loop); |
(...skipping 16 matching lines...) Expand all Loading... |
2174 __ movq(CODE_REG, FieldAddress(RAX, Function::code_offset())); | 2174 __ movq(CODE_REG, FieldAddress(RAX, Function::code_offset())); |
2175 __ ret(); | 2175 __ ret(); |
2176 | 2176 |
2177 __ Bind(&miss); | 2177 __ Bind(&miss); |
2178 __ LoadIsolate(RAX); | 2178 __ LoadIsolate(RAX); |
2179 __ movq(CODE_REG, Address(RAX, Isolate::ic_miss_code_offset())); | 2179 __ movq(CODE_REG, Address(RAX, Isolate::ic_miss_code_offset())); |
2180 __ movq(RCX, FieldAddress(CODE_REG, Code::entry_point_offset())); | 2180 __ movq(RCX, FieldAddress(CODE_REG, Code::entry_point_offset())); |
2181 __ ret(); | 2181 __ ret(); |
2182 } | 2182 } |
2183 | 2183 |
| 2184 |
| 2185 void StubCode::GenerateICLookupThroughCodeStub(Assembler* assembler) { |
| 2186 Label loop, found, miss; |
| 2187 |
| 2188 __ movq(R13, FieldAddress(RBX, ICData::ic_data_offset())); |
| 2189 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset())); |
| 2190 __ leaq(R13, FieldAddress(R13, Array::data_offset())); |
| 2191 // R13: first IC entry |
| 2192 __ LoadTaggedClassIdMayBeSmi(RAX, RDI); |
| 2193 // RAX: receiver cid as Smi |
| 2194 |
| 2195 __ Bind(&loop); |
| 2196 __ movq(R9, Address(R13, 0)); |
| 2197 __ cmpq(RAX, R9); |
| 2198 __ j(EQUAL, &found, Assembler::kNearJump); |
| 2199 |
| 2200 ASSERT(Smi::RawValue(kIllegalCid) == 0); |
| 2201 __ testq(R9, R9); |
| 2202 __ j(ZERO, &miss, Assembler::kNearJump); |
| 2203 |
| 2204 const intptr_t entry_length = ICData::TestEntryLengthFor(1) * kWordSize; |
| 2205 __ addq(R13, Immediate(entry_length)); // Next entry. |
| 2206 __ jmp(&loop); |
| 2207 |
| 2208 __ Bind(&found); |
| 2209 const intptr_t code_offset = ICData::CodeIndexFor(1) * kWordSize; |
| 2210 const intptr_t entry_offset = ICData::EntryPointIndexFor(1) * kWordSize; |
| 2211 __ movq(RCX, Address(R13, entry_offset)); |
| 2212 __ movq(CODE_REG, Address(R13, code_offset)); |
| 2213 __ ret(); |
| 2214 |
| 2215 __ Bind(&miss); |
| 2216 __ LoadIsolate(RAX); |
| 2217 __ movq(CODE_REG, Address(RAX, Isolate::ic_miss_code_offset())); |
| 2218 __ movq(RCX, FieldAddress(CODE_REG, Code::entry_point_offset())); |
| 2219 __ ret(); |
| 2220 } |
| 2221 |
2184 } // namespace dart | 2222 } // namespace dart |
2185 | 2223 |
2186 #endif // defined TARGET_ARCH_X64 | 2224 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |