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 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2081 int64_t iresult = 0; // integer return value | 2081 int64_t iresult = 0; // integer return value |
2082 double dresult = 0; // double return value | 2082 double dresult = 0; // double return value |
2083 GetFpArgs(&dval0, &dval1, &ival); | 2083 GetFpArgs(&dval0, &dval1, &ival); |
2084 SimulatorRuntimeCall generic_target = | 2084 SimulatorRuntimeCall generic_target = |
2085 reinterpret_cast<SimulatorRuntimeCall>(external); | 2085 reinterpret_cast<SimulatorRuntimeCall>(external); |
2086 if (::v8::internal::FLAG_trace_sim) { | 2086 if (::v8::internal::FLAG_trace_sim) { |
2087 switch (redirection->type()) { | 2087 switch (redirection->type()) { |
2088 case ExternalReference::BUILTIN_FP_FP_CALL: | 2088 case ExternalReference::BUILTIN_FP_FP_CALL: |
2089 case ExternalReference::BUILTIN_COMPARE_CALL: | 2089 case ExternalReference::BUILTIN_COMPARE_CALL: |
2090 PrintF("Call to host function at %p with args %f, %f", | 2090 PrintF("Call to host function at %p with args %f, %f", |
2091 FUNCTION_ADDR(generic_target), dval0, dval1); | 2091 static_cast<void*>(FUNCTION_ADDR(generic_target)), dval0, |
| 2092 dval1); |
2092 break; | 2093 break; |
2093 case ExternalReference::BUILTIN_FP_CALL: | 2094 case ExternalReference::BUILTIN_FP_CALL: |
2094 PrintF("Call to host function at %p with arg %f", | 2095 PrintF("Call to host function at %p with arg %f", |
2095 FUNCTION_ADDR(generic_target), dval0); | 2096 static_cast<void*>(FUNCTION_ADDR(generic_target)), dval0); |
2096 break; | 2097 break; |
2097 case ExternalReference::BUILTIN_FP_INT_CALL: | 2098 case ExternalReference::BUILTIN_FP_INT_CALL: |
2098 PrintF("Call to host function at %p with args %f, %d", | 2099 PrintF("Call to host function at %p with args %f, %d", |
2099 FUNCTION_ADDR(generic_target), dval0, ival); | 2100 static_cast<void*>(FUNCTION_ADDR(generic_target)), dval0, |
| 2101 ival); |
2100 break; | 2102 break; |
2101 default: | 2103 default: |
2102 UNREACHABLE(); | 2104 UNREACHABLE(); |
2103 break; | 2105 break; |
2104 } | 2106 } |
2105 } | 2107 } |
2106 switch (redirection->type()) { | 2108 switch (redirection->type()) { |
2107 case ExternalReference::BUILTIN_COMPARE_CALL: { | 2109 case ExternalReference::BUILTIN_COMPARE_CALL: { |
2108 SimulatorRuntimeCompareCall target = | 2110 SimulatorRuntimeCompareCall target = |
2109 reinterpret_cast<SimulatorRuntimeCompareCall>(external); | 2111 reinterpret_cast<SimulatorRuntimeCompareCall>(external); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2188 reinterpret_cast<SimulatorRuntimeProfilingGetterCall>(external); | 2190 reinterpret_cast<SimulatorRuntimeProfilingGetterCall>(external); |
2189 target(arg0, arg1, Redirection::ReverseRedirection(arg2)); | 2191 target(arg0, arg1, Redirection::ReverseRedirection(arg2)); |
2190 } else if (redirection->type() == ExternalReference::BUILTIN_CALL_TRIPLE) { | 2192 } else if (redirection->type() == ExternalReference::BUILTIN_CALL_TRIPLE) { |
2191 // builtin call returning ObjectTriple. | 2193 // builtin call returning ObjectTriple. |
2192 SimulatorRuntimeTripleCall target = | 2194 SimulatorRuntimeTripleCall target = |
2193 reinterpret_cast<SimulatorRuntimeTripleCall>(external); | 2195 reinterpret_cast<SimulatorRuntimeTripleCall>(external); |
2194 if (::v8::internal::FLAG_trace_sim) { | 2196 if (::v8::internal::FLAG_trace_sim) { |
2195 PrintF( | 2197 PrintF( |
2196 "Call to host triple returning runtime function %p " | 2198 "Call to host triple returning runtime function %p " |
2197 "args %08x, %08x, %08x, %08x, %08x\n", | 2199 "args %08x, %08x, %08x, %08x, %08x\n", |
2198 FUNCTION_ADDR(target), arg1, arg2, arg3, arg4, arg5); | 2200 static_cast<void*>(FUNCTION_ADDR(target)), arg1, arg2, arg3, arg4, |
| 2201 arg5); |
2199 } | 2202 } |
2200 // arg0 is a hidden argument pointing to the return location, so don't | 2203 // arg0 is a hidden argument pointing to the return location, so don't |
2201 // pass it to the target function. | 2204 // pass it to the target function. |
2202 ObjectTriple result = target(arg1, arg2, arg3, arg4, arg5); | 2205 ObjectTriple result = target(arg1, arg2, arg3, arg4, arg5); |
2203 if (::v8::internal::FLAG_trace_sim) { | 2206 if (::v8::internal::FLAG_trace_sim) { |
2204 PrintF("Returned { %p, %p, %p }\n", result.x, result.y, result.z); | 2207 PrintF("Returned { %p, %p, %p }\n", static_cast<void*>(result.x), |
| 2208 static_cast<void*>(result.y), static_cast<void*>(result.z)); |
2205 } | 2209 } |
2206 // Return is passed back in address pointed to by hidden first argument. | 2210 // Return is passed back in address pointed to by hidden first argument. |
2207 ObjectTriple* sim_result = reinterpret_cast<ObjectTriple*>(arg0); | 2211 ObjectTriple* sim_result = reinterpret_cast<ObjectTriple*>(arg0); |
2208 *sim_result = result; | 2212 *sim_result = result; |
2209 set_register(v0, arg0); | 2213 set_register(v0, arg0); |
2210 } else { | 2214 } else { |
2211 DCHECK(redirection->type() == ExternalReference::BUILTIN_CALL || | 2215 DCHECK(redirection->type() == ExternalReference::BUILTIN_CALL || |
2212 redirection->type() == ExternalReference::BUILTIN_CALL_PAIR); | 2216 redirection->type() == ExternalReference::BUILTIN_CALL_PAIR); |
2213 SimulatorRuntimeCall target = | 2217 SimulatorRuntimeCall target = |
2214 reinterpret_cast<SimulatorRuntimeCall>(external); | 2218 reinterpret_cast<SimulatorRuntimeCall>(external); |
2215 if (::v8::internal::FLAG_trace_sim) { | 2219 if (::v8::internal::FLAG_trace_sim) { |
2216 PrintF( | 2220 PrintF( |
2217 "Call to host function at %p " | 2221 "Call to host function at %p " |
2218 "args %08x, %08x, %08x, %08x, %08x, %08x\n", | 2222 "args %08x, %08x, %08x, %08x, %08x, %08x\n", |
2219 FUNCTION_ADDR(target), | 2223 static_cast<void*>(FUNCTION_ADDR(target)), arg0, arg1, arg2, arg3, |
2220 arg0, | 2224 arg4, arg5); |
2221 arg1, | |
2222 arg2, | |
2223 arg3, | |
2224 arg4, | |
2225 arg5); | |
2226 } | 2225 } |
2227 int64_t result = target(arg0, arg1, arg2, arg3, arg4, arg5); | 2226 int64_t result = target(arg0, arg1, arg2, arg3, arg4, arg5); |
2228 set_register(v0, static_cast<int32_t>(result)); | 2227 set_register(v0, static_cast<int32_t>(result)); |
2229 set_register(v1, static_cast<int32_t>(result >> 32)); | 2228 set_register(v1, static_cast<int32_t>(result >> 32)); |
2230 } | 2229 } |
2231 if (::v8::internal::FLAG_trace_sim) { | 2230 if (::v8::internal::FLAG_trace_sim) { |
2232 PrintF("Returned %08x : %08x\n", get_register(v1), get_register(v0)); | 2231 PrintF("Returned %08x : %08x\n", get_register(v1), get_register(v0)); |
2233 } | 2232 } |
2234 set_register(ra, saved_ra); | 2233 set_register(ra, saved_ra); |
2235 set_pc(get_register(ra)); | 2234 set_pc(get_register(ra)); |
(...skipping 2372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4608 | 4607 |
4609 | 4608 |
4610 #undef UNSUPPORTED | 4609 #undef UNSUPPORTED |
4611 | 4610 |
4612 } // namespace internal | 4611 } // namespace internal |
4613 } // namespace v8 | 4612 } // namespace v8 |
4614 | 4613 |
4615 #endif // USE_SIMULATOR | 4614 #endif // USE_SIMULATOR |
4616 | 4615 |
4617 #endif // V8_TARGET_ARCH_MIPS | 4616 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |