Revision: 3688
Author: [email protected]
Date: Mon Jan 25 04:37:31 2010
Log: Land patch to add Solaris platform support.

Patch by Erich Ocean and Ryan Dahl.

Review URL: http://codereview.chromium.org/545125
http://code.google.com/p/v8/source/detail?r=3688

Modified:
 /branches/bleeding_edge/AUTHORS
 /branches/bleeding_edge/SConstruct
 /branches/bleeding_edge/src/SConscript
 /branches/bleeding_edge/src/dtoa-config.c
 /branches/bleeding_edge/src/platform-freebsd.cc
 /branches/bleeding_edge/src/platform-linux.cc
 /branches/bleeding_edge/src/platform-macos.cc
 /branches/bleeding_edge/src/platform-openbsd.cc
 /branches/bleeding_edge/src/platform-posix.cc
 /branches/bleeding_edge/src/platform.h
 /branches/bleeding_edge/test/cctest/test-compiler.cc
 /branches/bleeding_edge/tools/utils.py

=======================================
--- /branches/bleeding_edge/AUTHORS     Wed Dec  9 03:14:45 2009
+++ /branches/bleeding_edge/AUTHORS     Mon Jan 25 04:37:31 2010
@@ -10,6 +10,7 @@
 Craig Schlenter <[email protected]>
 Daniel Andersson <[email protected]>
 Daniel James <[email protected]>
+Erich Ocean <[email protected]>
 Jan de Mooij <[email protected]>
 Jay Freeman <[email protected]>
 Joel Stanley <[email protected]>
=======================================
--- /branches/bleeding_edge/SConstruct  Mon Jan 18 08:45:13 2010
+++ /branches/bleeding_edge/SConstruct  Mon Jan 25 04:37:31 2010
@@ -35,7 +35,6 @@
 sys.path.append(join(root_dir, 'tools'))
 import js2c, utils

-
# ANDROID_TOP is the top of the Android checkout, fetched from the environment
 # variable 'TOP'.   You will also need to set the CXX, CC, AR and RANLIB
 # environment variables to the cross-compiling tools.
@@ -157,6 +156,11 @@
       'LIBPATH' : ['/usr/local/lib'],
       'CCFLAGS':      ['-ansi'],
     },
+    'os:solaris': {
+      'CPPPATH' : ['/usr/local/include'],
+      'LIBPATH' : ['/usr/local/lib'],
+      'CCFLAGS':      ['-ansi'],
+    },
     'os:win32': {
       'CCFLAGS':      ['-DWIN32'],
       'CXXFLAGS':     ['-DWIN32'],
@@ -313,6 +317,10 @@
     'os:freebsd': {
       'LIBS': ['execinfo', 'pthread']
     },
+    'os:solaris': {
+      'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'],
+      'LINKFLAGS': ['-mt']
+    },
     'os:openbsd': {
       'LIBS': ['execinfo', 'pthread']
     },
@@ -362,6 +370,10 @@
     'os:freebsd': {
       'LIBS':         ['execinfo', 'pthread']
     },
+    'os:solaris': {
+      'LIBS':         ['m', 'pthread', 'socket', 'nsl', 'rt'],
+      'LINKFLAGS':    ['-mt']
+    },
     'os:openbsd': {
       'LIBS':         ['execinfo', 'pthread']
     },
@@ -420,6 +432,11 @@
       'LIBPATH' : ['/usr/local/lib'],
       'LIBS':     ['execinfo', 'pthread']
     },
+    'os:solaris': {
+      'LIBPATH' : ['/usr/local/lib'],
+      'LIBS':     ['m', 'pthread', 'socket', 'nsl', 'rt'],
+      'LINKFLAGS': ['-mt']
+    },
     'os:openbsd': {
       'LIBPATH' : ['/usr/local/lib'],
       'LIBS':     ['execinfo', 'pthread']
@@ -529,6 +546,10 @@
     'os:freebsd': {
       'LIBS': ['pthread'],
     },
+    'os:solaris': {
+      'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'],
+      'LINKFLAGS': ['-mt']
+    },
     'os:openbsd': {
       'LIBS': ['pthread'],
     },
@@ -582,7 +603,7 @@
     'help': 'the toolchain to use (' + TOOLCHAIN_GUESS + ')'
   },
   'os': {
-    'values': ['freebsd', 'linux', 'macos', 'win32', 'android', 'openbsd'],
+ 'values': ['freebsd', 'linux', 'macos', 'win32', 'android', 'openbsd', 'solaris'],
     'default': OS_GUESS,
     'help': 'the os to build for (' + OS_GUESS + ')'
   },
@@ -936,6 +957,7 @@

   # Link the object files into a library.
   env.Replace(**context.flags['v8'])
+
   context.ApplyEnvOverrides(env)
   if context.options['library'] == 'static':
     library = env.StaticLibrary(library_name, object_files)
