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 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2160 __ jmp(RCX); | 2160 __ jmp(RCX); |
2161 | 2161 |
2162 __ Bind(&miss); | 2162 __ Bind(&miss); |
2163 __ LoadIsolate(RAX); | 2163 __ LoadIsolate(RAX); |
2164 __ movq(CODE_REG, Address(RAX, Isolate::ic_miss_code_offset())); | 2164 __ movq(CODE_REG, Address(RAX, Isolate::ic_miss_code_offset())); |
2165 __ movq(RCX, FieldAddress(CODE_REG, Code::entry_point_offset())); | 2165 __ movq(RCX, FieldAddress(CODE_REG, Code::entry_point_offset())); |
2166 __ jmp(RCX); | 2166 __ jmp(RCX); |
2167 } | 2167 } |
2168 | 2168 |
2169 | 2169 |
| 2170 // Called from switchable IC calls. |
| 2171 // RDI: receiver |
| 2172 // RBX: SingleTargetCache |
| 2173 // Passed to target:: |
| 2174 // CODE_REG: target Code object |
| 2175 void StubCode::GenerateSingleTargetCallStub(Assembler* assembler) { |
| 2176 __ NoMonomorphicCheckedEntry(); |
| 2177 |
| 2178 Label miss; |
| 2179 __ LoadClassIdMayBeSmi(RAX, RDI); |
| 2180 __ movl(R9, FieldAddress(RBX, SingleTargetCache::lower_limit_offset())); |
| 2181 __ movl(R10, FieldAddress(RBX, SingleTargetCache::upper_limit_offset())); |
| 2182 __ cmpq(RAX, R9); |
| 2183 __ j(LESS, &miss, Assembler::kNearJump); |
| 2184 __ cmpq(RAX, R10); |
| 2185 __ j(GREATER, &miss, Assembler::kNearJump); |
| 2186 __ movq(RCX, FieldAddress(RBX, SingleTargetCache::entry_point_offset())); |
| 2187 __ movq(CODE_REG, FieldAddress(RBX, SingleTargetCache::target_offset())); |
| 2188 __ jmp(RCX); |
| 2189 |
| 2190 __ Bind(&miss); |
| 2191 __ EnterStubFrame(); |
| 2192 __ pushq(RDI); // Preserve receiver. |
| 2193 |
| 2194 __ PushObject(Object::null_object()); // Result. |
| 2195 __ pushq(RDI); // Arg0: Receiver |
| 2196 __ CallRuntime(kSingleTargetMissRuntimeEntry, 1); |
| 2197 __ popq(RBX); |
| 2198 __ popq(RBX); // result = IC |
| 2199 |
| 2200 __ popq(RDI); // Restore receiver. |
| 2201 __ LeaveStubFrame(); |
| 2202 |
| 2203 __ movq(CODE_REG, Address(THR, Thread::ic_lookup_through_code_stub_offset())); |
| 2204 __ movq(RCX, FieldAddress(CODE_REG, Code::checked_entry_point_offset())); |
| 2205 __ jmp(RCX); |
| 2206 } |
| 2207 |
| 2208 |
2170 // Called from the monomorphic checked entry. | 2209 // Called from the monomorphic checked entry. |
2171 // RDI: receiver | 2210 // RDI: receiver |
2172 void StubCode::GenerateMonomorphicMissStub(Assembler* assembler) { | 2211 void StubCode::GenerateMonomorphicMissStub(Assembler* assembler) { |
2173 __ EnterStubFrame(); | 2212 __ EnterStubFrame(); |
2174 __ pushq(RDI); // Preserve receiver. | 2213 __ pushq(RDI); // Preserve receiver. |
2175 | 2214 |
2176 __ PushObject(Object::null_object()); // Result. | 2215 __ PushObject(Object::null_object()); // Result. |
2177 __ pushq(RDI); // Arg0: Receiver | 2216 __ pushq(RDI); // Arg0: Receiver |
2178 __ CallRuntime(kMonomorphicMissRuntimeEntry, 1); | 2217 __ CallRuntime(kMonomorphicMissRuntimeEntry, 1); |
2179 __ popq(RBX); | 2218 __ popq(RBX); |
2180 __ popq(RBX); // result = IC | 2219 __ popq(RBX); // result = IC |
2181 | 2220 |
2182 __ popq(RDI); // Restore receiver. | 2221 __ popq(RDI); // Restore receiver. |
2183 __ LeaveStubFrame(); | 2222 __ LeaveStubFrame(); |
2184 | 2223 |
2185 __ movq(CODE_REG, Address(THR, Thread::ic_lookup_through_code_stub_offset())); | 2224 __ movq(CODE_REG, Address(THR, Thread::ic_lookup_through_code_stub_offset())); |
2186 __ movq(RCX, FieldAddress(CODE_REG, Code::checked_entry_point_offset())); | 2225 __ movq(RCX, FieldAddress(CODE_REG, Code::checked_entry_point_offset())); |
2187 __ jmp(RCX); | 2226 __ jmp(RCX); |
2188 } | 2227 } |
2189 | 2228 |
2190 | 2229 |
2191 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { | 2230 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { |
2192 __ int3(); | 2231 __ int3(); |
2193 } | 2232 } |
2194 | 2233 |
2195 } // namespace dart | 2234 } // namespace dart |
2196 | 2235 |
2197 #endif // defined TARGET_ARCH_X64 | 2236 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |