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
+17 -15
View File
@@ -16,6 +16,7 @@
#include "bytecode-data.h"
#include "ecma-helpers.h"
#include "jrt-bit-fields.h"
#include "jrt-libc-includes.h"
#include "jsp-mm.h"
#include "opcodes.h"
@@ -27,6 +28,7 @@
#include "jsp-early-error.h"
#include "jsp-internal.h"
#include "vm.h"
#include "rcs-records.h"
/**
* Flag, indicating whether result of expression
@@ -975,9 +977,9 @@ parse_property_name (void)
if (is_keyword (tt))
{
const char *s = lexer_token_type_to_string (lexer_get_token_type (tok));
literal_t lit = lit_find_or_create_literal_from_utf8_string ((const lit_utf8_byte_t *) s,
lit_literal_t lit = lit_find_or_create_literal_from_utf8_string ((const lit_utf8_byte_t *) s,
(lit_utf8_size_t)strlen (s));
return jsp_operand_t::make_string_lit_operand (lit_cpointer_t::compress (lit));
return jsp_operand_t::make_string_lit_operand (rcs_cpointer_compress (lit));
}
else
{
@@ -995,9 +997,9 @@ parse_property_name (void)
if (lexer_get_token_type (tok) == TOK_NUMBER)
{
literal_t num_lit = lit_get_literal_by_cp (token_data_as_lit_cp ());
JERRY_ASSERT (num_lit->get_type () == LIT_NUMBER_T);
num = lit_charset_literal_get_number (num_lit);
lit_literal_t num_lit = lit_get_literal_by_cp (token_data_as_lit_cp ());
JERRY_ASSERT (RCS_RECORD_IS_NUMBER (num_lit));
num = lit_number_literal_get_number (num_lit);
}
else
{
@@ -1008,8 +1010,8 @@ parse_property_name (void)
lit_utf8_size_t sz = ecma_number_to_utf8_string (num, buff, sizeof (buff));
JERRY_ASSERT (sz <= ECMA_MAX_CHARS_IN_STRINGIFIED_NUMBER);
literal_t str_lit = lit_find_or_create_literal_from_utf8_string (buff, sz);
return jsp_operand_t::make_string_lit_operand (lit_cpointer_t::compress (str_lit));
lit_literal_t str_lit = lit_find_or_create_literal_from_utf8_string (buff, sz);
return jsp_operand_t::make_string_lit_operand (rcs_cpointer_compress (str_lit));
}
case TOK_NULL:
case TOK_BOOL:
@@ -1017,9 +1019,9 @@ parse_property_name (void)
lit_magic_string_id_t id = (token_is (TOK_NULL)
? LIT_MAGIC_STRING_NULL
: (tok.uid ? LIT_MAGIC_STRING_TRUE : LIT_MAGIC_STRING_FALSE));
literal_t lit = lit_find_or_create_literal_from_utf8_string (lit_get_magic_string_utf8 (id),
lit_literal_t lit = lit_find_or_create_literal_from_utf8_string (lit_get_magic_string_utf8 (id),
lit_get_magic_string_size (id));
return jsp_operand_t::make_string_lit_operand (lit_cpointer_t::compress (lit));
return jsp_operand_t::make_string_lit_operand (rcs_cpointer_compress (lit));
}
default:
{
@@ -1387,7 +1389,7 @@ jsp_start_parse_function_scope (jsp_ctx_t *ctx_p,
{
current_token_must_be (TOK_NAME);
literal_t current_parameter_name_lit = lit_get_literal_by_cp (token_data_as_lit_cp ());
lit_literal_t current_parameter_name_lit = lit_get_literal_by_cp (token_data_as_lit_cp ());
locus current_parameter_loc = tok.loc;
skip_token (ctx_p);
@@ -1409,7 +1411,7 @@ jsp_start_parse_function_scope (jsp_ctx_t *ctx_p,
if (lit_utf8_iterator_pos_cmp (tok.loc, current_parameter_loc) != 0)
{
literal_t iter_parameter_name_lit = lit_get_literal_by_cp (token_data_as_lit_cp ());
lit_literal_t iter_parameter_name_lit = lit_get_literal_by_cp (token_data_as_lit_cp ());
if (lit_literal_equal_type (current_parameter_name_lit, iter_parameter_name_lit))
{
@@ -2310,24 +2312,24 @@ jsp_get_prop_name_after_dot (void)
else if (is_keyword (lexer_get_token_type (tok)))
{
const char *s = lexer_token_type_to_string (lexer_get_token_type (tok));
literal_t lit = lit_find_or_create_literal_from_utf8_string ((lit_utf8_byte_t *) s,
lit_literal_t lit = lit_find_or_create_literal_from_utf8_string ((lit_utf8_byte_t *) s,
(lit_utf8_size_t) strlen (s));
if (lit == NULL)
{
EMIT_ERROR (JSP_EARLY_ERROR_SYNTAX, "Expected identifier");
}
return lit_cpointer_t::compress (lit);
return rcs_cpointer_compress (lit);
}
else if (token_is (TOK_BOOL) || token_is (TOK_NULL))
{
lit_magic_string_id_t id = (token_is (TOK_NULL)
? LIT_MAGIC_STRING_NULL
: (tok.uid ? LIT_MAGIC_STRING_TRUE : LIT_MAGIC_STRING_FALSE));
literal_t lit = lit_find_or_create_literal_from_utf8_string (lit_get_magic_string_utf8 (id),
lit_literal_t lit = lit_find_or_create_literal_from_utf8_string (lit_get_magic_string_utf8 (id),
lit_get_magic_string_size (id));
return lit_cpointer_t::compress (lit);
return rcs_cpointer_compress (lit);
}
else
{