| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/assembler_macros.h" | 9 #include "vm/assembler_macros.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 // TOS + 3: Last argument of caller. | 274 // TOS + 3: Last argument of caller. |
| 275 // .... | 275 // .... |
| 276 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); | 276 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); |
| 277 __ movq(RAX, Address(RBP, RAX, TIMES_4, kWordSize)); // Get receiver. | 277 __ movq(RAX, Address(RBP, RAX, TIMES_4, kWordSize)); // Get receiver. |
| 278 __ pushq(R10); // Preserve arguments descriptor array. | 278 __ pushq(R10); // Preserve arguments descriptor array. |
| 279 __ pushq(RAX); // Preserve receiver. | 279 __ pushq(RAX); // Preserve receiver. |
| 280 __ pushq(RBX); // Preserve ic-data. | 280 __ pushq(RBX); // Preserve ic-data. |
| 281 // First resolve the function to get the function object. | 281 // First resolve the function to get the function object. |
| 282 | 282 |
| 283 __ pushq(raw_null); // Setup space on stack for return value. | 283 __ pushq(raw_null); // Setup space on stack for return value. |
| 284 __ pushq(RAX); // Push receiver. | 284 __ pushq(RAX); // Pass receiver. |
| 285 __ pushq(RBX); // Pass IC data object. |
| 286 __ pushq(R10); // Pass arguments descriptor array. |
| 285 __ CallRuntime(kResolveCompileInstanceFunctionRuntimeEntry); | 287 __ CallRuntime(kResolveCompileInstanceFunctionRuntimeEntry); |
| 286 __ popq(RAX); // Remove receiver pushed earlier. | 288 __ popq(RAX); // Remove arguments pushed earlier. |
| 289 __ popq(RAX); |
| 290 __ popq(RAX); |
| 287 __ popq(RBX); // Pop returned code object into RBX. | 291 __ popq(RBX); // Pop returned code object into RBX. |
| 288 // Pop preserved values | 292 // Pop preserved values |
| 289 __ popq(R10); // Restore ic-data. | 293 __ popq(R10); // Restore ic-data. |
| 290 __ popq(RAX); // Restore receiver. | 294 __ popq(RAX); // Restore receiver. |
| 291 __ popq(R13); // Restore arguments descriptor array. | 295 __ popq(R13); // Restore arguments descriptor array. |
| 292 | 296 |
| 293 __ cmpq(RBX, raw_null); | 297 __ cmpq(RBX, raw_null); |
| 294 Label check_implicit_closure; | 298 Label check_implicit_closure; |
| 295 __ j(EQUAL, &check_implicit_closure, Assembler::kNearJump); | 299 __ j(EQUAL, &check_implicit_closure, Assembler::kNearJump); |
| 296 | 300 |
| (...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1611 | 1615 |
| 1612 // IC miss. | 1616 // IC miss. |
| 1613 const Immediate raw_null = | 1617 const Immediate raw_null = |
| 1614 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1618 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1615 // Compute address of arguments (first read number of arguments from | 1619 // Compute address of arguments (first read number of arguments from |
| 1616 // arguments descriptor array and then compute address on the stack). | 1620 // arguments descriptor array and then compute address on the stack). |
| 1617 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); | 1621 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); |
| 1618 __ leaq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX is Smi. | 1622 __ leaq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX is Smi. |
| 1619 AssemblerMacros::EnterStubFrame(assembler); | 1623 AssemblerMacros::EnterStubFrame(assembler); |
| 1620 __ pushq(R10); // Preserve arguments descriptor array. | 1624 __ pushq(R10); // Preserve arguments descriptor array. |
| 1621 __ pushq(RBX); // Preserve IC data array | 1625 __ pushq(RBX); // Preserve IC data object. |
| 1622 __ pushq(raw_null); // Setup space on stack for result (target code object). | 1626 __ pushq(raw_null); // Setup space on stack for result (target code object). |
| 1623 // Push call arguments. | 1627 // Push call arguments. |
| 1624 for (intptr_t i = 0; i < num_args; i++) { | 1628 for (intptr_t i = 0; i < num_args; i++) { |
| 1625 __ movq(R10, Address(RAX, -kWordSize * i)); | 1629 __ movq(RCX, Address(RAX, -kWordSize * i)); |
| 1626 __ pushq(R10); | 1630 __ pushq(RCX); |
| 1627 } | 1631 } |
| 1632 __ pushq(RBX); // Pass IC data object. |
| 1633 __ pushq(R10); // Pass arguments descriptor array. |
| 1628 if (num_args == 1) { | 1634 if (num_args == 1) { |
| 1629 __ CallRuntime(kInlineCacheMissHandlerOneArgRuntimeEntry); | 1635 __ CallRuntime(kInlineCacheMissHandlerOneArgRuntimeEntry); |
| 1630 } else if (num_args == 2) { | 1636 } else if (num_args == 2) { |
| 1631 __ CallRuntime(kInlineCacheMissHandlerTwoArgsRuntimeEntry); | 1637 __ CallRuntime(kInlineCacheMissHandlerTwoArgsRuntimeEntry); |
| 1632 } else if (num_args == 3) { | 1638 } else if (num_args == 3) { |
| 1633 __ CallRuntime(kInlineCacheMissHandlerThreeArgsRuntimeEntry); | 1639 __ CallRuntime(kInlineCacheMissHandlerThreeArgsRuntimeEntry); |
| 1634 } else { | 1640 } else { |
| 1635 UNIMPLEMENTED(); | 1641 UNIMPLEMENTED(); |
| 1636 } | 1642 } |
| 1637 // Remove call arguments pushed earlier. | 1643 // Remove the call arguments pushed earlier, including the IC data object |
| 1638 for (intptr_t i = 0; i < num_args; i++) { | 1644 // and the arguments descriptor array. |
| 1645 for (intptr_t i = 0; i < num_args + 2; i++) { |
| 1639 __ popq(RAX); | 1646 __ popq(RAX); |
| 1640 } | 1647 } |
| 1641 __ popq(RAX); // Pop returned code object into RAX (null if not found). | 1648 __ popq(RAX); // Pop returned code object into RAX (null if not found). |
| 1642 __ popq(RBX); // Restore IC data array. | 1649 __ popq(RBX); // Restore IC data array. |
| 1643 __ popq(R10); // Restore arguments descriptor array. | 1650 __ popq(R10); // Restore arguments descriptor array. |
| 1644 __ LeaveFrame(); | 1651 __ LeaveFrame(); |
| 1645 Label call_target_function; | 1652 Label call_target_function; |
| 1646 __ cmpq(RAX, raw_null); | 1653 __ cmpq(RAX, raw_null); |
| 1647 __ j(NOT_EQUAL, &call_target_function, Assembler::kNearJump); | 1654 __ j(NOT_EQUAL, &call_target_function, Assembler::kNearJump); |
| 1648 // NoSuchMethod or closure. | 1655 // NoSuchMethod or closure. |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2160 __ cmpq(left, right); | 2167 __ cmpq(left, right); |
| 2161 __ Bind(&done); | 2168 __ Bind(&done); |
| 2162 __ popq(right); | 2169 __ popq(right); |
| 2163 __ popq(left); | 2170 __ popq(left); |
| 2164 __ ret(); | 2171 __ ret(); |
| 2165 } | 2172 } |
| 2166 | 2173 |
| 2167 } // namespace dart | 2174 } // namespace dart |
| 2168 | 2175 |
| 2169 #endif // defined TARGET_ARCH_X64 | 2176 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |