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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/debugger.h" | 8 #include "vm/debugger.h" |
9 | 9 |
10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
11 #include "vm/cpu.h" | 11 #include "vm/cpu.h" |
12 #include "vm/disassembler.h" | 12 #include "vm/disassembler.h" |
13 #include "vm/object.h" | 13 #include "vm/object.h" |
14 #include "vm/os.h" | 14 #include "vm/os.h" |
15 #include "vm/stack_frame.h" | 15 #include "vm/stack_frame.h" |
16 #include "vm/stub_code.h" | 16 #include "vm/stub_code.h" |
17 | 17 |
18 namespace dart { | 18 namespace dart { |
19 | 19 |
20 RawInstance* ActivationFrame::GetInstanceCallReceiver( | |
21 intptr_t num_actual_args) { | |
22 ASSERT(num_actual_args > 0); // At minimum we have a receiver on the stack. | |
23 // Stack pointer points to last argument that was pushed on the stack. | |
24 uword receiver_addr = sp() + ((num_actual_args - 1) * kWordSize); | |
25 return reinterpret_cast<RawInstance*>( | |
26 *reinterpret_cast<uword*>(receiver_addr)); | |
27 } | |
28 | |
29 | |
30 RawObject* ActivationFrame::GetClosureObject(intptr_t num_actual_args) { | |
31 // At a minimum we have the closure object on the stack. | |
32 ASSERT(num_actual_args > 0); | |
33 // Stack pointer points to last argument that was pushed on the stack. | |
34 uword closure_addr = sp() + ((num_actual_args - 1) * kWordSize); | |
35 return reinterpret_cast<RawObject*>( | |
36 *reinterpret_cast<uword*>(closure_addr)); | |
37 } | |
38 | |
39 | |
40 uword CodeBreakpoint::OrigStubAddress() const { | 20 uword CodeBreakpoint::OrigStubAddress() const { |
41 return saved_value_; | 21 return saved_value_; |
42 } | 22 } |
43 | 23 |
44 | 24 |
45 void CodeBreakpoint::PatchCode() { | 25 void CodeBreakpoint::PatchCode() { |
46 ASSERT(!is_enabled_); | 26 ASSERT(!is_enabled_); |
47 const Code& code = Code::Handle(code_); | 27 const Code& code = Code::Handle(code_); |
48 const Instructions& instrs = Instructions::Handle(code.instructions()); | 28 const Instructions& instrs = Instructions::Handle(code.instructions()); |
49 Isolate* isolate = Isolate::Current(); | 29 Isolate* isolate = Isolate::Current(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 default: | 74 default: |
95 UNREACHABLE(); | 75 UNREACHABLE(); |
96 } | 76 } |
97 } | 77 } |
98 is_enabled_ = false; | 78 is_enabled_ = false; |
99 } | 79 } |
100 | 80 |
101 } // namespace dart | 81 } // namespace dart |
102 | 82 |
103 #endif // defined TARGET_ARCH_IA32 | 83 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |