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 28 matching lines...) Expand all Loading... |
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 const Code& code = Code::Handle(code_); | 47 const Code& code = Code::Handle(code_); |
48 const Instructions& instrs = Instructions::Handle(code.instructions()); | 48 const Instructions& instrs = Instructions::Handle(code.instructions()); |
| 49 Isolate* isolate = Isolate::Current(); |
49 { | 50 { |
50 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); | 51 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
51 switch (breakpoint_kind_) { | 52 switch (breakpoint_kind_) { |
52 case RawPcDescriptors::kIcCall: | 53 case RawPcDescriptors::kIcCall: |
53 case RawPcDescriptors::kUnoptStaticCall: { | 54 case RawPcDescriptors::kUnoptStaticCall: { |
54 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); | 55 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
55 CodePatcher::PatchStaticCallAt( | 56 CodePatcher::PatchStaticCallAt( |
56 pc_, code, StubCode::ICCallBreakpointEntryPoint()); | 57 pc_, code, isolate->stub_code()->ICCallBreakpointEntryPoint()); |
57 break; | 58 break; |
58 } | 59 } |
59 case RawPcDescriptors::kClosureCall: { | 60 case RawPcDescriptors::kClosureCall: { |
60 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); | 61 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
61 CodePatcher::PatchStaticCallAt( | 62 CodePatcher::PatchStaticCallAt( |
62 pc_, code, StubCode::ClosureCallBreakpointEntryPoint()); | 63 pc_, code, isolate->stub_code()->ClosureCallBreakpointEntryPoint()); |
63 break; | 64 break; |
64 } | 65 } |
65 case RawPcDescriptors::kRuntimeCall: { | 66 case RawPcDescriptors::kRuntimeCall: { |
66 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); | 67 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
67 CodePatcher::PatchStaticCallAt( | 68 CodePatcher::PatchStaticCallAt( |
68 pc_, code, StubCode::RuntimeCallBreakpointEntryPoint()); | 69 pc_, code, isolate->stub_code()->RuntimeCallBreakpointEntryPoint()); |
69 break; | 70 break; |
70 } | 71 } |
71 default: | 72 default: |
72 UNREACHABLE(); | 73 UNREACHABLE(); |
73 } | 74 } |
74 } | 75 } |
75 is_enabled_ = true; | 76 is_enabled_ = true; |
76 } | 77 } |
77 | 78 |
78 | 79 |
(...skipping 14 matching lines...) Expand all Loading... |
93 default: | 94 default: |
94 UNREACHABLE(); | 95 UNREACHABLE(); |
95 } | 96 } |
96 } | 97 } |
97 is_enabled_ = false; | 98 is_enabled_ = false; |
98 } | 99 } |
99 | 100 |
100 } // namespace dart | 101 } // namespace dart |
101 | 102 |
102 #endif // defined TARGET_ARCH_IA32 | 103 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |