Commit e614ca2c authored by Zhao Jiazhong's avatar Zhao Jiazhong Committed by Commit Bot

[mips] Adjust some functions and macro's position.

Macro 'USE_SIMULATOR' should wrap the whole v8::internal namespace.

Change-Id: I2b0102e563b6cb976e5a450363bc770f8d5628e2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1916439
Auto-Submit: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65069}
parent e34c42db
...@@ -15,6 +15,23 @@ ...@@ -15,6 +15,23 @@
// globals.h defines USE_SIMULATOR. // globals.h defines USE_SIMULATOR.
#include "src/common/globals.h" #include "src/common/globals.h"
template <typename T>
int Compare(const T& a, const T& b) {
if (a == b)
return 0;
else if (a < b)
return -1;
else
return 1;
}
// Returns the negative absolute value of its argument.
template <typename T,
typename = typename std::enable_if<std::is_signed<T>::value>::type>
T Nabs(T a) {
return a < 0 ? a : -a;
}
#if defined(USE_SIMULATOR) #if defined(USE_SIMULATOR)
// Running with a simulator. // Running with a simulator.
...@@ -693,26 +710,9 @@ class Simulator : public SimulatorBase { ...@@ -693,26 +710,9 @@ class Simulator : public SimulatorBase {
LocalMonitor local_monitor_; LocalMonitor local_monitor_;
GlobalMonitor::LinkedAddress global_monitor_thread_; GlobalMonitor::LinkedAddress global_monitor_thread_;
}; };
#endif // defined(USE_SIMULATOR)
template <typename T>
int Compare(const T& a, const T& b) {
if (a == b)
return 0;
else if (a < b)
return -1;
else
return 1;
}
// Returns the negative absolute value of its argument.
template <typename T,
typename = typename std::enable_if<std::is_signed<T>::value>::type>
T Nabs(T a) {
return a < 0 ? a : -a;
}
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
#endif // defined(USE_SIMULATOR)
#endif // V8_EXECUTION_MIPS_SIMULATOR_MIPS_H_ #endif // V8_EXECUTION_MIPS_SIMULATOR_MIPS_H_
...@@ -15,6 +15,23 @@ ...@@ -15,6 +15,23 @@
// globals.h defines USE_SIMULATOR. // globals.h defines USE_SIMULATOR.
#include "src/common/globals.h" #include "src/common/globals.h"
template <typename T>
int Compare(const T& a, const T& b) {
if (a == b)
return 0;
else if (a < b)
return -1;
else
return 1;
}
// Returns the negative absolute value of its argument.
template <typename T,
typename = typename std::enable_if<std::is_signed<T>::value>::type>
T Nabs(T a) {
return a < 0 ? a : -a;
}
#if defined(USE_SIMULATOR) #if defined(USE_SIMULATOR)
// Running with a simulator. // Running with a simulator.
...@@ -716,26 +733,9 @@ class Simulator : public SimulatorBase { ...@@ -716,26 +733,9 @@ class Simulator : public SimulatorBase {
LocalMonitor local_monitor_; LocalMonitor local_monitor_;
GlobalMonitor::LinkedAddress global_monitor_thread_; GlobalMonitor::LinkedAddress global_monitor_thread_;
}; };
#endif // defined(USE_SIMULATOR)
template <typename T>
int Compare(const T& a, const T& b) {
if (a == b)
return 0;
else if (a < b)
return -1;
else
return 1;
}
// Returns the negative absolute value of its argument.
template <typename T,
typename = typename std::enable_if<std::is_signed<T>::value>::type>
T Nabs(T a) {
return a < 0 ? a : -a;
}
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
#endif // defined(USE_SIMULATOR)
#endif // V8_EXECUTION_MIPS64_SIMULATOR_MIPS64_H_ #endif // V8_EXECUTION_MIPS64_SIMULATOR_MIPS64_H_
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