summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/wtf/wince
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScriptCore/wtf/wince')
-rw-r--r--JavaScriptCore/wtf/wince/FastMallocWinCE.h175
-rw-r--r--JavaScriptCore/wtf/wince/MemoryManager.cpp171
-rw-r--r--JavaScriptCore/wtf/wince/MemoryManager.h80
-rw-r--r--JavaScriptCore/wtf/wince/mt19937ar.c170
4 files changed, 0 insertions, 596 deletions
diff --git a/JavaScriptCore/wtf/wince/FastMallocWinCE.h b/JavaScriptCore/wtf/wince/FastMallocWinCE.h
deleted file mode 100644
index d91a5f2..0000000
--- a/JavaScriptCore/wtf/wince/FastMallocWinCE.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2007-2009 Torch Mobile, Inc. All rights reserved
- *
- * 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 WTF_FastMallocWinCE_h
-#define WTF_FastMallocWinCE_h
-
-#include <new.h>
-
-#ifdef __cplusplus
-#include <new>
-#include "MemoryManager.h"
-extern "C" {
-#endif
-
-void* fastMalloc(size_t n);
-void* fastCalloc(size_t n_elements, size_t element_size);
-void fastFree(void* p);
-void* fastRealloc(void* p, size_t n);
-void* fastZeroedMalloc(size_t n);
-// These functions return 0 if an allocation fails.
-void* tryFastMalloc(size_t n);
-void* tryFastZeroedMalloc(size_t n);
-void* tryFastCalloc(size_t n_elements, size_t element_size);
-void* tryFastRealloc(void* p, size_t n);
-char* fastStrDup(const char*);
-
-#ifndef NDEBUG
-void fastMallocForbid();
-void fastMallocAllow();
-#endif
-
-#if !defined(USE_SYSTEM_MALLOC) || !USE_SYSTEM_MALLOC
-
-#define malloc(n) fastMalloc(n)
-#define calloc(n_elements, element_size) fastCalloc(n_elements, element_size)
-#define realloc(p, n) fastRealloc(p, n)
-#define free(p) fastFree(p)
-#define strdup(p) fastStrDup(p)
-
-#else
-
-#define strdup(p) _strdup(p)
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#ifdef __cplusplus
-#if !defined(USE_SYSTEM_MALLOC) || !USE_SYSTEM_MALLOC
-static inline void* __cdecl operator new(size_t s) { return fastMalloc(s); }
-static inline void __cdecl operator delete(void* p) { fastFree(p); }
-static inline void* __cdecl operator new[](size_t s) { return fastMalloc(s); }
-static inline void __cdecl operator delete[](void* p) { fastFree(p); }
-static inline void* operator new(size_t s, const std::nothrow_t&) throw() { return fastMalloc(s); }
-static inline void operator delete(void* p, const std::nothrow_t&) throw() { fastFree(p); }
-static inline void* operator new[](size_t s, const std::nothrow_t&) throw() { return fastMalloc(s); }
-static inline void operator delete[](void* p, const std::nothrow_t&) throw() { fastFree(p); }
-#endif
-
-namespace WTF {
- // This defines a type which holds an unsigned integer and is the same
- // size as the minimally aligned memory allocation.
- typedef unsigned long long AllocAlignmentInteger;
-
- namespace Internal {
- enum AllocType { // Start with an unusual number instead of zero, because zero is common.
- AllocTypeMalloc = 0x375d6750, // Encompasses fastMalloc, fastZeroedMalloc, fastCalloc, fastRealloc.
- AllocTypeClassNew, // Encompasses class operator new from FastAllocBase.
- AllocTypeClassNewArray, // Encompasses class operator new[] from FastAllocBase.
- AllocTypeFastNew, // Encompasses fastNew.
- AllocTypeFastNewArray, // Encompasses fastNewArray.
- AllocTypeNew, // Encompasses global operator new.
- AllocTypeNewArray // Encompasses global operator new[].
- };
- }
-
-
-#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
-
- // Malloc validation is a scheme whereby a tag is attached to an
- // allocation which identifies how it was originally allocated.
- // This allows us to verify that the freeing operation matches the
- // allocation operation. If memory is allocated with operator new[]
- // but freed with free or delete, this system would detect that.
- // In the implementation here, the tag is an integer prepended to
- // the allocation memory which is assigned one of the AllocType
- // enumeration values. An alternative implementation of this
- // scheme could store the tag somewhere else or ignore it.
- // Users of FastMalloc don't need to know or care how this tagging
- // is implemented.
-
- namespace Internal {
-
- // Return the AllocType tag associated with the allocated block p.
- inline AllocType fastMallocMatchValidationType(const void* p)
- {
- const AllocAlignmentInteger* type = static_cast<const AllocAlignmentInteger*>(p) - 1;
- return static_cast<AllocType>(*type);
- }
-
- // Return the address of the AllocType tag associated with the allocated block p.
- inline AllocAlignmentInteger* fastMallocMatchValidationValue(void* p)
- {
- return reinterpret_cast<AllocAlignmentInteger*>(static_cast<char*>(p) - sizeof(AllocAlignmentInteger));
- }
-
- // Set the AllocType tag to be associaged with the allocated block p.
- inline void setFastMallocMatchValidationType(void* p, AllocType allocType)
- {
- AllocAlignmentInteger* type = static_cast<AllocAlignmentInteger*>(p) - 1;
- *type = static_cast<AllocAlignmentInteger>(allocType);
- }
-
- // Handle a detected alloc/free mismatch. By default this calls CRASH().
- void fastMallocMatchFailed(void* p);
-
- } // namespace Internal
-
- // This is a higher level function which is used by FastMalloc-using code.
- inline void fastMallocMatchValidateMalloc(void* p, Internal::AllocType allocType)
- {
- if (!p)
- return;
-
- Internal::setFastMallocMatchValidationType(p, allocType);
- }
-
- // This is a higher level function which is used by FastMalloc-using code.
- inline void fastMallocMatchValidateFree(void* p, Internal::AllocType allocType)
- {
- if (!p)
- return;
-
- if (Internal::fastMallocMatchValidationType(p) != allocType)
- Internal::fastMallocMatchFailed(p);
- Internal::setFastMallocMatchValidationType(p, Internal::AllocTypeMalloc); // Set it to this so that fastFree thinks it's OK.
- }
-
-#else
-
- inline void fastMallocMatchValidateMalloc(void*, Internal::AllocType)
- {
- }
-
- inline void fastMallocMatchValidateFree(void*, Internal::AllocType)
- {
- }
-
-#endif
-
-} // namespace WTF
-
-#endif
-
-#endif // WTF_FastMallocWinCE_h
diff --git a/JavaScriptCore/wtf/wince/MemoryManager.cpp b/JavaScriptCore/wtf/wince/MemoryManager.cpp
deleted file mode 100644
index 81d4f80..0000000
--- a/JavaScriptCore/wtf/wince/MemoryManager.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (C) 2008-2009 Torch Mobile 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.
- */
-
-#include "config.h"
-#include "MemoryManager.h"
-
-#undef malloc
-#undef calloc
-#undef realloc
-#undef free
-#undef strdup
-#undef _strdup
-#undef VirtualAlloc
-#undef VirtualFree
-
-#include <malloc.h>
-#include <windows.h>
-
-namespace WTF {
-
-MemoryManager* memoryManager()
-{
- static MemoryManager mm;
- return &mm;
-}
-
-MemoryManager::MemoryManager()
-: m_allocationCanFail(false)
-{
-}
-
-MemoryManager::~MemoryManager()
-{
-}
-
-HBITMAP MemoryManager::createCompatibleBitmap(HDC hdc, int width, int height)
-{
- return ::CreateCompatibleBitmap(hdc, width, height);
-}
-
-HBITMAP MemoryManager::createDIBSection(const BITMAPINFO* pbmi, void** ppvBits)
-{
- return ::CreateDIBSection(0, pbmi, DIB_RGB_COLORS, ppvBits, 0, 0);
-}
-
-void* MemoryManager::m_malloc(size_t size)
-{
- return malloc(size);
-}
-
-void* MemoryManager::m_calloc(size_t num, size_t size)
-{
- return calloc(num, size);
-}
-
-void* MemoryManager::m_realloc(void* p, size_t size)
-{
- return realloc(p, size);
-}
-
-void MemoryManager::m_free(void* p)
-{
- return free(p);
-}
-
-bool MemoryManager::resizeMemory(void*, size_t)
-{
- return false;
-}
-
-void* MemoryManager::allocate64kBlock()
-{
- return VirtualAlloc(0, 65536, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
-}
-
-void MemoryManager::free64kBlock(void* p)
-{
- VirtualFree(p, 65536, MEM_RELEASE);
-}
-
-bool MemoryManager::onIdle(DWORD& timeLimitMs)
-{
- return false;
-}
-
-LPVOID MemoryManager::virtualAlloc(LPVOID lpAddress, DWORD dwSize, DWORD flAllocationType, DWORD flProtect)
-{
- return ::VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect);
-}
-
-BOOL MemoryManager::virtualFree(LPVOID lpAddress, DWORD dwSize, DWORD dwFreeType)
-{
- return ::VirtualFree(lpAddress, dwSize, dwFreeType);
-}
-
-
-#if defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC
-
-void *fastMalloc(size_t n) { return malloc(n); }
-void *fastCalloc(size_t n_elements, size_t element_size) { return calloc(n_elements, element_size); }
-void fastFree(void* p) { return free(p); }
-void *fastRealloc(void* p, size_t n) { return realloc(p, n); }
-
-#else
-
-void *fastMalloc(size_t n) { return MemoryManager::m_malloc(n); }
-void *fastCalloc(size_t n_elements, size_t element_size) { return MemoryManager::m_calloc(n_elements, element_size); }
-void fastFree(void* p) { return MemoryManager::m_free(p); }
-void *fastRealloc(void* p, size_t n) { return MemoryManager::m_realloc(p, n); }
-
-#endif
-
-#ifndef NDEBUG
-void fastMallocForbid() {}
-void fastMallocAllow() {}
-#endif
-
-void* fastZeroedMalloc(size_t n)
-{
- void* p = fastMalloc(n);
- if (p)
- memset(p, 0, n);
- return p;
-}
-
-TryMallocReturnValue tryFastMalloc(size_t n)
-{
- MemoryAllocationCanFail canFail;
- return fastMalloc(n);
-}
-
-TryMallocReturnValue tryFastZeroedMalloc(size_t n)
-{
- MemoryAllocationCanFail canFail;
- return fastZeroedMalloc(n);
-}
-
-TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size)
-{
- MemoryAllocationCanFail canFail;
- return fastCalloc(n_elements, element_size);
-}
-
-TryMallocReturnValue tryFastRealloc(void* p, size_t n)
-{
- MemoryAllocationCanFail canFail;
- return fastRealloc(p, n);
-}
-
-char* fastStrDup(const char* str)
-{
- return _strdup(str);
-}
-
-} \ No newline at end of file
diff --git a/JavaScriptCore/wtf/wince/MemoryManager.h b/JavaScriptCore/wtf/wince/MemoryManager.h
deleted file mode 100644
index f405612..0000000
--- a/JavaScriptCore/wtf/wince/MemoryManager.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2008-2009 Torch Mobile 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.
- */
-
-#pragma once
-
-#include <winbase.h>
-
-typedef struct HBITMAP__* HBITMAP;
-typedef struct HDC__* HDC;
-typedef void *HANDLE;
-typedef struct tagBITMAPINFO BITMAPINFO;
-
-namespace WTF {
-
- class MemoryManager {
- public:
- MemoryManager();
- ~MemoryManager();
-
- bool allocationCanFail() const { return m_allocationCanFail; }
- void setAllocationCanFail(bool c) { m_allocationCanFail = c; }
-
- static HBITMAP createCompatibleBitmap(HDC hdc, int width, int height);
- static HBITMAP createDIBSection(const BITMAPINFO* pbmi, void** ppvBits);
- static void* m_malloc(size_t size);
- static void* m_calloc(size_t num, size_t size);
- static void* m_realloc(void* p, size_t size);
- static void m_free(void*);
- static bool resizeMemory(void* p, size_t newSize);
- static void* allocate64kBlock();
- static void free64kBlock(void*);
- static bool onIdle(DWORD& timeLimitMs);
- static LPVOID virtualAlloc(LPVOID lpAddress, DWORD dwSize, DWORD flAllocationType, DWORD flProtect);
- static BOOL virtualFree(LPVOID lpAddress, DWORD dwSize, DWORD dwFreeType);
-
- private:
- friend MemoryManager* memoryManager();
-
- bool m_allocationCanFail;
- };
-
- MemoryManager* memoryManager();
-
- class MemoryAllocationCanFail {
- public:
- MemoryAllocationCanFail() : m_old(memoryManager()->allocationCanFail()) { memoryManager()->setAllocationCanFail(true); }
- ~MemoryAllocationCanFail() { memoryManager()->setAllocationCanFail(m_old); }
- private:
- bool m_old;
- };
-
- class MemoryAllocationCannotFail {
- public:
- MemoryAllocationCannotFail() : m_old(memoryManager()->allocationCanFail()) { memoryManager()->setAllocationCanFail(false); }
- ~MemoryAllocationCannotFail() { memoryManager()->setAllocationCanFail(m_old); }
- private:
- bool m_old;
- };
-}
-
-using WTF::MemoryManager;
-using WTF::memoryManager;
-using WTF::MemoryAllocationCanFail;
-using WTF::MemoryAllocationCannotFail;
diff --git a/JavaScriptCore/wtf/wince/mt19937ar.c b/JavaScriptCore/wtf/wince/mt19937ar.c
deleted file mode 100644
index 4715958..0000000
--- a/JavaScriptCore/wtf/wince/mt19937ar.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- A C-program for MT19937, with initialization improved 2002/1/26.
- Coded by Takuji Nishimura and Makoto Matsumoto.
-
- Before using, initialize the state by using init_genrand(seed)
- or init_by_array(init_key, key_length).
-
- Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
- 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.
-
- 3. The names of its contributors may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT OWNER 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.
-
-
- Any feedback is very welcome.
- http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
- email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
-*/
-
-#include <stdio.h>
-
-/* Period parameters */
-#define N 624
-#define M 397
-#define MATRIX_A 0x9908b0dfUL /* constant vector a */
-#define UPPER_MASK 0x80000000UL /* most significant w-r bits */
-#define LOWER_MASK 0x7fffffffUL /* least significant r bits */
-
-static unsigned long mt[N]; /* the array for the state vector */
-static int mti=N+1; /* mti==N+1 means mt[N] is not initialized */
-
-/* initializes mt[N] with a seed */
-void init_genrand(unsigned long s)
-{
- mt[0]= s & 0xffffffffUL;
- for (mti=1; mti<N; mti++) {
- mt[mti] = (1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
- /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
- /* In the previous versions, MSBs of the seed affect */
- /* only MSBs of the array mt[]. */
- /* 2002/01/09 modified by Makoto Matsumoto */
- mt[mti] &= 0xffffffffUL;
- /* for >32 bit machines */
- }
-}
-
-/* initialize by an array with array-length */
-/* init_key is the array for initializing keys */
-/* key_length is its length */
-/* slight change for C++, 2004/2/26 */
-void init_by_array(unsigned long init_key[],int key_length)
-{
- int i, j, k;
- init_genrand(19650218UL);
- i=1; j=0;
- k = (N>key_length ? N : key_length);
- for (; k; k--) {
- mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525UL))
- + init_key[j] + j; /* non linear */
- mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
- i++; j++;
- if (i>=N) { mt[0] = mt[N-1]; i=1; }
- if (j>=key_length) j=0;
- }
- for (k=N-1; k; k--) {
- mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941UL))
- - i; /* non linear */
- mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
- i++;
- if (i>=N) { mt[0] = mt[N-1]; i=1; }
- }
-
- mt[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */
-}
-
-/* generates a random number on [0,0xffffffff]-interval */
-unsigned long genrand_int32(void)
-{
- unsigned long y;
- static unsigned long mag01[2]={0x0UL, MATRIX_A};
- /* mag01[x] = x * MATRIX_A for x=0,1 */
-
- if (mti >= N) { /* generate N words at one time */
- int kk;
-
- if (mti == N+1) /* if init_genrand() has not been called, */
- init_genrand(5489UL); /* a default initial seed is used */
-
- for (kk=0;kk<N-M;kk++) {
- y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1UL];
- }
- for (;kk<N-1;kk++) {
- y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1UL];
- }
- y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1UL];
-
- mti = 0;
- }
-
- y = mt[mti++];
-
- /* Tempering */
- y ^= (y >> 11);
- y ^= (y << 7) & 0x9d2c5680UL;
- y ^= (y << 15) & 0xefc60000UL;
- y ^= (y >> 18);
-
- return y;
-}
-
-/* generates a random number on [0,0x7fffffff]-interval */
-long genrand_int31(void)
-{
- return (long)(genrand_int32()>>1);
-}
-
-/* generates a random number on [0,1]-real-interval */
-double genrand_real1(void)
-{
- return genrand_int32()*(1.0/4294967295.0);
- /* divided by 2^32-1 */
-}
-
-/* generates a random number on [0,1)-real-interval */
-double genrand_real2(void)
-{
- return genrand_int32()*(1.0/4294967296.0);
- /* divided by 2^32 */
-}
-
-/* generates a random number on (0,1)-real-interval */
-double genrand_real3(void)
-{
- return (((double)genrand_int32()) + 0.5)*(1.0/4294967296.0);
- /* divided by 2^32 */
-}
-
-/* generates a random number on [0,1) with 53-bit resolution*/
-double genrand_res53(void)
-{
- unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;
- return(a*67108864.0+b)*(1.0/9007199254740992.0);
-}