OLD | NEW |
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 CallPattern static_call(return_address, code); | 62 CallPattern static_call(return_address, code); |
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, |
| 73 const Code& code, |
| 74 const ICData& ic_data, |
| 75 const MegamorphicCache& cache, |
| 76 const Code& lookup_stub) { |
| 77 ASSERT(code.ContainsInstructionAt(return_address)); |
| 78 SwitchableCallPattern call(return_address, code); |
| 79 ASSERT(call.cache() == ic_data.raw()); |
| 80 call.SetLookupStub(lookup_stub); |
| 81 call.SetCache(cache); |
| 82 } |
| 83 |
| 84 |
72 void CodePatcher::PatchNativeCallAt(uword return_address, | 85 void CodePatcher::PatchNativeCallAt(uword return_address, |
73 const Code& code, | 86 const Code& code, |
74 NativeFunction target, | 87 NativeFunction target, |
75 const Code& trampoline) { | 88 const Code& trampoline) { |
76 ASSERT(code.ContainsInstructionAt(return_address)); | 89 ASSERT(code.ContainsInstructionAt(return_address)); |
77 NativeCallPattern call(return_address, code); | 90 NativeCallPattern call(return_address, code); |
78 call.set_target(trampoline); | 91 call.set_target(trampoline); |
79 call.set_native_function(target); | 92 call.set_native_function(target); |
80 } | 93 } |
81 | 94 |
82 | 95 |
83 RawCode* CodePatcher::GetNativeCallAt(uword return_address, | 96 RawCode* CodePatcher::GetNativeCallAt(uword return_address, |
84 const Code& code, | 97 const Code& code, |
85 NativeFunction* target) { | 98 NativeFunction* target) { |
86 ASSERT(code.ContainsInstructionAt(return_address)); | 99 ASSERT(code.ContainsInstructionAt(return_address)); |
87 NativeCallPattern call(return_address, code); | 100 NativeCallPattern call(return_address, code); |
88 *target = call.native_function(); | 101 *target = call.native_function(); |
89 return call.target(); | 102 return call.target(); |
90 } | 103 } |
91 | 104 |
92 } // namespace dart | 105 } // namespace dart |
93 | 106 |
94 #endif // defined TARGET_ARCH_ARM | 107 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |