OLD | NEW |
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 ICData& ic_data = ICData::Handle(); | 103 ICData& ic_data = ICData::Handle(); |
104 ic_data ^= static_call.IcData(); | 104 ic_data ^= static_call.IcData(); |
105 if (ic_data_result != NULL) { | 105 if (ic_data_result != NULL) { |
106 *ic_data_result = ic_data.raw(); | 106 *ic_data_result = ic_data.raw(); |
107 } | 107 } |
108 return ic_data.GetTargetAt(0); | 108 return ic_data.GetTargetAt(0); |
109 } | 109 } |
110 | 110 |
111 | 111 |
112 void CodePatcher::PatchSwitchableCallAt(uword return_address, | 112 void CodePatcher::PatchSwitchableCallAt(uword return_address, |
113 const Code& code, | 113 const Code& caller_code, |
114 const ICData& ic_data, | 114 const Object& data, |
115 const MegamorphicCache& cache, | 115 const Code& target) { |
116 const Code& lookup_stub) { | 116 ASSERT(caller_code.ContainsInstructionAt(return_address)); |
117 ASSERT(code.ContainsInstructionAt(return_address)); | 117 SwitchableCallPattern call(return_address, caller_code); |
118 SwitchableCallPattern call(return_address, code); | 118 call.SetData(data); |
119 ASSERT(call.cache() == ic_data.raw()); | 119 call.SetTarget(target); |
120 call.SetLookupStub(lookup_stub); | |
121 call.SetCache(cache); | |
122 } | 120 } |
123 | 121 |
124 | 122 |
| 123 RawCode* CodePatcher::GetSwitchableCallTargetAt(uword return_address, |
| 124 const Code& caller_code) { |
| 125 ASSERT(caller_code.ContainsInstructionAt(return_address)); |
| 126 SwitchableCallPattern call(return_address, caller_code); |
| 127 return call.target(); |
| 128 } |
| 129 |
| 130 |
| 131 RawObject* CodePatcher::GetSwitchableCallDataAt(uword return_address, |
| 132 const Code& caller_code) { |
| 133 ASSERT(caller_code.ContainsInstructionAt(return_address)); |
| 134 SwitchableCallPattern call(return_address, caller_code); |
| 135 return call.data(); |
| 136 } |
| 137 |
| 138 |
125 void CodePatcher::PatchNativeCallAt(uword return_address, | 139 void CodePatcher::PatchNativeCallAt(uword return_address, |
126 const Code& code, | 140 const Code& code, |
127 NativeFunction target, | 141 NativeFunction target, |
128 const Code& trampoline) { | 142 const Code& trampoline) { |
129 ASSERT(code.ContainsInstructionAt(return_address)); | 143 ASSERT(code.ContainsInstructionAt(return_address)); |
130 NativeCallPattern call(return_address, code); | 144 NativeCallPattern call(return_address, code); |
131 call.set_target(trampoline); | 145 call.set_target(trampoline); |
132 call.set_native_function(target); | 146 call.set_native_function(target); |
133 } | 147 } |
134 | 148 |
135 | 149 |
136 RawCode* CodePatcher::GetNativeCallAt(uword return_address, | 150 RawCode* CodePatcher::GetNativeCallAt(uword return_address, |
137 const Code& code, | 151 const Code& code, |
138 NativeFunction* target) { | 152 NativeFunction* target) { |
139 ASSERT(code.ContainsInstructionAt(return_address)); | 153 ASSERT(code.ContainsInstructionAt(return_address)); |
140 NativeCallPattern call(return_address, code); | 154 NativeCallPattern call(return_address, code); |
141 *target = call.native_function(); | 155 *target = call.native_function(); |
142 return call.target(); | 156 return call.target(); |
143 } | 157 } |
144 | 158 |
145 } // namespace dart | 159 } // namespace dart |
146 | 160 |
147 #endif // defined TARGET_ARCH_ARM64 | 161 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |