rework JSC endian and bitness detection

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2020-11-21 00:01:40 +00:00
parent af26221080
commit 9ba355d55f
21 changed files with 31 additions and 668 deletions

View file

@ -47,7 +47,7 @@ apt-get install --yes git crossbuild-essential-$crossarch qemu-user-static
git clone --depth=1 git://github.com/fluxer/katie
cd katie
ln -sv package/debian .
apt-get build-dep -a $crossarch .
apt-get build-dep --yes -a $crossarch .
dpkg-buildpackage -uc -nc -b --no-sign -a $crossarch
EOF
chmod -v +x "$crossdir/crossbuild.sh"

View file

@ -376,19 +376,6 @@ inline bool isPointerAligned(void* p)
// Cell size needs to be a power of two for isPossibleCell to be valid.
COMPILE_ASSERT(sizeof(CollectorCell) % 2 == 0, Collector_cell_size_is_power_of_two);
#if USE(JSVALUE32)
static bool isHalfCellAligned(void *p)
{
return (((intptr_t)(p) & (CELL_MASK >> 1)) == 0);
}
static inline bool isPossibleCell(void* p)
{
return isHalfCellAligned(p) && p;
}
#else
static inline bool isCellAligned(void *p)
{
return (((intptr_t)(p) & CELL_MASK) == 0);
@ -398,7 +385,6 @@ static inline bool isPossibleCell(void* p)
{
return isCellAligned(p) && p;
}
#endif // USE(JSVALUE32)
void Heap::markConservatively(MarkStack& markStack, void* start, void* end)
{
@ -448,7 +434,7 @@ void NEVER_INLINE Heap::markCurrentThreadConservativelyInternal(MarkStack& markS
markConservatively(markStack, stackPointer, stackBase);
}
#if COMPILER(GCC)
#if defined(Q_CC_GNU)
#define REGISTER_BUFFER_ALIGNMENT __attribute__ ((aligned (sizeof(void*))))
#else
#define REGISTER_BUFFER_ALIGNMENT
@ -653,10 +639,6 @@ static const char* typeName(JSCell* cell)
{
if (cell->isString())
return "string";
#if USE(JSVALUE32)
if (cell->isNumber())
return "number";
#endif
if (cell->isGetterSetter())
return "gettersetter";
if (cell->isAPIValueWrapper())

View file

@ -158,11 +158,7 @@ namespace JSC {
const size_t BLOCK_OFFSET_MASK = BLOCK_SIZE - 1;
const size_t BLOCK_MASK = ~BLOCK_OFFSET_MASK;
// cell size needs to be a power of two for certain optimizations in collector.cpp
#if USE(JSVALUE32)
const size_t MINIMUM_CELL_SIZE = 32;
#else
const size_t MINIMUM_CELL_SIZE = 64;
#endif
const size_t CELL_ARRAY_LENGTH = (MINIMUM_CELL_SIZE / sizeof(double)) + (MINIMUM_CELL_SIZE % sizeof(double) != 0 ? sizeof(double) : 0);
const size_t CELL_SIZE = CELL_ARRAY_LENGTH * sizeof(double);
const size_t SMALL_CELL_SIZE = CELL_SIZE / 2;

View file

@ -33,8 +33,6 @@
namespace JSC {
extern const double NaN;
class DateInstanceData : public RefCounted<DateInstanceData> {
public:
static PassRefPtr<DateInstanceData> create() { return adoptRef(new DateInstanceData); }
@ -46,8 +44,8 @@ namespace JSC {
private:
DateInstanceData()
: m_gregorianDateTimeCachedForMS(NaN)
, m_gregorianDateTimeUTCCachedForMS(NaN)
: m_gregorianDateTimeCachedForMS(NAN)
, m_gregorianDateTimeUTCCachedForMS(NAN)
{
}
};
@ -62,7 +60,7 @@ namespace JSC {
void reset()
{
for (size_t i = 0; i < cacheSize; ++i)
m_cache[i].key = NaN;
m_cache[i].key = NAN;
}
DateInstanceData* add(double d)

View file

@ -29,52 +29,6 @@
namespace JSC {
#if defined NAN && defined INFINITY
extern const double NaN = NAN;
extern const double Inf = INFINITY;
#else // !(defined NAN && defined INFINITY)
// The trick is to define the NaN and Inf globals with a different type than the declaration.
// This trick works because the mangled name of the globals does not include the type, although
// I'm not sure that's guaranteed. There could be alignment issues with this, since arrays of
// characters don't necessarily need the same alignment doubles do, but for now it seems to work.
// It would be good to figure out a 100% clean way that still avoids code that runs at init time.
// Note, we have to use union to ensure alignment. Otherwise, NaN_Bytes can start anywhere,
// while NaN_double has to be 4-byte aligned for 32-bits.
// With -fstrict-aliasing enabled, unions are the only safe way to do type masquerading.
static const union {
struct {
unsigned char NaN_Bytes[8];
unsigned char Inf_Bytes[8];
} bytes;
struct {
double NaN_Double;
double Inf_Double;
} doubles;
} NaNInf = { {
#if CPU(BIG_ENDIAN)
{ 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 },
{ 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }
#elif CPU(MIDDLE_ENDIAN)
{ 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 },
{ 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 }
#else
{ 0, 0, 0, 0, 0, 0, 0xf8, 0x7f },
{ 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }
#endif
} } ;
extern const double NaN = NaNInf.doubles.NaN_Double;
extern const double Inf = NaNInf.doubles.Inf_Double;
#endif // !(defined NAN && defined INFINITY)
bool JSCell::getUInt32(uint32_t&) const
{
return false;

View file

@ -55,9 +55,6 @@ namespace JSC {
}
// Querying the type.
#if USE(JSVALUE32)
bool isNumber() const;
#endif
bool isString() const;
bool isObject() const;
virtual bool isGetterSetter() const;
@ -130,13 +127,6 @@ namespace JSC {
{
}
#if USE(JSVALUE32)
inline bool JSCell::isNumber() const
{
return m_structure->typeInfo().type() == NumberType;
}
#endif
inline bool JSCell::isObject() const
{
return m_structure->typeInfo().type() == ObjectType;

View file

@ -114,9 +114,6 @@ JSGlobalData::JSGlobalData(bool isShared)
, getterSetterStructure(GetterSetter::createStructure(jsNull()))
, apiWrapperStructure(JSAPIValueWrapper::createStructure(jsNull()))
, dummyMarkableCellStructure(JSCell::createDummyStructure())
#if USE(JSVALUE32)
, numberStructure(JSNumberCell::createStructure(jsNull()))
#endif
, identifierTable(createIdentifierTable())
, propertyNames(new CommonIdentifiers(this))
, emptyList(new MarkedArgumentBuffer)

View file

@ -120,10 +120,6 @@ namespace JSC {
RefPtr<Structure> apiWrapperStructure;
RefPtr<Structure> dummyMarkableCellStructure;
#if USE(JSVALUE32)
RefPtr<Structure> numberStructure;
#endif
static void storeVPtrs();
static void* jsArrayVPtr;
static void* jsByteArrayVPtr;

View file

@ -352,17 +352,8 @@ namespace JSC {
{
if (typeInfo().type() == ObjectType)
return m_prototype;
#if USE(JSVALUE32)
if (typeInfo().type() == StringType)
return exec->lexicalGlobalObject()->stringPrototype();
Q_ASSERT(typeInfo().type() == NumberType);
return exec->lexicalGlobalObject()->numberPrototype();
#else
Q_ASSERT(typeInfo().type() == StringType);
return exec->lexicalGlobalObject()->stringPrototype();
#endif
}
inline StructureChain* Structure::prototypeChain(ExecState* exec) const

View file

@ -23,80 +23,6 @@
#include "Platform.h"
#include "JSNumberCell.h"
#if USE(JSVALUE32)
#include "NumberObject.h"
#include "UString.h"
namespace JSC {
JSValue JSNumberCell::toPrimitive(ExecState*, PreferredPrimitiveType) const
{
return const_cast<JSNumberCell*>(this);
}
bool JSNumberCell::getPrimitiveNumber(ExecState*, double& number, JSValue& value)
{
number = m_value;
value = this;
return true;
}
bool JSNumberCell::toBoolean(ExecState*) const
{
return m_value < 0.0 || m_value > 0.0; // false for NaN
}
double JSNumberCell::toNumber(ExecState*) const
{
return m_value;
}
UString JSNumberCell::toString(ExecState*) const
{
return UString::from(m_value);
}
UString JSNumberCell::toThisString(ExecState*) const
{
return UString::from(m_value);
}
JSObject* JSNumberCell::toObject(ExecState* exec) const
{
return constructNumber(exec, const_cast<JSNumberCell*>(this));
}
JSObject* JSNumberCell::toThisObject(ExecState* exec) const
{
return constructNumber(exec, const_cast<JSNumberCell*>(this));
}
bool JSNumberCell::getUInt32(uint32_t& uint32) const
{
uint32 = static_cast<uint32_t>(m_value);
return uint32 == m_value;
}
JSValue JSNumberCell::getJSNumber()
{
return this;
}
JSValue jsNumberCell(ExecState* exec, double d)
{
return new (exec) JSNumberCell(exec, d);
}
JSValue jsNumberCell(JSGlobalData* globalData, double d)
{
return new (globalData) JSNumberCell(globalData, d);
}
} // namespace JSC
#else // USE(JSVALUE32)
// Keep our exported symbols lists happy.
namespace JSC {
@ -113,5 +39,3 @@ JSValue jsNumberCell(JSGlobalData*, double)
}
} // namespace JSC
#endif // USE(JSVALUE32)

View file

@ -32,169 +32,8 @@
namespace JSC {
extern const double NaN;
extern const double Inf;
#if USE(JSVALUE32)
JSValue jsNumberCell(ExecState*, double);
class Identifier;
class JSCell;
class JSObject;
class JSString;
class PropertySlot;
struct ClassInfo;
struct Instruction;
class JSNumberCell : public JSCell {
friend JSValue jsNumberCell(JSGlobalData*, double);
friend JSValue jsNumberCell(ExecState*, double);
public:
double value() const { return m_value; }
virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value);
virtual bool toBoolean(ExecState*) const;
virtual double toNumber(ExecState*) const;
virtual UString toString(ExecState*) const;
virtual JSObject* toObject(ExecState*) const;
virtual UString toThisString(ExecState*) const;
virtual JSObject* toThisObject(ExecState*) const;
virtual JSValue getJSNumber();
void* operator new(size_t size, ExecState* exec)
{
return exec->heap()->allocateNumber(size);
}
void* operator new(size_t size, JSGlobalData* globalData)
{
return globalData->heap.allocateNumber(size);
}
static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(NumberType, OverridesGetOwnPropertySlot | NeedsThisConversion)); }
private:
JSNumberCell(JSGlobalData* globalData, double value)
: JSCell(globalData->numberStructure.get())
, m_value(value)
{
}
JSNumberCell(ExecState* exec, double value)
: JSCell(exec->globalData().numberStructure.get())
, m_value(value)
{
}
virtual bool getUInt32(uint32_t&) const;
double m_value;
};
JSValue jsNumberCell(JSGlobalData*, double);
inline bool isNumberCell(JSValue v)
{
return v.isCell() && v.asCell()->isNumber();
}
inline JSNumberCell* asNumberCell(JSValue v)
{
Q_ASSERT(isNumberCell(v));
return static_cast<JSNumberCell*>(v.asCell());
}
ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, ExecState* exec, double d)
{
*this = jsNumberCell(exec, d);
}
inline JSValue::JSValue(ExecState* exec, double d)
{
JSValue v = JSImmediate::from(d);
*this = v ? v : jsNumberCell(exec, d);
}
inline JSValue::JSValue(ExecState* exec, int i)
{
JSValue v = JSImmediate::from(i);
*this = v ? v : jsNumberCell(exec, i);
}
inline JSValue::JSValue(ExecState* exec, unsigned i)
{
JSValue v = JSImmediate::from(i);
*this = v ? v : jsNumberCell(exec, i);
}
inline JSValue::JSValue(ExecState* exec, long i)
{
JSValue v = JSImmediate::from(i);
*this = v ? v : jsNumberCell(exec, i);
}
inline JSValue::JSValue(ExecState* exec, unsigned long i)
{
JSValue v = JSImmediate::from(i);
*this = v ? v : jsNumberCell(exec, i);
}
inline JSValue::JSValue(ExecState* exec, long long i)
{
JSValue v = JSImmediate::from(i);
*this = v ? v : jsNumberCell(exec, static_cast<double>(i));
}
inline JSValue::JSValue(ExecState* exec, unsigned long long i)
{
JSValue v = JSImmediate::from(i);
*this = v ? v : jsNumberCell(exec, static_cast<double>(i));
}
inline JSValue::JSValue(JSGlobalData* globalData, double d)
{
JSValue v = JSImmediate::from(d);
*this = v ? v : jsNumberCell(globalData, d);
}
inline JSValue::JSValue(JSGlobalData* globalData, int i)
{
JSValue v = JSImmediate::from(i);
*this = v ? v : jsNumberCell(globalData, i);
}
inline JSValue::JSValue(JSGlobalData* globalData, unsigned i)
{
JSValue v = JSImmediate::from(i);
*this = v ? v : jsNumberCell(globalData, i);
}
inline bool JSValue::isDouble() const
{
return isNumberCell(asValue());
}
inline double JSValue::asDouble() const
{
return asNumberCell(asValue())->value();
}
inline bool JSValue::isNumber() const
{
return JSImmediate::isNumber(asValue()) || isDouble();
}
inline double JSValue::uncheckedGetNumber() const
{
Q_ASSERT(isNumber());
return JSImmediate::isImmediate(asValue()) ? JSImmediate::toDouble(asValue()) : asDouble();
}
#endif // USE(JSVALUE32)
const double NaN = NAN;
const double Inf = INFINITY;
#if USE(JSVALUE64)
ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, ExecState*, double d)
@ -293,10 +132,6 @@ namespace JSC {
return JSImmediate::toDouble(asValue());
}
#endif // USE(JSVALUE64)
#if USE(JSVALUE32) || USE(JSVALUE64)
inline JSValue::JSValue(ExecState*, char i)
{
Q_ASSERT(JSImmediate::from(i));
@ -350,8 +185,7 @@ namespace JSC {
}
return true;
}
#endif // USE(JSVALUE32) || USE(JSVALUE64)
#endif // USE(JSVALUE64)
} // namespace JSC

View file

@ -237,9 +237,6 @@ namespace JSC {
void getString(ExecState* exec);
void isObject();
void isString();
#if USE(JSVALUE32)
void isNumber();
#endif
ConstPropertyStorage propertyStorage() const { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); }
PropertyStorage propertyStorage() { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); }
@ -288,9 +285,7 @@ inline JSObject::JSObject(NonNullPassRefPtr<Structure> structure)
Q_ASSERT(m_structure->propertyStorageCapacity() == inlineStorageCapacity);
Q_ASSERT(m_structure->isEmpty());
Q_ASSERT(prototype().isNull() || Heap::heap(this) == Heap::heap(prototype()));
#if USE(JSVALUE64) || USE(JSVALUE32_64)
Q_ASSERT(OBJECT_OFFSETOF(JSObject, m_inlineStorage) % sizeof(double) == 0);
#endif
}
inline JSObject::~JSObject()

View file

@ -233,7 +233,7 @@ namespace JSC {
union {
EncodedJSValue asEncodedJSValue;
double asDouble;
#if CPU(BIG_ENDIAN)
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
struct {
int32_t tag;
int32_t payload;

View file

@ -37,11 +37,7 @@ namespace JSC {
}
protected:
#if USE(JSVALUE32)
static const unsigned StructureFlags = OverridesMarkChildren | JSWrapperObject::StructureFlags;
#else
static const unsigned StructureFlags = JSWrapperObject::StructureFlags;
#endif
private:
virtual const ClassInfo* classInfo() const { return &info; }

View file

@ -21,7 +21,7 @@
#include "Platform.h"
#ifndef ALWAYS_INLINE
#if COMPILER(GCC) && defined(QT_NO_DEBUG)
#if defined(Q_CC_GNU) && defined(QT_NO_DEBUG)
#define ALWAYS_INLINE inline __attribute__((__always_inline__))
#else
#define ALWAYS_INLINE inline
@ -29,7 +29,7 @@
#endif
#ifndef NEVER_INLINE
#if COMPILER(GCC)
#if defined(Q_CC_GNU)
#define NEVER_INLINE __attribute__((__noinline__))
#else
#define NEVER_INLINE
@ -37,7 +37,7 @@
#endif
#ifndef NO_RETURN
#if COMPILER(GCC)
#if defined(Q_CC_GNU)
#define NO_RETURN __attribute((__noreturn__))
#else
#define NO_RETURN

View file

@ -38,13 +38,6 @@
} while(false)
/* COMPILE_ASSERT */
#if COMPILER_SUPPORTS(C_STATIC_ASSERT)
/* Unlike static_assert below, this also works in plain C code. */
#define COMPILE_ASSERT(exp, name) _Static_assert((exp), #name)
#elif COMPILER_SUPPORTS(CXX_STATIC_ASSERT)
#define COMPILE_ASSERT(exp, name) static_assert((exp), #name)
#else
#define COMPILE_ASSERT(exp, name) typedef int dummy##name [(exp) ? 1 : -1]
#endif
#endif /* WTF_Assertions_h */

View file

@ -33,13 +33,6 @@ QT_USE_NAMESPACE
/* ==== Platform adaptation macros: these describe properties of the target environment. ==== */
/* COMPILER() - the compiler being used to build the project */
#define COMPILER(WTF_FEATURE) (defined WTF_COMPILER_##WTF_FEATURE && WTF_COMPILER_##WTF_FEATURE)
/* COMPILER_SUPPORTS() - whether the compiler being used to build the project supports the given feature. */
#define COMPILER_SUPPORTS(WTF_COMPILER_FEATURE) (defined WTF_COMPILER_SUPPORTS_##WTF_COMPILER_FEATURE && WTF_COMPILER_SUPPORTS_##WTF_COMPILER_FEATURE)
/* CPU() - the target CPU architecture */
#define CPU(WTF_FEATURE) (defined WTF_CPU_##WTF_FEATURE && WTF_CPU_##WTF_FEATURE)
/* HAVE() - specific system features (headers, functions or similar) that are present or not */
#define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE && HAVE_##WTF_FEATURE)
@ -50,269 +43,6 @@ QT_USE_NAMESPACE
/* ENABLE() - turn on a specific feature of WebKit */
#define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE && ENABLE_##WTF_FEATURE)
/* ==== COMPILER() - the compiler being used to build the project ==== */
/* COMPILER(CLANG) - Clang */
#if defined(__clang__)
#define WTF_COMPILER_CLANG 1
#define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT __has_feature(c_static_assert)
#define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT __has_feature(cxx_static_assert)
#endif
/* COMPILER(GCC) - GNU Compiler Collection */
#if defined(__GNUC__)
#define WTF_COMPILER_GCC 1
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#define GCC_VERSION_AT_LEAST(major, minor, patch) (GCC_VERSION >= (major * 10000 + minor * 100 + patch))
#else
/* Define this for !GCC compilers, just so we can write things like GCC_VERSION_AT_LEAST(4, 1, 0). */
#define GCC_VERSION_AT_LEAST(major, minor, patch) 0
#endif
/* Specific compiler features */
#if COMPILER(GCC) && !COMPILER(CLANG)
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
/* C11 support */
#define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT 1
#endif
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplusplus >= 201103L)
/* C++11 support */
#if GCC_VERSION_AT_LEAST(4, 3, 0)
#define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT 1
#endif
#endif /* defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplusplus >= 201103L) */
#endif /* COMPILER(GCC) */
/* ==== CPU() - the target CPU architecture ==== */
/* This also defines CPU(BIG_ENDIAN) or CPU(MIDDLE_ENDIAN) or neither, as appropriate. */
/* CPU(ALPHA) - DEC Alpha */
#if defined(__alpha__)
#define WTF_CPU_ALPHA 1
#endif
/* CPU(IA64) - Itanium / IA-64 */
#if defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
#define WTF_CPU_IA64 1
/* 32-bit mode on Itanium */
#if !defined(__LP64__)
#define WTF_CPU_IA64_32 1
#endif
/* Itanium can be both big- and little-endian;
we need to determine at compile time which one it is.
- HP's aCC compiler only compiles big-endian (so HP-UXi is always big-endian)
- GCC defines __BIG_ENDIAN__ for us (default on HP-UX)
- Linux is usually little-endian
*/
#if defined(__BIG_ENDIAN__) || defined(__HP_aCC)
# define WTF_CPU_BIG_ENDIAN 1
#endif
#endif
/* CPU(HPPA) - a.k.a. PA-RISC */
#if defined(__hppa) || defined(__hppa__)
#define WTF_CPU_HPPA 1
#define WTF_CPU_BIG_ENDIAN 1
#endif
/* CPU(PPC) - PowerPC 32-bit */
#if defined(__ppc__) \
|| defined(__PPC__) \
|| defined(__powerpc__) \
|| defined(__powerpc) \
|| defined(__POWERPC__) \
|| defined(_M_PPC) \
|| defined(__PPC)
#define WTF_CPU_PPC 1
#define WTF_CPU_BIG_ENDIAN 1
#endif
/* CPU(PPC64) - PowerPC 64-bit */
#if defined(__ppc64__) \
|| defined(__PPC64__)
#define WTF_CPU_PPC64 1
#define WTF_CPU_BIG_ENDIAN 1
#endif
/* CPU(SH4) - SuperH SH-4 */
#if defined(__SH4__)
#define WTF_CPU_SH4 1
#endif
/* CPU(SPARC32) - SPARC 32-bit */
#if defined(__sparc) && !defined(__arch64__) || defined(__sparcv8)
#define WTF_CPU_SPARC32 1
#define WTF_CPU_BIG_ENDIAN 1
#endif
/* CPU(SPARC64) - SPARC 64-bit */
#if defined(__sparc__) && defined(__arch64__) || defined (__sparcv9)
#define WTF_CPU_SPARC64 1
#define WTF_CPU_BIG_ENDIAN 1
#endif
/* CPU(SPARC) - any SPARC, true for CPU(SPARC32) and CPU(SPARC64) */
#if CPU(SPARC32) || CPU(SPARC64)
#define WTF_CPU_SPARC 1
#endif
/* CPU(X86) - i386 / x86 32-bit */
#if defined(__i386__) \
|| defined(i386) \
|| defined(_M_IX86) \
|| defined(_X86_) \
|| defined(__THW_INTEL)
#define WTF_CPU_X86 1
#endif
/* CPU(X86_64) - AMD64 / Intel64 / x86_64 64-bit */
#if defined(__x86_64__) \
|| defined(_M_X64)
#define WTF_CPU_X86_64 1
#endif
/* CPU(AARCH64) - AArch64 */
#if defined(__aarch64__)
#define WTF_CPU_AARCH64 1
#if defined(__AARCH64EB__)
#define WTF_CPU_BIG_ENDIAN 1
#endif
#endif
/* CPU(ARM) - ARM, any version*/
#if defined(arm) \
|| defined(__arm__) \
|| defined(__MARM__)
#define WTF_CPU_ARM 1
#if defined(__ARMEB__)
#define WTF_CPU_BIG_ENDIAN 1
#elif !defined(__ARM_EABI__) \
&& !defined(__EABI__) \
&& !defined(__VFP_FP__)
#define WTF_CPU_MIDDLE_ENDIAN 1
#endif
#define WTF_ARM_ARCH_AT_LEAST(N) (CPU(ARM) && WTF_ARM_ARCH_VERSION >= N)
/* Set WTF_ARM_ARCH_VERSION */
#if defined(__ARM_ARCH_4__) \
|| defined(__ARM_ARCH_4T__) \
|| defined(__MARM_ARMV4__) \
|| defined(_ARMV4I_)
#define WTF_ARM_ARCH_VERSION 4
#elif defined(__ARM_ARCH_5__) \
|| defined(__ARM_ARCH_5T__) \
|| defined(__ARM_ARCH_5E__) \
|| defined(__ARM_ARCH_5TE__) \
|| defined(__ARM_ARCH_5TEJ__) \
|| defined(__MARM_ARMV5__)
#define WTF_ARM_ARCH_VERSION 5
#elif defined(__ARM_ARCH_6__) \
|| defined(__ARM_ARCH_6J__) \
|| defined(__ARM_ARCH_6K__) \
|| defined(__ARM_ARCH_6Z__) \
|| defined(__ARM_ARCH_6ZK__) \
|| defined(__ARM_ARCH_6T2__) \
|| defined(__ARMV6__)
#define WTF_ARM_ARCH_VERSION 6
#elif defined(__ARM_ARCH_7A__) \
|| defined(__ARM_ARCH_7R__)
#define WTF_ARM_ARCH_VERSION 7
#else
#define WTF_ARM_ARCH_VERSION 0
#endif
/* Set WTF_THUMB_ARCH_VERSION */
#if defined(__ARM_ARCH_4T__)
#define WTF_THUMB_ARCH_VERSION 1
#elif defined(__ARM_ARCH_5T__) \
|| defined(__ARM_ARCH_5TE__) \
|| defined(__ARM_ARCH_5TEJ__)
#define WTF_THUMB_ARCH_VERSION 2
#elif defined(__ARM_ARCH_6J__) \
|| defined(__ARM_ARCH_6K__) \
|| defined(__ARM_ARCH_6Z__) \
|| defined(__ARM_ARCH_6ZK__) \
|| defined(__ARM_ARCH_6M__)
#define WTF_THUMB_ARCH_VERSION 3
#elif defined(__ARM_ARCH_6T2__) \
|| defined(__ARM_ARCH_7__) \
|| defined(__ARM_ARCH_7A__) \
|| defined(__ARM_ARCH_7R__) \
|| defined(__ARM_ARCH_7M__)
#define WTF_THUMB_ARCH_VERSION 4
#else
#define WTF_THUMB_ARCH_VERSION 0
#endif
/* CPU(ARMV5_OR_LOWER) - ARM instruction set v5 or earlier */
/* On ARMv5 and below the natural alignment is required.
And there are some other differences for v5 or earlier. */
#if !defined(ARMV5_OR_LOWER) && !WTF_ARM_ARCH_AT_LEAST(6)
#define WTF_CPU_ARMV5_OR_LOWER 1
#endif
/* CPU(ARM_TRADITIONAL) - Thumb2 is not available, only traditional ARM (v4 or greater) */
/* CPU(ARM_THUMB2) - Thumb2 instruction set is available */
/* Only one of these will be defined. */
#if !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2)
# if defined(thumb2) || defined(__thumb2__) \
|| ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4)
# define WTF_CPU_ARM_TRADITIONAL 0
# define WTF_CPU_ARM_THUMB2 1
# elif WTF_ARM_ARCH_AT_LEAST(4)
# define WTF_CPU_ARM_TRADITIONAL 1
# define WTF_CPU_ARM_THUMB2 0
# else
# error "Not supported ARM architecture"
# endif
#elif CPU(ARM_TRADITIONAL) && CPU(ARM_THUMB2) /* Sanity Check */
# error "Cannot use both of WTF_CPU_ARM_TRADITIONAL and WTF_CPU_ARM_THUMB2 platforms"
#endif /* !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) */
#endif /* ARM */
/* CPU(MIPS) - MIPS, any version */
#if (defined(mips) || defined(__mips__) || defined(MIPS) || defined(_MIPS_))
#define WTF_CPU_MIPS 1
#include <sgidefs.h>
#if defined(__MIPSEB__)
#define WTF_CPU_BIG_ENDIAN 1
#endif
/* CPU(MIPS64) - MIPS 64-bit both BIG and LITTLE endian */
#if defined(_MIPS_SIM_ABI64) && (_MIPS_SIM == _MIPS_SIM_ABI64)
#define WTF_CPU_MIPS64 1
#endif
/* CPU(MIPSN32) - MIPS N32 ABI both BIG and LITTLE endian */
#if defined(_MIPS_SIM_ABIN32) && (_MIPS_SIM == _MIPS_SIM_ABIN32)
#define WTF_CPU_MIPSN32 1
#endif
/* CPU(MIPS32) - MIPS O32 ABI both BIG and LITTLE endian */
#if defined(_MIPS_SIM_ABI32) && (_MIPS_SIM == _MIPS_SIM_ABI32)
#define WTF_CPU_MIPS32 1
#endif
#endif /* __mips__ */
/* Operating environments */
#if defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD)
@ -350,15 +80,13 @@ QT_USE_NAMESPACE
#define ENABLE_SAMPLING_THREAD 1
#endif
#if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64)
#if CPU(X86_64) || (CPU(IA64) && !CPU(IA64_32)) || CPU(ALPHA) || CPU(SPARC64) || CPU(MIPS64) || CPU(AARCH64)
#if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64)
#if QT_POINTER_SIZE == 8
#define WTF_USE_JSVALUE64 1
#elif CPU(ARM) || CPU(PPC64)
#define WTF_USE_JSVALUE32 1
#else
#define WTF_USE_JSVALUE32_64 1
#endif
#endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64) */
#endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64) */
#define ENABLE_JSC_ZOMBIES 0

View file

@ -32,14 +32,14 @@
namespace WTF {
// WTF_ALIGN_OF / WTF_ALIGNED
#if COMPILER(GCC)
#if defined(Q_CC_GNU)
#define WTF_ALIGN_OF(type) __alignof__(type)
#define WTF_ALIGNED(variable_type, variable, n) variable_type variable __attribute__((__aligned__(n)))
#else
#define WTF_ALIGN_OF(type) 0
#endif
#if COMPILER(GCC)
#if defined(Q_CC_GNU)
typedef char __attribute__((__may_alias__)) AlignedBufferChar;
#else
typedef char AlignedBufferChar;

View file

@ -153,18 +153,16 @@
#include <stdio.h>
#include <float.h>
#if CPU(BIG_ENDIAN)
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
#define IEEE_MC68k
#elif CPU(MIDDLE_ENDIAN)
#define IEEE_ARM
#else
#define IEEE_8087
#endif
#define INFNAN_CHECK
#if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(IEEE_ARM) != 1
Exactly one of IEEE_8087, IEEE_ARM or IEEE_MC68k should be defined.
#if defined(IEEE_8087) + defined(IEEE_MC68k) != 1
Exactly one of IEEE_8087 or IEEE_MC68k should be defined.
#endif
namespace WTF {
@ -195,7 +193,7 @@ typedef union { double d; uint32_t L[2]; } U;
* An alternative that might be better on some machines is
* #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff)
*/
#if defined(IEEE_8087) || defined(IEEE_ARM)
#if defined(IEEE_8087)
#define Storeinc(a,b,c) (((unsigned short*)a)[1] = (unsigned short)b, ((unsigned short*)a)[0] = (unsigned short)c, a++)
#else
#define Storeinc(a,b,c) (((unsigned short*)a)[0] = (unsigned short)b, ((unsigned short*)a)[1] = (unsigned short)c, a++)
@ -252,7 +250,7 @@ typedef union { double d; uint32_t L[2]; } U;
#define Pack_32
#endif
#if CPU(PPC64) || CPU(X86_64)
#if defined(QT_ARCH_X86_64) || defined(QT_ARCH_POWERPC64)
// FIXME: should we enable this on all 64-bit CPUs?
// 64-bit emulation provided by the compiler is likely to be slower than dtoa own code on 32-bit hardware.
#define USE_LONG_LONG

View file

@ -60,6 +60,7 @@
MIPS - ...
PARISC - ...
POWERPC - ...
POWERPC64 - ...
S390 - ...
SPARC - ...
SH - ...
@ -91,8 +92,10 @@
# define QT_ARCH_MIPS
#elif defined(__hppa__)
# define QT_ARCH_PARISC
#elif defined(__powerpc__) || defined(__powerpc64__)
#elif defined(__powerpc__)
# define QT_ARCH_POWERPC
#elif defined(__powerpc64__)
# define QT_ARCH_POWERPC64
#elif defined(__s390__)
# define QT_ARCH_S390
#elif defined(__sparc__)

View file

@ -2971,26 +2971,14 @@ qreal QPainterPath::slopeAtPercent(qreal t) const
qreal m1 = slopeAt(realT, bez.x1, bez.x2, bez.x3, bez.x4);
qreal m2 = slopeAt(realT, bez.y1, bez.y2, bez.y3, bez.y4);
//tangent line
qreal slope = 0;
#define SIGN(x) ((x < 0)?-1:1)
if (m1)
slope = m2/m1;
else {
//windows doesn't define INFINITY :(
#ifdef INFINITY
slope = INFINITY*SIGN(m2);
#else
if (sizeof(qreal) == sizeof(double)) {
return 1.79769313486231570e+308;
} else {
return ((qreal)3.40282346638528860e+38);
}
#endif
}
return (m2 / m1);
return slope;
#define SLOPE_SIGN(x) ((x < 0)?-1:1)
return qreal(std::numeric_limits<qreal>::infinity() * SLOPE_SIGN(m2));
#undef SLOPE_SIGN
}
/*!