OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
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 uword* code = reinterpret_cast<uword*>(pc_ - 3 * Instr::kInstrSize); | 44 uword* code = reinterpret_cast<uword*>(pc_ - 3 * Instr::kInstrSize); |
35 ASSERT(code[0] == 0xe8bd4c00); // ldmia sp!, {pp, fp, lr} | 45 ASSERT(code[0] == 0xe8bd4c00); // ldmia sp!, {pp, fp, lr} |
36 ASSERT(code[1] == 0xe28dd004); // add sp, sp, #4 | 46 ASSERT(code[1] == 0xe28dd004); // add sp, sp, #4 |
37 ASSERT(code[2] == 0xe12fff1e); // bx lr | 47 ASSERT(code[2] == 0xe12fff1e); // bx lr |
38 | 48 |
39 // Smash code with call instruction and target address. | 49 // Smash code with call instruction and target address. |
40 uword stub_addr = StubCode::BreakpointReturnEntryPoint(); | 50 uword stub_addr = StubCode::BreakpointReturnEntryPoint(); |
41 uint16_t target_lo = stub_addr & 0xffff; | 51 uint16_t target_lo = stub_addr & 0xffff; |
42 uint16_t target_hi = stub_addr >> 16; | 52 uint16_t target_hi = stub_addr >> 16; |
(...skipping 12 matching lines...) Expand all Loading... |
55 ASSERT((code[0] & 0xfff0f000) == 0xe300c000); | 65 ASSERT((code[0] & 0xfff0f000) == 0xe300c000); |
56 code[0] = 0xe8bd4c00; // ldmia sp!, {pp, fp, lr} | 66 code[0] = 0xe8bd4c00; // ldmia sp!, {pp, fp, lr} |
57 code[1] = 0xe28dd004; // add sp, sp, #4 | 67 code[1] = 0xe28dd004; // add sp, sp, #4 |
58 code[2] = 0xe12fff1e; // bx lr | 68 code[2] = 0xe12fff1e; // bx lr |
59 CPU::FlushICache(pc_ - 3 * Instr::kInstrSize, 3 * Instr::kInstrSize); | 69 CPU::FlushICache(pc_ - 3 * Instr::kInstrSize, 3 * Instr::kInstrSize); |
60 } | 70 } |
61 | 71 |
62 } // namespace dart | 72 } // namespace dart |
63 | 73 |
64 #endif // defined TARGET_ARCH_ARM | 74 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |