Rework usages/naming of configuration macros [part 2] (#2903)
There are quite a few configuration macros in the project. As discussed in the #2520 issue there are a few awkward constructs. Main changes: * The following macros are now 0/1 switches: ** Renamed CONFIG_ECMA_LCACHE_DISABLE to JERRY_LCACHE. ** Renamed CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE to JERRY_PROPERTY_HASHMAP. ** Renamed CONFIG_DISABLE_UNICODE_CASE_CONVERSION to JERRY_UNICODE_CASE_CONVERSION. ** Renamed ENABLE_REGEXP_STRICT_MODE to JERRY_REGEXP_STRICT_MODE. ** Renamed JERRY_DISABLE_JS_PARSER to JERRY_PARSER. ** Renamed JERRY_ENABLE_ERROR_MESSAGES to JERRY_ERROR_MESSAGES. ** Renamed JERRY_ENABLE_EXTERNAL_CONTEXT to JERRY_EXTERNAL_CONTEXT. ** Renamed JERRY_ENABLE_LINE_INFO to JERRY_LINE_INFO. ** Renamed JERRY_ENABLE_LOGGING to JERRY_LOGGING. ** Renamed JERRY_ENABLE_SNAPSHOT_EXEC to JERRY_SNAPSHOT_EXEC. ** Renamed JERRY_ENABLE_SNAPSHOT_SAVE to JERRY_SNAPSHOT_SAVE. ** Renamed JERRY_SYSTEM_ALLOCATOR to JERRY_SYSTEM_ALLOCATOR. ** Renamed JERRY_VM_EXEC_STOP to JERRY_VM_EXEC_STOP. ** Renamed JMEM_GC_BEFORE_EACH_ALLOC to JERRY_MEM_GC_BEFORE_EACH_ALLOC. ** Renamed JMEM_STATS to JERRY_MEM_STATS. ** Renamed PARSER_DUMP_BYTE_CODE to JERRY_PARSER_DUMP_BYTE_CODE. ** Renamed REGEXP_DUMP_BYTE_CODE to JERRY_REGEXP_DUMP_BYTE_CODE. * Recursion check changes: ** Renamed REGEXP_RECURSION_LIMIT to JERRY_REGEXP_RECURSION_LIMIT. ** Renamed VM_RECURSION_LIMIT to JERRY_VM_RECURSION_LIMIT. * Attribute macro changes: ** Renamed JERRY_CONST_DATA to JERRY_ATTR_CONST_DATA. ** Renamed JERRY_HEAP_SECTION_ATTR to JERRY_ATTR_GLOBAL_HEAP. Now the macro can specify any attribute for the global heap object. * Other macro changes: ** Renamed CONFIG_MEM_HEAP_AREA_SIZE to JERRY_GLOBAL_HEAP_SIZE. Then new macro now specify the global heap size in kilobytes. * Updated documentations to reflect the new macro names. For more deatils please see jerry-core/config.h. JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
This commit is contained in:
@@ -46,7 +46,7 @@ static const char *output_file_name_p = "js.snapshot";
|
||||
static jerry_length_t magic_string_lengths[JERRY_LITERAL_LENGTH];
|
||||
static const jerry_char_t *magic_string_items[JERRY_LITERAL_LENGTH];
|
||||
|
||||
#ifdef JERRY_ENABLE_EXTERNAL_CONTEXT
|
||||
#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
|
||||
/**
|
||||
* The alloc function passed to jerry_create_context
|
||||
*/
|
||||
@@ -58,7 +58,17 @@ context_alloc (size_t size,
|
||||
return malloc (size);
|
||||
} /* context_alloc */
|
||||
|
||||
#endif /* JERRY_ENABLE_EXTERNAL_CONTEXT */
|
||||
/**
|
||||
* Create and set the default external context.
|
||||
*/
|
||||
static void
|
||||
context_init (void)
|
||||
{
|
||||
jerry_context_t *context_p = jerry_create_context (JERRY_GLOBAL_HEAP_SIZE * 1024, context_alloc, NULL);
|
||||
jerry_port_default_set_current_context (context_p);
|
||||
} /* context_init */
|
||||
|
||||
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
|
||||
|
||||
/**
|
||||
* Check whether JerryScript has a requested feature enabled or not. If not,
|
||||
@@ -308,10 +318,9 @@ process_generate (cli_state_t *cli_state_p, /**< cli state */
|
||||
return JERRY_STANDALONE_EXIT_CODE_FAIL;
|
||||
}
|
||||
|
||||
#ifdef JERRY_ENABLE_EXTERNAL_CONTEXT
|
||||
jerry_context_t *context_p = jerry_create_context (CONFIG_MEM_HEAP_AREA_SIZE, context_alloc, NULL);
|
||||
jerry_port_default_set_current_context (context_p);
|
||||
#endif /* JERRY_ENABLE_EXTERNAL_CONTEXT */
|
||||
#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
|
||||
context_init ();
|
||||
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
|
||||
|
||||
jerry_init (flags);
|
||||
|
||||
@@ -516,10 +525,9 @@ process_literal_dump (cli_state_t *cli_state_p, /**< cli state */
|
||||
return JERRY_STANDALONE_EXIT_CODE_FAIL;
|
||||
}
|
||||
|
||||
#ifdef JERRY_ENABLE_EXTERNAL_CONTEXT
|
||||
jerry_context_t *context_p = jerry_create_context (CONFIG_MEM_HEAP_AREA_SIZE, context_alloc, NULL);
|
||||
jerry_port_default_set_current_context (context_p);
|
||||
#endif /* JERRY_ENABLE_EXTERNAL_CONTEXT */
|
||||
#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
|
||||
context_init ();
|
||||
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
|
||||
|
||||
jerry_init (JERRY_INIT_EMPTY);
|
||||
|
||||
@@ -685,10 +693,9 @@ process_merge (cli_state_t *cli_state_p, /**< cli state */
|
||||
return JERRY_STANDALONE_EXIT_CODE_FAIL;
|
||||
}
|
||||
|
||||
#ifdef JERRY_ENABLE_EXTERNAL_CONTEXT
|
||||
jerry_context_t *context_p = jerry_create_context (CONFIG_MEM_HEAP_AREA_SIZE, context_alloc, NULL);
|
||||
jerry_port_default_set_current_context (context_p);
|
||||
#endif /* JERRY_ENABLE_EXTERNAL_CONTEXT */
|
||||
#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
|
||||
context_init ();
|
||||
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
|
||||
|
||||
jerry_init (JERRY_INIT_EMPTY);
|
||||
|
||||
|
||||
@@ -407,7 +407,7 @@ check_usage (bool condition, /**< the condition that must hold */
|
||||
}
|
||||
} /* check_usage */
|
||||
|
||||
#ifdef JERRY_ENABLE_EXTERNAL_CONTEXT
|
||||
#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
|
||||
|
||||
/**
|
||||
* The alloc function passed to jerry_create_context
|
||||
@@ -420,7 +420,7 @@ context_alloc (size_t size,
|
||||
return malloc (size);
|
||||
} /* context_alloc */
|
||||
|
||||
#endif /* JERRY_ENABLE_EXTERNAL_CONTEXT */
|
||||
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
|
||||
|
||||
/**
|
||||
* Inits the engine and the debugger
|
||||
@@ -666,12 +666,12 @@ main (int argc,
|
||||
is_repl_mode = true;
|
||||
}
|
||||
|
||||
#ifdef JERRY_ENABLE_EXTERNAL_CONTEXT
|
||||
#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
|
||||
|
||||
jerry_context_t *context_p = jerry_create_context (CONFIG_MEM_HEAP_AREA_SIZE, context_alloc, NULL);
|
||||
jerry_context_t *context_p = jerry_create_context (JERRY_GLOBAL_HEAP_SIZE * 1024, context_alloc, NULL);
|
||||
jerry_port_default_set_current_context (context_p);
|
||||
|
||||
#endif /* JERRY_ENABLE_EXTERNAL_CONTEXT */
|
||||
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
|
||||
|
||||
if (!start_debug_server)
|
||||
{
|
||||
@@ -938,8 +938,8 @@ main (int argc,
|
||||
jerry_release_value (ret_value);
|
||||
|
||||
jerry_cleanup ();
|
||||
#ifdef JERRY_ENABLE_EXTERNAL_CONTEXT
|
||||
#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
|
||||
free (context_p);
|
||||
#endif /* JERRY_ENABLE_EXTERNAL_CONTEXT */
|
||||
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
|
||||
return ret_code;
|
||||
} /* main */
|
||||
|
||||
Reference in New Issue
Block a user