quickjs 0.8.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/quickjsrb/extconf.rb +4 -6
- data/ext/quickjsrb/quickjs/cutils.c +2 -0
- data/ext/quickjsrb/quickjs/cutils.h +20 -0
- data/ext/quickjsrb/quickjs/dtoa.c +1620 -0
- data/ext/quickjsrb/quickjs/dtoa.h +83 -0
- data/ext/quickjsrb/quickjs/libregexp.c +34 -6
- data/ext/quickjsrb/quickjs/libregexp.h +5 -0
- data/ext/quickjsrb/quickjs/libunicode-table.h +1792 -1619
- data/ext/quickjsrb/quickjs/libunicode.c +201 -201
- data/ext/quickjsrb/quickjs/qjs.c +47 -60
- data/ext/quickjsrb/quickjs/qjsc.c +136 -76
- data/ext/quickjsrb/quickjs/quickjs-atom.h +7 -17
- data/ext/quickjsrb/quickjs/quickjs-libc.c +206 -109
- data/ext/quickjsrb/quickjs/quickjs-opcode.h +4 -6
- data/ext/quickjsrb/quickjs/quickjs.c +5500 -6786
- data/ext/quickjsrb/quickjs/quickjs.h +69 -32
- data/ext/quickjsrb/quickjs/run-test262.c +10 -1
- data/ext/quickjsrb/quickjs/unicode_gen.c +19 -1
- data/ext/quickjsrb/quickjs/unicode_gen_def.h +12 -0
- data/ext/quickjsrb/quickjsrb.c +9 -10
- data/lib/quickjs/version.rb +1 -1
- metadata +4 -4
- data/ext/quickjsrb/quickjs/libbf.c +0 -8475
- data/ext/quickjsrb/quickjs/libbf.h +0 -535
@@ -27,6 +27,7 @@
|
|
27
27
|
|
28
28
|
#include <stdio.h>
|
29
29
|
#include <stdint.h>
|
30
|
+
#include <string.h>
|
30
31
|
|
31
32
|
#ifdef __cplusplus
|
32
33
|
extern "C" {
|
@@ -48,7 +49,6 @@ extern "C" {
|
|
48
49
|
|
49
50
|
typedef struct JSRuntime JSRuntime;
|
50
51
|
typedef struct JSContext JSContext;
|
51
|
-
typedef struct JSObject JSObject;
|
52
52
|
typedef struct JSClass JSClass;
|
53
53
|
typedef uint32_t JSClassID;
|
54
54
|
typedef uint32_t JSAtom;
|
@@ -64,14 +64,21 @@ typedef uint32_t JSAtom;
|
|
64
64
|
#define JS_NAN_BOXING
|
65
65
|
#endif
|
66
66
|
|
67
|
+
#if defined(__SIZEOF_INT128__) && (INTPTR_MAX >= INT64_MAX)
|
68
|
+
#define JS_LIMB_BITS 64
|
69
|
+
#else
|
70
|
+
#define JS_LIMB_BITS 32
|
71
|
+
#endif
|
72
|
+
|
73
|
+
#define JS_SHORT_BIG_INT_BITS JS_LIMB_BITS
|
74
|
+
|
67
75
|
enum {
|
68
76
|
/* all tags with a reference count are negative */
|
69
|
-
JS_TAG_FIRST = -
|
70
|
-
|
71
|
-
JS_TAG_BIG_INT = -10,
|
72
|
-
JS_TAG_BIG_FLOAT = -9,
|
77
|
+
JS_TAG_FIRST = -9, /* first negative tag */
|
78
|
+
JS_TAG_BIG_INT = -9,
|
73
79
|
JS_TAG_SYMBOL = -8,
|
74
80
|
JS_TAG_STRING = -7,
|
81
|
+
JS_TAG_STRING_ROPE = -6,
|
75
82
|
JS_TAG_MODULE = -3, /* used internally */
|
76
83
|
JS_TAG_FUNCTION_BYTECODE = -2, /* used internally */
|
77
84
|
JS_TAG_OBJECT = -1,
|
@@ -83,7 +90,8 @@ enum {
|
|
83
90
|
JS_TAG_UNINITIALIZED = 4,
|
84
91
|
JS_TAG_CATCH_OFFSET = 5,
|
85
92
|
JS_TAG_EXCEPTION = 6,
|
86
|
-
|
93
|
+
JS_TAG_SHORT_BIG_INT = 7,
|
94
|
+
JS_TAG_FLOAT64 = 8,
|
87
95
|
/* any larger tag is FLOAT64 if JS_NAN_BOXING */
|
88
96
|
};
|
89
97
|
|
@@ -108,6 +116,7 @@ typedef const struct __JSValue *JSValueConst;
|
|
108
116
|
#define JS_VALUE_GET_INT(v) (int)((intptr_t)(v) >> 4)
|
109
117
|
#define JS_VALUE_GET_BOOL(v) JS_VALUE_GET_INT(v)
|
110
118
|
#define JS_VALUE_GET_FLOAT64(v) (double)JS_VALUE_GET_INT(v)
|
119
|
+
#define JS_VALUE_GET_SHORT_BIG_INT(v) JS_VALUE_GET_INT(v)
|
111
120
|
#define JS_VALUE_GET_PTR(v) (void *)((intptr_t)(v) & ~0xf)
|
112
121
|
|
113
122
|
#define JS_MKVAL(tag, val) (JSValue)(intptr_t)(((val) << 4) | (tag))
|
@@ -127,6 +136,11 @@ static inline JS_BOOL JS_VALUE_IS_NAN(JSValue v)
|
|
127
136
|
return 0;
|
128
137
|
}
|
129
138
|
|
139
|
+
static inline JSValue __JS_NewShortBigInt(JSContext *ctx, int32_t d)
|
140
|
+
{
|
141
|
+
return JS_MKVAL(JS_TAG_SHORT_BIG_INT, d);
|
142
|
+
}
|
143
|
+
|
130
144
|
#elif defined(JS_NAN_BOXING)
|
131
145
|
|
132
146
|
typedef uint64_t JSValue;
|
@@ -136,6 +150,7 @@ typedef uint64_t JSValue;
|
|
136
150
|
#define JS_VALUE_GET_TAG(v) (int)((v) >> 32)
|
137
151
|
#define JS_VALUE_GET_INT(v) (int)(v)
|
138
152
|
#define JS_VALUE_GET_BOOL(v) (int)(v)
|
153
|
+
#define JS_VALUE_GET_SHORT_BIG_INT(v) (int)(v)
|
139
154
|
#define JS_VALUE_GET_PTR(v) (void *)(intptr_t)(v)
|
140
155
|
|
141
156
|
#define JS_MKVAL(tag, val) (((uint64_t)(tag) << 32) | (uint32_t)(val))
|
@@ -192,12 +207,22 @@ static inline JS_BOOL JS_VALUE_IS_NAN(JSValue v)
|
|
192
207
|
return tag == (JS_NAN >> 32);
|
193
208
|
}
|
194
209
|
|
210
|
+
static inline JSValue __JS_NewShortBigInt(JSContext *ctx, int32_t d)
|
211
|
+
{
|
212
|
+
return JS_MKVAL(JS_TAG_SHORT_BIG_INT, d);
|
213
|
+
}
|
214
|
+
|
195
215
|
#else /* !JS_NAN_BOXING */
|
196
216
|
|
197
217
|
typedef union JSValueUnion {
|
198
218
|
int32_t int32;
|
199
219
|
double float64;
|
200
220
|
void *ptr;
|
221
|
+
#if JS_SHORT_BIG_INT_BITS == 32
|
222
|
+
int32_t short_big_int;
|
223
|
+
#else
|
224
|
+
int64_t short_big_int;
|
225
|
+
#endif
|
201
226
|
} JSValueUnion;
|
202
227
|
|
203
228
|
typedef struct JSValue {
|
@@ -213,6 +238,7 @@ typedef struct JSValue {
|
|
213
238
|
#define JS_VALUE_GET_INT(v) ((v).u.int32)
|
214
239
|
#define JS_VALUE_GET_BOOL(v) ((v).u.int32)
|
215
240
|
#define JS_VALUE_GET_FLOAT64(v) ((v).u.float64)
|
241
|
+
#define JS_VALUE_GET_SHORT_BIG_INT(v) ((v).u.short_big_int)
|
216
242
|
#define JS_VALUE_GET_PTR(v) ((v).u.ptr)
|
217
243
|
|
218
244
|
#define JS_MKVAL(tag, val) (JSValue){ (JSValueUnion){ .int32 = val }, tag }
|
@@ -242,13 +268,19 @@ static inline JS_BOOL JS_VALUE_IS_NAN(JSValue v)
|
|
242
268
|
return (u.u64 & 0x7fffffffffffffff) > 0x7ff0000000000000;
|
243
269
|
}
|
244
270
|
|
271
|
+
static inline JSValue __JS_NewShortBigInt(JSContext *ctx, int64_t d)
|
272
|
+
{
|
273
|
+
JSValue v;
|
274
|
+
v.tag = JS_TAG_SHORT_BIG_INT;
|
275
|
+
v.u.short_big_int = d;
|
276
|
+
return v;
|
277
|
+
}
|
278
|
+
|
245
279
|
#endif /* !JS_NAN_BOXING */
|
246
280
|
|
247
281
|
#define JS_VALUE_IS_BOTH_INT(v1, v2) ((JS_VALUE_GET_TAG(v1) | JS_VALUE_GET_TAG(v2)) == 0)
|
248
282
|
#define JS_VALUE_IS_BOTH_FLOAT(v1, v2) (JS_TAG_IS_FLOAT64(JS_VALUE_GET_TAG(v1)) && JS_TAG_IS_FLOAT64(JS_VALUE_GET_TAG(v2)))
|
249
283
|
|
250
|
-
#define JS_VALUE_GET_OBJ(v) ((JSObject *)JS_VALUE_GET_PTR(v))
|
251
|
-
#define JS_VALUE_GET_STRING(v) ((JSString *)JS_VALUE_GET_PTR(v))
|
252
284
|
#define JS_VALUE_HAS_REF_COUNT(v) ((unsigned)JS_VALUE_GET_TAG(v) >= (unsigned)JS_TAG_FIRST)
|
253
285
|
|
254
286
|
/* special values */
|
@@ -290,7 +322,9 @@ static inline JS_BOOL JS_VALUE_IS_NAN(JSValue v)
|
|
290
322
|
#define JS_PROP_NO_ADD (1 << 16) /* internal use */
|
291
323
|
#define JS_PROP_NO_EXOTIC (1 << 17) /* internal use */
|
292
324
|
|
293
|
-
#
|
325
|
+
#ifndef JS_DEFAULT_STACK_SIZE
|
326
|
+
#define JS_DEFAULT_STACK_SIZE (1024 * 1024)
|
327
|
+
#endif
|
294
328
|
|
295
329
|
/* JS_Eval() flags */
|
296
330
|
#define JS_EVAL_TYPE_GLOBAL (0 << 0) /* global code (default) */
|
@@ -300,7 +334,6 @@ static inline JS_BOOL JS_VALUE_IS_NAN(JSValue v)
|
|
300
334
|
#define JS_EVAL_TYPE_MASK (3 << 0)
|
301
335
|
|
302
336
|
#define JS_EVAL_FLAG_STRICT (1 << 3) /* force 'strict' mode */
|
303
|
-
#define JS_EVAL_FLAG_STRIP (1 << 4) /* force 'strip' mode */
|
304
337
|
/* compile but do not run. The result is an object with a
|
305
338
|
JS_TAG_FUNCTION_BYTECODE or JS_TAG_MODULE tag. It can be executed
|
306
339
|
with JS_EvalFunction(). */
|
@@ -373,13 +406,7 @@ void JS_AddIntrinsicProxy(JSContext *ctx);
|
|
373
406
|
void JS_AddIntrinsicMapSet(JSContext *ctx);
|
374
407
|
void JS_AddIntrinsicTypedArrays(JSContext *ctx);
|
375
408
|
void JS_AddIntrinsicPromise(JSContext *ctx);
|
376
|
-
void
|
377
|
-
void JS_AddIntrinsicBigFloat(JSContext *ctx);
|
378
|
-
void JS_AddIntrinsicBigDecimal(JSContext *ctx);
|
379
|
-
/* enable operator overloading */
|
380
|
-
void JS_AddIntrinsicOperators(JSContext *ctx);
|
381
|
-
/* enable "use math" */
|
382
|
-
void JS_EnableBignumExt(JSContext *ctx, JS_BOOL enable);
|
409
|
+
void JS_AddIntrinsicWeakRef(JSContext *ctx);
|
383
410
|
|
384
411
|
JSValue js_string_codePointRange(JSContext *ctx, JSValueConst this_val,
|
385
412
|
int argc, JSValueConst *argv);
|
@@ -474,6 +501,17 @@ typedef struct JSClassExoticMethods {
|
|
474
501
|
/* return < 0 if exception or TRUE/FALSE */
|
475
502
|
int (*set_property)(JSContext *ctx, JSValueConst obj, JSAtom atom,
|
476
503
|
JSValueConst value, JSValueConst receiver, int flags);
|
504
|
+
|
505
|
+
/* To get a consistent object behavior when get_prototype != NULL,
|
506
|
+
get_property, set_property and set_prototype must be != NULL
|
507
|
+
and the object must be created with a JS_NULL prototype. */
|
508
|
+
JSValue (*get_prototype)(JSContext *ctx, JSValueConst obj);
|
509
|
+
/* return < 0 if exception or TRUE/FALSE */
|
510
|
+
int (*set_prototype)(JSContext *ctx, JSValueConst obj, JSValueConst proto_val);
|
511
|
+
/* return < 0 if exception or TRUE/FALSE */
|
512
|
+
int (*is_extensible)(JSContext *ctx, JSValueConst obj);
|
513
|
+
/* return < 0 if exception or TRUE/FALSE */
|
514
|
+
int (*prevent_extensions)(JSContext *ctx, JSValueConst obj);
|
477
515
|
} JSClassExoticMethods;
|
478
516
|
|
479
517
|
typedef void JSClassFinalizer(JSRuntime *rt, JSValue val);
|
@@ -576,19 +614,7 @@ static inline JS_BOOL JS_IsNumber(JSValueConst v)
|
|
576
614
|
static inline JS_BOOL JS_IsBigInt(JSContext *ctx, JSValueConst v)
|
577
615
|
{
|
578
616
|
int tag = JS_VALUE_GET_TAG(v);
|
579
|
-
return tag == JS_TAG_BIG_INT;
|
580
|
-
}
|
581
|
-
|
582
|
-
static inline JS_BOOL JS_IsBigFloat(JSValueConst v)
|
583
|
-
{
|
584
|
-
int tag = JS_VALUE_GET_TAG(v);
|
585
|
-
return tag == JS_TAG_BIG_FLOAT;
|
586
|
-
}
|
587
|
-
|
588
|
-
static inline JS_BOOL JS_IsBigDecimal(JSValueConst v)
|
589
|
-
{
|
590
|
-
int tag = JS_VALUE_GET_TAG(v);
|
591
|
-
return tag == JS_TAG_BIG_DECIMAL;
|
617
|
+
return tag == JS_TAG_BIG_INT || tag == JS_TAG_SHORT_BIG_INT;
|
592
618
|
}
|
593
619
|
|
594
620
|
static inline JS_BOOL JS_IsBool(JSValueConst v)
|
@@ -618,7 +644,8 @@ static inline JS_BOOL JS_IsUninitialized(JSValueConst v)
|
|
618
644
|
|
619
645
|
static inline JS_BOOL JS_IsString(JSValueConst v)
|
620
646
|
{
|
621
|
-
return JS_VALUE_GET_TAG(v) == JS_TAG_STRING
|
647
|
+
return JS_VALUE_GET_TAG(v) == JS_TAG_STRING ||
|
648
|
+
JS_VALUE_GET_TAG(v) == JS_TAG_STRING_ROPE;
|
622
649
|
}
|
623
650
|
|
624
651
|
static inline JS_BOOL JS_IsSymbol(JSValueConst v)
|
@@ -703,7 +730,10 @@ int JS_ToBigInt64(JSContext *ctx, int64_t *pres, JSValueConst val);
|
|
703
730
|
int JS_ToInt64Ext(JSContext *ctx, int64_t *pres, JSValueConst val);
|
704
731
|
|
705
732
|
JSValue JS_NewStringLen(JSContext *ctx, const char *str1, size_t len1);
|
706
|
-
JSValue JS_NewString(JSContext *ctx, const char *str)
|
733
|
+
static inline JSValue JS_NewString(JSContext *ctx, const char *str)
|
734
|
+
{
|
735
|
+
return JS_NewStringLen(ctx, str, strlen(str));
|
736
|
+
}
|
707
737
|
JSValue JS_NewAtomString(JSContext *ctx, const char *str);
|
708
738
|
JSValue JS_ToString(JSContext *ctx, JSValueConst val);
|
709
739
|
JSValue JS_ToPropertyKey(JSContext *ctx, JSValueConst val);
|
@@ -813,6 +843,7 @@ int JS_DefinePropertyGetSet(JSContext *ctx, JSValueConst this_obj,
|
|
813
843
|
void JS_SetOpaque(JSValue obj, void *opaque);
|
814
844
|
void *JS_GetOpaque(JSValueConst obj, JSClassID class_id);
|
815
845
|
void *JS_GetOpaque2(JSContext *ctx, JSValueConst obj, JSClassID class_id);
|
846
|
+
void *JS_GetAnyOpaque(JSValueConst obj, JSClassID *class_id);
|
816
847
|
|
817
848
|
/* 'buf' must be zero terminated i.e. buf[buf_len] = '\0'. */
|
818
849
|
JSValue JS_ParseJSON(JSContext *ctx, const char *buf, size_t buf_len,
|
@@ -881,6 +912,12 @@ typedef int JSInterruptHandler(JSRuntime *rt, void *opaque);
|
|
881
912
|
void JS_SetInterruptHandler(JSRuntime *rt, JSInterruptHandler *cb, void *opaque);
|
882
913
|
/* if can_block is TRUE, Atomics.wait() can be used */
|
883
914
|
void JS_SetCanBlock(JSRuntime *rt, JS_BOOL can_block);
|
915
|
+
/* select which debug info is stripped from the compiled code */
|
916
|
+
#define JS_STRIP_SOURCE (1 << 0) /* strip source code */
|
917
|
+
#define JS_STRIP_DEBUG (1 << 1) /* strip all debug info including source code */
|
918
|
+
void JS_SetStripInfo(JSRuntime *rt, int flags);
|
919
|
+
int JS_GetStripInfo(JSRuntime *rt);
|
920
|
+
|
884
921
|
/* set the [IsHTMLDDA] internal slot */
|
885
922
|
void JS_SetIsHTMLDDA(JSContext *ctx, JSValueConst obj);
|
886
923
|
|
@@ -757,6 +757,13 @@ static JSValue js_IsHTMLDDA(JSContext *ctx, JSValue this_val,
|
|
757
757
|
return JS_NULL;
|
758
758
|
}
|
759
759
|
|
760
|
+
static JSValue js_gc(JSContext *ctx, JSValueConst this_val,
|
761
|
+
int argc, JSValueConst *argv)
|
762
|
+
{
|
763
|
+
JS_RunGC(JS_GetRuntime(ctx));
|
764
|
+
return JS_UNDEFINED;
|
765
|
+
}
|
766
|
+
|
760
767
|
static JSValue add_helpers1(JSContext *ctx)
|
761
768
|
{
|
762
769
|
JSValue global_obj;
|
@@ -790,6 +797,8 @@ static JSValue add_helpers1(JSContext *ctx)
|
|
790
797
|
obj = JS_NewCFunction(ctx, js_IsHTMLDDA, "IsHTMLDDA", 0);
|
791
798
|
JS_SetIsHTMLDDA(ctx, obj);
|
792
799
|
JS_SetPropertyStr(ctx, obj262, "IsHTMLDDA", obj);
|
800
|
+
JS_SetPropertyStr(ctx, obj262, "gc",
|
801
|
+
JS_NewCFunction(ctx, js_gc, "gc", 0));
|
793
802
|
|
794
803
|
JS_SetPropertyStr(ctx, global_obj, "$262", JS_DupValue(ctx, obj262));
|
795
804
|
|
@@ -1571,7 +1580,7 @@ int run_test_buf(const char *filename, const char *harness, namelist_t *ip,
|
|
1571
1580
|
|
1572
1581
|
for (i = 0; i < ip->count; i++) {
|
1573
1582
|
if (eval_file(ctx, harness, ip->array[i],
|
1574
|
-
JS_EVAL_TYPE_GLOBAL
|
1583
|
+
JS_EVAL_TYPE_GLOBAL)) {
|
1575
1584
|
fatal(1, "error including %s for %s", ip->array[i], filename);
|
1576
1585
|
}
|
1577
1586
|
}
|
@@ -625,7 +625,7 @@ void parse_derived_core_properties(const char *filename)
|
|
625
625
|
p++;
|
626
626
|
p += strspn(p, " \t");
|
627
627
|
q = buf;
|
628
|
-
while (*p != '\0' && *p != ' ' && *p != '#' && *p != '\t') {
|
628
|
+
while (*p != '\0' && *p != ' ' && *p != '#' && *p != '\t' && *p != ';') {
|
629
629
|
if ((q - buf) < sizeof(buf) - 1)
|
630
630
|
*q++ = *p;
|
631
631
|
p++;
|
@@ -1117,6 +1117,24 @@ void find_run_type(TableEntry *te, CCInfo *tab, int code)
|
|
1117
1117
|
te->ext_data[1] = ci->u_data[1];
|
1118
1118
|
te->ext_data[2] = ci->u_data[2];
|
1119
1119
|
te->ext_len = 3;
|
1120
|
+
} else if (ci->u_len == 2 && ci->l_len == 0 && ci->f_len == 1) {
|
1121
|
+
// U+FB05 LATIN SMALL LIGATURE LONG S T
|
1122
|
+
assert(code == 0xFB05);
|
1123
|
+
te->len = 1;
|
1124
|
+
te->type = RUN_TYPE_UF_EXT2;
|
1125
|
+
te->ext_data[0] = ci->u_data[0];
|
1126
|
+
te->ext_data[1] = ci->u_data[1];
|
1127
|
+
te->ext_len = 2;
|
1128
|
+
} else if (ci->u_len == 3 && ci->l_len == 0 && ci->f_len == 1) {
|
1129
|
+
// U+1FD3 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA or
|
1130
|
+
// U+1FE3 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA
|
1131
|
+
assert(code == 0x1FD3 || code == 0x1FE3);
|
1132
|
+
te->len = 1;
|
1133
|
+
te->type = RUN_TYPE_UF_EXT3;
|
1134
|
+
te->ext_data[0] = ci->u_data[0];
|
1135
|
+
te->ext_data[1] = ci->u_data[1];
|
1136
|
+
te->ext_data[2] = ci->u_data[2];
|
1137
|
+
te->ext_len = 3;
|
1120
1138
|
} else {
|
1121
1139
|
printf("unsupported encoding case:\n");
|
1122
1140
|
dump_cc_info(ci, code);
|
@@ -82,6 +82,7 @@ DEF(Egyptian_Hieroglyphs, "Egyp")
|
|
82
82
|
DEF(Elbasan, "Elba")
|
83
83
|
DEF(Elymaic, "Elym")
|
84
84
|
DEF(Ethiopic, "Ethi")
|
85
|
+
DEF(Garay, "Gara")
|
85
86
|
DEF(Georgian, "Geor")
|
86
87
|
DEF(Glagolitic, "Glag")
|
87
88
|
DEF(Gothic, "Goth")
|
@@ -90,6 +91,7 @@ DEF(Greek, "Grek")
|
|
90
91
|
DEF(Gujarati, "Gujr")
|
91
92
|
DEF(Gunjala_Gondi, "Gong")
|
92
93
|
DEF(Gurmukhi, "Guru")
|
94
|
+
DEF(Gurung_Khema, "Gukh")
|
93
95
|
DEF(Han, "Hani")
|
94
96
|
DEF(Hangul, "Hang")
|
95
97
|
DEF(Hanifi_Rohingya, "Rohg")
|
@@ -112,6 +114,7 @@ DEF(Khmer, "Khmr")
|
|
112
114
|
DEF(Khojki, "Khoj")
|
113
115
|
DEF(Khitan_Small_Script, "Kits")
|
114
116
|
DEF(Khudawadi, "Sind")
|
117
|
+
DEF(Kirat_Rai, "Krai")
|
115
118
|
DEF(Lao, "Laoo")
|
116
119
|
DEF(Latin, "Latn")
|
117
120
|
DEF(Lepcha, "Lepc")
|
@@ -149,6 +152,7 @@ DEF(Nushu, "Nshu")
|
|
149
152
|
DEF(Nyiakeng_Puachue_Hmong, "Hmnp")
|
150
153
|
DEF(Ogham, "Ogam")
|
151
154
|
DEF(Ol_Chiki, "Olck")
|
155
|
+
DEF(Ol_Onal, "Onao")
|
152
156
|
DEF(Old_Hungarian, "Hung")
|
153
157
|
DEF(Old_Italic, "Ital")
|
154
158
|
DEF(Old_North_Arabian, "Narb")
|
@@ -180,6 +184,7 @@ DEF(Sogdian, "Sogd")
|
|
180
184
|
DEF(Sora_Sompeng, "Sora")
|
181
185
|
DEF(Soyombo, "Soyo")
|
182
186
|
DEF(Sundanese, "Sund")
|
187
|
+
DEF(Sunuwar, "Sunu")
|
183
188
|
DEF(Syloti_Nagri, "Sylo")
|
184
189
|
DEF(Syriac, "Syrc")
|
185
190
|
DEF(Tagalog, "Tglg")
|
@@ -197,7 +202,9 @@ DEF(Tibetan, "Tibt")
|
|
197
202
|
DEF(Tifinagh, "Tfng")
|
198
203
|
DEF(Tirhuta, "Tirh")
|
199
204
|
DEF(Tangsa, "Tnsa")
|
205
|
+
DEF(Todhri, "Todr")
|
200
206
|
DEF(Toto, "Toto")
|
207
|
+
DEF(Tulu_Tigalari, "Tutg")
|
201
208
|
DEF(Ugaritic, "Ugar")
|
202
209
|
DEF(Vai, "Vaii")
|
203
210
|
DEF(Vithkuqi, "Vith")
|
@@ -236,11 +243,13 @@ DEF(Deprecated, "Dep")
|
|
236
243
|
DEF(Diacritic, "Dia")
|
237
244
|
DEF(Extender, "Ext")
|
238
245
|
DEF(Hex_Digit, "Hex")
|
246
|
+
DEF(IDS_Unary_Operator, "IDSU")
|
239
247
|
DEF(IDS_Binary_Operator, "IDSB")
|
240
248
|
DEF(IDS_Trinary_Operator, "IDST")
|
241
249
|
DEF(Ideographic, "Ideo")
|
242
250
|
DEF(Join_Control, "Join_C")
|
243
251
|
DEF(Logical_Order_Exception, "LOE")
|
252
|
+
DEF(Modifier_Combining_Mark, "MCM")
|
244
253
|
DEF(Noncharacter_Code_Point, "NChar")
|
245
254
|
DEF(Pattern_Syntax, "Pat_Syn")
|
246
255
|
DEF(Pattern_White_Space, "Pat_WS")
|
@@ -279,6 +288,9 @@ DEF(Changes_When_Uppercased, "CWU")
|
|
279
288
|
DEF(Grapheme_Base, "Gr_Base")
|
280
289
|
DEF(Grapheme_Extend, "Gr_Ext")
|
281
290
|
DEF(ID_Continue, "IDC")
|
291
|
+
DEF(ID_Compat_Math_Start, "")
|
292
|
+
DEF(ID_Compat_Math_Continue, "")
|
293
|
+
DEF(InCB, "")
|
282
294
|
DEF(Lowercase, "Lower")
|
283
295
|
DEF(Math, "")
|
284
296
|
DEF(Uppercase, "Upper")
|
data/ext/quickjsrb/quickjsrb.c
CHANGED
@@ -274,6 +274,7 @@ VALUE to_rb_value(JSContext *ctx, JSValue j_val)
|
|
274
274
|
return Qnil;
|
275
275
|
}
|
276
276
|
case JS_TAG_BIG_INT:
|
277
|
+
case JS_TAG_SHORT_BIG_INT:
|
277
278
|
{
|
278
279
|
JSValue j_toStringFunc = JS_GetPropertyStr(ctx, j_val, "toString");
|
279
280
|
JSValue j_strigified = JS_Call(ctx, j_toStringFunc, j_val, 0, NULL);
|
@@ -286,8 +287,6 @@ VALUE to_rb_value(JSContext *ctx, JSValue j_val)
|
|
286
287
|
|
287
288
|
return rb_funcall(r_str, rb_intern("to_i"), 0);
|
288
289
|
}
|
289
|
-
case JS_TAG_BIG_FLOAT:
|
290
|
-
case JS_TAG_BIG_DECIMAL:
|
291
290
|
case JS_TAG_SYMBOL:
|
292
291
|
default:
|
293
292
|
return Qnil;
|
@@ -515,11 +514,6 @@ static VALUE vm_m_initialize(int argc, VALUE *argv, VALUE r_self)
|
|
515
514
|
JS_SetMemoryLimit(runtime, NUM2UINT(r_memory_limit));
|
516
515
|
JS_SetMaxStackSize(runtime, NUM2UINT(r_max_stack_size));
|
517
516
|
|
518
|
-
JS_AddIntrinsicBigFloat(data->context);
|
519
|
-
JS_AddIntrinsicBigDecimal(data->context);
|
520
|
-
JS_AddIntrinsicOperators(data->context);
|
521
|
-
JS_EnableBignumExt(data->context, TRUE);
|
522
|
-
|
523
517
|
JS_SetModuleLoaderFunc(runtime, NULL, js_module_loader, NULL);
|
524
518
|
js_std_init_handlers(runtime);
|
525
519
|
|
@@ -677,9 +671,14 @@ static VALUE vm_m_import(int argc, VALUE *argv, VALUE r_self)
|
|
677
671
|
|
678
672
|
char *filename = random_string();
|
679
673
|
char *source = StringValueCStr(r_from);
|
680
|
-
JSValue
|
681
|
-
|
682
|
-
|
674
|
+
JSValue module = JS_Eval(data->context, source, strlen(source), filename, JS_EVAL_TYPE_MODULE | JS_EVAL_FLAG_COMPILE_ONLY);
|
675
|
+
if (JS_IsException(module))
|
676
|
+
{
|
677
|
+
JS_FreeValue(data->context, module);
|
678
|
+
return to_rb_value(data->context, module);
|
679
|
+
}
|
680
|
+
js_module_set_import_meta(data->context, module, TRUE, FALSE);
|
681
|
+
JS_FreeValue(data->context, module);
|
683
682
|
|
684
683
|
VALUE r_import_settings = rb_funcall(
|
685
684
|
rb_const_get(rb_cClass, rb_intern("Quickjs")),
|
data/lib/quickjs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quickjs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hmsk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -54,8 +54,8 @@ files:
|
|
54
54
|
- ext/quickjsrb/quickjs/LICENSE
|
55
55
|
- ext/quickjsrb/quickjs/cutils.c
|
56
56
|
- ext/quickjsrb/quickjs/cutils.h
|
57
|
-
- ext/quickjsrb/quickjs/
|
58
|
-
- ext/quickjsrb/quickjs/
|
57
|
+
- ext/quickjsrb/quickjs/dtoa.c
|
58
|
+
- ext/quickjsrb/quickjs/dtoa.h
|
59
59
|
- ext/quickjsrb/quickjs/libregexp-opcode.h
|
60
60
|
- ext/quickjsrb/quickjs/libregexp.c
|
61
61
|
- ext/quickjsrb/quickjs/libregexp.h
|