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

Side by Side Diff: runtime/vm/code_patcher_arm.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.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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 CallPattern static_call(return_address, code); 71 CallPattern static_call(return_address, code);
72 ICData& ic_data = ICData::Handle(); 72 ICData& ic_data = ICData::Handle();
73 ic_data ^= static_call.IcData(); 73 ic_data ^= static_call.IcData();
74 if (ic_data_result != NULL) { 74 if (ic_data_result != NULL) {
75 *ic_data_result = ic_data.raw(); 75 *ic_data_result = ic_data.raw();
76 } 76 }
77 return ic_data.GetTargetAt(0); 77 return ic_data.GetTargetAt(0);
78 } 78 }
79 79
80 80
81 void CodePatcher::PatchNativeCallAt(uword return_address,
82 const Code& code,
83 NativeFunction target,
84 const Code& trampoline) {
85 ASSERT(code.ContainsInstructionAt(return_address));
86 NativeCallPattern call(return_address, code);
87 call.set_target(trampoline.EntryPoint());
88 call.set_native_function(target);
89 }
90
91
92 uword CodePatcher::GetNativeCallAt(uword return_address,
93 const Code& code,
94 NativeFunction* target) {
95 ASSERT(code.ContainsInstructionAt(return_address));
96 NativeCallPattern call(return_address, code);
97 *target = call.native_function();
98 return call.target();
99 }
100
101
81 // This class pattern matches on a load from the object pool. Loading on 102 // This class pattern matches on a load from the object pool. Loading on
82 // ARM is complicated because it can take four possible different forms. We 103 // ARM is complicated because it can take four possible different forms. We
83 // match backwards from the end of the sequence so we can reuse the code for 104 // match backwards from the end of the sequence so we can reuse the code for
84 // matching object pool loads at calls. 105 // matching object pool loads at calls.
85 class EdgeCounter : public ValueObject { 106 class EdgeCounter : public ValueObject {
86 public: 107 public:
87 EdgeCounter(uword pc, const Code& code) 108 EdgeCounter(uword pc, const Code& code)
88 : end_(pc - FlowGraphCompiler::EdgeCounterIncrementSizeInBytes()), 109 : end_(pc - FlowGraphCompiler::EdgeCounterIncrementSizeInBytes()),
89 object_pool_(ObjectPool::Handle(code.GetObjectPool())) { 110 object_pool_(ObjectPool::Handle(code.GetObjectPool())) {
90 // An IsValid predicate is complicated and duplicates the code in the 111 // An IsValid predicate is complicated and duplicates the code in the
(...skipping 24 matching lines...) Expand all
115 136
116 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { 137 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) {
117 ASSERT(code.ContainsInstructionAt(pc)); 138 ASSERT(code.ContainsInstructionAt(pc));
118 EdgeCounter counter(pc, code); 139 EdgeCounter counter(pc, code);
119 return counter.edge_counter(); 140 return counter.edge_counter();
120 } 141 }
121 142
122 } // namespace dart 143 } // namespace dart
123 144
124 #endif // defined TARGET_ARCH_ARM 145 #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