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_ARM | 210 #elif USE_SIMULATOR && (V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS) |
211 uintptr_t CallSimulator(byte* f, int32_t p1 = 0, int32_t p2 = 0, | 211 uintptr_t CallSimulator(byte* f, int32_t p1 = 0, int32_t p2 = 0, |
212 int32_t p3 = 0, int32_t p4 = 0) { | 212 int32_t p3 = 0, int32_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 template <typename R, typename F> | 216 template <typename R, typename F> |
217 R DoCall(F* f) { | 217 R DoCall(F* f) { |
218 return ReturnValueTraits<R>::Cast(CallSimulator(FUNCTION_ADDR(f))); | 218 return ReturnValueTraits<R>::Cast(CallSimulator(FUNCTION_ADDR(f))); |
219 } | 219 } |
220 template <typename R, typename F, typename P1> | 220 template <typename R, typename F, typename P1> |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 384 |
385 private: | 385 private: |
386 CallHelper* helper() { return static_cast<C*>(this); } | 386 CallHelper* helper() { return static_cast<C*>(this); } |
387 }; | 387 }; |
388 | 388 |
389 } // namespace compiler | 389 } // namespace compiler |
390 } // namespace internal | 390 } // namespace internal |
391 } // namespace v8 | 391 } // namespace v8 |
392 | 392 |
393 #endif // V8_CCTEST_COMPILER_CALL_TESTER_H_ | 393 #endif // V8_CCTEST_COMPILER_CALL_TESTER_H_ |
OLD | NEW |