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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
7 | 7 |
8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
9 | 9 |
10 #include "vm/instructions.h" | 10 #include "vm/instructions.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 CallPattern static_call(return_address, code); | 61 CallPattern static_call(return_address, code); |
62 ICData& ic_data = ICData::Handle(); | 62 ICData& ic_data = ICData::Handle(); |
63 ic_data ^= static_call.IcData(); | 63 ic_data ^= static_call.IcData(); |
64 if (ic_data_result != NULL) { | 64 if (ic_data_result != NULL) { |
65 *ic_data_result = ic_data.raw(); | 65 *ic_data_result = ic_data.raw(); |
66 } | 66 } |
67 return ic_data.GetTargetAt(0); | 67 return ic_data.GetTargetAt(0); |
68 } | 68 } |
69 | 69 |
70 | 70 |
| 71 void CodePatcher::PatchSwitchableCallAt(uword return_address, |
| 72 const Code& code, |
| 73 const ICData& ic_data, |
| 74 const MegamorphicCache& cache, |
| 75 const Code& lookup_stub) { |
| 76 ASSERT(code.ContainsInstructionAt(return_address)); |
| 77 SwitchableCallPattern call(return_address, code); |
| 78 ASSERT(call.cache() == ic_data.raw()); |
| 79 call.SetLookupStub(lookup_stub); |
| 80 call.SetCache(cache); |
| 81 } |
| 82 |
| 83 |
71 void CodePatcher::PatchNativeCallAt(uword return_address, | 84 void CodePatcher::PatchNativeCallAt(uword return_address, |
72 const Code& code, | 85 const Code& code, |
73 NativeFunction target, | 86 NativeFunction target, |
74 const Code& trampoline) { | 87 const Code& trampoline) { |
75 ASSERT(code.ContainsInstructionAt(return_address)); | 88 ASSERT(code.ContainsInstructionAt(return_address)); |
76 NativeCallPattern call(return_address, code); | 89 NativeCallPattern call(return_address, code); |
77 call.set_target(trampoline); | 90 call.set_target(trampoline); |
78 call.set_native_function(target); | 91 call.set_native_function(target); |
79 } | 92 } |
80 | 93 |
81 | 94 |
82 RawCode* CodePatcher::GetNativeCallAt(uword return_address, | 95 RawCode* CodePatcher::GetNativeCallAt(uword return_address, |
83 const Code& code, | 96 const Code& code, |
84 NativeFunction* target) { | 97 NativeFunction* target) { |
85 ASSERT(code.ContainsInstructionAt(return_address)); | 98 ASSERT(code.ContainsInstructionAt(return_address)); |
86 NativeCallPattern call(return_address, code); | 99 NativeCallPattern call(return_address, code); |
87 *target = call.native_function(); | 100 *target = call.native_function(); |
88 return call.target(); | 101 return call.target(); |
89 } | 102 } |
90 | 103 |
91 } // namespace dart | 104 } // namespace dart |
92 | 105 |
93 #endif // defined TARGET_ARCH_MIPS | 106 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |