| 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" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| (...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1357 __ j(ZERO, &call_target_function, Assembler::kNearJump); | 1357 __ j(ZERO, &call_target_function, Assembler::kNearJump); |
| 1358 __ cmpq(RDX, RAX); | 1358 __ cmpq(RDX, RAX); |
| 1359 __ j(NOT_EQUAL, &update, Assembler::kNearJump); | 1359 __ j(NOT_EQUAL, &update, Assembler::kNearJump); |
| 1360 | 1360 |
| 1361 __ Bind(&call_target_function); | 1361 __ Bind(&call_target_function); |
| 1362 // Call the target found in the cache. For a class id match, this is a | 1362 // Call the target found in the cache. For a class id match, this is a |
| 1363 // proper target for the given name and arguments descriptor. If the | 1363 // proper target for the given name and arguments descriptor. If the |
| 1364 // illegal class id was found, the target is a cache miss handler that can | 1364 // illegal class id was found, the target is a cache miss handler that can |
| 1365 // be invoked as a normal Dart function. | 1365 // be invoked as a normal Dart function. |
| 1366 __ movq(RAX, FieldAddress(RDI, RCX, TIMES_8, base + kWordSize)); | 1366 __ movq(RAX, FieldAddress(RDI, RCX, TIMES_8, base + kWordSize)); |
| 1367 __ movq(RBX, FieldAddress(RAX, Function::code_offset())); | 1367 __ movq(RCX, FieldAddress(RAX, Function::code_offset())); |
| 1368 if (FLAG_collect_code) { | 1368 __ movq(RCX, FieldAddress(RCX, Code::instructions_offset())); |
| 1369 // If we are collecting code, the code object may be null. | |
| 1370 Label is_compiled; | |
| 1371 const Immediate& raw_null = | |
| 1372 Immediate(reinterpret_cast<intptr_t>(Object::null())); | |
| 1373 __ cmpq(RBX, raw_null); | |
| 1374 __ j(NOT_EQUAL, &is_compiled, Assembler::kNearJump); | |
| 1375 __ call(&StubCode::CompileFunctionRuntimeCallLabel()); | |
| 1376 AddCurrentDescriptor(PcDescriptors::kRuntimeCall, | |
| 1377 Isolate::kNoDeoptId, | |
| 1378 token_pos); | |
| 1379 RecordSafepoint(locs); | |
| 1380 __ movq(RBX, FieldAddress(RAX, Function::code_offset())); | |
| 1381 __ Bind(&is_compiled); | |
| 1382 } | |
| 1383 __ movq(RAX, FieldAddress(RBX, Code::instructions_offset())); | |
| 1384 __ LoadObject(RBX, ic_data, PP); | 1369 __ LoadObject(RBX, ic_data, PP); |
| 1385 __ LoadObject(R10, arguments_descriptor, PP); | 1370 __ LoadObject(R10, arguments_descriptor, PP); |
| 1386 __ AddImmediate( | 1371 __ AddImmediate( |
| 1387 RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag), PP); | 1372 RCX, Immediate(Instructions::HeaderSize() - kHeapObjectTag), PP); |
| 1388 __ call(RAX); | 1373 __ call(RCX); |
| 1389 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos); | 1374 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos); |
| 1390 RecordSafepoint(locs); | 1375 RecordSafepoint(locs); |
| 1391 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos); | 1376 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos); |
| 1392 __ Drop(argument_count); | 1377 __ Drop(argument_count); |
| 1393 } | 1378 } |
| 1394 | 1379 |
| 1395 | 1380 |
| 1396 void FlowGraphCompiler::EmitOptimizedStaticCall( | 1381 void FlowGraphCompiler::EmitOptimizedStaticCall( |
| 1397 const Function& function, | 1382 const Function& function, |
| 1398 const Array& arguments_descriptor, | 1383 const Array& arguments_descriptor, |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1838 __ movups(reg, Address(RSP, 0)); | 1823 __ movups(reg, Address(RSP, 0)); |
| 1839 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 1824 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); |
| 1840 } | 1825 } |
| 1841 | 1826 |
| 1842 | 1827 |
| 1843 #undef __ | 1828 #undef __ |
| 1844 | 1829 |
| 1845 } // namespace dart | 1830 } // namespace dart |
| 1846 | 1831 |
| 1847 #endif // defined TARGET_ARCH_X64 | 1832 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |