Rework usages/naming of configuration macros [part 1] (#2793)
There are quite a few configuration macros in the project. As discussed in the #2520 issue there are a few awkward constructs. Main changes: * Renamed all CONFIG_DISABLE_<name>_BUILTIN macro to JERRY_BUILTIN_<name> format. * The special JERRY_BUILTINS macro specifies the basic config for all es5.1 builtins. * Renamed all CONFIG_DISABLE_ES2015_<name> to JERRY_ES2015_<name> format. * The special JERRY_ES2015 macro specifies the basic config for all es2015 builtins. * Renamed UNICODE_CASE_CONVERSION to JERRY_UNICODE_CASE_CONVERSION. * Renamed ENABLE_REGEXP_STRICT_MODE to JERRY_REGEXP_STRICT_MODE. * All options (in this change) can have a value of 0 or 1. * Renamed ENABLE_REGEXP_STRICT_MODE to JERRY_REGEXP_STRICT_MODE. JERRY_REGEXP_STRICT_MODE is set to 0 by default. * Reworked CONFIG_ECMA_NUMBER_TYPE macro to JERRY_NUMBER_TYPE_FLOAT64 name and now it uses the value 1 for 64 bit floating point numbers and 0 for 32 bit floating point number. By default the 64-bit floating point number mode is enabled. * All new JERRY_ defines can be used wit the `#if ENABLED (JERRY_...)` construct to test if the feature is enabled or not. * Added/replaced a few config.h includes to correctly propagate the macro values. * Added sanity checks for each macro to avoid incorrectly set values. * Updated profile documentation. * The CMake feature names are not updated at this point. JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
This commit is contained in:
committed by
Robert Fancsik
parent
722d092528
commit
40f7b1c27f
@@ -67,9 +67,9 @@ vm_stack_context_abort (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
/* FALLTHRU */
|
||||
}
|
||||
case VM_CONTEXT_WITH:
|
||||
#ifndef CONFIG_DISABLE_ES2015_CLASS
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
case VM_CONTEXT_SUPER_CLASS:
|
||||
#endif /* !CONFIG_DISABLE_ES2015_CLASS */
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
{
|
||||
ecma_object_t *lex_env_p = frame_ctx_p->lex_env_p;
|
||||
frame_ctx_p->lex_env_p = ecma_get_lex_env_outer_reference (lex_env_p);
|
||||
|
||||
@@ -57,9 +57,9 @@ typedef enum
|
||||
VM_CONTEXT_TRY, /**< try context */
|
||||
VM_CONTEXT_CATCH, /**< catch context */
|
||||
VM_CONTEXT_WITH, /**< with context */
|
||||
#ifndef CONFIG_DISABLE_ES2015_CLASS
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
VM_CONTEXT_SUPER_CLASS, /**< super class context */
|
||||
#endif /* !CONFIG_DISABLE_ES2015_CLASS */
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
VM_CONTEXT_FOR_IN, /**< for-in context */
|
||||
} vm_stack_context_type_t;
|
||||
|
||||
|
||||
+28
-28
@@ -77,12 +77,12 @@ vm_op_get_value (ecma_value_t object, /**< base object */
|
||||
property_name_p = ecma_get_string_from_value (property);
|
||||
}
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_SYMBOL_BUILTIN
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
|
||||
if (ecma_is_value_symbol (property))
|
||||
{
|
||||
property_name_p = ecma_get_symbol_from_value (property);
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_SYMBOL_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
|
||||
|
||||
if (property_name_p != NULL)
|
||||
{
|
||||
@@ -226,7 +226,7 @@ static const uint16_t vm_decode_table[] JERRY_CONST_DATA =
|
||||
|
||||
#undef CBC_OPCODE
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_MODULE_SYSTEM
|
||||
#if ENABLED (JERRY_ES2015_MODULE_SYSTEM)
|
||||
/**
|
||||
* Run ES2015 module code
|
||||
*
|
||||
@@ -255,7 +255,7 @@ vm_run_module (const ecma_compiled_code_t *bytecode_p, /**< pointer to bytecode
|
||||
|
||||
return ret_value;
|
||||
} /* vm_run_module */
|
||||
#endif /* !CONFIG_DISABLE_ES2015_MODULE_SYSTEM */
|
||||
#endif /* ENABLED (JERRY_ES2015_MODULE_SYSTEM) */
|
||||
|
||||
/**
|
||||
* Run global code
|
||||
@@ -382,7 +382,7 @@ vm_construct_literal_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
}
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
|
||||
#ifndef CONFIG_DISABLE_REGEXP_BUILTIN
|
||||
#if ENABLED (JERRY_BUILTIN_REGEXP)
|
||||
if (!(bytecode_p->status_flags & CBC_CODE_FLAGS_FUNCTION))
|
||||
{
|
||||
ecma_value_t ret_value;
|
||||
@@ -396,19 +396,19 @@ vm_construct_literal_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_REGEXP_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
|
||||
|
||||
JERRY_ASSERT (bytecode_p->status_flags & CBC_CODE_FLAGS_FUNCTION);
|
||||
|
||||
ecma_object_t *func_obj_p;
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_ARROW_FUNCTION
|
||||
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
|
||||
if (!(bytecode_p->status_flags & CBC_CODE_FLAGS_ARROW_FUNCTION))
|
||||
{
|
||||
#endif /* !CONFIG_DISABLE_ES2015_ARROW_FUNCTION */
|
||||
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
|
||||
func_obj_p = ecma_op_create_function_object (frame_ctx_p->lex_env_p,
|
||||
bytecode_p);
|
||||
#ifndef CONFIG_DISABLE_ES2015_ARROW_FUNCTION
|
||||
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -416,7 +416,7 @@ vm_construct_literal_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
bytecode_p,
|
||||
frame_ctx_p->this_binding);
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_ARROW_FUNCTION */
|
||||
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
|
||||
|
||||
return ecma_make_object_value (func_obj_p);
|
||||
} /* vm_construct_literal_object */
|
||||
@@ -456,7 +456,7 @@ static const uint8_t vm_error_byte_code_p[] =
|
||||
CBC_EXT_OPCODE, CBC_EXT_ERROR
|
||||
};
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_CLASS
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
/**
|
||||
* 'super(...)' function call handler.
|
||||
*/
|
||||
@@ -531,7 +531,7 @@ vm_super_call (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
frame_ctx_p->stack_top_p = stack_top_p;
|
||||
} /* vm_super_call */
|
||||
#endif /* !CONFIG_DISABLE_ES2015_CLASS */
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
|
||||
/**
|
||||
* 'Function call' opcode handler.
|
||||
@@ -1211,7 +1211,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
*stack_top_p++ = left_value;
|
||||
continue;
|
||||
}
|
||||
#ifndef CONFIG_DISABLE_ES2015_OBJECT_INITIALIZER
|
||||
#if ENABLED (JERRY_ES2015_OBJECT_INITIALIZER)
|
||||
case VM_OC_SET_COMPUTED_PROPERTY:
|
||||
{
|
||||
/* Swap values. */
|
||||
@@ -1220,7 +1220,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
left_value ^= right_value;
|
||||
/* FALLTHRU */
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_OBJECT_INITIALIZER */
|
||||
#endif /* ENABLED (JERRY_ES2015_OBJECT_INITIALIZER) */
|
||||
case VM_OC_SET_PROPERTY:
|
||||
{
|
||||
JERRY_STATIC_ASSERT (VM_OC_NON_STATIC_FLAG == VM_OC_BACKWARD_BRANCH,
|
||||
@@ -1236,7 +1236,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
goto error;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_CLASS
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
if (JERRY_UNLIKELY (ecma_compare_ecma_string_to_magic_id (prop_name_p, LIT_MAGIC_STRING_PROTOTYPE))
|
||||
&& !(opcode_data & VM_OC_NON_STATIC_FLAG))
|
||||
{
|
||||
@@ -1245,9 +1245,9 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
}
|
||||
|
||||
const int index = (int) (opcode_data >> VM_OC_NON_STATIC_SHIFT) - 2;
|
||||
#else /* CONFIG_DISABLE_ES2015_CLASS */
|
||||
#else /* !ENABLED (JERRY_ES2015_CLASS) */
|
||||
const int index = -1;
|
||||
#endif /* !CONFIG_DISABLE_ES2015_CLASS */
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
|
||||
ecma_object_t *object_p = ecma_get_object_from_value (stack_top_p[index]);
|
||||
ecma_property_t *property_p = ecma_find_named_property (object_p, prop_name_p);
|
||||
@@ -1292,7 +1292,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
goto error;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_CLASS
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
if (JERRY_UNLIKELY (ecma_compare_ecma_string_to_magic_id (prop_name_p, LIT_MAGIC_STRING_PROTOTYPE))
|
||||
&& !(opcode_data & VM_OC_NON_STATIC_FLAG))
|
||||
{
|
||||
@@ -1301,9 +1301,9 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
}
|
||||
|
||||
const int index = (int) (opcode_data >> VM_OC_NON_STATIC_SHIFT) - 2;
|
||||
#else /* CONFIG_DISABLE_ES2015_CLASS */
|
||||
#else /* !ENABLED (JERRY_ES2015_CLASS) */
|
||||
const int index = -1;
|
||||
#endif /* !CONFIG_DISABLE_ES2015_CLASS */
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
|
||||
opfunc_set_accessor (VM_OC_GROUP_GET_INDEX (opcode_data) == VM_OC_SET_GETTER,
|
||||
stack_top_p[index],
|
||||
@@ -1326,7 +1326,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
*stack_top_p++ = result;
|
||||
continue;
|
||||
}
|
||||
#ifndef CONFIG_DISABLE_ES2015_CLASS
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
case VM_OC_SUPER_CALL:
|
||||
{
|
||||
frame_ctx_p->call_operation = VM_EXEC_SUPER_CALL;
|
||||
@@ -1601,7 +1601,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
goto error;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_CLASS */
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
case VM_OC_PUSH_ELISON:
|
||||
{
|
||||
*stack_top_p++ = ECMA_VALUE_ARRAY_HOLE;
|
||||
@@ -3427,9 +3427,9 @@ vm_execute (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
|
||||
frame_ctx_p->stack_top_p = frame_ctx_p->registers_p + register_end;
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_FUNCTION_REST_PARAMETER
|
||||
#if ENABLED (JERRY_ES2015_FUNCTION_REST_PARAMETER)
|
||||
uint32_t function_call_argument_count = arg_list_len;
|
||||
#endif /* !CONFIG_DISABLE_ES2015_FUNCTION_REST_PARAMETER */
|
||||
#endif /* ENABLED (JERRY_ES2015_FUNCTION_REST_PARAMETER) */
|
||||
|
||||
if (arg_list_len > argument_end)
|
||||
{
|
||||
@@ -3453,7 +3453,7 @@ vm_execute (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_FUNCTION_REST_PARAMETER
|
||||
#if ENABLED (JERRY_ES2015_FUNCTION_REST_PARAMETER)
|
||||
if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_REST_PARAMETER)
|
||||
{
|
||||
JERRY_ASSERT (function_call_argument_count >= arg_list_len);
|
||||
@@ -3464,7 +3464,7 @@ vm_execute (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
frame_ctx_p->registers_p[argument_end] = new_array;
|
||||
arg_list_len++;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_FUNCTION_REST_PARAMETER */
|
||||
#endif /* ENABLED (JERRY_ES2015_FUNCTION_REST_PARAMETER) */
|
||||
|
||||
JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_DIRECT_EVAL;
|
||||
|
||||
@@ -3483,13 +3483,13 @@ vm_execute (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
opfunc_call (frame_ctx_p);
|
||||
break;
|
||||
}
|
||||
#ifndef CONFIG_DISABLE_ES2015_CLASS
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
case VM_EXEC_SUPER_CALL:
|
||||
{
|
||||
vm_super_call (frame_ctx_p);
|
||||
break;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_CLASS */
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
case VM_EXEC_CONSTRUCT:
|
||||
{
|
||||
opfunc_construct (frame_ctx_p);
|
||||
|
||||
+10
-10
@@ -122,9 +122,9 @@ typedef enum
|
||||
VM_OC_PUSH_OBJECT, /**< push object */
|
||||
VM_OC_PUSH_NAMED_FUNC_EXPR, /**< push named function expression */
|
||||
VM_OC_SET_PROPERTY, /**< set property */
|
||||
#ifndef CONFIG_DISABLE_ES2015_OBJECT_INITIALIZER
|
||||
#if ENABLED (JERRY_ES2015_OBJECT_INITIALIZER)
|
||||
VM_OC_SET_COMPUTED_PROPERTY, /**< set computed property */
|
||||
#endif /* !CONFIG_DISABLE_ES2015_OBJECT_INITIALIZER */
|
||||
#endif /* ENABLED (JERRY_ES2015_OBJECT_INITIALIZER) */
|
||||
VM_OC_SET_GETTER, /**< set getter */
|
||||
VM_OC_SET_SETTER, /**< set setter */
|
||||
VM_OC_PUSH_UNDEFINED_BASE, /**< push undefined base */
|
||||
@@ -212,7 +212,7 @@ typedef enum
|
||||
VM_OC_FINALLY, /**< finally */
|
||||
VM_OC_CONTEXT_END, /**< context end */
|
||||
VM_OC_JUMP_AND_EXIT_CONTEXT, /**< jump and exit context */
|
||||
#ifndef CONFIG_DISABLE_ES2015_CLASS
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
VM_OC_CLASS_HERITAGE, /**< create a super class context */
|
||||
VM_OC_CLASS_INHERITANCE, /**< inherit properties from the 'super' class */
|
||||
VM_OC_PUSH_CLASS_CONSTRUCTOR, /**< push class constructor */
|
||||
@@ -226,7 +226,7 @@ typedef enum
|
||||
VM_OC_PUSH_CONSTRUCTOR_SUPER, /**< push 'super' inside a class constructor */
|
||||
VM_OC_PUSH_CONSTRUCTOR_THIS, /**< push 'this' inside a class constructor */
|
||||
VM_OC_CONSTRUCTOR_RET, /**< explicit return from a class constructor */
|
||||
#endif /* !CONFIG_DISABLE_ES2015 */
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
#ifdef JERRY_DEBUGGER
|
||||
VM_OC_BREAKPOINT_ENABLED, /**< enabled breakpoint for debugger */
|
||||
VM_OC_BREAKPOINT_DISABLED, /**< disabled breakpoint for debugger */
|
||||
@@ -243,9 +243,9 @@ typedef enum
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
#ifdef CONFIG_DISABLE_ES2015_OBJECT_INITIALIZER
|
||||
#if !ENABLED (JERRY_ES2015_OBJECT_INITIALIZER)
|
||||
VM_OC_SET_COMPUTED_PROPERTY = VM_OC_NONE, /**< set computed property is unused */
|
||||
#endif /* CONFIG_DISABLE_ES2015_OBJECT_INITIALIZER */
|
||||
#endif /* !ENABLED (JERRY_ES2015_OBJECT_INITIALIZER) */
|
||||
#ifndef JERRY_DEBUGGER
|
||||
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 */
|
||||
@@ -254,7 +254,7 @@ typedef enum
|
||||
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 */
|
||||
#ifdef CONFIG_DISABLE_ES2015_CLASS
|
||||
#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 */
|
||||
VM_OC_PUSH_CLASS_CONSTRUCTOR = VM_OC_NONE, /**< push class constructor */
|
||||
@@ -268,7 +268,7 @@ typedef enum
|
||||
VM_OC_PUSH_CONSTRUCTOR_SUPER = VM_OC_NONE, /**< push 'super' inside a class constructor */
|
||||
VM_OC_PUSH_CONSTRUCTOR_THIS = VM_OC_NONE, /**< push 'this' inside a class constructor */
|
||||
VM_OC_CONSTRUCTOR_RET = VM_OC_NONE, /**< explicit return from a class constructor */
|
||||
#endif /* CONFIG_DISABLE_ES2015 */
|
||||
#endif /* !ENABLED (JERRY_ES2015_CLASS) */
|
||||
VM_OC_UNUSED = VM_OC_NONE /**< placeholder if the list is empty */
|
||||
} vm_oc_unused_types;
|
||||
|
||||
@@ -355,9 +355,9 @@ typedef enum
|
||||
ecma_value_t vm_run_global (const ecma_compiled_code_t *bytecode_p);
|
||||
ecma_value_t vm_run_eval (ecma_compiled_code_t *bytecode_data_p, uint32_t parse_opts);
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_MODULE_SYSTEM
|
||||
#if ENABLED (JERRY_ES2015_MODULE_SYSTEM)
|
||||
ecma_value_t vm_run_module (const ecma_compiled_code_t *bytecode_p, ecma_object_t *lex_env_p);
|
||||
#endif /* !CONFIG_DISABLE_ES2015_MODULE_SYSTEM */
|
||||
#endif /* ENABLED (JERRY_ES2015_MODULE_SYSTEM) */
|
||||
|
||||
ecma_value_t vm_run (const ecma_compiled_code_t *bytecode_header_p, ecma_value_t this_binding_value,
|
||||
ecma_object_t *lex_env_p, uint32_t parse_opts, const ecma_value_t *arg_list_p,
|
||||
|
||||
Reference in New Issue
Block a user