mirror of
https://github.com/bellard/quickjs.git
synced 2026-06-07 06:32:08 +00:00
fixed large performance regression with recent GCC versions
This commit is contained in:
parent
e2c01dff61
commit
10c81b1989
10
quickjs.h
10
quickjs.h
@ -216,7 +216,7 @@ static inline JSValue __JS_NewShortBigInt(JSContext *ctx, int32_t d)
|
||||
#else /* !JS_NAN_BOXING */
|
||||
|
||||
typedef union JSValueUnion {
|
||||
int32_t int32;
|
||||
uint64_t uint64;
|
||||
double float64;
|
||||
void *ptr;
|
||||
#if JS_SHORT_BIG_INT_BITS == 32
|
||||
@ -236,13 +236,15 @@ typedef struct JSValue {
|
||||
#define JS_VALUE_GET_TAG(v) ((int32_t)(v).tag)
|
||||
/* same as JS_VALUE_GET_TAG, but return JS_TAG_FLOAT64 with NaN boxing */
|
||||
#define JS_VALUE_GET_NORM_TAG(v) JS_VALUE_GET_TAG(v)
|
||||
#define JS_VALUE_GET_INT(v) ((v).u.int32)
|
||||
#define JS_VALUE_GET_BOOL(v) ((v).u.int32)
|
||||
#define JS_VALUE_GET_INT(v) ((int)(v).u.uint64)
|
||||
#define JS_VALUE_GET_BOOL(v) ((int)(v).u.uint64)
|
||||
#define JS_VALUE_GET_FLOAT64(v) ((v).u.float64)
|
||||
#define JS_VALUE_GET_SHORT_BIG_INT(v) ((v).u.short_big_int)
|
||||
#define JS_VALUE_GET_PTR(v) ((v).u.ptr)
|
||||
|
||||
#define JS_MKVAL(tag, val) (JSValue){ (JSValueUnion){ .int32 = val }, tag }
|
||||
/* avoid uninitialized data by using a 64 bit field even if only 32
|
||||
bits are needed because some compilers generate slower code */
|
||||
#define JS_MKVAL(tag, val) (JSValue){ (JSValueUnion){ .uint64 = (uint32_t)(val) }, tag }
|
||||
#define JS_MKPTR(tag, p) (JSValue){ (JSValueUnion){ .ptr = p }, tag }
|
||||
|
||||
#define JS_TAG_IS_FLOAT64(tag) ((unsigned)(tag) == JS_TAG_FLOAT64)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user