| 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_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/debugger.h" | 8 #include "vm/debugger.h" |
| 9 | 9 |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.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 uint8_t* code = reinterpret_cast<uint8_t*>(pc_ - 13); | 44 uint8_t* code = reinterpret_cast<uint8_t*>(pc_ - 13); |
| 35 // movq %rbp,%rsp | 45 // movq %rbp,%rsp |
| 36 ASSERT((code[0] == 0x48) && (code[1] == 0x89) && (code[2] == 0xec)); | 46 ASSERT((code[0] == 0x48) && (code[1] == 0x89) && (code[2] == 0xec)); |
| 37 ASSERT(code[3] == 0x5d); // popq %rbp | 47 ASSERT(code[3] == 0x5d); // popq %rbp |
| 38 ASSERT(code[4] == 0xc3); // ret | 48 ASSERT(code[4] == 0xc3); // ret |
| 39 // Next 8 bytes are nop instructions | 49 // Next 8 bytes are nop instructions |
| 40 ASSERT((code[5] == 0x90) && (code[6] == 0x90) && | 50 ASSERT((code[5] == 0x90) && (code[6] == 0x90) && |
| 41 (code[7] == 0x90) && (code[8] == 0x90) && | 51 (code[7] == 0x90) && (code[8] == 0x90) && |
| 42 (code[9] == 0x90) && (code[10] == 0x90) && | 52 (code[9] == 0x90) && (code[10] == 0x90) && |
| (...skipping 25 matching lines...) Expand all Loading... |
| 68 code[9] = 0x90; // nop | 78 code[9] = 0x90; // nop |
| 69 code[10] = 0x90; // nop | 79 code[10] = 0x90; // nop |
| 70 code[11] = 0x90; // nop | 80 code[11] = 0x90; // nop |
| 71 code[12] = 0x90; // nop | 81 code[12] = 0x90; // nop |
| 72 CPU::FlushICache(pc_ - 13, 13); | 82 CPU::FlushICache(pc_ - 13, 13); |
| 73 } | 83 } |
| 74 | 84 |
| 75 } // namespace dart | 85 } // namespace dart |
| 76 | 86 |
| 77 #endif // defined TARGET_ARCH_X64 | 87 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |