aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2023-08-04 15:44:46 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2023-08-04 15:44:46 +0200
commit1225f0c8d37a1fd6b08760db2f5786ccb9909fa5 (patch)
treebb8c6fe2ef910ba1117ed2242318814379172789
parent456d5c10e34c8f519b3fe049cd286fdf4a5776f1 (diff)
parent7cbb842efb4a7cab534aabc5c23a5aa925d5fab6 (diff)
Merge 2.1 into master
-rw-r--r--changelogs/changes-2.1.1.md1
-rw-r--r--changelogs/changes-2.1.2.md5
-rw-r--r--src/lib/corelib/tools/scripttools.cpp2
-rw-r--r--src/lib/corelib/tools/scripttools.h2
-rw-r--r--src/shared/quickjs/quickjs.c12
-rw-r--r--src/shared/quickjs/quickjs.h3
6 files changed, 23 insertions, 2 deletions
diff --git a/changelogs/changes-2.1.1.md b/changelogs/changes-2.1.1.md
index 760149718..d0cdaad4f 100644
--- a/changelogs/changes-2.1.1.md
+++ b/changelogs/changes-2.1.1.md
@@ -1,6 +1,7 @@
# General
* Fixed Probe lookup in multiplexed products.
* Fixed excessively slow module merging in some circumstances.
+* Fixed building QuickJS on x86 systems.
# Contributors
* Christian Kandeler
diff --git a/changelogs/changes-2.1.2.md b/changelogs/changes-2.1.2.md
new file mode 100644
index 000000000..074cbc85f
--- /dev/null
+++ b/changelogs/changes-2.1.2.md
@@ -0,0 +1,5 @@
+# General
+* Fixed handling JS floating-point values for x86.
+
+# Contributors
+* Dmitry Shachnev
diff --git a/src/lib/corelib/tools/scripttools.cpp b/src/lib/corelib/tools/scripttools.cpp
index 83005c788..efa942fd5 100644
--- a/src/lib/corelib/tools/scripttools.cpp
+++ b/src/lib/corelib/tools/scripttools.cpp
@@ -318,7 +318,7 @@ static QVariant getJsVariantImpl(JSContext *ctx, JSValue val, QList<JSValue> pat
const auto tag = JS_VALUE_GET_TAG(val);
if (tag == JS_TAG_INT)
return JS_VALUE_GET_INT(val);
- else if (tag == JS_TAG_FLOAT64)
+ else if (JS_TAG_IS_FLOAT64(tag))
return JS_VALUE_GET_FLOAT64(val);
return {};
}
diff --git a/src/lib/corelib/tools/scripttools.h b/src/lib/corelib/tools/scripttools.h
index ea7993485..955c37af5 100644
--- a/src/lib/corelib/tools/scripttools.h
+++ b/src/lib/corelib/tools/scripttools.h
@@ -201,9 +201,11 @@ QVariant QBS_AUTOTEST_EXPORT getConfigProperty(const QVariantMap &cfg, const QSt
} // namespace qbs
// Only to be used for objects!
+#ifndef JS_NAN_BOXING
inline bool operator==(JSValue v1, JSValue v2) { return v1.u.ptr == v2.u.ptr; }
inline bool operator!=(JSValue v1, JSValue v2) { return !(v1 == v2); }
inline bool operator<(JSValue v1, JSValue v2) { return v1.u.ptr < v2.u.ptr; }
inline qbs::QHashValueType qHash(const JSValue &v) { return QT_PREPEND_NAMESPACE(qHash)(v.u.ptr); }
+#endif
#endif // QBS_SCRIPTTOOLS_H
diff --git a/src/shared/quickjs/quickjs.c b/src/shared/quickjs/quickjs.c
index 9b5ea51a0..3665eea5e 100644
--- a/src/shared/quickjs/quickjs.c
+++ b/src/shared/quickjs/quickjs.c
@@ -54232,6 +54232,17 @@ JSValue JS_NewCFunctionMagic(JSContext *ctx, JSCFunctionMagic *func,
magic);
}
+#ifdef JS_NAN_BOXING
+JSValue mkVal(int32_t tag, int32_t val)
+{
+ return ((uint64_t)(tag) << 32) | (uint32_t)(val);
+}
+
+JSValue mkPtr(int32_t tag, void *p)
+{
+ return ((uint64_t)(tag) << 32) | (uintptr_t)(p);
+}
+#else
JSValue mkVal(int32_t tag, int32_t val)
{
return (JSValue){ (JSValueUnion){ .int32 = val }, tag };
@@ -54241,6 +54252,7 @@ JSValue mkPtr(int32_t tag, void *p)
{
return (JSValue){ (JSValueUnion){ .ptr = p }, tag };
}
+#endif
void JS_FreeValue(JSContext *ctx, JSValue v) {
if (JS_VALUE_HAS_REF_COUNT(v)) {
diff --git a/src/shared/quickjs/quickjs.h b/src/shared/quickjs/quickjs.h
index fbea4af3d..f2caef137 100644
--- a/src/shared/quickjs/quickjs.h
+++ b/src/shared/quickjs/quickjs.h
@@ -156,8 +156,9 @@ static inline double JS_VALUE_GET_FLOAT64(JSValue v)
#define JS_NAN (0x7ff8000000000000 - ((uint64_t)JS_FLOAT64_TAG_ADDEND << 32))
-static inline JSValue __JS_NewFloat64(JSContext *ctx, double d)
+static inline JSValue JS_NewFloat64Impl(JSContext *ctx, double d)
{
+ (void) ctx;
union {
double d;
uint64_t u64;