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 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1805 __ AddImmediateDetectOverflow(T4, T4, Smi::RawValue(1), T5, T6); | 1805 __ AddImmediateDetectOverflow(T4, T4, Smi::RawValue(1), T5, T6); |
1806 | 1806 |
1807 __ bgez(T5, &call_target_function); // No overflow. | 1807 __ bgez(T5, &call_target_function); // No overflow. |
1808 __ delay_slot()->sw(T4, Address(T0, count_offset)); | 1808 __ delay_slot()->sw(T4, Address(T0, count_offset)); |
1809 | 1809 |
1810 __ LoadImmediate(T1, Smi::RawValue(Smi::kMaxValue)); | 1810 __ LoadImmediate(T1, Smi::RawValue(Smi::kMaxValue)); |
1811 __ sw(T1, Address(T0, count_offset)); | 1811 __ sw(T1, Address(T0, count_offset)); |
1812 | 1812 |
1813 __ Bind(&call_target_function); | 1813 __ Bind(&call_target_function); |
1814 // T3: Target function. | 1814 // T3: Target function. |
1815 __ lw(T3, FieldAddress(T3, Function::code_offset())); | 1815 Label is_compiled; |
1816 __ lw(T3, FieldAddress(T3, Code::instructions_offset())); | 1816 __ lw(T4, FieldAddress(T3, Function::code_offset())); |
| 1817 if (FLAG_collect_code) { |
| 1818 __ BranchNotEqual(T4, reinterpret_cast<int32_t>(Object::null()), |
| 1819 &is_compiled); |
| 1820 __ EnterStubFrame(); |
| 1821 __ addiu(SP, SP, Immediate(-3 * kWordSize)); |
| 1822 __ sw(S5, Address(SP, 2 * kWordSize)); // Preserve IC data. |
| 1823 __ sw(S4, Address(SP, 1 * kWordSize)); // Preserve arg desc. |
| 1824 __ sw(T3, Address(SP, 0 * kWordSize)); // Function argument. |
| 1825 __ CallRuntime(kCompileFunctionRuntimeEntry, 1); |
| 1826 __ lw(T3, Address(SP, 0 * kWordSize)); // Restore Function. |
| 1827 __ lw(S4, Address(SP, 1 * kWordSize)); // Restore arg desc. |
| 1828 __ lw(S5, Address(SP, 2 * kWordSize)); // Restore IC data. |
| 1829 __ addiu(SP, SP, Immediate(3 * kWordSize)); |
| 1830 __ LeaveStubFrame(); |
| 1831 __ lw(T4, FieldAddress(T3, Function::code_offset())); |
| 1832 __ Bind(&is_compiled); |
| 1833 } |
| 1834 __ lw(T3, FieldAddress(T4, Code::instructions_offset())); |
1817 __ AddImmediate(T3, Instructions::HeaderSize() - kHeapObjectTag); | 1835 __ AddImmediate(T3, Instructions::HeaderSize() - kHeapObjectTag); |
1818 __ jr(T3); | 1836 __ jr(T3); |
1819 | 1837 |
1820 // Instance in T3, return its class-id in T3 as Smi. | 1838 // Instance in T3, return its class-id in T3 as Smi. |
1821 __ Bind(&get_class_id_as_smi); | 1839 __ Bind(&get_class_id_as_smi); |
1822 Label not_smi; | 1840 Label not_smi; |
1823 // Test if Smi -> load Smi class for comparison. | 1841 // Test if Smi -> load Smi class for comparison. |
1824 __ andi(CMPRES1, T3, Immediate(kSmiTagMask)); | 1842 __ andi(CMPRES1, T3, Immediate(kSmiTagMask)); |
1825 __ bne(CMPRES1, ZR, ¬_smi); | 1843 __ bne(CMPRES1, ZR, ¬_smi); |
1826 __ jr(RA); | 1844 __ jr(RA); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1986 } | 2004 } |
1987 | 2005 |
1988 | 2006 |
1989 void StubCode::GenerateTwoArgsUnoptimizedStaticCallStub(Assembler* assembler) { | 2007 void StubCode::GenerateTwoArgsUnoptimizedStaticCallStub(Assembler* assembler) { |
1990 GenerateUsageCounterIncrement(assembler, T0); | 2008 GenerateUsageCounterIncrement(assembler, T0); |
1991 GenerateNArgsCheckInlineCacheStub( | 2009 GenerateNArgsCheckInlineCacheStub( |
1992 assembler, 2, kStaticCallMissHandlerTwoArgsRuntimeEntry); | 2010 assembler, 2, kStaticCallMissHandlerTwoArgsRuntimeEntry); |
1993 } | 2011 } |
1994 | 2012 |
1995 | 2013 |
| 2014 // Stub for calling the CompileFunction runtime call. |
| 2015 // S5: IC-Data. |
| 2016 // S4: Arguments descriptor. |
| 2017 // T0: Function. |
| 2018 void StubCode::GenerateCompileFunctionRuntimeCallStub(Assembler* assembler) { |
| 2019 __ EnterStubFrame(); |
| 2020 __ addiu(SP, SP, Immediate(-3 * kWordSize)); |
| 2021 __ sw(S5, Address(SP, 2 * kWordSize)); // Preserve IC data object. |
| 2022 __ sw(S4, Address(SP, 1 * kWordSize)); // Preserve args descriptor array. |
| 2023 __ sw(T0, Address(SP, 0 * kWordSize)); // Pass function. |
| 2024 __ CallRuntime(kCompileFunctionRuntimeEntry, 1); |
| 2025 __ lw(T0, Address(SP, 0 * kWordSize)); // Restore function. |
| 2026 __ lw(S4, Address(SP, 1 * kWordSize)); // Restore args descriptor array. |
| 2027 __ lw(S5, Address(SP, 2 * kWordSize)); // Restore IC data array. |
| 2028 __ LeaveStubFrameAndReturn(); |
| 2029 } |
| 2030 |
| 2031 |
1996 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) { | 2032 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) { |
1997 __ Comment("BreakpointRuntime stub"); | 2033 __ Comment("BreakpointRuntime stub"); |
1998 __ EnterStubFrame(); | 2034 __ EnterStubFrame(); |
1999 __ addiu(SP, SP, Immediate(-3 * kWordSize)); | 2035 __ addiu(SP, SP, Immediate(-3 * kWordSize)); |
2000 __ sw(S5, Address(SP, 2 * kWordSize)); | 2036 __ sw(S5, Address(SP, 2 * kWordSize)); |
2001 __ sw(S4, Address(SP, 1 * kWordSize)); | 2037 __ sw(S4, Address(SP, 1 * kWordSize)); |
2002 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); | 2038 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); |
2003 __ sw(TMP, Address(SP, 0 * kWordSize)); | 2039 __ sw(TMP, Address(SP, 0 * kWordSize)); |
2004 | 2040 |
2005 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); | 2041 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2396 __ lw(left, Address(SP, 1 * kWordSize)); | 2432 __ lw(left, Address(SP, 1 * kWordSize)); |
2397 __ lw(temp2, Address(SP, 2 * kWordSize)); | 2433 __ lw(temp2, Address(SP, 2 * kWordSize)); |
2398 __ lw(temp1, Address(SP, 3 * kWordSize)); | 2434 __ lw(temp1, Address(SP, 3 * kWordSize)); |
2399 __ Ret(); | 2435 __ Ret(); |
2400 __ delay_slot()->addiu(SP, SP, Immediate(4 * kWordSize)); | 2436 __ delay_slot()->addiu(SP, SP, Immediate(4 * kWordSize)); |
2401 } | 2437 } |
2402 | 2438 |
2403 } // namespace dart | 2439 } // namespace dart |
2404 | 2440 |
2405 #endif // defined TARGET_ARCH_MIPS | 2441 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |