inline Primitive Primitive::nullValue()
{
Primitive v;
-#if QT_POINTER_SIZE == 8
+#ifdef QV4_USE_64_BIT_VALUE_ENCODING
v.val = quint64(_Null_Type) << Tag_Shift;
#else
v.tag = _Null_Type;
#ifndef V4_BOOTSTRAP
inline uint Value::asArrayIndex() const
{
-#if QT_POINTER_SIZE == 8
+#ifdef QV4_USE_64_BIT_VALUE_ENCODING
if (!isNumber())
return UINT_MAX;
if (isInteger())
#include <QtCore/QString>
#include "qv4global_p.h"
+/* We cannot rely on QT_POINTER_SIZE to be set correctly on host builds. In qmldevtools the Value objects
+ are only used to store primitives, never object pointers. So we can use the 64-bit encoding. */
+#ifdef V4_BOOTSTRAP
+#define QV4_USE_64_BIT_VALUE_ENCODING
+#elif QT_POINTER_SIZE == 8
+#define QV4_USE_64_BIT_VALUE_ENCODING
+#endif
+
QT_BEGIN_NAMESPACE
namespace QV4 {
union {
quint64 val;
-#if QT_POINTER_SIZE == 8
+#ifdef QV4_USE_64_BIT_VALUE_ENCODING
Heap::Base *m;
#else
double dbl;
union {
uint uint_32;
int int_32;
-#if QT_POINTER_SIZE == 4
+#ifndef QV4_USE_64_BIT_VALUE_ENCODING
Heap::Base *m;
#endif
};
};
};
-#if QT_POINTER_SIZE == 4
+#ifndef QV4_USE_64_BIT_VALUE_ENCODING
enum Masks {
SilentNaNBit = 0x00040000,
NaN_Mask = 0x7ff80000,
inline bool isUndefined() const { return tag == Undefined_Type; }
inline bool isNull() const { return tag == _Null_Type; }
inline bool isBoolean() const { return tag == _Boolean_Type; }
-#if QT_POINTER_SIZE == 8
+#ifdef QV4_USE_64_BIT_VALUE_ENCODING
inline bool isInteger() const { return (val >> IsNumber_Shift) == 1; }
inline bool isDouble() const { return (val >> IsDouble_Shift); }
inline bool isNumber() const { return (val >> IsNumber_Shift); }
{
Value v;
v.m = m;
-#if QT_POINTER_SIZE == 4
+#ifndef QV4_USE_64_BIT_VALUE_ENCODING
v.tag = Managed_Type;
#endif
return v;
}
Value &operator=(Heap::Base *o) {
m = o;
-#if QT_POINTER_SIZE == 4
+#ifndef QV4_USE_64_BIT_VALUE_ENCODING
tag = Managed_Type;
#endif
return *this;
inline Primitive Primitive::undefinedValue()
{
Primitive v;
-#if QT_POINTER_SIZE == 8
+#ifdef QV4_USE_64_BIT_VALUE_ENCODING
v.val = quint64(Undefined_Type) << Tag_Shift;
#else
v.tag = Undefined_Type;
template<typename X>
TypedValue &operator =(X *x) {
m = x;
-#if QT_POINTER_SIZE == 4
+#ifndef QV4_USE_64_BIT_VALUE_ENCODING
tag = Managed_Type;
#endif
return *this;