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 27 matching lines...) Expand all Loading... | |
38 | 38 |
39 | 39 |
40 uword CodeBreakpoint::OrigStubAddress() const { | 40 uword CodeBreakpoint::OrigStubAddress() const { |
41 return saved_value_; | 41 return saved_value_; |
42 } | 42 } |
43 | 43 |
44 | 44 |
45 void CodeBreakpoint::PatchCode() { | 45 void CodeBreakpoint::PatchCode() { |
46 ASSERT(!is_enabled_); | 46 ASSERT(!is_enabled_); |
47 switch (breakpoint_kind_) { | 47 switch (breakpoint_kind_) { |
48 case PcDescriptors::kIcCall: { | 48 case PcDescriptors::kIcCall: |
49 const Code& code = | |
50 Code::Handle(Function::Handle(function_).unoptimized_code()); | |
51 saved_value_ = CodePatcher::GetInstanceCallAt(pc_, code, NULL); | |
52 CodePatcher::PatchInstanceCallAt(pc_, code, | |
53 StubCode::BreakpointDynamicEntryPoint()); | |
54 break; | |
55 } | |
56 case PcDescriptors::kUnoptStaticCall: | 49 case PcDescriptors::kUnoptStaticCall: |
57 case PcDescriptors::kRuntimeCall: | 50 case PcDescriptors::kRuntimeCall: |
58 case PcDescriptors::kClosureCall: | 51 case PcDescriptors::kClosureCall: |
59 case PcDescriptors::kReturn: { | 52 case PcDescriptors::kReturn: { |
60 const Code& code = | 53 const Code& code = |
61 Code::Handle(Function::Handle(function_).unoptimized_code()); | 54 Code::Handle(Function::Handle(function_).unoptimized_code()); |
zra
2014/01/24 16:09:17
In general, unoptimized code can be disconnected f
| |
62 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); | 55 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
63 CodePatcher::PatchStaticCallAt(pc_, code, | 56 CodePatcher::PatchStaticCallAt(pc_, code, |
64 StubCode::BreakpointRuntimeEntryPoint()); | 57 StubCode::BreakpointRuntimeEntryPoint()); |
65 break; | 58 break; |
66 } | 59 } |
67 default: | 60 default: |
68 UNREACHABLE(); | 61 UNREACHABLE(); |
69 } | 62 } |
70 is_enabled_ = true; | 63 is_enabled_ = true; |
71 } | 64 } |
72 | 65 |
73 | 66 |
74 void CodeBreakpoint::RestoreCode() { | 67 void CodeBreakpoint::RestoreCode() { |
75 ASSERT(is_enabled_); | 68 ASSERT(is_enabled_); |
76 switch (breakpoint_kind_) { | 69 switch (breakpoint_kind_) { |
77 case PcDescriptors::kIcCall: { | 70 case PcDescriptors::kIcCall: |
78 const Code& code = | |
79 Code::Handle(Function::Handle(function_).unoptimized_code()); | |
80 CodePatcher::PatchInstanceCallAt(pc_, code, saved_value_); | |
81 break; | |
82 } | |
83 case PcDescriptors::kUnoptStaticCall: | 71 case PcDescriptors::kUnoptStaticCall: |
84 case PcDescriptors::kClosureCall: | 72 case PcDescriptors::kClosureCall: |
85 case PcDescriptors::kRuntimeCall: | 73 case PcDescriptors::kRuntimeCall: |
86 case PcDescriptors::kReturn: { | 74 case PcDescriptors::kReturn: { |
87 const Code& code = | 75 const Code& code = |
88 Code::Handle(Function::Handle(function_).unoptimized_code()); | 76 Code::Handle(Function::Handle(function_).unoptimized_code()); |
zra
2014/01/24 16:09:17
Here, and etc.
| |
89 CodePatcher::PatchStaticCallAt(pc_, code, saved_value_); | 77 CodePatcher::PatchStaticCallAt(pc_, code, saved_value_); |
90 break; | 78 break; |
91 } | 79 } |
92 default: | 80 default: |
93 UNREACHABLE(); | 81 UNREACHABLE(); |
94 } | 82 } |
95 is_enabled_ = false; | 83 is_enabled_ = false; |
96 } | 84 } |
97 | 85 |
98 } // namespace dart | 86 } // namespace dart |
99 | 87 |
100 #endif // defined TARGET_ARCH_IA32 | 88 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |