Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: runtime/vm/debugger_ia32.cc

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/debugger_dbc.cc ('k') | runtime/vm/debugger_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef PRODUCT 20 #ifndef PRODUCT
21 21
22 RawCode* CodeBreakpoint::OrigStubAddress() const { 22 RawCode* CodeBreakpoint::OrigStubAddress() const {
23 return saved_value_; 23 return saved_value_;
24 } 24 }
25 25
26
27 void CodeBreakpoint::PatchCode() { 26 void CodeBreakpoint::PatchCode() {
28 ASSERT(!is_enabled_); 27 ASSERT(!is_enabled_);
29 const Code& code = Code::Handle(code_); 28 const Code& code = Code::Handle(code_);
30 const Instructions& instrs = Instructions::Handle(code.instructions()); 29 const Instructions& instrs = Instructions::Handle(code.instructions());
31 Code& stub_target = Code::Handle(); 30 Code& stub_target = Code::Handle();
32 { 31 {
33 WritableInstructionsScope writable(instrs.PayloadStart(), instrs.Size()); 32 WritableInstructionsScope writable(instrs.PayloadStart(), instrs.Size());
34 switch (breakpoint_kind_) { 33 switch (breakpoint_kind_) {
35 case RawPcDescriptors::kIcCall: 34 case RawPcDescriptors::kIcCall:
36 case RawPcDescriptors::kUnoptStaticCall: { 35 case RawPcDescriptors::kUnoptStaticCall: {
37 stub_target = StubCode::ICCallBreakpoint_entry()->code(); 36 stub_target = StubCode::ICCallBreakpoint_entry()->code();
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 stub_target = StubCode::RuntimeCallBreakpoint_entry()->code(); 41 stub_target = StubCode::RuntimeCallBreakpoint_entry()->code();
43 break; 42 break;
44 } 43 }
45 default: 44 default:
46 UNREACHABLE(); 45 UNREACHABLE();
47 } 46 }
48 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); 47 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code);
49 CodePatcher::PatchStaticCallAt(pc_, code, stub_target); 48 CodePatcher::PatchStaticCallAt(pc_, code, stub_target);
50 } 49 }
51 is_enabled_ = true; 50 is_enabled_ = true;
52 } 51 }
53 52
54
55 void CodeBreakpoint::RestoreCode() { 53 void CodeBreakpoint::RestoreCode() {
56 ASSERT(is_enabled_); 54 ASSERT(is_enabled_);
57 const Code& code = Code::Handle(code_); 55 const Code& code = Code::Handle(code_);
58 const Instructions& instrs = Instructions::Handle(code.instructions()); 56 const Instructions& instrs = Instructions::Handle(code.instructions());
59 { 57 {
60 WritableInstructionsScope writable(instrs.PayloadStart(), instrs.Size()); 58 WritableInstructionsScope writable(instrs.PayloadStart(), instrs.Size());
61 switch (breakpoint_kind_) { 59 switch (breakpoint_kind_) {
62 case RawPcDescriptors::kIcCall: 60 case RawPcDescriptors::kIcCall:
63 case RawPcDescriptors::kUnoptStaticCall: 61 case RawPcDescriptors::kUnoptStaticCall:
64 case RawPcDescriptors::kRuntimeCall: { 62 case RawPcDescriptors::kRuntimeCall: {
65 CodePatcher::PatchStaticCallAt(pc_, code, Code::Handle(saved_value_)); 63 CodePatcher::PatchStaticCallAt(pc_, code, Code::Handle(saved_value_));
66 break; 64 break;
67 } 65 }
68 default: 66 default:
69 UNREACHABLE(); 67 UNREACHABLE();
70 } 68 }
71 } 69 }
72 is_enabled_ = false; 70 is_enabled_ = false;
73 } 71 }
74 72
75 #endif // !PRODUCT 73 #endif // !PRODUCT
76 74
77 } // namespace dart 75 } // namespace dart
78 76
79 #endif // defined TARGET_ARCH_IA32 77 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/debugger_dbc.cc ('k') | runtime/vm/debugger_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698