=======================================
--- /branches/bleeding_edge/src/SConscript      Wed Jan 20 08:28:21 2010
+++ /branches/bleeding_edge/src/SConscript      Mon Jan 25 04:37:31 2010
@@ -168,6 +168,7 @@
   'os:linux':   ['platform-linux.cc', 'platform-posix.cc'],
   'os:android': ['platform-linux.cc', 'platform-posix.cc'],
   'os:macos':   ['platform-macos.cc', 'platform-posix.cc'],
+  'os:solaris': ['platform-solaris.cc', 'platform-posix.cc'],
   'os:nullos':  ['platform-nullos.cc'],
   'os:win32':   ['platform-win32.cc'],
   'mode:release': [],
@@ -196,6 +197,9 @@
   'os:openbsd': [
     'd8-posix.cc'
   ],
+  'os:solaris': [
+    'd8-posix.cc'
+  ],
   'os:win32': [
     'd8-windows.cc'
   ],
=======================================
--- /branches/bleeding_edge/src/dtoa-config.c   Wed Dec  2 05:38:50 2009
+++ /branches/bleeding_edge/src/dtoa-config.c   Mon Jan 25 04:37:31 2010
@@ -38,7 +38,8 @@
  */

 #if !(defined(__APPLE__) && defined(__MACH__)) && \
-    !defined(WIN32) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
+    !defined(WIN32) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && \
+    !defined(__sun)
 #include <endian.h>
 #endif
 #include <math.h>
@@ -47,7 +48,7 @@
 /* The floating point word order on ARM is big endian when floating point
  * emulation is used, even if the byte order is little endian */
 #if !(defined(__APPLE__) && defined(__MACH__)) && !defined(WIN32) && \
-    !defined(__FreeBSD__) && !defined(__OpenBSD__) && \
+    !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__sun) && \
     __FLOAT_WORD_ORDER == __BIG_ENDIAN
 #define  IEEE_MC68k
 #else
@@ -56,7 +57,7 @@

 #define __MATH_H__
 #if defined(__APPLE__) && defined(__MACH__) || defined(__FreeBSD__) || \
-    defined(__OpenBSD__)
+    defined(__OpenBSD__) || defined(__sun)
 /* stdlib.h on FreeBSD and Apple's 10.5 and later SDKs will mangle the
  * name of strtod.  If it's included after strtod is redefined as
  * gay_strtod, it will mangle the name of gay_strtod, which is
=======================================
--- /branches/bleeding_edge/src/platform-freebsd.cc     Thu Jan 21 08:42:41 2010
+++ /branches/bleeding_edge/src/platform-freebsd.cc     Mon Jan 25 04:37:31 2010
@@ -93,6 +93,24 @@
   // 16 byte alignment on FreeBSD
   return 16;
 }
+
+
+const char* OS::LocalTimezone(double time) {
+  if (isnan(time)) return "";
+  time_t tv = static_cast<time_t>(floor(time/msPerSecond));
+  struct tm* t = localtime(&tv);
+  if (NULL == t) return "";
+  return t->tm_zone;
+}
+
+
+double OS::LocalTimeOffset() {
+  time_t tv = time(NULL);
+  struct tm* t = localtime(&tv);
+  // tm_gmtoff includes any daylight savings offset, so subtract it.
+  return static_cast<double>(t->tm_gmtoff * msPerSecond -
+                             (t->tm_isdst > 0 ? 3600 * msPerSecond : 0));
+}


 // We keep the lowest and highest addresses mapped as a quick way of
=======================================
--- /branches/bleeding_edge/src/platform-linux.cc       Thu Jan 21 08:42:41 2010
+++ /branches/bleeding_edge/src/platform-linux.cc       Mon Jan 25 04:37:31 2010
@@ -157,6 +157,24 @@
   return 16;
 #endif
 }
+
+
+const char* OS::LocalTimezone(double time) {
+  if (isnan(time)) return "";
+  time_t tv = static_cast<time_t>(floor(time/msPerSecond));
+  struct tm* t = localtime(&tv);
+  if (NULL == t) return "";
+  return t->tm_zone;
+}
+
+
+double OS::LocalTimeOffset() {
+  time_t tv = time(NULL);
+  struct tm* t = localtime(&tv);
+  // tm_gmtoff includes any daylight savings offset, so subtract it.
+  return static_cast<double>(t->tm_gmtoff * msPerSecond -
+                             (t->tm_isdst > 0 ? 3600 * msPerSecond : 0));
+}


 // We keep the lowest and highest addresses mapped as a quick way of
=======================================
--- /branches/bleeding_edge/src/platform-macos.cc       Thu Jan 21 08:42:41 2010
+++ /branches/bleeding_edge/src/platform-macos.cc       Mon Jan 25 04:37:31 2010
@@ -257,6 +257,24 @@
   // Function Call Guide".
   return 16;
 }
+
+
+const char* OS::LocalTimezone(double time) {
+  if (isnan(time)) return "";
+  time_t tv = static_cast<time_t>(floor(time/msPerSecond));
+  struct tm* t = localtime(&tv);
+  if (NULL == t) return "";
+  return t->tm_zone;
+}
+
+
+double OS::LocalTimeOffset() {
+  time_t tv = time(NULL);
+  struct tm* t = localtime(&tv);
+  // tm_gmtoff includes any daylight savings offset, so subtract it.
+  return static_cast<double>(t->tm_gmtoff * msPerSecond -
+                             (t->tm_isdst > 0 ? 3600 * msPerSecond : 0));
+}


 int OS::StackWalk(Vector<StackFrame> frames) {
=======================================
--- /branches/bleeding_edge/src/platform-openbsd.cc     Thu Dec  3 01:29:21 2009
+++ /branches/bleeding_edge/src/platform-openbsd.cc     Mon Jan 25 04:37:31 2010
@@ -92,6 +92,24 @@
   // 16 byte alignment on OpenBSD
   return 16;
 }
+
+
+const char* OS::LocalTimezone(double time) {
+  if (isnan(time)) return "";
+  time_t tv = static_cast<time_t>(floor(time/msPerSecond));
+  struct tm* t = localtime(&tv);
+  if (NULL == t) return "";
+  return t->tm_zone;
+}
+
+
+double OS::LocalTimeOffset() {
+  time_t tv = time(NULL);
+  struct tm* t = localtime(&tv);
+  // tm_gmtoff includes any daylight savings offset, so subtract it.
+  return static_cast<double>(t->tm_gmtoff * msPerSecond -
+                             (t->tm_isdst > 0 ? 3600 * msPerSecond : 0));
+}


 // We keep the lowest and highest addresses mapped as a quick way of
=======================================
--- /branches/bleeding_edge/src/platform-posix.cc       Thu Dec  3 01:29:21 2009
+++ /branches/bleeding_edge/src/platform-posix.cc       Mon Jan 25 04:37:31 2010
@@ -97,15 +97,6 @@
     return 0;
   return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec;
 }
-
-
-const char* OS::LocalTimezone(double time) {
-  if (isnan(time)) return "";
-  time_t tv = static_cast<time_t>(floor(time/msPerSecond));
-  struct tm* t = localtime(&tv);
-  if (NULL == t) return "";
-  return t->tm_zone;
-}


 double OS::DaylightSavingsOffset(double time) {
@@ -115,15 +106,6 @@
   if (NULL == t) return nan_value();
   return t->tm_isdst > 0 ? 3600 * msPerSecond : 0;
 }
-
-
-double OS::LocalTimeOffset() {
-  time_t tv = time(NULL);
-  struct tm* t = localtime(&tv);
-  // tm_gmtoff includes any daylight savings offset, so subtract it.
-  return static_cast<double>(t->tm_gmtoff * msPerSecond -
-                             (t->tm_isdst > 0 ? 3600 * msPerSecond : 0));
-}


// ----------------------------------------------------------------------------
=======================================
--- /branches/bleeding_edge/src/platform.h      Thu Jan 21 08:42:41 2010
+++ /branches/bleeding_edge/src/platform.h      Mon Jan 25 04:37:31 2010
@@ -44,6 +44,12 @@
 #ifndef V8_PLATFORM_H_
 #define V8_PLATFORM_H_

+#ifdef __sun
+// On Solaris, to get isinf, INFINITY, fpclassify and other macros one needs
+// to define this symbol
+#define __C99FEATURES__ 1
+#endif
+
 #define V8_INFINITY INFINITY

 // Windows specific stuff.
=======================================
--- /branches/bleeding_edge/test/cctest/test-compiler.cc Tue Mar 10 08:08:45 2009 +++ /branches/bleeding_edge/test/cctest/test-compiler.cc Mon Jan 25 04:37:31 2010
@@ -26,6 +26,7 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 #include <stdlib.h>
+#include <wchar.h>  // wint_t

 #include "v8.h"

@@ -73,7 +74,7 @@
     uint16_t* string = NewArray<uint16_t>(length + 1);
     string_obj->Write(string);
     for (int j = 0; j < length; j++)
-      printf("%lc", string[j]);
+      printf("%lc", static_cast<wint_t>(string[j]));
     DeleteArray(string);
   }
   printf("\n");
=======================================
--- /branches/bleeding_edge/tools/utils.py      Wed Dec  2 05:38:50 2009
+++ /branches/bleeding_edge/tools/utils.py      Mon Jan 25 04:37:31 2010
@@ -57,6 +57,8 @@
     return 'freebsd'
   elif id == 'OpenBSD':
     return 'openbsd'
+  elif id == 'SunOS':
+    return 'solaris'
   else:
     return None

@@ -67,6 +69,8 @@
     return 'arm'
   elif (not id) or (not re.match('(x|i[3-6])86', id) is None):
     return 'ia32'
+  elif id == 'i86pc':
+    return 'ia32'
   else:
     return None

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to