Freaking FINALLY: postparser

This commit is contained in:
Ilmir Usmanov
2014-10-12 20:33:37 +04:00
parent 63662dfb35
commit 18618c6501
13 changed files with 132 additions and 105 deletions
+1 -1
View File
@@ -46,6 +46,6 @@ struct
__packed
bytecode_data;
scopes_tree *current_scope;
scopes_tree current_scope;
#endif // BYTECODE_DATA_H
+8
View File
@@ -47,6 +47,11 @@ deserialize_bytecode (void)
opcode_t
deserialize_opcode (opcode_counter_t oc)
{
if (bytecode_data.opcodes)
{
JERRY_ASSERT (oc < bytecode_data.opcodes_count);
return bytecode_data.opcodes[oc];
}
return scopes_tree_opcode (current_scope, oc);
}
@@ -59,6 +64,9 @@ deserialize_min_temp (void)
void
deserializer_init (void)
{
bytecode_data.strings = NULL;
bytecode_data.nums = NULL;
bytecode_data.opcodes = NULL;
}
void
+8 -8
View File
@@ -295,8 +295,8 @@ pp_opcode (opcode_counter_t oc, opcode_t opcode, bool is_rewrite)
}
case NAME_TO_ID (try):
{
pp_printf ("try (end: %d);", calc_opcode_counter_from_idx_idx (opcode.data.try.oc_idx_1,
opcode.data.try.oc_idx_2));
pp_printf ("try (end: %d);", oc + calc_opcode_counter_from_idx_idx (opcode.data.try.oc_idx_1,
opcode.data.try.oc_idx_2));
break;
}
case NAME_TO_ID (assignment):
@@ -595,14 +595,14 @@ pp_opcode (opcode_counter_t oc, opcode_t opcode, bool is_rewrite)
}
case OPCODE_META_TYPE_FUNCTION_END:
{
pp_printf ("function end: %d;", calc_opcode_counter_from_idx_idx (opcode.data.meta.data_1,
opcode.data.meta.data_2));
pp_printf ("function end: %d;", oc + calc_opcode_counter_from_idx_idx (opcode.data.meta.data_1,
opcode.data.meta.data_2));
break;
}
case OPCODE_META_TYPE_CATCH:
{
pp_printf ("catch end: %d;", calc_opcode_counter_from_idx_idx (opcode.data.meta.data_1,
opcode.data.meta.data_2));
pp_printf ("catch end: %d;", oc + calc_opcode_counter_from_idx_idx (opcode.data.meta.data_1,
opcode.data.meta.data_2));
break;
}
case OPCODE_META_TYPE_CATCH_EXCEPTION_IDENTIFIER:
@@ -612,8 +612,8 @@ pp_opcode (opcode_counter_t oc, opcode_t opcode, bool is_rewrite)
}
case OPCODE_META_TYPE_FINALLY:
{
pp_printf ("finally end: %d;", calc_opcode_counter_from_idx_idx (opcode.data.meta.data_1,
opcode.data.meta.data_2));
pp_printf ("finally end: %d;", oc + calc_opcode_counter_from_idx_idx (opcode.data.meta.data_1,
opcode.data.meta.data_2));
break;
}
case OPCODE_META_TYPE_END_TRY_CATCH_FINALLY:
+1 -1
View File
@@ -23,7 +23,7 @@
static bool print_opcodes;
void
serializer_set_scope (scopes_tree *new_scope)
serializer_set_scope (scopes_tree new_scope)
{
current_scope = new_scope;
}
+1 -1
View File
@@ -25,7 +25,7 @@
void serializer_init (bool show_opcodes);
void serializer_dump_strings_and_nums (const lp_string *, uint8_t,
const ecma_number_t *, uint8_t);
void serializer_set_scope (scopes_tree *);
void serializer_set_scope (scopes_tree);
void serializer_merge_scopes_into_bytecode (void);
void serializer_dump_opcode (opcode_t);
void serializer_set_writing_position (opcode_counter_t);