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/assembler.h" | 10 #include "vm/assembler.h" |
11 #include "vm/code_patcher.h" | 11 #include "vm/code_patcher.h" |
12 #include "vm/cpu.h" | 12 #include "vm/cpu.h" |
13 #include "vm/instructions.h" | 13 #include "vm/instructions.h" |
14 #include "vm/stub_code.h" | 14 #include "vm/stub_code.h" |
15 | 15 |
16 namespace dart { | 16 namespace dart { |
17 | 17 |
18 RawInstance* ActivationFrame::GetInstanceCallReceiver( | |
19 intptr_t num_actual_args) { | |
20 ASSERT(num_actual_args > 0); // At minimum we have a receiver on the stack. | |
21 // Stack pointer points to last argument that was pushed on the stack. | |
22 uword receiver_addr = sp() + ((num_actual_args - 1) * kWordSize); | |
23 return reinterpret_cast<RawInstance*>( | |
24 *reinterpret_cast<uword*>(receiver_addr)); | |
25 } | |
26 | |
27 | |
28 RawObject* ActivationFrame::GetClosureObject(intptr_t num_actual_args) { | |
29 // At a minimum we have the closure object on the stack. | |
30 ASSERT(num_actual_args > 0); | |
31 // Stack pointer points to last argument that was pushed on the stack. | |
32 uword closure_addr = sp() + ((num_actual_args - 1) * kWordSize); | |
33 return reinterpret_cast<RawObject*>( | |
34 *reinterpret_cast<uword*>(closure_addr)); | |
35 } | |
36 | |
37 | |
38 uword CodeBreakpoint::OrigStubAddress() const { | 18 uword CodeBreakpoint::OrigStubAddress() const { |
39 const Code& code = Code::Handle(code_); | 19 const Code& code = Code::Handle(code_); |
40 const Array& object_pool = Array::Handle(code.ObjectPool()); | 20 const Array& object_pool = Array::Handle(code.ObjectPool()); |
41 uword offset = saved_value_ + kHeapObjectTag; | 21 uword offset = saved_value_ + kHeapObjectTag; |
42 ASSERT((offset % kWordSize) == 0); | 22 ASSERT((offset % kWordSize) == 0); |
43 const intptr_t index = (offset - Array::data_offset()) / kWordSize; | 23 const intptr_t index = (offset - Array::data_offset()) / kWordSize; |
44 const uword stub_address = reinterpret_cast<uword>(object_pool.At(index)); | 24 const uword stub_address = reinterpret_cast<uword>(object_pool.At(index)); |
45 ASSERT(stub_address % kWordSize == 0); | 25 ASSERT(stub_address % kWordSize == 0); |
46 return stub_address; | 26 return stub_address; |
47 } | 27 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 UNREACHABLE(); | 91 UNREACHABLE(); |
112 } | 92 } |
113 } | 93 } |
114 is_enabled_ = false; | 94 is_enabled_ = false; |
115 } | 95 } |
116 | 96 |
117 | 97 |
118 } // namespace dart | 98 } // namespace dart |
119 | 99 |
120 #endif // defined TARGET_ARCH_X64 | 100 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |