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

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

Powered by Google App Engine
This is Rietveld 408576698