@@ -86,47 +86,12 @@ typedef struct JSRefCountHeader {
86
86
} JSRefCountHeader ;
87
87
88
88
#define JS_FLOAT64_NAN NAN
89
+ #define JSValueConst JSValue /* For backwards compatibility. */
89
90
90
- #ifdef CONFIG_CHECK_JSVALUE
91
- /* JSValue consistency : it is not possible to run the code in this
92
- mode, but it is useful to detect simple reference counting
93
- errors. It would be interesting to modify a static C analyzer to
94
- handle specific annotations (clang has such annotations but only
95
- for objective C) */
96
- typedef struct __JSValue * JSValue ;
97
- typedef const struct __JSValue * JSValueConst ;
98
-
99
- #define JS_VALUE_GET_TAG (v ) (int)((uintptr_t)(v) & 0xf)
100
- /* same as JS_VALUE_GET_TAG, but return JS_TAG_FLOAT64 with NaN boxing */
101
- #define JS_VALUE_GET_NORM_TAG (v ) JS_VALUE_GET_TAG(v)
102
- #define JS_VALUE_GET_INT (v ) (int)((intptr_t)(v) >> 4)
103
- #define JS_VALUE_GET_BOOL (v ) JS_VALUE_GET_INT(v)
104
- #define JS_VALUE_GET_FLOAT64 (v ) (double)JS_VALUE_GET_INT(v)
105
- #define JS_VALUE_GET_PTR (v ) (void *)((intptr_t)(v) & ~0xf)
106
-
107
- #define JS_MKVAL (tag , val ) (JSValue)(intptr_t)(((val) << 4) | (tag))
108
- #define JS_MKPTR (tag , p ) (JSValue)((intptr_t)(p) | (tag))
109
-
110
- #define JS_TAG_IS_FLOAT64 (tag ) ((unsigned)(tag) == JS_TAG_FLOAT64)
111
-
112
- #define JS_NAN JS_MKVAL(JS_TAG_FLOAT64, 1)
113
-
114
- static inline JSValue __JS_NewFloat64 (double d )
115
- {
116
- return JS_MKVAL (JS_TAG_FLOAT64 , (int )d );
117
- }
118
-
119
- static inline JS_BOOL JS_VALUE_IS_NAN (JSValue v )
120
- {
121
- return 0 ;
122
- }
123
-
124
- #elif defined(JS_NAN_BOXING )
91
+ #if defined(JS_NAN_BOXING )
125
92
126
93
typedef uint64_t JSValue ;
127
94
128
- #define JSValueConst JSValue
129
-
130
95
#define JS_VALUE_GET_TAG (v ) (int)((v) >> 32)
131
96
#define JS_VALUE_GET_INT (v ) (int)(v)
132
97
#define JS_VALUE_GET_BOOL (v ) (int)(v)
@@ -199,8 +164,6 @@ typedef struct JSValue {
199
164
int64_t tag ;
200
165
} JSValue ;
201
166
202
- #define JSValueConst JSValue
203
-
204
167
#define JS_VALUE_GET_TAG (v ) ((int32_t)(v).tag)
205
168
/* same as JS_VALUE_GET_TAG, but return JS_TAG_FLOAT64 with NaN boxing */
206
169
#define JS_VALUE_GET_NORM_TAG (v ) JS_VALUE_GET_TAG(v)
0 commit comments