Bug 587369 - [OS/2] let YARR build on OS/2, r=daveryeo, gal
authorWalter Meinl <wuno@lsvw.de>
Tue, 21 Sep 2010 13:08:00 -0700
changeset 62078 8003e273cd7e99530414ec09b39aadf0bb9dcfe7
parent 62077 db8be4e3f373398ea980eb3c68de9860114c3a50
child 62079 3a14243ea7277e9638a9e549516ca4755b1a5530
push id18581
push usercleary@mozilla.com
push dateSun, 06 Feb 2011 23:32:36 +0000
treeherdermozilla-central@a02c6f4ffe4a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaveryeo, gal
bugs587369
milestone2.0b11pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 587369 - [OS/2] let YARR build on OS/2, r=daveryeo, gal
js/src/Makefile.in
js/src/assembler/jit/ExecutableAllocatorOS2.cpp
js/src/assembler/wtf/Platform.h
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -402,16 +402,17 @@ VPATH += 	$(srcdir)/assembler \
 		$(srcdir)/yarr/yarr \
 		$(srcdir)/yarr/pcre \
 		$(srcdir)/yarr/wtf \
 		$(NONE)
 
 CPPSRCS += 	Assertions.cpp \
 		ExecutableAllocatorPosix.cpp \
 		ExecutableAllocatorWin.cpp \
+		ExecutableAllocatorOS2.cpp \
 		ExecutableAllocator.cpp \
 		ARMAssembler.cpp \
                 Logging.cpp \
 		MacroAssemblerARM.cpp \
 		MacroAssemblerX86Common.cpp \
 		RegexCompiler.cpp \
 		RegexJIT.cpp \
 		pcre_compile.cpp \
new file mode 100644
--- /dev/null
+++ b/js/src/assembler/jit/ExecutableAllocatorOS2.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "ExecutableAllocator.h"
+
+#if ENABLE_ASSEMBLER && WTF_PLATFORM_OS2
+
+#define INCL_DOS
+#include <os2.h>
+
+namespace JSC {
+
+void ExecutableAllocator::intializePageSize()
+{
+    ExecutableAllocator::pageSize = 4096u;
+}
+
+ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t n)
+{
+    void* allocation = NULL;
+    if (DosAllocMem(&allocation, n, OBJ_ANY|PAG_COMMIT|PAG_READ|PAG_WRITE) &&
+        DosAllocMem(&allocation, n, PAG_COMMIT|PAG_READ|PAG_WRITE))
+        CRASH();
+    ExecutablePool::Allocation alloc = {reinterpret_cast<char*>(allocation), n};
+    return alloc;
+}
+
+void ExecutablePool::systemRelease(const ExecutablePool::Allocation& alloc)
+{
+    DosFreeMem(alloc.pages);
+}
+
+#if ENABLE_ASSEMBLER_WX_EXCLUSIVE
+#error "ASSEMBLER_WX_EXCLUSIVE not yet suported on this platform."
+#endif
+
+}
+
+#endif // HAVE(ASSEMBLER)
--- a/js/src/assembler/wtf/Platform.h
+++ b/js/src/assembler/wtf/Platform.h
@@ -357,16 +357,23 @@
 
 /* PLATFORM(SOLARIS) */
 /* Operating system level dependencies for Solaris that should be used */
 /* regardless of operating environment */
 #if defined(sun) || defined(__sun)
 #define WTF_PLATFORM_SOLARIS 1
 #endif
 
+/* PLATFORM(OS2) */
+/* Operating system level dependencies for OS/2 that should be used */
+/* regardless of operating environment */
+#if defined(OS2) || defined(__OS2__)
+#define WTF_PLATFORM_OS2 1
+#endif
+
 #if defined (__SYMBIAN32__)
 /* we are cross-compiling, it is not really windows */
 #undef WTF_PLATFORM_WIN_OS
 #undef WTF_PLATFORM_WIN
 #define WTF_PLATFORM_SYMBIAN 1
 #endif
 
 
