Remove ecma_simple_value_t and refactor ecma_make_simple_value (#2135)

This patch removes all ecma_make_simple_value calls to make the code more easy to understand.
Also removes the type ecma_simple_value_t which improves the performance in related code paths by calculating the value of new ecma_value_t is no longer needed.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2017-12-06 18:06:07 +01:00
committed by Dániel Bátyai
parent 1007b63024
commit e83de3accd
60 changed files with 470 additions and 482 deletions
+3 -3
View File
@@ -2729,8 +2729,8 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
{
/* It is unlikely that memory can be allocated in an out-of-memory
* situation. However, a simple value can still be thrown. */
JERRY_CONTEXT (error_value) = ecma_make_simple_value (ECMA_SIMPLE_VALUE_NULL);
return ecma_make_simple_value (ECMA_SIMPLE_VALUE_ERROR);
JERRY_CONTEXT (error_value) = ECMA_VALUE_NULL;
return ECMA_VALUE_ERROR;
}
#ifdef JERRY_ENABLE_ERROR_MESSAGES
const lit_utf8_byte_t *err_bytes_p = (const lit_utf8_byte_t *) parser_error_to_string (parser_error.error);
@@ -2756,7 +2756,7 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
return ecma_raise_syntax_error ("");
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
}
return ecma_make_simple_value (ECMA_SIMPLE_VALUE_TRUE);
return ECMA_VALUE_TRUE;
#else /* JERRY_DISABLE_JS_PARSER */
JERRY_UNUSED (arg_list_p);
JERRY_UNUSED (arg_list_size);
+2 -2
View File
@@ -217,7 +217,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
{
uint32_t idx;
re_bytecode_ctx_t *bc_ctx_p = re_ctx_p->bytecode_ctx_p;
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
uint32_t alterantive_offset = re_get_bytecode_length (re_ctx_p->bytecode_ctx_p);
bool should_loop = true;
@@ -517,7 +517,7 @@ re_compile_bytecode (const re_compiled_code_t **out_bytecode_p, /**< [out] point
ecma_string_t *pattern_str_p, /**< pattern */
uint16_t flags) /**< flags */
{
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
uint8_t cache_idx = re_find_bytecode_in_cache (pattern_str_p, flags);
if (cache_idx < RE_CACHE_SIZE)
+2 -2
View File
@@ -113,7 +113,7 @@ static ecma_value_t
re_parse_iterator (re_parser_ctx_t *parser_ctx_p, /**< RegExp parser context */
re_token_t *re_token_p) /**< [out] output token */
{
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
re_token_p->qmin = 1;
re_token_p->qmax = 1;
@@ -561,7 +561,7 @@ ecma_value_t
re_parse_next_token (re_parser_ctx_t *parser_ctx_p, /**< RegExp parser context */
re_token_t *out_token_p) /**< [out] output token */
{
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
if (parser_ctx_p->input_curr_p >= parser_ctx_p->input_end_p)
{