mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Fix reg_var_decl generation.
This commit is contained in:
parent
6c422fec2e
commit
d26b7f9f4e
@ -290,7 +290,12 @@ lp_string_hash (lp_string str)
|
||||
static idx_t
|
||||
next_temp_name (void)
|
||||
{
|
||||
return TEMP_NAME()++;
|
||||
TEMP_NAME ()++;
|
||||
if (MAX_TEMP_NAME () < TEMP_NAME ())
|
||||
{
|
||||
MAX_TEMP_NAME () = TEMP_NAME ();
|
||||
}
|
||||
return TEMP_NAME ();
|
||||
}
|
||||
|
||||
static void
|
||||
@ -310,10 +315,6 @@ finish_scope (void)
|
||||
static void
|
||||
reset_temp_name (void)
|
||||
{
|
||||
if (MAX_TEMP_NAME() < TEMP_NAME())
|
||||
{
|
||||
MAX_TEMP_NAME() = TEMP_NAME();
|
||||
}
|
||||
TEMP_NAME() = MIN_TEMP_NAME();
|
||||
}
|
||||
|
||||
@ -2795,18 +2796,7 @@ parse_source_element_list (void)
|
||||
skip_newlines ();
|
||||
}
|
||||
lexer_save_token (TOK ());
|
||||
if (MAX_TEMP_NAME () > MIN_TEMP_NAME ())
|
||||
{
|
||||
REWRITE_OPCODE_2 (STACK_HEAD (U16, 1), reg_var_decl, MIN_TEMP_NAME (), MAX_TEMP_NAME () - 1);
|
||||
}
|
||||
else if (MAX_TEMP_NAME () == MIN_TEMP_NAME ())
|
||||
{
|
||||
REWRITE_OPCODE_2 (STACK_HEAD (U16, 1), reg_var_decl, MIN_TEMP_NAME (), MAX_TEMP_NAME ());
|
||||
}
|
||||
else
|
||||
{
|
||||
JERRY_UNREACHABLE ();
|
||||
}
|
||||
REWRITE_OPCODE_2 (STACK_HEAD (U16, 1), reg_var_decl, MIN_TEMP_NAME (), MAX_TEMP_NAME ());
|
||||
finish_scope ();
|
||||
|
||||
STACK_DROP (U16, 1);
|
||||
|
||||
@ -19,29 +19,20 @@
|
||||
const ecma_char_t *
|
||||
deserialize_string_by_id (uint8_t id)
|
||||
{
|
||||
JERRY_ASSERT (id < bytecode_data.strs_count);
|
||||
JERRY_ASSERT (bytecode_data.strings[id].str[bytecode_data.strings[id].length] == '\0');
|
||||
|
||||
if (id >= bytecode_data.strs_count)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return ((const ecma_char_t *) bytecode_data.strings[id].str);
|
||||
}
|
||||
|
||||
ecma_number_t
|
||||
deserialize_num_by_id (uint8_t id)
|
||||
{
|
||||
if (id < bytecode_data.strs_count)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
JERRY_ASSERT (id >= bytecode_data.strs_count);
|
||||
|
||||
id = (uint8_t) (id - bytecode_data.strs_count);
|
||||
|
||||
if (id >= bytecode_data.nums_count)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
JERRY_ASSERT (id < bytecode_data.nums_count);
|
||||
|
||||
return bytecode_data.nums[id];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user