@@ -47,35 +47,13 @@ typedef struct namelist_t {
47
47
int size ;
48
48
} namelist_t ;
49
49
50
- typedef struct {
51
- const char * option_name ;
52
- const char * init_name ;
53
- } FeatureEntry ;
54
-
55
50
static namelist_t cname_list ;
56
51
static namelist_t cmodule_list ;
57
52
static namelist_t init_module_list ;
58
- static uint64_t feature_bitmap ;
59
53
static FILE * outfile ;
60
54
static BOOL byte_swap ;
61
55
static const char * c_ident_prefix = "qjsc_" ;
62
56
63
- #define FE_ALL (-1)
64
-
65
- static const FeatureEntry feature_list [] = {
66
- { "date" , "Date" },
67
- { "eval" , "Eval" },
68
- { "string-normalize" , "StringNormalize" },
69
- { "regexp" , "RegExp" },
70
- { "json" , "JSON" },
71
- { "proxy" , "Proxy" },
72
- { "map" , "MapSet" },
73
- { "typedarray" , "TypedArrays" },
74
- { "promise" , "Promise" },
75
- #define FE_MODULE_LOADER 9
76
- { "module-loader" , NULL },
77
- { "bigint" , "BigInt" },
78
- };
79
57
80
58
void namelist_add (namelist_t * lp , const char * name , const char * short_name ,
81
59
int flags )
@@ -349,20 +327,6 @@ void help(void)
349
327
"-S n set the maximum stack size to 'n' bytes (default=%d)\n" ,
350
328
JS_GetVersion (),
351
329
JS_DEFAULT_STACK_SIZE );
352
- #ifdef CONFIG_LTO
353
- {
354
- int i ;
355
- printf ("-flto use link time optimization\n" );
356
- printf ("-fno-[" );
357
- for (i = 0 ; i < countof (feature_list ); i ++ ) {
358
- if (i != 0 )
359
- printf ("|" );
360
- printf ("%s" , feature_list [i ].option_name );
361
- }
362
- printf ("]\n"
363
- " disable selected language features (smaller code size)\n" );
364
- }
365
- #endif
366
330
exit (1 );
367
331
}
368
332
@@ -379,7 +343,6 @@ int main(int argc, char **argv)
379
343
FILE * fo ;
380
344
JSRuntime * rt ;
381
345
JSContext * ctx ;
382
- BOOL use_lto ;
383
346
int module ;
384
347
OutputTypeEnum output_type ;
385
348
size_t stack_size ;
@@ -388,11 +351,9 @@ int main(int argc, char **argv)
388
351
out_filename = NULL ;
389
352
output_type = OUTPUT_C ;
390
353
cname = NULL ;
391
- feature_bitmap = FE_ALL ;
392
354
module = -1 ;
393
355
byte_swap = FALSE;
394
356
verbose = 0 ;
395
- use_lto = FALSE;
396
357
stack_size = 0 ;
397
358
memset (& dynamic_module_list , 0 , sizeof (dynamic_module_list ));
398
359
@@ -401,7 +362,7 @@ int main(int argc, char **argv)
401
362
namelist_add (& cmodule_list , "os" , "os" , 0 );
402
363
403
364
for (;;) {
404
- c = getopt (argc , argv , "ho:N:f: mxevM:p:S:D:" );
365
+ c = getopt (argc , argv , "ho:N:mxevM:p:S:D:" );
405
366
if (c == -1 )
406
367
break ;
407
368
switch (c ) {
@@ -416,29 +377,6 @@ int main(int argc, char **argv)
416
377
case 'N' :
417
378
cname = optarg ;
418
379
break ;
419
- case 'f' :
420
- {
421
- const char * p ;
422
- p = optarg ;
423
- if (!strcmp (optarg , "lto" )) {
424
- use_lto = TRUE;
425
- } else if (strstart (p , "no-" , & p )) {
426
- use_lto = TRUE;
427
- for (i = 0 ; i < countof (feature_list ); i ++ ) {
428
- if (!strcmp (p , feature_list [i ].option_name )) {
429
- feature_bitmap &= ~((uint64_t )1 << i );
430
- break ;
431
- }
432
- }
433
- if (i == countof (feature_list ))
434
- goto bad_feature ;
435
- } else {
436
- bad_feature :
437
- fprintf (stderr , "unsupported feature: %s\n" , optarg );
438
- exit (1 );
439
- }
440
- }
441
- break ;
442
380
case 'm' :
443
381
module = 1 ;
444
382
break ;
@@ -531,18 +469,9 @@ int main(int argc, char **argv)
531
469
fprintf (fo ,
532
470
"static JSContext *JS_NewCustomContext(JSRuntime *rt)\n"
533
471
"{\n"
534
- " JSContext *ctx = JS_NewContextRaw (rt);\n"
472
+ " JSContext *ctx = JS_NewContext (rt);\n"
535
473
" if (!ctx)\n"
536
474
" return NULL;\n" );
537
- /* add the basic objects */
538
- fprintf (fo , " JS_AddIntrinsicBaseObjects(ctx);\n" );
539
- for (i = 0 ; i < countof (feature_list ); i ++ ) {
540
- if ((feature_bitmap & ((uint64_t )1 << i )) &&
541
- feature_list [i ].init_name ) {
542
- fprintf (fo , " JS_AddIntrinsic%s(ctx);\n" ,
543
- feature_list [i ].init_name );
544
- }
545
- }
546
475
/* add the precompiled modules (XXX: could modify the module
547
476
loader instead) */
548
477
for (i = 0 ; i < init_module_list .count ; i ++ ) {
@@ -574,10 +503,8 @@ int main(int argc, char **argv)
574
503
(unsigned int )stack_size );
575
504
}
576
505
577
- /* add the module loader if necessary */
578
- if (feature_bitmap & (1 << FE_MODULE_LOADER )) {
579
- fprintf (fo , " JS_SetModuleLoaderFunc(rt, NULL, js_module_loader, NULL);\n" );
580
- }
506
+ /* add the module loader */
507
+ fprintf (fo , " JS_SetModuleLoaderFunc(rt, NULL, js_module_loader, NULL);\n" );
581
508
582
509
fprintf (fo ,
583
510
" ctx = JS_NewCustomContext(rt);\n"
0 commit comments