summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/wtf
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScriptCore/wtf')
-rw-r--r--JavaScriptCore/wtf/Assertions.h8
-rw-r--r--JavaScriptCore/wtf/CurrentTime.cpp16
-rw-r--r--JavaScriptCore/wtf/CurrentTime.h1
-rw-r--r--JavaScriptCore/wtf/Platform.h28
-rw-r--r--JavaScriptCore/wtf/brew/MainThreadBrew.cpp45
-rw-r--r--JavaScriptCore/wtf/brew/OwnPtrBrew.cpp51
-rw-r--r--JavaScriptCore/wtf/brew/OwnPtrBrew.h133
7 files changed, 276 insertions, 6 deletions
diff --git a/JavaScriptCore/wtf/Assertions.h b/JavaScriptCore/wtf/Assertions.h
index 352a74b..0e02af5 100644
--- a/JavaScriptCore/wtf/Assertions.h
+++ b/JavaScriptCore/wtf/Assertions.h
@@ -179,6 +179,14 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann
#undef ASSERT
#endif
+#if PLATFORM(BREWMP)
+/* FIXME: We include this here only to avoid a conflict with the COMPILE_ASSERT macro. */
+#include <AEEClassIDs.h>
+
+/* FIXME: Change to use something other than COMPILE_ASSERT to avoid this conflict with the underlying platform */
+#undef COMPILE_ASSERT
+#endif
+
#if ASSERT_DISABLED
#define ASSERT(assertion) ((void)0)
diff --git a/JavaScriptCore/wtf/CurrentTime.cpp b/JavaScriptCore/wtf/CurrentTime.cpp
index b272874..30ca7c3 100644
--- a/JavaScriptCore/wtf/CurrentTime.cpp
+++ b/JavaScriptCore/wtf/CurrentTime.cpp
@@ -59,6 +59,8 @@ extern "C" time_t mktime(struct tm *t);
#include <glib.h>
#elif PLATFORM(WX)
#include <wx/datetime.h>
+#elif PLATFORM(BREWMP)
+#include <AEEStdLib.h>
#else // Posix systems relying on the gettimeofday()
#include <sys/time.h>
#endif
@@ -277,6 +279,20 @@ double currentTime()
return (double)now.GetTicks() + (double)(now.GetMillisecond() / 1000.0);
}
+#elif PLATFORM(BREWMP)
+
+// GETUTCSECONDS returns the number of seconds since 1980/01/06 00:00:00 UTC,
+// and GETTIMEMS returns the number of milliseconds that have elapsed since the last
+// occurrence of 00:00:00 local time.
+// We can combine GETUTCSECONDS and GETTIMEMS to calculate the number of milliseconds
+// since 1970/01/01 00:00:00 UTC.
+double currentTime()
+{
+ // diffSeconds is the number of seconds from 1970/01/01 to 1980/01/06
+ const unsigned diffSeconds = 315964800;
+ return static_cast<double>(diffSeconds + GETUTCSECONDS() + ((GETTIMEMS() % 1000) / msPerSecond));
+}
+
#else // Other Posix systems rely on the gettimeofday().
double currentTime()
diff --git a/JavaScriptCore/wtf/CurrentTime.h b/JavaScriptCore/wtf/CurrentTime.h
index 334a6e9..033448f 100644
--- a/JavaScriptCore/wtf/CurrentTime.h
+++ b/JavaScriptCore/wtf/CurrentTime.h
@@ -61,6 +61,7 @@ namespace WTF {
} // namespace WTF
using WTF::currentTime;
+using WTF::getLocalTime;
#endif // CurrentTime_h
diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h
index 810c829..166a955 100644
--- a/JavaScriptCore/wtf/Platform.h
+++ b/JavaScriptCore/wtf/Platform.h
@@ -415,6 +415,13 @@
#define WTF_PLATFORM_GTK 1
#elif defined(BUILDING_HAIKU__)
#define WTF_PLATFORM_HAIKU 1
+#elif defined(BUILDING_BREWMP__)
+#define WTF_PLATFORM_BREWMP 1
+#if defined(AEE_SIMULATOR)
+#define WTF_PLATFORM_BREWMP_SIMULATOR 1
+#else
+#define WTF_PLATFORM_BREWMP_SIMULATOR 0
+#endif
#elif OS(DARWIN)
#define WTF_PLATFORM_MAC 1
#elif OS(WINDOWS)
@@ -481,10 +488,10 @@
*/
#if OS(WINCE) && PLATFORM(QT)
# include <QtGlobal>
-# undef WTF_PLATFORM_BIG_ENDIAN
-# undef WTF_PLATFORM_MIDDLE_ENDIAN
-# if Q_BYTE_ORDER == Q_BIG_EDIAN
-# define WTF_PLATFORM_BIG_ENDIAN 1
+# undef WTF_CPU_BIG_ENDIAN
+# undef WTF_CPU_MIDDLE_ENDIAN
+# if Q_BYTE_ORDER == Q_BIG_ENDIAN
+# define WTF_CPU_BIG_ENDIAN 1
# endif
# include <ce_time.h>
@@ -632,7 +639,7 @@
#if !OS(WINDOWS) && !OS(SOLARIS) && !OS(QNX) \
&& !OS(SYMBIAN) && !OS(HAIKU) && !OS(RVCT) \
- && !OS(ANDROID)
+ && !OS(ANDROID) && !PLATFORM(BREWMP)
#define HAVE_TM_GMTOFF 1
#define HAVE_TM_ZONE 1
#define HAVE_TIMEGM 1
@@ -688,6 +695,10 @@
#define HAVE_SYS_PARAM_H 1
#endif
+#elif PLATFORM(BREWMP)
+
+#define HAVE_ERRNO_H 1
+
#elif OS(QNX)
#define HAVE_ERRNO_H 1
@@ -854,7 +865,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
#define ENABLE_JIT 1
#endif
-#if PLATFORM(QT)
+#if PLATFORM(QT) || PLATFORM(WX)
#if CPU(X86_64) && OS(DARWIN)
#define ENABLE_JIT 1
#elif CPU(X86) && OS(DARWIN)
@@ -918,8 +929,13 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
#if (CPU(X86) && PLATFORM(MAC)) \
|| (CPU(X86_64) && PLATFORM(MAC)) \
|| (CPU(ARM_THUMB2) && PLATFORM(IPHONE)) \
+<<<<<<< HEAD
|| (CPU(ARM_THUMB2) && PLATFORM(ANDROID) && ENABLE(ANDROID_JSC_JIT)) \
|| (CPU(X86) && PLATFORM(WIN))
+=======
+ || (CPU(X86) && PLATFORM(WIN)) \
+ || (CPU(X86) && PLATFORM(WX))
+>>>>>>> webkit.org at r54340
#define ENABLE_YARR 1
#define ENABLE_YARR_JIT 1
#endif
diff --git a/JavaScriptCore/wtf/brew/MainThreadBrew.cpp b/JavaScriptCore/wtf/brew/MainThreadBrew.cpp
new file mode 100644
index 0000000..2690ea5
--- /dev/null
+++ b/JavaScriptCore/wtf/brew/MainThreadBrew.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2009 Company 100, Inc.
+ *
+ * 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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 "config.h"
+#include "MainThread.h"
+
+namespace WTF {
+
+void initializeMainThreadPlatform()
+{
+ // not implemented
+}
+
+void scheduleDispatchFunctionsOnMainThread()
+{
+ // not implemented
+}
+
+} // namespace WTF
+
diff --git a/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp b/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp
new file mode 100644
index 0000000..dadd82e
--- /dev/null
+++ b/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2010 Company 100, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "OwnPtrBrew.h"
+
+#include <AEEBitmap.h>
+#include <AEEFile.h>
+#include <AEEStdLib.h>
+
+namespace WTF {
+
+template <> void freeOwnedPtrBrew<IFileMgr>(IFileMgr* ptr)
+{
+ if (ptr)
+ IFILEMGR_Release(ptr);
+}
+
+template <> void freeOwnedPtrBrew<IFile>(IFile* ptr)
+{
+ if (ptr)
+ IFILE_Release(ptr);
+}
+
+template <> void freeOwnedPtrBrew<IBitmap>(IBitmap* ptr)
+{
+ if (ptr)
+ IBitmap_Release(ptr);
+}
+
+template <typename T> void freeOwnedPtrBrew(T* ptr)
+{
+ FREEIF(ptr);
+}
+
+} // namespace WTF
diff --git a/JavaScriptCore/wtf/brew/OwnPtrBrew.h b/JavaScriptCore/wtf/brew/OwnPtrBrew.h
new file mode 100644
index 0000000..1bb44fc
--- /dev/null
+++ b/JavaScriptCore/wtf/brew/OwnPtrBrew.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Collabora Ltd.
+ * Copyright (C) 2010 Company 100, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef OwnPtrBrew_h
+#define OwnPtrBrew_h
+
+#include <algorithm>
+#include <wtf/Assertions.h>
+#include <wtf/Noncopyable.h>
+
+// Forward delcarations at this point avoid the need to include BREW includes
+// in WTF headers.
+typedef struct _IFileMgr IFileMgr;
+typedef struct _IFile IFile;
+typedef struct IBitmap IBitmap;
+
+namespace WTF {
+
+template <typename T> void freeOwnedPtrBrew(T* ptr);
+template<> void freeOwnedPtrBrew<IFileMgr>(IFileMgr*);
+template<> void freeOwnedPtrBrew<IFile>(IFile*);
+template<> void freeOwnedPtrBrew<IBitmap>(IBitmap*);
+
+template <typename T> class OwnPtrBrew : public Noncopyable {
+public:
+ explicit OwnPtrBrew(T* ptr = 0) : m_ptr(ptr) { }
+ ~OwnPtrBrew() { freeOwnedPtrBrew(m_ptr); }
+
+ T* get() const { return m_ptr; }
+ T* release()
+ {
+ T* ptr = m_ptr;
+ m_ptr = 0;
+ return ptr;
+ }
+
+ T*& outPtr()
+ {
+ ASSERT(!m_ptr);
+ return m_ptr;
+ }
+
+ void set(T* ptr)
+ {
+ ASSERT(!ptr || m_ptr != ptr);
+ freeOwnedPtrBrew(m_ptr);
+ m_ptr = ptr;
+ }
+
+ void clear()
+ {
+ freeOwnedPtrBrew(m_ptr);
+ m_ptr = 0;
+ }
+
+ T& operator*() const
+ {
+ ASSERT(m_ptr);
+ return *m_ptr;
+ }
+
+ T* operator->() const
+ {
+ ASSERT(m_ptr);
+ return m_ptr;
+ }
+
+ bool operator!() const { return !m_ptr; }
+
+ // This conversion operator allows implicit conversion to bool but not to other integer types.
+ typedef T* OwnPtrBrew::*UnspecifiedBoolType;
+ operator UnspecifiedBoolType() const { return m_ptr ? &OwnPtrBrew::m_ptr : 0; }
+
+ void swap(OwnPtrBrew& o) { std::swap(m_ptr, o.m_ptr); }
+
+private:
+ T* m_ptr;
+};
+
+template <typename T> inline void swap(OwnPtrBrew<T>& a, OwnPtrBrew<T>& b)
+{
+ a.swap(b);
+}
+
+template <typename T, typename U> inline bool operator==(const OwnPtrBrew<T>& a, U* b)
+{
+ return a.get() == b;
+}
+
+template <typename T, typename U> inline bool operator==(T* a, const OwnPtrBrew<U>& b)
+{
+ return a == b.get();
+}
+
+template <typename T, typename U> inline bool operator!=(const OwnPtrBrew<T>& a, U* b)
+{
+ return a.get() != b;
+}
+
+template <typename T, typename U> inline bool operator!=(T* a, const OwnPtrBrew<U>& b)
+{
+ return a != b.get();
+}
+
+template <typename T> inline typename OwnPtrBrew<T>::PtrType getPtr(const OwnPtrBrew<T>& p)
+{
+ return p.get();
+}
+
+} // namespace WTF
+
+using WTF::OwnPtrBrew;
+
+#endif // OwnPtrBrew_h