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

Side by Side Diff: runtime/vm/debugger_ia32.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_dbc.cc ('k') | runtime/vm/disassembler.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"
(...skipping 12 matching lines...) Expand all
23 return saved_value_; 23 return saved_value_;
24 } 24 }
25 25
26 26
27 void CodeBreakpoint::PatchCode() { 27 void CodeBreakpoint::PatchCode() {
28 ASSERT(!is_enabled_); 28 ASSERT(!is_enabled_);
29 const Code& code = Code::Handle(code_); 29 const Code& code = Code::Handle(code_);
30 const Instructions& instrs = Instructions::Handle(code.instructions()); 30 const Instructions& instrs = Instructions::Handle(code.instructions());
31 Code& stub_target = Code::Handle(); 31 Code& stub_target = Code::Handle();
32 { 32 {
33 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); 33 WritableInstructionsScope writable(instrs.PayloadStart(), instrs.size());
34 switch (breakpoint_kind_) { 34 switch (breakpoint_kind_) {
35 case RawPcDescriptors::kIcCall: 35 case RawPcDescriptors::kIcCall:
36 case RawPcDescriptors::kUnoptStaticCall: { 36 case RawPcDescriptors::kUnoptStaticCall: {
37 stub_target = StubCode::ICCallBreakpoint_entry()->code(); 37 stub_target = StubCode::ICCallBreakpoint_entry()->code();
38 break; 38 break;
39 } 39 }
40 case RawPcDescriptors::kRuntimeCall: { 40 case RawPcDescriptors::kRuntimeCall: {
41 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); 41 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code);
42 stub_target = StubCode::RuntimeCallBreakpoint_entry()->code(); 42 stub_target = StubCode::RuntimeCallBreakpoint_entry()->code();
43 break; 43 break;
44 } 44 }
45 default: 45 default:
46 UNREACHABLE(); 46 UNREACHABLE();
47 } 47 }
48 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); 48 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code);
49 CodePatcher::PatchStaticCallAt(pc_, code, stub_target); 49 CodePatcher::PatchStaticCallAt(pc_, code, stub_target);
50 } 50 }
51 is_enabled_ = true; 51 is_enabled_ = true;
52 } 52 }
53 53
54 54
55 void CodeBreakpoint::RestoreCode() { 55 void CodeBreakpoint::RestoreCode() {
56 ASSERT(is_enabled_); 56 ASSERT(is_enabled_);
57 const Code& code = Code::Handle(code_); 57 const Code& code = Code::Handle(code_);
58 const Instructions& instrs = Instructions::Handle(code.instructions()); 58 const Instructions& instrs = Instructions::Handle(code.instructions());
59 { 59 {
60 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); 60 WritableInstructionsScope writable(instrs.PayloadStart(), instrs.size());
61 switch (breakpoint_kind_) { 61 switch (breakpoint_kind_) {
62 case RawPcDescriptors::kIcCall: 62 case RawPcDescriptors::kIcCall:
63 case RawPcDescriptors::kUnoptStaticCall: 63 case RawPcDescriptors::kUnoptStaticCall:
64 case RawPcDescriptors::kRuntimeCall: { 64 case RawPcDescriptors::kRuntimeCall: {
65 CodePatcher::PatchStaticCallAt(pc_, code, Code::Handle(saved_value_)); 65 CodePatcher::PatchStaticCallAt(pc_, code, Code::Handle(saved_value_));
66 break; 66 break;
67 } 67 }
68 default: 68 default:
69 UNREACHABLE(); 69 UNREACHABLE();
70 } 70 }
71 } 71 }
72 is_enabled_ = false; 72 is_enabled_ = false;
73 } 73 }
74 74
75 #endif // !PRODUCT 75 #endif // !PRODUCT
76 76
77 } // namespace dart 77 } // namespace dart
78 78
79 #endif // defined TARGET_ARCH_IA32 79 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/debugger_dbc.cc ('k') | runtime/vm/disassembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698