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 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 __ Ret(); | 1978 __ Ret(); |
1979 __ delay_slot()->mov(V0, SP); | 1979 __ delay_slot()->mov(V0, SP); |
1980 } | 1980 } |
1981 | 1981 |
1982 | 1982 |
1983 // Jump to the exception or error handler. | 1983 // Jump to the exception or error handler. |
1984 // RA: return address. | 1984 // RA: return address. |
1985 // A0: program_counter. | 1985 // A0: program_counter. |
1986 // A1: stack_pointer. | 1986 // A1: stack_pointer. |
1987 // A2: frame_pointer. | 1987 // A2: frame_pointer. |
1988 // A3: thread. | 1988 // A3: error object. |
| 1989 // SP + 4*kWordSize: address of stacktrace object. |
| 1990 // SP + 5*kWordSize: address of thread. |
1989 // Does not return. | 1991 // Does not return. |
1990 void StubCode::GenerateJumpToFrameStub(Assembler* assembler) { | 1992 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { |
1991 ASSERT(kExceptionObjectReg == V0); | 1993 ASSERT(kExceptionObjectReg == V0); |
1992 ASSERT(kStackTraceObjectReg == V1); | 1994 ASSERT(kStackTraceObjectReg == V1); |
1993 __ mov(FP, A2); // Frame_pointer. | 1995 __ mov(V0, A3); // Exception object. |
1994 __ mov(THR, A3); // Thread. | 1996 // MIPS ABI reserves stack space for all arguments. The StackTrace object is |
| 1997 // the last of five arguments, so it is first pushed on the stack. |
| 1998 __ lw(V1, Address(SP, 4 * kWordSize)); // StackTrace object. |
| 1999 __ mov(FP, A2); // Frame_pointer. |
| 2000 __ lw(THR, Address(SP, 5 * kWordSize)); // Thread. |
1995 // Set tag. | 2001 // Set tag. |
1996 __ LoadImmediate(A2, VMTag::kDartTagId); | 2002 __ LoadImmediate(A2, VMTag::kDartTagId); |
1997 __ sw(A2, Assembler::VMTagAddress()); | 2003 __ sw(A2, Assembler::VMTagAddress()); |
1998 // Clear top exit frame. | 2004 // Clear top exit frame. |
1999 __ sw(ZR, Address(THR, Thread::top_exit_frame_info_offset())); | 2005 __ sw(ZR, Address(THR, Thread::top_exit_frame_info_offset())); |
2000 // Restore pool pointer. | 2006 // Restore pool pointer. |
2001 __ RestoreCodePointer(); | 2007 __ RestoreCodePointer(); |
2002 __ LoadPoolPointer(); | 2008 __ LoadPoolPointer(); |
2003 __ jr(A0); // Jump to the program counter. | 2009 __ jr(A0); // Jump to the exception handler code. |
2004 __ delay_slot()->mov(SP, A1); // Stack pointer. | 2010 __ delay_slot()->mov(SP, A1); // Stack pointer. |
2005 } | 2011 } |
2006 | 2012 |
2007 | 2013 |
2008 // Run an exception handler. Execution comes from JumpToFrame | |
2009 // stub or from the simulator. | |
2010 // | |
2011 // The arguments are stored in the Thread object. | |
2012 // Does not return. | |
2013 void StubCode::GenerateRunExceptionHandlerStub(Assembler* assembler) { | |
2014 __ lw(A0, Address(THR, Thread::resume_pc_offset())); | |
2015 __ LoadImmediate(A2, 0); | |
2016 | |
2017 // Load the exception from the current thread. | |
2018 Address exception_addr(THR, Thread::active_exception_offset()); | |
2019 __ lw(V0, exception_addr); | |
2020 __ sw(A2, exception_addr); | |
2021 | |
2022 // Load the stacktrace from the current thread. | |
2023 Address stacktrace_addr(THR, Thread::active_stacktrace_offset()); | |
2024 __ lw(V1, stacktrace_addr); | |
2025 | |
2026 __ jr(A0); // Jump to continuation point. | |
2027 __ delay_slot()->sw(A2, stacktrace_addr); | |
2028 } | |
2029 | |
2030 | |
2031 // Calls to the runtime to optimize the given function. | 2014 // Calls to the runtime to optimize the given function. |
2032 // T0: function to be reoptimized. | 2015 // T0: function to be reoptimized. |
2033 // S4: argument descriptor (preserved). | 2016 // S4: argument descriptor (preserved). |
2034 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { | 2017 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { |
2035 __ Comment("OptimizeFunctionStub"); | 2018 __ Comment("OptimizeFunctionStub"); |
2036 __ EnterStubFrame(); | 2019 __ EnterStubFrame(); |
2037 __ addiu(SP, SP, Immediate(-3 * kWordSize)); | 2020 __ addiu(SP, SP, Immediate(-3 * kWordSize)); |
2038 __ sw(S4, Address(SP, 2 * kWordSize)); | 2021 __ sw(S4, Address(SP, 2 * kWordSize)); |
2039 // Setup space on stack for return value. | 2022 // Setup space on stack for return value. |
2040 __ sw(ZR, Address(SP, 1 * kWordSize)); | 2023 __ sw(ZR, Address(SP, 1 * kWordSize)); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2398 } | 2381 } |
2399 | 2382 |
2400 | 2383 |
2401 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { | 2384 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { |
2402 __ break_(0); | 2385 __ break_(0); |
2403 } | 2386 } |
2404 | 2387 |
2405 } // namespace dart | 2388 } // namespace dart |
2406 | 2389 |
2407 #endif // defined TARGET_ARCH_MIPS | 2390 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |