| 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 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1701 } | 1701 } |
| 1702 | 1702 |
| 1703 | 1703 |
| 1704 // Megamorphic call is currently implemented as IC call but through a stub | 1704 // Megamorphic call is currently implemented as IC call but through a stub |
| 1705 // that does not check/count function invocations. | 1705 // that does not check/count function invocations. |
| 1706 void StubCode::GenerateMegamorphicCallStub(Assembler* assembler) { | 1706 void StubCode::GenerateMegamorphicCallStub(Assembler* assembler) { |
| 1707 GenerateNArgsCheckInlineCacheStub(assembler, 1); | 1707 GenerateNArgsCheckInlineCacheStub(assembler, 1); |
| 1708 } | 1708 } |
| 1709 | 1709 |
| 1710 | 1710 |
| 1711 // ECX: ICData | 1711 // EDX, EXC: May contain arguments to runtime stub. |
| 1712 void StubCode::GenerateBreakpointEqNullStub(Assembler* assembler) { | 1712 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) { |
| 1713 __ EnterStubFrame(); | 1713 __ EnterStubFrame(); |
| 1714 // Save runtime args. |
| 1714 __ pushl(ECX); | 1715 __ pushl(ECX); |
| 1715 __ CallRuntime(kBreakpointEqualNullHandlerRuntimeEntry); | 1716 __ pushl(EDX); |
| 1717 // Room for result. Debugger stub returns address of the |
| 1718 // unpatched runtime stub. |
| 1719 const Immediate& raw_null = |
| 1720 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1721 __ pushl(raw_null); // Room for result. |
| 1722 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry); |
| 1723 __ popl(EAX); // Address of original stub. |
| 1724 __ popl(EDX); // Restore arguments. |
| 1716 __ popl(ECX); | 1725 __ popl(ECX); |
| 1717 __ LeaveFrame(); | 1726 __ LeaveFrame(); |
| 1718 __ jmp(&StubCode::EqualityWithNullArgLabel()); | 1727 __ jmp(EAX); // Jump to original stub. |
| 1719 } | |
| 1720 | |
| 1721 | |
| 1722 // EDX: Arguments descriptor array. | |
| 1723 void StubCode::GenerateBreakpointClosureStub(Assembler* assembler) { | |
| 1724 __ EnterStubFrame(); | |
| 1725 __ pushl(EDX); // Push arguments descriptor. | |
| 1726 __ CallRuntime(kBreakpointClosureHandlerRuntimeEntry); | |
| 1727 __ popl(EDX); // Restore arguments descriptor. | |
| 1728 __ LeaveFrame(); | |
| 1729 __ jmp(&StubCode::CallClosureFunctionLabel()); | |
| 1730 } | 1728 } |
| 1731 | 1729 |
| 1732 | 1730 |
| 1733 // EDX: Arguments descriptor array. | 1731 // EDX: Arguments descriptor array. |
| 1734 // TOS(0): return address (Dart code). | 1732 // TOS(0): return address (Dart code). |
| 1735 void StubCode::GenerateBreakpointStaticStub(Assembler* assembler) { | 1733 void StubCode::GenerateBreakpointStaticStub(Assembler* assembler) { |
| 1736 // Create a stub frame as we are pushing some objects on the stack before | 1734 // Create a stub frame as we are pushing some objects on the stack before |
| 1737 // calling into the runtime. | 1735 // calling into the runtime. |
| 1738 __ EnterStubFrame(); | 1736 __ EnterStubFrame(); |
| 1739 __ pushl(EDX); // Preserve arguments descriptor. | 1737 __ pushl(EDX); // Preserve arguments descriptor. |
| 1740 const Immediate& raw_null = | 1738 const Immediate& raw_null = |
| 1741 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1739 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1742 __ pushl(raw_null); // Room for result. | 1740 __ pushl(raw_null); // Room for result. |
| 1743 __ CallRuntime(kBreakpointStaticHandlerRuntimeEntry); | 1741 __ CallRuntime(kBreakpointStaticHandlerRuntimeEntry); |
| 1744 __ popl(EAX); // Code object. | 1742 __ popl(EAX); // Code object. |
| 1745 __ popl(EDX); // Restore arguments descriptor. | 1743 __ popl(EDX); // Restore arguments descriptor. |
| 1746 __ LeaveFrame(); | 1744 __ LeaveFrame(); |
| 1747 | 1745 |
| 1748 // Now call the static function. The breakpoint handler function | 1746 // Now call the static function. The breakpoint handler function |
| 1749 // ensures that the call target is compiled. | 1747 // ensures that the call target is compiled. |
| 1748 // Note that we can't just jump to the CallStatic function stub |
| 1749 // here since that stub would patch the call site with the |
| 1750 // static function address. |
| 1750 __ movl(ECX, FieldAddress(EAX, Code::instructions_offset())); | 1751 __ movl(ECX, FieldAddress(EAX, Code::instructions_offset())); |
| 1751 __ addl(ECX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | 1752 __ addl(ECX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
| 1752 __ jmp(ECX); | 1753 __ jmp(ECX); |
| 1753 } | 1754 } |
| 1754 | 1755 |
| 1755 | 1756 |
| 1756 // TOS(0): return address (Dart code). | 1757 // TOS(0): return address (Dart code). |
| 1757 void StubCode::GenerateBreakpointReturnStub(Assembler* assembler) { | 1758 void StubCode::GenerateBreakpointReturnStub(Assembler* assembler) { |
| 1758 // Create a stub frame as we are pushing some objects on the stack before | 1759 // Create a stub frame as we are pushing some objects on the stack before |
| 1759 // calling into the runtime. | 1760 // calling into the runtime. |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2146 __ Bind(&done); | 2147 __ Bind(&done); |
| 2147 __ popl(temp); | 2148 __ popl(temp); |
| 2148 __ popl(right); | 2149 __ popl(right); |
| 2149 __ popl(left); | 2150 __ popl(left); |
| 2150 __ ret(); | 2151 __ ret(); |
| 2151 } | 2152 } |
| 2152 | 2153 |
| 2153 } // namespace dart | 2154 } // namespace dart |
| 2154 | 2155 |
| 2155 #endif // defined TARGET_ARCH_IA32 | 2156 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |