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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 CallPattern static_call(return_address, code); | 102 CallPattern static_call(return_address, code); |
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, |
| 113 const Code& code, |
| 114 const ICData& ic_data, |
| 115 const MegamorphicCache& cache, |
| 116 const Code& lookup_stub) { |
| 117 ASSERT(code.ContainsInstructionAt(return_address)); |
| 118 SwitchableCallPattern call(return_address, code); |
| 119 ASSERT(call.cache() == ic_data.raw()); |
| 120 call.SetLookupStub(lookup_stub); |
| 121 call.SetCache(cache); |
| 122 } |
| 123 |
| 124 |
112 void CodePatcher::PatchNativeCallAt(uword return_address, | 125 void CodePatcher::PatchNativeCallAt(uword return_address, |
113 const Code& code, | 126 const Code& code, |
114 NativeFunction target, | 127 NativeFunction target, |
115 const Code& trampoline) { | 128 const Code& trampoline) { |
116 ASSERT(code.ContainsInstructionAt(return_address)); | 129 ASSERT(code.ContainsInstructionAt(return_address)); |
117 NativeCallPattern call(return_address, code); | 130 NativeCallPattern call(return_address, code); |
118 call.set_target(trampoline); | 131 call.set_target(trampoline); |
119 call.set_native_function(target); | 132 call.set_native_function(target); |
120 } | 133 } |
121 | 134 |
122 | 135 |
123 RawCode* CodePatcher::GetNativeCallAt(uword return_address, | 136 RawCode* CodePatcher::GetNativeCallAt(uword return_address, |
124 const Code& code, | 137 const Code& code, |
125 NativeFunction* target) { | 138 NativeFunction* target) { |
126 ASSERT(code.ContainsInstructionAt(return_address)); | 139 ASSERT(code.ContainsInstructionAt(return_address)); |
127 NativeCallPattern call(return_address, code); | 140 NativeCallPattern call(return_address, code); |
128 *target = call.native_function(); | 141 *target = call.native_function(); |
129 return call.target(); | 142 return call.target(); |
130 } | 143 } |
131 | 144 |
132 } // namespace dart | 145 } // namespace dart |
133 | 146 |
134 #endif // defined TARGET_ARCH_ARM64 | 147 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |