OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CCTEST_COMPILER_CALL_TESTER_H_ | 5 #ifndef V8_CCTEST_COMPILER_CALL_TESTER_H_ |
6 #define V8_CCTEST_COMPILER_CALL_TESTER_H_ | 6 #define V8_CCTEST_COMPILER_CALL_TESTER_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/simulator.h" | 10 #include "src/simulator.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 200 } |
201 template <typename R, typename F, typename P1, typename P2, typename P3, | 201 template <typename R, typename F, typename P1, typename P2, typename P3, |
202 typename P4> | 202 typename P4> |
203 R DoCall(F* f, P1 p1, P2 p2, P3 p3, P4 p4) { | 203 R DoCall(F* f, P1 p1, P2 p2, P3 p3, P4 p4) { |
204 Simulator::CallArgument args[] = { | 204 Simulator::CallArgument args[] = { |
205 Simulator::CallArgument(p1), Simulator::CallArgument(p2), | 205 Simulator::CallArgument(p1), Simulator::CallArgument(p2), |
206 Simulator::CallArgument(p3), Simulator::CallArgument(p4), | 206 Simulator::CallArgument(p3), Simulator::CallArgument(p4), |
207 Simulator::CallArgument::End()}; | 207 Simulator::CallArgument::End()}; |
208 return ReturnValueTraits<R>::Cast(CallSimulator(FUNCTION_ADDR(f), args)); | 208 return ReturnValueTraits<R>::Cast(CallSimulator(FUNCTION_ADDR(f), args)); |
209 } | 209 } |
210 #elif USE_SIMULATOR && V8_TARGET_ARCH_MIPS64 | 210 #elif USE_SIMULATOR && (V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_PPC64) |
211 uintptr_t CallSimulator(byte* f, int64_t p1 = 0, int64_t p2 = 0, | 211 uintptr_t CallSimulator(byte* f, int64_t p1 = 0, int64_t p2 = 0, |
212 int64_t p3 = 0, int64_t p4 = 0) { | 212 int64_t p3 = 0, int64_t p4 = 0) { |
213 Simulator* simulator = Simulator::current(isolate_); | 213 Simulator* simulator = Simulator::current(isolate_); |
214 return static_cast<uintptr_t>(simulator->Call(f, 4, p1, p2, p3, p4)); | 214 return static_cast<uintptr_t>(simulator->Call(f, 4, p1, p2, p3, p4)); |
215 } | 215 } |
216 | 216 |
217 template <typename R, typename F> | 217 template <typename R, typename F> |
218 R DoCall(F* f) { | 218 R DoCall(F* f) { |
219 return ReturnValueTraits<R>::Cast(CallSimulator(FUNCTION_ADDR(f))); | 219 return ReturnValueTraits<R>::Cast(CallSimulator(FUNCTION_ADDR(f))); |
220 } | 220 } |
(...skipping 15 matching lines...) Expand all Loading... |
236 ParameterTraits<P2>::Cast(p2), ParameterTraits<P3>::Cast(p3))); | 236 ParameterTraits<P2>::Cast(p2), ParameterTraits<P3>::Cast(p3))); |
237 } | 237 } |
238 template <typename R, typename F, typename P1, typename P2, typename P3, | 238 template <typename R, typename F, typename P1, typename P2, typename P3, |
239 typename P4> | 239 typename P4> |
240 R DoCall(F* f, P1 p1, P2 p2, P3 p3, P4 p4) { | 240 R DoCall(F* f, P1 p1, P2 p2, P3 p3, P4 p4) { |
241 return ReturnValueTraits<R>::Cast(CallSimulator( | 241 return ReturnValueTraits<R>::Cast(CallSimulator( |
242 FUNCTION_ADDR(f), ParameterTraits<P1>::Cast(p1), | 242 FUNCTION_ADDR(f), ParameterTraits<P1>::Cast(p1), |
243 ParameterTraits<P2>::Cast(p2), ParameterTraits<P3>::Cast(p3), | 243 ParameterTraits<P2>::Cast(p2), ParameterTraits<P3>::Cast(p3), |
244 ParameterTraits<P4>::Cast(p4))); | 244 ParameterTraits<P4>::Cast(p4))); |
245 } | 245 } |
246 #elif USE_SIMULATOR && (V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS) | 246 #elif USE_SIMULATOR && \ |
| 247 (V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_PPC) |
247 uintptr_t CallSimulator(byte* f, int32_t p1 = 0, int32_t p2 = 0, | 248 uintptr_t CallSimulator(byte* f, int32_t p1 = 0, int32_t p2 = 0, |
248 int32_t p3 = 0, int32_t p4 = 0) { | 249 int32_t p3 = 0, int32_t p4 = 0) { |
249 Simulator* simulator = Simulator::current(isolate_); | 250 Simulator* simulator = Simulator::current(isolate_); |
250 return static_cast<uintptr_t>(simulator->Call(f, 4, p1, p2, p3, p4)); | 251 return static_cast<uintptr_t>(simulator->Call(f, 4, p1, p2, p3, p4)); |
251 } | 252 } |
252 template <typename R, typename F> | 253 template <typename R, typename F> |
253 R DoCall(F* f) { | 254 R DoCall(F* f) { |
254 return ReturnValueTraits<R>::Cast(CallSimulator(FUNCTION_ADDR(f))); | 255 return ReturnValueTraits<R>::Cast(CallSimulator(FUNCTION_ADDR(f))); |
255 } | 256 } |
256 template <typename R, typename F, typename P1> | 257 template <typename R, typename F, typename P1> |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 | 421 |
421 private: | 422 private: |
422 CallHelper* helper() { return static_cast<C*>(this); } | 423 CallHelper* helper() { return static_cast<C*>(this); } |
423 }; | 424 }; |
424 | 425 |
425 } // namespace compiler | 426 } // namespace compiler |
426 } // namespace internal | 427 } // namespace internal |
427 } // namespace v8 | 428 } // namespace v8 |
428 | 429 |
429 #endif // V8_CCTEST_COMPILER_CALL_TESTER_H_ | 430 #endif // V8_CCTEST_COMPILER_CALL_TESTER_H_ |
OLD | NEW |