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_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 DECLARE_FLAG(bool, trace_optimized_ic_calls); | 27 DECLARE_FLAG(bool, trace_optimized_ic_calls); |
28 | 28 |
29 DECLARE_FLAG(bool, enable_debugger); | 29 DECLARE_FLAG(bool, enable_debugger); |
30 | 30 |
31 // Input parameters: | 31 // Input parameters: |
32 // RA : return address. | 32 // RA : return address. |
33 // SP : address of last argument in argument array. | 33 // SP : address of last argument in argument array. |
34 // SP + 4*S4 - 4 : address of first argument in argument array. | 34 // SP + 4*S4 - 4 : address of first argument in argument array. |
35 // SP + 4*S4 : address of return value. | 35 // SP + 4*S4 : address of return value. |
36 // S5 : address of the runtime function to call. | 36 // S5 : address of the runtime function to call. |
37 // S4 : number of arguments to the call as Smi. | 37 // S4 : number of arguments to the call. |
38 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { | 38 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { |
39 const intptr_t isolate_offset = NativeArguments::isolate_offset(); | 39 const intptr_t isolate_offset = NativeArguments::isolate_offset(); |
40 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); | 40 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); |
41 const intptr_t argv_offset = NativeArguments::argv_offset(); | 41 const intptr_t argv_offset = NativeArguments::argv_offset(); |
42 const intptr_t retval_offset = NativeArguments::retval_offset(); | 42 const intptr_t retval_offset = NativeArguments::retval_offset(); |
43 const intptr_t exitframe_last_param_slot_from_fp = 2; | 43 const intptr_t exitframe_last_param_slot_from_fp = 2; |
44 | 44 |
45 __ SetPrologueOffset(); | 45 __ SetPrologueOffset(); |
46 __ TraceSimMsg("CallToRuntimeStub"); | 46 __ TraceSimMsg("CallToRuntimeStub"); |
47 __ addiu(SP, SP, Immediate(-3 * kWordSize)); | 47 __ addiu(SP, SP, Immediate(-3 * kWordSize)); |
48 __ sw(ZR, Address(SP, 2 * kWordSize)); // Push 0 for the PC marker | 48 __ sw(ZR, Address(SP, 2 * kWordSize)); // Push 0 for the PC marker |
49 __ sw(RA, Address(SP, 1 * kWordSize)); | 49 __ sw(RA, Address(SP, 1 * kWordSize)); |
50 __ sw(FP, Address(SP, 0 * kWordSize)); | 50 __ sw(FP, Address(SP, 0 * kWordSize)); |
51 __ mov(FP, SP); | 51 __ mov(FP, SP); |
52 __ SmiUntag(S4); | |
53 | 52 |
54 // Load current Isolate pointer from Context structure into A0. | 53 // Load current Isolate pointer from Context structure into A0. |
55 __ lw(A0, FieldAddress(CTX, Context::isolate_offset())); | 54 __ lw(A0, FieldAddress(CTX, Context::isolate_offset())); |
56 | 55 |
57 // Save exit frame information to enable stack walking as we are about | 56 // Save exit frame information to enable stack walking as we are about |
58 // to transition to Dart VM C++ code. | 57 // to transition to Dart VM C++ code. |
59 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); | 58 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); |
60 | 59 |
61 // Save current Context pointer into Isolate structure. | 60 // Save current Context pointer into Isolate structure. |
62 __ sw(CTX, Address(A0, Isolate::top_context_offset())); | 61 __ sw(CTX, Address(A0, Isolate::top_context_offset())); |
(...skipping 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 __ lw(S5, Address(SP, 2 * kWordSize)); // Restore IC data array. | 1713 __ lw(S5, Address(SP, 2 * kWordSize)); // Restore IC data array. |
1715 __ addiu(SP, SP, Immediate(3 * kWordSize)); | 1714 __ addiu(SP, SP, Immediate(3 * kWordSize)); |
1716 __ LeaveStubFrame(); | 1715 __ LeaveStubFrame(); |
1717 | 1716 |
1718 __ lw(T2, FieldAddress(T0, Function::instructions_offset())); | 1717 __ lw(T2, FieldAddress(T0, Function::instructions_offset())); |
1719 __ AddImmediate(T2, Instructions::HeaderSize() - kHeapObjectTag); | 1718 __ AddImmediate(T2, Instructions::HeaderSize() - kHeapObjectTag); |
1720 __ jr(T2); | 1719 __ jr(T2); |
1721 } | 1720 } |
1722 | 1721 |
1723 | 1722 |
1724 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) { | 1723 // S5: Contains an ICData. |
1725 __ Comment("BreakpointRuntime stub"); | 1724 void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) { |
| 1725 __ Comment("ICCallBreakpoint stub"); |
| 1726 __ EnterStubFrame(); |
| 1727 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
| 1728 __ sw(S5, Address(SP, 1 * kWordSize)); |
| 1729 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); |
| 1730 __ sw(TMP, Address(SP, 0 * kWordSize)); |
| 1731 |
| 1732 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); |
| 1733 |
| 1734 __ lw(S5, Address(SP, 1 * kWordSize)); |
| 1735 __ lw(T0, Address(SP, 0 * kWordSize)); |
| 1736 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
| 1737 __ LeaveStubFrame(); |
| 1738 __ jr(T0); |
| 1739 } |
| 1740 |
| 1741 |
| 1742 // S5: Contains Smi 0 (need to preserve a GC-safe value for the lazy compile |
| 1743 // stub). |
| 1744 // S4: Contains an arguments descriptor. |
| 1745 void StubCode::GenerateClosureCallBreakpointStub(Assembler* assembler) { |
| 1746 __ Comment("ClosureCallBreakpoint stub"); |
1726 __ EnterStubFrame(); | 1747 __ EnterStubFrame(); |
1727 __ addiu(SP, SP, Immediate(-3 * kWordSize)); | 1748 __ addiu(SP, SP, Immediate(-3 * kWordSize)); |
1728 __ sw(S5, Address(SP, 2 * kWordSize)); | 1749 __ sw(S5, Address(SP, 2 * kWordSize)); |
1729 __ sw(S4, Address(SP, 1 * kWordSize)); | 1750 __ sw(S4, Address(SP, 1 * kWordSize)); |
1730 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); | 1751 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); |
1731 __ sw(TMP, Address(SP, 0 * kWordSize)); | 1752 __ sw(TMP, Address(SP, 0 * kWordSize)); |
1732 | 1753 |
1733 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); | 1754 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); |
1734 | 1755 |
1735 __ lw(S5, Address(SP, 2 * kWordSize)); | 1756 __ lw(S5, Address(SP, 2 * kWordSize)); |
1736 __ lw(S4, Address(SP, 1 * kWordSize)); | 1757 __ lw(S4, Address(SP, 1 * kWordSize)); |
1737 __ lw(T0, Address(SP, 0 * kWordSize)); | 1758 __ lw(T0, Address(SP, 0 * kWordSize)); |
1738 __ addiu(SP, SP, Immediate(3 * kWordSize)); | 1759 __ addiu(SP, SP, Immediate(3 * kWordSize)); |
1739 __ LeaveStubFrame(); | 1760 __ LeaveStubFrame(); |
1740 __ jr(T0); | 1761 __ jr(T0); |
1741 } | 1762 } |
1742 | 1763 |
1743 | 1764 |
| 1765 // S5: Garbage or function address. |
| 1766 // S4: Garbage or raw argument count. |
| 1767 void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) { |
| 1768 __ Comment("RuntimeCallBreakpoint stub"); |
| 1769 __ EnterStubFrame(); |
| 1770 __ addiu(SP, SP, Immediate(-3 * kWordSize)); |
| 1771 __ AndImmediate(S5, S5, ~kSmiTagMask); |
| 1772 __ sw(S5, Address(SP, 2 * kWordSize)); |
| 1773 __ SmiTag(S4); |
| 1774 __ sw(S4, Address(SP, 1 * kWordSize)); |
| 1775 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); |
| 1776 __ sw(TMP, Address(SP, 0 * kWordSize)); |
| 1777 |
| 1778 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); |
| 1779 |
| 1780 __ lw(S5, Address(SP, 2 * kWordSize)); |
| 1781 __ lw(S4, Address(SP, 1 * kWordSize)); |
| 1782 __ SmiUntag(S4); |
| 1783 __ lw(T0, Address(SP, 0 * kWordSize)); |
| 1784 __ addiu(SP, SP, Immediate(3 * kWordSize)); |
| 1785 __ LeaveStubFrame(); |
| 1786 __ jr(T0); |
| 1787 } |
| 1788 |
| 1789 |
1744 // Called only from unoptimized code. All relevant registers have been saved. | 1790 // Called only from unoptimized code. All relevant registers have been saved. |
1745 // RA: return address. | 1791 // RA: return address. |
1746 void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { | 1792 void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { |
1747 if (FLAG_enable_debugger) { | 1793 if (FLAG_enable_debugger) { |
1748 // Check single stepping. | 1794 // Check single stepping. |
1749 Label not_stepping; | 1795 Label not_stepping; |
1750 __ lw(T0, FieldAddress(CTX, Context::isolate_offset())); | 1796 __ lw(T0, FieldAddress(CTX, Context::isolate_offset())); |
1751 __ lbu(T0, Address(T0, Isolate::single_step_offset())); | 1797 __ lbu(T0, Address(T0, Isolate::single_step_offset())); |
1752 __ BranchEqual(T0, 0, ¬_stepping); | 1798 __ BranchEqual(T0, 0, ¬_stepping); |
1753 // Call single step callback in debugger. | 1799 // Call single step callback in debugger. |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2062 const Register right = T0; | 2108 const Register right = T0; |
2063 __ lw(left, Address(SP, 1 * kWordSize)); | 2109 __ lw(left, Address(SP, 1 * kWordSize)); |
2064 __ lw(right, Address(SP, 0 * kWordSize)); | 2110 __ lw(right, Address(SP, 0 * kWordSize)); |
2065 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); | 2111 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); |
2066 __ Ret(); | 2112 __ Ret(); |
2067 } | 2113 } |
2068 | 2114 |
2069 } // namespace dart | 2115 } // namespace dart |
2070 | 2116 |
2071 #endif // defined TARGET_ARCH_MIPS | 2117 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |