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 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 __ lw(S5, Address(SP, 2 * kWordSize)); // Restore IC data array. | 1718 __ lw(S5, Address(SP, 2 * kWordSize)); // Restore IC data array. |
1720 __ addiu(SP, SP, Immediate(3 * kWordSize)); | 1719 __ addiu(SP, SP, Immediate(3 * kWordSize)); |
1721 __ LeaveStubFrame(); | 1720 __ LeaveStubFrame(); |
1722 | 1721 |
1723 __ lw(T2, FieldAddress(T0, Function::instructions_offset())); | 1722 __ lw(T2, FieldAddress(T0, Function::instructions_offset())); |
1724 __ AddImmediate(T2, Instructions::HeaderSize() - kHeapObjectTag); | 1723 __ AddImmediate(T2, Instructions::HeaderSize() - kHeapObjectTag); |
1725 __ jr(T2); | 1724 __ jr(T2); |
1726 } | 1725 } |
1727 | 1726 |
1728 | 1727 |
1729 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) { | 1728 // S5: Contains an ICData. |
1730 __ Comment("BreakpointRuntime stub"); | 1729 void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) { |
| 1730 __ Comment("ICCallBreakpoint stub"); |
| 1731 __ EnterStubFrame(); |
| 1732 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
| 1733 __ sw(S5, Address(SP, 1 * kWordSize)); |
| 1734 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); |
| 1735 __ sw(TMP, Address(SP, 0 * kWordSize)); |
| 1736 |
| 1737 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); |
| 1738 |
| 1739 __ lw(S5, Address(SP, 1 * kWordSize)); |
| 1740 __ lw(T0, Address(SP, 0 * kWordSize)); |
| 1741 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
| 1742 __ LeaveStubFrame(); |
| 1743 __ jr(T0); |
| 1744 } |
| 1745 |
| 1746 |
| 1747 // S5: Contains Smi 0 (need to preserve a GC-safe value for the lazy compile |
| 1748 // stub). |
| 1749 // S4: Contains an arguments descriptor. |
| 1750 void StubCode::GenerateClosureCallBreakpointStub(Assembler* assembler) { |
| 1751 __ Comment("ClosureCallBreakpoint stub"); |
1731 __ EnterStubFrame(); | 1752 __ EnterStubFrame(); |
1732 __ addiu(SP, SP, Immediate(-3 * kWordSize)); | 1753 __ addiu(SP, SP, Immediate(-3 * kWordSize)); |
1733 __ sw(S5, Address(SP, 2 * kWordSize)); | 1754 __ sw(S5, Address(SP, 2 * kWordSize)); |
1734 __ sw(S4, Address(SP, 1 * kWordSize)); | 1755 __ sw(S4, Address(SP, 1 * kWordSize)); |
1735 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); | 1756 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); |
1736 __ sw(TMP, Address(SP, 0 * kWordSize)); | 1757 __ sw(TMP, Address(SP, 0 * kWordSize)); |
1737 | 1758 |
1738 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); | 1759 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); |
1739 | 1760 |
1740 __ lw(S5, Address(SP, 2 * kWordSize)); | 1761 __ lw(S5, Address(SP, 2 * kWordSize)); |
1741 __ lw(S4, Address(SP, 1 * kWordSize)); | 1762 __ lw(S4, Address(SP, 1 * kWordSize)); |
1742 __ lw(T0, Address(SP, 0 * kWordSize)); | 1763 __ lw(T0, Address(SP, 0 * kWordSize)); |
1743 __ addiu(SP, SP, Immediate(3 * kWordSize)); | 1764 __ addiu(SP, SP, Immediate(3 * kWordSize)); |
1744 __ LeaveStubFrame(); | 1765 __ LeaveStubFrame(); |
1745 __ jr(T0); | 1766 __ jr(T0); |
1746 } | 1767 } |
1747 | 1768 |
1748 | 1769 |
| 1770 void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) { |
| 1771 __ Comment("RuntimeCallBreakpoint stub"); |
| 1772 __ EnterStubFrame(); |
| 1773 __ addiu(SP, SP, Immediate(-1 * kWordSize)); |
| 1774 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); |
| 1775 __ sw(TMP, Address(SP, 0 * kWordSize)); |
| 1776 |
| 1777 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); |
| 1778 |
| 1779 __ lw(T0, Address(SP, 0 * kWordSize)); |
| 1780 __ addiu(SP, SP, Immediate(3 * kWordSize)); |
| 1781 __ LeaveStubFrame(); |
| 1782 __ jr(T0); |
| 1783 } |
| 1784 |
| 1785 |
1749 // Called only from unoptimized code. All relevant registers have been saved. | 1786 // Called only from unoptimized code. All relevant registers have been saved. |
1750 // RA: return address. | 1787 // RA: return address. |
1751 void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { | 1788 void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { |
1752 if (FLAG_enable_debugger) { | 1789 if (FLAG_enable_debugger) { |
1753 // Check single stepping. | 1790 // Check single stepping. |
1754 Label not_stepping; | 1791 Label not_stepping; |
1755 __ lw(T0, FieldAddress(CTX, Context::isolate_offset())); | 1792 __ lw(T0, FieldAddress(CTX, Context::isolate_offset())); |
1756 __ lbu(T0, Address(T0, Isolate::single_step_offset())); | 1793 __ lbu(T0, Address(T0, Isolate::single_step_offset())); |
1757 __ BranchEqual(T0, 0, ¬_stepping); | 1794 __ BranchEqual(T0, 0, ¬_stepping); |
1758 // Call single step callback in debugger. | 1795 // Call single step callback in debugger. |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2067 const Register right = T0; | 2104 const Register right = T0; |
2068 __ lw(left, Address(SP, 1 * kWordSize)); | 2105 __ lw(left, Address(SP, 1 * kWordSize)); |
2069 __ lw(right, Address(SP, 0 * kWordSize)); | 2106 __ lw(right, Address(SP, 0 * kWordSize)); |
2070 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); | 2107 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); |
2071 __ Ret(); | 2108 __ Ret(); |
2072 } | 2109 } |
2073 | 2110 |
2074 } // namespace dart | 2111 } // namespace dart |
2075 | 2112 |
2076 #endif // defined TARGET_ARCH_MIPS | 2113 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |