Refactor literal-storage to not use C++ features

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.u-szeged@partner.samsung.com
This commit is contained in:
Roland Takacs
2015-12-24 17:24:46 +03:00
committed by Peter Gal
parent f932b7d48c
commit 21f561f8ef
36 changed files with 2603 additions and 3134 deletions
+10 -7
View File
@@ -22,6 +22,7 @@
#include "lit-magic-strings.h"
#include "lit-strings.h"
#include "jsp-early-error.h"
#include "rcs-records.h"
static token saved_token, prev_token, sent_token, empty_token;
@@ -119,13 +120,13 @@ dump_current_line (void)
} /* dump_current_line */
static token
create_token_from_lit (jsp_token_type_t type, literal_t lit)
create_token_from_lit (jsp_token_type_t type, lit_literal_t lit)
{
token ret;
ret.type = type;
ret.loc = current_locus ();
ret.uid = lit_cpointer_t::compress (lit).packed_value;
ret.uid = rcs_cpointer_compress (lit).packed_value;
return ret;
}
@@ -195,7 +196,7 @@ lexer_create_token_for_charset (jsp_token_type_t tt, /**< token type */
JERRY_ASSERT (lit_is_cesu8_string_valid (converted_str_p, new_length));
}
literal_t lit = lit_find_literal_by_utf8_string (converted_str_p, new_length);
lit_literal_t lit = lit_find_literal_by_utf8_string (converted_str_p, new_length);
if (lit != NULL)
{
if (unlikely (should_convert))
@@ -206,9 +207,11 @@ lexer_create_token_for_charset (jsp_token_type_t tt, /**< token type */
return create_token_from_lit (tt, lit);
}
lit = lit_create_literal_from_utf8_string (converted_str_p, new_length);
JERRY_ASSERT (lit->get_type () == LIT_STR_T
|| lit->get_type () == LIT_MAGIC_STR_T
|| lit->get_type () == LIT_MAGIC_STR_EX_T);
rcs_record_type_t type = rcs_record_get_type (lit);
JERRY_ASSERT (RCS_RECORD_TYPE_IS_CHARSET (type)
|| RCS_RECORD_TYPE_IS_MAGIC_STR (type)
|| RCS_RECORD_TYPE_IS_MAGIC_STR_EX (type));
if (unlikely (should_convert))
{
@@ -661,7 +664,7 @@ lexer_parse_reserved_word (const lit_utf8_byte_t *str_p, /**< characters buffer
static token
convert_seen_num_to_token (ecma_number_t num)
{
literal_t lit = lit_find_literal_by_num (num);
lit_literal_t lit = lit_find_literal_by_num (num);
if (lit != NULL)
{
return create_token_from_lit (TOK_NUMBER, lit);