Rename idx_t -> vm_idx_t, opcode_special_reg_t -> vm_reg_t, INVALID_VALUE -> VM_IDX_EMPTY / VM_IDX_REWRITE_GENERAL_CASE, LITERAL_TO_REWRITE -> VM_IDX_REWRITE_LITERAL_UID.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
@@ -20,8 +20,6 @@
|
|||||||
#include "lit-literal-storage.h"
|
#include "lit-literal-storage.h"
|
||||||
#include "lit-magic-strings.h"
|
#include "lit-magic-strings.h"
|
||||||
|
|
||||||
#define LITERAL_TO_REWRITE (INVALID_VALUE - 1)
|
|
||||||
|
|
||||||
void lit_init ();
|
void lit_init ();
|
||||||
void lit_finalize ();
|
void lit_finalize ();
|
||||||
void lit_dump_literals ();
|
void lit_dump_literals ();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
* @{
|
* @{
|
||||||
*
|
*
|
||||||
* \addtogroup lit_id_hash_table Literal identifiers hash table
|
* \addtogroup lit_id_hash_table Literal identifiers hash table
|
||||||
* The hash table connects pairs (instruction block, idx_t value) with literal identifiers.
|
* The hash table connects pairs (instruction block, vm_idx_t value) with literal identifiers.
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ lit_id_hash_table_free (lit_id_hash_table *table_p) /**< table's header */
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
lit_id_hash_table_insert (lit_id_hash_table *table_p, /**< table's header */
|
lit_id_hash_table_insert (lit_id_hash_table *table_p, /**< table's header */
|
||||||
idx_t uid, /**< value of byte-code instruction's argument */
|
vm_idx_t uid, /**< value of byte-code instruction's argument */
|
||||||
vm_instr_counter_t oc, /**< instruction counter of the instruction */
|
vm_instr_counter_t oc, /**< instruction counter of the instruction */
|
||||||
lit_cpointer_t lit_cp) /**< literal identifier */
|
lit_cpointer_t lit_cp) /**< literal identifier */
|
||||||
{
|
{
|
||||||
@@ -111,7 +111,7 @@ lit_id_hash_table_insert (lit_id_hash_table *table_p, /**< table's header */
|
|||||||
*/
|
*/
|
||||||
lit_cpointer_t
|
lit_cpointer_t
|
||||||
lit_id_hash_table_lookup (lit_id_hash_table *table_p, /**< table's header */
|
lit_id_hash_table_lookup (lit_id_hash_table *table_p, /**< table's header */
|
||||||
idx_t uid, /**< value of byte-code instruction's argument */
|
vm_idx_t uid, /**< value of byte-code instruction's argument */
|
||||||
vm_instr_counter_t oc) /**< instruction counter of the instruction */
|
vm_instr_counter_t oc) /**< instruction counter of the instruction */
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (table_p != NULL);
|
JERRY_ASSERT (table_p != NULL);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ typedef struct
|
|||||||
lit_id_hash_table *lit_id_hash_table_init (uint8_t*, size_t, size_t, size_t);
|
lit_id_hash_table *lit_id_hash_table_init (uint8_t*, size_t, size_t, size_t);
|
||||||
size_t lit_id_hash_table_get_size_for_table (size_t, size_t);
|
size_t lit_id_hash_table_get_size_for_table (size_t, size_t);
|
||||||
void lit_id_hash_table_free (lit_id_hash_table *);
|
void lit_id_hash_table_free (lit_id_hash_table *);
|
||||||
void lit_id_hash_table_insert (lit_id_hash_table *, idx_t, vm_instr_counter_t, lit_cpointer_t);
|
void lit_id_hash_table_insert (lit_id_hash_table *, vm_idx_t, vm_instr_counter_t, lit_cpointer_t);
|
||||||
lit_cpointer_t lit_id_hash_table_lookup (lit_id_hash_table *, idx_t, vm_instr_counter_t);
|
lit_cpointer_t lit_id_hash_table_lookup (lit_id_hash_table *, vm_idx_t, vm_instr_counter_t);
|
||||||
|
|
||||||
#endif /* LIT_ID_HASH_TABLE */
|
#endif /* LIT_ID_HASH_TABLE */
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
#include "lit-literal.h"
|
#include "lit-literal.h"
|
||||||
#include "lit-strings.h"
|
#include "lit-strings.h"
|
||||||
|
|
||||||
#define INVALID_VALUE 255
|
|
||||||
#define INVALID_LITERAL (rcs_cpointer_t::null_cp ())
|
#define INVALID_LITERAL (rcs_cpointer_t::null_cp ())
|
||||||
|
|
||||||
/* Keywords. */
|
/* Keywords. */
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -89,10 +89,19 @@ public:
|
|||||||
* @return constructed operand
|
* @return constructed operand
|
||||||
*/
|
*/
|
||||||
static jsp_operand_t
|
static jsp_operand_t
|
||||||
make_reg_operand (idx_t reg_index) /**< register index */
|
make_reg_operand (vm_idx_t reg_index) /**< register index */
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (reg_index != INVALID_VALUE
|
/*
|
||||||
&& reg_index != LITERAL_TO_REWRITE);
|
* The following check currently leads to 'comparison is always true
|
||||||
|
* due to limited range of data type' warning, so it is turned off.
|
||||||
|
*
|
||||||
|
* If VM_IDX_GENERAL_VALUE_FIRST is changed to value greater than 0,
|
||||||
|
* the check should be restored.
|
||||||
|
*/
|
||||||
|
// JERRY_ASSERT (reg_index >= VM_IDX_GENERAL_VALUE_FIRST);
|
||||||
|
static_assert (VM_IDX_GENERAL_VALUE_FIRST == 0, "See comment above");
|
||||||
|
|
||||||
|
JERRY_ASSERT (reg_index <= VM_IDX_GENERAL_VALUE_LAST);
|
||||||
|
|
||||||
jsp_operand_t ret;
|
jsp_operand_t ret;
|
||||||
|
|
||||||
@@ -142,12 +151,12 @@ public:
|
|||||||
} /* is_literal_operand */
|
} /* is_literal_operand */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get idx_t for operand
|
* Get idx for operand
|
||||||
*
|
*
|
||||||
* @return LITERAL_TO_REWRITE (for jsp_operand_t::LITERAL),
|
* @return VM_IDX_REWRITE_LITERAL_UID (for jsp_operand_t::LITERAL),
|
||||||
* or register index (for jsp_operand_t::TMP).
|
* or register index (for jsp_operand_t::TMP).
|
||||||
*/
|
*/
|
||||||
idx_t
|
vm_idx_t
|
||||||
get_idx (void) const
|
get_idx (void) const
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (_type != jsp_operand_t::UNINITIALIZED);
|
JERRY_ASSERT (_type != jsp_operand_t::UNINITIALIZED);
|
||||||
@@ -158,13 +167,13 @@ public:
|
|||||||
}
|
}
|
||||||
else if (_type == jsp_operand_t::LITERAL)
|
else if (_type == jsp_operand_t::LITERAL)
|
||||||
{
|
{
|
||||||
return LITERAL_TO_REWRITE;
|
return VM_IDX_REWRITE_LITERAL_UID;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (_type == jsp_operand_t::EMPTY);
|
JERRY_ASSERT (_type == jsp_operand_t::EMPTY);
|
||||||
|
|
||||||
return INVALID_VALUE;
|
return VM_IDX_EMPTY;
|
||||||
}
|
}
|
||||||
} /* get_idx */
|
} /* get_idx */
|
||||||
|
|
||||||
@@ -198,7 +207,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
idx_t uid; /**< byte-code register index (for jsp_operand_t::TMP) */
|
vm_idx_t uid; /**< byte-code register index (for jsp_operand_t::TMP) */
|
||||||
lit_cpointer_t lit_id; /**< literal (for jsp_operand_t::LITERAL) */
|
lit_cpointer_t lit_id; /**< literal (for jsp_operand_t::LITERAL) */
|
||||||
} _data;
|
} _data;
|
||||||
|
|
||||||
@@ -243,8 +252,8 @@ void dump_number_assignment (jsp_operand_t, lit_cpointer_t);
|
|||||||
jsp_operand_t dump_number_assignment_res (lit_cpointer_t);
|
jsp_operand_t dump_number_assignment_res (lit_cpointer_t);
|
||||||
void dump_regexp_assignment (jsp_operand_t, lit_cpointer_t);
|
void dump_regexp_assignment (jsp_operand_t, lit_cpointer_t);
|
||||||
jsp_operand_t dump_regexp_assignment_res (lit_cpointer_t);
|
jsp_operand_t dump_regexp_assignment_res (lit_cpointer_t);
|
||||||
void dump_smallint_assignment (jsp_operand_t, idx_t);
|
void dump_smallint_assignment (jsp_operand_t, vm_idx_t);
|
||||||
jsp_operand_t dump_smallint_assignment_res (idx_t);
|
jsp_operand_t dump_smallint_assignment_res (vm_idx_t);
|
||||||
void dump_undefined_assignment (jsp_operand_t);
|
void dump_undefined_assignment (jsp_operand_t);
|
||||||
jsp_operand_t dump_undefined_assignment_res (void);
|
jsp_operand_t dump_undefined_assignment_res (void);
|
||||||
void dump_null_assignment (jsp_operand_t);
|
void dump_null_assignment (jsp_operand_t);
|
||||||
|
|||||||
@@ -803,7 +803,7 @@ parse_literal (void)
|
|||||||
case TOK_REGEXP: return dump_regexp_assignment_res (token_data_as_lit_cp ());
|
case TOK_REGEXP: return dump_regexp_assignment_res (token_data_as_lit_cp ());
|
||||||
case TOK_NULL: return dump_null_assignment_res ();
|
case TOK_NULL: return dump_null_assignment_res ();
|
||||||
case TOK_BOOL: return dump_boolean_assignment_res ((bool) token_data ());
|
case TOK_BOOL: return dump_boolean_assignment_res ((bool) token_data ());
|
||||||
case TOK_SMALL_INT: return dump_smallint_assignment_res ((idx_t) token_data ());
|
case TOK_SMALL_INT: return dump_smallint_assignment_res ((vm_idx_t) token_data ());
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
EMIT_ERROR (JSP_EARLY_ERROR_SYNTAX, "Expected literal");
|
EMIT_ERROR (JSP_EARLY_ERROR_SYNTAX, "Expected literal");
|
||||||
@@ -2073,7 +2073,7 @@ jsp_parse_for_in_statement_iterator (jsp_operand_t *base_p, /**< out: base value
|
|||||||
* tmp <- Collection (Expression)
|
* tmp <- Collection (Expression)
|
||||||
* for_in instruction (tmp, instruction counter of for-in end mark)
|
* for_in instruction (tmp, instruction counter of for-in end mark)
|
||||||
* {
|
* {
|
||||||
* Assignment of OPCODE_REG_SPECIAL_FOR_IN_PROPERTY_NAME to
|
* Assignment of VM_REG_SPECIAL_FOR_IN_PROPERTY_NAME to
|
||||||
* Iterator (VariableDeclarationNoIn / LeftHandSideExpression)
|
* Iterator (VariableDeclarationNoIn / LeftHandSideExpression)
|
||||||
* }
|
* }
|
||||||
* Body (Statement)
|
* Body (Statement)
|
||||||
@@ -2127,7 +2127,7 @@ jsp_parse_for_in_statement (jsp_label_t *outermost_stmt_label_p, /**< outermost
|
|||||||
// Dump for-in instruction
|
// Dump for-in instruction
|
||||||
vm_instr_counter_t for_in_oc = dump_for_in_for_rewrite (collection);
|
vm_instr_counter_t for_in_oc = dump_for_in_for_rewrite (collection);
|
||||||
|
|
||||||
// Dump assignment VariableDeclarationNoIn / LeftHandSideExpression <- OPCODE_REG_SPECIAL_FOR_IN_PROPERTY_NAME
|
// Dump assignment VariableDeclarationNoIn / LeftHandSideExpression <- VM_REG_SPECIAL_FOR_IN_PROPERTY_NAME
|
||||||
lexer_seek (iterator_loc);
|
lexer_seek (iterator_loc);
|
||||||
tok = lexer_next_token ();
|
tok = lexer_next_token ();
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
static hash_table lit_id_to_uid = null_hash;
|
static hash_table lit_id_to_uid = null_hash;
|
||||||
static vm_instr_counter_t global_oc;
|
static vm_instr_counter_t global_oc;
|
||||||
static idx_t next_uid;
|
static vm_idx_t next_uid;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
assert_tree (scopes_tree t)
|
assert_tree (scopes_tree t)
|
||||||
@@ -29,7 +29,7 @@ assert_tree (scopes_tree t)
|
|||||||
JERRY_ASSERT (t != NULL);
|
JERRY_ASSERT (t != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static idx_t
|
static vm_idx_t
|
||||||
get_uid (op_meta *op, uint8_t i)
|
get_uid (op_meta *op, uint8_t i)
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (i < 4);
|
JERRY_ASSERT (i < 4);
|
||||||
@@ -38,7 +38,7 @@ get_uid (op_meta *op, uint8_t i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_uid (op_meta *op, uint8_t i, idx_t uid)
|
set_uid (op_meta *op, uint8_t i, vm_idx_t uid)
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (i < 4);
|
JERRY_ASSERT (i < 4);
|
||||||
raw_instr *raw = (raw_instr *) &op->op;
|
raw_instr *raw = (raw_instr *) &op->op;
|
||||||
@@ -151,7 +151,7 @@ start_new_block_if_necessary (void)
|
|||||||
hash_table_free (lit_id_to_uid);
|
hash_table_free (lit_id_to_uid);
|
||||||
lit_id_to_uid = null_hash;
|
lit_id_to_uid = null_hash;
|
||||||
}
|
}
|
||||||
lit_id_to_uid = hash_table_init (sizeof (lit_cpointer_t), sizeof (idx_t), HASH_SIZE, lit_id_hash);
|
lit_id_to_uid = hash_table_init (sizeof (lit_cpointer_t), sizeof (vm_idx_t), HASH_SIZE, lit_id_hash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,16 +188,16 @@ change_uid (op_meta *om, lit_id_hash_table *lit_ids, uint16_t mask)
|
|||||||
{
|
{
|
||||||
if (is_possible_literal (mask, i))
|
if (is_possible_literal (mask, i))
|
||||||
{
|
{
|
||||||
if (get_uid (om, i) == LITERAL_TO_REWRITE)
|
if (get_uid (om, i) == VM_IDX_REWRITE_LITERAL_UID)
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (om->lit_id[i].packed_value != MEM_CP_NULL);
|
JERRY_ASSERT (om->lit_id[i].packed_value != MEM_CP_NULL);
|
||||||
lit_cpointer_t lit_id = om->lit_id[i];
|
lit_cpointer_t lit_id = om->lit_id[i];
|
||||||
idx_t *uid = (idx_t *) hash_table_lookup (lit_id_to_uid, &lit_id);
|
vm_idx_t *uid = (vm_idx_t *) hash_table_lookup (lit_id_to_uid, &lit_id);
|
||||||
if (uid == NULL)
|
if (uid == NULL)
|
||||||
{
|
{
|
||||||
hash_table_insert (lit_id_to_uid, &lit_id, &next_uid);
|
hash_table_insert (lit_id_to_uid, &lit_id, &next_uid);
|
||||||
lit_id_hash_table_insert (lit_ids, next_uid, global_oc, lit_id);
|
lit_id_hash_table_insert (lit_ids, next_uid, global_oc, lit_id);
|
||||||
uid = (idx_t *) hash_table_lookup (lit_id_to_uid, &lit_id);
|
uid = (vm_idx_t *) hash_table_lookup (lit_id_to_uid, &lit_id);
|
||||||
JERRY_ASSERT (uid != NULL);
|
JERRY_ASSERT (uid != NULL);
|
||||||
JERRY_ASSERT (*uid == next_uid);
|
JERRY_ASSERT (*uid == next_uid);
|
||||||
next_uid++;
|
next_uid++;
|
||||||
@@ -223,15 +223,15 @@ insert_uids_to_lit_id_map (op_meta *om, uint16_t mask)
|
|||||||
{
|
{
|
||||||
if (is_possible_literal (mask, i))
|
if (is_possible_literal (mask, i))
|
||||||
{
|
{
|
||||||
if (get_uid (om, i) == LITERAL_TO_REWRITE)
|
if (get_uid (om, i) == VM_IDX_REWRITE_LITERAL_UID)
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (om->lit_id[i].packed_value != MEM_CP_NULL);
|
JERRY_ASSERT (om->lit_id[i].packed_value != MEM_CP_NULL);
|
||||||
lit_cpointer_t lit_id = om->lit_id[i];
|
lit_cpointer_t lit_id = om->lit_id[i];
|
||||||
idx_t *uid = (idx_t *) hash_table_lookup (lit_id_to_uid, &lit_id);
|
vm_idx_t *uid = (vm_idx_t *) hash_table_lookup (lit_id_to_uid, &lit_id);
|
||||||
if (uid == NULL)
|
if (uid == NULL)
|
||||||
{
|
{
|
||||||
hash_table_insert (lit_id_to_uid, &lit_id, &next_uid);
|
hash_table_insert (lit_id_to_uid, &lit_id, &next_uid);
|
||||||
uid = (idx_t *) hash_table_lookup (lit_id_to_uid, &lit_id);
|
uid = (vm_idx_t *) hash_table_lookup (lit_id_to_uid, &lit_id);
|
||||||
JERRY_ASSERT (uid != NULL);
|
JERRY_ASSERT (uid != NULL);
|
||||||
JERRY_ASSERT (*uid == next_uid);
|
JERRY_ASSERT (*uid == next_uid);
|
||||||
next_uid++;
|
next_uid++;
|
||||||
@@ -416,11 +416,11 @@ generate_instr (linked_list instr_list, /**< instruction list */
|
|||||||
*
|
*
|
||||||
* @return number of new literals
|
* @return number of new literals
|
||||||
*/
|
*/
|
||||||
static idx_t
|
static vm_idx_t
|
||||||
count_new_literals_in_instr (op_meta *om_p) /**< instruction */
|
count_new_literals_in_instr (op_meta *om_p) /**< instruction */
|
||||||
{
|
{
|
||||||
start_new_block_if_necessary ();
|
start_new_block_if_necessary ();
|
||||||
idx_t current_uid = next_uid;
|
vm_idx_t current_uid = next_uid;
|
||||||
switch (om_p->op.op_idx)
|
switch (om_p->op.op_idx)
|
||||||
{
|
{
|
||||||
case VM_OP_PROP_GETTER:
|
case VM_OP_PROP_GETTER:
|
||||||
@@ -549,7 +549,7 @@ count_new_literals_in_instr (op_meta *om_p) /**< instruction */
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (idx_t) (next_uid - current_uid);
|
return (vm_idx_t) (next_uid - current_uid);
|
||||||
} /* count_new_literals_in_instr */
|
} /* count_new_literals_in_instr */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ ecma_completion_value_t
|
|||||||
opfunc_is_true_jmp_down (vm_instr_t instr, /**< instruction */
|
opfunc_is_true_jmp_down (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t cond_var_idx = instr.data.is_true_jmp_down.value;
|
const vm_idx_t cond_var_idx = instr.data.is_true_jmp_down.value;
|
||||||
const vm_instr_counter_t offset = vm_calc_instr_counter_from_idx_idx (instr.data.is_true_jmp_down.oc_idx_1,
|
const vm_instr_counter_t offset = vm_calc_instr_counter_from_idx_idx (instr.data.is_true_jmp_down.oc_idx_1,
|
||||||
instr.data.is_true_jmp_down.oc_idx_2);
|
instr.data.is_true_jmp_down.oc_idx_2);
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ ecma_completion_value_t
|
|||||||
opfunc_is_true_jmp_up (vm_instr_t instr, /**< instruction */
|
opfunc_is_true_jmp_up (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t cond_var_idx = instr.data.is_true_jmp_up.value;
|
const vm_idx_t cond_var_idx = instr.data.is_true_jmp_up.value;
|
||||||
const vm_instr_counter_t offset = vm_calc_instr_counter_from_idx_idx (instr.data.is_true_jmp_up.oc_idx_1,
|
const vm_instr_counter_t offset = vm_calc_instr_counter_from_idx_idx (instr.data.is_true_jmp_up.oc_idx_1,
|
||||||
instr.data.is_true_jmp_up.oc_idx_2);
|
instr.data.is_true_jmp_up.oc_idx_2);
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ ecma_completion_value_t
|
|||||||
opfunc_is_false_jmp_down (vm_instr_t instr, /**< instruction */
|
opfunc_is_false_jmp_down (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t cond_var_idx = instr.data.is_false_jmp_down.value;
|
const vm_idx_t cond_var_idx = instr.data.is_false_jmp_down.value;
|
||||||
const vm_instr_counter_t offset = vm_calc_instr_counter_from_idx_idx (instr.data.is_false_jmp_down.oc_idx_1,
|
const vm_instr_counter_t offset = vm_calc_instr_counter_from_idx_idx (instr.data.is_false_jmp_down.oc_idx_1,
|
||||||
instr.data.is_false_jmp_down.oc_idx_2);
|
instr.data.is_false_jmp_down.oc_idx_2);
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ ecma_completion_value_t
|
|||||||
opfunc_is_false_jmp_up (vm_instr_t instr, /**< instruction */
|
opfunc_is_false_jmp_up (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t cond_var_idx = instr.data.is_false_jmp_up.value;
|
const vm_idx_t cond_var_idx = instr.data.is_false_jmp_up.value;
|
||||||
const vm_instr_counter_t offset = vm_calc_instr_counter_from_idx_idx (instr.data.is_false_jmp_up.oc_idx_1,
|
const vm_instr_counter_t offset = vm_calc_instr_counter_from_idx_idx (instr.data.is_false_jmp_up.oc_idx_1,
|
||||||
instr.data.is_false_jmp_up.oc_idx_2);
|
instr.data.is_false_jmp_up.oc_idx_2);
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ typedef enum
|
|||||||
*/
|
*/
|
||||||
static ecma_completion_value_t
|
static ecma_completion_value_t
|
||||||
do_number_arithmetic (vm_frame_ctx_t *frame_ctx_p, /**< interpreter context */
|
do_number_arithmetic (vm_frame_ctx_t *frame_ctx_p, /**< interpreter context */
|
||||||
idx_t dst_var_idx, /**< destination variable identifier */
|
vm_idx_t dst_var_idx, /**< destination variable identifier */
|
||||||
number_arithmetic_op op, /**< number arithmetic operation */
|
number_arithmetic_op op, /**< number arithmetic operation */
|
||||||
ecma_value_t left_value, /**< left value */
|
ecma_value_t left_value, /**< left value */
|
||||||
ecma_value_t right_value) /** right value */
|
ecma_value_t right_value) /** right value */
|
||||||
@@ -106,9 +106,9 @@ ecma_completion_value_t
|
|||||||
opfunc_addition (vm_instr_t instr, /**< instruction */
|
opfunc_addition (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.addition.dst;
|
const vm_idx_t dst_var_idx = instr.data.addition.dst;
|
||||||
const idx_t left_var_idx = instr.data.addition.var_left;
|
const vm_idx_t left_var_idx = instr.data.addition.var_left;
|
||||||
const idx_t right_var_idx = instr.data.addition.var_right;
|
const vm_idx_t right_var_idx = instr.data.addition.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -172,9 +172,9 @@ ecma_completion_value_t
|
|||||||
opfunc_substraction (vm_instr_t instr, /**< instruction */
|
opfunc_substraction (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.substraction.dst;
|
const vm_idx_t dst_var_idx = instr.data.substraction.dst;
|
||||||
const idx_t left_var_idx = instr.data.substraction.var_left;
|
const vm_idx_t left_var_idx = instr.data.substraction.var_left;
|
||||||
const idx_t right_var_idx = instr.data.substraction.var_right;
|
const vm_idx_t right_var_idx = instr.data.substraction.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -207,9 +207,9 @@ ecma_completion_value_t
|
|||||||
opfunc_multiplication (vm_instr_t instr, /**< instruction */
|
opfunc_multiplication (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.multiplication.dst;
|
const vm_idx_t dst_var_idx = instr.data.multiplication.dst;
|
||||||
const idx_t left_var_idx = instr.data.multiplication.var_left;
|
const vm_idx_t left_var_idx = instr.data.multiplication.var_left;
|
||||||
const idx_t right_var_idx = instr.data.multiplication.var_right;
|
const vm_idx_t right_var_idx = instr.data.multiplication.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -242,9 +242,9 @@ ecma_completion_value_t
|
|||||||
opfunc_division (vm_instr_t instr, /**< instruction */
|
opfunc_division (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.division.dst;
|
const vm_idx_t dst_var_idx = instr.data.division.dst;
|
||||||
const idx_t left_var_idx = instr.data.division.var_left;
|
const vm_idx_t left_var_idx = instr.data.division.var_left;
|
||||||
const idx_t right_var_idx = instr.data.division.var_right;
|
const vm_idx_t right_var_idx = instr.data.division.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -277,9 +277,9 @@ ecma_completion_value_t
|
|||||||
opfunc_remainder (vm_instr_t instr, /**< instruction */
|
opfunc_remainder (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.remainder.dst;
|
const vm_idx_t dst_var_idx = instr.data.remainder.dst;
|
||||||
const idx_t left_var_idx = instr.data.remainder.var_left;
|
const vm_idx_t left_var_idx = instr.data.remainder.var_left;
|
||||||
const idx_t right_var_idx = instr.data.remainder.var_right;
|
const vm_idx_t right_var_idx = instr.data.remainder.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -312,8 +312,8 @@ ecma_completion_value_t
|
|||||||
opfunc_unary_plus (vm_instr_t instr, /**< instruction */
|
opfunc_unary_plus (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.remainder.dst;
|
const vm_idx_t dst_var_idx = instr.data.remainder.dst;
|
||||||
const idx_t var_idx = instr.data.remainder.var_left;
|
const vm_idx_t var_idx = instr.data.remainder.var_left;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -349,8 +349,8 @@ ecma_completion_value_t
|
|||||||
opfunc_unary_minus (vm_instr_t instr, /**< instruction */
|
opfunc_unary_minus (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.remainder.dst;
|
const vm_idx_t dst_var_idx = instr.data.remainder.dst;
|
||||||
const idx_t var_idx = instr.data.remainder.var_left;
|
const vm_idx_t var_idx = instr.data.remainder.var_left;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ typedef enum
|
|||||||
*/
|
*/
|
||||||
static ecma_completion_value_t
|
static ecma_completion_value_t
|
||||||
do_number_bitwise_logic (vm_frame_ctx_t *frame_ctx_p, /**< interpreter context */
|
do_number_bitwise_logic (vm_frame_ctx_t *frame_ctx_p, /**< interpreter context */
|
||||||
idx_t dst_var_idx, /**< destination variable identifier */
|
vm_idx_t dst_var_idx, /**< destination variable identifier */
|
||||||
number_bitwise_logic_op op, /**< number bitwise logic operation */
|
number_bitwise_logic_op op, /**< number bitwise logic operation */
|
||||||
ecma_value_t left_value, /**< left value */
|
ecma_value_t left_value, /**< left value */
|
||||||
ecma_value_t right_value) /** right value */
|
ecma_value_t right_value) /** right value */
|
||||||
@@ -122,9 +122,9 @@ ecma_completion_value_t
|
|||||||
opfunc_b_and (vm_instr_t instr, /**< instruction */
|
opfunc_b_and (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.b_and.dst;
|
const vm_idx_t dst_var_idx = instr.data.b_and.dst;
|
||||||
const idx_t left_var_idx = instr.data.b_and.var_left;
|
const vm_idx_t left_var_idx = instr.data.b_and.var_left;
|
||||||
const idx_t right_var_idx = instr.data.b_and.var_right;
|
const vm_idx_t right_var_idx = instr.data.b_and.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -157,9 +157,9 @@ ecma_completion_value_t
|
|||||||
opfunc_b_or (vm_instr_t instr, /**< instruction */
|
opfunc_b_or (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.b_or.dst;
|
const vm_idx_t dst_var_idx = instr.data.b_or.dst;
|
||||||
const idx_t left_var_idx = instr.data.b_or.var_left;
|
const vm_idx_t left_var_idx = instr.data.b_or.var_left;
|
||||||
const idx_t right_var_idx = instr.data.b_or.var_right;
|
const vm_idx_t right_var_idx = instr.data.b_or.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -192,9 +192,9 @@ ecma_completion_value_t
|
|||||||
opfunc_b_xor (vm_instr_t instr, /**< instruction */
|
opfunc_b_xor (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.b_xor.dst;
|
const vm_idx_t dst_var_idx = instr.data.b_xor.dst;
|
||||||
const idx_t left_var_idx = instr.data.b_xor.var_left;
|
const vm_idx_t left_var_idx = instr.data.b_xor.var_left;
|
||||||
const idx_t right_var_idx = instr.data.b_xor.var_right;
|
const vm_idx_t right_var_idx = instr.data.b_xor.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -227,9 +227,9 @@ ecma_completion_value_t
|
|||||||
opfunc_b_shift_left (vm_instr_t instr, /**< instruction */
|
opfunc_b_shift_left (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.b_shift_left.dst;
|
const vm_idx_t dst_var_idx = instr.data.b_shift_left.dst;
|
||||||
const idx_t left_var_idx = instr.data.b_shift_left.var_left;
|
const vm_idx_t left_var_idx = instr.data.b_shift_left.var_left;
|
||||||
const idx_t right_var_idx = instr.data.b_shift_left.var_right;
|
const vm_idx_t right_var_idx = instr.data.b_shift_left.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -262,9 +262,9 @@ ecma_completion_value_t
|
|||||||
opfunc_b_shift_right (vm_instr_t instr, /**< instruction */
|
opfunc_b_shift_right (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.b_shift_right.dst;
|
const vm_idx_t dst_var_idx = instr.data.b_shift_right.dst;
|
||||||
const idx_t left_var_idx = instr.data.b_shift_right.var_left;
|
const vm_idx_t left_var_idx = instr.data.b_shift_right.var_left;
|
||||||
const idx_t right_var_idx = instr.data.b_shift_right.var_right;
|
const vm_idx_t right_var_idx = instr.data.b_shift_right.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -297,9 +297,9 @@ ecma_completion_value_t
|
|||||||
opfunc_b_shift_uright (vm_instr_t instr, /**< instruction */
|
opfunc_b_shift_uright (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.b_shift_uright.dst;
|
const vm_idx_t dst_var_idx = instr.data.b_shift_uright.dst;
|
||||||
const idx_t left_var_idx = instr.data.b_shift_uright.var_left;
|
const vm_idx_t left_var_idx = instr.data.b_shift_uright.var_left;
|
||||||
const idx_t right_var_idx = instr.data.b_shift_uright.var_right;
|
const vm_idx_t right_var_idx = instr.data.b_shift_uright.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -332,8 +332,8 @@ ecma_completion_value_t
|
|||||||
opfunc_b_not (vm_instr_t instr, /**< instruction */
|
opfunc_b_not (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.b_not.dst;
|
const vm_idx_t dst_var_idx = instr.data.b_not.dst;
|
||||||
const idx_t right_var_idx = instr.data.b_not.var_right;
|
const vm_idx_t right_var_idx = instr.data.b_not.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ ecma_completion_value_t
|
|||||||
opfunc_equal_value (vm_instr_t instr, /**< instruction */
|
opfunc_equal_value (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.equal_value.dst;
|
const vm_idx_t dst_var_idx = instr.data.equal_value.dst;
|
||||||
const idx_t left_var_idx = instr.data.equal_value.var_left;
|
const vm_idx_t left_var_idx = instr.data.equal_value.var_left;
|
||||||
const idx_t right_var_idx = instr.data.equal_value.var_right;
|
const vm_idx_t right_var_idx = instr.data.equal_value.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -67,9 +67,9 @@ ecma_completion_value_t
|
|||||||
opfunc_not_equal_value (vm_instr_t instr, /**< instruction */
|
opfunc_not_equal_value (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.not_equal_value.dst;
|
const vm_idx_t dst_var_idx = instr.data.not_equal_value.dst;
|
||||||
const idx_t left_var_idx = instr.data.not_equal_value.var_left;
|
const vm_idx_t left_var_idx = instr.data.not_equal_value.var_left;
|
||||||
const idx_t right_var_idx = instr.data.not_equal_value.var_right;
|
const vm_idx_t right_var_idx = instr.data.not_equal_value.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -108,9 +108,9 @@ ecma_completion_value_t
|
|||||||
opfunc_equal_value_type (vm_instr_t instr, /**< instruction */
|
opfunc_equal_value_type (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.equal_value_type.dst;
|
const vm_idx_t dst_var_idx = instr.data.equal_value_type.dst;
|
||||||
const idx_t left_var_idx = instr.data.equal_value_type.var_left;
|
const vm_idx_t left_var_idx = instr.data.equal_value_type.var_left;
|
||||||
const idx_t right_var_idx = instr.data.equal_value_type.var_right;
|
const vm_idx_t right_var_idx = instr.data.equal_value_type.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -143,9 +143,9 @@ ecma_completion_value_t
|
|||||||
opfunc_not_equal_value_type (vm_instr_t instr, /**< instruction */
|
opfunc_not_equal_value_type (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.not_equal_value_type.dst;
|
const vm_idx_t dst_var_idx = instr.data.not_equal_value_type.dst;
|
||||||
const idx_t left_var_idx = instr.data.not_equal_value_type.var_left;
|
const vm_idx_t left_var_idx = instr.data.not_equal_value_type.var_left;
|
||||||
const idx_t right_var_idx = instr.data.not_equal_value_type.var_right;
|
const vm_idx_t right_var_idx = instr.data.not_equal_value_type.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ ecma_completion_value_t
|
|||||||
opfunc_less_than (vm_instr_t instr, /**< instruction */
|
opfunc_less_than (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.less_than.dst;
|
const vm_idx_t dst_var_idx = instr.data.less_than.dst;
|
||||||
const idx_t left_var_idx = instr.data.less_than.var_left;
|
const vm_idx_t left_var_idx = instr.data.less_than.var_left;
|
||||||
const idx_t right_var_idx = instr.data.less_than.var_right;
|
const vm_idx_t right_var_idx = instr.data.less_than.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -76,9 +76,9 @@ ecma_completion_value_t
|
|||||||
opfunc_greater_than (vm_instr_t instr, /**< instruction */
|
opfunc_greater_than (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.greater_than.dst;
|
const vm_idx_t dst_var_idx = instr.data.greater_than.dst;
|
||||||
const idx_t left_var_idx = instr.data.greater_than.var_left;
|
const vm_idx_t left_var_idx = instr.data.greater_than.var_left;
|
||||||
const idx_t right_var_idx = instr.data.greater_than.var_right;
|
const vm_idx_t right_var_idx = instr.data.greater_than.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -124,9 +124,9 @@ ecma_completion_value_t
|
|||||||
opfunc_less_or_equal_than (vm_instr_t instr, /**< instruction */
|
opfunc_less_or_equal_than (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.less_or_equal_than.dst;
|
const vm_idx_t dst_var_idx = instr.data.less_or_equal_than.dst;
|
||||||
const idx_t left_var_idx = instr.data.less_or_equal_than.var_left;
|
const vm_idx_t left_var_idx = instr.data.less_or_equal_than.var_left;
|
||||||
const idx_t right_var_idx = instr.data.less_or_equal_than.var_right;
|
const vm_idx_t right_var_idx = instr.data.less_or_equal_than.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -179,9 +179,9 @@ ecma_completion_value_t
|
|||||||
opfunc_greater_or_equal_than (vm_instr_t instr, /**< instruction */
|
opfunc_greater_or_equal_than (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.greater_or_equal_than.dst;
|
const vm_idx_t dst_var_idx = instr.data.greater_or_equal_than.dst;
|
||||||
const idx_t left_var_idx = instr.data.greater_or_equal_than.var_left;
|
const vm_idx_t left_var_idx = instr.data.greater_or_equal_than.var_left;
|
||||||
const idx_t right_var_idx = instr.data.greater_or_equal_than.var_right;
|
const vm_idx_t right_var_idx = instr.data.greater_or_equal_than.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -234,9 +234,9 @@ ecma_completion_value_t
|
|||||||
opfunc_instanceof (vm_instr_t instr __attr_unused___, /**< instruction */
|
opfunc_instanceof (vm_instr_t instr __attr_unused___, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p __attr_unused___) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p __attr_unused___) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_idx = instr.data.instanceof.dst;
|
const vm_idx_t dst_idx = instr.data.instanceof.dst;
|
||||||
const idx_t left_var_idx = instr.data.instanceof.var_left;
|
const vm_idx_t left_var_idx = instr.data.instanceof.var_left;
|
||||||
const idx_t right_var_idx = instr.data.instanceof.var_right;
|
const vm_idx_t right_var_idx = instr.data.instanceof.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -280,9 +280,9 @@ ecma_completion_value_t
|
|||||||
opfunc_in (vm_instr_t instr __attr_unused___, /**< instruction */
|
opfunc_in (vm_instr_t instr __attr_unused___, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p __attr_unused___) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p __attr_unused___) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_idx = instr.data.in.dst;
|
const vm_idx_t dst_idx = instr.data.in.dst;
|
||||||
const idx_t left_var_idx = instr.data.in.var_left;
|
const vm_idx_t left_var_idx = instr.data.in.var_left;
|
||||||
const idx_t right_var_idx = instr.data.in.var_right;
|
const vm_idx_t right_var_idx = instr.data.in.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
|
|||||||
@@ -34,9 +34,9 @@
|
|||||||
#include "ecma-try-catch-macro.h"
|
#include "ecma-try-catch-macro.h"
|
||||||
#include "serializer.h"
|
#include "serializer.h"
|
||||||
|
|
||||||
bool is_reg_variable (vm_frame_ctx_t *frame_ctx_p, idx_t var_idx);
|
bool is_reg_variable (vm_frame_ctx_t *frame_ctx_p, vm_idx_t var_idx);
|
||||||
ecma_completion_value_t get_variable_value (vm_frame_ctx_t *, idx_t, bool);
|
ecma_completion_value_t get_variable_value (vm_frame_ctx_t *, vm_idx_t, bool);
|
||||||
ecma_completion_value_t set_variable_value (vm_frame_ctx_t *, vm_instr_counter_t, idx_t, ecma_value_t);
|
ecma_completion_value_t set_variable_value (vm_frame_ctx_t *, vm_instr_counter_t, vm_idx_t, ecma_value_t);
|
||||||
ecma_completion_value_t vm_fill_varg_list (vm_frame_ctx_t *frame_ctx_p,
|
ecma_completion_value_t vm_fill_varg_list (vm_frame_ctx_t *frame_ctx_p,
|
||||||
ecma_length_t args_number,
|
ecma_length_t args_number,
|
||||||
ecma_collection_header_t *args_values_p);
|
ecma_collection_header_t *args_values_p);
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ ecma_completion_value_t
|
|||||||
opfunc_try_block (vm_instr_t instr, /**< instruction */
|
opfunc_try_block (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t block_end_oc_idx_1 = instr.data.try_block.oc_idx_1;
|
const vm_idx_t block_end_oc_idx_1 = instr.data.try_block.oc_idx_1;
|
||||||
const idx_t block_end_oc_idx_2 = instr.data.try_block.oc_idx_2;
|
const vm_idx_t block_end_oc_idx_2 = instr.data.try_block.oc_idx_2;
|
||||||
const vm_instr_counter_t try_end_oc = (vm_instr_counter_t) (
|
const vm_instr_counter_t try_end_oc = (vm_instr_counter_t) (
|
||||||
vm_calc_instr_counter_from_idx_idx (block_end_oc_idx_1, block_end_oc_idx_2) + frame_ctx_p->pos);
|
vm_calc_instr_counter_from_idx_idx (block_end_oc_idx_1, block_end_oc_idx_2) + frame_ctx_p->pos);
|
||||||
|
|
||||||
|
|||||||
@@ -185,9 +185,9 @@ ecma_completion_value_t
|
|||||||
opfunc_for_in (vm_instr_t instr, /**< instruction */
|
opfunc_for_in (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *int_data_p) /**< interpreter context */
|
vm_frame_ctx_t *int_data_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t expr_idx = instr.data.for_in.expr;
|
const vm_idx_t expr_idx = instr.data.for_in.expr;
|
||||||
const idx_t block_end_oc_idx_1 = instr.data.for_in.oc_idx_1;
|
const vm_idx_t block_end_oc_idx_1 = instr.data.for_in.oc_idx_1;
|
||||||
const idx_t block_end_oc_idx_2 = instr.data.for_in.oc_idx_2;
|
const vm_idx_t block_end_oc_idx_2 = instr.data.for_in.oc_idx_2;
|
||||||
const vm_instr_counter_t for_in_end_oc = (vm_instr_counter_t) (
|
const vm_instr_counter_t for_in_end_oc = (vm_instr_counter_t) (
|
||||||
vm_calc_instr_counter_from_idx_idx (block_end_oc_idx_1,
|
vm_calc_instr_counter_from_idx_idx (block_end_oc_idx_1,
|
||||||
block_end_oc_idx_2) + int_data_p->pos);
|
block_end_oc_idx_2) + int_data_p->pos);
|
||||||
@@ -238,7 +238,7 @@ opfunc_for_in (vm_instr_t instr, /**< instruction */
|
|||||||
{
|
{
|
||||||
ecma_completion_value_t completion = set_variable_value (int_data_p,
|
ecma_completion_value_t completion = set_variable_value (int_data_p,
|
||||||
int_data_p->pos,
|
int_data_p->pos,
|
||||||
OPCODE_REG_SPECIAL_FOR_IN_PROPERTY_NAME,
|
VM_REG_SPECIAL_FOR_IN_PROPERTY_NAME,
|
||||||
name_value);
|
name_value);
|
||||||
JERRY_ASSERT (ecma_is_completion_value_empty (completion));
|
JERRY_ASSERT (ecma_is_completion_value_empty (completion));
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ do_strict_eval_arguments_check (ecma_object_t *ref_base_lex_env_p, /**< base of
|
|||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
is_reg_variable (vm_frame_ctx_t *frame_ctx_p, /**< interpreter context */
|
is_reg_variable (vm_frame_ctx_t *frame_ctx_p, /**< interpreter context */
|
||||||
idx_t var_idx) /**< variable identifier */
|
vm_idx_t var_idx) /**< variable identifier */
|
||||||
{
|
{
|
||||||
return (var_idx >= frame_ctx_p->min_reg_idx && var_idx <= frame_ctx_p->max_reg_idx);
|
return (var_idx >= frame_ctx_p->min_reg_idx && var_idx <= frame_ctx_p->max_reg_idx);
|
||||||
} /* is_reg_variable */
|
} /* is_reg_variable */
|
||||||
@@ -73,7 +73,7 @@ is_reg_variable (vm_frame_ctx_t *frame_ctx_p, /**< interpreter context */
|
|||||||
*/
|
*/
|
||||||
ecma_completion_value_t
|
ecma_completion_value_t
|
||||||
get_variable_value (vm_frame_ctx_t *frame_ctx_p, /**< interpreter context */
|
get_variable_value (vm_frame_ctx_t *frame_ctx_p, /**< interpreter context */
|
||||||
idx_t var_idx, /**< variable identifier */
|
vm_idx_t var_idx, /**< variable identifier */
|
||||||
bool do_eval_or_arguments_check) /** run 'strict eval or arguments reference' check
|
bool do_eval_or_arguments_check) /** run 'strict eval or arguments reference' check
|
||||||
See also: do_strict_eval_arguments_check */
|
See also: do_strict_eval_arguments_check */
|
||||||
{
|
{
|
||||||
@@ -126,7 +126,7 @@ get_variable_value (vm_frame_ctx_t *frame_ctx_p, /**< interpreter context */
|
|||||||
ecma_completion_value_t
|
ecma_completion_value_t
|
||||||
set_variable_value (vm_frame_ctx_t *frame_ctx_p, /**< interpreter context */
|
set_variable_value (vm_frame_ctx_t *frame_ctx_p, /**< interpreter context */
|
||||||
vm_instr_counter_t lit_oc, /**< instruction counter for literal */
|
vm_instr_counter_t lit_oc, /**< instruction counter for literal */
|
||||||
idx_t var_idx, /**< variable identifier */
|
vm_idx_t var_idx, /**< variable identifier */
|
||||||
ecma_value_t value) /**< value to set */
|
ecma_value_t value) /**< value to set */
|
||||||
{
|
{
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ vm_fill_varg_list (vm_frame_ctx_t *frame_ctx_p, /**< interpreter context */
|
|||||||
JERRY_ASSERT (next_instr.op_idx == VM_OP_META);
|
JERRY_ASSERT (next_instr.op_idx == VM_OP_META);
|
||||||
JERRY_ASSERT (next_instr.data.meta.type == OPCODE_META_TYPE_VARG);
|
JERRY_ASSERT (next_instr.data.meta.type == OPCODE_META_TYPE_VARG);
|
||||||
|
|
||||||
const idx_t varg_var_idx = next_instr.data.meta.data_1;
|
const vm_idx_t varg_var_idx = next_instr.data.meta.data_1;
|
||||||
|
|
||||||
ECMA_TRY_CATCH (get_arg,
|
ECMA_TRY_CATCH (get_arg,
|
||||||
get_variable_value (frame_ctx_p, varg_var_idx, false),
|
get_variable_value (frame_ctx_p, varg_var_idx, false),
|
||||||
|
|||||||
+59
-59
@@ -62,9 +62,9 @@ ecma_completion_value_t
|
|||||||
opfunc_assignment (vm_instr_t instr, /**< instruction */
|
opfunc_assignment (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.assignment.var_left;
|
const vm_idx_t dst_var_idx = instr.data.assignment.var_left;
|
||||||
const opcode_arg_type_operand type_value_right = (opcode_arg_type_operand) instr.data.assignment.type_value_right;
|
const opcode_arg_type_operand type_value_right = (opcode_arg_type_operand) instr.data.assignment.type_value_right;
|
||||||
const idx_t src_val_descr = instr.data.assignment.value_right;
|
const vm_idx_t src_val_descr = instr.data.assignment.value_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -233,8 +233,8 @@ ecma_completion_value_t
|
|||||||
opfunc_pre_incr (vm_instr_t instr, /**< instruction */
|
opfunc_pre_incr (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.pre_incr.dst;
|
const vm_idx_t dst_var_idx = instr.data.pre_incr.dst;
|
||||||
const idx_t incr_var_idx = instr.data.pre_incr.var_right;
|
const vm_idx_t incr_var_idx = instr.data.pre_incr.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -280,8 +280,8 @@ ecma_completion_value_t
|
|||||||
opfunc_pre_decr (vm_instr_t instr, /**< instruction */
|
opfunc_pre_decr (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.pre_decr.dst;
|
const vm_idx_t dst_var_idx = instr.data.pre_decr.dst;
|
||||||
const idx_t decr_var_idx = instr.data.pre_decr.var_right;
|
const vm_idx_t decr_var_idx = instr.data.pre_decr.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -327,8 +327,8 @@ ecma_completion_value_t
|
|||||||
opfunc_post_incr (vm_instr_t instr, /**< instruction */
|
opfunc_post_incr (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.post_incr.dst;
|
const vm_idx_t dst_var_idx = instr.data.post_incr.dst;
|
||||||
const idx_t incr_var_idx = instr.data.post_incr.var_right;
|
const vm_idx_t incr_var_idx = instr.data.post_incr.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -375,8 +375,8 @@ ecma_completion_value_t
|
|||||||
opfunc_post_decr (vm_instr_t instr, /**< instruction */
|
opfunc_post_decr (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.post_decr.dst;
|
const vm_idx_t dst_var_idx = instr.data.post_decr.dst;
|
||||||
const idx_t decr_var_idx = instr.data.post_decr.var_right;
|
const vm_idx_t decr_var_idx = instr.data.post_decr.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -530,7 +530,7 @@ ecma_completion_value_t
|
|||||||
opfunc_func_decl_n (vm_instr_t instr, /**< instruction */
|
opfunc_func_decl_n (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t function_name_idx = instr.data.func_decl_n.name_lit_idx;
|
const vm_idx_t function_name_idx = instr.data.func_decl_n.name_lit_idx;
|
||||||
const ecma_length_t params_number = instr.data.func_decl_n.arg_list;
|
const ecma_length_t params_number = instr.data.func_decl_n.arg_list;
|
||||||
|
|
||||||
lit_cpointer_t function_name_lit_cp = serializer_get_literal_cp_by_uid (function_name_idx,
|
lit_cpointer_t function_name_lit_cp = serializer_get_literal_cp_by_uid (function_name_idx,
|
||||||
@@ -566,10 +566,10 @@ opfunc_func_expr_n (vm_instr_t instr, /**< instruction */
|
|||||||
|
|
||||||
frame_ctx_p->pos++;
|
frame_ctx_p->pos++;
|
||||||
|
|
||||||
const idx_t dst_var_idx = instr.data.func_expr_n.lhs;
|
const vm_idx_t dst_var_idx = instr.data.func_expr_n.lhs;
|
||||||
const idx_t function_name_lit_idx = instr.data.func_expr_n.name_lit_idx;
|
const vm_idx_t function_name_lit_idx = instr.data.func_expr_n.name_lit_idx;
|
||||||
const ecma_length_t params_number = instr.data.func_expr_n.arg_list;
|
const ecma_length_t params_number = instr.data.func_expr_n.arg_list;
|
||||||
const bool is_named_func_expr = (function_name_lit_idx != INVALID_VALUE);
|
const bool is_named_func_expr = (function_name_lit_idx != VM_IDX_EMPTY);
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -662,7 +662,7 @@ static ecma_value_t
|
|||||||
vm_helper_call_get_call_flags_and_this_arg (vm_frame_ctx_t *int_data_p, /**< interpreter context */
|
vm_helper_call_get_call_flags_and_this_arg (vm_frame_ctx_t *int_data_p, /**< interpreter context */
|
||||||
vm_instr_counter_t var_idx_lit_oc, /**< instruction counter of instruction
|
vm_instr_counter_t var_idx_lit_oc, /**< instruction counter of instruction
|
||||||
with var_idx */
|
with var_idx */
|
||||||
idx_t var_idx, /**< idx, used to retrieve the called function object */
|
vm_idx_t var_idx, /**< idx, used to retrieve the called function object */
|
||||||
opcode_call_flags_t *out_flags_p) /**< out: call flags */
|
opcode_call_flags_t *out_flags_p) /**< out: call flags */
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (out_flags_p != NULL);
|
JERRY_ASSERT (out_flags_p != NULL);
|
||||||
@@ -670,7 +670,7 @@ vm_helper_call_get_call_flags_and_this_arg (vm_frame_ctx_t *int_data_p, /**< int
|
|||||||
bool is_increase_instruction_pointer;
|
bool is_increase_instruction_pointer;
|
||||||
|
|
||||||
opcode_call_flags_t call_flags = OPCODE_CALL_FLAGS__EMPTY;
|
opcode_call_flags_t call_flags = OPCODE_CALL_FLAGS__EMPTY;
|
||||||
idx_t this_arg_var_idx = INVALID_VALUE;
|
vm_idx_t this_arg_var_idx = VM_IDX_EMPTY;
|
||||||
|
|
||||||
vm_instr_t next_opcode = vm_get_instr (int_data_p->instrs_p, int_data_p->pos);
|
vm_instr_t next_opcode = vm_get_instr (int_data_p->instrs_p, int_data_p->pos);
|
||||||
if (next_opcode.op_idx == VM_OP_META
|
if (next_opcode.op_idx == VM_OP_META
|
||||||
@@ -773,9 +773,9 @@ ecma_completion_value_t
|
|||||||
opfunc_call_n (vm_instr_t instr, /**< instruction */
|
opfunc_call_n (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t lhs_var_idx = instr.data.call_n.lhs;
|
const vm_idx_t lhs_var_idx = instr.data.call_n.lhs;
|
||||||
const idx_t function_var_idx = instr.data.call_n.function_var_idx;
|
const vm_idx_t function_var_idx = instr.data.call_n.function_var_idx;
|
||||||
const idx_t args_number_idx = instr.data.call_n.arg_list;
|
const vm_idx_t args_number_idx = instr.data.call_n.arg_list;
|
||||||
const vm_instr_counter_t lit_oc = frame_ctx_p->pos;
|
const vm_instr_counter_t lit_oc = frame_ctx_p->pos;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
@@ -866,9 +866,9 @@ ecma_completion_value_t
|
|||||||
opfunc_construct_n (vm_instr_t instr, /**< instruction */
|
opfunc_construct_n (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t lhs_var_idx = instr.data.construct_n.lhs;
|
const vm_idx_t lhs_var_idx = instr.data.construct_n.lhs;
|
||||||
const idx_t constructor_name_lit_idx = instr.data.construct_n.name_lit_idx;
|
const vm_idx_t constructor_name_lit_idx = instr.data.construct_n.name_lit_idx;
|
||||||
const idx_t args_number = instr.data.construct_n.arg_list;
|
const vm_idx_t args_number = instr.data.construct_n.arg_list;
|
||||||
const vm_instr_counter_t lit_oc = frame_ctx_p->pos;
|
const vm_instr_counter_t lit_oc = frame_ctx_p->pos;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
@@ -935,9 +935,9 @@ ecma_completion_value_t
|
|||||||
opfunc_array_decl (vm_instr_t instr, /**< instruction */
|
opfunc_array_decl (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t lhs_var_idx = instr.data.array_decl.lhs;
|
const vm_idx_t lhs_var_idx = instr.data.array_decl.lhs;
|
||||||
const idx_t args_number_high_byte = instr.data.array_decl.list_1;
|
const vm_idx_t args_number_high_byte = instr.data.array_decl.list_1;
|
||||||
const idx_t args_number_low_byte = instr.data.array_decl.list_2;
|
const vm_idx_t args_number_low_byte = instr.data.array_decl.list_2;
|
||||||
const vm_instr_counter_t lit_oc = frame_ctx_p->pos;
|
const vm_instr_counter_t lit_oc = frame_ctx_p->pos;
|
||||||
|
|
||||||
frame_ctx_p->pos++;
|
frame_ctx_p->pos++;
|
||||||
@@ -1009,9 +1009,9 @@ ecma_completion_value_t
|
|||||||
opfunc_obj_decl (vm_instr_t instr, /**< instruction */
|
opfunc_obj_decl (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t lhs_var_idx = instr.data.obj_decl.lhs;
|
const vm_idx_t lhs_var_idx = instr.data.obj_decl.lhs;
|
||||||
const idx_t args_number_high_byte = instr.data.obj_decl.list_1;
|
const vm_idx_t args_number_high_byte = instr.data.obj_decl.list_1;
|
||||||
const idx_t args_number_low_byte = instr.data.obj_decl.list_2;
|
const vm_idx_t args_number_low_byte = instr.data.obj_decl.list_2;
|
||||||
const vm_instr_counter_t obj_lit_oc = frame_ctx_p->pos;
|
const vm_instr_counter_t obj_lit_oc = frame_ctx_p->pos;
|
||||||
|
|
||||||
frame_ctx_p->pos++;
|
frame_ctx_p->pos++;
|
||||||
@@ -1039,10 +1039,10 @@ opfunc_obj_decl (vm_instr_t instr, /**< instruction */
|
|||||||
|| type == OPCODE_META_TYPE_VARG_PROP_GETTER
|
|| type == OPCODE_META_TYPE_VARG_PROP_GETTER
|
||||||
|| type == OPCODE_META_TYPE_VARG_PROP_SETTER);
|
|| type == OPCODE_META_TYPE_VARG_PROP_SETTER);
|
||||||
|
|
||||||
const idx_t prop_name_var_idx = next_opcode.data.meta.data_1;
|
const vm_idx_t prop_name_var_idx = next_opcode.data.meta.data_1;
|
||||||
JERRY_ASSERT (is_reg_variable (frame_ctx_p, prop_name_var_idx));
|
JERRY_ASSERT (is_reg_variable (frame_ctx_p, prop_name_var_idx));
|
||||||
|
|
||||||
const idx_t value_for_prop_desc_var_idx = next_opcode.data.meta.data_2;
|
const vm_idx_t value_for_prop_desc_var_idx = next_opcode.data.meta.data_2;
|
||||||
|
|
||||||
ECMA_TRY_CATCH (value_for_prop_desc,
|
ECMA_TRY_CATCH (value_for_prop_desc,
|
||||||
get_variable_value (frame_ctx_p,
|
get_variable_value (frame_ctx_p,
|
||||||
@@ -1209,9 +1209,9 @@ ecma_completion_value_t
|
|||||||
opfunc_prop_getter (vm_instr_t instr __attr_unused___, /**< instruction */
|
opfunc_prop_getter (vm_instr_t instr __attr_unused___, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p __attr_unused___) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p __attr_unused___) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t lhs_var_idx = instr.data.prop_getter.lhs;
|
const vm_idx_t lhs_var_idx = instr.data.prop_getter.lhs;
|
||||||
const idx_t base_var_idx = instr.data.prop_getter.obj;
|
const vm_idx_t base_var_idx = instr.data.prop_getter.obj;
|
||||||
const idx_t prop_name_var_idx = instr.data.prop_getter.prop;
|
const vm_idx_t prop_name_var_idx = instr.data.prop_getter.prop;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -1262,9 +1262,9 @@ ecma_completion_value_t
|
|||||||
opfunc_prop_setter (vm_instr_t instr __attr_unused___, /**< instruction */
|
opfunc_prop_setter (vm_instr_t instr __attr_unused___, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p __attr_unused___) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p __attr_unused___) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t base_var_idx = instr.data.prop_setter.obj;
|
const vm_idx_t base_var_idx = instr.data.prop_setter.obj;
|
||||||
const idx_t prop_name_var_idx = instr.data.prop_setter.prop;
|
const vm_idx_t prop_name_var_idx = instr.data.prop_setter.prop;
|
||||||
const idx_t rhs_var_idx = instr.data.prop_setter.rhs;
|
const vm_idx_t rhs_var_idx = instr.data.prop_setter.rhs;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -1314,8 +1314,8 @@ ecma_completion_value_t
|
|||||||
opfunc_logical_not (vm_instr_t instr, /**< instruction */
|
opfunc_logical_not (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.logical_not.dst;
|
const vm_idx_t dst_var_idx = instr.data.logical_not.dst;
|
||||||
const idx_t right_var_idx = instr.data.logical_not.var_right;
|
const vm_idx_t right_var_idx = instr.data.logical_not.var_right;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -1352,7 +1352,7 @@ ecma_completion_value_t
|
|||||||
opfunc_this_binding (vm_instr_t instr, /**< instruction */
|
opfunc_this_binding (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.this_binding.lhs;
|
const vm_idx_t dst_var_idx = instr.data.this_binding.lhs;
|
||||||
const vm_instr_counter_t lit_oc = frame_ctx_p->pos;
|
const vm_instr_counter_t lit_oc = frame_ctx_p->pos;
|
||||||
|
|
||||||
frame_ctx_p->pos++;
|
frame_ctx_p->pos++;
|
||||||
@@ -1378,9 +1378,9 @@ ecma_completion_value_t
|
|||||||
opfunc_with (vm_instr_t instr, /**< instruction */
|
opfunc_with (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t expr_var_idx = instr.data.with.expr;
|
const vm_idx_t expr_var_idx = instr.data.with.expr;
|
||||||
const idx_t block_end_oc_idx_1 = instr.data.with.oc_idx_1;
|
const vm_idx_t block_end_oc_idx_1 = instr.data.with.oc_idx_1;
|
||||||
const idx_t block_end_oc_idx_2 = instr.data.with.oc_idx_2;
|
const vm_idx_t block_end_oc_idx_2 = instr.data.with.oc_idx_2;
|
||||||
const vm_instr_counter_t with_end_oc = (vm_instr_counter_t) (
|
const vm_instr_counter_t with_end_oc = (vm_instr_counter_t) (
|
||||||
vm_calc_instr_counter_from_idx_idx (block_end_oc_idx_1, block_end_oc_idx_2) + frame_ctx_p->pos);
|
vm_calc_instr_counter_from_idx_idx (block_end_oc_idx_1, block_end_oc_idx_2) + frame_ctx_p->pos);
|
||||||
|
|
||||||
@@ -1452,7 +1452,7 @@ ecma_completion_value_t
|
|||||||
opfunc_throw_value (vm_instr_t instr, /**< instruction */
|
opfunc_throw_value (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t var_idx = instr.data.throw_value.var;
|
const vm_idx_t var_idx = instr.data.throw_value.var;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -1481,7 +1481,7 @@ opfunc_throw_value (vm_instr_t instr, /**< instruction */
|
|||||||
*/
|
*/
|
||||||
static ecma_completion_value_t
|
static ecma_completion_value_t
|
||||||
evaluate_arg_for_typeof (vm_frame_ctx_t *frame_ctx_p, /**< interpreter context */
|
evaluate_arg_for_typeof (vm_frame_ctx_t *frame_ctx_p, /**< interpreter context */
|
||||||
idx_t var_idx) /**< arg variable identifier */
|
vm_idx_t var_idx) /**< arg variable identifier */
|
||||||
{
|
{
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -1531,8 +1531,8 @@ ecma_completion_value_t
|
|||||||
opfunc_typeof (vm_instr_t instr, /**< instruction */
|
opfunc_typeof (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.typeof.lhs;
|
const vm_idx_t dst_var_idx = instr.data.typeof.lhs;
|
||||||
const idx_t obj_var_idx = instr.data.typeof.obj;
|
const vm_idx_t obj_var_idx = instr.data.typeof.obj;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -1603,8 +1603,8 @@ ecma_completion_value_t
|
|||||||
opfunc_delete_var (vm_instr_t instr, /**< instruction */
|
opfunc_delete_var (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.delete_var.lhs;
|
const vm_idx_t dst_var_idx = instr.data.delete_var.lhs;
|
||||||
const idx_t name_lit_idx = instr.data.delete_var.name;
|
const vm_idx_t name_lit_idx = instr.data.delete_var.name;
|
||||||
const vm_instr_counter_t lit_oc = frame_ctx_p->pos;
|
const vm_instr_counter_t lit_oc = frame_ctx_p->pos;
|
||||||
|
|
||||||
frame_ctx_p->pos++;
|
frame_ctx_p->pos++;
|
||||||
@@ -1670,9 +1670,9 @@ ecma_completion_value_t
|
|||||||
opfunc_delete_prop (vm_instr_t instr, /**< instruction */
|
opfunc_delete_prop (vm_instr_t instr, /**< instruction */
|
||||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||||
{
|
{
|
||||||
const idx_t dst_var_idx = instr.data.delete_prop.lhs;
|
const vm_idx_t dst_var_idx = instr.data.delete_prop.lhs;
|
||||||
const idx_t base_var_idx = instr.data.delete_prop.base;
|
const vm_idx_t base_var_idx = instr.data.delete_prop.base;
|
||||||
const idx_t name_var_idx = instr.data.delete_prop.name;
|
const vm_idx_t name_var_idx = instr.data.delete_prop.name;
|
||||||
|
|
||||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||||
|
|
||||||
@@ -1777,13 +1777,13 @@ opfunc_meta (vm_instr_t instr, /**< instruction */
|
|||||||
* @return instruction counter
|
* @return instruction counter
|
||||||
*/
|
*/
|
||||||
vm_instr_counter_t
|
vm_instr_counter_t
|
||||||
vm_calc_instr_counter_from_idx_idx (const idx_t oc_idx_1, /**< first idx */
|
vm_calc_instr_counter_from_idx_idx (const vm_idx_t oc_idx_1, /**< first idx */
|
||||||
const idx_t oc_idx_2) /**< second idx */
|
const vm_idx_t oc_idx_2) /**< second idx */
|
||||||
{
|
{
|
||||||
vm_instr_counter_t counter;
|
vm_instr_counter_t counter;
|
||||||
|
|
||||||
counter = oc_idx_1;
|
counter = oc_idx_1;
|
||||||
counter = (vm_instr_counter_t) (counter << (sizeof (idx_t) * JERRY_BITSINBYTE));
|
counter = (vm_instr_counter_t) (counter << (sizeof (vm_idx_t) * JERRY_BITSINBYTE));
|
||||||
counter = (vm_instr_counter_t) (counter | oc_idx_2);
|
counter = (vm_instr_counter_t) (counter | oc_idx_2);
|
||||||
|
|
||||||
return counter;
|
return counter;
|
||||||
@@ -1800,8 +1800,8 @@ vm_read_instr_counter_from_meta (opcode_meta_type expected_type, /**< expected t
|
|||||||
vm_instr_t meta_opcode = vm_get_instr (frame_ctx_p->instrs_p, frame_ctx_p->pos);
|
vm_instr_t meta_opcode = vm_get_instr (frame_ctx_p->instrs_p, frame_ctx_p->pos);
|
||||||
JERRY_ASSERT (meta_opcode.data.meta.type == expected_type);
|
JERRY_ASSERT (meta_opcode.data.meta.type == expected_type);
|
||||||
|
|
||||||
const idx_t data_1 = meta_opcode.data.meta.data_1;
|
const vm_idx_t data_1 = meta_opcode.data.meta.data_1;
|
||||||
const idx_t data_2 = meta_opcode.data.meta.data_2;
|
const vm_idx_t data_2 = meta_opcode.data.meta.data_2;
|
||||||
|
|
||||||
return vm_calc_instr_counter_from_idx_idx (data_1, data_2);
|
return vm_calc_instr_counter_from_idx_idx (data_1, data_2);
|
||||||
} /* vm_read_instr_counter_from_meta */
|
} /* vm_read_instr_counter_from_meta */
|
||||||
@@ -1815,7 +1815,7 @@ vm_read_instr_counter_from_meta (opcode_meta_type expected_type, /**< expected t
|
|||||||
return instr; \
|
return instr; \
|
||||||
}
|
}
|
||||||
#define VM_OP_1(opcode_name, opcode_name_uppercase, arg1, arg1_type) \
|
#define VM_OP_1(opcode_name, opcode_name_uppercase, arg1, arg1_type) \
|
||||||
vm_instr_t getop_##opcode_name (idx_t arg1_v) \
|
vm_instr_t getop_##opcode_name (vm_idx_t arg1_v) \
|
||||||
{ \
|
{ \
|
||||||
vm_instr_t instr; \
|
vm_instr_t instr; \
|
||||||
memset (&instr, 0, sizeof(instr)); \
|
memset (&instr, 0, sizeof(instr)); \
|
||||||
@@ -1824,7 +1824,7 @@ vm_read_instr_counter_from_meta (opcode_meta_type expected_type, /**< expected t
|
|||||||
return instr; \
|
return instr; \
|
||||||
}
|
}
|
||||||
#define VM_OP_2(opcode_name, opcode_name_uppercase, arg1, arg1_type, arg2, arg2_type) \
|
#define VM_OP_2(opcode_name, opcode_name_uppercase, arg1, arg1_type, arg2, arg2_type) \
|
||||||
vm_instr_t getop_##opcode_name (idx_t arg1_v, idx_t arg2_v) \
|
vm_instr_t getop_##opcode_name (vm_idx_t arg1_v, vm_idx_t arg2_v) \
|
||||||
{ \
|
{ \
|
||||||
vm_instr_t instr; \
|
vm_instr_t instr; \
|
||||||
memset (&instr, 0, sizeof(instr)); \
|
memset (&instr, 0, sizeof(instr)); \
|
||||||
@@ -1834,7 +1834,7 @@ vm_read_instr_counter_from_meta (opcode_meta_type expected_type, /**< expected t
|
|||||||
return instr; \
|
return instr; \
|
||||||
}
|
}
|
||||||
#define VM_OP_3(opcode_name, opcode_name_uppercase, arg1, arg1_type, arg2, arg2_type, arg3, arg3_type) \
|
#define VM_OP_3(opcode_name, opcode_name_uppercase, arg1, arg1_type, arg2, arg2_type, arg3, arg3_type) \
|
||||||
vm_instr_t getop_##opcode_name (idx_t arg1_v, idx_t arg2_v, idx_t arg3_v) \
|
vm_instr_t getop_##opcode_name (vm_idx_t arg1_v, vm_idx_t arg2_v, vm_idx_t arg3_v) \
|
||||||
{ \
|
{ \
|
||||||
vm_instr_t instr; \
|
vm_instr_t instr; \
|
||||||
instr.op_idx = VM_OP_##opcode_name_uppercase; \
|
instr.op_idx = VM_OP_##opcode_name_uppercase; \
|
||||||
|
|||||||
+65
-32
@@ -41,9 +41,56 @@
|
|||||||
typedef uint16_t vm_instr_counter_t;
|
typedef uint16_t vm_instr_counter_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opcode / argument value in an instruction
|
* Opcode / argument value in an instruction ("idx")
|
||||||
*/
|
*/
|
||||||
typedef uint8_t idx_t;
|
typedef uint8_t vm_idx_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description of vm_idx_t possible value ranges and special values
|
||||||
|
*/
|
||||||
|
enum : vm_idx_t
|
||||||
|
{
|
||||||
|
VM_IDX_GENERAL_VALUE_FIRST = 0, /**< first idx value that can be used for any argument value */
|
||||||
|
VM_IDX_GENERAL_VALUE_LAST = 252, /**< last idx value that can be used for any argument value */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Special values
|
||||||
|
*/
|
||||||
|
VM_IDX_REWRITE_GENERAL_CASE = 253, /**< intermediate value, used during byte-code generation,
|
||||||
|
* indicating that the idx would be rewritten with a value
|
||||||
|
* other than in-block literal identifier */
|
||||||
|
VM_IDX_REWRITE_LITERAL_UID = 254, /**< intermediate value, used during byte-code generation,
|
||||||
|
* indicating that the idx would be rewritten with in-block
|
||||||
|
* literal identifier */
|
||||||
|
VM_IDX_EMPTY = 255, /**< empty idx value, used when corresponding instruction argument is not set */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Literals (variable names / strings / numbers) ranges
|
||||||
|
*/
|
||||||
|
VM_IDX_LITERAL_FIRST = VM_IDX_GENERAL_VALUE_FIRST, /**< index of first possible literals-related idx value */
|
||||||
|
VM_IDX_LITERAL_LAST = VM_IDX_LITERAL_FIRST + 127, /**< index of last possible literals-related idx value */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Registers (temp variables) ranges
|
||||||
|
*/
|
||||||
|
VM_IDX_REG_FIRST = VM_IDX_LITERAL_LAST + 1, /** identifier of first special register */
|
||||||
|
VM_IDX_REG_LAST = VM_IDX_GENERAL_VALUE_LAST, /**< identifier of last register */
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ranges of registers (temporary variables)
|
||||||
|
*/
|
||||||
|
typedef enum : vm_idx_t
|
||||||
|
{
|
||||||
|
VM_REG_FIRST = VM_IDX_REG_FIRST, /** identifier of first special register */
|
||||||
|
VM_REG_LAST = VM_IDX_REG_LAST, /**< identifier of last register */
|
||||||
|
|
||||||
|
VM_REG_SPECIAL_EVAL_RET = VM_REG_FIRST, /**< eval return value */
|
||||||
|
VM_REG_SPECIAL_FOR_IN_PROPERTY_NAME, /**< variable, containing property name,
|
||||||
|
* at start of for-in loop body */
|
||||||
|
VM_REG_GENERAL_FIRST, /** identifier of first non-special register */
|
||||||
|
VM_REG_GENERAL_LAST = VM_IDX_REG_LAST /** identifier of last non-special register */
|
||||||
|
} vm_reg_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Descriptor of assignment's second argument
|
* Descriptor of assignment's second argument
|
||||||
@@ -84,7 +131,7 @@ typedef enum
|
|||||||
OPCODE_META_TYPE_END_FOR_IN /**< end of for-in statement */
|
OPCODE_META_TYPE_END_FOR_IN /**< end of for-in statement */
|
||||||
} opcode_meta_type;
|
} opcode_meta_type;
|
||||||
|
|
||||||
typedef enum : idx_t
|
typedef enum : vm_idx_t
|
||||||
{
|
{
|
||||||
OPCODE_CALL_FLAGS__EMPTY = (0u), /**< initializer for empty flag set */
|
OPCODE_CALL_FLAGS__EMPTY = (0u), /**< initializer for empty flag set */
|
||||||
OPCODE_CALL_FLAGS_HAVE_THIS_ARG = (1u << 0), /**< flag, indicating that call is performed
|
OPCODE_CALL_FLAGS_HAVE_THIS_ARG = (1u << 0), /**< flag, indicating that call is performed
|
||||||
@@ -100,7 +147,7 @@ typedef enum : idx_t
|
|||||||
/**
|
/**
|
||||||
* Flags indicating various properties of a scope's code
|
* Flags indicating various properties of a scope's code
|
||||||
*/
|
*/
|
||||||
typedef enum : idx_t
|
typedef enum : vm_idx_t
|
||||||
{
|
{
|
||||||
OPCODE_SCOPE_CODE_FLAGS__EMPTY = (0u), /**< initializer for empty flag set */
|
OPCODE_SCOPE_CODE_FLAGS__EMPTY = (0u), /**< initializer for empty flag set */
|
||||||
OPCODE_SCOPE_CODE_FLAGS_STRICT = (1u << 0), /**< code is strict mode code */
|
OPCODE_SCOPE_CODE_FLAGS_STRICT = (1u << 0), /**< code is strict mode code */
|
||||||
@@ -110,20 +157,6 @@ typedef enum : idx_t
|
|||||||
* 'eval' identifier */
|
* 'eval' identifier */
|
||||||
} opcode_scope_code_flags_t;
|
} opcode_scope_code_flags_t;
|
||||||
|
|
||||||
/**
|
|
||||||
* Enumeration of registers (temp variables) ranges
|
|
||||||
*/
|
|
||||||
typedef enum : idx_t
|
|
||||||
{
|
|
||||||
OPCODE_REG_FIRST = 128, /** identifier of first special register */
|
|
||||||
OPCODE_REG_SPECIAL_EVAL_RET = OPCODE_REG_FIRST, /**< eval return value */
|
|
||||||
OPCODE_REG_SPECIAL_FOR_IN_PROPERTY_NAME, /**< variable, containing property name,
|
|
||||||
* at start of for-in loop body */
|
|
||||||
OPCODE_REG_GENERAL_FIRST, /** identifier of first non-special register */
|
|
||||||
OPCODE_REG_GENERAL_LAST = 253, /** identifier of last non-special register */
|
|
||||||
OPCODE_REG_LAST = OPCODE_REG_GENERAL_FIRST /**< identifier of last register */
|
|
||||||
} opcode_special_reg_t;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Types of byte-code instruction arguments, used for instruction description
|
* Types of byte-code instruction arguments, used for instruction description
|
||||||
*
|
*
|
||||||
@@ -137,7 +170,7 @@ typedef enum
|
|||||||
VM_OP_ARG_TYPE_IDENTIFIER = (1u << 2), /**< identifier - named variable (string literal) */
|
VM_OP_ARG_TYPE_IDENTIFIER = (1u << 2), /**< identifier - named variable (string literal) */
|
||||||
VM_OP_ARG_TYPE_STRING = (1u << 3), /**< string constant value (string literal) */
|
VM_OP_ARG_TYPE_STRING = (1u << 3), /**< string constant value (string literal) */
|
||||||
VM_OP_ARG_TYPE_NUMBER = (1u << 4), /**< number constant value (number literal) */
|
VM_OP_ARG_TYPE_NUMBER = (1u << 4), /**< number constant value (number literal) */
|
||||||
VM_OP_ARG_TYPE_INTEGER_CONST = (1u << 5), /**< a 8-bit integer constant (any idx_t) */
|
VM_OP_ARG_TYPE_INTEGER_CONST = (1u << 5), /**< a 8-bit integer constant (any vm_idx_t) */
|
||||||
VM_OP_ARG_TYPE_TYPE_OF_NEXT = (1u << 6), /**< opcode_arg_type_operand value,
|
VM_OP_ARG_TYPE_TYPE_OF_NEXT = (1u << 6), /**< opcode_arg_type_operand value,
|
||||||
* representing type of argument encoded in next idx */
|
* representing type of argument encoded in next idx */
|
||||||
|
|
||||||
@@ -163,8 +196,8 @@ typedef struct
|
|||||||
bool is_eval_code; /**< is current code executed with eval */
|
bool is_eval_code; /**< is current code executed with eval */
|
||||||
bool is_call_in_direct_eval_form; /** flag, indicating if there is call of 'Direct call to eval' form in
|
bool is_call_in_direct_eval_form; /** flag, indicating if there is call of 'Direct call to eval' form in
|
||||||
* process (see also: OPCODE_CALL_FLAGS_DIRECT_CALL_TO_EVAL_FORM) */
|
* process (see also: OPCODE_CALL_FLAGS_DIRECT_CALL_TO_EVAL_FORM) */
|
||||||
idx_t min_reg_idx; /**< minimum idx used for register identification */
|
vm_idx_t min_reg_idx; /**< minimum idx used for register identification */
|
||||||
idx_t max_reg_idx; /**< maximum idx used for register identification */
|
vm_idx_t max_reg_idx; /**< maximum idx used for register identification */
|
||||||
ecma_number_t* tmp_num_p; /**< an allocated number (to reduce temporary allocations) */
|
ecma_number_t* tmp_num_p; /**< an allocated number (to reduce temporary allocations) */
|
||||||
vm_stack_frame_t stack_frame; /**< stack frame associated with the context */
|
vm_stack_frame_t stack_frame; /**< stack frame associated with the context */
|
||||||
|
|
||||||
@@ -195,32 +228,32 @@ typedef struct
|
|||||||
const vm_instr_counter_t end_oc; /**< instruction counter of the last instruction of the scope */
|
const vm_instr_counter_t end_oc; /**< instruction counter of the last instruction of the scope */
|
||||||
} vm_run_scope_t;
|
} vm_run_scope_t;
|
||||||
|
|
||||||
vm_instr_counter_t vm_calc_instr_counter_from_idx_idx (const idx_t oc_idx_1, const idx_t oc_idx_2);
|
vm_instr_counter_t vm_calc_instr_counter_from_idx_idx (const vm_idx_t oc_idx_1, const vm_idx_t oc_idx_2);
|
||||||
vm_instr_counter_t vm_read_instr_counter_from_meta (opcode_meta_type expected_type, vm_frame_ctx_t *int_data);
|
vm_instr_counter_t vm_read_instr_counter_from_meta (opcode_meta_type expected_type, vm_frame_ctx_t *int_data);
|
||||||
|
|
||||||
typedef struct vm_instr_t
|
typedef struct vm_instr_t
|
||||||
{
|
{
|
||||||
idx_t op_idx;
|
vm_idx_t op_idx;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
#define VM_OP_1(opcode_name, opcode_name_uppercase, arg1, arg1_type) \
|
#define VM_OP_1(opcode_name, opcode_name_uppercase, arg1, arg1_type) \
|
||||||
struct \
|
struct \
|
||||||
{ \
|
{ \
|
||||||
idx_t arg1; \
|
vm_idx_t arg1; \
|
||||||
} opcode_name;
|
} opcode_name;
|
||||||
|
|
||||||
#define VM_OP_2(opcode_name, opcode_name_uppercase, arg1, arg1_type, arg2, arg2_type) \
|
#define VM_OP_2(opcode_name, opcode_name_uppercase, arg1, arg1_type, arg2, arg2_type) \
|
||||||
struct \
|
struct \
|
||||||
{ \
|
{ \
|
||||||
idx_t arg1; \
|
vm_idx_t arg1; \
|
||||||
idx_t arg2; \
|
vm_idx_t arg2; \
|
||||||
} opcode_name;
|
} opcode_name;
|
||||||
#define VM_OP_3(opcode_name, opcode_name_uppercase, arg1, arg1_type, arg2, arg2_type, arg3, arg3_type) \
|
#define VM_OP_3(opcode_name, opcode_name_uppercase, arg1, arg1_type, arg2, arg2_type, arg3, arg3_type) \
|
||||||
struct \
|
struct \
|
||||||
{ \
|
{ \
|
||||||
idx_t arg1; \
|
vm_idx_t arg1; \
|
||||||
idx_t arg2; \
|
vm_idx_t arg2; \
|
||||||
idx_t arg3; \
|
vm_idx_t arg3; \
|
||||||
} opcode_name;
|
} opcode_name;
|
||||||
|
|
||||||
#include "vm-opcodes.inc.h"
|
#include "vm-opcodes.inc.h"
|
||||||
@@ -259,11 +292,11 @@ typedef ecma_completion_value_t (*opfunc) (vm_instr_t, vm_frame_ctx_t *);
|
|||||||
#define VM_OP_0(opcode_name, opcode_name_uppercase) \
|
#define VM_OP_0(opcode_name, opcode_name_uppercase) \
|
||||||
vm_instr_t getop_##opcode_name (void);
|
vm_instr_t getop_##opcode_name (void);
|
||||||
#define VM_OP_1(opcode_name, opcode_name_uppercase, arg1, arg1_type) \
|
#define VM_OP_1(opcode_name, opcode_name_uppercase, arg1, arg1_type) \
|
||||||
vm_instr_t getop_##opcode_name (idx_t);
|
vm_instr_t getop_##opcode_name (vm_idx_t);
|
||||||
#define VM_OP_2(opcode_name, opcode_name_uppercase, arg1, arg1_type, arg2, arg2_type) \
|
#define VM_OP_2(opcode_name, opcode_name_uppercase, arg1, arg1_type, arg2, arg2_type) \
|
||||||
vm_instr_t getop_##opcode_name (idx_t, idx_t);
|
vm_instr_t getop_##opcode_name (vm_idx_t, vm_idx_t);
|
||||||
#define VM_OP_3(opcode_name, opcode_name_uppercase, arg1, arg1_type, arg2, arg2_type, arg3, arg3_type) \
|
#define VM_OP_3(opcode_name, opcode_name_uppercase, arg1, arg1_type, arg2, arg2_type, arg3, arg3_type) \
|
||||||
vm_instr_t getop_##opcode_name (idx_t, idx_t, idx_t);
|
vm_instr_t getop_##opcode_name (vm_idx_t, vm_idx_t, vm_idx_t);
|
||||||
|
|
||||||
#include "vm-opcodes.inc.h"
|
#include "vm-opcodes.inc.h"
|
||||||
|
|
||||||
|
|||||||
@@ -68,9 +68,9 @@ lit_cp_to_str (lit_cpointer_t cp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
tmp_id_to_str (idx_t id)
|
tmp_id_to_str (vm_idx_t id)
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (id != LITERAL_TO_REWRITE);
|
JERRY_ASSERT (id != VM_IDX_REWRITE_LITERAL_UID);
|
||||||
JERRY_ASSERT (id >= 128);
|
JERRY_ASSERT (id >= 128);
|
||||||
clear_temp_buffer ();
|
clear_temp_buffer ();
|
||||||
strncpy (buff, "tmp", 3);
|
strncpy (buff, "tmp", 3);
|
||||||
@@ -96,7 +96,7 @@ static const char *
|
|||||||
var_to_str (vm_instr_t instr, lit_cpointer_t lit_ids[], vm_instr_counter_t oc, uint8_t current_arg)
|
var_to_str (vm_instr_t instr, lit_cpointer_t lit_ids[], vm_instr_counter_t oc, uint8_t current_arg)
|
||||||
{
|
{
|
||||||
raw_instr raw = *(raw_instr*) &instr;
|
raw_instr raw = *(raw_instr*) &instr;
|
||||||
if (raw.uids[current_arg] == LITERAL_TO_REWRITE)
|
if (raw.uids[current_arg] == VM_IDX_REWRITE_LITERAL_UID)
|
||||||
{
|
{
|
||||||
if (lit_ids == NULL)
|
if (lit_ids == NULL)
|
||||||
{
|
{
|
||||||
@@ -309,7 +309,7 @@ pp_op_meta (const vm_instr_t *instrs_p,
|
|||||||
{
|
{
|
||||||
if (opm.op.data.func_expr_n.arg_list == 0)
|
if (opm.op.data.func_expr_n.arg_list == 0)
|
||||||
{
|
{
|
||||||
if (opm.op.data.func_expr_n.name_lit_idx == INVALID_VALUE)
|
if (opm.op.data.func_expr_n.name_lit_idx == VM_IDX_EMPTY)
|
||||||
{
|
{
|
||||||
printf ("%s = function ();", VAR (1));
|
printf ("%s = function ();", VAR (1));
|
||||||
}
|
}
|
||||||
@@ -416,7 +416,7 @@ pp_op_meta (const vm_instr_t *instrs_p,
|
|||||||
}
|
}
|
||||||
case VM_OP_FUNC_EXPR_N:
|
case VM_OP_FUNC_EXPR_N:
|
||||||
{
|
{
|
||||||
if (start_op.data.func_expr_n.name_lit_idx == INVALID_VALUE)
|
if (start_op.data.func_expr_n.name_lit_idx == VM_IDX_EMPTY)
|
||||||
{
|
{
|
||||||
pp_printf ("%s = function (", start_op, NULL, start, 1);
|
pp_printf ("%s = function (", start_op, NULL, start, 1);
|
||||||
}
|
}
|
||||||
@@ -556,24 +556,25 @@ pp_op_meta (const vm_instr_t *instrs_p,
|
|||||||
}
|
}
|
||||||
case OPCODE_META_TYPE_SCOPE_CODE_FLAGS:
|
case OPCODE_META_TYPE_SCOPE_CODE_FLAGS:
|
||||||
{
|
{
|
||||||
if (opm.op.data.meta.data_1 != INVALID_VALUE)
|
if (opm.op.data.meta.data_1 != VM_IDX_REWRITE_GENERAL_CASE
|
||||||
|
&& opm.op.data.meta.data_1 != VM_IDX_EMPTY)
|
||||||
{
|
{
|
||||||
idx_t scope_flags = opm.op.data.meta.data_1;
|
vm_idx_t scope_flags = opm.op.data.meta.data_1;
|
||||||
|
|
||||||
if (scope_flags & OPCODE_SCOPE_CODE_FLAGS_STRICT)
|
if (scope_flags & OPCODE_SCOPE_CODE_FLAGS_STRICT)
|
||||||
{
|
{
|
||||||
printf ("[use strict] ");
|
printf ("[use strict] ");
|
||||||
scope_flags &= (idx_t) ~(OPCODE_SCOPE_CODE_FLAGS_STRICT);
|
scope_flags &= (vm_idx_t) ~(OPCODE_SCOPE_CODE_FLAGS_STRICT);
|
||||||
}
|
}
|
||||||
if (scope_flags & OPCODE_SCOPE_CODE_FLAGS_NOT_REF_ARGUMENTS_IDENTIFIER)
|
if (scope_flags & OPCODE_SCOPE_CODE_FLAGS_NOT_REF_ARGUMENTS_IDENTIFIER)
|
||||||
{
|
{
|
||||||
printf ("[no 'arguments'] ");
|
printf ("[no 'arguments'] ");
|
||||||
scope_flags &= (idx_t) ~(OPCODE_SCOPE_CODE_FLAGS_NOT_REF_ARGUMENTS_IDENTIFIER);
|
scope_flags &= (vm_idx_t) ~(OPCODE_SCOPE_CODE_FLAGS_NOT_REF_ARGUMENTS_IDENTIFIER);
|
||||||
}
|
}
|
||||||
if (scope_flags & OPCODE_SCOPE_CODE_FLAGS_NOT_REF_EVAL_IDENTIFIER)
|
if (scope_flags & OPCODE_SCOPE_CODE_FLAGS_NOT_REF_EVAL_IDENTIFIER)
|
||||||
{
|
{
|
||||||
printf ("[no 'eval'] ");
|
printf ("[no 'eval'] ");
|
||||||
scope_flags &= (idx_t) ~(OPCODE_SCOPE_CODE_FLAGS_NOT_REF_EVAL_IDENTIFIER);
|
scope_flags &= (vm_idx_t) ~(OPCODE_SCOPE_CODE_FLAGS_NOT_REF_EVAL_IDENTIFIER);
|
||||||
}
|
}
|
||||||
|
|
||||||
JERRY_ASSERT (scope_flags == 0);
|
JERRY_ASSERT (scope_flags == 0);
|
||||||
|
|||||||
@@ -543,9 +543,9 @@ vm_run_from_pos (const vm_instr_t *instrs_p, /**< byte-code array */
|
|||||||
const vm_instr_t *curr = &instrs_p[start_pos];
|
const vm_instr_t *curr = &instrs_p[start_pos];
|
||||||
JERRY_ASSERT (curr->op_idx == VM_OP_REG_VAR_DECL);
|
JERRY_ASSERT (curr->op_idx == VM_OP_REG_VAR_DECL);
|
||||||
|
|
||||||
const idx_t min_reg_idx = curr->data.reg_var_decl.min;
|
const vm_idx_t min_reg_idx = curr->data.reg_var_decl.min;
|
||||||
const idx_t max_reg_idx = curr->data.reg_var_decl.max;
|
const vm_idx_t max_reg_idx = curr->data.reg_var_decl.max;
|
||||||
const idx_t local_var_regs_num = curr->data.reg_var_decl.local_var_regs_num;
|
const vm_idx_t local_var_regs_num = curr->data.reg_var_decl.local_var_regs_num;
|
||||||
JERRY_ASSERT (max_reg_idx >= min_reg_idx);
|
JERRY_ASSERT (max_reg_idx >= min_reg_idx);
|
||||||
|
|
||||||
int32_t regs_num = max_reg_idx - min_reg_idx + 1;
|
int32_t regs_num = max_reg_idx - min_reg_idx + 1;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ instrs_equal (const vm_instr_t *instrs1, vm_instr_t *instrs2, uint16_t size)
|
|||||||
uint16_t i;
|
uint16_t i;
|
||||||
for (i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
if (memcmp (&instrs1[i], &instrs2[i], instr_fields_num[instrs1[i].op_idx] * sizeof (idx_t)) != 0)
|
if (memcmp (&instrs1[i], &instrs2[i], instr_fields_num[instrs1[i].op_idx] * sizeof (vm_idx_t)) != 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -77,8 +77,8 @@ main (int __attr_unused___ argc,
|
|||||||
getop_meta (OPCODE_META_TYPE_SCOPE_CODE_FLAGS, // [ ]
|
getop_meta (OPCODE_META_TYPE_SCOPE_CODE_FLAGS, // [ ]
|
||||||
OPCODE_SCOPE_CODE_FLAGS_NOT_REF_ARGUMENTS_IDENTIFIER
|
OPCODE_SCOPE_CODE_FLAGS_NOT_REF_ARGUMENTS_IDENTIFIER
|
||||||
| OPCODE_SCOPE_CODE_FLAGS_NOT_REF_EVAL_IDENTIFIER,
|
| OPCODE_SCOPE_CODE_FLAGS_NOT_REF_EVAL_IDENTIFIER,
|
||||||
INVALID_VALUE),
|
VM_IDX_EMPTY),
|
||||||
getop_reg_var_decl (OPCODE_REG_FIRST, OPCODE_REG_GENERAL_FIRST, 0),
|
getop_reg_var_decl (VM_REG_FIRST, VM_REG_GENERAL_FIRST, 0),
|
||||||
getop_var_decl (0), // var a;
|
getop_var_decl (0), // var a;
|
||||||
getop_assignment (130, 1, 1), // $tmp0 = 1;
|
getop_assignment (130, 1, 1), // $tmp0 = 1;
|
||||||
getop_assignment (0, 6, 130), // a = $tmp0;
|
getop_assignment (0, 6, 130), // a = $tmp0;
|
||||||
|
|||||||
Reference in New Issue
Block a user