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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | 71 void CodePatcher::PatchSwitchableCallAt(uword return_address, |
72 const Code& code, | 72 const Code& caller_code, |
73 const ICData& ic_data, | 73 const Object& data, |
74 const MegamorphicCache& cache, | 74 const Code& target) { |
75 const Code& lookup_stub) { | 75 ASSERT(caller_code.ContainsInstructionAt(return_address)); |
76 ASSERT(code.ContainsInstructionAt(return_address)); | 76 SwitchableCallPattern call(return_address, caller_code); |
77 SwitchableCallPattern call(return_address, code); | 77 call.SetData(data); |
78 ASSERT(call.cache() == ic_data.raw()); | 78 call.SetTarget(target); |
79 call.SetLookupStub(lookup_stub); | |
80 call.SetCache(cache); | |
81 } | 79 } |
82 | 80 |
83 | 81 |
| 82 RawCode* CodePatcher::GetSwitchableCallTargetAt(uword return_address, |
| 83 const Code& caller_code) { |
| 84 ASSERT(caller_code.ContainsInstructionAt(return_address)); |
| 85 SwitchableCallPattern call(return_address, caller_code); |
| 86 return call.target(); |
| 87 } |
| 88 |
| 89 |
| 90 RawObject* CodePatcher::GetSwitchableCallDataAt(uword return_address, |
| 91 const Code& caller_code) { |
| 92 ASSERT(caller_code.ContainsInstructionAt(return_address)); |
| 93 SwitchableCallPattern call(return_address, caller_code); |
| 94 return call.data(); |
| 95 } |
| 96 |
| 97 |
84 void CodePatcher::PatchNativeCallAt(uword return_address, | 98 void CodePatcher::PatchNativeCallAt(uword return_address, |
85 const Code& code, | 99 const Code& code, |
86 NativeFunction target, | 100 NativeFunction target, |
87 const Code& trampoline) { | 101 const Code& trampoline) { |
88 ASSERT(code.ContainsInstructionAt(return_address)); | 102 ASSERT(code.ContainsInstructionAt(return_address)); |
89 NativeCallPattern call(return_address, code); | 103 NativeCallPattern call(return_address, code); |
90 call.set_target(trampoline); | 104 call.set_target(trampoline); |
91 call.set_native_function(target); | 105 call.set_native_function(target); |
92 } | 106 } |
93 | 107 |
94 | 108 |
95 RawCode* CodePatcher::GetNativeCallAt(uword return_address, | 109 RawCode* CodePatcher::GetNativeCallAt(uword return_address, |
96 const Code& code, | 110 const Code& code, |
97 NativeFunction* target) { | 111 NativeFunction* target) { |
98 ASSERT(code.ContainsInstructionAt(return_address)); | 112 ASSERT(code.ContainsInstructionAt(return_address)); |
99 NativeCallPattern call(return_address, code); | 113 NativeCallPattern call(return_address, code); |
100 *target = call.native_function(); | 114 *target = call.native_function(); |
101 return call.target(); | 115 return call.target(); |
102 } | 116 } |
103 | 117 |
104 } // namespace dart | 118 } // namespace dart |
105 | 119 |
106 #endif // defined TARGET_ARCH_MIPS | 120 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |