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 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1409 // Check that the IC data array has NumberOfArgumentsChecked() == num_args. | 1409 // Check that the IC data array has NumberOfArgumentsChecked() == num_args. |
1410 // 'num_args_tested' is stored as an untagged int. | 1410 // 'num_args_tested' is stored as an untagged int. |
1411 __ movq(RCX, FieldAddress(RBX, ICData::num_args_tested_offset())); | 1411 __ movq(RCX, FieldAddress(RBX, ICData::num_args_tested_offset())); |
1412 __ cmpq(RCX, Immediate(num_args)); | 1412 __ cmpq(RCX, Immediate(num_args)); |
1413 __ j(EQUAL, &ok, Assembler::kNearJump); | 1413 __ j(EQUAL, &ok, Assembler::kNearJump); |
1414 __ Stop("Incorrect stub for IC data"); | 1414 __ Stop("Incorrect stub for IC data"); |
1415 __ Bind(&ok); | 1415 __ Bind(&ok); |
1416 } | 1416 } |
1417 #endif // DEBUG | 1417 #endif // DEBUG |
1418 | 1418 |
| 1419 // Check single stepping. |
| 1420 Label not_stepping; |
| 1421 __ movq(RAX, FieldAddress(CTX, Context::isolate_offset())); |
| 1422 __ movzxb(RAX, Address(RAX, Isolate::single_step_offset())); |
| 1423 __ cmpq(RAX, Immediate(0)); |
| 1424 __ j(EQUAL, ¬_stepping, Assembler::kNearJump); |
| 1425 __ EnterStubFrame(); |
| 1426 __ pushq(RBX); |
| 1427 __ CallRuntime(kSingleStepHandlerRuntimeEntry); |
| 1428 __ popq(RBX); |
| 1429 __ LeaveFrame(); |
| 1430 __ Bind(¬_stepping); |
| 1431 |
1419 // Load arguments descriptor into R10. | 1432 // Load arguments descriptor into R10. |
1420 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset())); | 1433 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset())); |
1421 // Loop that checks if there is an IC data match. | 1434 // Loop that checks if there is an IC data match. |
1422 Label loop, update, test, found, get_class_id_as_smi; | 1435 Label loop, update, test, found, get_class_id_as_smi; |
1423 // RBX: IC data object (preserved). | 1436 // RBX: IC data object (preserved). |
1424 __ movq(R12, FieldAddress(RBX, ICData::ic_data_offset())); | 1437 __ movq(R12, FieldAddress(RBX, ICData::ic_data_offset())); |
1425 // R12: ic_data_array with check entries: classes and target functions. | 1438 // R12: ic_data_array with check entries: classes and target functions. |
1426 __ leaq(R12, FieldAddress(R12, Array::data_offset())); | 1439 __ leaq(R12, FieldAddress(R12, Array::data_offset())); |
1427 // R12: points directly to the first ic data array element. | 1440 // R12: points directly to the first ic data array element. |
1428 | 1441 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 // Check that the IC data array has NumberOfArgumentsChecked() == 0. | 1642 // Check that the IC data array has NumberOfArgumentsChecked() == 0. |
1630 // 'num_args_tested' is stored as an untagged int. | 1643 // 'num_args_tested' is stored as an untagged int. |
1631 __ movq(RCX, FieldAddress(RBX, ICData::num_args_tested_offset())); | 1644 __ movq(RCX, FieldAddress(RBX, ICData::num_args_tested_offset())); |
1632 __ cmpq(RCX, Immediate(0)); | 1645 __ cmpq(RCX, Immediate(0)); |
1633 __ j(EQUAL, &ok, Assembler::kNearJump); | 1646 __ j(EQUAL, &ok, Assembler::kNearJump); |
1634 __ Stop("Incorrect IC data for unoptimized static call"); | 1647 __ Stop("Incorrect IC data for unoptimized static call"); |
1635 __ Bind(&ok); | 1648 __ Bind(&ok); |
1636 } | 1649 } |
1637 #endif // DEBUG | 1650 #endif // DEBUG |
1638 | 1651 |
| 1652 // Check single stepping. |
| 1653 Label not_stepping; |
| 1654 __ movq(RAX, FieldAddress(CTX, Context::isolate_offset())); |
| 1655 __ movzxb(RAX, Address(RAX, Isolate::single_step_offset())); |
| 1656 __ cmpq(RAX, Immediate(0)); |
| 1657 __ j(EQUAL, ¬_stepping, Assembler::kNearJump); |
| 1658 __ EnterStubFrame(); |
| 1659 __ pushq(RBX); // Preserve IC data object. |
| 1660 __ CallRuntime(kSingleStepHandlerRuntimeEntry); |
| 1661 __ popq(RBX); |
| 1662 __ LeaveFrame(); |
| 1663 __ Bind(¬_stepping); |
| 1664 |
1639 // RBX: IC data object (preserved). | 1665 // RBX: IC data object (preserved). |
1640 __ movq(R12, FieldAddress(RBX, ICData::ic_data_offset())); | 1666 __ movq(R12, FieldAddress(RBX, ICData::ic_data_offset())); |
1641 // R12: ic_data_array with entries: target functions and count. | 1667 // R12: ic_data_array with entries: target functions and count. |
1642 __ leaq(R12, FieldAddress(R12, Array::data_offset())); | 1668 __ leaq(R12, FieldAddress(R12, Array::data_offset())); |
1643 // R12: points directly to the first ic data array element. | 1669 // R12: points directly to the first ic data array element. |
1644 const intptr_t target_offset = ICData::TargetIndexFor(0) * kWordSize; | 1670 const intptr_t target_offset = ICData::TargetIndexFor(0) * kWordSize; |
1645 const intptr_t count_offset = ICData::CountIndexFor(0) * kWordSize; | 1671 const intptr_t count_offset = ICData::CountIndexFor(0) * kWordSize; |
1646 | 1672 |
1647 // Increment count for this call. | 1673 // Increment count for this call. |
1648 Label increment_done; | 1674 Label increment_done; |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2091 } | 2117 } |
2092 | 2118 |
2093 | 2119 |
2094 // Called only from unoptimized code. All relevant registers have been saved. | 2120 // Called only from unoptimized code. All relevant registers have been saved. |
2095 // TOS + 0: return address | 2121 // TOS + 0: return address |
2096 // TOS + 1: right argument. | 2122 // TOS + 1: right argument. |
2097 // TOS + 2: left argument. | 2123 // TOS + 2: left argument. |
2098 // Returns ZF set. | 2124 // Returns ZF set. |
2099 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( | 2125 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( |
2100 Assembler* assembler) { | 2126 Assembler* assembler) { |
| 2127 // Check single stepping. |
| 2128 Label not_stepping; |
| 2129 __ movq(RAX, FieldAddress(CTX, Context::isolate_offset())); |
| 2130 __ movzxb(RAX, Address(RAX, Isolate::single_step_offset())); |
| 2131 __ cmpq(RAX, Immediate(0)); |
| 2132 __ j(EQUAL, ¬_stepping, Assembler::kNearJump); |
| 2133 __ EnterStubFrame(); |
| 2134 __ CallRuntime(kSingleStepHandlerRuntimeEntry); |
| 2135 __ LeaveFrame(); |
| 2136 __ Bind(¬_stepping); |
| 2137 |
2101 const Register left = RAX; | 2138 const Register left = RAX; |
2102 const Register right = RDX; | 2139 const Register right = RDX; |
2103 | 2140 |
2104 __ movq(left, Address(RSP, 2 * kWordSize)); | 2141 __ movq(left, Address(RSP, 2 * kWordSize)); |
2105 __ movq(right, Address(RSP, 1 * kWordSize)); | 2142 __ movq(right, Address(RSP, 1 * kWordSize)); |
2106 GenerateIdenticalWithNumberCheckStub(assembler, left, right); | 2143 GenerateIdenticalWithNumberCheckStub(assembler, left, right); |
2107 __ ret(); | 2144 __ ret(); |
2108 } | 2145 } |
2109 | 2146 |
2110 | 2147 |
(...skipping 14 matching lines...) Expand all Loading... |
2125 __ movq(right, Address(RSP, 3 * kWordSize)); | 2162 __ movq(right, Address(RSP, 3 * kWordSize)); |
2126 GenerateIdenticalWithNumberCheckStub(assembler, left, right); | 2163 GenerateIdenticalWithNumberCheckStub(assembler, left, right); |
2127 __ popq(right); | 2164 __ popq(right); |
2128 __ popq(left); | 2165 __ popq(left); |
2129 __ ret(); | 2166 __ ret(); |
2130 } | 2167 } |
2131 | 2168 |
2132 } // namespace dart | 2169 } // namespace dart |
2133 | 2170 |
2134 #endif // defined TARGET_ARCH_X64 | 2171 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |