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

Side by Side Diff: runtime/vm/code_patcher_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/code_patcher_arm_test.cc ('k') | runtime/vm/code_patcher_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" // Needed here to get TARGET_ARCH_DBC. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_DBC.
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 9
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 ICData& ic_data = ICData::Handle(); 61 ICData& ic_data = ICData::Handle();
62 ic_data ^= static_call.IcData(); 62 ic_data ^= static_call.IcData();
63 if (ic_data_result != NULL) { 63 if (ic_data_result != NULL) {
64 *ic_data_result = ic_data.raw(); 64 *ic_data_result = ic_data.raw();
65 } 65 }
66 return ic_data.GetTargetAt(0); 66 return ic_data.GetTargetAt(0);
67 } 67 }
68 68
69 69
70 void CodePatcher::PatchSwitchableCallAt(uword return_address, 70 void CodePatcher::PatchSwitchableCallAt(uword return_address,
71 const Code& code, 71 const Code& caller_code,
72 const ICData& ic_data, 72 const Object& data,
73 const MegamorphicCache& cache, 73 const Code& target) {
74 const Code& lookup_stub) { 74 ASSERT(caller_code.ContainsInstructionAt(return_address));
75 ASSERT(code.ContainsInstructionAt(return_address)); 75 SwitchableCallPattern call(return_address, caller_code);
76 SwitchableCallPattern call(return_address, code); 76 call.SetData(data);
77 ASSERT(call.cache() == ic_data.raw()); 77 call.SetTarget(target);
78 call.SetLookupStub(lookup_stub);
79 call.SetCache(cache);
80 } 78 }
81 79
82 80
81 RawCode* CodePatcher::GetSwitchableCallTargetAt(uword return_address,
82 const Code& caller_code) {
83 ASSERT(caller_code.ContainsInstructionAt(return_address));
84 SwitchableCallPattern call(return_address, caller_code);
85 return call.target();
86 }
87
88
89 RawObject* CodePatcher::GetSwitchableCallDataAt(uword return_address,
90 const Code& caller_code) {
91 ASSERT(caller_code.ContainsInstructionAt(return_address));
92 SwitchableCallPattern call(return_address, caller_code);
93 return call.data();
94 }
95
96
83 void CodePatcher::PatchNativeCallAt(uword return_address, 97 void CodePatcher::PatchNativeCallAt(uword return_address,
84 const Code& code, 98 const Code& code,
85 NativeFunction target, 99 NativeFunction target,
86 const Code& trampoline) { 100 const Code& trampoline) {
87 ASSERT(code.ContainsInstructionAt(return_address)); 101 ASSERT(code.ContainsInstructionAt(return_address));
88 NativeCallPattern call(return_address, code); 102 NativeCallPattern call(return_address, code);
89 call.set_target(trampoline); 103 call.set_target(trampoline);
90 call.set_native_function(target); 104 call.set_native_function(target);
91 } 105 }
92 106
93 107
94 RawCode* CodePatcher::GetNativeCallAt(uword return_address, 108 RawCode* CodePatcher::GetNativeCallAt(uword return_address,
95 const Code& code, 109 const Code& code,
96 NativeFunction* target) { 110 NativeFunction* target) {
97 ASSERT(code.ContainsInstructionAt(return_address)); 111 ASSERT(code.ContainsInstructionAt(return_address));
98 NativeCallPattern call(return_address, code); 112 NativeCallPattern call(return_address, code);
99 *target = call.native_function(); 113 *target = call.native_function();
100 return call.target(); 114 return call.target();
101 } 115 }
102 116
103 } // namespace dart 117 } // namespace dart
104 118
105 #endif // defined TARGET_ARCH_DBC 119 #endif // defined TARGET_ARCH_DBC
OLDNEW
« no previous file with comments | « runtime/vm/code_patcher_arm_test.cc ('k') | runtime/vm/code_patcher_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698