Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1136)

Side by Side Diff: runtime/vm/stub_code_mips.cc

Issue 2503653002: JumpToFrame refactor (Closed)
Patch Set: code review Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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: error object. 1988 // A3: thread.
1989 // SP + 4*kWordSize: address of stacktrace object.
1990 // SP + 5*kWordSize: address of thread.
1991 // Does not return. 1989 // Does not return.
1992 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { 1990 void StubCode::GenerateJumpToFrameStub(Assembler* assembler) {
1993 ASSERT(kExceptionObjectReg == V0); 1991 ASSERT(kExceptionObjectReg == V0);
1994 ASSERT(kStackTraceObjectReg == V1); 1992 ASSERT(kStackTraceObjectReg == V1);
1995 __ mov(V0, A3); // Exception object. 1993 __ mov(FP, A2); // Frame_pointer.
1996 // MIPS ABI reserves stack space for all arguments. The StackTrace object is 1994 __ mov(THR, A3); // Thread.
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.
2001 // Set tag. 1995 // Set tag.
2002 __ LoadImmediate(A2, VMTag::kDartTagId); 1996 __ LoadImmediate(A2, VMTag::kDartTagId);
2003 __ sw(A2, Assembler::VMTagAddress()); 1997 __ sw(A2, Assembler::VMTagAddress());
2004 // Clear top exit frame. 1998 // Clear top exit frame.
2005 __ sw(ZR, Address(THR, Thread::top_exit_frame_info_offset())); 1999 __ sw(ZR, Address(THR, Thread::top_exit_frame_info_offset()));
2006 // Restore pool pointer. 2000 // Restore pool pointer.
2007 __ RestoreCodePointer(); 2001 __ RestoreCodePointer();
2008 __ LoadPoolPointer(); 2002 __ LoadPoolPointer();
2009 __ jr(A0); // Jump to the exception handler code. 2003 __ jr(A0); // Jump to the program counter.
2010 __ delay_slot()->mov(SP, A1); // Stack pointer. 2004 __ delay_slot()->mov(SP, A1); // Stack pointer.
2011 } 2005 }
2012 2006
2013 2007
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
2014 // Calls to the runtime to optimize the given function. 2031 // Calls to the runtime to optimize the given function.
2015 // T0: function to be reoptimized. 2032 // T0: function to be reoptimized.
2016 // S4: argument descriptor (preserved). 2033 // S4: argument descriptor (preserved).
2017 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { 2034 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) {
2018 __ Comment("OptimizeFunctionStub"); 2035 __ Comment("OptimizeFunctionStub");
2019 __ EnterStubFrame(); 2036 __ EnterStubFrame();
2020 __ addiu(SP, SP, Immediate(-3 * kWordSize)); 2037 __ addiu(SP, SP, Immediate(-3 * kWordSize));
2021 __ sw(S4, Address(SP, 2 * kWordSize)); 2038 __ sw(S4, Address(SP, 2 * kWordSize));
2022 // Setup space on stack for return value. 2039 // Setup space on stack for return value.
2023 __ sw(ZR, Address(SP, 1 * kWordSize)); 2040 __ sw(ZR, Address(SP, 1 * kWordSize));
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 } 2398 }
2382 2399
2383 2400
2384 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { 2401 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) {
2385 __ break_(0); 2402 __ break_(0);
2386 } 2403 }
2387 2404
2388 } // namespace dart 2405 } // namespace dart
2389 2406
2390 #endif // defined TARGET_ARCH_MIPS 2407 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698