aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/base
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2015-01-07 18:38:38 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2015-01-07 22:11:18 +0100
commitdad73f645cde6920e79db956e7ef82ed640d7615 (patch)
tree7ba3f3fc7e0722c5f130065461b7c56f571af383 /deps/v8/src/base
parent53ba494537259b18b346dc6150d6a100c557e08f (diff)
downloadandroid-node-v8-dad73f645cde6920e79db956e7ef82ed640d7615.tar.gz
android-node-v8-dad73f645cde6920e79db956e7ef82ed640d7615.tar.bz2
android-node-v8-dad73f645cde6920e79db956e7ef82ed640d7615.zip
deps: upgrade v8 to 3.31.74.1
PR-URL: https://github.com/iojs/io.js/pull/243 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'deps/v8/src/base')
-rw-r--r--deps/v8/src/base/cpu.cc86
-rw-r--r--deps/v8/src/base/cpu.h7
-rw-r--r--deps/v8/src/base/iterator.h56
-rw-r--r--deps/v8/src/base/macros.h6
-rw-r--r--deps/v8/src/base/platform/platform-linux.cc2
-rw-r--r--deps/v8/src/base/platform/platform-posix.cc3
-rw-r--r--deps/v8/src/base/platform/platform-win32.cc43
-rw-r--r--deps/v8/src/base/platform/time.cc12
-rw-r--r--deps/v8/src/base/sys-info.cc8
9 files changed, 158 insertions, 65 deletions
diff --git a/deps/v8/src/base/cpu.cc b/deps/v8/src/base/cpu.cc
index 5bc8b13a97..56e1c4633c 100644
--- a/deps/v8/src/base/cpu.cc
+++ b/deps/v8/src/base/cpu.cc
@@ -291,32 +291,36 @@ static bool HasListItem(const char* list, const char* item) {
#endif // V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64
-CPU::CPU() : stepping_(0),
- model_(0),
- ext_model_(0),
- family_(0),
- ext_family_(0),
- type_(0),
- implementer_(0),
- architecture_(0),
- part_(0),
- has_fpu_(false),
- has_cmov_(false),
- has_sahf_(false),
- has_mmx_(false),
- has_sse_(false),
- has_sse2_(false),
- has_sse3_(false),
- has_ssse3_(false),
- has_sse41_(false),
- has_sse42_(false),
- has_idiva_(false),
- has_neon_(false),
- has_thumb2_(false),
- has_vfp_(false),
- has_vfp3_(false),
- has_vfp3_d32_(false),
- is_fp64_mode_(false) {
+CPU::CPU()
+ : stepping_(0),
+ model_(0),
+ ext_model_(0),
+ family_(0),
+ ext_family_(0),
+ type_(0),
+ implementer_(0),
+ architecture_(0),
+ variant_(-1),
+ part_(0),
+ has_fpu_(false),
+ has_cmov_(false),
+ has_sahf_(false),
+ has_mmx_(false),
+ has_sse_(false),
+ has_sse2_(false),
+ has_sse3_(false),
+ has_ssse3_(false),
+ has_sse41_(false),
+ has_sse42_(false),
+ has_avx_(false),
+ has_fma3_(false),
+ has_idiva_(false),
+ has_neon_(false),
+ has_thumb2_(false),
+ has_vfp_(false),
+ has_vfp3_(false),
+ has_vfp3_d32_(false),
+ is_fp64_mode_(false) {
memcpy(vendor_, "Unknown", 8);
#if V8_OS_NACL
// Portable host shouldn't do feature detection.
@@ -356,6 +360,8 @@ CPU::CPU() : stepping_(0),
has_ssse3_ = (cpu_info[2] & 0x00000200) != 0;
has_sse41_ = (cpu_info[2] & 0x00080000) != 0;
has_sse42_ = (cpu_info[2] & 0x00100000) != 0;
+ has_avx_ = (cpu_info[2] & 0x10000000) != 0;
+ if (has_avx_) has_fma3_ = (cpu_info[2] & 0x00001000) != 0;
}
#if V8_HOST_ARCH_IA32
@@ -383,7 +389,7 @@ CPU::CPU() : stepping_(0),
// Extract implementor from the "CPU implementer" field.
char* implementer = cpu_info.ExtractField("CPU implementer");
if (implementer != NULL) {
- char* end ;
+ char* end;
implementer_ = strtol(implementer, &end, 0);
if (end == implementer) {
implementer_ = 0;
@@ -391,10 +397,20 @@ CPU::CPU() : stepping_(0),
delete[] implementer;
}
+ char* variant = cpu_info.ExtractField("CPU variant");
+ if (variant != NULL) {
+ char* end;
+ variant_ = strtol(variant, &end, 0);
+ if (end == variant) {
+ variant_ = -1;
+ }
+ delete[] variant;
+ }
+
// Extract part number from the "CPU part" field.
char* part = cpu_info.ExtractField("CPU part");
if (part != NULL) {
- char* end ;
+ char* end;
part_ = strtol(part, &end, 0);
if (end == part) {
part_ = 0;
@@ -535,7 +551,7 @@ CPU::CPU() : stepping_(0),
// Extract implementor from the "CPU implementer" field.
char* implementer = cpu_info.ExtractField("CPU implementer");
if (implementer != NULL) {
- char* end ;
+ char* end;
implementer_ = strtol(implementer, &end, 0);
if (end == implementer) {
implementer_ = 0;
@@ -543,10 +559,20 @@ CPU::CPU() : stepping_(0),
delete[] implementer;
}
+ char* variant = cpu_info.ExtractField("CPU variant");
+ if (variant != NULL) {
+ char* end;
+ variant_ = strtol(variant, &end, 0);
+ if (end == variant) {
+ variant_ = -1;
+ }
+ delete[] variant;
+ }
+
// Extract part number from the "CPU part" field.
char* part = cpu_info.ExtractField("CPU part");
if (part != NULL) {
- char* end ;
+ char* end;
part_ = strtol(part, &end, 0);
if (end == part) {
part_ = 0;
diff --git a/deps/v8/src/base/cpu.h b/deps/v8/src/base/cpu.h
index dc0eaf485f..8c41f9d77a 100644
--- a/deps/v8/src/base/cpu.h
+++ b/deps/v8/src/base/cpu.h
@@ -47,6 +47,8 @@ class CPU FINAL {
static const int NVIDIA = 0x4e;
static const int QUALCOMM = 0x51;
int architecture() const { return architecture_; }
+ int variant() const { return variant_; }
+ static const int NVIDIA_DENVER = 0x0;
int part() const { return part_; }
static const int ARM_CORTEX_A5 = 0xc05;
static const int ARM_CORTEX_A7 = 0xc07;
@@ -68,6 +70,8 @@ class CPU FINAL {
bool has_ssse3() const { return has_ssse3_; }
bool has_sse41() const { return has_sse41_; }
bool has_sse42() const { return has_sse42_; }
+ bool has_avx() const { return has_avx_; }
+ bool has_fma3() const { return has_fma3_; }
// arm features
bool has_idiva() const { return has_idiva_; }
@@ -90,6 +94,7 @@ class CPU FINAL {
int type_;
int implementer_;
int architecture_;
+ int variant_;
int part_;
bool has_fpu_;
bool has_cmov_;
@@ -101,6 +106,8 @@ class CPU FINAL {
bool has_ssse3_;
bool has_sse41_;
bool has_sse42_;
+ bool has_avx_;
+ bool has_fma3_;
bool has_idiva_;
bool has_neon_;
bool has_thumb2_;
diff --git a/deps/v8/src/base/iterator.h b/deps/v8/src/base/iterator.h
new file mode 100644
index 0000000000..e380dc338f
--- /dev/null
+++ b/deps/v8/src/base/iterator.h
@@ -0,0 +1,56 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_BASE_ITERATOR_H_
+#define V8_BASE_ITERATOR_H_
+
+#include <iterator>
+
+#include "src/base/macros.h"
+
+namespace v8 {
+namespace base {
+
+// The intention of the base::iterator_range class is to encapsulate two
+// iterators so that the range defined by the iterators can be used like
+// a regular STL container (actually only a subset of the full container
+// functionality is available usually).
+template <typename ForwardIterator>
+class iterator_range {
+ public:
+ typedef ForwardIterator iterator;
+ typedef ForwardIterator const_iterator;
+ typedef typename std::iterator_traits<iterator>::pointer pointer;
+ typedef typename std::iterator_traits<iterator>::reference reference;
+ typedef typename std::iterator_traits<iterator>::value_type value_type;
+ typedef
+ typename std::iterator_traits<iterator>::difference_type difference_type;
+
+ iterator_range() : begin_(), end_() {}
+ template <typename ForwardIterator2>
+ iterator_range(ForwardIterator2 const& begin, ForwardIterator2 const& end)
+ : begin_(begin), end_(end) {}
+
+ iterator begin() { return begin_; }
+ iterator end() { return end_; }
+ const_iterator begin() const { return begin_; }
+ const_iterator end() const { return end_; }
+ const_iterator cbegin() const { return begin_; }
+ const_iterator cend() const { return end_; }
+
+ bool empty() const { return cbegin() == cend(); }
+
+ // Random Access iterators only.
+ reference operator[](difference_type n) { return begin()[n]; }
+ difference_type size() const { return cend() - cbegin(); }
+
+ private:
+ const_iterator const begin_;
+ const_iterator const end_;
+};
+
+} // namespace base
+} // namespace v8
+
+#endif // V8_BASE_ITERATOR_H_
diff --git a/deps/v8/src/base/macros.h b/deps/v8/src/base/macros.h
index 80a89496a5..371d7da6ea 100644
--- a/deps/v8/src/base/macros.h
+++ b/deps/v8/src/base/macros.h
@@ -20,9 +20,9 @@
// corresponds to 'offsetof' (in stddef.h), except that it doesn't
// use 0 or NULL, which causes a problem with the compiler warnings
// we have enabled (which is also why 'offsetof' doesn't seem to work).
-// Here we simply use the non-zero value 4, which seems to work.
-#define OFFSET_OF(type, field) \
- (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4)
+// Here we simply use the aligned, non-zero value 16.
+#define OFFSET_OF(type, field) \
+ (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(16)->field)) - 16)
#if V8_OS_NACL
diff --git a/deps/v8/src/base/platform/platform-linux.cc b/deps/v8/src/base/platform/platform-linux.cc
index b13a1e85c5..36857e6219 100644
--- a/deps/v8/src/base/platform/platform-linux.cc
+++ b/deps/v8/src/base/platform/platform-linux.cc
@@ -8,10 +8,10 @@
#include <pthread.h>
#include <semaphore.h>
#include <signal.h>
+#include <stdio.h>
#include <stdlib.h>
#include <sys/resource.h>
#include <sys/time.h>
-#include <sys/types.h>
// Ubuntu Dapper requires memory pages to be marked as
// executable. Otherwise, OS raises an exception when executing code
diff --git a/deps/v8/src/base/platform/platform-posix.cc b/deps/v8/src/base/platform/platform-posix.cc
index 0a222a612e..c2fa26a9ea 100644
--- a/deps/v8/src/base/platform/platform-posix.cc
+++ b/deps/v8/src/base/platform/platform-posix.cc
@@ -13,6 +13,7 @@
#include <pthread_np.h> // for pthread_set_name_np
#endif
#include <sched.h> // for sched_yield
+#include <stdio.h>
#include <time.h>
#include <unistd.h>
@@ -253,7 +254,7 @@ int OS::GetCurrentProcessId() {
int OS::GetCurrentThreadId() {
-#if V8_OS_MACOSX
+#if V8_OS_MACOSX || (V8_OS_ANDROID && defined(__APPLE__))
return static_cast<int>(pthread_mach_thread_np(pthread_self()));
#elif V8_OS_LINUX
return static_cast<int>(syscall(__NR_gettid));
diff --git a/deps/v8/src/base/platform/platform-win32.cc b/deps/v8/src/base/platform/platform-win32.cc
index 1c46cf6811..d68e8617d7 100644
--- a/deps/v8/src/base/platform/platform-win32.cc
+++ b/deps/v8/src/base/platform/platform-win32.cc
@@ -346,26 +346,41 @@ void Win32Time::SetToCurrentTime() {
}
-int64_t FileTimeToInt64(FILETIME ft) {
- ULARGE_INTEGER result;
- result.LowPart = ft.dwLowDateTime;
- result.HighPart = ft.dwHighDateTime;
- return static_cast<int64_t>(result.QuadPart);
-}
-
-
// Return the local timezone offset in milliseconds east of UTC. This
// takes into account whether daylight saving is in effect at the time.
// Only times in the 32-bit Unix range may be passed to this function.
// Also, adding the time-zone offset to the input must not overflow.
// The function EquivalentTime() in date.js guarantees this.
int64_t Win32Time::LocalOffset(TimezoneCache* cache) {
- FILETIME local;
- SYSTEMTIME system_utc, system_local;
- FileTimeToSystemTime(&time_.ft_, &system_utc);
- SystemTimeToTzSpecificLocalTime(NULL, &system_utc, &system_local);
- SystemTimeToFileTime(&system_local, &local);
- return (FileTimeToInt64(local) - FileTimeToInt64(time_.ft_)) / kTimeScaler;
+ cache->InitializeIfNeeded();
+
+ Win32Time rounded_to_second(*this);
+ rounded_to_second.t() =
+ rounded_to_second.t() / 1000 / kTimeScaler * 1000 * kTimeScaler;
+ // Convert to local time using POSIX localtime function.
+ // Windows XP Service Pack 3 made SystemTimeToTzSpecificLocalTime()
+ // very slow. Other browsers use localtime().
+
+ // Convert from JavaScript milliseconds past 1/1/1970 0:00:00 to
+ // POSIX seconds past 1/1/1970 0:00:00.
+ double unchecked_posix_time = rounded_to_second.ToJSTime() / 1000;
+ if (unchecked_posix_time > INT_MAX || unchecked_posix_time < 0) {
+ return 0;
+ }
+ // Because _USE_32BIT_TIME_T is defined, time_t is a 32-bit int.
+ time_t posix_time = static_cast<time_t>(unchecked_posix_time);
+
+ // Convert to local time, as struct with fields for day, hour, year, etc.
+ tm posix_local_time_struct;
+ if (localtime_s(&posix_local_time_struct, &posix_time)) return 0;
+
+ if (posix_local_time_struct.tm_isdst > 0) {
+ return (cache->tzinfo_.Bias + cache->tzinfo_.DaylightBias) * -kMsPerMinute;
+ } else if (posix_local_time_struct.tm_isdst == 0) {
+ return (cache->tzinfo_.Bias + cache->tzinfo_.StandardBias) * -kMsPerMinute;
+ } else {
+ return cache->tzinfo_.Bias * -kMsPerMinute;
+ }
}
diff --git a/deps/v8/src/base/platform/time.cc b/deps/v8/src/base/platform/time.cc
index d47ccaf803..40dd188db3 100644
--- a/deps/v8/src/base/platform/time.cc
+++ b/deps/v8/src/base/platform/time.cc
@@ -401,7 +401,7 @@ class HighResolutionTickClock FINAL : public TickClock {
}
virtual ~HighResolutionTickClock() {}
- virtual int64_t Now() OVERRIDE {
+ int64_t Now() OVERRIDE {
LARGE_INTEGER now;
BOOL result = QueryPerformanceCounter(&now);
DCHECK(result);
@@ -419,9 +419,7 @@ class HighResolutionTickClock FINAL : public TickClock {
return ticks + 1;
}
- virtual bool IsHighResolution() OVERRIDE {
- return true;
- }
+ bool IsHighResolution() OVERRIDE { return true; }
private:
int64_t ticks_per_second_;
@@ -435,7 +433,7 @@ class RolloverProtectedTickClock FINAL : public TickClock {
RolloverProtectedTickClock() : last_seen_now_(0), rollover_ms_(1) {}
virtual ~RolloverProtectedTickClock() {}
- virtual int64_t Now() OVERRIDE {
+ int64_t Now() OVERRIDE {
LockGuard<Mutex> lock_guard(&mutex_);
// We use timeGetTime() to implement TimeTicks::Now(), which rolls over
// every ~49.7 days. We try to track rollover ourselves, which works if
@@ -454,9 +452,7 @@ class RolloverProtectedTickClock FINAL : public TickClock {
return (now + rollover_ms_) * Time::kMicrosecondsPerMillisecond;
}
- virtual bool IsHighResolution() OVERRIDE {
- return false;
- }
+ bool IsHighResolution() OVERRIDE { return false; }
private:
Mutex mutex_;
diff --git a/deps/v8/src/base/sys-info.cc b/deps/v8/src/base/sys-info.cc
index 06c4f24eeb..c665771b8b 100644
--- a/deps/v8/src/base/sys-info.cc
+++ b/deps/v8/src/base/sys-info.cc
@@ -34,14 +34,12 @@ int SysInfo::NumberOfProcessors() {
int ncpu = 0;
size_t len = sizeof(ncpu);
if (sysctl(mib, arraysize(mib), &ncpu, &len, NULL, 0) != 0) {
- UNREACHABLE();
return 1;
}
return ncpu;
#elif V8_OS_POSIX
long result = sysconf(_SC_NPROCESSORS_ONLN); // NOLINT(runtime/int)
if (result == -1) {
- UNREACHABLE();
return 1;
}
return static_cast<int>(result);
@@ -60,7 +58,6 @@ int64_t SysInfo::AmountOfPhysicalMemory() {
int64_t memsize = 0;
size_t len = sizeof(memsize);
if (sysctl(mib, arraysize(mib), &memsize, &len, NULL, 0) != 0) {
- UNREACHABLE();
return 0;
}
return memsize;
@@ -70,7 +67,6 @@ int64_t SysInfo::AmountOfPhysicalMemory() {
sysctlbyname("vm.stats.vm.v_page_count", &pages, &size, NULL, 0);
sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0);
if (pages == -1 || page_size == -1) {
- UNREACHABLE();
return 0;
}
return static_cast<int64_t>(pages) * page_size;
@@ -78,7 +74,6 @@ int64_t SysInfo::AmountOfPhysicalMemory() {
MEMORYSTATUSEX memory_info;
memory_info.dwLength = sizeof(memory_info);
if (!GlobalMemoryStatusEx(&memory_info)) {
- UNREACHABLE();
return 0;
}
int64_t result = static_cast<int64_t>(memory_info.ullTotalPhys);
@@ -87,7 +82,6 @@ int64_t SysInfo::AmountOfPhysicalMemory() {
#elif V8_OS_QNX
struct stat stat_buf;
if (stat("/proc", &stat_buf) != 0) {
- UNREACHABLE();
return 0;
}
return static_cast<int64_t>(stat_buf.st_size);
@@ -98,7 +92,6 @@ int64_t SysInfo::AmountOfPhysicalMemory() {
long pages = sysconf(_SC_PHYS_PAGES); // NOLINT(runtime/int)
long page_size = sysconf(_SC_PAGESIZE); // NOLINT(runtime/int)
if (pages == -1 || page_size == -1) {
- UNREACHABLE();
return 0;
}
return static_cast<int64_t>(pages) * page_size;
@@ -114,7 +107,6 @@ int64_t SysInfo::AmountOfVirtualMemory() {
struct rlimit rlim;
int result = getrlimit(RLIMIT_DATA, &rlim);
if (result != 0) {
- UNREACHABLE();
return 0;
}
return (rlim.rlim_cur == RLIM_INFINITY) ? 0 : rlim.rlim_cur;