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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
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 19 matching lines...) Expand all Loading... |
30 DEFINE_FLAG(bool, verify_incoming_contexts, false, ""); | 30 DEFINE_FLAG(bool, verify_incoming_contexts, false, ""); |
31 | 31 |
32 DECLARE_FLAG(bool, enable_debugger); | 32 DECLARE_FLAG(bool, enable_debugger); |
33 | 33 |
34 // Input parameters: | 34 // Input parameters: |
35 // ESP : points to return address. | 35 // ESP : points to return address. |
36 // ESP + 4 : address of last argument in argument array. | 36 // ESP + 4 : address of last argument in argument array. |
37 // ESP + 4*EDX : address of first argument in argument array. | 37 // ESP + 4*EDX : address of first argument in argument array. |
38 // ESP + 4*EDX + 4 : address of return value. | 38 // ESP + 4*EDX + 4 : address of return value. |
39 // ECX : address of the runtime function to call. | 39 // ECX : address of the runtime function to call. |
40 // EDX : number of arguments to the call as Smi. | 40 // EDX : number of arguments to the call. |
41 // Must preserve callee saved registers EDI and EBX. | 41 // Must preserve callee saved registers EDI and EBX. |
42 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { | 42 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { |
43 const intptr_t isolate_offset = NativeArguments::isolate_offset(); | 43 const intptr_t isolate_offset = NativeArguments::isolate_offset(); |
44 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); | 44 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); |
45 const intptr_t argv_offset = NativeArguments::argv_offset(); | 45 const intptr_t argv_offset = NativeArguments::argv_offset(); |
46 const intptr_t retval_offset = NativeArguments::retval_offset(); | 46 const intptr_t retval_offset = NativeArguments::retval_offset(); |
47 | 47 |
48 __ EnterFrame(0); | 48 __ EnterFrame(0); |
49 __ SmiUntag(EDX); | |
50 | 49 |
51 // Load current Isolate pointer from Context structure into EAX. | 50 // Load current Isolate pointer from Context structure into EAX. |
52 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset())); | 51 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset())); |
53 | 52 |
54 // Save exit frame information to enable stack walking as we are about | 53 // Save exit frame information to enable stack walking as we are about |
55 // to transition to Dart VM C++ code. | 54 // to transition to Dart VM C++ code. |
56 __ movl(Address(EAX, Isolate::top_exit_frame_info_offset()), ESP); | 55 __ movl(Address(EAX, Isolate::top_exit_frame_info_offset()), ESP); |
57 | 56 |
58 #if defined(DEBUG) | 57 #if defined(DEBUG) |
59 if (FLAG_verify_incoming_contexts) { | 58 if (FLAG_verify_incoming_contexts) { |
(...skipping 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1581 __ popl(ECX); // Restore IC data array. | 1580 __ popl(ECX); // Restore IC data array. |
1582 __ popl(EDX); // Restore arguments descriptor array. | 1581 __ popl(EDX); // Restore arguments descriptor array. |
1583 __ LeaveFrame(); | 1582 __ LeaveFrame(); |
1584 | 1583 |
1585 __ movl(EAX, FieldAddress(EAX, Function::instructions_offset())); | 1584 __ movl(EAX, FieldAddress(EAX, Function::instructions_offset())); |
1586 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | 1585 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
1587 __ jmp(EAX); | 1586 __ jmp(EAX); |
1588 } | 1587 } |
1589 | 1588 |
1590 | 1589 |
1591 // EDX, ECX: May contain arguments to runtime stub. | 1590 // ECX: Contains an ICData. |
1592 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) { | 1591 void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) { |
1593 __ EnterStubFrame(); | 1592 __ EnterStubFrame(); |
1594 // Save runtime args. | 1593 // Save IC data. |
| 1594 __ pushl(ECX); |
| 1595 // Room for result. Debugger stub returns address of the |
| 1596 // unpatched runtime stub. |
| 1597 const Immediate& raw_null = |
| 1598 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1599 __ pushl(raw_null); // Room for result. |
| 1600 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); |
| 1601 __ popl(EAX); // Address of original stub. |
| 1602 __ popl(ECX); // Restore IC data. |
| 1603 __ LeaveFrame(); |
| 1604 __ jmp(EAX); // Jump to original stub. |
| 1605 } |
| 1606 |
| 1607 |
| 1608 // ECX: Contains Smi 0 (need to preserve a GC-safe value for the lazy compile |
| 1609 // stub). |
| 1610 // EDX: Contains an arguments descriptor. |
| 1611 void StubCode::GenerateClosureCallBreakpointStub(Assembler* assembler) { |
| 1612 __ EnterStubFrame(); |
| 1613 // Save arguments to original stub. |
1595 __ pushl(ECX); | 1614 __ pushl(ECX); |
1596 __ pushl(EDX); | 1615 __ pushl(EDX); |
1597 // Room for result. Debugger stub returns address of the | 1616 // Room for result. Debugger stub returns address of the |
1598 // unpatched runtime stub. | 1617 // unpatched runtime stub. |
1599 const Immediate& raw_null = | 1618 const Immediate& raw_null = |
1600 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1619 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
1601 __ pushl(raw_null); // Room for result. | 1620 __ pushl(raw_null); // Room for result. |
1602 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); | 1621 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); |
1603 __ popl(EAX); // Address of original stub. | 1622 __ popl(EAX); // Address of original stub. |
1604 __ popl(EDX); // Restore arguments. | 1623 __ popl(EDX); // Restore arguments to original stub. |
1605 __ popl(ECX); | 1624 __ popl(ECX); |
1606 __ LeaveFrame(); | 1625 __ LeaveFrame(); |
1607 __ jmp(EAX); // Jump to original stub. | 1626 __ jmp(EAX); // Jump to original stub. |
1608 } | 1627 } |
1609 | 1628 |
1610 | 1629 |
| 1630 void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) { |
| 1631 __ EnterStubFrame(); |
| 1632 // Room for result. Debugger stub returns address of the |
| 1633 // unpatched runtime stub. |
| 1634 const Immediate& raw_null = |
| 1635 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1636 __ pushl(raw_null); // Room for result. |
| 1637 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); |
| 1638 __ popl(EAX); // Address of original stub. |
| 1639 __ LeaveFrame(); |
| 1640 __ jmp(EAX); // Jump to original stub. |
| 1641 } |
| 1642 |
| 1643 |
1611 // Called only from unoptimized code. | 1644 // Called only from unoptimized code. |
1612 void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { | 1645 void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { |
1613 if (FLAG_enable_debugger) { | 1646 if (FLAG_enable_debugger) { |
1614 // Check single stepping. | 1647 // Check single stepping. |
1615 Label not_stepping; | 1648 Label not_stepping; |
1616 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset())); | 1649 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset())); |
1617 __ movzxb(EAX, Address(EAX, Isolate::single_step_offset())); | 1650 __ movzxb(EAX, Address(EAX, Isolate::single_step_offset())); |
1618 __ cmpl(EAX, Immediate(0)); | 1651 __ cmpl(EAX, Immediate(0)); |
1619 __ j(EQUAL, ¬_stepping, Assembler::kNearJump); | 1652 __ j(EQUAL, ¬_stepping, Assembler::kNearJump); |
1620 | 1653 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 const Register temp = ECX; | 1934 const Register temp = ECX; |
1902 __ movl(left, Address(ESP, 2 * kWordSize)); | 1935 __ movl(left, Address(ESP, 2 * kWordSize)); |
1903 __ movl(right, Address(ESP, 1 * kWordSize)); | 1936 __ movl(right, Address(ESP, 1 * kWordSize)); |
1904 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 1937 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
1905 __ ret(); | 1938 __ ret(); |
1906 } | 1939 } |
1907 | 1940 |
1908 } // namespace dart | 1941 } // namespace dart |
1909 | 1942 |
1910 #endif // defined TARGET_ARCH_IA32 | 1943 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |