| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 #include <limits.h> | 5 #include <limits.h> |
| 6 #include <stdarg.h> | 6 #include <stdarg.h> |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #if V8_TARGET_ARCH_MIPS | 10 #if V8_TARGET_ARCH_MIPS |
| (...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2021 UNIMPLEMENTED_MIPS(); | 2021 UNIMPLEMENTED_MIPS(); |
| 2022 } | 2022 } |
| 2023 | 2023 |
| 2024 | 2024 |
| 2025 // Calls into the V8 runtime are based on this very simple interface. | 2025 // Calls into the V8 runtime are based on this very simple interface. |
| 2026 // Note: To be able to return two values from some calls the code in runtime.cc | 2026 // Note: To be able to return two values from some calls the code in runtime.cc |
| 2027 // uses the ObjectPair which is essentially two 32-bit values stuffed into a | 2027 // uses the ObjectPair which is essentially two 32-bit values stuffed into a |
| 2028 // 64-bit value. With the code below we assume that all runtime calls return | 2028 // 64-bit value. With the code below we assume that all runtime calls return |
| 2029 // 64 bits of result. If they don't, the v1 result register contains a bogus | 2029 // 64 bits of result. If they don't, the v1 result register contains a bogus |
| 2030 // value, which is fine because it is caller-saved. | 2030 // value, which is fine because it is caller-saved. |
| 2031 typedef int64_t (*SimulatorRuntimeCall)(int32_t arg0, | 2031 typedef int64_t (*SimulatorRuntimeCall)(int32_t arg0, int32_t arg1, |
| 2032 int32_t arg1, | 2032 int32_t arg2, int32_t arg3, |
| 2033 int32_t arg2, | 2033 int32_t arg4, int32_t arg5, |
| 2034 int32_t arg3, | 2034 int32_t arg6, int32_t arg7, |
| 2035 int32_t arg4, | 2035 int32_t arg8); |
| 2036 int32_t arg5); | |
| 2037 | 2036 |
| 2038 typedef ObjectTriple (*SimulatorRuntimeTripleCall)(int32_t arg0, int32_t arg1, | 2037 typedef ObjectTriple (*SimulatorRuntimeTripleCall)(int32_t arg0, int32_t arg1, |
| 2039 int32_t arg2, int32_t arg3, | 2038 int32_t arg2, int32_t arg3, |
| 2040 int32_t arg4); | 2039 int32_t arg4); |
| 2041 | 2040 |
| 2042 // These prototypes handle the four types of FP calls. | 2041 // These prototypes handle the four types of FP calls. |
| 2043 typedef int64_t (*SimulatorRuntimeCompareCall)(double darg0, double darg1); | 2042 typedef int64_t (*SimulatorRuntimeCompareCall)(double darg0, double darg1); |
| 2044 typedef double (*SimulatorRuntimeFPFPCall)(double darg0, double darg1); | 2043 typedef double (*SimulatorRuntimeFPFPCall)(double darg0, double darg1); |
| 2045 typedef double (*SimulatorRuntimeFPCall)(double darg0); | 2044 typedef double (*SimulatorRuntimeFPCall)(double darg0); |
| 2046 typedef double (*SimulatorRuntimeFPIntCall)(double darg0, int32_t arg0); | 2045 typedef double (*SimulatorRuntimeFPIntCall)(double darg0, int32_t arg0); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2069 Redirection* redirection = Redirection::FromSwiInstruction(instr_.instr()); | 2068 Redirection* redirection = Redirection::FromSwiInstruction(instr_.instr()); |
| 2070 int32_t arg0 = get_register(a0); | 2069 int32_t arg0 = get_register(a0); |
| 2071 int32_t arg1 = get_register(a1); | 2070 int32_t arg1 = get_register(a1); |
| 2072 int32_t arg2 = get_register(a2); | 2071 int32_t arg2 = get_register(a2); |
| 2073 int32_t arg3 = get_register(a3); | 2072 int32_t arg3 = get_register(a3); |
| 2074 | 2073 |
| 2075 int32_t* stack_pointer = reinterpret_cast<int32_t*>(get_register(sp)); | 2074 int32_t* stack_pointer = reinterpret_cast<int32_t*>(get_register(sp)); |
| 2076 // Args 4 and 5 are on the stack after the reserved space for args 0..3. | 2075 // Args 4 and 5 are on the stack after the reserved space for args 0..3. |
| 2077 int32_t arg4 = stack_pointer[4]; | 2076 int32_t arg4 = stack_pointer[4]; |
| 2078 int32_t arg5 = stack_pointer[5]; | 2077 int32_t arg5 = stack_pointer[5]; |
| 2078 int32_t arg6 = stack_pointer[6]; |
| 2079 int32_t arg7 = stack_pointer[7]; |
| 2080 int32_t arg8 = stack_pointer[8]; |
| 2081 STATIC_ASSERT(kMaxCParameters == 9); |
| 2079 | 2082 |
| 2080 bool fp_call = | 2083 bool fp_call = |
| 2081 (redirection->type() == ExternalReference::BUILTIN_FP_FP_CALL) || | 2084 (redirection->type() == ExternalReference::BUILTIN_FP_FP_CALL) || |
| 2082 (redirection->type() == ExternalReference::BUILTIN_COMPARE_CALL) || | 2085 (redirection->type() == ExternalReference::BUILTIN_COMPARE_CALL) || |
| 2083 (redirection->type() == ExternalReference::BUILTIN_FP_CALL) || | 2086 (redirection->type() == ExternalReference::BUILTIN_FP_CALL) || |
| 2084 (redirection->type() == ExternalReference::BUILTIN_FP_INT_CALL); | 2087 (redirection->type() == ExternalReference::BUILTIN_FP_INT_CALL); |
| 2085 | 2088 |
| 2086 if (!IsMipsSoftFloatABI) { | 2089 if (!IsMipsSoftFloatABI) { |
| 2087 // With the hard floating point calling convention, double | 2090 // With the hard floating point calling convention, double |
| 2088 // arguments are passed in FPU registers. Fetch the arguments | 2091 // arguments are passed in FPU registers. Fetch the arguments |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2275 *sim_result = result; | 2278 *sim_result = result; |
| 2276 set_register(v0, arg0); | 2279 set_register(v0, arg0); |
| 2277 } else { | 2280 } else { |
| 2278 DCHECK(redirection->type() == ExternalReference::BUILTIN_CALL || | 2281 DCHECK(redirection->type() == ExternalReference::BUILTIN_CALL || |
| 2279 redirection->type() == ExternalReference::BUILTIN_CALL_PAIR); | 2282 redirection->type() == ExternalReference::BUILTIN_CALL_PAIR); |
| 2280 SimulatorRuntimeCall target = | 2283 SimulatorRuntimeCall target = |
| 2281 reinterpret_cast<SimulatorRuntimeCall>(external); | 2284 reinterpret_cast<SimulatorRuntimeCall>(external); |
| 2282 if (::v8::internal::FLAG_trace_sim) { | 2285 if (::v8::internal::FLAG_trace_sim) { |
| 2283 PrintF( | 2286 PrintF( |
| 2284 "Call to host function at %p " | 2287 "Call to host function at %p " |
| 2285 "args %08x, %08x, %08x, %08x, %08x, %08x\n", | 2288 "args %08x, %08x, %08x, %08x, %08x, %08x, %08x, %08x, %08x\n", |
| 2286 static_cast<void*>(FUNCTION_ADDR(target)), arg0, arg1, arg2, arg3, | 2289 static_cast<void*>(FUNCTION_ADDR(target)), arg0, arg1, arg2, arg3, |
| 2287 arg4, arg5); | 2290 arg4, arg5, arg6, arg7, arg8); |
| 2288 } | 2291 } |
| 2289 int64_t result = target(arg0, arg1, arg2, arg3, arg4, arg5); | 2292 int64_t result = |
| 2293 target(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); |
| 2290 set_register(v0, static_cast<int32_t>(result)); | 2294 set_register(v0, static_cast<int32_t>(result)); |
| 2291 set_register(v1, static_cast<int32_t>(result >> 32)); | 2295 set_register(v1, static_cast<int32_t>(result >> 32)); |
| 2292 } | 2296 } |
| 2293 if (::v8::internal::FLAG_trace_sim) { | 2297 if (::v8::internal::FLAG_trace_sim) { |
| 2294 PrintF("Returned %08x : %08x\n", get_register(v1), get_register(v0)); | 2298 PrintF("Returned %08x : %08x\n", get_register(v1), get_register(v0)); |
| 2295 } | 2299 } |
| 2296 set_register(ra, saved_ra); | 2300 set_register(ra, saved_ra); |
| 2297 set_pc(get_register(ra)); | 2301 set_pc(get_register(ra)); |
| 2298 | 2302 |
| 2299 } else if (func == BREAK && code <= kMaxStopCode) { | 2303 } else if (func == BREAK && code <= kMaxStopCode) { |
| (...skipping 2543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4843 | 4847 |
| 4844 | 4848 |
| 4845 #undef UNSUPPORTED | 4849 #undef UNSUPPORTED |
| 4846 | 4850 |
| 4847 } // namespace internal | 4851 } // namespace internal |
| 4848 } // namespace v8 | 4852 } // namespace v8 |
| 4849 | 4853 |
| 4850 #endif // USE_SIMULATOR | 4854 #endif // USE_SIMULATOR |
| 4851 | 4855 |
| 4852 #endif // V8_TARGET_ARCH_MIPS | 4856 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |