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/cpu.h" | 8 #include "vm/cpu.h" |
9 #include "vm/debugger.h" | 9 #include "vm/debugger.h" |
10 #include "vm/instructions.h" | 10 #include "vm/instructions.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 RawInstance* ActivationFrame::GetInstanceCallReceiver( | 23 RawInstance* ActivationFrame::GetInstanceCallReceiver( |
24 intptr_t num_actual_args) { | 24 intptr_t num_actual_args) { |
25 ASSERT(num_actual_args > 0); // At minimum we have a receiver on the stack. | 25 ASSERT(num_actual_args > 0); // At minimum we have a receiver on the stack. |
26 // Stack pointer points to last argument that was pushed on the stack. | 26 // Stack pointer points to last argument that was pushed on the stack. |
27 uword receiver_addr = sp() + ((num_actual_args - 1) * kWordSize); | 27 uword receiver_addr = sp() + ((num_actual_args - 1) * kWordSize); |
28 return reinterpret_cast<RawInstance*>( | 28 return reinterpret_cast<RawInstance*>( |
29 *reinterpret_cast<uword*>(receiver_addr)); | 29 *reinterpret_cast<uword*>(receiver_addr)); |
30 } | 30 } |
31 | 31 |
32 | 32 |
| 33 RawObject* ActivationFrame::GetClosureObject(intptr_t num_actual_args) { |
| 34 // At a minimum we have the closure object on the stack. |
| 35 ASSERT(num_actual_args > 0); |
| 36 // Stack pointer points to last argument that was pushed on the stack. |
| 37 uword closure_addr = sp() + ((num_actual_args - 1) * kWordSize); |
| 38 return reinterpret_cast<RawObject*>( |
| 39 *reinterpret_cast<uword*>(closure_addr)); |
| 40 } |
| 41 |
| 42 |
33 void CodeBreakpoint::PatchFunctionReturn() { | 43 void CodeBreakpoint::PatchFunctionReturn() { |
34 Instr* instr1 = Instr::At(pc_ - 5 * Instr::kInstrSize); | 44 Instr* instr1 = Instr::At(pc_ - 5 * Instr::kInstrSize); |
35 Instr* instr2 = Instr::At(pc_ - 4 * Instr::kInstrSize); | 45 Instr* instr2 = Instr::At(pc_ - 4 * Instr::kInstrSize); |
36 Instr* instr3 = Instr::At(pc_ - 3 * Instr::kInstrSize); | 46 Instr* instr3 = Instr::At(pc_ - 3 * Instr::kInstrSize); |
37 Instr* instr4 = Instr::At(pc_ - 2 * Instr::kInstrSize); | 47 Instr* instr4 = Instr::At(pc_ - 2 * Instr::kInstrSize); |
38 Instr* instr5 = Instr::At(pc_ - 1 * Instr::kInstrSize); | 48 Instr* instr5 = Instr::At(pc_ - 1 * Instr::kInstrSize); |
39 | 49 |
40 #if defined(DEBUG) | 50 #if defined(DEBUG) |
41 | 51 |
42 instr1->AssertIsImmInstr(LW, SP, RA, 2 * kWordSize); | 52 instr1->AssertIsImmInstr(LW, SP, RA, 2 * kWordSize); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 instr3->SetImmInstrBits(LW, SP, PP, 0 * kWordSize); | 88 instr3->SetImmInstrBits(LW, SP, PP, 0 * kWordSize); |
79 instr4->SetSpecialInstrBits(JR, RA, ZR, ZR); | 89 instr4->SetSpecialInstrBits(JR, RA, ZR, ZR); |
80 instr5->SetImmInstrBits(ADDIU, SP, SP, 4 * kWordSize); | 90 instr5->SetImmInstrBits(ADDIU, SP, SP, 4 * kWordSize); |
81 | 91 |
82 CPU::FlushICache(pc_ - 5 * Instr::kInstrSize, 5 * Instr::kInstrSize); | 92 CPU::FlushICache(pc_ - 5 * Instr::kInstrSize, 5 * Instr::kInstrSize); |
83 } | 93 } |
84 | 94 |
85 } // namespace dart | 95 } // namespace dart |
86 | 96 |
87 #endif // defined TARGET_ARCH_MIPS | 97 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |