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

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

Issue 2226893002: Optimize AOT's switchable calls for the monomorphic case. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sync Created 4 years, 4 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.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"
(...skipping 17 matching lines...) Expand all
28 static Instr* FastSmiInstructionFromReturnAddress(uword pc) { 28 static Instr* FastSmiInstructionFromReturnAddress(uword pc) {
29 return reinterpret_cast<Instr*>(pc) - 2; 29 return reinterpret_cast<Instr*>(pc) - 2;
30 } 30 }
31 31
32 32
33 void CodeBreakpoint::PatchCode() { 33 void CodeBreakpoint::PatchCode() {
34 ASSERT(!is_enabled_); 34 ASSERT(!is_enabled_);
35 const Code& code = Code::Handle(code_); 35 const Code& code = Code::Handle(code_);
36 const Instructions& instrs = Instructions::Handle(code.instructions()); 36 const Instructions& instrs = Instructions::Handle(code.instructions());
37 { 37 {
38 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); 38 WritableInstructionsScope writable(instrs.PayloadStart(), instrs.size());
39 saved_value_ = *CallInstructionFromReturnAddress(pc_); 39 saved_value_ = *CallInstructionFromReturnAddress(pc_);
40 switch (breakpoint_kind_) { 40 switch (breakpoint_kind_) {
41 case RawPcDescriptors::kIcCall: 41 case RawPcDescriptors::kIcCall:
42 case RawPcDescriptors::kUnoptStaticCall: { 42 case RawPcDescriptors::kUnoptStaticCall: {
43 // DebugBreak has an A operand matching the call it replaces. 43 // DebugBreak has an A operand matching the call it replaces.
44 // This ensures that Return instructions continue to work - as they 44 // This ensures that Return instructions continue to work - as they
45 // look at calls to figure out how many arguments to drop. 45 // look at calls to figure out how many arguments to drop.
46 *CallInstructionFromReturnAddress(pc_) = 46 *CallInstructionFromReturnAddress(pc_) =
47 Bytecode::Encode(Bytecode::kDebugBreak, 47 Bytecode::Encode(Bytecode::kDebugBreak,
48 Bytecode::DecodeArgc(saved_value_), 48 Bytecode::DecodeArgc(saved_value_),
(...skipping 24 matching lines...) Expand all
73 } 73 }
74 is_enabled_ = true; 74 is_enabled_ = true;
75 } 75 }
76 76
77 77
78 void CodeBreakpoint::RestoreCode() { 78 void CodeBreakpoint::RestoreCode() {
79 ASSERT(is_enabled_); 79 ASSERT(is_enabled_);
80 const Code& code = Code::Handle(code_); 80 const Code& code = Code::Handle(code_);
81 const Instructions& instrs = Instructions::Handle(code.instructions()); 81 const Instructions& instrs = Instructions::Handle(code.instructions());
82 { 82 {
83 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); 83 WritableInstructionsScope writable(instrs.PayloadStart(), instrs.size());
84 switch (breakpoint_kind_) { 84 switch (breakpoint_kind_) {
85 case RawPcDescriptors::kIcCall: 85 case RawPcDescriptors::kIcCall:
86 case RawPcDescriptors::kUnoptStaticCall: 86 case RawPcDescriptors::kUnoptStaticCall:
87 case RawPcDescriptors::kRuntimeCall: { 87 case RawPcDescriptors::kRuntimeCall: {
88 *CallInstructionFromReturnAddress(pc_) = saved_value_; 88 *CallInstructionFromReturnAddress(pc_) = saved_value_;
89 break; 89 break;
90 } 90 }
91 default: 91 default:
92 UNREACHABLE(); 92 UNREACHABLE();
93 } 93 }
94 94
95 if (saved_value_fastsmi_ != Bytecode::kTrap) { 95 if (saved_value_fastsmi_ != Bytecode::kTrap) {
96 Instr current_instr = *FastSmiInstructionFromReturnAddress(pc_); 96 Instr current_instr = *FastSmiInstructionFromReturnAddress(pc_);
97 ASSERT(Bytecode::DecodeOpcode(current_instr) == Bytecode::kNop); 97 ASSERT(Bytecode::DecodeOpcode(current_instr) == Bytecode::kNop);
98 *FastSmiInstructionFromReturnAddress(pc_) = saved_value_fastsmi_; 98 *FastSmiInstructionFromReturnAddress(pc_) = saved_value_fastsmi_;
99 } 99 }
100 } 100 }
101 is_enabled_ = false; 101 is_enabled_ = false;
102 } 102 }
103 103
104 #endif // !PRODUCT 104 #endif // !PRODUCT
105 105
106 } // namespace dart 106 } // namespace dart
107 107
108 #endif // defined TARGET_ARCH_DBC 108 #endif // defined TARGET_ARCH_DBC
OLDNEW
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/debugger_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698