@@ -2477,25 +2477,25 @@ static __maybe_unused void JS_DumpString(JSRuntime *rt,
2477
2477
}
2478
2478
printf("%d", p->header.ref_count);
2479
2479
sep = (p->header.ref_count == 1) ? '\"' : '\'';
2480
- putchar( sep);
2480
+ printf("%c", sep);
2481
2481
for(i = 0; i < p->len; i++) {
2482
2482
if (p->is_wide_char)
2483
2483
c = p->u.str16[i];
2484
2484
else
2485
2485
c = p->u.str8[i];
2486
2486
if (c == sep || c == '\\') {
2487
- putchar( '\\');
2488
- putchar( c);
2487
+ printf("%c", '\\');
2488
+ printf("%c", c);
2489
2489
} else if (c >= ' ' && c <= 126) {
2490
- putchar( c);
2490
+ printf("%c", c);
2491
2491
} else if (c == '\n') {
2492
- putchar( '\\');
2493
- putchar( 'n');
2492
+ printf("%c", '\\');
2493
+ printf("%c", 'n');
2494
2494
} else {
2495
2495
printf("\\u%04x", c);
2496
2496
}
2497
2497
}
2498
- putchar( sep);
2498
+ printf("%c", sep);
2499
2499
}
2500
2500
2501
2501
static __maybe_unused void JS_DumpAtoms(JSRuntime *rt)
@@ -14961,6 +14961,50 @@ static JSValue js_build_arguments(JSContext *ctx, int argc, JSValueConst *argv)
14961
14961
return val;
14962
14962
}
14963
14963
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
+
14964
15008
#define GLOBAL_VAR_OFFSET 0x40000000
14965
15009
#define ARGUMENT_VAR_OFFSET 0x20000000
14966
15010
@@ -20300,6 +20344,10 @@ static __exception int js_parse_string(JSParseState *s, int sep,
20300
20344
p++;
20301
20345
c = '\n';
20302
20346
}
20347
+ #ifdef CONFIG_JSX
20348
+ if(sep == '<')
20349
+ s->line_num++;
20350
+ #endif
20303
20351
/* do not update s->line_num */
20304
20352
} else if (c == '\n' || c == '\r')
20305
20353
goto invalid_char;
0 commit comments