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 uword CodeBreakpoint::OrigStubAddress() const { | 20 uword CodeBreakpoint::OrigStubAddress() const { |
21 return saved_value_; | 21 return saved_value_; |
22 } | 22 } |
23 | 23 |
24 | 24 |
25 void CodeBreakpoint::PatchCode() { | 25 void CodeBreakpoint::PatchCode() { |
26 ASSERT(!is_enabled_); | 26 ASSERT(!is_enabled_); |
27 const Code& code = Code::Handle(code_); | 27 const Code& code = Code::Handle(code_); |
28 const Instructions& instrs = Instructions::Handle(code.instructions()); | 28 const Instructions& instrs = Instructions::Handle(code.instructions()); |
29 Isolate* isolate = Isolate::Current(); | |
30 { | 29 { |
31 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); | 30 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
32 switch (breakpoint_kind_) { | 31 switch (breakpoint_kind_) { |
33 case RawPcDescriptors::kIcCall: | 32 case RawPcDescriptors::kIcCall: |
34 case RawPcDescriptors::kUnoptStaticCall: { | 33 case RawPcDescriptors::kUnoptStaticCall: { |
35 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); | 34 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
36 CodePatcher::PatchStaticCallAt( | 35 CodePatcher::PatchStaticCallAt( |
37 pc_, code, isolate->stub_code()->ICCallBreakpointEntryPoint()); | 36 pc_, code, StubCode::ICCallBreakpointEntryPoint()); |
38 break; | 37 break; |
39 } | 38 } |
40 case RawPcDescriptors::kRuntimeCall: { | 39 case RawPcDescriptors::kRuntimeCall: { |
41 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); | 40 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
42 CodePatcher::PatchStaticCallAt( | 41 CodePatcher::PatchStaticCallAt( |
43 pc_, code, isolate->stub_code()->RuntimeCallBreakpointEntryPoint()); | 42 pc_, code, StubCode::RuntimeCallBreakpointEntryPoint()); |
44 break; | 43 break; |
45 } | 44 } |
46 default: | 45 default: |
47 UNREACHABLE(); | 46 UNREACHABLE(); |
48 } | 47 } |
49 } | 48 } |
50 is_enabled_ = true; | 49 is_enabled_ = true; |
51 } | 50 } |
52 | 51 |
53 | 52 |
(...skipping 13 matching lines...) Expand all Loading... |
67 default: | 66 default: |
68 UNREACHABLE(); | 67 UNREACHABLE(); |
69 } | 68 } |
70 } | 69 } |
71 is_enabled_ = false; | 70 is_enabled_ = false; |
72 } | 71 } |
73 | 72 |
74 } // namespace dart | 73 } // namespace dart |
75 | 74 |
76 #endif // defined TARGET_ARCH_IA32 | 75 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |