summaryrefslogtreecommitdiff
path: root/chromium/v8/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/v8/src/base')
-rw-r--r--chromium/v8/src/base/ieee754.cc2
-rw-r--r--chromium/v8/src/base/platform/time.cc19
2 files changed, 20 insertions, 1 deletions
diff --git a/chromium/v8/src/base/ieee754.cc b/chromium/v8/src/base/ieee754.cc
index dd86353bbfb..b7178cad301 100644
--- a/chromium/v8/src/base/ieee754.cc
+++ b/chromium/v8/src/base/ieee754.cc
@@ -609,7 +609,7 @@ recompute:
j = 0;
for (i = jz - 1; i >= jk; i--) j |= iq[i];
if (j == 0) { /* need recomputation */
- for (k = 1; iq[jk - k] == 0; k++) {
+ for (k = 1; jk >= k && iq[jk - k] == 0; k++) {
/* k = no. of terms needed */
}
diff --git a/chromium/v8/src/base/platform/time.cc b/chromium/v8/src/base/platform/time.cc
index f71af151655..786ef2e6c2e 100644
--- a/chromium/v8/src/base/platform/time.cc
+++ b/chromium/v8/src/base/platform/time.cc
@@ -56,6 +56,17 @@ int64_t ComputeThreadTicks() {
V8_INLINE int64_t ClockNow(clockid_t clk_id) {
#if (defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0) || \
defined(V8_OS_BSD) || defined(V8_OS_ANDROID)
+// On AIX clock_gettime for CLOCK_THREAD_CPUTIME_ID outputs time with
+// resolution of 10ms. thread_cputime API provides the time in ns
+#if defined(V8_OS_AIX)
+ thread_cputime_t tc;
+ if (clk_id == CLOCK_THREAD_CPUTIME_ID) {
+ if (thread_cputime(-1, &tc) != 0) {
+ UNREACHABLE();
+ return 0;
+ }
+ }
+#endif
struct timespec ts;
if (clock_gettime(clk_id, &ts) != 0) {
UNREACHABLE();
@@ -63,7 +74,15 @@ V8_INLINE int64_t ClockNow(clockid_t clk_id) {
}
v8::base::internal::CheckedNumeric<int64_t> result(ts.tv_sec);
result *= v8::base::Time::kMicrosecondsPerSecond;
+#if defined(V8_OS_AIX)
+ if (clk_id == CLOCK_THREAD_CPUTIME_ID) {
+ result += (tc.stime / v8::base::Time::kNanosecondsPerMicrosecond);
+ } else {
+ result += (ts.tv_nsec / v8::base::Time::kNanosecondsPerMicrosecond);
+ }
+#else
result += (ts.tv_nsec / v8::base::Time::kNanosecondsPerMicrosecond);
+#endif
return result.ValueOrDie();
#else // Monotonic clock not supported.
return 0;