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
@@ -30,15 +30,15 @@
|
||||
#include "vm-defines.h"
|
||||
#include "vm-stack.h"
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY)
|
||||
#include "ecma-typedarray-object.h"
|
||||
#endif /* !CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN */
|
||||
#ifndef CONFIG_DISABLE_ES2015_PROMISE_BUILTIN
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_PROMISE)
|
||||
#include "ecma-promise-object.h"
|
||||
#endif /* !CONFIG_DISABLE_ES2015_PROMISE_BUILTIN */
|
||||
#ifndef CONFIG_DISABLE_ES2015_MAP_BUILTIN
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_MAP)
|
||||
#include "ecma-map-object.h"
|
||||
#endif /* !CONFIG_DISABLE_ES2015_MAP_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_MAP) */
|
||||
|
||||
/* TODO: Extract GC to a separate component */
|
||||
|
||||
@@ -209,7 +209,7 @@ ecma_gc_mark_property (ecma_property_pair_t *property_pair_p, /**< property pair
|
||||
}
|
||||
} /* ecma_gc_mark_property */
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_PROMISE_BUILTIN
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_PROMISE)
|
||||
|
||||
/**
|
||||
* Mark objects referenced by Promise built-in.
|
||||
@@ -244,9 +244,9 @@ ecma_gc_mark_promise_object (ecma_extended_object_t *ext_object_p) /**< extended
|
||||
}
|
||||
} /* ecma_gc_mark_promise_object */
|
||||
|
||||
#endif /* !CONFIG_DISABLE_ES2015_PROMISE_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_MAP_BUILTIN
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_MAP)
|
||||
|
||||
/**
|
||||
* Mark objects referenced by Map built-in.
|
||||
@@ -288,7 +288,7 @@ ecma_gc_mark_map_object (ecma_extended_object_t *ext_object_p) /**< extended obj
|
||||
}
|
||||
} /* ecma_gc_mark_map_object */
|
||||
|
||||
#endif /* !CONFIG_DISABLE_ES2015_MAP_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_MAP) */
|
||||
|
||||
/**
|
||||
* Mark objects as visited starting from specified object as root
|
||||
@@ -333,20 +333,20 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
|
||||
|
||||
switch (ext_object_p->u.class_prop.class_id)
|
||||
{
|
||||
#ifndef CONFIG_DISABLE_ES2015_PROMISE_BUILTIN
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_PROMISE)
|
||||
case LIT_MAGIC_STRING_PROMISE_UL:
|
||||
{
|
||||
ecma_gc_mark_promise_object (ext_object_p);
|
||||
break;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_PROMISE_BUILTIN */
|
||||
#ifndef CONFIG_DISABLE_ES2015_MAP_BUILTIN
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_MAP)
|
||||
case LIT_MAGIC_STRING_MAP_UL:
|
||||
{
|
||||
ecma_gc_mark_map_object (ext_object_p);
|
||||
break;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_MAP_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_MAP) */
|
||||
default:
|
||||
{
|
||||
break;
|
||||
@@ -361,15 +361,15 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
|
||||
|
||||
switch (ext_object_p->u.pseudo_array.type)
|
||||
{
|
||||
#ifndef CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY)
|
||||
case ECMA_PSEUDO_ARRAY_TYPEDARRAY:
|
||||
case ECMA_PSEUDO_ARRAY_TYPEDARRAY_WITH_INFO:
|
||||
{
|
||||
ecma_gc_set_object_visited (ecma_typedarray_get_arraybuffer (object_p));
|
||||
break;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN */
|
||||
#ifndef CONFIG_DISABLE_ES2015_ITERATOR_BUILTIN
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR)
|
||||
case ECMA_PSEUDO_ARRAY_ITERATOR:
|
||||
{
|
||||
ecma_object_t *iterated_obj_p = ECMA_GET_POINTER (ecma_object_t,
|
||||
@@ -381,7 +381,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_ITERATOR_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) */
|
||||
default:
|
||||
{
|
||||
JERRY_ASSERT (ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS);
|
||||
@@ -442,7 +442,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
|
||||
}
|
||||
break;
|
||||
}
|
||||
#ifndef CONFIG_DISABLE_ES2015_ARROW_FUNCTION
|
||||
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
|
||||
case ECMA_OBJECT_TYPE_ARROW_FUNCTION:
|
||||
{
|
||||
ecma_arrow_function_t *arrow_func_p = (ecma_arrow_function_t *) object_p;
|
||||
@@ -456,7 +456,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_ARROW_FUNCTION */
|
||||
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
|
||||
default:
|
||||
{
|
||||
break;
|
||||
@@ -605,9 +605,9 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
|
||||
switch (ext_object_p->u.class_prop.class_id)
|
||||
{
|
||||
#ifndef CONFIG_DISABLE_ES2015_SYMBOL_BUILTIN
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
|
||||
case LIT_MAGIC_STRING_SYMBOL_UL:
|
||||
#endif /* !CONFIG_DISABLE_ES2015_SYMBOL_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
|
||||
case LIT_MAGIC_STRING_STRING_UL:
|
||||
case LIT_MAGIC_STRING_NUMBER_UL:
|
||||
{
|
||||
@@ -635,7 +635,7 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
}
|
||||
break;
|
||||
}
|
||||
#ifndef CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY)
|
||||
case LIT_MAGIC_STRING_ARRAY_BUFFER_UL:
|
||||
{
|
||||
ecma_length_t arraybuffer_length = ext_object_p->u.class_prop.u.length;
|
||||
@@ -662,8 +662,8 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
ecma_dealloc_extended_object (object_p, size);
|
||||
return;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN */
|
||||
#ifndef CONFIG_DISABLE_ES2015_PROMISE_BUILTIN
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_PROMISE)
|
||||
case LIT_MAGIC_STRING_PROMISE_UL:
|
||||
{
|
||||
ecma_free_value_if_not_object (ext_object_p->u.class_prop.u.value);
|
||||
@@ -674,15 +674,15 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
ecma_dealloc_extended_object (object_p, sizeof (ecma_promise_object_t));
|
||||
return;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_PROMISE_BUILTIN */
|
||||
#ifndef CONFIG_DISABLE_ES2015_MAP_BUILTIN
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_MAP)
|
||||
case LIT_MAGIC_STRING_MAP_UL:
|
||||
{
|
||||
ecma_op_map_clear_map ((ecma_map_object_t *) object_p);
|
||||
ecma_dealloc_extended_object (object_p, sizeof (ecma_map_object_t));
|
||||
return;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_MAP_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_MAP) */
|
||||
default:
|
||||
{
|
||||
/* The undefined id represents an uninitialized class. */
|
||||
@@ -730,7 +730,7 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_ARROW_FUNCTION
|
||||
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
|
||||
if (object_type == ECMA_OBJECT_TYPE_ARROW_FUNCTION)
|
||||
{
|
||||
ecma_arrow_function_t *arrow_func_p = (ecma_arrow_function_t *) object_p;
|
||||
@@ -755,7 +755,7 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
return;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_ARROW_FUNCTION */
|
||||
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
|
||||
|
||||
if (object_type == ECMA_OBJECT_TYPE_PSEUDO_ARRAY)
|
||||
{
|
||||
@@ -763,7 +763,7 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
|
||||
switch (ext_object_p->u.pseudo_array.type)
|
||||
{
|
||||
#ifndef CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY)
|
||||
case ECMA_PSEUDO_ARRAY_TYPEDARRAY:
|
||||
{
|
||||
ecma_dealloc_extended_object (object_p, sizeof (ecma_extended_object_t));
|
||||
@@ -774,14 +774,14 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
ecma_dealloc_extended_object (object_p, sizeof (ecma_extended_typedarray_object_t));
|
||||
return;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN */
|
||||
#ifndef CONFIG_DISABLE_ES2015_ITERATOR_BUILTIN
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR)
|
||||
case ECMA_PSEUDO_ARRAY_ITERATOR:
|
||||
{
|
||||
ecma_dealloc_extended_object (object_p, sizeof (ecma_extended_object_t));
|
||||
return;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_ITERATOR_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) */
|
||||
default:
|
||||
{
|
||||
JERRY_ASSERT (ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS);
|
||||
@@ -983,10 +983,10 @@ ecma_gc_run (jmem_free_unused_memory_severity_t severity) /**< gc severity */
|
||||
|
||||
JERRY_CONTEXT (ecma_gc_objects_p) = black_objects_p;
|
||||
|
||||
#ifndef CONFIG_DISABLE_REGEXP_BUILTIN
|
||||
#if ENABLED (JERRY_BUILTIN_REGEXP)
|
||||
/* Free RegExp bytecodes stored in cache */
|
||||
re_cache_gc_run ();
|
||||
#endif /* !CONFIG_DISABLE_REGEXP_BUILTIN */
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
|
||||
} /* ecma_gc_run */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user