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

Side by Side Diff: runtime/vm/debugger_dbc.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_arm64.cc ('k') | runtime/vm/debugger_ia32.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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_DBC) 6 #if defined(TARGET_ARCH_DBC)
7 7
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/debugger.h" 10 #include "vm/debugger.h"
11 #include "vm/instructions.h" 11 #include "vm/instructions.h"
12 #include "vm/stub_code.h" 12 #include "vm/stub_code.h"
13 13
14 namespace dart { 14 namespace dart {
15 15
16 #ifndef PRODUCT 16 #ifndef PRODUCT
17 17
18 RawCode* CodeBreakpoint::OrigStubAddress() const { 18 RawCode* CodeBreakpoint::OrigStubAddress() const {
19 return reinterpret_cast<RawCode*>(static_cast<uintptr_t>(saved_value_)); 19 return reinterpret_cast<RawCode*>(static_cast<uintptr_t>(saved_value_));
20 } 20 }
21 21
22
23 static Instr* CallInstructionFromReturnAddress(uword pc) { 22 static Instr* CallInstructionFromReturnAddress(uword pc) {
24 return reinterpret_cast<Instr*>(pc) - 1; 23 return reinterpret_cast<Instr*>(pc) - 1;
25 } 24 }
26 25
27
28 static Instr* FastSmiInstructionFromReturnAddress(uword pc) { 26 static Instr* FastSmiInstructionFromReturnAddress(uword pc) {
29 return reinterpret_cast<Instr*>(pc) - 2; 27 return reinterpret_cast<Instr*>(pc) - 2;
30 } 28 }
31 29
32
33 void CodeBreakpoint::PatchCode() { 30 void CodeBreakpoint::PatchCode() {
34 ASSERT(!is_enabled_); 31 ASSERT(!is_enabled_);
35 const Code& code = Code::Handle(code_); 32 const Code& code = Code::Handle(code_);
36 const Instructions& instrs = Instructions::Handle(code.instructions()); 33 const Instructions& instrs = Instructions::Handle(code.instructions());
37 { 34 {
38 WritableInstructionsScope writable(instrs.PayloadStart(), instrs.Size()); 35 WritableInstructionsScope writable(instrs.PayloadStart(), instrs.Size());
39 saved_value_ = *CallInstructionFromReturnAddress(pc_); 36 saved_value_ = *CallInstructionFromReturnAddress(pc_);
40 switch (breakpoint_kind_) { 37 switch (breakpoint_kind_) {
41 case RawPcDescriptors::kIcCall: 38 case RawPcDescriptors::kIcCall:
42 case RawPcDescriptors::kUnoptStaticCall: { 39 case RawPcDescriptors::kUnoptStaticCall: {
(...skipping 21 matching lines...) Expand all
64 saved_value_fastsmi_ = *FastSmiInstructionFromReturnAddress(pc_); 61 saved_value_fastsmi_ = *FastSmiInstructionFromReturnAddress(pc_);
65 *FastSmiInstructionFromReturnAddress(pc_) = 62 *FastSmiInstructionFromReturnAddress(pc_) =
66 Bytecode::Encode(Bytecode::kNop, 0, 0, 0); 63 Bytecode::Encode(Bytecode::kNop, 0, 0, 0);
67 } else { 64 } else {
68 saved_value_fastsmi_ = Bytecode::kTrap; 65 saved_value_fastsmi_ = Bytecode::kTrap;
69 } 66 }
70 } 67 }
71 is_enabled_ = true; 68 is_enabled_ = true;
72 } 69 }
73 70
74
75 void CodeBreakpoint::RestoreCode() { 71 void CodeBreakpoint::RestoreCode() {
76 ASSERT(is_enabled_); 72 ASSERT(is_enabled_);
77 const Code& code = Code::Handle(code_); 73 const Code& code = Code::Handle(code_);
78 const Instructions& instrs = Instructions::Handle(code.instructions()); 74 const Instructions& instrs = Instructions::Handle(code.instructions());
79 { 75 {
80 WritableInstructionsScope writable(instrs.PayloadStart(), instrs.Size()); 76 WritableInstructionsScope writable(instrs.PayloadStart(), instrs.Size());
81 switch (breakpoint_kind_) { 77 switch (breakpoint_kind_) {
82 case RawPcDescriptors::kIcCall: 78 case RawPcDescriptors::kIcCall:
83 case RawPcDescriptors::kUnoptStaticCall: 79 case RawPcDescriptors::kUnoptStaticCall:
84 case RawPcDescriptors::kRuntimeCall: { 80 case RawPcDescriptors::kRuntimeCall: {
(...skipping 11 matching lines...) Expand all
96 } 92 }
97 } 93 }
98 is_enabled_ = false; 94 is_enabled_ = false;
99 } 95 }
100 96
101 #endif // !PRODUCT 97 #endif // !PRODUCT
102 98
103 } // namespace dart 99 } // namespace dart
104 100
105 #endif // defined TARGET_ARCH_DBC 101 #endif // defined TARGET_ARCH_DBC
OLDNEW
« no previous file with comments | « runtime/vm/debugger_arm64.cc ('k') | runtime/vm/debugger_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698