| 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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // TOS + 3: Last argument of caller. | 279 // TOS + 3: Last argument of caller. |
| 280 // .... | 280 // .... |
| 281 __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); | 281 __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); |
| 282 __ movl(EAX, Address(EBP, EAX, TIMES_2, kWordSize)); // Get receiver. | 282 __ movl(EAX, Address(EBP, EAX, TIMES_2, kWordSize)); // Get receiver. |
| 283 __ pushl(EDX); // Preserve arguments descriptor array. | 283 __ pushl(EDX); // Preserve arguments descriptor array. |
| 284 __ pushl(EAX); // Preserve receiver. | 284 __ pushl(EAX); // Preserve receiver. |
| 285 __ pushl(ECX); // Preserve ic-data. | 285 __ pushl(ECX); // Preserve ic-data. |
| 286 // First resolve the function to get the function object. | 286 // First resolve the function to get the function object. |
| 287 | 287 |
| 288 __ pushl(raw_null); // Setup space on stack for return value. | 288 __ pushl(raw_null); // Setup space on stack for return value. |
| 289 __ pushl(EAX); // Push receiver. | 289 __ pushl(EAX); // Pass receiver. |
| 290 __ pushl(ECX); // Pass IC data object. |
| 291 __ pushl(EDX); // Pass arguments descriptor array. |
| 290 __ CallRuntime(kResolveCompileInstanceFunctionRuntimeEntry); | 292 __ CallRuntime(kResolveCompileInstanceFunctionRuntimeEntry); |
| 291 __ popl(EAX); // Remove receiver pushed earlier. | 293 __ popl(EAX); // Remove arguments pushed earlier. |
| 294 __ popl(EAX); |
| 295 __ popl(EAX); |
| 292 __ popl(ECX); // Pop returned code object into ECX. | 296 __ popl(ECX); // Pop returned code object into ECX. |
| 293 // Pop preserved values | 297 // Pop preserved values. |
| 294 __ popl(EDX); // Restore ic-data. | 298 __ popl(EDX); // Restore ic-data. |
| 295 __ popl(EAX); // Restore receiver. | 299 __ popl(EAX); // Restore receiver. |
| 296 __ popl(EDI); // Restore arguments descriptor array. | 300 __ popl(EDI); // Restore arguments descriptor array. |
| 297 | 301 |
| 298 __ cmpl(ECX, raw_null); | 302 __ cmpl(ECX, raw_null); |
| 299 Label check_implicit_closure; | 303 Label check_implicit_closure; |
| 300 __ j(EQUAL, &check_implicit_closure, Assembler::kNearJump); | 304 __ j(EQUAL, &check_implicit_closure, Assembler::kNearJump); |
| 301 | 305 |
| 302 // Remove the stub frame as we are about to jump to the dart function. | 306 // Remove the stub frame as we are about to jump to the dart function. |
| 303 __ LeaveFrame(); | 307 __ LeaveFrame(); |
| (...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1633 const Immediate raw_null = | 1637 const Immediate raw_null = |
| 1634 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1638 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1635 // Compute address of arguments (first read number of arguments from | 1639 // Compute address of arguments (first read number of arguments from |
| 1636 // arguments descriptor array and then compute address on the stack). | 1640 // arguments descriptor array and then compute address on the stack). |
| 1637 __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); | 1641 __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); |
| 1638 __ leal(EAX, Address(ESP, EAX, TIMES_2, 0)); // EAX is Smi. | 1642 __ leal(EAX, Address(ESP, EAX, TIMES_2, 0)); // EAX is Smi. |
| 1639 // Create a stub frame as we are pushing some objects on the stack before | 1643 // Create a stub frame as we are pushing some objects on the stack before |
| 1640 // calling into the runtime. | 1644 // calling into the runtime. |
| 1641 AssemblerMacros::EnterStubFrame(assembler); | 1645 AssemblerMacros::EnterStubFrame(assembler); |
| 1642 __ pushl(EDX); // Preserve arguments descriptor array. | 1646 __ pushl(EDX); // Preserve arguments descriptor array. |
| 1643 __ pushl(ECX); // Preserve IC data array | 1647 __ pushl(ECX); // Preserve IC data object. |
| 1644 __ pushl(raw_null); // Setup space on stack for result (target code object). | 1648 __ pushl(raw_null); // Setup space on stack for result (target code object). |
| 1645 // Push call arguments. | 1649 // Push call arguments. |
| 1646 for (intptr_t i = 0; i < num_args; i++) { | 1650 for (intptr_t i = 0; i < num_args; i++) { |
| 1647 __ movl(EDX, Address(EAX, -kWordSize * i)); | 1651 __ movl(EBX, Address(EAX, -kWordSize * i)); |
| 1648 __ pushl(EDX); | 1652 __ pushl(EBX); |
| 1649 } | 1653 } |
| 1654 __ pushl(ECX); // Pass IC data object. |
| 1655 __ pushl(EDX); // Pass arguments descriptor array. |
| 1650 if (num_args == 1) { | 1656 if (num_args == 1) { |
| 1651 __ CallRuntime(kInlineCacheMissHandlerOneArgRuntimeEntry); | 1657 __ CallRuntime(kInlineCacheMissHandlerOneArgRuntimeEntry); |
| 1652 } else if (num_args == 2) { | 1658 } else if (num_args == 2) { |
| 1653 __ CallRuntime(kInlineCacheMissHandlerTwoArgsRuntimeEntry); | 1659 __ CallRuntime(kInlineCacheMissHandlerTwoArgsRuntimeEntry); |
| 1654 } else if (num_args == 3) { | 1660 } else if (num_args == 3) { |
| 1655 __ CallRuntime(kInlineCacheMissHandlerThreeArgsRuntimeEntry); | 1661 __ CallRuntime(kInlineCacheMissHandlerThreeArgsRuntimeEntry); |
| 1656 } else { | 1662 } else { |
| 1657 UNIMPLEMENTED(); | 1663 UNIMPLEMENTED(); |
| 1658 } | 1664 } |
| 1659 // Remove call arguments pushed earlier. | 1665 // Remove the call arguments pushed earlier, including the IC data object |
| 1660 for (intptr_t i = 0; i < num_args; i++) { | 1666 // and the arguments descriptor array. |
| 1667 for (intptr_t i = 0; i < num_args + 2; i++) { |
| 1661 __ popl(EAX); | 1668 __ popl(EAX); |
| 1662 } | 1669 } |
| 1663 __ popl(EAX); // Pop returned code object into EAX (null if not found). | 1670 __ popl(EAX); // Pop returned code object into EAX (null if not found). |
| 1664 __ popl(ECX); // Restore IC data array. | 1671 __ popl(ECX); // Restore IC data array. |
| 1665 __ popl(EDX); // Restore arguments descriptor array. | 1672 __ popl(EDX); // Restore arguments descriptor array. |
| 1666 __ LeaveFrame(); | 1673 __ LeaveFrame(); |
| 1667 Label call_target_function; | 1674 Label call_target_function; |
| 1668 __ cmpl(EAX, raw_null); | 1675 __ cmpl(EAX, raw_null); |
| 1669 __ j(NOT_EQUAL, &call_target_function, Assembler::kNearJump); | 1676 __ j(NOT_EQUAL, &call_target_function, Assembler::kNearJump); |
| 1670 // NoSuchMethod or closure. | 1677 // NoSuchMethod or closure. |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2209 __ Bind(&done); | 2216 __ Bind(&done); |
| 2210 __ popl(temp); | 2217 __ popl(temp); |
| 2211 __ popl(right); | 2218 __ popl(right); |
| 2212 __ popl(left); | 2219 __ popl(left); |
| 2213 __ ret(); | 2220 __ ret(); |
| 2214 } | 2221 } |
| 2215 | 2222 |
| 2216 } // namespace dart | 2223 } // namespace dart |
| 2217 | 2224 |
| 2218 #endif // defined TARGET_ARCH_IA32 | 2225 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |