Re-target for ES.Next (#3901)

A list of changes:
- 'es2015-subset' profile is deprecated, and an 'es.next' profile is added.
- The default profile is changed to 'es.next'
- Renamed the JERRY_ES2015 guard to JERRY_ESNEXT
- Renamed JERRY_ES2015_BUILTIN_* guards to JERRY_BUILTIN_*
- Moved es2015 specific tests to a new 'es.next' subdirectory
- Updated docs, targets, and test runners to reflect these changes

Resolves #3737.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
This commit is contained in:
Dániel Bátyai
2020-06-12 17:55:00 +02:00
committed by GitHub
parent c0270c4887
commit fde0d556ac
832 changed files with 3053 additions and 3046 deletions
+50 -50
View File
@@ -120,7 +120,7 @@ ecma_regexp_parse_flags (ecma_string_t *flags_str_p, /**< Input string with flag
return ret_value;
} /* ecma_regexp_parse_flags */
#if !ENABLED (JERRY_ES2015)
#if !ENABLED (JERRY_ESNEXT)
/*
* Create the properties of a RegExp instance.
*/
@@ -193,7 +193,7 @@ ecma_regexp_update_props (ecma_object_t *re_object_p, /**< RegExp object */
prop_value_p = ECMA_PROPERTY_VALUE_PTR (prop_p);
prop_value_p->value = ecma_make_boolean_value (flags & RE_FLAG_MULTILINE);
} /* ecma_regexp_update_props */
#endif /* !ENABLED (JERRY_ES2015) */
#endif /* !ENABLED (JERRY_ESNEXT) */
/**
* RegExpAlloc method
@@ -209,7 +209,7 @@ ecma_regexp_update_props (ecma_object_t *re_object_p, /**< RegExp object */
ecma_object_t *
ecma_op_regexp_alloc (ecma_object_t *ctr_obj_p) /**< constructor object pointer */
{
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
if (ctr_obj_p == NULL)
{
ctr_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP);
@@ -223,18 +223,18 @@ ecma_op_regexp_alloc (ecma_object_t *ctr_obj_p) /**< constructor object pointer
return proto_obj_p;
}
#else /* !ENABLED (JERRY_ES2015) */
#else /* !ENABLED (JERRY_ESNEXT) */
JERRY_UNUSED (ctr_obj_p);
ecma_object_t *proto_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE);
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
ecma_object_t *new_object_p = ecma_create_object (proto_obj_p,
sizeof (ecma_extended_object_t),
ECMA_OBJECT_TYPE_CLASS);
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
ecma_deref_object (proto_obj_p);
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
ecma_extended_object_t *regexp_obj_p = (ecma_extended_object_t *) new_object_p;
@@ -262,7 +262,7 @@ ecma_op_regexp_initialize (ecma_object_t *regexp_obj_p, /**< RegExp object */
{
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) regexp_obj_p;
#if !ENABLED (JERRY_ES2015)
#if !ENABLED (JERRY_ESNEXT)
if (ext_obj_p->u.class_prop.class_id == LIT_MAGIC_STRING_UNDEFINED)
{
/* This instance has not been initialized before. */
@@ -272,12 +272,12 @@ ecma_op_regexp_initialize (ecma_object_t *regexp_obj_p, /**< RegExp object */
{
ecma_regexp_update_props (regexp_obj_p, pattern_str_p, flags);
}
#endif /* !ENABLED (JERRY_ES2015) */
#endif /* !ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
JERRY_UNUSED (pattern_str_p);
JERRY_UNUSED (flags);
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
ext_obj_p->u.class_prop.class_id = LIT_MAGIC_STRING_REGEXP_UL;
ECMA_SET_INTERNAL_VALUE_POINTER (ext_obj_p->u.class_prop.u.value, bc_p);
@@ -413,13 +413,13 @@ ecma_regexp_canonicalize_char (lit_code_point_t ch, /**< character */
return ch;
}
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
/* TODO: Implement case folding for code points in the upper planes. */
if (JERRY_UNLIKELY (ch > LIT_UTF16_CODE_UNIT_MAX))
{
return ch;
}
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
ecma_char_t u[LIT_MAXIMUM_OTHER_CASE_LENGTH];
const ecma_length_t size = lit_char_to_upper_case ((ecma_char_t) ch, u, LIT_MAXIMUM_OTHER_CASE_LENGTH);
@@ -514,7 +514,7 @@ ecma_regexp_advance (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context */
JERRY_ASSERT (str_p != NULL);
lit_code_point_t cp = lit_cesu8_read_next (str_p);
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
if (JERRY_UNLIKELY (re_ctx_p->flags & RE_FLAG_UNICODE)
&& lit_is_code_point_utf16_high_surrogate ((ecma_char_t) cp)
&& *str_p < re_ctx_p->input_end_p)
@@ -526,12 +526,12 @@ ecma_regexp_advance (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context */
*str_p += LIT_UTF8_MAX_BYTES_IN_CODE_UNIT;
}
}
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
return ecma_regexp_canonicalize (cp, re_ctx_p->flags);
} /* ecma_regexp_advance */
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
/**
* Helper function to get current full unicode code point and advance the string pointer.
*
@@ -559,7 +559,7 @@ ecma_regexp_unicode_advance (const lit_utf8_byte_t **str_p, /**< reference to st
*str_p = current_p;
return ch;
} /* ecma_regexp_unicode_advance */
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
/**
* Helper function to revert the string pointer to the previous code point.
@@ -571,7 +571,7 @@ ecma_regexp_step_back (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context */
const lit_utf8_byte_t *str_p) /**< reference to string pointer */
{
JERRY_ASSERT (str_p != NULL);
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
lit_code_point_t ch = lit_cesu8_read_prev (&str_p);
if (JERRY_UNLIKELY (re_ctx_p->flags & RE_FLAG_UNICODE)
&& lit_is_code_point_utf16_low_surrogate (ch)
@@ -579,10 +579,10 @@ ecma_regexp_step_back (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context */
{
str_p -= LIT_UTF8_MAX_BYTES_IN_CODE_UNIT;
}
#else /* !ENABLED (JERRY_ES2015) */
#else /* !ENABLED (JERRY_ESNEXT) */
JERRY_UNUSED (re_ctx_p);
lit_utf8_decr (&str_p);
#endif /* !ENABLED (JERRY_ES2015) */
#endif /* !ENABLED (JERRY_ESNEXT) */
return str_p;
} /* ecma_regexp_step_back */
@@ -1450,7 +1450,7 @@ class_found:
bc_p = bc_p + escape_count + chars_size + ranges_size;
continue;
}
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
case RE_OP_UNICODE_PERIOD:
{
if (str_curr_p >= re_ctx_p->input_end_p)
@@ -1467,7 +1467,7 @@ class_found:
continue;
}
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
case RE_OP_PERIOD:
{
if (str_curr_p >= re_ctx_p->input_end_p)
@@ -1709,11 +1709,11 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */
/* TODO: Replace with ToLength */
if (lastindex_num < 0.0f)
{
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
lastindex_num = 0.0f;
#else /* !ENABLED (JERRY_ES2015) */
#else /* !ENABLED (JERRY_ESNEXT) */
lastindex_num = input_length + 1;
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
}
index = ecma_number_to_uint32 (lastindex_num);
@@ -1771,7 +1771,7 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */
break;
}
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
if (re_ctx.flags & RE_FLAG_STICKY)
{
ecma_value_t put_result = ecma_op_object_put (regexp_object_p,
@@ -1788,7 +1788,7 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */
ret_value = ECMA_VALUE_NULL;
goto cleanup_context;
}
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
if (input_curr_p >= input_end_p)
{
@@ -1814,7 +1814,7 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */
JERRY_ASSERT (input_curr_p < input_end_p);
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
if (re_ctx.flags & RE_FLAG_UNICODE)
{
index++;
@@ -1828,7 +1828,7 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */
continue;
}
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
index++;
lit_utf8_incr (&input_curr_p);
@@ -2007,7 +2007,7 @@ ecma_regexp_split_helper (ecma_value_t this_arg, /**< this value */
ecma_value_t string_arg, /**< string value */
ecma_value_t limit_arg) /**< limit value */
{
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
/* 2. */
if (!ecma_is_value_object (this_arg))
{
@@ -2311,7 +2311,7 @@ cleanup_string:
ecma_deref_ecma_string (string_p);
return result;
#else /* ENABLED (JERRY_ES2015) */
#else /* ENABLED (JERRY_ESNEXT) */
ecma_value_t result = ECMA_VALUE_ERROR;
/* 2. */
@@ -2480,7 +2480,7 @@ cleanup_string:
ecma_deref_ecma_string (string_p);
return result;
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
} /* ecma_regexp_split_helper */
/**
@@ -2523,7 +2523,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
const lit_utf8_byte_t *last_append_p = current_p;
JERRY_ASSERT (ctx_p->index <= string_length);
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
/* Global matches always start at index 0, but Sticky matches may have a non-zero lastIndex. */
if (ctx_p->index > 0)
{
@@ -2540,7 +2540,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
}
}
}
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
ecma_regexp_ctx_t re_ctx;
ecma_regexp_initialize_context (&re_ctx,
@@ -2639,7 +2639,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
break;
}
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
if ((re_ctx.flags & RE_FLAG_UNICODE) != 0)
{
ctx_p->index++;
@@ -2653,7 +2653,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
continue;
}
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
ctx_p->index++;
lit_utf8_incr (&current_p);
@@ -2736,15 +2736,15 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
const bool global = ecma_op_to_boolean (result);
ecma_free_value (result);
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
const lit_utf8_size_t string_length = ecma_string_get_length (string_p);
bool unicode = false;
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
/* 10. */
if (global)
{
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
result = ecma_op_object_get_by_magic_id (this_obj_p, LIT_MAGIC_STRING_UNICODE);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -2753,7 +2753,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
unicode = ecma_op_to_boolean (result);
ecma_free_value (result);
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
result = ecma_op_object_put (this_obj_p,
ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),
@@ -2767,7 +2767,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
JERRY_ASSERT (ecma_is_value_boolean (result));
}
#if !ENABLED (JERRY_ES2015)
#if !ENABLED (JERRY_ESNEXT)
ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) this_obj_p;
const re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t,
re_obj_p->u.class_prop.u.value);
@@ -2778,7 +2778,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
replace_arg);
goto cleanup_replace;
#else /* ENABLED (JERRY_ES2015) */
#else /* ENABLED (JERRY_ESNEXT) */
result = ecma_op_object_get_by_magic_id (this_obj_p, LIT_MAGIC_STRING_EXEC);
if (ECMA_IS_VALUE_ERROR (result))
@@ -3190,7 +3190,7 @@ cleanup_chars:
cleanup_results:
ecma_collection_free (results_p);
#endif /* !ENABLED (JERRY_ES2015) */
#endif /* !ENABLED (JERRY_ESNEXT) */
cleanup_replace:
if (replace_ctx.replace_str_p != NULL)
@@ -3250,7 +3250,7 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */
return result;
}
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
ecma_value_t full_unicode_value = ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_UNICODE);
if (ECMA_IS_VALUE_ERROR (full_unicode_value))
@@ -3262,7 +3262,7 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */
bool full_unicode = ecma_op_to_boolean (full_unicode_value);
ecma_free_value (full_unicode_value);
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
ecma_value_t set_status = ecma_op_object_put (obj_p,
ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),
@@ -3336,7 +3336,7 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */
goto match_cleanup;
}
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
uint32_t index;
ecma_value_t length_value = ecma_op_to_length (this_index, &index);
@@ -3353,7 +3353,7 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */
ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),
ecma_make_uint32_value (next_index),
true);
#else /* !ENABLED (JERRY_ES2015) */
#else /* !ENABLED (JERRY_ESNEXT) */
ecma_number_t next_index = ecma_get_number_from_value (this_index);
ecma_value_t next_set_status = ecma_op_object_put (obj_p,
@@ -3362,7 +3362,7 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */
true);
ecma_free_value (this_index);
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
if (ECMA_IS_VALUE_ERROR (next_set_status))
{
@@ -3405,7 +3405,7 @@ ecma_op_regexp_exec (ecma_value_t this_arg, /**< this argument */
{
ecma_object_t *arg_obj_p = ecma_get_object_from_value (this_arg);
#if ENABLED (JERRY_ES2015)
#if ENABLED (JERRY_ESNEXT)
ecma_value_t exec = ecma_op_object_get_by_magic_id (arg_obj_p, LIT_MAGIC_STRING_EXEC);
if (ECMA_IS_VALUE_ERROR (exec))
@@ -3439,7 +3439,7 @@ ecma_op_regexp_exec (ecma_value_t this_arg, /**< this argument */
{
ecma_free_value (exec);
}
#endif /* ENABLED (JERRY_ES2015) */
#endif /* ENABLED (JERRY_ESNEXT) */
if (!ecma_object_is_regexp_object (this_arg))
{