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:
@@ -50,10 +50,10 @@ typedef struct vm_frame_ctx_t
|
||||
struct vm_frame_ctx_t *prev_context_p; /**< previous context */
|
||||
ecma_value_t this_binding; /**< this binding */
|
||||
ecma_value_t block_result; /**< block result */
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
ecma_value_t resource_name; /**< current resource name (usually a file name) */
|
||||
uint32_t current_line; /**< currently executed line */
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
uint16_t context_depth; /**< current context depth */
|
||||
uint8_t is_eval_code; /**< eval mode flag */
|
||||
uint8_t call_operation; /**< perform a call or construct operation */
|
||||
|
||||
@@ -60,7 +60,7 @@ vm_is_direct_eval_form_call (void)
|
||||
ecma_value_t
|
||||
vm_get_backtrace (uint32_t max_depth) /**< maximum backtrace depth, 0 = unlimited */
|
||||
{
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
ecma_value_t result_array = ecma_op_create_array_object (NULL, 0, false);
|
||||
|
||||
if (max_depth == 0)
|
||||
@@ -124,9 +124,9 @@ vm_get_backtrace (uint32_t max_depth) /**< maximum backtrace depth, 0 = unlimite
|
||||
}
|
||||
|
||||
return result_array;
|
||||
#else /* !JERRY_ENABLE_LINE_INFO */
|
||||
#else /* !ENABLED (JERRY_LINE_INFO) */
|
||||
JERRY_UNUSED (max_depth);
|
||||
|
||||
return ecma_op_create_array_object (NULL, 0, false);
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
} /* vm_get_backtrace */
|
||||
|
||||
+33
-33
@@ -46,9 +46,9 @@
|
||||
/*
|
||||
* Check VM recursion depth limit
|
||||
*/
|
||||
#ifdef VM_RECURSION_LIMIT
|
||||
JERRY_STATIC_ASSERT (VM_RECURSION_LIMIT > 0, vm_recursion_limit_must_be_greater_than_zero);
|
||||
#endif /* VM_RECURSION_LIMIT */
|
||||
#if defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0)
|
||||
JERRY_STATIC_ASSERT (JERRY_VM_RECURSION_LIMIT > 0, vm_recursion_limit_must_be_greater_than_zero);
|
||||
#endif /* defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0) */
|
||||
|
||||
/**
|
||||
* Get the value of object[property].
|
||||
@@ -87,7 +87,7 @@ vm_op_get_value (ecma_value_t object, /**< base object */
|
||||
|
||||
if (property_name_p != NULL)
|
||||
{
|
||||
#ifndef CONFIG_ECMA_LCACHE_DISABLE
|
||||
#if ENABLED (JERRY_LCACHE)
|
||||
ecma_object_t *object_p = ecma_get_object_from_value (object);
|
||||
ecma_property_t *property_p = ecma_lcache_lookup (object_p, property_name_p);
|
||||
|
||||
@@ -96,7 +96,7 @@ vm_op_get_value (ecma_value_t object, /**< base object */
|
||||
{
|
||||
return ecma_fast_copy_value (ECMA_PROPERTY_VALUE_PTR (property_p)->value);
|
||||
}
|
||||
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
|
||||
#endif /* ENABLED (JERRY_LCACHE) */
|
||||
|
||||
/* There is no need to free the name. */
|
||||
return ecma_op_object_get (ecma_get_object_from_value (object), property_name_p);
|
||||
@@ -105,14 +105,14 @@ vm_op_get_value (ecma_value_t object, /**< base object */
|
||||
|
||||
if (JERRY_UNLIKELY (ecma_is_value_undefined (object) || ecma_is_value_null (object)))
|
||||
{
|
||||
#ifdef JERRY_ENABLE_ERROR_MESSAGES
|
||||
#if ENABLED (JERRY_ERROR_MESSAGES)
|
||||
ecma_value_t error_value = ecma_raise_standard_error_with_format (ECMA_ERROR_TYPE,
|
||||
"Cannot read property '%' of %",
|
||||
property,
|
||||
object);
|
||||
#else /* !JERRY_ENABLE_ERROR_MESSAGES */
|
||||
#else /* !ENABLED (JERRY_ERROR_MESSAGES) */
|
||||
ecma_value_t error_value = ecma_raise_type_error (NULL);
|
||||
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
|
||||
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
|
||||
return error_value;
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ vm_op_set_value (ecma_value_t object, /**< base object */
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (to_object))
|
||||
{
|
||||
#ifdef JERRY_ENABLE_ERROR_MESSAGES
|
||||
#if ENABLED (JERRY_ERROR_MESSAGES)
|
||||
ecma_free_value (to_object);
|
||||
ecma_free_value (JERRY_CONTEXT (error_value));
|
||||
|
||||
@@ -162,10 +162,10 @@ vm_op_set_value (ecma_value_t object, /**< base object */
|
||||
ecma_free_value (property);
|
||||
|
||||
return error_value;
|
||||
#else /* !JERRY_ENABLE_ERROR_MESSAGES */
|
||||
#else /* !ENABLED (JERRY_ERROR_MESSAGES) */
|
||||
ecma_free_value (property);
|
||||
return to_object;
|
||||
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
|
||||
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
|
||||
}
|
||||
|
||||
object = to_object;
|
||||
@@ -219,7 +219,7 @@ vm_op_set_value (ecma_value_t object, /**< base object */
|
||||
/**
|
||||
* Decode table for both opcodes and extended opcodes.
|
||||
*/
|
||||
static const uint16_t vm_decode_table[] JERRY_CONST_DATA =
|
||||
static const uint16_t vm_decode_table[] JERRY_ATTR_CONST_DATA =
|
||||
{
|
||||
CBC_OPCODE_LIST
|
||||
CBC_EXT_OPCODE_LIST
|
||||
@@ -338,14 +338,14 @@ vm_run_eval (ecma_compiled_code_t *bytecode_data_p, /**< byte-code data */
|
||||
ecma_deref_object (lex_env_p);
|
||||
ecma_free_value (this_binding);
|
||||
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
|
||||
#if ENABLED (JERRY_SNAPSHOT_EXEC)
|
||||
if (!(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))
|
||||
{
|
||||
ecma_bytecode_deref (bytecode_data_p);
|
||||
}
|
||||
#else /* !JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
#else /* !ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
ecma_bytecode_deref (bytecode_data_p);
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
|
||||
return completion_value;
|
||||
} /* vm_run_eval */
|
||||
@@ -361,20 +361,20 @@ vm_construct_literal_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
{
|
||||
ecma_compiled_code_t *bytecode_p;
|
||||
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
|
||||
#if ENABLED (JERRY_SNAPSHOT_EXEC)
|
||||
if (JERRY_LIKELY (!(frame_ctx_p->bytecode_header_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)))
|
||||
{
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
|
||||
lit_value);
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
|
||||
#if ENABLED (JERRY_SNAPSHOT_EXEC)
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t *byte_p = ((uint8_t *) frame_ctx_p->bytecode_header_p) + lit_value;
|
||||
bytecode_p = (ecma_compiled_code_t *) byte_p;
|
||||
}
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_REGEXP)
|
||||
if (!(bytecode_p->status_flags & CBC_CODE_FLAGS_FUNCTION))
|
||||
@@ -870,14 +870,14 @@ vm_init_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
|
||||
#if ENABLED (JERRY_SNAPSHOT_EXEC)
|
||||
case CBC_SET_BYTECODE_PTR:
|
||||
{
|
||||
memcpy (&byte_code_p, byte_code_p + 1, sizeof (uint8_t *));
|
||||
frame_ctx_p->byte_code_start_p = byte_code_p;
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
|
||||
default:
|
||||
{
|
||||
@@ -1036,7 +1036,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
if (opcode_data & VM_OC_BACKWARD_BRANCH)
|
||||
{
|
||||
#ifdef JERRY_VM_EXEC_STOP
|
||||
#if ENABLED (JERRY_VM_EXEC_STOP)
|
||||
if (JERRY_CONTEXT (vm_exec_stop_cb) != NULL
|
||||
&& --JERRY_CONTEXT (vm_exec_stop_counter) == 0)
|
||||
{
|
||||
@@ -1064,7 +1064,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
#endif /* JERRY_VM_EXEC_STOP */
|
||||
#endif /* ENABLED (JERRY_VM_EXEC_STOP) */
|
||||
|
||||
branch_offset = -branch_offset;
|
||||
}
|
||||
@@ -2572,7 +2572,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
if (ecma_are_values_integer_numbers (left_value, right_value))
|
||||
{
|
||||
bool is_less = (ecma_integer_value_t) left_value < (ecma_integer_value_t) right_value;
|
||||
#ifndef JERRY_VM_EXEC_STOP
|
||||
#if !ENABLED (JERRY_VM_EXEC_STOP)
|
||||
/* This is a lookahead to the next opcode to improve performance.
|
||||
* If it is CBC_BRANCH_IF_TRUE_BACKWARD, execute it. */
|
||||
if (*byte_code_p <= CBC_BRANCH_IF_TRUE_BACKWARD_3 && *byte_code_p >= CBC_BRANCH_IF_TRUE_BACKWARD)
|
||||
@@ -2606,7 +2606,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
continue;
|
||||
}
|
||||
#endif /* !JERRY_VM_EXEC_STOP */
|
||||
#endif /* !ENABLED (JERRY_VM_EXEC_STOP) */
|
||||
*stack_top_p++ = ecma_make_boolean_value (is_less);
|
||||
continue;
|
||||
}
|
||||
@@ -3178,7 +3178,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
continue;
|
||||
}
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
case VM_OC_RESOURCE_NAME:
|
||||
{
|
||||
ecma_length_t formal_params_number = 0;
|
||||
@@ -3223,7 +3223,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
frame_ctx_p->current_line = value;
|
||||
continue;
|
||||
}
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
default:
|
||||
{
|
||||
JERRY_ASSERT (VM_OC_GROUP_GET_INDEX (opcode_data) == VM_OC_NONE);
|
||||
@@ -3598,9 +3598,9 @@ vm_execute (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
}
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
#ifdef VM_RECURSION_LIMIT
|
||||
#if defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0)
|
||||
JERRY_CONTEXT (vm_recursion_counter)++;
|
||||
#endif /* VM_RECURSION_LIMIT */
|
||||
#endif /* defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0) */
|
||||
|
||||
JERRY_CONTEXT (vm_top_context_p) = frame_ctx_p->prev_context_p;
|
||||
return completion_value;
|
||||
@@ -3622,7 +3622,7 @@ vm_run (const ecma_compiled_code_t *bytecode_header_p, /**< byte-code data heade
|
||||
const ecma_value_t *arg_list_p, /**< arguments list */
|
||||
ecma_length_t arg_list_len) /**< length of arguments list */
|
||||
{
|
||||
#ifdef VM_RECURSION_LIMIT
|
||||
#if defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0)
|
||||
if (JERRY_UNLIKELY (JERRY_CONTEXT (vm_recursion_counter) == 0))
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("VM recursion limit is exceeded."));
|
||||
@@ -3631,7 +3631,7 @@ vm_run (const ecma_compiled_code_t *bytecode_header_p, /**< byte-code data heade
|
||||
{
|
||||
JERRY_CONTEXT (vm_recursion_counter)--;
|
||||
}
|
||||
#endif /* VM_RECURSION_LIMIT */
|
||||
#endif /* defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0) */
|
||||
|
||||
ecma_value_t *literal_p;
|
||||
vm_frame_ctx_t frame_ctx;
|
||||
@@ -3665,10 +3665,10 @@ vm_run (const ecma_compiled_code_t *bytecode_header_p, /**< byte-code data heade
|
||||
frame_ctx.prev_context_p = JERRY_CONTEXT (vm_top_context_p);
|
||||
frame_ctx.this_binding = this_binding_value;
|
||||
frame_ctx.block_result = ECMA_VALUE_UNDEFINED;
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
frame_ctx.resource_name = ECMA_VALUE_UNDEFINED;
|
||||
frame_ctx.current_line = 0;
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
frame_ctx.context_depth = 0;
|
||||
frame_ctx.is_eval_code = parse_opts & ECMA_PARSE_DIRECT_EVAL;
|
||||
|
||||
|
||||
+4
-4
@@ -236,10 +236,10 @@ typedef enum
|
||||
VM_OC_BREAKPOINT_ENABLED, /**< enabled breakpoint for debugger */
|
||||
VM_OC_BREAKPOINT_DISABLED, /**< disabled breakpoint for debugger */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
VM_OC_RESOURCE_NAME, /**< resource name of the current function */
|
||||
VM_OC_LINE, /**< line number of the next statement */
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
VM_OC_NONE, /**< a special opcode for unsupported byte codes */
|
||||
} vm_oc_types;
|
||||
|
||||
@@ -255,10 +255,10 @@ typedef enum
|
||||
VM_OC_BREAKPOINT_ENABLED = VM_OC_NONE, /**< enabled breakpoint for debugger is unused */
|
||||
VM_OC_BREAKPOINT_DISABLED = VM_OC_NONE, /**< disabled breakpoint for debugger is unused */
|
||||
#endif /* !JERRY_DEBUGGER */
|
||||
#ifndef JERRY_ENABLE_LINE_INFO
|
||||
#if !ENABLED (JERRY_LINE_INFO)
|
||||
VM_OC_RESOURCE_NAME = VM_OC_NONE, /**< resource name of the current function is unused */
|
||||
VM_OC_LINE = VM_OC_NONE, /**< line number of the next statement is unused */
|
||||
#endif /* !JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* !ENABLED (JERRY_LINE_INFO) */
|
||||
#if !ENABLED (JERRY_ES2015_CLASS)
|
||||
VM_OC_CLASS_HERITAGE = VM_OC_NONE, /**< create a super class context */
|
||||
VM_OC_CLASS_INHERITANCE = VM_OC_NONE, /**< inherit properties from the 'super' class */
|
||||
|
||||
Reference in New Issue
Block a user