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" |
(...skipping 19 matching lines...) Expand all Loading... |
30 { | 30 { |
31 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); | 31 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
32 switch (breakpoint_kind_) { | 32 switch (breakpoint_kind_) { |
33 case RawPcDescriptors::kIcCall: | 33 case RawPcDescriptors::kIcCall: |
34 case RawPcDescriptors::kUnoptStaticCall: { | 34 case RawPcDescriptors::kUnoptStaticCall: { |
35 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); | 35 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
36 CodePatcher::PatchStaticCallAt( | 36 CodePatcher::PatchStaticCallAt( |
37 pc_, code, isolate->stub_code()->ICCallBreakpointEntryPoint()); | 37 pc_, code, isolate->stub_code()->ICCallBreakpointEntryPoint()); |
38 break; | 38 break; |
39 } | 39 } |
40 case RawPcDescriptors::kClosureCall: { | |
41 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); | |
42 CodePatcher::PatchStaticCallAt( | |
43 pc_, code, isolate->stub_code()->ClosureCallBreakpointEntryPoint()); | |
44 break; | |
45 } | |
46 case RawPcDescriptors::kRuntimeCall: { | 40 case RawPcDescriptors::kRuntimeCall: { |
47 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); | 41 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
48 CodePatcher::PatchStaticCallAt( | 42 CodePatcher::PatchStaticCallAt( |
49 pc_, code, isolate->stub_code()->RuntimeCallBreakpointEntryPoint()); | 43 pc_, code, isolate->stub_code()->RuntimeCallBreakpointEntryPoint()); |
50 break; | 44 break; |
51 } | 45 } |
52 default: | 46 default: |
53 UNREACHABLE(); | 47 UNREACHABLE(); |
54 } | 48 } |
55 } | 49 } |
56 is_enabled_ = true; | 50 is_enabled_ = true; |
57 } | 51 } |
58 | 52 |
59 | 53 |
60 void CodeBreakpoint::RestoreCode() { | 54 void CodeBreakpoint::RestoreCode() { |
61 ASSERT(is_enabled_); | 55 ASSERT(is_enabled_); |
62 const Code& code = Code::Handle(code_); | 56 const Code& code = Code::Handle(code_); |
63 const Instructions& instrs = Instructions::Handle(code.instructions()); | 57 const Instructions& instrs = Instructions::Handle(code.instructions()); |
64 { | 58 { |
65 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); | 59 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
66 switch (breakpoint_kind_) { | 60 switch (breakpoint_kind_) { |
67 case RawPcDescriptors::kIcCall: | 61 case RawPcDescriptors::kIcCall: |
68 case RawPcDescriptors::kUnoptStaticCall: | 62 case RawPcDescriptors::kUnoptStaticCall: |
69 case RawPcDescriptors::kClosureCall: | |
70 case RawPcDescriptors::kRuntimeCall: { | 63 case RawPcDescriptors::kRuntimeCall: { |
71 CodePatcher::PatchStaticCallAt(pc_, code, saved_value_); | 64 CodePatcher::PatchStaticCallAt(pc_, code, saved_value_); |
72 break; | 65 break; |
73 } | 66 } |
74 default: | 67 default: |
75 UNREACHABLE(); | 68 UNREACHABLE(); |
76 } | 69 } |
77 } | 70 } |
78 is_enabled_ = false; | 71 is_enabled_ = false; |
79 } | 72 } |
80 | 73 |
81 } // namespace dart | 74 } // namespace dart |
82 | 75 |
83 #endif // defined TARGET_ARCH_IA32 | 76 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |