Commit b3f4a377 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[arm64] Fix compile error in Simulator

Some compilers complain that ConvertReturn is private in SimulatorBase,
but used in the arm64 Simulator. This CL fixes this by making
ConvertReturn protected.

R=ulan@chromium.org

Bug: v8:7541
Change-Id: I9326b2c746829e9c37c58c14561811b32929c615
Reviewed-on: https://chromium-review.googlesource.com/955689Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51834}
parent 43d86966
...@@ -45,6 +45,26 @@ class SimulatorBase { ...@@ -45,6 +45,26 @@ class SimulatorBase {
return ConvertReturn<Return>(ret); return ConvertReturn<Return>(ret);
} }
// Convert back integral return types. This is always a narrowing conversion.
template <typename T>
static typename std::enable_if<std::is_integral<T>::value, T>::type
ConvertReturn(intptr_t ret) {
static_assert(sizeof(T) <= sizeof(intptr_t), "type bigger than ptrsize");
return static_cast<T>(ret);
}
// Convert back pointer-typed return types.
template <typename T>
static typename std::enable_if<std::is_pointer<T>::value, T>::type
ConvertReturn(intptr_t ret) {
return reinterpret_cast<T>(ret);
}
// Convert back void return type (i.e. no return).
template <typename T>
static typename std::enable_if<std::is_void<T>::value, T>::type ConvertReturn(
intptr_t ret) {}
private: private:
// Runtime call support. // Runtime call support.
static void* RedirectExternalReference(void* external_function, static void* RedirectExternalReference(void* external_function,
...@@ -82,26 +102,6 @@ class SimulatorBase { ...@@ -82,26 +102,6 @@ class SimulatorBase {
ConvertArg(T arg) { ConvertArg(T arg) {
return reinterpret_cast<intptr_t>(arg); return reinterpret_cast<intptr_t>(arg);
} }
// Convert back integral return types. This is always a narrowing conversion.
template <typename T>
static typename std::enable_if<std::is_integral<T>::value, T>::type
ConvertReturn(intptr_t ret) {
static_assert(sizeof(T) <= sizeof(intptr_t), "type bigger than ptrsize");
return static_cast<T>(ret);
}
// Convert back pointer-typed return types.
template <typename T>
static typename std::enable_if<std::is_pointer<T>::value, T>::type
ConvertReturn(intptr_t ret) {
return reinterpret_cast<T>(ret);
}
// Convert back void return type (i.e. no return).
template <typename T>
static typename std::enable_if<std::is_void<T>::value, T>::type ConvertReturn(
intptr_t ret) {}
}; };
// When the generated code calls an external reference we need to catch that in // When the generated code calls an external reference we need to catch that in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment