@@ -47,35 +47,13 @@ typedef struct namelist_t {
4747 int size ;
4848} namelist_t ;
4949
50- typedef struct {
51- const char * option_name ;
52- const char * init_name ;
53- } FeatureEntry ;
54-
5550static namelist_t cname_list ;
5651static namelist_t cmodule_list ;
5752static namelist_t init_module_list ;
58- static uint64_t feature_bitmap ;
5953static FILE * outfile ;
6054static BOOL byte_swap ;
6155static const char * c_ident_prefix = "qjsc_" ;
6256
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- };
7957
8058void namelist_add (namelist_t * lp , const char * name , const char * short_name ,
8159 int flags )
@@ -349,20 +327,6 @@ void help(void)
349327 "-S n set the maximum stack size to 'n' bytes (default=%d)\n" ,
350328 JS_GetVersion (),
351329 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
366330 exit (1 );
367331}
368332
@@ -379,7 +343,6 @@ int main(int argc, char **argv)
379343 FILE * fo ;
380344 JSRuntime * rt ;
381345 JSContext * ctx ;
382- BOOL use_lto ;
383346 int module ;
384347 OutputTypeEnum output_type ;
385348 size_t stack_size ;
@@ -388,11 +351,9 @@ int main(int argc, char **argv)
388351 out_filename = NULL ;
389352 output_type = OUTPUT_C ;
390353 cname = NULL ;
391- feature_bitmap = FE_ALL ;
392354 module = -1 ;
393355 byte_swap = FALSE;
394356 verbose = 0 ;
395- use_lto = FALSE;
396357 stack_size = 0 ;
397358 memset (& dynamic_module_list , 0 , sizeof (dynamic_module_list ));
398359
@@ -401,7 +362,7 @@ int main(int argc, char **argv)
401362 namelist_add (& cmodule_list , "os" , "os" , 0 );
402363
403364 for (;;) {
404- c = getopt (argc , argv , "ho:N:f: mxevM:p:S:D:" );
365+ c = getopt (argc , argv , "ho:N:mxevM:p:S:D:" );
405366 if (c == -1 )
406367 break ;
407368 switch (c ) {
@@ -416,29 +377,6 @@ int main(int argc, char **argv)
416377 case 'N' :
417378 cname = optarg ;
418379 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 ;
442380 case 'm' :
443381 module = 1 ;
444382 break ;
@@ -531,18 +469,9 @@ int main(int argc, char **argv)
531469 fprintf (fo ,
532470 "static JSContext *JS_NewCustomContext(JSRuntime *rt)\n"
533471 "{\n"
534- " JSContext *ctx = JS_NewContextRaw (rt);\n"
472+ " JSContext *ctx = JS_NewContext (rt);\n"
535473 " if (!ctx)\n"
536474 " 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- }
546475 /* add the precompiled modules (XXX: could modify the module
547476 loader instead) */
548477 for (i = 0 ; i < init_module_list .count ; i ++ ) {
@@ -574,10 +503,8 @@ int main(int argc, char **argv)
574503 (unsigned int )stack_size );
575504 }
576505
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" );
581508
582509 fprintf (fo ,
583510 " ctx = JS_NewCustomContext(rt);\n"
0 commit comments