OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
7 | 7 |
8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/debugger.h" | 10 #include "vm/debugger.h" |
11 #include "vm/instructions.h" | 11 #include "vm/instructions.h" |
12 #include "vm/stub_code.h" | 12 #include "vm/stub_code.h" |
13 | 13 |
14 namespace dart { | 14 namespace dart { |
15 | 15 |
16 RawInstance* ActivationFrame::GetInstanceCallReceiver( | |
17 intptr_t num_actual_args) { | |
18 ASSERT(num_actual_args > 0); // At minimum we have a receiver on the stack. | |
19 // Stack pointer points to last argument that was pushed on the stack. | |
20 const uword receiver_addr = sp() + ((num_actual_args - 1) * kWordSize); | |
21 const uword receiver = *reinterpret_cast<uword*>(receiver_addr); | |
22 return reinterpret_cast<RawInstance*>(receiver); | |
23 } | |
24 | |
25 | |
26 RawObject* ActivationFrame::GetClosureObject(intptr_t num_actual_args) { | |
27 // At a minimum we have the closure object on the stack. | |
28 ASSERT(num_actual_args > 0); | |
29 // Stack pointer points to last argument that was pushed on the stack. | |
30 const uword closure_addr = sp() + ((num_actual_args - 1) * kWordSize); | |
31 const uword closure = *reinterpret_cast<uword*>(closure_addr); | |
32 return reinterpret_cast<RawObject*>(closure); | |
33 } | |
34 | |
35 | |
36 uword CodeBreakpoint::OrigStubAddress() const { | 16 uword CodeBreakpoint::OrigStubAddress() const { |
37 const Code& code = Code::Handle(code_); | 17 const Code& code = Code::Handle(code_); |
38 const Array& object_pool = Array::Handle(code.ObjectPool()); | 18 const Array& object_pool = Array::Handle(code.ObjectPool()); |
39 const uword offset = saved_value_; | 19 const uword offset = saved_value_; |
40 ASSERT((offset % kWordSize) == 0); | 20 ASSERT((offset % kWordSize) == 0); |
41 const intptr_t index = (offset - Array::data_offset()) / kWordSize; | 21 const intptr_t index = (offset - Array::data_offset()) / kWordSize; |
42 const uword stub_address = reinterpret_cast<uword>(object_pool.At(index)); | 22 const uword stub_address = reinterpret_cast<uword>(object_pool.At(index)); |
43 ASSERT(stub_address % kWordSize == 0); | 23 ASSERT(stub_address % kWordSize == 0); |
44 return stub_address; | 24 return stub_address; |
45 } | 25 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 default: | 88 default: |
109 UNREACHABLE(); | 89 UNREACHABLE(); |
110 } | 90 } |
111 } | 91 } |
112 is_enabled_ = false; | 92 is_enabled_ = false; |
113 } | 93 } |
114 | 94 |
115 } // namespace dart | 95 } // namespace dart |
116 | 96 |
117 #endif // defined TARGET_ARCH_ARM64 | 97 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |