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

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

Issue 1294113004: VM: Link native calls lazily. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: addressed comments Created 5 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.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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/instructions.h" 10 #include "vm/instructions.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 CallPattern static_call(return_address, code); 111 CallPattern static_call(return_address, code);
112 ICData& ic_data = ICData::Handle(); 112 ICData& ic_data = ICData::Handle();
113 ic_data ^= static_call.IcData(); 113 ic_data ^= static_call.IcData();
114 if (ic_data_result != NULL) { 114 if (ic_data_result != NULL) {
115 *ic_data_result = ic_data.raw(); 115 *ic_data_result = ic_data.raw();
116 } 116 }
117 return ic_data.GetTargetAt(0); 117 return ic_data.GetTargetAt(0);
118 } 118 }
119 119
120 120
121 void CodePatcher::PatchNativeCallAt(uword return_address,
122 const Code& code,
123 NativeFunction target,
124 const Code& trampoline) {
125 ASSERT(code.ContainsInstructionAt(return_address));
126 NativeCallPattern call(return_address, code);
127 call.set_target(trampoline.EntryPoint());
128 call.set_native_function(target);
129 }
130
131
132 uword CodePatcher::GetNativeCallAt(uword return_address,
133 const Code& code,
134 NativeFunction* target) {
135 ASSERT(code.ContainsInstructionAt(return_address));
136 NativeCallPattern call(return_address, code);
137 *target = call.native_function();
138 return call.target();
139 }
140
141
121 // This class pattern matches on a load from the object pool. Loading on 142 // This class pattern matches on a load from the object pool. Loading on
122 // ARM64 is complicated because it can take more than one form. We 143 // ARM64 is complicated because it can take more than one form. We
123 // match backwards from the end of the sequence so we can reuse the code for 144 // match backwards from the end of the sequence so we can reuse the code for
124 // matching object pool loads at calls. 145 // matching object pool loads at calls.
125 class EdgeCounter : public ValueObject { 146 class EdgeCounter : public ValueObject {
126 public: 147 public:
127 EdgeCounter(uword pc, const Code& code) 148 EdgeCounter(uword pc, const Code& code)
128 : end_(pc - kAdjust), 149 : end_(pc - kAdjust),
129 object_pool_(ObjectPool::Handle(code.GetObjectPool())) { 150 object_pool_(ObjectPool::Handle(code.GetObjectPool())) {
130 // An IsValid predicate is complicated and duplicates the code in the 151 // An IsValid predicate is complicated and duplicates the code in the
(...skipping 24 matching lines...) Expand all
155 176
156 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { 177 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) {
157 ASSERT(code.ContainsInstructionAt(pc)); 178 ASSERT(code.ContainsInstructionAt(pc));
158 EdgeCounter counter(pc, code); 179 EdgeCounter counter(pc, code);
159 return counter.edge_counter(); 180 return counter.edge_counter();
160 } 181 }
161 182
162 } // namespace dart 183 } // namespace dart
163 184
164 #endif // defined TARGET_ARCH_ARM64 185 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/code_patcher_arm.cc ('k') | runtime/vm/code_patcher_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698