@@ -486,17 +493,17 @@
 #   undef WTF_PLATFORM_MIDDLE_ENDIAN
 #   if Q_BYTE_ORDER == Q_BIG_EDIAN
 #       define WTF_PLATFORM_BIG_ENDIAN 1
 #   endif
 
 #   include <ce_time.h>
 #endif
 
-#if (WTF_PLATFORM_IPHONE || WTF_PLATFORM_MAC || WTF_PLATFORM_WIN || (WTF_PLATFORM_QT && WTF_PLATFORM_DARWIN && !ENABLE_SINGLE_THREADED)) && !defined(ENABLE_JSC_MULTIPLE_THREADS)
+#if (WTF_PLATFORM_IPHONE || WTF_PLATFORM_MAC || WTF_PLATFORM_WIN || WTF_PLATFORM_OS2 || (WTF_PLATFORM_QT && WTF_PLATFORM_DARWIN && !ENABLE_SINGLE_THREADED)) && !defined(ENABLE_JSC_MULTIPLE_THREADS)
 #define ENABLE_JSC_MULTIPLE_THREADS 1
 #endif
 
 /* On Windows, use QueryPerformanceCounter by default */
 #if WTF_PLATFORM_WIN_OS
 #define WTF_USE_QUERY_PERFORMANCE_COUNTER  1
 #endif
 
@@ -627,17 +634,17 @@
 #endif /* !defined(HAVE_ACCESSIBILITY) */
 
 #if WTF_PLATFORM_UNIX && !WTF_PLATFORM_SYMBIAN
 #define HAVE_SIGNAL_H 1
 #endif
 
 #if !WTF_PLATFORM_WIN_OS && !WTF_PLATFORM_SOLARIS && !WTF_PLATFORM_QNX \
     && !WTF_PLATFORM_SYMBIAN && !WTF_PLATFORM_HAIKU && !WTF_COMPILER_RVCT \
-    && !WTF_PLATFORM_ANDROID
+    && !WTF_PLATFORM_ANDROID && !WTF_PLATFORM_OS2
 #define HAVE_TM_GMTOFF 1
 #define HAVE_TM_ZONE 1
 #define HAVE_TIMEGM 1
 #endif     
 
 #if WTF_PLATFORM_DARWIN
 
 #define HAVE_ERRNO_H 1
@@ -696,16 +703,26 @@
 #define HAVE_ERRNO_H 1
 #define HAVE_LANGINFO_H 0
 #define HAVE_MMAP 1
 #define HAVE_SBRK 1
 #define HAVE_STRINGS_H 1
 #define HAVE_SYS_PARAM_H 1
 #define HAVE_SYS_TIME_H 1
 
+#elif WTF_PLATFORM_OS2
+
+#define HAVE_MMAP 1
+#define ENABLE_ASSEMBLER 1
+#define HAVE_ERRNO_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TIMEB_H 1
+
 #else
 
 /* FIXME: is this actually used or do other platforms generate their own config.h? */
 
 #define HAVE_ERRNO_H 1
 /* As long as Haiku doesn't have a complete support of locale this will be disabled. */
 #if !WTF_PLATFORM_HAIKU
 #define HAVE_LANGINFO_H 1
@@ -829,16 +846,19 @@ on MinGW. See https://bugs.webkit.org/sh
 #if WTF_CPU_X86_64 && WTF_PLATFORM_MAC
     #define ENABLE_JIT 1
 /* The JIT is tested & working on x86 Mac */
 #elif WTF_CPU_X86 && WTF_PLATFORM_MAC
     #define ENABLE_JIT 1
     #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
 #elif WTF_CPU_ARM_THUMB2 && WTF_PLATFORM_IPHONE
     #define ENABLE_JIT 1
+/* The JIT is tested & working on x86 OS/2 */
+#elif WTF_CPU_X86 && WTF_PLATFORM_OS2
+    #define ENABLE_JIT 1
 /* The JIT is tested & working on x86 Windows */
 #elif WTF_CPU_X86 && WTF_PLATFORM_WIN
     #define ENABLE_JIT 1
 #endif
 
 #if WTF_PLATFORM_QT
 #if WTF_CPU_X86_64 && WTF_PLATFORM_DARWIN
     #define ENABLE_JIT 1