Renaming OPCODE_META_TYPE_OPCODE_COUNTER -> OPCODE_META_TYPE_FUNCTION_END.

This commit is contained in:
Ruben Ayrapetyan
2014-08-28 16:49:03 +04:00
parent 9d45f68370
commit 647f6b3c67
3 changed files with 17 additions and 13 deletions
+7 -5
View File
@@ -469,7 +469,7 @@ function_declaration (int_data_t *int_data, /**< interpreter context */
const opcode_counter_t function_code_begin_oc = (opcode_counter_t) (int_data->pos + 1); const opcode_counter_t function_code_begin_oc = (opcode_counter_t) (int_data->pos + 1);
int_data->pos = read_meta_opcode_counter (int_data); int_data->pos = read_meta_opcode_counter (OPCODE_META_TYPE_FUNCTION_END, int_data);
ecma_string_t *function_name_string_p = ecma_new_ecma_string_from_lit_index (function_name_lit_idx); ecma_string_t *function_name_string_p = ecma_new_ecma_string_from_lit_index (function_name_lit_idx);
@@ -617,7 +617,7 @@ opfunc_func_expr_n (opcode_t opdata, /**< operation data */
const opcode_counter_t function_code_begin_oc = (opcode_counter_t) (int_data->pos + 1); const opcode_counter_t function_code_begin_oc = (opcode_counter_t) (int_data->pos + 1);
int_data->pos = read_meta_opcode_counter (int_data); int_data->pos = read_meta_opcode_counter (OPCODE_META_TYPE_FUNCTION_END, int_data);
ecma_object_t *scope_p; ecma_object_t *scope_p;
ecma_string_t *function_name_string_p = NULL; ecma_string_t *function_name_string_p = NULL;
@@ -1742,11 +1742,12 @@ opfunc_meta (opcode_t opdata, /**< operation data */
ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY), ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY),
ECMA_TARGET_ID_RESERVED); ECMA_TARGET_ID_RESERVED);
} }
case OPCODE_META_TYPE_UNDEFINED:
case OPCODE_META_TYPE_THIS_ARG: case OPCODE_META_TYPE_THIS_ARG:
case OPCODE_META_TYPE_VARG_PROP_DATA: case OPCODE_META_TYPE_VARG_PROP_DATA:
case OPCODE_META_TYPE_VARG_PROP_GETTER: case OPCODE_META_TYPE_VARG_PROP_GETTER:
case OPCODE_META_TYPE_VARG_PROP_SETTER: case OPCODE_META_TYPE_VARG_PROP_SETTER:
case OPCODE_META_TYPE_OPCODE_COUNTER: case OPCODE_META_TYPE_FUNCTION_END:
{ {
JERRY_UNREACHABLE (); JERRY_UNREACHABLE ();
} }
@@ -1778,10 +1779,11 @@ calc_meta_opcode_counter_from_meta_data (const idx_t data_1, /**< first data arg
* that should be 'meta' opcode of type 'opcode counter'. * that should be 'meta' opcode of type 'opcode counter'.
*/ */
opcode_counter_t opcode_counter_t
read_meta_opcode_counter (int_data_t *int_data) /**< interpreter context */ read_meta_opcode_counter (opcode_meta_type expected_type, /**< expected type of meta opcode */
int_data_t *int_data) /**< interpreter context */
{ {
opcode_t meta_opcode = read_opcode (int_data->pos); opcode_t meta_opcode = read_opcode (int_data->pos);
JERRY_ASSERT (meta_opcode.data.meta.type == OPCODE_META_TYPE_OPCODE_COUNTER); JERRY_ASSERT (meta_opcode.data.meta.type == expected_type);
const idx_t data_1 = meta_opcode.data.meta.data_1; const idx_t data_1 = meta_opcode.data.meta.data_1;
const idx_t data_2 = meta_opcode.data.meta.data_2; const idx_t data_2 = meta_opcode.data.meta.data_2;
+3 -2
View File
@@ -52,13 +52,14 @@ typedef enum
*/ */
typedef enum typedef enum
{ {
OPCODE_META_TYPE_UNDEFINED, /**< undefined meta (should be rewritten) */
OPCODE_META_TYPE_THIS_ARG, /**< value (var_idx) of this used during call */ OPCODE_META_TYPE_THIS_ARG, /**< value (var_idx) of this used during call */
OPCODE_META_TYPE_VARG, /**< element (var_idx) of arguments' list */ OPCODE_META_TYPE_VARG, /**< element (var_idx) of arguments' list */
OPCODE_META_TYPE_VARG_PROP_DATA, /**< name (lit_idx) and value (var_idx) for a data property descriptor */ OPCODE_META_TYPE_VARG_PROP_DATA, /**< name (lit_idx) and value (var_idx) for a data property descriptor */
OPCODE_META_TYPE_VARG_PROP_GETTER, /**< name (lit_idx) and getter (var_idx) for an accessor property descriptor */ OPCODE_META_TYPE_VARG_PROP_GETTER, /**< name (lit_idx) and getter (var_idx) for an accessor property descriptor */
OPCODE_META_TYPE_VARG_PROP_SETTER, /**< name (lit_idx) and setter (var_idx) for an accessor property descriptor */ OPCODE_META_TYPE_VARG_PROP_SETTER, /**< name (lit_idx) and setter (var_idx) for an accessor property descriptor */
OPCODE_META_TYPE_END_WITH, /**< end of with statement */ OPCODE_META_TYPE_END_WITH, /**< end of with statement */
OPCODE_META_TYPE_OPCODE_COUNTER /**< opcode counter */ OPCODE_META_TYPE_FUNCTION_END /**< opcode counter */
} opcode_meta_type; } opcode_meta_type;
typedef struct typedef struct
@@ -74,7 +75,7 @@ typedef struct
} int_data_t; } int_data_t;
opcode_counter_t calc_meta_opcode_counter_from_meta_data (const idx_t data_1, const idx_t data_2); opcode_counter_t calc_meta_opcode_counter_from_meta_data (const idx_t data_1, const idx_t data_2);
opcode_counter_t read_meta_opcode_counter (int_data_t *int_data); opcode_counter_t read_meta_opcode_counter (opcode_meta_type expected_type, int_data_t *int_data);
#define OP_CALLS_AND_ARGS(p, a) \ #define OP_CALLS_AND_ARGS(p, a) \
p##_2 (a, call_0, lhs, name_lit_idx) \ p##_2 (a, call_0, lhs, name_lit_idx) \
+7 -6
View File
@@ -895,7 +895,8 @@ parse_argument_list (argument_list_type alt, idx_t obj)
} }
static void static void
rewrite_meta_opcode_counter (opcode_counter_t meta_oc, rewrite_meta_opcode_counter (opcode_meta_type type,
opcode_counter_t meta_oc,
opcode_counter_t new_value) opcode_counter_t new_value)
{ {
JERRY_STATIC_ASSERT (sizeof (idx_t) == 1); JERRY_STATIC_ASSERT (sizeof (idx_t) == 1);
@@ -905,7 +906,7 @@ rewrite_meta_opcode_counter (opcode_counter_t meta_oc,
JERRY_ASSERT (new_value == calc_meta_opcode_counter_from_meta_data (data_1, data_2)); JERRY_ASSERT (new_value == calc_meta_opcode_counter_from_meta_data (data_1, data_2));
REWRITE_OPCODE_3 (meta_oc, meta, OPCODE_META_TYPE_OPCODE_COUNTER, data_1, data_2); REWRITE_OPCODE_3 (meta_oc, meta, type, data_1, data_2);
} }
/* function_declaration /* function_declaration
@@ -931,7 +932,7 @@ parse_function_declaration (void)
parse_argument_list (AL_FUNC_DECL, name); parse_argument_list (AL_FUNC_DECL, name);
meta_oc = opcode_counter; meta_oc = opcode_counter;
DUMP_OPCODE_3 (meta, OPCODE_META_TYPE_OPCODE_COUNTER, INVALID_VALUE, INVALID_VALUE); DUMP_OPCODE_3 (meta, OPCODE_META_TYPE_UNDEFINED, INVALID_VALUE, INVALID_VALUE);
token_after_newlines_must_be (TOK_OPEN_BRACE); token_after_newlines_must_be (TOK_OPEN_BRACE);
@@ -944,7 +945,7 @@ parse_function_declaration (void)
DUMP_VOID_OPCODE (ret); DUMP_VOID_OPCODE (ret);
rewrite_meta_opcode_counter (meta_oc, opcode_counter); rewrite_meta_opcode_counter (OPCODE_META_TYPE_FUNCTION_END, meta_oc, opcode_counter);
} }
/* function_expression /* function_expression
@@ -973,7 +974,7 @@ parse_function_expression (void)
lhs = parse_argument_list (AL_FUNC_EXPR, name); lhs = parse_argument_list (AL_FUNC_EXPR, name);
meta_oc = opcode_counter; meta_oc = opcode_counter;
DUMP_OPCODE_3 (meta, OPCODE_META_TYPE_OPCODE_COUNTER, INVALID_VALUE, INVALID_VALUE); DUMP_OPCODE_3 (meta, OPCODE_META_TYPE_UNDEFINED, INVALID_VALUE, INVALID_VALUE);
token_after_newlines_must_be (TOK_OPEN_BRACE); token_after_newlines_must_be (TOK_OPEN_BRACE);
@@ -985,7 +986,7 @@ parse_function_expression (void)
token_after_newlines_must_be (TOK_CLOSE_BRACE); token_after_newlines_must_be (TOK_CLOSE_BRACE);
DUMP_VOID_OPCODE (ret); DUMP_VOID_OPCODE (ret);
rewrite_meta_opcode_counter (meta_oc, opcode_counter); rewrite_meta_opcode_counter (OPCODE_META_TYPE_FUNCTION_END, meta_oc, opcode_counter);
return lhs; return lhs;
} }