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/simulator.h" | 8 #include "src/simulator.h" |
9 #include "test/cctest/compiler/c-signature.h" | 9 #include "test/cctest/compiler/c-signature.h" |
10 | 10 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 } | 213 } |
214 template <typename F, typename P1, typename P2, typename P3, typename P4, | 214 template <typename F, typename P1, typename P2, typename P3, typename P4, |
215 typename P5> | 215 typename P5> |
216 R DoCall(F* f, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { | 216 R DoCall(F* f, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { |
217 Simulator::CallArgument args[] = { | 217 Simulator::CallArgument args[] = { |
218 Simulator::CallArgument(p1), Simulator::CallArgument(p2), | 218 Simulator::CallArgument(p1), Simulator::CallArgument(p2), |
219 Simulator::CallArgument(p3), Simulator::CallArgument(p4), | 219 Simulator::CallArgument(p3), Simulator::CallArgument(p4), |
220 Simulator::CallArgument(p5), Simulator::CallArgument::End()}; | 220 Simulator::CallArgument(p5), Simulator::CallArgument::End()}; |
221 return CastReturnValue<R>(CallSimulator(FUNCTION_ADDR(f), args)); | 221 return CastReturnValue<R>(CallSimulator(FUNCTION_ADDR(f), args)); |
222 } | 222 } |
223 #elif USE_SIMULATOR && (V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_PPC64) | 223 #elif USE_SIMULATOR && \ |
| 224 (V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_PPC64 || V8_TARGET_ARCH_S390X) |
224 uintptr_t CallSimulator(byte* f, int64_t p1 = 0, int64_t p2 = 0, | 225 uintptr_t CallSimulator(byte* f, int64_t p1 = 0, int64_t p2 = 0, |
225 int64_t p3 = 0, int64_t p4 = 0, int64_t p5 = 0) { | 226 int64_t p3 = 0, int64_t p4 = 0, int64_t p5 = 0) { |
226 Simulator* simulator = Simulator::current(isolate_); | 227 Simulator* simulator = Simulator::current(isolate_); |
227 return static_cast<uintptr_t>(simulator->Call(f, 5, p1, p2, p3, p4, p5)); | 228 return static_cast<uintptr_t>(simulator->Call(f, 5, p1, p2, p3, p4, p5)); |
228 } | 229 } |
229 | 230 |
230 | 231 |
231 template <typename F> | 232 template <typename F> |
232 R DoCall(F* f) { | 233 R DoCall(F* f) { |
233 return CastReturnValue<R>(CallSimulator(FUNCTION_ADDR(f))); | 234 return CastReturnValue<R>(CallSimulator(FUNCTION_ADDR(f))); |
(...skipping 23 matching lines...) Expand all Loading... |
257 ParameterTraits<P4>::Cast(p4))); | 258 ParameterTraits<P4>::Cast(p4))); |
258 } | 259 } |
259 template <typename F, typename P1, typename P2, typename P3, typename P4, | 260 template <typename F, typename P1, typename P2, typename P3, typename P4, |
260 typename P5> | 261 typename P5> |
261 R DoCall(F* f, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { | 262 R DoCall(F* f, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) { |
262 return CastReturnValue<R>(CallSimulator( | 263 return CastReturnValue<R>(CallSimulator( |
263 FUNCTION_ADDR(f), ParameterTraits<P1>::Cast(p1), | 264 FUNCTION_ADDR(f), ParameterTraits<P1>::Cast(p1), |
264 ParameterTraits<P2>::Cast(p2), ParameterTraits<P3>::Cast(p3), | 265 ParameterTraits<P2>::Cast(p2), ParameterTraits<P3>::Cast(p3), |
265 ParameterTraits<P4>::Cast(p4), ParameterTraits<P5>::Cast(p5))); | 266 ParameterTraits<P4>::Cast(p4), ParameterTraits<P5>::Cast(p5))); |
266 } | 267 } |
267 #elif USE_SIMULATOR && \ | 268 #elif USE_SIMULATOR && (V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || \ |
268 (V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_PPC) | 269 V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_S390) |
269 uintptr_t CallSimulator(byte* f, int32_t p1 = 0, int32_t p2 = 0, | 270 uintptr_t CallSimulator(byte* f, int32_t p1 = 0, int32_t p2 = 0, |
270 int32_t p3 = 0, int32_t p4 = 0, int32_t p5 = 0) { | 271 int32_t p3 = 0, int32_t p4 = 0, int32_t p5 = 0) { |
271 Simulator* simulator = Simulator::current(isolate_); | 272 Simulator* simulator = Simulator::current(isolate_); |
272 return static_cast<uintptr_t>(simulator->Call(f, 5, p1, p2, p3, p4, p5)); | 273 return static_cast<uintptr_t>(simulator->Call(f, 5, p1, p2, p3, p4, p5)); |
273 } | 274 } |
274 template <typename F> | 275 template <typename F> |
275 R DoCall(F* f) { | 276 R DoCall(F* f) { |
276 return CastReturnValue<R>(CallSimulator(FUNCTION_ADDR(f))); | 277 return CastReturnValue<R>(CallSimulator(FUNCTION_ADDR(f))); |
277 } | 278 } |
278 template <typename F, typename P1> | 279 template <typename F, typename P1> |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 private: | 352 private: |
352 Handle<Code> code_; | 353 Handle<Code> code_; |
353 }; | 354 }; |
354 | 355 |
355 | 356 |
356 } // namespace compiler | 357 } // namespace compiler |
357 } // namespace internal | 358 } // namespace internal |
358 } // namespace v8 | 359 } // namespace v8 |
359 | 360 |
360 #endif // V8_CCTEST_COMPILER_CALL_TESTER_H_ | 361 #endif // V8_CCTEST_COMPILER_CALL_TESTER_H_ |
OLD | NEW |