@@ -2477,25 +2477,25 @@ static __maybe_unused void JS_DumpString(JSRuntime *rt,
24772477 }
24782478 printf("%d", p->header.ref_count);
24792479 sep = (p->header.ref_count == 1) ? '\"' : '\'';
2480- putchar( sep);
2480+ printf("%c", sep);
24812481 for(i = 0; i < p->len; i++) {
24822482 if (p->is_wide_char)
24832483 c = p->u.str16[i];
24842484 else
24852485 c = p->u.str8[i];
24862486 if (c == sep || c == '\\') {
2487- putchar( '\\');
2488- putchar( c);
2487+ printf("%c", '\\');
2488+ printf("%c", c);
24892489 } else if (c >= ' ' && c <= 126) {
2490- putchar( c);
2490+ printf("%c", c);
24912491 } else if (c == '\n') {
2492- putchar( '\\');
2493- putchar( 'n');
2492+ printf("%c", '\\');
2493+ printf("%c", 'n');
24942494 } else {
24952495 printf("\\u%04x", c);
24962496 }
24972497 }
2498- putchar( sep);
2498+ printf("%c", sep);
24992499}
25002500
25012501static __maybe_unused void JS_DumpAtoms(JSRuntime *rt)
@@ -14961,6 +14961,50 @@ static JSValue js_build_arguments(JSContext *ctx, int argc, JSValueConst *argv)
1496114961 return val;
1496214962}
1496314963
14964+ /**/
14965+ JSValue JS_NewFastArray(JSContext *ctx, int argc, JSValueConst *argv)
14966+ {
14967+ JSValue val, *tab;
14968+ JSProperty *pr;
14969+ JSObject *p;
14970+ int i;
14971+
14972+ val = JS_NewObjectProtoClass(ctx, ctx->class_proto[JS_CLASS_OBJECT], JS_CLASS_ARRAY);
14973+ if (JS_IsException(val))
14974+ return val;
14975+ p = JS_VALUE_GET_OBJ(val);
14976+
14977+ /* add the length field (cannot fail) */
14978+ pr = add_property(ctx, p, JS_ATOM_length,
14979+ JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE);
14980+ pr->u.value = JS_NewInt32(ctx, argc);
14981+
14982+ /* initialize the fast array part */
14983+ tab = NULL;
14984+ if (argc > 0) {
14985+ tab = js_malloc(ctx, sizeof(tab[0]) * argc);
14986+ if (!tab) {
14987+ JS_FreeValue(ctx, val);
14988+ return JS_EXCEPTION;
14989+ }
14990+ for (i = 0; i < argc; i++) {
14991+ tab[i] = JS_DupValue(ctx, argv[i]);
14992+ }
14993+ }
14994+ p->u.array.u.values = tab;
14995+ p->u.array.count = argc;
14996+
14997+ JS_DefinePropertyValue(ctx, val, JS_ATOM_Symbol_iterator,
14998+ JS_DupValue(ctx, ctx->array_proto_values),
14999+ JS_PROP_CONFIGURABLE | JS_PROP_WRITABLE);
15000+ return val;
15001+ }
15002+
15003+ BOOL JS_GetFastArray(JSContext *ctx, JSValueConst obj, JSValue **arrpp, uint32_t *countp) {
15004+ return js_get_fast_array(ctx, obj, arrpp, countp);
15005+ }
15006+
15007+
1496415008#define GLOBAL_VAR_OFFSET 0x40000000
1496515009#define ARGUMENT_VAR_OFFSET 0x20000000
1496615010
@@ -20300,6 +20344,10 @@ static __exception int js_parse_string(JSParseState *s, int sep,
2030020344 p++;
2030120345 c = '\n';
2030220346 }
20347+ #ifdef CONFIG_JSX
20348+ if(sep == '<')
20349+ s->line_num++;
20350+ #endif
2030320351 /* do not update s->line_num */
2030420352 } else if (c == '\n' || c == '\r')
2030520353 goto invalid_char;
0 commit comments