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:
Péter Gál
2019-04-09 10:14:46 +02:00
committed by Robert Fancsik
parent 722d092528
commit 40f7b1c27f
213 changed files with 1902 additions and 1649 deletions
+28 -28
View File
@@ -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);