Converting ecma_completion_value_t to class derived from ecma_value_t with additional field with for completion type and related operations.
Completion value are now returned through ecma_completion_value_t &ret_value argument.
This commit is contained in:
@@ -372,24 +372,26 @@ run_int (void)
|
||||
ecma_object_t *lex_env_p = ecma_op_create_global_environment (glob_obj_p);
|
||||
ecma_value_t this_binding_value (glob_obj_p);
|
||||
|
||||
ecma_completion_value_t completion = run_int_from_pos (start_pos,
|
||||
this_binding_value,
|
||||
lex_env_p,
|
||||
is_strict,
|
||||
false);
|
||||
ecma_completion_value_t run_completion;
|
||||
run_int_from_pos (run_completion,
|
||||
start_pos,
|
||||
this_binding_value,
|
||||
lex_env_p,
|
||||
is_strict,
|
||||
false);
|
||||
|
||||
if (ecma_is_completion_value_exit (completion))
|
||||
if (ecma_is_completion_value_exit (run_completion))
|
||||
{
|
||||
ecma_deref_object (glob_obj_p);
|
||||
ecma_deref_object (lex_env_p);
|
||||
ecma_finalize ();
|
||||
|
||||
ecma_value_t value_ret;
|
||||
ecma_get_completion_value_value (value_ret, completion);
|
||||
ecma_get_completion_value_value (value_ret, run_completion);
|
||||
|
||||
return ecma_is_value_true (value_ret);
|
||||
}
|
||||
else if (ecma_is_completion_value_throw (completion))
|
||||
else if (ecma_is_completion_value_throw (run_completion))
|
||||
{
|
||||
jerry_exit (ERR_UNHANDLED_EXCEPTION);
|
||||
}
|
||||
@@ -397,11 +399,10 @@ run_int (void)
|
||||
JERRY_UNREACHABLE ();
|
||||
}
|
||||
|
||||
ecma_completion_value_t
|
||||
run_int_loop (int_data_t *int_data)
|
||||
void
|
||||
run_int_loop (ecma_completion_value_t &completion, /**< out: completion value */
|
||||
int_data_t *int_data /**< interpretation context */)
|
||||
{
|
||||
ecma_completion_value_t completion;
|
||||
|
||||
#ifdef MEM_STATS
|
||||
mem_heap_stats_t heap_stats_before;
|
||||
mem_pools_stats_t pools_stats_before;
|
||||
@@ -424,7 +425,7 @@ run_int_loop (int_data_t *int_data)
|
||||
&pools_stats_before);
|
||||
#endif /* MEM_STATS */
|
||||
|
||||
completion = __opfuncs[curr->op_idx] (*curr, int_data);
|
||||
__opfuncs[curr->op_idx] (completion, *curr, int_data);
|
||||
|
||||
#ifdef MEM_STATS
|
||||
interp_mem_stats_opcode_exit (int_data,
|
||||
@@ -440,22 +441,21 @@ run_int_loop (int_data_t *int_data)
|
||||
|
||||
if (ecma_is_completion_value_meta (completion))
|
||||
{
|
||||
completion = ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (completion);
|
||||
}
|
||||
|
||||
return completion;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ecma_completion_value_t
|
||||
run_int_from_pos (opcode_counter_t start_pos,
|
||||
const ecma_value_t& this_binding_value,
|
||||
ecma_object_t *lex_env_p,
|
||||
bool is_strict,
|
||||
bool is_eval_code)
|
||||
void
|
||||
run_int_from_pos (ecma_completion_value_t &completion, /**< out: completion value */
|
||||
opcode_counter_t start_pos, /**< position to start interpretation at */
|
||||
const ecma_value_t& this_binding_value, /**< value of 'this' binding */
|
||||
ecma_object_t *lex_env_p, /**< starting lexical environment */
|
||||
bool is_strict, /**< is execution mode strict? */
|
||||
bool is_eval_code) /**< is current code executed with eval? */
|
||||
{
|
||||
ecma_completion_value_t completion;
|
||||
|
||||
const opcode_t *curr = &__program[start_pos];
|
||||
JERRY_ASSERT (curr->op_idx == __op__idx_reg_var_decl);
|
||||
|
||||
@@ -482,7 +482,7 @@ run_int_from_pos (opcode_counter_t start_pos,
|
||||
interp_mem_stats_context_enter (&int_data, start_pos);
|
||||
#endif /* MEM_STATS */
|
||||
|
||||
completion = run_int_loop (&int_data);
|
||||
run_int_loop (completion, &int_data);
|
||||
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal (completion)
|
||||
|| ecma_is_completion_value_throw (completion)
|
||||
@@ -498,8 +498,6 @@ run_int_from_pos (opcode_counter_t start_pos,
|
||||
#endif /* MEM_STATS */
|
||||
|
||||
MEM_FINALIZE_LOCAL_ARRAY (regs);
|
||||
|
||||
return completion;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,12 +23,14 @@
|
||||
|
||||
void init_int (const opcode_t* program_p, bool dump_mem_stats);
|
||||
bool run_int (void);
|
||||
ecma_completion_value_t run_int_loop (int_data_t *int_data);
|
||||
ecma_completion_value_t run_int_from_pos (opcode_counter_t start_pos,
|
||||
const ecma_value_t& this_binding_value,
|
||||
ecma_object_t *lex_env_p,
|
||||
bool is_strict,
|
||||
bool is_eval_code);
|
||||
void run_int_loop (ecma_completion_value_t &ret_value,
|
||||
int_data_t *int_data);
|
||||
void run_int_from_pos (ecma_completion_value_t &ret_value,
|
||||
opcode_counter_t start_pos,
|
||||
const ecma_value_t& this_binding_value,
|
||||
ecma_object_t *lex_env_p,
|
||||
bool is_strict,
|
||||
bool is_eval_code);
|
||||
|
||||
opcode_t read_opcode (opcode_counter_t counter);
|
||||
|
||||
|
||||
@@ -23,19 +23,19 @@
|
||||
* current opcode's position changes by adding specified offset
|
||||
* if argument evaluates to true.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_is_true_jmp_down (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_is_true_jmp_down (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t cond_var_idx = opdata.data.is_true_jmp_down.value;
|
||||
const opcode_counter_t offset = calc_opcode_counter_from_idx_idx (opdata.data.is_true_jmp_down.opcode_1,
|
||||
opdata.data.is_true_jmp_down.opcode_2);
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, cond_value, int_data, cond_var_idx, false);
|
||||
|
||||
ECMA_TRY_CATCH (cond_value, get_variable_value (int_data, cond_var_idx, false), ret_value);
|
||||
|
||||
ecma_completion_value_t to_bool_completion = ecma_op_to_boolean (cond_value);
|
||||
ecma_completion_value_t to_bool_completion;
|
||||
ecma_op_to_boolean (to_bool_completion, cond_value);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal (to_bool_completion));
|
||||
|
||||
if (ecma_is_completion_value_normal_true (to_bool_completion))
|
||||
@@ -48,27 +48,25 @@ opfunc_is_true_jmp_down (opcode_t opdata, /**< operation data */
|
||||
int_data->pos++;
|
||||
}
|
||||
|
||||
ret_value = ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
|
||||
ECMA_FINALIZE (cond_value);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
/* Likewise to opfunc_is_true_jmp_down, but jumps up. */
|
||||
ecma_completion_value_t
|
||||
opfunc_is_true_jmp_up (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_is_true_jmp_up (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t cond_var_idx = opdata.data.is_true_jmp_up.value;
|
||||
const opcode_counter_t offset = calc_opcode_counter_from_idx_idx (opdata.data.is_true_jmp_up.opcode_1,
|
||||
opdata.data.is_true_jmp_up.opcode_2);
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, cond_value, int_data, cond_var_idx, false);
|
||||
|
||||
ECMA_TRY_CATCH (cond_value, get_variable_value (int_data, cond_var_idx, false), ret_value);
|
||||
|
||||
ecma_completion_value_t to_bool_completion = ecma_op_to_boolean (cond_value);
|
||||
ecma_completion_value_t to_bool_completion;
|
||||
ecma_op_to_boolean (to_bool_completion, cond_value);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal (to_bool_completion));
|
||||
|
||||
if (ecma_is_completion_value_normal_true (to_bool_completion))
|
||||
@@ -81,11 +79,9 @@ opfunc_is_true_jmp_up (opcode_t opdata, /**< operation data */
|
||||
int_data->pos++;
|
||||
}
|
||||
|
||||
ret_value = ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
|
||||
ECMA_FINALIZE (cond_value);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,19 +91,19 @@ opfunc_is_true_jmp_up (opcode_t opdata, /**< operation data */
|
||||
* current opcode's position changes by adding specified offset
|
||||
* if argument evaluates to false.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_is_false_jmp_down (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_is_false_jmp_down (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t cond_var_idx = opdata.data.is_false_jmp_down.value;
|
||||
const opcode_counter_t offset = calc_opcode_counter_from_idx_idx (opdata.data.is_false_jmp_down.opcode_1,
|
||||
opdata.data.is_false_jmp_down.opcode_2);
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, cond_value, int_data, cond_var_idx, false);
|
||||
|
||||
ECMA_TRY_CATCH (cond_value, get_variable_value (int_data, cond_var_idx, false), ret_value);
|
||||
|
||||
ecma_completion_value_t to_bool_completion = ecma_op_to_boolean (cond_value);
|
||||
ecma_completion_value_t to_bool_completion;
|
||||
ecma_op_to_boolean (to_bool_completion, cond_value);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal (to_bool_completion));
|
||||
|
||||
if (!ecma_is_completion_value_normal_true (to_bool_completion))
|
||||
@@ -120,27 +116,25 @@ opfunc_is_false_jmp_down (opcode_t opdata, /**< operation data */
|
||||
int_data->pos++;
|
||||
}
|
||||
|
||||
ret_value = ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
|
||||
ECMA_FINALIZE (cond_value);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
/* Likewise to opfunc_is_false_jmp_down, but jumps up. */
|
||||
ecma_completion_value_t
|
||||
opfunc_is_false_jmp_up (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_is_false_jmp_up (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t cond_var_idx = opdata.data.is_false_jmp_up.value;
|
||||
const opcode_counter_t offset = calc_opcode_counter_from_idx_idx (opdata.data.is_false_jmp_up.opcode_1,
|
||||
opdata.data.is_false_jmp_up.opcode_2);
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, cond_value, int_data, cond_var_idx, false);
|
||||
|
||||
ECMA_TRY_CATCH (cond_value, get_variable_value (int_data, cond_var_idx, false), ret_value);
|
||||
|
||||
ecma_completion_value_t to_bool_completion = ecma_op_to_boolean (cond_value);
|
||||
ecma_completion_value_t to_bool_completion;
|
||||
ecma_op_to_boolean (to_bool_completion, cond_value);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal (to_bool_completion));
|
||||
|
||||
if (!ecma_is_completion_value_normal_true (to_bool_completion))
|
||||
@@ -153,11 +147,9 @@ opfunc_is_false_jmp_up (opcode_t opdata, /**< operation data */
|
||||
int_data->pos++;
|
||||
}
|
||||
|
||||
ret_value = ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
|
||||
ECMA_FINALIZE (cond_value);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,8 +158,9 @@ opfunc_is_false_jmp_up (opcode_t opdata, /**< operation data */
|
||||
* Note:
|
||||
* the opcode changes adds specified value to current opcode position
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_jmp_down (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_jmp_down (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const opcode_counter_t offset = calc_opcode_counter_from_idx_idx (opdata.data.jmp_down.opcode_1,
|
||||
@@ -177,7 +170,7 @@ opfunc_jmp_down (opcode_t opdata, /**< operation data */
|
||||
|
||||
int_data->pos = (opcode_counter_t) (int_data->pos + offset);
|
||||
|
||||
return ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,8 +179,9 @@ opfunc_jmp_down (opcode_t opdata, /**< operation data */
|
||||
* Note:
|
||||
* the opcode changes substracts specified value from current opcode position
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_jmp_up (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_jmp_up (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const opcode_counter_t offset = calc_opcode_counter_from_idx_idx (opdata.data.jmp_up.opcode_1,
|
||||
@@ -196,5 +190,5 @@ opfunc_jmp_up (opcode_t opdata, /**< operation data */
|
||||
|
||||
int_data->pos = (opcode_counter_t) (int_data->pos - offset);
|
||||
|
||||
return ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
}
|
||||
|
||||
@@ -41,15 +41,14 @@ typedef enum
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
do_number_arithmetic (int_data_t *int_data, /**< interpreter context */
|
||||
static void
|
||||
do_number_arithmetic (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
int_data_t *int_data, /**< interpreter context */
|
||||
idx_t dst_var_idx, /**< destination variable identifier */
|
||||
number_arithmetic_op op, /**< number arithmetic operation */
|
||||
const ecma_value_t& left_value, /**< left value */
|
||||
const ecma_value_t& right_value) /** right value */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (num_left, left_value, ret_value);
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (num_right, right_value, ret_value);
|
||||
|
||||
@@ -84,14 +83,13 @@ do_number_arithmetic (int_data_t *int_data, /**< interpreter context */
|
||||
}
|
||||
}
|
||||
|
||||
ret_value = set_variable_value (int_data, int_data->pos,
|
||||
dst_var_idx,
|
||||
ecma_value_t (res_p));
|
||||
set_variable_value (ret_value,
|
||||
int_data, int_data->pos,
|
||||
dst_var_idx,
|
||||
ecma_value_t (res_p));
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (num_right);
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (num_left);
|
||||
|
||||
return ret_value;
|
||||
} /* do_number_arithmetic */
|
||||
|
||||
/**
|
||||
@@ -102,39 +100,32 @@ do_number_arithmetic (int_data_t *int_data, /**< interpreter context */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_addition (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_addition (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.addition.dst;
|
||||
const idx_t left_var_idx = opdata.data.addition.var_left;
|
||||
const idx_t right_var_idx = opdata.data.addition.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (prim_left_value,
|
||||
ecma_op_to_primitive (left_value,
|
||||
ECMA_PREFERRED_TYPE_NO),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (prim_right_value,
|
||||
ecma_op_to_primitive (right_value,
|
||||
ECMA_PREFERRED_TYPE_NO),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_primitive, prim_left_value, left_value, ECMA_PREFERRED_TYPE_NO);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_primitive, prim_right_value, right_value, ECMA_PREFERRED_TYPE_NO);
|
||||
|
||||
if (ecma_is_value_string (prim_left_value)
|
||||
|| ecma_is_value_string (prim_right_value))
|
||||
{
|
||||
ECMA_TRY_CATCH (str_left_value, ecma_op_to_string (prim_left_value), ret_value);
|
||||
ECMA_TRY_CATCH (str_right_value, ecma_op_to_string (prim_right_value), ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, str_left_value, prim_left_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, str_right_value, prim_right_value);
|
||||
|
||||
ecma_string_t *string1_p = ecma_get_string_from_value (str_left_value);
|
||||
ecma_string_t *string2_p = ecma_get_string_from_value (str_right_value);
|
||||
|
||||
ecma_string_t *concat_str_p = ecma_concat_ecma_strings (string1_p, string2_p);
|
||||
|
||||
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx, ecma_value_t (concat_str_p));
|
||||
set_variable_value (ret_value, int_data, int_data->pos, dst_var_idx, ecma_value_t (concat_str_p));
|
||||
|
||||
ecma_deref_ecma_string (concat_str_p);
|
||||
|
||||
@@ -143,11 +134,12 @@ opfunc_addition (opcode_t opdata, /**< operation data */
|
||||
}
|
||||
else
|
||||
{
|
||||
ret_value = do_number_arithmetic (int_data,
|
||||
dst_var_idx,
|
||||
number_arithmetic_addition,
|
||||
prim_left_value,
|
||||
prim_right_value);
|
||||
do_number_arithmetic (ret_value,
|
||||
int_data,
|
||||
dst_var_idx,
|
||||
number_arithmetic_addition,
|
||||
prim_left_value,
|
||||
prim_right_value);
|
||||
}
|
||||
|
||||
ECMA_FINALIZE (prim_right_value);
|
||||
@@ -156,8 +148,6 @@ opfunc_addition (opcode_t opdata, /**< operation data */
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_addition */
|
||||
|
||||
/**
|
||||
@@ -168,31 +158,29 @@ opfunc_addition (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_substraction (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_substraction (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.substraction.dst;
|
||||
const idx_t left_var_idx = opdata.data.substraction.var_left;
|
||||
const idx_t right_var_idx = opdata.data.substraction.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
|
||||
ret_value = do_number_arithmetic (int_data,
|
||||
dst_var_idx,
|
||||
number_arithmetic_substraction,
|
||||
left_value,
|
||||
right_value);
|
||||
do_number_arithmetic (ret_value,
|
||||
int_data,
|
||||
dst_var_idx,
|
||||
number_arithmetic_substraction,
|
||||
left_value,
|
||||
right_value);
|
||||
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_substraction */
|
||||
|
||||
/**
|
||||
@@ -203,31 +191,29 @@ opfunc_substraction (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_multiplication (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_multiplication (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.multiplication.dst;
|
||||
const idx_t left_var_idx = opdata.data.multiplication.var_left;
|
||||
const idx_t right_var_idx = opdata.data.multiplication.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
|
||||
ret_value = do_number_arithmetic (int_data,
|
||||
dst_var_idx,
|
||||
number_arithmetic_multiplication,
|
||||
left_value,
|
||||
right_value);
|
||||
do_number_arithmetic (ret_value,
|
||||
int_data,
|
||||
dst_var_idx,
|
||||
number_arithmetic_multiplication,
|
||||
left_value,
|
||||
right_value);
|
||||
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_multiplication */
|
||||
|
||||
/**
|
||||
@@ -238,31 +224,29 @@ opfunc_multiplication (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_division (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_division (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.division.dst;
|
||||
const idx_t left_var_idx = opdata.data.division.var_left;
|
||||
const idx_t right_var_idx = opdata.data.division.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
|
||||
ret_value = do_number_arithmetic (int_data,
|
||||
dst_var_idx,
|
||||
number_arithmetic_division,
|
||||
left_value,
|
||||
right_value);
|
||||
do_number_arithmetic (ret_value,
|
||||
int_data,
|
||||
dst_var_idx,
|
||||
number_arithmetic_division,
|
||||
left_value,
|
||||
right_value);
|
||||
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_division */
|
||||
|
||||
/**
|
||||
@@ -273,31 +257,29 @@ opfunc_division (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_remainder (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_remainder (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.remainder.dst;
|
||||
const idx_t left_var_idx = opdata.data.remainder.var_left;
|
||||
const idx_t right_var_idx = opdata.data.remainder.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
|
||||
ret_value = do_number_arithmetic (int_data,
|
||||
dst_var_idx,
|
||||
number_arithmetic_remainder,
|
||||
left_value,
|
||||
right_value);
|
||||
do_number_arithmetic (ret_value,
|
||||
int_data,
|
||||
dst_var_idx,
|
||||
number_arithmetic_remainder,
|
||||
left_value,
|
||||
right_value);
|
||||
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_remainder */
|
||||
|
||||
/**
|
||||
@@ -308,16 +290,15 @@ opfunc_remainder (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_unary_plus (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_unary_plus (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.remainder.dst;
|
||||
const idx_t var_idx = opdata.data.remainder.var_left;
|
||||
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
ECMA_TRY_CATCH (var_value, get_variable_value (int_data, var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, var_value, int_data, var_idx, false);
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (num_var_value,
|
||||
var_value,
|
||||
ret_value);
|
||||
@@ -325,16 +306,12 @@ opfunc_unary_plus (opcode_t opdata, /**< operation data */
|
||||
ecma_number_t *tmp_p = int_data->tmp_num_p;
|
||||
|
||||
*tmp_p = num_var_value;
|
||||
ret_value = set_variable_value (int_data, int_data->pos,
|
||||
dst_var_idx,
|
||||
ecma_value_t (tmp_p));
|
||||
set_variable_value (ret_value, int_data, int_data->pos, dst_var_idx, ecma_value_t (tmp_p));
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (num_var_value);
|
||||
ECMA_FINALIZE (var_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_unary_plus */
|
||||
|
||||
/**
|
||||
@@ -345,16 +322,15 @@ opfunc_unary_plus (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_unary_minus (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_unary_minus (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.remainder.dst;
|
||||
const idx_t var_idx = opdata.data.remainder.var_left;
|
||||
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
ECMA_TRY_CATCH (var_value, get_variable_value (int_data, var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, var_value, int_data, var_idx, false);
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (num_var_value,
|
||||
var_value,
|
||||
ret_value);
|
||||
@@ -362,14 +338,10 @@ opfunc_unary_minus (opcode_t opdata, /**< operation data */
|
||||
ecma_number_t *tmp_p = int_data->tmp_num_p;
|
||||
|
||||
*tmp_p = ecma_number_negate (num_var_value);
|
||||
ret_value = set_variable_value (int_data, int_data->pos,
|
||||
dst_var_idx,
|
||||
ecma_value_t (tmp_p));
|
||||
set_variable_value (ret_value, int_data, int_data->pos, dst_var_idx, ecma_value_t (tmp_p));
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (num_var_value);
|
||||
ECMA_FINALIZE (var_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_unary_minus */
|
||||
|
||||
@@ -41,15 +41,14 @@ typedef enum
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
do_number_bitwise_logic (int_data_t *int_data, /**< interpreter context */
|
||||
static void
|
||||
do_number_bitwise_logic (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
int_data_t *int_data, /**< interpreter context */
|
||||
idx_t dst_var_idx, /**< destination variable identifier */
|
||||
number_bitwise_logic_op op, /**< number bitwise logic operation */
|
||||
const ecma_value_t& left_value, /**< left value */
|
||||
const ecma_value_t& right_value) /** right value */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (num_left, left_value, ret_value);
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (num_right, right_value, ret_value);
|
||||
|
||||
@@ -100,14 +99,10 @@ do_number_bitwise_logic (int_data_t *int_data, /**< interpreter context */
|
||||
}
|
||||
}
|
||||
|
||||
ret_value = set_variable_value (int_data, int_data->pos,
|
||||
dst_var_idx,
|
||||
ecma_value_t (res_p));
|
||||
set_variable_value (ret_value, int_data, int_data->pos, dst_var_idx, ecma_value_t (res_p));
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (num_right);
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (num_left);
|
||||
|
||||
return ret_value;
|
||||
} /* do_number_bitwise_logic */
|
||||
|
||||
/**
|
||||
@@ -118,31 +113,29 @@ do_number_bitwise_logic (int_data_t *int_data, /**< interpreter context */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_b_and (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_b_and (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.b_and.dst;
|
||||
const idx_t left_var_idx = opdata.data.b_and.var_left;
|
||||
const idx_t right_var_idx = opdata.data.b_and.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
|
||||
ret_value = do_number_bitwise_logic (int_data,
|
||||
dst_var_idx,
|
||||
number_bitwise_logic_and,
|
||||
left_value,
|
||||
right_value);
|
||||
do_number_bitwise_logic (ret_value,
|
||||
int_data,
|
||||
dst_var_idx,
|
||||
number_bitwise_logic_and,
|
||||
left_value,
|
||||
right_value);
|
||||
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_b_and */
|
||||
|
||||
/**
|
||||
@@ -153,31 +146,29 @@ opfunc_b_and (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_b_or (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_b_or (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.b_or.dst;
|
||||
const idx_t left_var_idx = opdata.data.b_or.var_left;
|
||||
const idx_t right_var_idx = opdata.data.b_or.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
|
||||
ret_value = do_number_bitwise_logic (int_data,
|
||||
dst_var_idx,
|
||||
number_bitwise_logic_or,
|
||||
left_value,
|
||||
right_value);
|
||||
do_number_bitwise_logic (ret_value,
|
||||
int_data,
|
||||
dst_var_idx,
|
||||
number_bitwise_logic_or,
|
||||
left_value,
|
||||
right_value);
|
||||
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_b_or */
|
||||
|
||||
/**
|
||||
@@ -188,31 +179,29 @@ opfunc_b_or (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_b_xor (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_b_xor (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.b_xor.dst;
|
||||
const idx_t left_var_idx = opdata.data.b_xor.var_left;
|
||||
const idx_t right_var_idx = opdata.data.b_xor.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
|
||||
ret_value = do_number_bitwise_logic (int_data,
|
||||
dst_var_idx,
|
||||
number_bitwise_logic_xor,
|
||||
left_value,
|
||||
right_value);
|
||||
do_number_bitwise_logic (ret_value,
|
||||
int_data,
|
||||
dst_var_idx,
|
||||
number_bitwise_logic_xor,
|
||||
left_value,
|
||||
right_value);
|
||||
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_b_xor */
|
||||
|
||||
/**
|
||||
@@ -223,31 +212,29 @@ opfunc_b_xor (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_b_shift_left (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_b_shift_left (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.b_shift_left.dst;
|
||||
const idx_t left_var_idx = opdata.data.b_shift_left.var_left;
|
||||
const idx_t right_var_idx = opdata.data.b_shift_left.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
|
||||
ret_value = do_number_bitwise_logic (int_data,
|
||||
dst_var_idx,
|
||||
number_bitwise_shift_left,
|
||||
left_value,
|
||||
right_value);
|
||||
do_number_bitwise_logic (ret_value,
|
||||
int_data,
|
||||
dst_var_idx,
|
||||
number_bitwise_shift_left,
|
||||
left_value,
|
||||
right_value);
|
||||
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_b_shift_left */
|
||||
|
||||
/**
|
||||
@@ -258,31 +245,29 @@ opfunc_b_shift_left (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_b_shift_right (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_b_shift_right (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.b_shift_right.dst;
|
||||
const idx_t left_var_idx = opdata.data.b_shift_right.var_left;
|
||||
const idx_t right_var_idx = opdata.data.b_shift_right.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
|
||||
ret_value = do_number_bitwise_logic (int_data,
|
||||
dst_var_idx,
|
||||
number_bitwise_shift_right,
|
||||
left_value,
|
||||
right_value);
|
||||
do_number_bitwise_logic (ret_value,
|
||||
int_data,
|
||||
dst_var_idx,
|
||||
number_bitwise_shift_right,
|
||||
left_value,
|
||||
right_value);
|
||||
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_b_shift_right */
|
||||
|
||||
/**
|
||||
@@ -293,31 +278,29 @@ opfunc_b_shift_right (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_b_shift_uright (opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
void
|
||||
opfunc_b_shift_uright (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.b_shift_uright.dst;
|
||||
const idx_t left_var_idx = opdata.data.b_shift_uright.var_left;
|
||||
const idx_t right_var_idx = opdata.data.b_shift_uright.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
|
||||
ret_value = do_number_bitwise_logic (int_data,
|
||||
dst_var_idx,
|
||||
number_bitwise_shift_uright,
|
||||
left_value,
|
||||
right_value);
|
||||
do_number_bitwise_logic (ret_value,
|
||||
int_data,
|
||||
dst_var_idx,
|
||||
number_bitwise_shift_uright,
|
||||
left_value,
|
||||
right_value);
|
||||
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_b_shift_uright */
|
||||
|
||||
/**
|
||||
@@ -328,26 +311,24 @@ opfunc_b_shift_uright (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_b_not (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_b_not (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.b_not.dst;
|
||||
const idx_t right_var_idx = opdata.data.b_not.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
|
||||
ret_value = do_number_bitwise_logic (int_data,
|
||||
dst_var_idx,
|
||||
number_bitwise_not,
|
||||
right_value,
|
||||
right_value);
|
||||
do_number_bitwise_logic (ret_value,
|
||||
int_data,
|
||||
dst_var_idx,
|
||||
number_bitwise_not,
|
||||
right_value,
|
||||
right_value);
|
||||
|
||||
ECMA_FINALIZE (right_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_b_not */
|
||||
|
||||
@@ -24,35 +24,28 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_equal_value (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_equal_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.equal_value.dst;
|
||||
const idx_t left_var_idx = opdata.data.equal_value.var_left;
|
||||
const idx_t right_var_idx = opdata.data.equal_value.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (compare_result,
|
||||
ecma_op_abstract_equality_compare (left_value,
|
||||
right_value),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_abstract_equality_compare, compare_result, left_value, right_value);
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_boolean (compare_result));
|
||||
|
||||
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx,
|
||||
compare_result);
|
||||
set_variable_value (ret_value, int_data, int_data->pos, dst_var_idx, compare_result);
|
||||
|
||||
ECMA_FINALIZE (compare_result);
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_equal_value */
|
||||
|
||||
/**
|
||||
@@ -63,37 +56,32 @@ opfunc_equal_value (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_not_equal_value (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_not_equal_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.not_equal_value.dst;
|
||||
const idx_t left_var_idx = opdata.data.not_equal_value.var_left;
|
||||
const idx_t right_var_idx = opdata.data.not_equal_value.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (compare_result,
|
||||
ecma_op_abstract_equality_compare (left_value, right_value),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_abstract_equality_compare, compare_result, left_value, right_value);
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_boolean (compare_result));
|
||||
|
||||
bool is_equal = ecma_is_value_true (compare_result);
|
||||
|
||||
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx,
|
||||
ecma_value_t (is_equal ? ECMA_SIMPLE_VALUE_FALSE
|
||||
: ECMA_SIMPLE_VALUE_TRUE));
|
||||
set_variable_value (ret_value, int_data, int_data->pos, dst_var_idx,
|
||||
ecma_value_t (is_equal ? ECMA_SIMPLE_VALUE_FALSE
|
||||
: ECMA_SIMPLE_VALUE_TRUE));
|
||||
|
||||
ECMA_FINALIZE (compare_result);
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_not_equal_value */
|
||||
|
||||
/**
|
||||
@@ -104,31 +92,28 @@ opfunc_not_equal_value (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_equal_value_type (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_equal_value_type (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.equal_value_type.dst;
|
||||
const idx_t left_var_idx = opdata.data.equal_value_type.var_left;
|
||||
const idx_t right_var_idx = opdata.data.equal_value_type.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
|
||||
bool is_equal = ecma_op_strict_equality_compare (left_value, right_value);
|
||||
|
||||
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx,
|
||||
ecma_value_t (is_equal ? ECMA_SIMPLE_VALUE_TRUE
|
||||
: ECMA_SIMPLE_VALUE_FALSE));
|
||||
set_variable_value (ret_value, int_data, int_data->pos, dst_var_idx,
|
||||
ecma_value_t (is_equal ? ECMA_SIMPLE_VALUE_TRUE
|
||||
: ECMA_SIMPLE_VALUE_FALSE));
|
||||
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_equal_value_type */
|
||||
|
||||
/**
|
||||
@@ -139,30 +124,27 @@ opfunc_equal_value_type (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_not_equal_value_type (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_not_equal_value_type (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.not_equal_value_type.dst;
|
||||
const idx_t left_var_idx = opdata.data.not_equal_value_type.var_left;
|
||||
const idx_t right_var_idx = opdata.data.not_equal_value_type.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
|
||||
bool is_equal = ecma_op_strict_equality_compare (left_value, right_value);
|
||||
|
||||
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx,
|
||||
ecma_value_t (is_equal ? ECMA_SIMPLE_VALUE_FALSE
|
||||
: ECMA_SIMPLE_VALUE_TRUE));
|
||||
set_variable_value (ret_value, int_data, int_data->pos, dst_var_idx,
|
||||
ecma_value_t (is_equal ? ECMA_SIMPLE_VALUE_FALSE
|
||||
: ECMA_SIMPLE_VALUE_TRUE));
|
||||
|
||||
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_not_equal_value_type */
|
||||
|
||||
@@ -24,21 +24,18 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_less_than (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_less_than (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.less_than.dst;
|
||||
const idx_t left_var_idx = opdata.data.less_than.var_left;
|
||||
const idx_t right_var_idx = opdata.data.less_than.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (compare_result,
|
||||
ecma_op_abstract_relational_compare (left_value, right_value, true),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_abstract_relational_compare, compare_result, left_value, right_value, true);
|
||||
|
||||
ecma_simple_value_t res;
|
||||
|
||||
@@ -53,15 +50,13 @@ opfunc_less_than (opcode_t opdata, /**< operation data */
|
||||
res = (ecma_is_value_true (compare_result) ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
}
|
||||
|
||||
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx, ecma_value_t (res));
|
||||
set_variable_value (ret_value, int_data, int_data->pos, dst_var_idx, ecma_value_t (res));
|
||||
|
||||
ECMA_FINALIZE (compare_result);
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_less_than */
|
||||
|
||||
/**
|
||||
@@ -72,21 +67,18 @@ opfunc_less_than (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_greater_than (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_greater_than (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.greater_than.dst;
|
||||
const idx_t left_var_idx = opdata.data.greater_than.var_left;
|
||||
const idx_t right_var_idx = opdata.data.greater_than.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (compare_result,
|
||||
ecma_op_abstract_relational_compare (right_value, left_value, false),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_abstract_relational_compare, compare_result, right_value, left_value, false);
|
||||
|
||||
ecma_simple_value_t res;
|
||||
|
||||
@@ -101,15 +93,13 @@ opfunc_greater_than (opcode_t opdata, /**< operation data */
|
||||
res = (ecma_is_value_true (compare_result) ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
}
|
||||
|
||||
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx, ecma_value_t (res));
|
||||
set_variable_value (ret_value, int_data, int_data->pos, dst_var_idx, ecma_value_t (res));
|
||||
|
||||
ECMA_FINALIZE (compare_result);
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_greater_than */
|
||||
|
||||
/**
|
||||
@@ -120,21 +110,18 @@ opfunc_greater_than (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_less_or_equal_than (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_less_or_equal_than (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.less_or_equal_than.dst;
|
||||
const idx_t left_var_idx = opdata.data.less_or_equal_than.var_left;
|
||||
const idx_t right_var_idx = opdata.data.less_or_equal_than.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (compare_result,
|
||||
ecma_op_abstract_relational_compare (right_value, left_value, false),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_abstract_relational_compare, compare_result, right_value, left_value, false);
|
||||
|
||||
ecma_simple_value_t res;
|
||||
|
||||
@@ -156,15 +143,13 @@ opfunc_less_or_equal_than (opcode_t opdata, /**< operation data */
|
||||
}
|
||||
}
|
||||
|
||||
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx, ecma_value_t (res));
|
||||
set_variable_value (ret_value, int_data, int_data->pos, dst_var_idx, ecma_value_t (res));
|
||||
|
||||
ECMA_FINALIZE (compare_result);
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_less_or_equal_than */
|
||||
|
||||
/**
|
||||
@@ -175,21 +160,18 @@ opfunc_less_or_equal_than (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_greater_or_equal_than (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_greater_or_equal_than (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx = opdata.data.greater_or_equal_than.dst;
|
||||
const idx_t left_var_idx = opdata.data.greater_or_equal_than.var_left;
|
||||
const idx_t right_var_idx = opdata.data.greater_or_equal_than.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (compare_result,
|
||||
ecma_op_abstract_relational_compare (left_value, right_value, true),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_abstract_relational_compare, compare_result, left_value, right_value, true);
|
||||
|
||||
ecma_simple_value_t res;
|
||||
|
||||
@@ -211,15 +193,13 @@ opfunc_greater_or_equal_than (opcode_t opdata, /**< operation data */
|
||||
}
|
||||
}
|
||||
|
||||
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx, ecma_value_t (res));
|
||||
set_variable_value (ret_value, int_data, int_data->pos, dst_var_idx, ecma_value_t (res));
|
||||
|
||||
ECMA_FINALIZE (compare_result);
|
||||
ECMA_FINALIZE (right_value);
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_greater_or_equal_than */
|
||||
|
||||
/**
|
||||
@@ -230,32 +210,29 @@ opfunc_greater_or_equal_than (opcode_t opdata, /**< operation data */
|
||||
* @return completion value
|
||||
* returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_instanceof (opcode_t opdata __unused, /**< operation data */
|
||||
void
|
||||
opfunc_instanceof (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata __unused, /**< operation data */
|
||||
int_data_t *int_data __unused) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_idx = opdata.data.instanceof.dst;
|
||||
const idx_t left_var_idx = opdata.data.instanceof.var_left;
|
||||
const idx_t right_var_idx = opdata.data.instanceof.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
|
||||
if (!ecma_is_value_object (right_value))
|
||||
{
|
||||
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *right_value_obj_p = ecma_get_object_from_value (right_value);
|
||||
|
||||
ECMA_TRY_CATCH (is_instance_of,
|
||||
ecma_op_object_has_instance (right_value_obj_p, left_value),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_object_has_instance, is_instance_of, right_value_obj_p, left_value);
|
||||
|
||||
ret_value = set_variable_value (int_data, int_data->pos, dst_idx, is_instance_of);
|
||||
set_variable_value (ret_value, int_data, int_data->pos, dst_idx, is_instance_of);
|
||||
|
||||
ECMA_FINALIZE (is_instance_of);
|
||||
}
|
||||
@@ -264,8 +241,6 @@ opfunc_instanceof (opcode_t opdata __unused, /**< operation data */
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_instanceof */
|
||||
|
||||
/**
|
||||
@@ -276,26 +251,25 @@ opfunc_instanceof (opcode_t opdata __unused, /**< operation data */
|
||||
* @return completion value
|
||||
* returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_in (opcode_t opdata __unused, /**< operation data */
|
||||
void
|
||||
opfunc_in (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata __unused, /**< operation data */
|
||||
int_data_t *int_data __unused) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_idx = opdata.data.in.dst;
|
||||
const idx_t left_var_idx = opdata.data.in.var_left;
|
||||
const idx_t right_var_idx = opdata.data.in.var_right;
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, left_value, int_data, left_var_idx, false);
|
||||
ECMA_TRY_CATCH (ret_value, get_variable_value, right_value, int_data, right_var_idx, false);
|
||||
|
||||
if (!ecma_is_value_object (right_value))
|
||||
{
|
||||
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
else
|
||||
{
|
||||
ECMA_TRY_CATCH (str_left_value, ecma_op_to_string (left_value), ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, str_left_value, left_value);
|
||||
|
||||
ecma_simple_value_t is_in = ECMA_SIMPLE_VALUE_UNDEFINED;
|
||||
ecma_string_t *left_value_prop_name_p = ecma_get_string_from_value (str_left_value);
|
||||
@@ -310,9 +284,8 @@ opfunc_in (opcode_t opdata __unused, /**< operation data */
|
||||
is_in = ECMA_SIMPLE_VALUE_FALSE;
|
||||
}
|
||||
|
||||
ret_value = set_variable_value (int_data, int_data->pos,
|
||||
dst_idx,
|
||||
ecma_value_t (is_in));
|
||||
set_variable_value (ret_value, int_data, int_data->pos,
|
||||
dst_idx, ecma_value_t (is_in));
|
||||
|
||||
ECMA_FINALIZE (str_left_value);
|
||||
}
|
||||
@@ -321,6 +294,4 @@ opfunc_in (opcode_t opdata __unused, /**< operation data */
|
||||
ECMA_FINALIZE (left_value);
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_in */
|
||||
|
||||
@@ -34,14 +34,28 @@
|
||||
#include "ecma-value.h"
|
||||
#include "deserializer.h"
|
||||
|
||||
bool is_reg_variable (int_data_t *int_data, idx_t var_idx);
|
||||
ecma_completion_value_t get_variable_value (int_data_t *, idx_t, bool);
|
||||
ecma_completion_value_t set_variable_value (int_data_t *, opcode_counter_t, idx_t, const ecma_value_t&);
|
||||
ecma_completion_value_t fill_varg_list (int_data_t *int_data,
|
||||
ecma_length_t args_number,
|
||||
ecma_value_t args_values[],
|
||||
ecma_length_t *out_arg_number_p);
|
||||
void fill_params_list (int_data_t *int_data,
|
||||
ecma_length_t params_number,
|
||||
ecma_string_t* params_names[]);
|
||||
bool
|
||||
is_reg_variable (int_data_t *int_data,
|
||||
idx_t var_idx);
|
||||
void
|
||||
get_variable_value (ecma_completion_value_t &ret_value,
|
||||
int_data_t *,
|
||||
idx_t,
|
||||
bool);
|
||||
void
|
||||
set_variable_value (ecma_completion_value_t &ret_value,
|
||||
int_data_t *,
|
||||
opcode_counter_t,
|
||||
idx_t,
|
||||
const ecma_value_t&);
|
||||
void
|
||||
fill_varg_list (ecma_completion_value_t &ret_value,
|
||||
int_data_t *int_data,
|
||||
ecma_length_t args_number,
|
||||
ecma_value_t args_values[],
|
||||
ecma_length_t *out_arg_number_p);
|
||||
void
|
||||
fill_params_list (int_data_t *int_data,
|
||||
ecma_length_t params_number,
|
||||
ecma_string_t* params_names[]);
|
||||
#endif /* OPCODES_ECMA_SUPPORT_H */
|
||||
|
||||
@@ -26,8 +26,9 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_try_block (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_try_block (ecma_completion_value_t &try_completion, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
const idx_t block_end_oc_idx_1 = opdata.data.try_block.oc_idx_1;
|
||||
@@ -37,7 +38,8 @@ opfunc_try_block (opcode_t opdata, /**< operation data */
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
ecma_completion_value_t try_completion = run_int_loop (int_data);
|
||||
run_int_loop (try_completion, int_data);
|
||||
|
||||
JERRY_ASSERT ((!ecma_is_completion_value_empty (try_completion) && int_data->pos <= try_end_oc)
|
||||
|| (ecma_is_completion_value_empty (try_completion) && int_data->pos == try_end_oc));
|
||||
int_data->pos = try_end_oc;
|
||||
@@ -47,7 +49,7 @@ opfunc_try_block (opcode_t opdata, /**< operation data */
|
||||
|
||||
if (ecma_is_completion_value_exit (try_completion))
|
||||
{
|
||||
return try_completion;
|
||||
return;
|
||||
}
|
||||
|
||||
if (next_opcode.data.meta.type == OPCODE_META_TYPE_CATCH)
|
||||
@@ -70,18 +72,22 @@ opfunc_try_block (opcode_t opdata, /**< operation data */
|
||||
|
||||
ecma_object_t *old_env_p = int_data->lex_env_p;
|
||||
ecma_object_t *catch_env_p = ecma_create_decl_lex_env (old_env_p);
|
||||
ecma_completion_value_t completion = ecma_op_create_mutable_binding (catch_env_p,
|
||||
catch_exc_var_name_str_p,
|
||||
false);
|
||||
|
||||
ecma_completion_value_t completion;
|
||||
ecma_op_create_mutable_binding (completion,
|
||||
catch_env_p,
|
||||
catch_exc_var_name_str_p,
|
||||
false);
|
||||
JERRY_ASSERT (ecma_is_completion_value_empty (completion));
|
||||
|
||||
ecma_value_t catched_exc_value;
|
||||
ecma_get_completion_value_value (catched_exc_value, try_completion);
|
||||
|
||||
completion = ecma_op_set_mutable_binding (catch_env_p,
|
||||
catch_exc_var_name_str_p,
|
||||
catched_exc_value,
|
||||
false);
|
||||
ecma_op_set_mutable_binding (completion,
|
||||
catch_env_p,
|
||||
catch_exc_var_name_str_p,
|
||||
catched_exc_value,
|
||||
false);
|
||||
JERRY_ASSERT (ecma_is_completion_value_empty (completion));
|
||||
|
||||
ecma_deref_ecma_string (catch_exc_var_name_str_p);
|
||||
@@ -89,7 +95,7 @@ opfunc_try_block (opcode_t opdata, /**< operation data */
|
||||
int_data->lex_env_p = catch_env_p;
|
||||
|
||||
ecma_free_completion_value (try_completion);
|
||||
try_completion = run_int_loop (int_data);
|
||||
run_int_loop (try_completion, int_data);
|
||||
|
||||
int_data->lex_env_p = old_env_p;
|
||||
|
||||
@@ -107,7 +113,7 @@ opfunc_try_block (opcode_t opdata, /**< operation data */
|
||||
|
||||
if (ecma_is_completion_value_exit (try_completion))
|
||||
{
|
||||
return try_completion;
|
||||
return;
|
||||
}
|
||||
|
||||
if (next_opcode.data.meta.type == OPCODE_META_TYPE_FINALLY)
|
||||
@@ -116,7 +122,8 @@ opfunc_try_block (opcode_t opdata, /**< operation data */
|
||||
read_meta_opcode_counter (OPCODE_META_TYPE_FINALLY, int_data) + int_data->pos);
|
||||
int_data->pos++;
|
||||
|
||||
ecma_completion_value_t finally_completion = run_int_loop (int_data);
|
||||
ecma_completion_value_t finally_completion;
|
||||
run_int_loop (finally_completion, int_data);
|
||||
JERRY_ASSERT ((!ecma_is_completion_value_empty (finally_completion) && int_data->pos <= finally_end_oc)
|
||||
|| (ecma_is_completion_value_empty (finally_completion) && int_data->pos == finally_end_oc));
|
||||
int_data->pos = finally_end_oc;
|
||||
@@ -131,6 +138,4 @@ opfunc_try_block (opcode_t opdata, /**< operation data */
|
||||
next_opcode = read_opcode (int_data->pos++);
|
||||
JERRY_ASSERT (next_opcode.op_idx == __op__idx_meta);
|
||||
JERRY_ASSERT (next_opcode.data.meta.type == OPCODE_META_TYPE_END_TRY_CATCH_FINALLY);
|
||||
|
||||
return try_completion;
|
||||
} /* opfunc_try_block */
|
||||
|
||||
@@ -71,14 +71,13 @@ is_reg_variable (int_data_t *int_data, /**< interpreter context */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
get_variable_value (int_data_t *int_data, /**< interpreter context */
|
||||
void
|
||||
get_variable_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
int_data_t *int_data, /**< interpreter context */
|
||||
idx_t var_idx, /**< variable identifier */
|
||||
bool do_eval_or_arguments_check) /** run 'strict eval or arguments reference' check
|
||||
See also: do_strict_eval_arguments_check */
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
if (is_reg_variable (int_data, var_idx))
|
||||
{
|
||||
ecma_value_t reg_value;
|
||||
@@ -91,7 +90,7 @@ get_variable_value (int_data_t *int_data, /**< interpreter context */
|
||||
ecma_value_t value_copy;
|
||||
ecma_copy_value (value_copy, reg_value, true);
|
||||
|
||||
ret_value = ecma_make_normal_completion_value (value_copy);
|
||||
ecma_make_normal_completion_value (ret_value, value_copy);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -112,14 +111,13 @@ get_variable_value (int_data_t *int_data, /**< interpreter context */
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
}
|
||||
|
||||
ret_value = ecma_op_get_value_lex_env_base (ref_base_lex_env_p,
|
||||
&var_name_string,
|
||||
int_data->is_strict);
|
||||
ecma_op_get_value_lex_env_base (ret_value,
|
||||
ref_base_lex_env_p,
|
||||
&var_name_string,
|
||||
int_data->is_strict);
|
||||
|
||||
ecma_check_that_ecma_string_need_not_be_freed (&var_name_string);
|
||||
}
|
||||
|
||||
return ret_value;
|
||||
} /* get_variable_value */
|
||||
|
||||
/**
|
||||
@@ -128,18 +126,17 @@ get_variable_value (int_data_t *int_data, /**< interpreter context */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
set_variable_value (int_data_t *int_data, /**< interpreter context */
|
||||
void
|
||||
set_variable_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
int_data_t *int_data, /**< interpreter context */
|
||||
opcode_counter_t lit_oc, /**< opcode counter for literal */
|
||||
idx_t var_idx, /**< variable identifier */
|
||||
const ecma_value_t& value) /**< value to set */
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
|
||||
if (is_reg_variable (int_data, var_idx))
|
||||
{
|
||||
ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
ecma_value_t reg_value;
|
||||
ecma_stack_frame_get_reg_value (reg_value,
|
||||
&int_data->stack_frame,
|
||||
@@ -181,13 +178,12 @@ set_variable_value (int_data_t *int_data, /**< interpreter context */
|
||||
int_data->is_strict);
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
|
||||
ret_value = ecma_op_put_value_lex_env_base (ref_base_lex_env_p,
|
||||
&var_name_string,
|
||||
int_data->is_strict,
|
||||
value);
|
||||
ecma_op_put_value_lex_env_base (ret_value,
|
||||
ref_base_lex_env_p,
|
||||
&var_name_string,
|
||||
int_data->is_strict,
|
||||
value);
|
||||
|
||||
ecma_check_that_ecma_string_need_not_be_freed (&var_name_string);
|
||||
}
|
||||
|
||||
return ret_value;
|
||||
} /* set_variable_value */
|
||||
|
||||
@@ -29,8 +29,9 @@
|
||||
/**
|
||||
* 'Native call' opcode handler.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_native_call (opcode_t opdata, /**< operation data */
|
||||
void
|
||||
opfunc_native_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
opcode_t opdata, /**< operation data */
|
||||
int_data_t *int_data) /**< interpreter context */
|
||||
{
|
||||
// const idx_t dst_var_idx = opdata.data.native_call.lhs;
|
||||
@@ -43,15 +44,15 @@ opfunc_native_call (opcode_t opdata, /**< operation data */
|
||||
|
||||
JERRY_STATIC_ASSERT (OPCODE_NATIVE_CALL__COUNT < (1u << (sizeof (native_call_id_idx) * JERRY_BITSINBYTE)));
|
||||
|
||||
ecma_completion_value_t ret_value = 0;
|
||||
|
||||
MEM_DEFINE_LOCAL_ARRAY (arg_values, args_number, ecma_value_t);
|
||||
|
||||
ecma_length_t args_read;
|
||||
ecma_completion_value_t get_arg_completion = fill_varg_list (int_data,
|
||||
args_number,
|
||||
arg_values,
|
||||
&args_read);
|
||||
ecma_completion_value_t get_arg_completion;
|
||||
fill_varg_list (get_arg_completion,
|
||||
int_data,
|
||||
args_number,
|
||||
arg_values,
|
||||
&args_read);
|
||||
|
||||
if (ecma_is_completion_value_empty (get_arg_completion))
|
||||
{
|
||||
@@ -66,7 +67,7 @@ opfunc_native_call (opcode_t opdata, /**< operation data */
|
||||
uint32_t int_num = ecma_number_to_uint32 (*num_p);
|
||||
led_toggle (int_num);
|
||||
|
||||
ret_value = ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
break;
|
||||
}
|
||||
case OPCODE_NATIVE_CALL_LED_ON:
|
||||
@@ -76,7 +77,7 @@ opfunc_native_call (opcode_t opdata, /**< operation data */
|
||||
uint32_t int_num = ecma_number_to_uint32 (*num_p);
|
||||
led_on (int_num);
|
||||
|
||||
ret_value = ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
break;
|
||||
}
|
||||
case OPCODE_NATIVE_CALL_LED_OFF:
|
||||
@@ -86,7 +87,7 @@ opfunc_native_call (opcode_t opdata, /**< operation data */
|
||||
uint32_t int_num = ecma_number_to_uint32 (*num_p);
|
||||
led_off (int_num);
|
||||
|
||||
ret_value = ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
break;
|
||||
}
|
||||
case OPCODE_NATIVE_CALL_LED_ONCE:
|
||||
@@ -96,7 +97,7 @@ opfunc_native_call (opcode_t opdata, /**< operation data */
|
||||
uint32_t int_num = ecma_number_to_uint32 (*num_p);
|
||||
led_blink_once (int_num);
|
||||
|
||||
ret_value = ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
break;
|
||||
}
|
||||
case OPCODE_NATIVE_CALL_WAIT:
|
||||
@@ -106,7 +107,7 @@ opfunc_native_call (opcode_t opdata, /**< operation data */
|
||||
uint32_t int_num = ecma_number_to_uint32 (*num_p);
|
||||
wait_ms (int_num);
|
||||
|
||||
ret_value = ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -114,9 +115,7 @@ opfunc_native_call (opcode_t opdata, /**< operation data */
|
||||
{
|
||||
JERRY_ASSERT (args_number == 1);
|
||||
|
||||
ECMA_TRY_CATCH (str_value,
|
||||
ecma_op_to_string (arg_values[0]),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, str_value, arg_values[0]);
|
||||
|
||||
ecma_string_t *str_p = ecma_get_string_from_value (str_value);
|
||||
|
||||
@@ -141,7 +140,7 @@ opfunc_native_call (opcode_t opdata, /**< operation data */
|
||||
|
||||
mem_heap_free_block (zt_str_p);
|
||||
|
||||
ret_value = ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
|
||||
ECMA_FINALIZE (str_value);
|
||||
|
||||
@@ -169,6 +168,4 @@ opfunc_native_call (opcode_t opdata, /**< operation data */
|
||||
}
|
||||
|
||||
MEM_FINALIZE_LOCAL_ARRAY (arg_values);
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_native_call */
|
||||
|
||||
@@ -26,21 +26,23 @@
|
||||
* otherwise - not normal completion value indicating completion type
|
||||
* of last expression evaluated
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
fill_varg_list (int_data_t *int_data, /**< interpreter context */
|
||||
void
|
||||
fill_varg_list (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
int_data_t *int_data, /**< interpreter context */
|
||||
ecma_length_t args_number, /**< number of arguments */
|
||||
ecma_value_t arg_values[], /**< out: arguments' values */
|
||||
ecma_length_t *out_arg_number_p) /**< out: number of arguments
|
||||
successfully read */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
|
||||
ecma_length_t arg_index;
|
||||
for (arg_index = 0;
|
||||
arg_index < args_number;
|
||||
arg_index++)
|
||||
{
|
||||
ecma_completion_value_t evaluate_arg_completion = run_int_loop (int_data);
|
||||
ecma_completion_value_t evaluate_arg_completion;
|
||||
run_int_loop (evaluate_arg_completion, int_data);
|
||||
|
||||
if (ecma_is_completion_value_normal (evaluate_arg_completion))
|
||||
{
|
||||
@@ -50,7 +52,8 @@ fill_varg_list (int_data_t *int_data, /**< interpreter context */
|
||||
|
||||
const idx_t varg_var_idx = next_opcode.data.meta.data_1;
|
||||
|
||||
ecma_completion_value_t get_arg_completion = get_variable_value (int_data, varg_var_idx, false);
|
||||
ecma_completion_value_t get_arg_completion;
|
||||
get_variable_value (get_arg_completion, int_data, varg_var_idx, false);
|
||||
|
||||
if (ecma_is_completion_value_normal (get_arg_completion))
|
||||
{
|
||||
@@ -75,8 +78,6 @@ fill_varg_list (int_data_t *int_data, /**< interpreter context */
|
||||
}
|
||||
|
||||
*out_arg_number_p = arg_index;
|
||||
|
||||
return ret_value;
|
||||
} /* fill_varg_list */
|
||||
|
||||
/**
|
||||
|
||||
+268
-390
File diff suppressed because it is too large
Load Diff
@@ -242,11 +242,11 @@ enum __opcode_idx
|
||||
};
|
||||
#undef __OP_ENUM_FIELD
|
||||
|
||||
#define __OP_FUNC_DECL(name, arg1, arg2, arg3) ecma_completion_value_t opfunc_##name (opcode_t, int_data_t*);
|
||||
#define __OP_FUNC_DECL(name, arg1, arg2, arg3) void opfunc_##name (ecma_completion_value_t &, opcode_t, int_data_t*);
|
||||
OP_LIST (OP_FUNC_DECL)
|
||||
#undef __OP_FUNC_DECL
|
||||
|
||||
typedef ecma_completion_value_t (*opfunc) (opcode_t, int_data_t *);
|
||||
typedef void (*opfunc) (ecma_completion_value_t &, opcode_t, int_data_t *);
|
||||
|
||||
#define GETOP_DECL_0(a, name) \
|
||||
opcode_t getop_##name (void);
|
||||
|
||||
@@ -53,10 +53,11 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_array_prototype_object_to_string (const ecma_value_t& this_arg) /**< this argument */
|
||||
static void
|
||||
ecma_builtin_array_prototype_object_to_string (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg) /**< this argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg);
|
||||
} /* ecma_builtin_array_prototype_object_to_string */
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,8 +53,9 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_array_object_is_array (const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_array_object_is_array (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< first argument */
|
||||
{
|
||||
ecma_simple_value_t is_array = ECMA_SIMPLE_VALUE_FALSE;
|
||||
@@ -72,7 +73,7 @@ ecma_builtin_array_object_is_array (const ecma_value_t& this_arg __unused, /**<
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_make_simple_completion_value (is_array);
|
||||
ecma_make_simple_completion_value (ret_value, is_array);
|
||||
} /* ecma_builtin_array_object_is_array */
|
||||
|
||||
/**
|
||||
@@ -80,13 +81,14 @@ ecma_builtin_array_object_is_array (const ecma_value_t& this_arg __unused, /**<
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_array_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_builtin_array_dispatch_construct (arguments_list_p, arguments_list_len);
|
||||
ecma_builtin_array_dispatch_construct (ret_value, arguments_list_p, arguments_list_len);
|
||||
} /* ecma_builtin_array_dispatch_call */
|
||||
|
||||
/**
|
||||
@@ -94,13 +96,14 @@ ecma_builtin_array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arg
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_array_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_op_create_array_object (arguments_list_p, arguments_list_len, true);
|
||||
ecma_op_create_array_object (ret_value, arguments_list_p, arguments_list_len, true);
|
||||
} /* ecma_builtin_array_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,14 +53,11 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_boolean_prototype_object_to_string (const ecma_value_t& this_arg) /**< this argument */
|
||||
static void
|
||||
ecma_builtin_boolean_prototype_object_to_string (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg) /**< this argument */
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (value_of_ret,
|
||||
ecma_builtin_boolean_prototype_object_value_of (this_arg),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_builtin_boolean_prototype_object_value_of, value_of_ret, this_arg);
|
||||
|
||||
ecma_string_t *ret_str_p;
|
||||
|
||||
@@ -75,11 +72,9 @@ ecma_builtin_boolean_prototype_object_to_string (const ecma_value_t& this_arg) /
|
||||
ret_str_p = ecma_get_magic_string (ECMA_MAGIC_STRING_FALSE);
|
||||
}
|
||||
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (ret_str_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (ret_str_p));
|
||||
|
||||
ECMA_FINALIZE (value_of_ret);
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_boolean_prototype_object_to_string */
|
||||
|
||||
/**
|
||||
@@ -91,12 +86,14 @@ ecma_builtin_boolean_prototype_object_to_string (const ecma_value_t& this_arg) /
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_boolean_prototype_object_value_of (const ecma_value_t& this_arg) /**< this argument */
|
||||
static void
|
||||
ecma_builtin_boolean_prototype_object_value_of (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg) /**< this argument */
|
||||
{
|
||||
if (ecma_is_value_boolean (this_arg))
|
||||
{
|
||||
return ecma_make_normal_completion_value (this_arg);
|
||||
ecma_make_normal_completion_value (ret_value, this_arg);
|
||||
return;
|
||||
}
|
||||
else if (ecma_is_value_object (this_arg))
|
||||
{
|
||||
@@ -117,11 +114,12 @@ ecma_builtin_boolean_prototype_object_value_of (const ecma_value_t& this_arg) /*
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_boolean (ret_boolean_value));
|
||||
|
||||
return ecma_make_normal_completion_value (ret_boolean_value);
|
||||
ecma_make_normal_completion_value (ret_value, ret_boolean_value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
} /* ecma_builtin_boolean_prototype_object_value_of */
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,8 +49,9 @@
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_boolean_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_boolean_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
@@ -59,13 +60,12 @@ ecma_builtin_boolean_dispatch_call (const ecma_value_t *arguments_list_p, /**< a
|
||||
{
|
||||
ecma_value_t value_undefined (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
|
||||
return ecma_op_to_boolean (value_undefined);
|
||||
ecma_op_to_boolean (ret_value, value_undefined);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_op_to_boolean (arguments_list_p [0]);
|
||||
ecma_op_to_boolean (ret_value, arguments_list_p [0]);
|
||||
}
|
||||
|
||||
} /* ecma_builtin_boolean_dispatch_call */
|
||||
|
||||
/**
|
||||
@@ -73,19 +73,20 @@ ecma_builtin_boolean_dispatch_call (const ecma_value_t *arguments_list_p, /**< a
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_boolean_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_boolean_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
if (arguments_list_len == 0)
|
||||
{
|
||||
return ecma_op_create_boolean_object (ecma_value_t (ECMA_SIMPLE_VALUE_FALSE));
|
||||
ecma_op_create_boolean_object (ret_value, ecma_value_t (ECMA_SIMPLE_VALUE_FALSE));
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_op_create_boolean_object (arguments_list_p[0]);
|
||||
ecma_op_create_boolean_object (ret_value, arguments_list_p[0]);
|
||||
}
|
||||
} /* ecma_builtin_boolean_dispatch_construct */
|
||||
|
||||
|
||||
@@ -48,13 +48,14 @@
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_compact_profile_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_compact_profile_error_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_make_throw_obj_completion_value (ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR));
|
||||
} /* ecma_builtin_compact_profile_error_dispatch_call */
|
||||
|
||||
/**
|
||||
@@ -62,13 +63,14 @@ ecma_builtin_compact_profile_error_dispatch_call (const ecma_value_t *arguments_
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_compact_profile_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_compact_profile_error_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_make_throw_obj_completion_value (ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR));
|
||||
} /* ecma_builtin_compact_profile_error_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,24 +53,21 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_error_prototype_object_to_string (const ecma_value_t& this_arg) /**< this argument */
|
||||
static void
|
||||
ecma_builtin_error_prototype_object_to_string (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg) /**< this argument */
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
// 2.
|
||||
if (!ecma_is_value_object (this_arg))
|
||||
{
|
||||
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (this_arg);
|
||||
ecma_string_t *name_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_NAME);
|
||||
|
||||
ECMA_TRY_CATCH (name_get_ret_value,
|
||||
ecma_op_object_get (obj_p, name_magic_string_p),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_object_get, name_get_ret_value, obj_p, name_magic_string_p);
|
||||
|
||||
ecma_completion_value_t name_to_str_completion;
|
||||
|
||||
@@ -78,24 +75,22 @@ ecma_builtin_error_prototype_object_to_string (const ecma_value_t& this_arg) /**
|
||||
{
|
||||
ecma_string_t *error_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_ERROR_UL);
|
||||
|
||||
name_to_str_completion = ecma_make_normal_completion_value (ecma_value_t (error_magic_string_p));
|
||||
ecma_make_normal_completion_value (name_to_str_completion, ecma_value_t (error_magic_string_p));
|
||||
}
|
||||
else
|
||||
{
|
||||
name_to_str_completion = ecma_op_to_string (name_get_ret_value);
|
||||
ecma_op_to_string (name_to_str_completion, name_get_ret_value);
|
||||
}
|
||||
|
||||
if (unlikely (!ecma_is_completion_value_normal (name_to_str_completion)))
|
||||
{
|
||||
ret_value = ecma_copy_completion_value (name_to_str_completion);
|
||||
ecma_copy_completion_value (ret_value, name_to_str_completion);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_string_t *message_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_MESSAGE);
|
||||
|
||||
ECMA_TRY_CATCH (msg_get_ret_value,
|
||||
ecma_op_object_get (obj_p, message_magic_string_p),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_object_get, msg_get_ret_value, obj_p, message_magic_string_p);
|
||||
|
||||
ecma_completion_value_t msg_to_str_completion;
|
||||
|
||||
@@ -103,16 +98,16 @@ ecma_builtin_error_prototype_object_to_string (const ecma_value_t& this_arg) /**
|
||||
{
|
||||
ecma_string_t *empty_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING__EMPTY);
|
||||
|
||||
msg_to_str_completion = ecma_make_normal_completion_value (ecma_value_t (empty_magic_string_p));
|
||||
ecma_make_normal_completion_value (msg_to_str_completion, ecma_value_t (empty_magic_string_p));
|
||||
}
|
||||
else
|
||||
{
|
||||
msg_to_str_completion = ecma_op_to_string (msg_get_ret_value);
|
||||
ecma_op_to_string (msg_to_str_completion, msg_get_ret_value);
|
||||
}
|
||||
|
||||
if (unlikely (!ecma_is_completion_value_normal (msg_to_str_completion)))
|
||||
{
|
||||
ret_value = ecma_copy_completion_value (msg_to_str_completion);
|
||||
ecma_copy_completion_value (ret_value, msg_to_str_completion);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -182,7 +177,7 @@ ecma_builtin_error_prototype_object_to_string (const ecma_value_t& this_arg) /**
|
||||
MEM_FINALIZE_LOCAL_ARRAY (ret_str_buffer);
|
||||
}
|
||||
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (ret_str_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (ret_str_p));
|
||||
}
|
||||
|
||||
ecma_free_completion_value (msg_to_str_completion);
|
||||
@@ -198,8 +193,6 @@ ecma_builtin_error_prototype_object_to_string (const ecma_value_t& this_arg) /**
|
||||
|
||||
ecma_deref_ecma_string (name_magic_string_p);
|
||||
}
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_error_prototype_object_to_string */
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,8 +48,9 @@
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_error_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
@@ -57,26 +58,20 @@ ecma_builtin_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arg
|
||||
if (arguments_list_len != 0
|
||||
&& !ecma_is_value_undefined (arguments_list_p [0]))
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (msg_str_value,
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, msg_str_value, arguments_list_p[0]);
|
||||
|
||||
ecma_string_t *message_string_p = ecma_get_string_from_value (msg_str_value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_COMMON,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (new_error_object_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_str_value);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_COMMON);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (new_error_object_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
}
|
||||
} /* ecma_builtin_error_dispatch_call */
|
||||
|
||||
@@ -85,11 +80,12 @@ ecma_builtin_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arg
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_error_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
return ecma_builtin_error_dispatch_call (arguments_list_p, arguments_list_len);
|
||||
ecma_builtin_error_dispatch_call (ret_value, arguments_list_p, arguments_list_len);
|
||||
} /* ecma_builtin_error_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,8 +48,9 @@
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_eval_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_eval_error_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
@@ -57,26 +58,20 @@ ecma_builtin_eval_error_dispatch_call (const ecma_value_t *arguments_list_p, /**
|
||||
if (arguments_list_len != 0
|
||||
&& !ecma_is_value_undefined (arguments_list_p [0]))
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (msg_str_value,
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, msg_str_value, arguments_list_p[0]);
|
||||
|
||||
ecma_string_t *message_string_p = ecma_get_string_from_value (msg_str_value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_EVAL,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (new_error_object_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_str_value);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_EVAL);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (new_error_object_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
}
|
||||
} /* ecma_builtin_eval_error_dispatch_call */
|
||||
|
||||
@@ -85,11 +80,12 @@ ecma_builtin_eval_error_dispatch_call (const ecma_value_t *arguments_list_p, /**
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_eval_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_eval_error_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
return ecma_builtin_eval_error_dispatch_call (arguments_list_p, arguments_list_len);
|
||||
ecma_builtin_eval_error_dispatch_call (ret_value, arguments_list_p, arguments_list_len);
|
||||
} /* ecma_builtin_eval_error_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,10 +51,11 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_function_prototype_object_to_string (const ecma_value_t& this_arg) /**< this argument */
|
||||
static void
|
||||
ecma_builtin_function_prototype_object_to_string (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg) /**< this argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg);
|
||||
} /* ecma_builtin_function_prototype_object_to_string */
|
||||
|
||||
/**
|
||||
@@ -66,12 +67,13 @@ ecma_builtin_function_prototype_object_to_string (const ecma_value_t& this_arg)
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_function_prototype_object_apply (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_function_prototype_object_apply (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg1, /**< first argument */
|
||||
const ecma_value_t& arg2) /**< second argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg1, arg2);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg1, arg2);
|
||||
} /* ecma_builtin_function_prototype_object_apply */
|
||||
|
||||
/**
|
||||
@@ -83,12 +85,13 @@ ecma_builtin_function_prototype_object_apply (const ecma_value_t& this_arg, /**<
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_function_prototype_object_call (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_function_prototype_object_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t* arguments_list_p, /**< list of arguments */
|
||||
ecma_length_t arguments_number) /**< number of arguments */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arguments_list_p, arguments_number);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arguments_list_p, arguments_number);
|
||||
} /* ecma_builtin_function_prototype_object_call */
|
||||
|
||||
/**
|
||||
@@ -100,12 +103,13 @@ ecma_builtin_function_prototype_object_call (const ecma_value_t& this_arg, /**<
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_function_prototype_object_bind (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_function_prototype_object_bind (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t* arguments_list_p, /**< list of arguments */
|
||||
ecma_length_t arguments_number) /**< number of arguments */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arguments_list_p, arguments_number);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arguments_list_p, arguments_number);
|
||||
} /* ecma_builtin_function_prototype_object_bind */
|
||||
|
||||
/**
|
||||
@@ -113,13 +117,14 @@ ecma_builtin_function_prototype_object_bind (const ecma_value_t& this_arg, /**<
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_function_prototype_dispatch_call (const ecma_value_t* arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_function_prototype_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t* arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
} /* ecma_builtin_function_prototype_dispatch_call */
|
||||
|
||||
/**
|
||||
@@ -127,13 +132,14 @@ ecma_builtin_function_prototype_dispatch_call (const ecma_value_t* arguments_lis
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_function_prototype_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_function_prototype_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
} /* ecma_builtin_function_prototype_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,13 +47,14 @@
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_function_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_function_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_builtin_function_dispatch_construct (arguments_list_p, arguments_list_len);
|
||||
ecma_builtin_function_dispatch_construct (ret_value, arguments_list_p, arguments_list_len);
|
||||
} /* ecma_builtin_function_dispatch_call */
|
||||
|
||||
/**
|
||||
@@ -61,13 +62,14 @@ ecma_builtin_function_dispatch_call (const ecma_value_t *arguments_list_p, /**<
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_function_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_function_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (arguments_list_p, arguments_list_len);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, arguments_list_p, arguments_list_len);
|
||||
} /* ecma_builtin_function_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,11 +48,12 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_global_object_eval (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_global_object_eval (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& x) /**< routine's first argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, x);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, x);
|
||||
} /* ecma_builtin_global_object_eval */
|
||||
|
||||
/**
|
||||
@@ -64,12 +65,13 @@ ecma_builtin_global_object_eval (const ecma_value_t& this_arg, /**< this argumen
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_global_object_parse_int (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_global_object_parse_int (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& string, /**< routine's first argument */
|
||||
const ecma_value_t& radix) /**< routine's second argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, string, radix);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, string, radix);
|
||||
} /* ecma_builtin_global_object_parse_int */
|
||||
|
||||
/**
|
||||
@@ -81,11 +83,12 @@ ecma_builtin_global_object_parse_int (const ecma_value_t& this_arg, /**< this ar
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_global_object_parse_float (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_global_object_parse_float (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& string) /**< routine's first argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, string);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, string);
|
||||
} /* ecma_builtin_global_object_parse_float */
|
||||
|
||||
/**
|
||||
@@ -97,22 +100,21 @@ ecma_builtin_global_object_parse_float (const ecma_value_t& this_arg, /**< this
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_global_object_is_nan (const ecma_value_t& this_arg __unused, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_global_object_is_nan (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg __unused, /**< this argument */
|
||||
const ecma_value_t& arg) /**< routine's first argument */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (arg_num, arg, ret_value);
|
||||
|
||||
bool is_nan = ecma_number_is_nan (arg_num);
|
||||
|
||||
ret_value = ecma_make_simple_completion_value (is_nan ? ECMA_SIMPLE_VALUE_TRUE
|
||||
: ECMA_SIMPLE_VALUE_FALSE);
|
||||
ecma_make_simple_completion_value (ret_value,
|
||||
is_nan ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (arg_num);
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_global_object_is_nan */
|
||||
|
||||
/**
|
||||
@@ -124,23 +126,22 @@ ecma_builtin_global_object_is_nan (const ecma_value_t& this_arg __unused, /**< t
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_global_object_is_finite (const ecma_value_t& this_arg __unused, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_global_object_is_finite (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg __unused, /**< this argument */
|
||||
const ecma_value_t& arg) /**< routine's first argument */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (arg_num, arg, ret_value);
|
||||
|
||||
bool is_finite = !(ecma_number_is_nan (arg_num)
|
||||
|| ecma_number_is_infinity (arg_num));
|
||||
|
||||
ret_value = ecma_make_simple_completion_value (is_finite ? ECMA_SIMPLE_VALUE_TRUE
|
||||
: ECMA_SIMPLE_VALUE_FALSE);
|
||||
ecma_make_simple_completion_value (ret_value,
|
||||
is_finite ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (arg_num);
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_global_object_is_finite */
|
||||
|
||||
/**
|
||||
@@ -152,11 +153,12 @@ ecma_builtin_global_object_is_finite (const ecma_value_t& this_arg __unused, /**
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_global_object_decode_uri (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_global_object_decode_uri (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& encoded_uri) /**< routine's first argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, encoded_uri);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, encoded_uri);
|
||||
} /* ecma_builtin_global_object_decode_uri */
|
||||
|
||||
/**
|
||||
@@ -168,12 +170,13 @@ ecma_builtin_global_object_decode_uri (const ecma_value_t& this_arg, /**< this a
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_global_object_decode_uri_component (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_global_object_decode_uri_component (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& encoded_uri_component) /**< routine's
|
||||
* first argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, encoded_uri_component);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, encoded_uri_component);
|
||||
} /* ecma_builtin_global_object_decode_uri_component */
|
||||
|
||||
/**
|
||||
@@ -185,11 +188,12 @@ ecma_builtin_global_object_decode_uri_component (const ecma_value_t& this_arg, /
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_global_object_encode_uri (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_global_object_encode_uri (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& uri) /**< routine's first argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, uri);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, uri);
|
||||
} /* ecma_builtin_global_object_encode_uri */
|
||||
|
||||
/**
|
||||
@@ -201,11 +205,12 @@ ecma_builtin_global_object_encode_uri (const ecma_value_t& this_arg, /**< this a
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_global_object_encode_uri_component (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_global_object_encode_uri_component (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& uri_component) /**< routine's first argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, uri_component);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, uri_component);
|
||||
} /* ecma_builtin_global_object_encode_uri_component */
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
#define ROUTINE_ARG_LIST_NON_FIXED ROUTINE_ARG_LIST_0, \
|
||||
const ecma_value_t *arguments_list_p, ecma_length_t arguments_list_len
|
||||
#define ROUTINE(name, c_function_name, args_number, length_prop_value) \
|
||||
static ecma_completion_value_t c_function_name (ROUTINE_ARG_LIST_ ## args_number);
|
||||
static void c_function_name (ecma_completion_value_t &ret_value, \
|
||||
ROUTINE_ARG_LIST_ ## args_number);
|
||||
#include BUILTIN_INC_HEADER_NAME
|
||||
#undef ROUTINE_ARG_LIST_NON_FIXED
|
||||
#undef ROUTINE_ARG_LIST_3
|
||||
@@ -272,8 +273,10 @@ TRY_TO_INSTANTIATE_PROPERTY_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (ecma_object_t
|
||||
* @return completion-value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
DISPATCH_ROUTINE_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (ecma_magic_string_id_t builtin_routine_id, /**< built-in's
|
||||
void
|
||||
DISPATCH_ROUTINE_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (ecma_completion_value_t &ret_value, /**< out: completion
|
||||
* value */
|
||||
ecma_magic_string_id_t builtin_routine_id, /**< built-in's
|
||||
routine's
|
||||
name */
|
||||
const ecma_value_t& this_arg_value, /**< 'this' argument
|
||||
@@ -288,6 +291,8 @@ DISPATCH_ROUTINE_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (ecma_magic_string_id_t b
|
||||
(void) arguments_list;
|
||||
(void) arguments_number;
|
||||
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
|
||||
ecma_value_t value_undefined (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
switch (builtin_routine_id)
|
||||
{
|
||||
@@ -301,7 +306,8 @@ DISPATCH_ROUTINE_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (ecma_magic_string_id_t b
|
||||
#define ROUTINE(name, c_function_name, args_number, length_prop_value) \
|
||||
case name: \
|
||||
{ \
|
||||
return c_function_name (this_arg_value ROUTINE_ARG_LIST_ ## args_number); \
|
||||
c_function_name (ret_value, this_arg_value ROUTINE_ARG_LIST_ ## args_number); \
|
||||
return; \
|
||||
}
|
||||
#include BUILTIN_INC_HEADER_NAME
|
||||
#undef ROUTINE_ARG_LIST_0
|
||||
|
||||
@@ -54,12 +54,11 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_abs (const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_abs (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (arg_num, arg, ret_value);
|
||||
|
||||
ecma_number_t *num_p = ecma_alloc_number ();
|
||||
@@ -73,11 +72,9 @@ ecma_builtin_math_object_abs (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
*num_p = ecma_number_abs (arg_num);
|
||||
}
|
||||
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (num_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (num_p));
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (arg_num);
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_math_object_abs */
|
||||
|
||||
/**
|
||||
@@ -89,11 +86,12 @@ ecma_builtin_math_object_abs (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_acos (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_acos (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_math_object_acos */
|
||||
|
||||
/**
|
||||
@@ -105,11 +103,12 @@ ecma_builtin_math_object_acos (const ecma_value_t& this_arg, /**< 'this' argumen
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_asin (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_asin (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_math_object_asin */
|
||||
|
||||
/**
|
||||
@@ -121,11 +120,12 @@ ecma_builtin_math_object_asin (const ecma_value_t& this_arg, /**< 'this' argumen
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_atan (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_atan (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_math_object_atan */
|
||||
|
||||
/**
|
||||
@@ -137,12 +137,13 @@ ecma_builtin_math_object_atan (const ecma_value_t& this_arg, /**< 'this' argumen
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_atan2 (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_atan2 (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg1, /**< first routine's argument */
|
||||
const ecma_value_t& arg2) /**< second routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg1, arg2);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg1, arg2);
|
||||
} /* ecma_builtin_math_object_atan2 */
|
||||
|
||||
/**
|
||||
@@ -154,11 +155,12 @@ ecma_builtin_math_object_atan2 (const ecma_value_t& this_arg, /**< 'this' argume
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_ceil (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_ceil (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_math_object_ceil */
|
||||
|
||||
/**
|
||||
@@ -170,12 +172,11 @@ ecma_builtin_math_object_ceil (const ecma_value_t& this_arg, /**< 'this' argumen
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_cos (const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_cos (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (arg_num, arg, ret_value);
|
||||
|
||||
ecma_number_t *num_p = ecma_alloc_number ();
|
||||
@@ -222,11 +223,9 @@ ecma_builtin_math_object_cos (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
*num_p = sum;
|
||||
}
|
||||
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (num_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (num_p));
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (arg_num);
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_math_object_cos */
|
||||
|
||||
/**
|
||||
@@ -238,12 +237,11 @@ ecma_builtin_math_object_cos (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_exp (const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_exp (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (arg_num, arg, ret_value);
|
||||
|
||||
ecma_number_t *num_p = ecma_alloc_number ();
|
||||
@@ -272,11 +270,9 @@ ecma_builtin_math_object_exp (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
*num_p = ecma_number_exp (arg_num);
|
||||
}
|
||||
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (num_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (num_p));
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (arg_num);
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_math_object_exp */
|
||||
|
||||
/**
|
||||
@@ -288,11 +284,12 @@ ecma_builtin_math_object_exp (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_floor (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_floor (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_math_object_floor */
|
||||
|
||||
/**
|
||||
@@ -304,12 +301,11 @@ ecma_builtin_math_object_floor (const ecma_value_t& this_arg, /**< 'this' argume
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_log (const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_log (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (arg_num, arg, ret_value);
|
||||
|
||||
ecma_number_t *num_p = ecma_alloc_number ();
|
||||
@@ -335,11 +331,9 @@ ecma_builtin_math_object_log (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
*num_p = ecma_number_ln (arg_num);
|
||||
}
|
||||
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (num_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (num_p));
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (arg_num);
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_math_object_log */
|
||||
|
||||
/**
|
||||
@@ -351,13 +345,12 @@ ecma_builtin_math_object_log (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_max (const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_max (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
const ecma_value_t args[], /**< arguments list */
|
||||
ecma_length_t args_number) /**< number of arguments */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
ecma_number_t ret_num = ecma_number_make_infinity (true);
|
||||
|
||||
bool is_just_convert = false;
|
||||
@@ -415,7 +408,7 @@ ecma_builtin_math_object_max (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
|
||||
if (ecma_is_completion_value_throw (ret_value))
|
||||
{
|
||||
return ret_value;
|
||||
return;
|
||||
}
|
||||
|
||||
JERRY_ASSERT (ecma_is_completion_value_empty (ret_value));
|
||||
@@ -426,7 +419,7 @@ ecma_builtin_math_object_max (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
ecma_number_t *num_p = ecma_alloc_number ();
|
||||
*num_p = ret_num;
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (num_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (num_p));
|
||||
} /* ecma_builtin_math_object_max */
|
||||
|
||||
/**
|
||||
@@ -438,13 +431,12 @@ ecma_builtin_math_object_max (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_min (const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_min (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
const ecma_value_t args[], /**< arguments list */
|
||||
ecma_length_t args_number) /**< number of arguments */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
ecma_number_t ret_num = ecma_number_make_infinity (false);
|
||||
|
||||
bool is_just_convert = false;
|
||||
@@ -502,7 +494,7 @@ ecma_builtin_math_object_min (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
|
||||
if (ecma_is_completion_value_throw (ret_value))
|
||||
{
|
||||
return ret_value;
|
||||
return;
|
||||
}
|
||||
|
||||
JERRY_ASSERT (ecma_is_completion_value_empty (ret_value));
|
||||
@@ -513,7 +505,7 @@ ecma_builtin_math_object_min (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
ecma_number_t *num_p = ecma_alloc_number ();
|
||||
*num_p = ret_num;
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (num_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (num_p));
|
||||
} /* ecma_builtin_math_object_min */
|
||||
|
||||
/**
|
||||
@@ -525,13 +517,12 @@ ecma_builtin_math_object_min (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_pow (const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_pow (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
const ecma_value_t& arg1, /**< first routine's argument */
|
||||
const ecma_value_t& arg2) /**< second routine's argument */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (x, arg1, ret_value);
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (y, arg2, ret_value);
|
||||
|
||||
@@ -742,12 +733,10 @@ ecma_builtin_math_object_pow (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
}
|
||||
}
|
||||
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (num_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (num_p));
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (y);
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (x);
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_math_object_pow */
|
||||
|
||||
/**
|
||||
@@ -759,8 +748,9 @@ ecma_builtin_math_object_pow (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_random (const ecma_value_t& this_arg __unused) /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_random (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg __unused) /**< 'this' argument */
|
||||
{
|
||||
/* Implementation of George Marsaglia's XorShift random number generator */
|
||||
TODO (/* Check for license issues */);
|
||||
@@ -788,7 +778,7 @@ ecma_builtin_math_object_random (const ecma_value_t& this_arg __unused) /**< 'th
|
||||
ecma_number_t *rand_p = ecma_alloc_number ();
|
||||
*rand_p = rand;
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (rand_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (rand_p));
|
||||
} /* ecma_builtin_math_object_random */
|
||||
|
||||
/**
|
||||
@@ -800,12 +790,11 @@ ecma_builtin_math_object_random (const ecma_value_t& this_arg __unused) /**< 'th
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_round (const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_round (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (arg_num, arg, ret_value);
|
||||
|
||||
ecma_number_t *num_p = ecma_alloc_number ();
|
||||
@@ -838,11 +827,9 @@ ecma_builtin_math_object_round (const ecma_value_t& this_arg __unused, /**< 'thi
|
||||
}
|
||||
}
|
||||
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (num_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (num_p));
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (arg_num);
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_math_object_round */
|
||||
|
||||
/**
|
||||
@@ -854,12 +841,11 @@ ecma_builtin_math_object_round (const ecma_value_t& this_arg __unused, /**< 'thi
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_sin (const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_sin (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (arg_num, arg, ret_value);
|
||||
|
||||
ecma_number_t *num_p = ecma_alloc_number ();
|
||||
@@ -906,11 +892,9 @@ ecma_builtin_math_object_sin (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
*num_p = sum;
|
||||
}
|
||||
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (num_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (num_p));
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (arg_num);
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_math_object_sin */
|
||||
|
||||
/**
|
||||
@@ -922,12 +906,11 @@ ecma_builtin_math_object_sin (const ecma_value_t& this_arg __unused, /**< 'this'
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_sqrt (const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_sqrt (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (arg_num, arg, ret_value);
|
||||
|
||||
ecma_number_t ret_num;
|
||||
@@ -956,11 +939,9 @@ ecma_builtin_math_object_sqrt (const ecma_value_t& this_arg __unused, /**< 'this
|
||||
ecma_number_t *num_p = ecma_alloc_number ();
|
||||
*num_p = ret_num;
|
||||
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (num_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (num_p));
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (arg_num);
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_math_object_sqrt */
|
||||
|
||||
/**
|
||||
@@ -972,11 +953,12 @@ ecma_builtin_math_object_sqrt (const ecma_value_t& this_arg __unused, /**< 'this
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_math_object_tan (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_math_object_tan (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_math_object_tan */
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,8 +53,9 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_number_prototype_object_to_string (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_number_prototype_object_to_string (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t* arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
@@ -83,22 +84,25 @@ ecma_builtin_number_prototype_object_to_string (const ecma_value_t& this_arg, /*
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
return;
|
||||
}
|
||||
|
||||
if (arguments_list_len == 0)
|
||||
{
|
||||
ecma_string_t *ret_str_p = ecma_new_ecma_string_from_number (this_arg_number);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (ret_str_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (ret_str_p));
|
||||
}
|
||||
else
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (arguments_list_p);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, arguments_list_p);
|
||||
}
|
||||
} /* ecma_builtin_number_prototype_object_to_string */
|
||||
|
||||
@@ -111,10 +115,11 @@ ecma_builtin_number_prototype_object_to_string (const ecma_value_t& this_arg, /*
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_number_prototype_object_to_locale_string (const ecma_value_t& this_arg) /**< this argument */
|
||||
static void
|
||||
ecma_builtin_number_prototype_object_to_locale_string (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg) /**< this argument */
|
||||
{
|
||||
return ecma_builtin_number_prototype_object_to_string (this_arg, NULL, 0);
|
||||
ecma_builtin_number_prototype_object_to_string (ret_value, this_arg, NULL, 0);
|
||||
} /* ecma_builtin_number_prototype_object_to_locale_string */
|
||||
|
||||
/**
|
||||
@@ -126,15 +131,17 @@ ecma_builtin_number_prototype_object_to_locale_string (const ecma_value_t& this_
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_number_prototype_object_value_of (const ecma_value_t& this_arg) /**< this argument */
|
||||
static void
|
||||
ecma_builtin_number_prototype_object_value_of (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg) /**< this argument */
|
||||
{
|
||||
if (ecma_is_value_number (this_arg))
|
||||
{
|
||||
ecma_value_t this_arg_copy;
|
||||
ecma_copy_value (this_arg_copy, this_arg, true);
|
||||
|
||||
return ecma_make_normal_completion_value (this_arg_copy);
|
||||
ecma_make_normal_completion_value (ret_value, this_arg_copy);
|
||||
return;
|
||||
}
|
||||
else if (ecma_is_value_object (this_arg))
|
||||
{
|
||||
@@ -153,11 +160,12 @@ ecma_builtin_number_prototype_object_value_of (const ecma_value_t& this_arg) /**
|
||||
ecma_number_t *ret_num_p = ecma_alloc_number ();
|
||||
*ret_num_p = *prim_value_num_p;
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (ret_num_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (ret_num_p));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
} /* ecma_builtin_number_prototype_object_value_of */
|
||||
|
||||
/**
|
||||
@@ -169,11 +177,12 @@ ecma_builtin_number_prototype_object_value_of (const ecma_value_t& this_arg) /**
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_number_prototype_object_to_fixed (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_number_prototype_object_to_fixed (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_number_prototype_object_to_fixed */
|
||||
|
||||
/**
|
||||
@@ -185,11 +194,12 @@ ecma_builtin_number_prototype_object_to_fixed (const ecma_value_t& this_arg, /**
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_number_prototype_object_to_exponential (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_number_prototype_object_to_exponential (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_number_prototype_object_to_exponential */
|
||||
|
||||
/**
|
||||
@@ -201,11 +211,12 @@ ecma_builtin_number_prototype_object_to_exponential (const ecma_value_t& this_ar
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_number_prototype_object_to_precision (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_number_prototype_object_to_precision (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_number_prototype_object_to_precision */
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,27 +49,24 @@
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_number_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_number_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
if (arguments_list_len == 0)
|
||||
{
|
||||
ecma_number_t *zero_num_p = ecma_alloc_number ();
|
||||
*zero_num_p = ECMA_NUMBER_ZERO;
|
||||
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (zero_num_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (zero_num_p));
|
||||
}
|
||||
else
|
||||
{
|
||||
ret_value = ecma_op_to_number (arguments_list_p [0]);
|
||||
ecma_op_to_number (ret_value, arguments_list_p [0]);
|
||||
}
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_number_dispatch_call */
|
||||
|
||||
/**
|
||||
@@ -77,8 +74,9 @@ ecma_builtin_number_dispatch_call (const ecma_value_t *arguments_list_p, /**< ar
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_number_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_number_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
@@ -88,15 +86,13 @@ ecma_builtin_number_dispatch_construct (const ecma_value_t *arguments_list_p, /*
|
||||
ecma_number_t *zero_num_p = ecma_alloc_number ();
|
||||
*zero_num_p = ECMA_NUMBER_ZERO;
|
||||
|
||||
ecma_completion_value_t completion = ecma_op_create_number_object (ecma_value_t (zero_num_p));
|
||||
ecma_op_create_number_object (ret_value, ecma_value_t (zero_num_p));
|
||||
|
||||
ecma_dealloc_number (zero_num_p);
|
||||
|
||||
return completion;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_op_create_number_object (arguments_list_p[0]);
|
||||
ecma_op_create_number_object (ret_value, arguments_list_p[0]);
|
||||
}
|
||||
} /* ecma_builtin_number_dispatch_construct */
|
||||
|
||||
|
||||
@@ -51,8 +51,9 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_prototype_object_to_string (const ecma_value_t& this_arg) /**< this argument */
|
||||
static void
|
||||
ecma_builtin_object_prototype_object_to_string (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg) /**< this argument */
|
||||
{
|
||||
ecma_magic_string_id_t type_string;
|
||||
|
||||
@@ -66,11 +67,13 @@ ecma_builtin_object_prototype_object_to_string (const ecma_value_t& this_arg) /*
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_completion_value_t this_to_obj_completion = ecma_op_to_object (this_arg);
|
||||
ecma_completion_value_t this_to_obj_completion;
|
||||
ecma_op_to_object (this_to_obj_completion, this_arg);
|
||||
|
||||
if (!ecma_is_completion_value_normal (this_to_obj_completion))
|
||||
{
|
||||
return this_to_obj_completion;
|
||||
ret_value = this_to_obj_completion;
|
||||
return;
|
||||
}
|
||||
|
||||
ecma_value_t obj_this_value;
|
||||
@@ -127,7 +130,7 @@ ecma_builtin_object_prototype_object_to_string (const ecma_value_t& this_arg) /*
|
||||
|
||||
MEM_FINALIZE_LOCAL_ARRAY (str_buffer);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (ret_string_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (ret_string_p));
|
||||
} /* ecma_builtin_object_prototype_object_to_string */
|
||||
|
||||
/**
|
||||
@@ -139,10 +142,11 @@ ecma_builtin_object_prototype_object_to_string (const ecma_value_t& this_arg) /*
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_prototype_object_value_of (const ecma_value_t& this_arg) /**< this argument */
|
||||
static void
|
||||
ecma_builtin_object_prototype_object_value_of (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg) /**< this argument */
|
||||
{
|
||||
return ecma_op_to_object (this_arg);
|
||||
ecma_op_to_object (ret_value, this_arg);
|
||||
} /* ecma_builtin_object_prototype_object_value_of */
|
||||
|
||||
/**
|
||||
@@ -154,10 +158,11 @@ ecma_builtin_object_prototype_object_value_of (const ecma_value_t& this_arg) /**
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_prototype_object_to_locale_string (const ecma_value_t& this_arg) /**< this argument */
|
||||
static void
|
||||
ecma_builtin_object_prototype_object_to_locale_string (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg) /**< this argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg);
|
||||
} /* ecma_builtin_object_prototype_object_to_locale_string */
|
||||
|
||||
/**
|
||||
@@ -169,11 +174,12 @@ ecma_builtin_object_prototype_object_to_locale_string (const ecma_value_t& this_
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_prototype_object_has_own_property (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_object_prototype_object_has_own_property (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg) /**< first argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_object_prototype_object_has_own_property */
|
||||
|
||||
/**
|
||||
@@ -185,11 +191,12 @@ ecma_builtin_object_prototype_object_has_own_property (const ecma_value_t& this_
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_prototype_object_is_prototype_of (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_object_prototype_object_is_prototype_of (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg) /**< routine's first argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_object_prototype_object_is_prototype_of */
|
||||
|
||||
/**
|
||||
@@ -201,11 +208,13 @@ ecma_builtin_object_prototype_object_is_prototype_of (const ecma_value_t& this_a
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_prototype_object_property_is_enumerable (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_object_prototype_object_property_is_enumerable (ecma_completion_value_t &ret_value, /**< out: completion
|
||||
* value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg) /**< routine's first argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_object_prototype_object_property_is_enumerable */
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,26 +47,23 @@
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_object_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_object_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
if (arguments_list_len == 0
|
||||
|| ecma_is_value_undefined (arguments_list_p[0])
|
||||
|| ecma_is_value_null (arguments_list_p [0]))
|
||||
{
|
||||
ret_value = ecma_builtin_object_dispatch_construct (arguments_list_p, arguments_list_len);
|
||||
ecma_builtin_object_dispatch_construct (ret_value, arguments_list_p, arguments_list_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret_value = ecma_op_to_object (arguments_list_p [0]);
|
||||
ecma_op_to_object (ret_value, arguments_list_p [0]);
|
||||
}
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_object_dispatch_call */
|
||||
|
||||
/**
|
||||
@@ -74,8 +71,9 @@ ecma_builtin_object_dispatch_call (const ecma_value_t *arguments_list_p, /**< ar
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_object_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_object_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
@@ -84,22 +82,23 @@ ecma_builtin_object_dispatch_construct (const ecma_value_t *arguments_list_p, /*
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_op_create_object_object_noarg ();
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (obj_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (obj_p));
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_completion_value_t new_obj_completion = ecma_op_create_object_object_arg (arguments_list_p [0]);
|
||||
ecma_completion_value_t new_obj_completion;
|
||||
ecma_op_create_object_object_arg (new_obj_completion, arguments_list_p [0]);
|
||||
|
||||
if (!ecma_is_completion_value_normal (new_obj_completion))
|
||||
{
|
||||
return new_obj_completion;
|
||||
ret_value = new_obj_completion;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_value_t new_obj_value;
|
||||
ecma_get_completion_value_value (new_obj_value, new_obj_completion);
|
||||
|
||||
return ecma_make_normal_completion_value (new_obj_value);
|
||||
ecma_make_normal_completion_value (ret_value, new_obj_value);
|
||||
}
|
||||
}
|
||||
} /* ecma_builtin_object_dispatch_construct */
|
||||
@@ -113,11 +112,12 @@ ecma_builtin_object_dispatch_construct (const ecma_value_t *arguments_list_p, /*
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_object_get_prototype_of (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_object_object_get_prototype_of (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_object_object_get_prototype_of */
|
||||
|
||||
/**
|
||||
@@ -129,11 +129,12 @@ ecma_builtin_object_object_get_prototype_of (const ecma_value_t& this_arg, /**<
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_object_get_own_property_names (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_object_object_get_own_property_names (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_object_object_get_own_property_names */
|
||||
|
||||
/**
|
||||
@@ -145,11 +146,12 @@ ecma_builtin_object_object_get_own_property_names (const ecma_value_t& this_arg,
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_object_seal (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_object_object_seal (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_object_object_seal */
|
||||
|
||||
/**
|
||||
@@ -161,11 +163,12 @@ ecma_builtin_object_object_seal (const ecma_value_t& this_arg, /**< 'this' argum
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_object_freeze (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_object_object_freeze (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_object_object_freeze */
|
||||
|
||||
/**
|
||||
@@ -177,11 +180,12 @@ ecma_builtin_object_object_freeze (const ecma_value_t& this_arg, /**< 'this' arg
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_object_prevent_extensions (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_object_object_prevent_extensions (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_object_object_prevent_extensions */
|
||||
|
||||
/**
|
||||
@@ -193,11 +197,12 @@ ecma_builtin_object_object_prevent_extensions (const ecma_value_t& this_arg, /**
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_object_is_sealed (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_object_object_is_sealed (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_object_object_is_sealed */
|
||||
|
||||
/**
|
||||
@@ -209,11 +214,12 @@ ecma_builtin_object_object_is_sealed (const ecma_value_t& this_arg, /**< 'this'
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_object_is_frozen (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_object_object_is_frozen (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_object_object_is_frozen */
|
||||
|
||||
/**
|
||||
@@ -225,11 +231,12 @@ ecma_builtin_object_object_is_frozen (const ecma_value_t& this_arg, /**< 'this'
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_object_is_extensible (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_object_object_is_extensible (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_object_object_is_extensible */
|
||||
|
||||
/**
|
||||
@@ -241,11 +248,12 @@ ecma_builtin_object_object_is_extensible (const ecma_value_t& this_arg, /**< 'th
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_object_keys (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_object_object_keys (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_object_object_keys */
|
||||
|
||||
/**
|
||||
@@ -257,12 +265,14 @@ ecma_builtin_object_object_keys (const ecma_value_t& this_arg, /**< 'this' argum
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_object_get_own_property_descriptor (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_object_object_get_own_property_descriptor (ecma_completion_value_t &ret_value, /**< out: completion
|
||||
* value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg1, /**< routine's first argument */
|
||||
const ecma_value_t& arg2) /**< routine's second argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg1, arg2);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg1, arg2);
|
||||
} /* ecma_builtin_object_object_get_own_property_descriptor */
|
||||
|
||||
/**
|
||||
@@ -274,12 +284,13 @@ ecma_builtin_object_object_get_own_property_descriptor (const ecma_value_t& this
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_object_create (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_object_object_create (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg1, /**< routine's first argument */
|
||||
const ecma_value_t& arg2) /**< routine's second argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg1, arg2);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg1, arg2);
|
||||
} /* ecma_builtin_object_object_create */
|
||||
|
||||
/**
|
||||
@@ -291,12 +302,13 @@ ecma_builtin_object_object_create (const ecma_value_t& this_arg, /**< 'this' arg
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_object_define_properties (const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_object_object_define_properties (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< 'this' argument */
|
||||
const ecma_value_t& arg1, /**< routine's first argument */
|
||||
const ecma_value_t& arg2) /**< routine's second argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg1, arg2);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg1, arg2);
|
||||
} /* ecma_builtin_object_object_define_properties */
|
||||
|
||||
/**
|
||||
@@ -308,53 +320,42 @@ ecma_builtin_object_object_define_properties (const ecma_value_t& this_arg, /**<
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_object_object_define_property (const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_object_object_define_property (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
const ecma_value_t& arg1, /**< routine's first argument */
|
||||
const ecma_value_t& arg2, /**< routine's second argument */
|
||||
const ecma_value_t& arg3) /**< routine's third argument */
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
if (!ecma_is_value_object (arg1))
|
||||
{
|
||||
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (arg1);
|
||||
|
||||
ECMA_TRY_CATCH (name_str_value,
|
||||
ecma_op_to_string (arg2),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, name_str_value, arg2);
|
||||
|
||||
ecma_string_t *name_str_p = ecma_get_string_from_value (name_str_value);
|
||||
|
||||
ecma_property_descriptor_t prop_desc;
|
||||
|
||||
ECMA_TRY_CATCH (conv_result,
|
||||
ecma_op_to_property_descriptor (arg3, &prop_desc),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_property_descriptor, conv_result, arg3, &prop_desc);
|
||||
|
||||
ECMA_TRY_CATCH (define_own_prop_ret,
|
||||
ecma_op_object_define_own_property (obj_p,
|
||||
name_str_p,
|
||||
&prop_desc,
|
||||
true),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value,
|
||||
ecma_op_object_define_own_property, define_own_prop_ret, obj_p, name_str_p, &prop_desc, true);
|
||||
|
||||
ecma_value_t arg1_copy;
|
||||
ecma_copy_value (arg1_copy, arg1, true);
|
||||
|
||||
ret_value = ecma_make_normal_completion_value (arg1_copy);
|
||||
ecma_make_normal_completion_value (ret_value, arg1_copy);
|
||||
|
||||
ECMA_FINALIZE (define_own_prop_ret);
|
||||
ecma_free_property_descriptor (&prop_desc);
|
||||
ECMA_FINALIZE (conv_result);
|
||||
ECMA_FINALIZE (name_str_value);
|
||||
}
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_object_object_define_property */
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,8 +48,9 @@
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_range_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_range_error_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
@@ -57,26 +58,20 @@ ecma_builtin_range_error_dispatch_call (const ecma_value_t *arguments_list_p, /*
|
||||
if (arguments_list_len != 0
|
||||
&& !ecma_is_value_undefined (arguments_list_p [0]))
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (msg_str_value,
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, msg_str_value, arguments_list_p[0]);
|
||||
|
||||
ecma_string_t *message_string_p = ecma_get_string_from_value (msg_str_value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_RANGE,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (new_error_object_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_str_value);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_RANGE);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (new_error_object_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
}
|
||||
} /* ecma_builtin_range_error_dispatch_call */
|
||||
|
||||
@@ -85,11 +80,12 @@ ecma_builtin_range_error_dispatch_call (const ecma_value_t *arguments_list_p, /*
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_range_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_range_error_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
return ecma_builtin_range_error_dispatch_call (arguments_list_p, arguments_list_len);
|
||||
ecma_builtin_range_error_dispatch_call (ret_value, arguments_list_p, arguments_list_len);
|
||||
} /* ecma_builtin_range_error_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,8 +48,9 @@
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_reference_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_reference_error_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
@@ -57,26 +58,20 @@ ecma_builtin_reference_error_dispatch_call (const ecma_value_t *arguments_list_p
|
||||
if (arguments_list_len != 0
|
||||
&& !ecma_is_value_undefined (arguments_list_p [0]))
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (msg_str_value,
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, msg_str_value, arguments_list_p[0]);
|
||||
|
||||
ecma_string_t *message_string_p = ecma_get_string_from_value (msg_str_value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_REFERENCE,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (new_error_object_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_str_value);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_REFERENCE);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (new_error_object_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
}
|
||||
} /* ecma_builtin_reference_error_dispatch_call */
|
||||
|
||||
@@ -85,11 +80,12 @@ ecma_builtin_reference_error_dispatch_call (const ecma_value_t *arguments_list_p
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_reference_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_reference_error_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
return ecma_builtin_reference_error_dispatch_call (arguments_list_p, arguments_list_len);
|
||||
ecma_builtin_reference_error_dispatch_call (ret_value, arguments_list_p, arguments_list_len);
|
||||
} /* ecma_builtin_reference_error_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,15 +53,17 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_to_string (const ecma_value_t& this_arg) /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_to_string (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg) /**< this argument */
|
||||
{
|
||||
if (ecma_is_value_string (this_arg))
|
||||
{
|
||||
ecma_value_t this_arg_copy;
|
||||
ecma_copy_value (this_arg_copy, this_arg, true);
|
||||
|
||||
return ecma_make_normal_completion_value (this_arg_copy);
|
||||
ecma_make_normal_completion_value (ret_value, this_arg_copy);
|
||||
return;
|
||||
}
|
||||
else if (ecma_is_value_object (this_arg))
|
||||
{
|
||||
@@ -79,11 +81,12 @@ ecma_builtin_string_prototype_object_to_string (const ecma_value_t& this_arg) /*
|
||||
|
||||
prim_value_str_p = ecma_copy_or_ref_ecma_string (prim_value_str_p);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (prim_value_str_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (prim_value_str_p));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
} /* ecma_builtin_string_prototype_object_to_string */
|
||||
|
||||
/**
|
||||
@@ -95,10 +98,11 @@ ecma_builtin_string_prototype_object_to_string (const ecma_value_t& this_arg) /*
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_value_of (const ecma_value_t& this_arg) /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_value_of (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg) /**< this argument */
|
||||
{
|
||||
return ecma_builtin_string_prototype_object_to_string (this_arg);
|
||||
ecma_builtin_string_prototype_object_to_string (ret_value, this_arg);
|
||||
} /* ecma_builtin_string_prototype_object_value_of */
|
||||
|
||||
/**
|
||||
@@ -110,11 +114,12 @@ ecma_builtin_string_prototype_object_value_of (const ecma_value_t& this_arg) /**
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_char_at (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_char_at (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_string_prototype_object_char_at */
|
||||
|
||||
/**
|
||||
@@ -126,11 +131,12 @@ ecma_builtin_string_prototype_object_char_at (const ecma_value_t& this_arg, /**<
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_char_code_at (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_char_code_at (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_string_prototype_object_char_code_at */
|
||||
|
||||
/**
|
||||
@@ -142,12 +148,13 @@ ecma_builtin_string_prototype_object_char_code_at (const ecma_value_t& this_arg,
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_concat (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_concat (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t* argument_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_number) /**< number of arguments */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, argument_list_p, arguments_number);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, argument_list_p, arguments_number);
|
||||
} /* ecma_builtin_string_prototype_object_concat */
|
||||
|
||||
/**
|
||||
@@ -159,12 +166,13 @@ ecma_builtin_string_prototype_object_concat (const ecma_value_t& this_arg, /**<
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_index_of (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_index_of (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg1, /**< routine's first argument */
|
||||
const ecma_value_t& arg2) /**< routine's second argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg1, arg2);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg1, arg2);
|
||||
} /* ecma_builtin_string_prototype_object_index_of */
|
||||
|
||||
/**
|
||||
@@ -176,12 +184,13 @@ ecma_builtin_string_prototype_object_index_of (const ecma_value_t& this_arg, /**
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_last_index_of (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_last_index_of (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg1, /**< routine's first argument */
|
||||
const ecma_value_t& arg2) /**< routine's second argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg1, arg2);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg1, arg2);
|
||||
} /* ecma_builtin_string_prototype_object_last_index_of */
|
||||
|
||||
/**
|
||||
@@ -193,11 +202,12 @@ ecma_builtin_string_prototype_object_last_index_of (const ecma_value_t& this_arg
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_locale_compare (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_locale_compare (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_string_prototype_object_locale_compare */
|
||||
|
||||
/**
|
||||
@@ -209,11 +219,12 @@ ecma_builtin_string_prototype_object_locale_compare (const ecma_value_t& this_ar
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_match (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_match (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_string_prototype_object_match */
|
||||
|
||||
/**
|
||||
@@ -225,12 +236,13 @@ ecma_builtin_string_prototype_object_match (const ecma_value_t& this_arg, /**< t
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_replace (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_replace (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg1, /**< routine's first argument */
|
||||
const ecma_value_t& arg2) /**< routine's second argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg1, arg2);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg1, arg2);
|
||||
} /* ecma_builtin_string_prototype_object_replace */
|
||||
|
||||
/**
|
||||
@@ -242,11 +254,12 @@ ecma_builtin_string_prototype_object_replace (const ecma_value_t& this_arg, /**<
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_search (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_search (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg) /**< routine's argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg);
|
||||
} /* ecma_builtin_string_prototype_object_search */
|
||||
|
||||
/**
|
||||
@@ -258,12 +271,13 @@ ecma_builtin_string_prototype_object_search (const ecma_value_t& this_arg, /**<
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_slice (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_slice (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg1, /**< routine's first argument */
|
||||
const ecma_value_t& arg2) /**< routine's second argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg1, arg2);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg1, arg2);
|
||||
} /* ecma_builtin_string_prototype_object_slice */
|
||||
|
||||
/**
|
||||
@@ -275,12 +289,13 @@ ecma_builtin_string_prototype_object_slice (const ecma_value_t& this_arg, /**< t
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_split (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_split (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg1, /**< routine's first argument */
|
||||
const ecma_value_t& arg2) /**< routine's second argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg1, arg2);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg1, arg2);
|
||||
} /* ecma_builtin_string_prototype_object_split */
|
||||
|
||||
/**
|
||||
@@ -292,12 +307,13 @@ ecma_builtin_string_prototype_object_split (const ecma_value_t& this_arg, /**< t
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_substring (const ecma_value_t& this_arg, /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_substring (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg, /**< this argument */
|
||||
const ecma_value_t& arg1, /**< routine's first argument */
|
||||
const ecma_value_t& arg2) /**< routine's second argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg, arg1, arg2);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg, arg1, arg2);
|
||||
} /* ecma_builtin_string_prototype_object_substring */
|
||||
|
||||
/**
|
||||
@@ -309,10 +325,11 @@ ecma_builtin_string_prototype_object_substring (const ecma_value_t& this_arg, /*
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_to_lower_case (const ecma_value_t& this_arg) /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_to_lower_case (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg) /**< this argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg);
|
||||
} /* ecma_builtin_string_prototype_object_to_lower_case */
|
||||
|
||||
/**
|
||||
@@ -324,10 +341,12 @@ ecma_builtin_string_prototype_object_to_lower_case (const ecma_value_t& this_arg
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_to_locale_lower_case (const ecma_value_t& this_arg) /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_to_locale_lower_case (ecma_completion_value_t &ret_value, /**< out: completion
|
||||
* value */
|
||||
const ecma_value_t& this_arg) /**< this argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg);
|
||||
} /* ecma_builtin_string_prototype_object_to_locale_lower_case */
|
||||
|
||||
/**
|
||||
@@ -339,10 +358,12 @@ ecma_builtin_string_prototype_object_to_locale_lower_case (const ecma_value_t& t
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_to_upper_case (const ecma_value_t& this_arg) /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_to_upper_case (ecma_completion_value_t &ret_value, /**< out: completion
|
||||
* value */
|
||||
const ecma_value_t& this_arg) /**< this argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg);
|
||||
} /* ecma_builtin_string_prototype_object_to_upper_case */
|
||||
|
||||
/**
|
||||
@@ -354,10 +375,12 @@ ecma_builtin_string_prototype_object_to_upper_case (const ecma_value_t& this_arg
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_to_locale_upper_case (const ecma_value_t& this_arg) /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_to_locale_upper_case (ecma_completion_value_t &ret_value, /**< out: completion
|
||||
* value */
|
||||
const ecma_value_t& this_arg) /**< this argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg);
|
||||
} /* ecma_builtin_string_prototype_object_to_locale_upper_case */
|
||||
|
||||
/**
|
||||
@@ -369,10 +392,11 @@ ecma_builtin_string_prototype_object_to_locale_upper_case (const ecma_value_t& t
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_trim (const ecma_value_t& this_arg) /**< this argument */
|
||||
static void
|
||||
ecma_builtin_string_prototype_object_trim (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg) /**< this argument */
|
||||
{
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
|
||||
ECMA_BUILTIN_CP_UNIMPLEMENTED (ret_value, this_arg);
|
||||
} /* ecma_builtin_string_prototype_object_trim */
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,13 +53,12 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_object_from_char_code (const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
static void
|
||||
ecma_builtin_string_object_from_char_code (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& this_arg __unused, /**< 'this' argument */
|
||||
const ecma_value_t args[], /**< arguments list */
|
||||
ecma_length_t args_number) /**< number of arguments */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
size_t zt_str_buffer_size = sizeof (ecma_char_t) * (args_number + 1u);
|
||||
|
||||
ecma_char_t *ret_zt_str_p = (ecma_char_t*) mem_heap_alloc_block (zt_str_buffer_size,
|
||||
@@ -78,7 +77,7 @@ ecma_builtin_string_object_from_char_code (const ecma_value_t& this_arg __unused
|
||||
#if CONFIG_ECMA_CHAR_ENCODING == CONFIG_ECMA_CHAR_ASCII
|
||||
if ((uint16_char_code >> JERRY_BITSINBYTE) != 0)
|
||||
{
|
||||
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -94,7 +93,7 @@ ecma_builtin_string_object_from_char_code (const ecma_value_t& this_arg __unused
|
||||
{
|
||||
mem_heap_free_block (ret_zt_str_p);
|
||||
|
||||
return ret_value;
|
||||
return;
|
||||
}
|
||||
|
||||
JERRY_ASSERT (ecma_is_completion_value_empty (ret_value));
|
||||
@@ -104,7 +103,7 @@ ecma_builtin_string_object_from_char_code (const ecma_value_t& this_arg __unused
|
||||
|
||||
mem_heap_free_block (ret_zt_str_p);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (ret_str_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (ret_str_p));
|
||||
} /* ecma_builtin_string_object_from_char_code */
|
||||
|
||||
/**
|
||||
@@ -112,27 +111,24 @@ ecma_builtin_string_object_from_char_code (const ecma_value_t& this_arg __unused
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_string_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_string_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
if (arguments_list_len == 0)
|
||||
{
|
||||
ecma_string_t *str_p = ecma_new_ecma_string_from_magic_string_id (ECMA_MAGIC_STRING__EMPTY);
|
||||
ecma_value_t str_value (str_p);
|
||||
|
||||
ret_value = ecma_make_normal_completion_value (str_value);
|
||||
ecma_make_normal_completion_value (ret_value, str_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret_value = ecma_op_to_string (arguments_list_p [0]);
|
||||
ecma_op_to_string (ret_value, arguments_list_p [0]);
|
||||
}
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_string_dispatch_call */
|
||||
|
||||
/**
|
||||
@@ -140,13 +136,14 @@ ecma_builtin_string_dispatch_call (const ecma_value_t *arguments_list_p, /**< ar
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_string_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_string_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_op_create_string_object (arguments_list_p, arguments_list_len);
|
||||
ecma_op_create_string_object (ret_value, arguments_list_p, arguments_list_len);
|
||||
} /* ecma_builtin_string_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,8 +48,9 @@
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_syntax_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_syntax_error_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
@@ -57,26 +58,20 @@ ecma_builtin_syntax_error_dispatch_call (const ecma_value_t *arguments_list_p, /
|
||||
if (arguments_list_len != 0
|
||||
&& !ecma_is_value_undefined (arguments_list_p [0]))
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (msg_str_value,
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, msg_str_value, arguments_list_p[0]);
|
||||
|
||||
ecma_string_t *message_string_p = ecma_get_string_from_value (msg_str_value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_SYNTAX,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (new_error_object_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_str_value);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_SYNTAX);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (new_error_object_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
}
|
||||
} /* ecma_builtin_syntax_error_dispatch_call */
|
||||
|
||||
@@ -85,11 +80,12 @@ ecma_builtin_syntax_error_dispatch_call (const ecma_value_t *arguments_list_p, /
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_syntax_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_syntax_error_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
return ecma_builtin_syntax_error_dispatch_call (arguments_list_p, arguments_list_len);
|
||||
ecma_builtin_syntax_error_dispatch_call (ret_value, arguments_list_p, arguments_list_len);
|
||||
} /* ecma_builtin_syntax_error_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,14 +49,15 @@
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_type_error_thrower_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_type_error_thrower_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
/* The object should throw TypeError */
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
} /* ecma_builtin_type_error_thrower_dispatch_call */
|
||||
|
||||
/**
|
||||
@@ -67,14 +68,15 @@ ecma_builtin_type_error_thrower_dispatch_call (const ecma_value_t *arguments_lis
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_type_error_thrower_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_type_error_thrower_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
/* The object is not a constructor */
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
} /* ecma_builtin_type_error_thrower_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,8 +48,9 @@
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_type_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_type_error_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
@@ -57,26 +58,20 @@ ecma_builtin_type_error_dispatch_call (const ecma_value_t *arguments_list_p, /**
|
||||
if (arguments_list_len != 0
|
||||
&& !ecma_is_value_undefined (arguments_list_p [0]))
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (msg_str_value,
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, msg_str_value, arguments_list_p[0]);
|
||||
|
||||
ecma_string_t *message_string_p = ecma_get_string_from_value (msg_str_value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_TYPE,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (new_error_object_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_str_value);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_TYPE);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (new_error_object_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
}
|
||||
} /* ecma_builtin_type_error_dispatch_call */
|
||||
|
||||
@@ -85,11 +80,12 @@ ecma_builtin_type_error_dispatch_call (const ecma_value_t *arguments_list_p, /**
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_type_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_type_error_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
return ecma_builtin_type_error_dispatch_call (arguments_list_p, arguments_list_len);
|
||||
ecma_builtin_type_error_dispatch_call (ret_value, arguments_list_p, arguments_list_len);
|
||||
} /* ecma_builtin_type_error_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,8 +48,9 @@
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_uri_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_uri_error_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
@@ -57,26 +58,20 @@ ecma_builtin_uri_error_dispatch_call (const ecma_value_t *arguments_list_p, /**<
|
||||
if (arguments_list_len != 0
|
||||
&& !ecma_is_value_undefined (arguments_list_p [0]))
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (msg_str_value,
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, msg_str_value, arguments_list_p[0]);
|
||||
|
||||
ecma_string_t *message_string_p = ecma_get_string_from_value (msg_str_value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_URI,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_value_t (new_error_object_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_str_value);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_URI);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (new_error_object_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
}
|
||||
} /* ecma_builtin_uri_error_dispatch_call */
|
||||
|
||||
@@ -85,11 +80,12 @@ ecma_builtin_uri_error_dispatch_call (const ecma_value_t *arguments_list_p, /**<
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_uri_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
void
|
||||
ecma_builtin_uri_error_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
return ecma_builtin_uri_error_dispatch_call (arguments_list_p, arguments_list_len);
|
||||
ecma_builtin_uri_error_dispatch_call (ret_value, arguments_list_p, arguments_list_len);
|
||||
} /* ecma_builtin_uri_error_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,14 +62,17 @@ ecma_builtin_bin_search_for_magic_string_id_in_array (const ecma_magic_string_id
|
||||
object_prototype_builtin_id, \
|
||||
is_extensible, \
|
||||
lowercase_name) \
|
||||
extern ecma_completion_value_t \
|
||||
ecma_builtin_ ## lowercase_name ## _dispatch_call (const ecma_value_t *arguments_list_p, \
|
||||
extern void \
|
||||
ecma_builtin_ ## lowercase_name ## _dispatch_call (ecma_completion_value_t &ret_value, \
|
||||
const ecma_value_t *arguments_list_p, \
|
||||
ecma_length_t arguments_list_len); \
|
||||
extern ecma_completion_value_t \
|
||||
ecma_builtin_ ## lowercase_name ## _dispatch_construct (const ecma_value_t *arguments_list_p, \
|
||||
extern void \
|
||||
ecma_builtin_ ## lowercase_name ## _dispatch_construct (ecma_completion_value_t &ret_value, \
|
||||
const ecma_value_t *arguments_list_p, \
|
||||
ecma_length_t arguments_list_len); \
|
||||
extern ecma_completion_value_t \
|
||||
ecma_builtin_ ## lowercase_name ## _dispatch_routine (ecma_magic_string_id_t builtin_routine_id, \
|
||||
extern void \
|
||||
ecma_builtin_ ## lowercase_name ## _dispatch_routine (ecma_completion_value_t &ret_value, \
|
||||
ecma_magic_string_id_t builtin_routine_id, \
|
||||
const ecma_value_t& this_arg_value, \
|
||||
const ecma_value_t arguments_list [], \
|
||||
ecma_length_t arguments_number); \
|
||||
@@ -92,7 +95,8 @@ ecma_builtin_ ## lowercase_name ## _sort_property_names (void);
|
||||
jerry_ref_unused_variables (0, __VA_ARGS__); \
|
||||
} \
|
||||
ecma_object_t *cp_error_p = ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR); \
|
||||
return ecma_make_throw_obj_completion_value (cp_error_p); \
|
||||
ecma_make_throw_obj_completion_value (ret_value, cp_error_p); \
|
||||
return; \
|
||||
}
|
||||
#endif /* CONFIG_ECMA_COMPACT_PROFILE */
|
||||
|
||||
|
||||
@@ -31,8 +31,9 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_dispatch_routine (ecma_builtin_id_t builtin_object_id,
|
||||
static void
|
||||
ecma_builtin_dispatch_routine (ecma_completion_value_t &ret_value,
|
||||
ecma_builtin_id_t builtin_object_id,
|
||||
ecma_magic_string_id_t builtin_routine_id,
|
||||
const ecma_value_t& this_arg_value,
|
||||
const ecma_value_t arguments_list [],
|
||||
@@ -358,8 +359,9 @@ ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id, /**
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_dispatch_call (ecma_object_t *obj_p, /**< built-in object */
|
||||
void
|
||||
ecma_builtin_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< built-in object */
|
||||
const ecma_value_t& this_arg_value, /**< 'this' argument value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< length of the arguments list */
|
||||
@@ -386,11 +388,13 @@ ecma_builtin_dispatch_call (ecma_object_t *obj_p, /**< built-in object */
|
||||
ecma_builtin_id_t built_in_id = (ecma_builtin_id_t) built_in_id_field;
|
||||
ecma_magic_string_id_t routine_id = (ecma_magic_string_id_t) routine_id_field;
|
||||
|
||||
return ecma_builtin_dispatch_routine (built_in_id,
|
||||
routine_id,
|
||||
this_arg_value,
|
||||
arguments_list_p,
|
||||
arguments_list_len);
|
||||
ecma_builtin_dispatch_routine (ret_value,
|
||||
built_in_id,
|
||||
routine_id,
|
||||
this_arg_value,
|
||||
arguments_list_p,
|
||||
arguments_list_len);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -414,8 +418,10 @@ ecma_builtin_dispatch_call (ecma_object_t *obj_p, /**< built-in object */
|
||||
{ \
|
||||
if (object_type == ECMA_OBJECT_TYPE_FUNCTION) \
|
||||
{ \
|
||||
return ecma_builtin_ ## lowercase_name ## _dispatch_call (arguments_list_p, \
|
||||
arguments_list_len); \
|
||||
ecma_builtin_ ## lowercase_name ## _dispatch_call (ret_value, \
|
||||
arguments_list_p, \
|
||||
arguments_list_len); \
|
||||
return; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
@@ -448,8 +454,9 @@ ecma_builtin_dispatch_call (ecma_object_t *obj_p, /**< built-in object */
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_dispatch_construct (ecma_object_t *obj_p, /**< built-in object */
|
||||
void
|
||||
ecma_builtin_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< built-in object */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< length of the arguments list */
|
||||
{
|
||||
@@ -476,8 +483,10 @@ ecma_builtin_dispatch_construct (ecma_object_t *obj_p, /**< built-in object */
|
||||
{ \
|
||||
if (object_type == ECMA_OBJECT_TYPE_FUNCTION) \
|
||||
{ \
|
||||
return ecma_builtin_ ## lowercase_name ## _dispatch_construct (arguments_list_p, \
|
||||
arguments_list_len); \
|
||||
ecma_builtin_ ## lowercase_name ## _dispatch_construct (ret_value, \
|
||||
arguments_list_p, \
|
||||
arguments_list_len); \
|
||||
return; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
@@ -510,8 +519,9 @@ ecma_builtin_dispatch_construct (ecma_object_t *obj_p, /**< built-in object */
|
||||
* @return completion-value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_dispatch_routine (ecma_builtin_id_t builtin_object_id, /**< built-in object' identifier */
|
||||
static void
|
||||
ecma_builtin_dispatch_routine (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_builtin_id_t builtin_object_id, /**< built-in object' identifier */
|
||||
ecma_magic_string_id_t builtin_routine_id, /**< name of the built-in object's
|
||||
routine property */
|
||||
const ecma_value_t& this_arg_value, /**< 'this' argument value */
|
||||
@@ -528,10 +538,12 @@ ecma_builtin_dispatch_routine (ecma_builtin_id_t builtin_object_id, /**< built-i
|
||||
lowercase_name) \
|
||||
case builtin_id: \
|
||||
{ \
|
||||
return ecma_builtin_ ## lowercase_name ## _dispatch_routine (builtin_routine_id, \
|
||||
this_arg_value, \
|
||||
arguments_list, \
|
||||
arguments_number); \
|
||||
ecma_builtin_ ## lowercase_name ## _dispatch_routine (ret_value, \
|
||||
builtin_routine_id, \
|
||||
this_arg_value, \
|
||||
arguments_list, \
|
||||
arguments_number); \
|
||||
return; \
|
||||
}
|
||||
#include "ecma-builtins.inc.h"
|
||||
|
||||
|
||||
@@ -39,13 +39,15 @@ typedef enum
|
||||
extern void ecma_init_builtins (void);
|
||||
extern void ecma_finalize_builtins (void);
|
||||
|
||||
extern ecma_completion_value_t
|
||||
ecma_builtin_dispatch_call (ecma_object_t *obj_p,
|
||||
extern void
|
||||
ecma_builtin_dispatch_call (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_value_t& this_arg,
|
||||
const ecma_value_t *arguments_list_p,
|
||||
ecma_length_t arguments_list_len);
|
||||
extern ecma_completion_value_t
|
||||
ecma_builtin_dispatch_construct (ecma_object_t *obj_p,
|
||||
extern void
|
||||
ecma_builtin_dispatch_construct (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_value_t *arguments_list_p,
|
||||
ecma_length_t arguments_list_len);
|
||||
extern ecma_property_t*
|
||||
|
||||
@@ -30,7 +30,6 @@ JERRY_STATIC_ASSERT (ECMA_OBJECT_LEX_ENV_TYPE_SIZE <= sizeof (uint64_t) * JERRY_
|
||||
JERRY_STATIC_ASSERT (sizeof (ecma_collection_header_t) == sizeof (uint64_t));
|
||||
JERRY_STATIC_ASSERT (sizeof (ecma_collection_chunk_t) == sizeof (uint64_t));
|
||||
JERRY_STATIC_ASSERT (sizeof (ecma_string_t) == sizeof (uint64_t));
|
||||
JERRY_STATIC_ASSERT (sizeof (ecma_completion_value_t) == sizeof (uint32_t));
|
||||
JERRY_STATIC_ASSERT (sizeof (ecma_label_descriptor_t) == sizeof (uint64_t));
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -183,15 +183,16 @@ ecma_free_value (ecma_value_t& value, /**< value description */
|
||||
*
|
||||
* @return 'throw' completion value
|
||||
*/
|
||||
ecma_completion_value_t __attribute_const__
|
||||
ecma_make_throw_obj_completion_value (ecma_object_t *exception_p) /**< an object */
|
||||
void
|
||||
ecma_make_throw_obj_completion_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *exception_p) /**< an object */
|
||||
{
|
||||
JERRY_ASSERT(exception_p != NULL
|
||||
&& !ecma_is_lexical_environment (exception_p));
|
||||
|
||||
ecma_value_t exception (exception_p);
|
||||
|
||||
return ecma_make_throw_completion_value (exception);
|
||||
ecma_make_throw_completion_value (ret_value, exception);
|
||||
} /* ecma_make_throw_obj_completion_value */
|
||||
|
||||
/**
|
||||
@@ -199,10 +200,11 @@ ecma_make_throw_obj_completion_value (ecma_object_t *exception_p) /**< an object
|
||||
*
|
||||
* @return (source.type, ecma_copy_value (source.value), source.target).
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_copy_completion_value (ecma_completion_value_t value) /**< completion value */
|
||||
void
|
||||
ecma_copy_completion_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_completion_value_t& value) /**< completion value */
|
||||
{
|
||||
const ecma_completion_type_t type = ecma_get_completion_value_type_field (value);
|
||||
const ecma_completion_type_t type = (ecma_completion_type_t) (value);
|
||||
const bool is_type_ok = (type == ECMA_COMPLETION_TYPE_NORMAL
|
||||
#ifdef CONFIG_ECMA_EXCEPTION_SUPPORT
|
||||
|| type == ECMA_COMPLETION_TYPE_THROW
|
||||
@@ -212,22 +214,21 @@ ecma_copy_completion_value (ecma_completion_value_t value) /**< completion value
|
||||
|
||||
JERRY_ASSERT (is_type_ok);
|
||||
|
||||
ecma_value_t v;
|
||||
ecma_get_completion_value_value_field (v, value);
|
||||
ecma_value_t v ((ecma_value_packed_t) value);
|
||||
|
||||
ecma_value_t value_copy;
|
||||
ecma_copy_value (value_copy, v, true);
|
||||
|
||||
return ecma_make_completion_value (type, value_copy);
|
||||
ecma_make_completion_value (ret_value, type, value_copy);
|
||||
} /* ecma_copy_completion_value */
|
||||
|
||||
/**
|
||||
* Free the completion value.
|
||||
*/
|
||||
void
|
||||
ecma_free_completion_value (ecma_completion_value_t completion_value) /**< completion value */
|
||||
ecma_free_completion_value (ecma_completion_value_t& completion_value) /**< completion value */
|
||||
{
|
||||
switch (ecma_get_completion_value_type_field (completion_value))
|
||||
switch ((ecma_completion_type_t) (completion_value))
|
||||
{
|
||||
case ECMA_COMPLETION_TYPE_NORMAL:
|
||||
#ifdef CONFIG_ECMA_EXCEPTION_SUPPORT
|
||||
@@ -235,17 +236,15 @@ ecma_free_completion_value (ecma_completion_value_t completion_value) /**< compl
|
||||
#endif /* CONFIG_ECMA_EXCEPTION_SUPPORT */
|
||||
case ECMA_COMPLETION_TYPE_RETURN:
|
||||
{
|
||||
ecma_value_t v;
|
||||
ecma_get_completion_value_value_field (v, completion_value);
|
||||
ecma_value_t v ((ecma_value_packed_t) completion_value);
|
||||
|
||||
ecma_free_value (v, true);
|
||||
break;
|
||||
}
|
||||
case ECMA_COMPLETION_TYPE_EXIT:
|
||||
{
|
||||
ecma_value_t v;
|
||||
ecma_value_t v ((ecma_value_packed_t) completion_value);
|
||||
|
||||
ecma_get_completion_value_value_field (v, completion_value);
|
||||
JERRY_ASSERT(ecma_get_value_type_field (v) == ECMA_TYPE_SIMPLE);
|
||||
|
||||
break;
|
||||
@@ -255,6 +254,8 @@ ecma_free_completion_value (ecma_completion_value_t completion_value) /**< compl
|
||||
JERRY_UNREACHABLE ();
|
||||
}
|
||||
}
|
||||
|
||||
ecma_make_empty_completion_value (completion_value);
|
||||
} /* ecma_free_completion_value */
|
||||
|
||||
/**
|
||||
|
||||
+100
-148
@@ -173,33 +173,44 @@ class ecma_value_t
|
||||
* Description of a block completion value
|
||||
*
|
||||
* See also: ECMA-262 v5, 8.9.
|
||||
*
|
||||
*
|
||||
* Bit-field structure: type (8) | padding (8) | value (16)
|
||||
*
|
||||
*/
|
||||
typedef uint32_t ecma_completion_value_t;
|
||||
class ecma_completion_value_t : public ecma_value_t
|
||||
{
|
||||
public:
|
||||
/* Constructors */
|
||||
ecma_completion_value_t ()
|
||||
: ecma_value_t (),
|
||||
_type (ECMA_COMPLETION_TYPE_NORMAL) { }
|
||||
|
||||
/**
|
||||
* Type (ecma_completion_type_t)
|
||||
*/
|
||||
#define ECMA_COMPLETION_VALUE_TYPE_POS (0)
|
||||
#define ECMA_COMPLETION_VALUE_TYPE_WIDTH (8)
|
||||
ecma_completion_value_t (ecma_completion_type_t type,
|
||||
const ecma_value_t &value)
|
||||
: ecma_value_t ((ecma_value_packed_t) value),
|
||||
_type (type) { }
|
||||
|
||||
/**
|
||||
* Padding (1 byte)
|
||||
*/
|
||||
#define ECMA_COMPLETION_VALUE_PADDING_WIDTH (8)
|
||||
/* Assignment operators */
|
||||
ecma_completion_value_t & operator = (ecma_completion_type_t type)
|
||||
{
|
||||
_type = type;
|
||||
|
||||
/**
|
||||
* Value
|
||||
*
|
||||
* Used for normal, return, throw and exit completion types.
|
||||
*/
|
||||
#define ECMA_COMPLETION_VALUE_VALUE_POS (ECMA_COMPLETION_VALUE_TYPE_POS + \
|
||||
ECMA_COMPLETION_VALUE_TYPE_WIDTH + \
|
||||
ECMA_COMPLETION_VALUE_PADDING_WIDTH)
|
||||
#define ECMA_COMPLETION_VALUE_VALUE_WIDTH (ECMA_VALUE_SIZE)
|
||||
return *this;
|
||||
}
|
||||
|
||||
ecma_completion_value_t & operator = (const ecma_value_t& value)
|
||||
{
|
||||
*static_cast<ecma_value_t*> (this) = (ecma_value_packed_t) value;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* Completion type extraction */
|
||||
explicit operator ecma_completion_type_t () const
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
private:
|
||||
ecma_completion_type_t _type; /**< completion type */
|
||||
};
|
||||
|
||||
/**
|
||||
* Get type field of ecma-value
|
||||
@@ -338,72 +349,14 @@ extern ecma_object_t* __attribute_pure__ ecma_get_object_from_value (const ecma_
|
||||
extern void ecma_copy_value (ecma_value_t &ret, const ecma_value_t& value, bool do_ref_if_object);
|
||||
extern void ecma_free_value (ecma_value_t& value, bool do_deref_if_object);
|
||||
|
||||
/**
|
||||
* Get type field of completion value
|
||||
*
|
||||
* @return type field
|
||||
*/
|
||||
inline ecma_completion_type_t __attribute_const__ __attribute_always_inline__
|
||||
ecma_get_completion_value_type_field (ecma_completion_value_t completion_value) /**< completion value */
|
||||
{
|
||||
return (ecma_completion_type_t) jrt_extract_bit_field (completion_value,
|
||||
ECMA_COMPLETION_VALUE_TYPE_POS,
|
||||
ECMA_COMPLETION_VALUE_TYPE_WIDTH);
|
||||
} /* ecma_get_completion_value_type_field */
|
||||
|
||||
/**
|
||||
* Get value field of completion value
|
||||
*
|
||||
* @return value field
|
||||
*/
|
||||
inline void __attribute_always_inline__
|
||||
ecma_get_completion_value_value_field (ecma_value_t &ret, /**< out: ecma-value */
|
||||
ecma_completion_value_t completion_value) /**< completion value */
|
||||
{
|
||||
ret = (ecma_value_packed_t) jrt_extract_bit_field (completion_value,
|
||||
ECMA_COMPLETION_VALUE_VALUE_POS,
|
||||
ECMA_COMPLETION_VALUE_VALUE_WIDTH);
|
||||
} /* ecma_get_completion_value_value_field */
|
||||
|
||||
/**
|
||||
* Set type field of completion value
|
||||
*
|
||||
* @return completion value with updated field
|
||||
*/
|
||||
inline ecma_completion_value_t __attribute_const__ __attribute_always_inline__
|
||||
ecma_set_completion_value_type_field (ecma_completion_value_t completion_value, /**< completion value
|
||||
* to set field in */
|
||||
ecma_completion_type_t type_field) /**< new field value */
|
||||
{
|
||||
return (ecma_completion_value_t) jrt_set_bit_field_value (completion_value,
|
||||
type_field,
|
||||
ECMA_COMPLETION_VALUE_TYPE_POS,
|
||||
ECMA_COMPLETION_VALUE_TYPE_WIDTH);
|
||||
} /* ecma_set_completion_value_type_field */
|
||||
|
||||
/**
|
||||
* Set value field of completion value
|
||||
*
|
||||
* @return completion value with updated field
|
||||
*/
|
||||
inline ecma_completion_value_t __attribute_pure__ __attribute_always_inline__
|
||||
ecma_set_completion_value_value_field (ecma_completion_value_t completion_value, /**< completion value
|
||||
* to set field in */
|
||||
const ecma_value_t& value_field) /**< new field value */
|
||||
{
|
||||
return (ecma_completion_value_t) jrt_set_bit_field_value (completion_value,
|
||||
(ecma_value_packed_t) value_field,
|
||||
ECMA_COMPLETION_VALUE_VALUE_POS,
|
||||
ECMA_COMPLETION_VALUE_VALUE_WIDTH);
|
||||
} /* ecma_set_completion_value_value_field */
|
||||
|
||||
/**
|
||||
* Normal, throw, return, exit and meta completion values constructor
|
||||
*
|
||||
* @return completion value
|
||||
*/
|
||||
inline ecma_completion_value_t __attribute_pure__ __attribute_always_inline__
|
||||
ecma_make_completion_value (ecma_completion_type_t type, /**< type */
|
||||
inline void __attribute_always_inline__
|
||||
ecma_make_completion_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_completion_type_t type, /**< type */
|
||||
const ecma_value_t& value) /**< value */
|
||||
{
|
||||
const bool is_type_ok = (type == ECMA_COMPLETION_TYPE_NORMAL
|
||||
@@ -417,14 +370,8 @@ ecma_make_completion_value (ecma_completion_type_t type, /**< type */
|
||||
|
||||
JERRY_ASSERT (is_type_ok);
|
||||
|
||||
ecma_completion_value_t completion_value = 0;
|
||||
|
||||
completion_value = ecma_set_completion_value_type_field (completion_value,
|
||||
type);
|
||||
completion_value = ecma_set_completion_value_value_field (completion_value,
|
||||
value);
|
||||
|
||||
return completion_value;
|
||||
ret_value = type;
|
||||
ret_value = value;
|
||||
} /* ecma_make_completion_value */
|
||||
|
||||
/**
|
||||
@@ -432,16 +379,18 @@ ecma_make_completion_value (ecma_completion_type_t type, /**< type */
|
||||
*
|
||||
* @return completion value
|
||||
*/
|
||||
inline ecma_completion_value_t __attribute_const__ __attribute_always_inline__
|
||||
ecma_make_simple_completion_value (ecma_simple_value_t simple_value) /**< simple ecma-value */
|
||||
inline void __attribute_always_inline__
|
||||
ecma_make_simple_completion_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_simple_value_t simple_value) /**< simple ecma-value */
|
||||
{
|
||||
JERRY_ASSERT(simple_value == ECMA_SIMPLE_VALUE_UNDEFINED
|
||||
|| simple_value == ECMA_SIMPLE_VALUE_NULL
|
||||
|| simple_value == ECMA_SIMPLE_VALUE_FALSE
|
||||
|| simple_value == ECMA_SIMPLE_VALUE_TRUE);
|
||||
|
||||
return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL,
|
||||
ecma_value_t (simple_value));
|
||||
ecma_make_completion_value (ret_value,
|
||||
ECMA_COMPLETION_TYPE_NORMAL,
|
||||
ecma_value_t (simple_value));
|
||||
} /* ecma_make_simple_completion_value */
|
||||
|
||||
/**
|
||||
@@ -449,10 +398,11 @@ ecma_make_simple_completion_value (ecma_simple_value_t simple_value) /**< simple
|
||||
*
|
||||
* @return completion value
|
||||
*/
|
||||
inline ecma_completion_value_t __attribute_pure__ __attribute_always_inline__
|
||||
ecma_make_normal_completion_value (const ecma_value_t& value) /**< value */
|
||||
inline void __attribute_always_inline__
|
||||
ecma_make_normal_completion_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& value) /**< value */
|
||||
{
|
||||
return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, value);
|
||||
ecma_make_completion_value (ret_value, ECMA_COMPLETION_TYPE_NORMAL, value);
|
||||
} /* ecma_make_normal_completion_value */
|
||||
|
||||
/**
|
||||
@@ -460,11 +410,12 @@ ecma_make_normal_completion_value (const ecma_value_t& value) /**< value */
|
||||
*
|
||||
* @return completion value
|
||||
*/
|
||||
inline ecma_completion_value_t __attribute_pure__ __attribute_always_inline__
|
||||
ecma_make_throw_completion_value (const ecma_value_t& value) /**< value */
|
||||
inline void __attribute_always_inline__
|
||||
ecma_make_throw_completion_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& value) /**< value */
|
||||
{
|
||||
#ifdef CONFIG_ECMA_EXCEPTION_SUPPORT
|
||||
return ecma_make_completion_value (ECMA_COMPLETION_TYPE_THROW, value);
|
||||
ecma_make_completion_value (ret_value, ECMA_COMPLETION_TYPE_THROW, value);
|
||||
#else /* CONFIG_ECMA_EXCEPTION_SUPPORT */
|
||||
(void) value;
|
||||
|
||||
@@ -472,18 +423,19 @@ ecma_make_throw_completion_value (const ecma_value_t& value) /**< value */
|
||||
#endif /* !CONFIG_ECMA_EXCEPTION_SUPPORT */
|
||||
} /* ecma_make_throw_completion_value */
|
||||
|
||||
extern ecma_completion_value_t ecma_make_throw_obj_completion_value (ecma_object_t *exception_p);
|
||||
extern void ecma_make_throw_obj_completion_value (ecma_completion_value_t &ret_value, ecma_object_t *exception_p);
|
||||
|
||||
/**
|
||||
* Empty completion value constructor.
|
||||
*
|
||||
* @return (normal, empty, reserved) completion value.
|
||||
*/
|
||||
inline ecma_completion_value_t __attribute_const__ __attribute_always_inline__
|
||||
ecma_make_empty_completion_value (void)
|
||||
inline void __attribute_always_inline__
|
||||
ecma_make_empty_completion_value (ecma_completion_value_t &ret_value) /**< out: completion value */
|
||||
{
|
||||
return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL,
|
||||
ecma_value_t ());
|
||||
ecma_make_completion_value (ret_value,
|
||||
ECMA_COMPLETION_TYPE_NORMAL,
|
||||
ecma_value_t ());
|
||||
} /* ecma_make_empty_completion_value */
|
||||
|
||||
/**
|
||||
@@ -491,10 +443,11 @@ ecma_make_empty_completion_value (void)
|
||||
*
|
||||
* @return completion value
|
||||
*/
|
||||
inline ecma_completion_value_t __attribute_pure__ __attribute_always_inline__
|
||||
ecma_make_return_completion_value (const ecma_value_t& value) /**< value */
|
||||
inline void __attribute_always_inline__
|
||||
ecma_make_return_completion_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& value) /**< value */
|
||||
{
|
||||
return ecma_make_completion_value (ECMA_COMPLETION_TYPE_RETURN, value);
|
||||
ecma_make_completion_value (ret_value, ECMA_COMPLETION_TYPE_RETURN, value);
|
||||
} /* ecma_make_return_completion_value */
|
||||
|
||||
/**
|
||||
@@ -502,14 +455,16 @@ ecma_make_return_completion_value (const ecma_value_t& value) /**< value */
|
||||
*
|
||||
* @return completion value
|
||||
*/
|
||||
inline ecma_completion_value_t __attribute_const__ __attribute_always_inline__
|
||||
ecma_make_exit_completion_value (bool is_successful) /**< does completion value indicate
|
||||
inline void __attribute_always_inline__
|
||||
ecma_make_exit_completion_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
bool is_successful) /**< does completion value indicate
|
||||
successfulness completion
|
||||
of script execution (true) or not (false) */
|
||||
{
|
||||
return ecma_make_completion_value (ECMA_COMPLETION_TYPE_EXIT,
|
||||
ecma_value_t (is_successful ? ECMA_SIMPLE_VALUE_TRUE
|
||||
: ECMA_SIMPLE_VALUE_FALSE));
|
||||
ecma_make_completion_value (ret_value,
|
||||
ECMA_COMPLETION_TYPE_EXIT,
|
||||
ecma_value_t (is_successful ? ECMA_SIMPLE_VALUE_TRUE
|
||||
: ECMA_SIMPLE_VALUE_FALSE));
|
||||
} /* ecma_make_exit_completion_value */
|
||||
|
||||
/**
|
||||
@@ -517,11 +472,12 @@ ecma_make_exit_completion_value (bool is_successful) /**< does completion value
|
||||
*
|
||||
* @return completion value
|
||||
*/
|
||||
inline ecma_completion_value_t __attribute_const__ __attribute_always_inline__
|
||||
ecma_make_meta_completion_value (void)
|
||||
inline void __attribute_always_inline__
|
||||
ecma_make_meta_completion_value (ecma_completion_value_t &ret_value) /**< out: completion value */
|
||||
{
|
||||
return ecma_make_completion_value (ECMA_COMPLETION_TYPE_META,
|
||||
ecma_value_t (ECMA_SIMPLE_VALUE_EMPTY));
|
||||
ecma_make_completion_value (ret_value,
|
||||
ECMA_COMPLETION_TYPE_META,
|
||||
ecma_value_t (ECMA_SIMPLE_VALUE_EMPTY));
|
||||
} /* ecma_make_meta_completion_value */
|
||||
|
||||
/**
|
||||
@@ -531,9 +487,9 @@ ecma_make_meta_completion_value (void)
|
||||
*/
|
||||
inline void __attribute_always_inline__
|
||||
ecma_get_completion_value_value (ecma_value_t &ret, /**< out: ecma-value */
|
||||
ecma_completion_value_t completion_value) /**< completion value */
|
||||
const ecma_completion_value_t& completion_value) /**< completion value */
|
||||
{
|
||||
const ecma_completion_type_t type = ecma_get_completion_value_type_field (completion_value);
|
||||
const ecma_completion_type_t type = (ecma_completion_type_t) completion_value;
|
||||
|
||||
const bool is_type_ok = (type == ECMA_COMPLETION_TYPE_NORMAL
|
||||
#ifdef CONFIG_ECMA_EXCEPTION_SUPPORT
|
||||
@@ -544,11 +500,11 @@ ecma_get_completion_value_value (ecma_value_t &ret, /**< out: ecma-value */
|
||||
|
||||
JERRY_ASSERT (is_type_ok);
|
||||
|
||||
ecma_get_completion_value_value_field (ret, completion_value);
|
||||
ret = (ecma_value_packed_t) completion_value;
|
||||
} /* ecma_get_completion_value_value */
|
||||
|
||||
extern ecma_completion_value_t ecma_copy_completion_value (ecma_completion_value_t value);
|
||||
extern void ecma_free_completion_value (ecma_completion_value_t completion_value);
|
||||
extern void ecma_copy_completion_value (ecma_completion_value_t& ret_value, const ecma_completion_value_t& value);
|
||||
extern void ecma_free_completion_value (ecma_completion_value_t& completion_value);
|
||||
|
||||
/**
|
||||
* Check if the completion value is normal value.
|
||||
@@ -557,9 +513,9 @@ extern void ecma_free_completion_value (ecma_completion_value_t completion_value
|
||||
* false - otherwise.
|
||||
*/
|
||||
inline bool __attribute_const__ __attribute_always_inline__
|
||||
ecma_is_completion_value_normal (ecma_completion_value_t value) /**< completion value */
|
||||
ecma_is_completion_value_normal (const ecma_completion_value_t& value) /**< completion value */
|
||||
{
|
||||
return (ecma_get_completion_value_type_field (value) == ECMA_COMPLETION_TYPE_NORMAL);
|
||||
return ((ecma_completion_type_t) value == ECMA_COMPLETION_TYPE_NORMAL);
|
||||
} /* ecma_is_completion_value_normal */
|
||||
|
||||
/**
|
||||
@@ -569,10 +525,10 @@ ecma_is_completion_value_normal (ecma_completion_value_t value) /**< completion
|
||||
* false - otherwise.
|
||||
*/
|
||||
inline bool __attribute_const__ __attribute_always_inline__
|
||||
ecma_is_completion_value_throw (ecma_completion_value_t value) /**< completion value */
|
||||
ecma_is_completion_value_throw (const ecma_completion_value_t& value) /**< completion value */
|
||||
{
|
||||
#ifdef CONFIG_ECMA_EXCEPTION_SUPPORT
|
||||
return (ecma_get_completion_value_type_field (value) == ECMA_COMPLETION_TYPE_THROW);
|
||||
return ((ecma_completion_type_t) value == ECMA_COMPLETION_TYPE_THROW);
|
||||
#else /* CONFIG_ECMA_EXCEPTION_SUPPORT */
|
||||
(void) value;
|
||||
|
||||
@@ -587,9 +543,9 @@ ecma_is_completion_value_throw (ecma_completion_value_t value) /**< completion v
|
||||
* false - otherwise.
|
||||
*/
|
||||
inline bool __attribute_const__ __attribute_always_inline__
|
||||
ecma_is_completion_value_return (ecma_completion_value_t value) /**< completion value */
|
||||
ecma_is_completion_value_return (const ecma_completion_value_t& value) /**< completion value */
|
||||
{
|
||||
return (ecma_get_completion_value_type_field (value) == ECMA_COMPLETION_TYPE_RETURN);
|
||||
return ((ecma_completion_type_t) value == ECMA_COMPLETION_TYPE_RETURN);
|
||||
} /* ecma_is_completion_value_return */
|
||||
|
||||
/**
|
||||
@@ -599,14 +555,12 @@ ecma_is_completion_value_return (ecma_completion_value_t value) /**< completion
|
||||
* false - otherwise.
|
||||
*/
|
||||
inline bool __attribute_const__ __attribute_always_inline__
|
||||
ecma_is_completion_value_exit (ecma_completion_value_t value) /**< completion value */
|
||||
ecma_is_completion_value_exit (const ecma_completion_value_t& value) /**< completion value */
|
||||
{
|
||||
if (ecma_get_completion_value_type_field (value) == ECMA_COMPLETION_TYPE_EXIT)
|
||||
if ((ecma_completion_type_t) value == ECMA_COMPLETION_TYPE_EXIT)
|
||||
{
|
||||
#ifndef JERRY_NDEBUG
|
||||
ecma_value_t v;
|
||||
|
||||
ecma_get_completion_value_value_field (v, value);
|
||||
ecma_value_t v ((ecma_value_packed_t) value);
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_boolean (v));
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
@@ -626,14 +580,12 @@ ecma_is_completion_value_exit (ecma_completion_value_t value) /**< completion va
|
||||
* false - otherwise.
|
||||
*/
|
||||
inline bool __attribute_const__ __attribute_always_inline__
|
||||
ecma_is_completion_value_meta (ecma_completion_value_t value) /**< completion value */
|
||||
ecma_is_completion_value_meta (const ecma_completion_value_t& value) /**< completion value */
|
||||
{
|
||||
if (ecma_get_completion_value_type_field (value) == ECMA_COMPLETION_TYPE_META)
|
||||
if ((ecma_completion_type_t) value == ECMA_COMPLETION_TYPE_META)
|
||||
{
|
||||
#ifndef JERRY_NDEBUG
|
||||
ecma_value_t v;
|
||||
|
||||
ecma_get_completion_value_value_field (v, value);
|
||||
ecma_value_t v ((ecma_value_packed_t) value);
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_empty (v));
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
@@ -654,11 +606,13 @@ ecma_is_completion_value_meta (ecma_completion_value_t value) /**< completion va
|
||||
* false - otherwise.
|
||||
*/
|
||||
inline bool __attribute_const__ __attribute_always_inline__
|
||||
ecma_is_completion_value_normal_simple_value (ecma_completion_value_t value, /**< completion value */
|
||||
ecma_is_completion_value_normal_simple_value (const ecma_completion_value_t& value, /**< completion value */
|
||||
ecma_simple_value_t simple_value) /**< simple value to check
|
||||
for equality with */
|
||||
{
|
||||
return (value == ecma_make_simple_completion_value (simple_value));
|
||||
return (ecma_is_completion_value_normal (value)
|
||||
&& ecma_get_value_type_field (value) == ECMA_TYPE_SIMPLE
|
||||
&& ecma_get_value_value_field (value) == simple_value);
|
||||
} /* ecma_is_completion_value_normal_simple_value */
|
||||
|
||||
/**
|
||||
@@ -669,7 +623,7 @@ ecma_is_completion_value_normal_simple_value (ecma_completion_value_t value, /**
|
||||
* false - otherwise.
|
||||
*/
|
||||
inline bool __attribute_const__ __attribute_always_inline__
|
||||
ecma_is_completion_value_normal_true (ecma_completion_value_t value) /**< completion value */
|
||||
ecma_is_completion_value_normal_true (const ecma_completion_value_t& value) /**< completion value */
|
||||
{
|
||||
return ecma_is_completion_value_normal_simple_value (value, ECMA_SIMPLE_VALUE_TRUE);
|
||||
} /* ecma_is_completion_value_normal_true */
|
||||
@@ -682,7 +636,7 @@ ecma_is_completion_value_normal_true (ecma_completion_value_t value) /**< comple
|
||||
* false - otherwise.
|
||||
*/
|
||||
inline bool __attribute_const__ __attribute_always_inline__
|
||||
ecma_is_completion_value_normal_false (ecma_completion_value_t value) /**< completion value */
|
||||
ecma_is_completion_value_normal_false (const ecma_completion_value_t& value) /**< completion value */
|
||||
{
|
||||
return ecma_is_completion_value_normal_simple_value (value, ECMA_SIMPLE_VALUE_FALSE);
|
||||
} /* ecma_is_completion_value_normal_false */
|
||||
@@ -695,13 +649,11 @@ ecma_is_completion_value_normal_false (ecma_completion_value_t value) /**< compl
|
||||
* false - otherwise.
|
||||
*/
|
||||
inline bool __attribute_const__ __attribute_always_inline__
|
||||
ecma_is_completion_value_empty (ecma_completion_value_t value) /**< completion value */
|
||||
ecma_is_completion_value_empty (const ecma_completion_value_t& value) /**< completion value */
|
||||
{
|
||||
if (ecma_is_completion_value_normal (value))
|
||||
{
|
||||
ecma_value_t v;
|
||||
|
||||
ecma_get_completion_value_value_field (v, value);
|
||||
ecma_value_t v ((ecma_value_packed_t) value);
|
||||
|
||||
return ecma_is_value_empty (v);
|
||||
}
|
||||
|
||||
@@ -37,16 +37,17 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_reject (bool is_throw) /**< Throw flag */
|
||||
static void
|
||||
ecma_reject (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
bool is_throw) /**< Throw flag */
|
||||
{
|
||||
if (is_throw)
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_FALSE);
|
||||
}
|
||||
} /* ecma_reject */
|
||||
|
||||
@@ -59,8 +60,9 @@ ecma_reject (bool is_throw) /**< Throw flag */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_create_array_object (const ecma_value_t *arguments_list_p, /**< list of arguments that
|
||||
void
|
||||
ecma_op_create_array_object (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< list of arguments that
|
||||
are passed to Array constructor */
|
||||
ecma_length_t arguments_list_len, /**< length of the arguments' list */
|
||||
bool is_treat_single_arg_as_length) /**< if the value is true,
|
||||
@@ -85,7 +87,8 @@ ecma_op_create_array_object (const ecma_value_t *arguments_list_p, /**< list of
|
||||
uint32_t num_uint32 = ecma_number_to_uint32 (*num_p);
|
||||
if (*num_p != ecma_uint32_to_number (num_uint32))
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_RANGE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_RANGE));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -145,15 +148,18 @@ ecma_op_create_array_object (const ecma_value_t *arguments_list_p, /**< list of
|
||||
item_prop_desc.is_configurable = true;
|
||||
}
|
||||
|
||||
ecma_op_object_define_own_property (obj_p,
|
||||
ecma_op_object_define_own_property (ret_value,
|
||||
obj_p,
|
||||
item_name_string_p,
|
||||
&item_prop_desc,
|
||||
false);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (ret_value)
|
||||
|| ecma_is_completion_value_normal_false (ret_value));
|
||||
|
||||
ecma_deref_ecma_string (item_name_string_p);
|
||||
}
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (obj_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (obj_p));
|
||||
} /* ecma_op_create_array_object */
|
||||
|
||||
/**
|
||||
@@ -166,8 +172,9 @@ ecma_op_create_array_object (const ecma_value_t *arguments_list_p, /**< list of
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array object */
|
||||
void
|
||||
ecma_op_array_object_define_own_property (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the array object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
const ecma_property_descriptor_t* property_desc_p, /**< property descriptor */
|
||||
bool is_throw) /**< flag that controls failure handling */
|
||||
@@ -199,16 +206,19 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
||||
if (!property_desc_p->is_value_defined)
|
||||
{
|
||||
// i.
|
||||
return ecma_op_general_object_define_own_property (obj_p, property_name_p, property_desc_p, is_throw);
|
||||
ecma_op_general_object_define_own_property (ret_value, obj_p, property_name_p, property_desc_p, is_throw);
|
||||
return;
|
||||
}
|
||||
|
||||
ecma_number_t new_len_num;
|
||||
|
||||
// c.
|
||||
ecma_completion_value_t prop_val_to_num_completion = ecma_op_to_number (ecma_value_t (property_desc_p->value));
|
||||
ecma_completion_value_t prop_val_to_num_completion;
|
||||
ecma_op_to_number (prop_val_to_num_completion, ecma_value_t (property_desc_p->value));
|
||||
if (ecma_is_completion_value_throw (prop_val_to_num_completion))
|
||||
{
|
||||
return prop_val_to_num_completion;
|
||||
ret_value = prop_val_to_num_completion;
|
||||
return;
|
||||
}
|
||||
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal (prop_val_to_num_completion));
|
||||
@@ -225,7 +235,8 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
||||
// d.
|
||||
if (ecma_uint32_to_number (new_len_uint32) != new_len_num)
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_RANGE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_RANGE));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -236,17 +247,16 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
||||
ecma_property_descriptor_t new_len_property_desc = *property_desc_p;
|
||||
new_len_property_desc.value = (ecma_value_packed_t) ecma_value_t (new_len_num_p);
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
// f.
|
||||
if (new_len_uint32 >= old_len_uint32)
|
||||
{
|
||||
// i.
|
||||
magic_string_length_p = ecma_get_magic_string (ECMA_MAGIC_STRING_LENGTH);
|
||||
ret_value = ecma_op_general_object_define_own_property (obj_p,
|
||||
magic_string_length_p,
|
||||
&new_len_property_desc,
|
||||
is_throw);
|
||||
ecma_op_general_object_define_own_property (ret_value,
|
||||
obj_p,
|
||||
magic_string_length_p,
|
||||
&new_len_property_desc,
|
||||
is_throw);
|
||||
ecma_deref_ecma_string (magic_string_length_p);
|
||||
}
|
||||
else
|
||||
@@ -254,7 +264,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
||||
// g.
|
||||
if (!ecma_is_property_writable (len_prop_p))
|
||||
{
|
||||
ret_value = ecma_reject (is_throw);
|
||||
ecma_reject (ret_value, is_throw);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -277,10 +287,12 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
||||
|
||||
// j.
|
||||
magic_string_length_p = ecma_get_magic_string (ECMA_MAGIC_STRING_LENGTH);
|
||||
ecma_completion_value_t succeeded = ecma_op_general_object_define_own_property (obj_p,
|
||||
magic_string_length_p,
|
||||
&new_len_property_desc,
|
||||
is_throw);
|
||||
ecma_completion_value_t succeeded;
|
||||
ecma_op_general_object_define_own_property (succeeded,
|
||||
obj_p,
|
||||
magic_string_length_p,
|
||||
&new_len_property_desc,
|
||||
is_throw);
|
||||
ecma_deref_ecma_string (magic_string_length_p);
|
||||
|
||||
/* Handling normal false and throw values */
|
||||
@@ -306,9 +318,11 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
||||
|
||||
// ii
|
||||
ecma_string_t *old_length_string_p = ecma_new_ecma_string_from_uint32 (old_len_uint32);
|
||||
ecma_completion_value_t delete_succeeded = ecma_op_object_delete (obj_p,
|
||||
old_length_string_p,
|
||||
false);
|
||||
ecma_completion_value_t delete_succeeded;
|
||||
ecma_op_object_delete (delete_succeeded,
|
||||
obj_p,
|
||||
old_length_string_p,
|
||||
false);
|
||||
ecma_deref_ecma_string (old_length_string_p);
|
||||
|
||||
// iii
|
||||
@@ -331,10 +345,12 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
||||
|
||||
// 3.
|
||||
ecma_string_t *magic_string_length_p = ecma_get_magic_string (ECMA_MAGIC_STRING_LENGTH);
|
||||
ecma_completion_value_t completion = ecma_op_general_object_define_own_property (obj_p,
|
||||
magic_string_length_p,
|
||||
&new_len_property_desc,
|
||||
false);
|
||||
ecma_completion_value_t completion;
|
||||
ecma_op_general_object_define_own_property (completion,
|
||||
obj_p,
|
||||
magic_string_length_p,
|
||||
&new_len_property_desc,
|
||||
false);
|
||||
ecma_deref_ecma_string (magic_string_length_p);
|
||||
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion)
|
||||
@@ -348,7 +364,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
||||
|
||||
if (!reduce_succeeded)
|
||||
{
|
||||
ret_value = ecma_reject (is_throw);
|
||||
ecma_reject (ret_value, is_throw);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -362,15 +378,16 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
||||
|
||||
ecma_completion_value_t completion_set_not_writable;
|
||||
magic_string_length_p = ecma_get_magic_string (ECMA_MAGIC_STRING_LENGTH);
|
||||
completion_set_not_writable = ecma_op_general_object_define_own_property (obj_p,
|
||||
magic_string_length_p,
|
||||
&prop_desc_not_writable,
|
||||
false);
|
||||
ecma_op_general_object_define_own_property (completion_set_not_writable,
|
||||
obj_p,
|
||||
magic_string_length_p,
|
||||
&prop_desc_not_writable,
|
||||
false);
|
||||
ecma_deref_ecma_string (magic_string_length_p);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion_set_not_writable));
|
||||
}
|
||||
|
||||
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -378,7 +395,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
||||
|
||||
ecma_dealloc_number (new_len_num_p);
|
||||
|
||||
return ret_value;
|
||||
return;
|
||||
}
|
||||
|
||||
JERRY_UNREACHABLE();
|
||||
@@ -412,10 +429,12 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
||||
if (!is_index)
|
||||
{
|
||||
// 5.
|
||||
return ecma_op_general_object_define_own_property (obj_p,
|
||||
property_name_p,
|
||||
property_desc_p,
|
||||
false);
|
||||
ecma_op_general_object_define_own_property (ret_value,
|
||||
obj_p,
|
||||
property_name_p,
|
||||
property_desc_p,
|
||||
false);
|
||||
return;
|
||||
}
|
||||
|
||||
// 4.
|
||||
@@ -424,21 +443,25 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
||||
if (index >= old_len_uint32
|
||||
&& !ecma_is_property_writable (len_prop_p))
|
||||
{
|
||||
return ecma_reject (is_throw);
|
||||
ecma_reject (ret_value, is_throw);
|
||||
return;
|
||||
}
|
||||
|
||||
// c.
|
||||
ecma_completion_value_t succeeded = ecma_op_general_object_define_own_property (obj_p,
|
||||
property_name_p,
|
||||
property_desc_p,
|
||||
false);
|
||||
ecma_completion_value_t succeeded;
|
||||
ecma_op_general_object_define_own_property (succeeded,
|
||||
obj_p,
|
||||
property_name_p,
|
||||
property_desc_p,
|
||||
false);
|
||||
// d.
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (succeeded)
|
||||
|| ecma_is_completion_value_normal_false (succeeded));
|
||||
|
||||
if (ecma_is_completion_value_normal_false (succeeded))
|
||||
{
|
||||
return ecma_reject (is_throw);
|
||||
ecma_reject (ret_value, is_throw);
|
||||
return;
|
||||
}
|
||||
|
||||
// e.
|
||||
@@ -454,7 +477,8 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
||||
}
|
||||
|
||||
// f.
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
JERRY_UNREACHABLE();
|
||||
|
||||
@@ -26,13 +26,15 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
extern ecma_completion_value_t
|
||||
ecma_op_create_array_object (const ecma_value_t *arguments_list_p,
|
||||
extern void
|
||||
ecma_op_create_array_object (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t *arguments_list_p,
|
||||
ecma_length_t arguments_list_len,
|
||||
bool is_treat_single_arg_as_length);
|
||||
|
||||
extern ecma_completion_value_t
|
||||
ecma_op_array_object_define_own_property (ecma_object_t *obj_p,
|
||||
extern void
|
||||
ecma_op_array_object_define_own_property (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
const ecma_property_descriptor_t* property_desc_p,
|
||||
bool is_throw);
|
||||
|
||||
@@ -38,14 +38,17 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_create_boolean_object (const ecma_value_t& arg) /**< argument passed to the Boolean constructor */
|
||||
void
|
||||
ecma_op_create_boolean_object (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& arg) /**< argument passed to the Boolean constructor */
|
||||
{
|
||||
ecma_completion_value_t conv_to_boolean_completion = ecma_op_to_boolean (arg);
|
||||
ecma_completion_value_t conv_to_boolean_completion;
|
||||
ecma_op_to_boolean (conv_to_boolean_completion, arg);
|
||||
|
||||
if (!ecma_is_completion_value_normal (conv_to_boolean_completion))
|
||||
{
|
||||
return conv_to_boolean_completion;
|
||||
ret_value = conv_to_boolean_completion;
|
||||
return;
|
||||
}
|
||||
|
||||
ecma_simple_value_t bool_value = (ecma_is_completion_value_normal_true (conv_to_boolean_completion) ?
|
||||
@@ -69,5 +72,5 @@ ecma_op_create_boolean_object (const ecma_value_t& arg) /**< argument passed to
|
||||
ECMA_INTERNAL_PROPERTY_PRIMITIVE_BOOLEAN_VALUE);
|
||||
prim_value_prop_p->u.internal_property.value = bool_value;
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (obj_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (obj_p));
|
||||
} /* ecma_op_create_boolean_object */
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
extern ecma_completion_value_t ecma_op_create_boolean_object (const ecma_value_t& arg);
|
||||
extern void
|
||||
ecma_op_create_boolean_object (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t& arg);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -34,8 +34,9 @@
|
||||
* @return true - if values are equal,
|
||||
* false - otherwise.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_abstract_equality_compare (const ecma_value_t& x, /**< first operand */
|
||||
void
|
||||
ecma_op_abstract_equality_compare (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& x, /**< first operand */
|
||||
const ecma_value_t& y) /**< second operand */
|
||||
{
|
||||
const bool is_x_undefined = ecma_is_value_undefined (x);
|
||||
@@ -59,8 +60,6 @@ ecma_op_abstract_equality_compare (const ecma_value_t& x, /**< first operand */
|
||||
|| (is_x_string && is_y_string)
|
||||
|| (is_x_object && is_y_object));
|
||||
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
if (is_types_equal)
|
||||
{
|
||||
// 1.
|
||||
@@ -69,7 +68,7 @@ ecma_op_abstract_equality_compare (const ecma_value_t& x, /**< first operand */
|
||||
|| is_x_null)
|
||||
{
|
||||
// a., b.
|
||||
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_TRUE);
|
||||
}
|
||||
else if (is_x_number)
|
||||
{ // c.
|
||||
@@ -100,8 +99,8 @@ ecma_op_abstract_equality_compare (const ecma_value_t& x, /**< first operand */
|
||||
JERRY_ASSERT (is_x_equal_to_y == is_x_equal_to_y_check);
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
|
||||
ret_value = ecma_make_simple_completion_value (is_x_equal_to_y ?
|
||||
ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
ecma_make_simple_completion_value (ret_value,
|
||||
is_x_equal_to_y ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
}
|
||||
else if (is_x_string)
|
||||
{ // d.
|
||||
@@ -110,13 +109,13 @@ ecma_op_abstract_equality_compare (const ecma_value_t& x, /**< first operand */
|
||||
|
||||
bool is_equal = ecma_compare_ecma_strings (x_str_p, y_str_p);
|
||||
|
||||
ret_value = ecma_make_simple_completion_value (is_equal ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
ecma_make_simple_completion_value (ret_value, is_equal ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
}
|
||||
else if (is_x_boolean)
|
||||
{ // e.
|
||||
bool is_equal = (ecma_is_value_true (x) == ecma_is_value_true (y));
|
||||
|
||||
ret_value = ecma_make_simple_completion_value (is_equal ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
ecma_make_simple_completion_value (ret_value, is_equal ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
}
|
||||
else
|
||||
{ // f.
|
||||
@@ -124,55 +123,47 @@ ecma_op_abstract_equality_compare (const ecma_value_t& x, /**< first operand */
|
||||
|
||||
bool is_equal = (ecma_get_object_from_value (x) == ecma_get_object_from_value (y));
|
||||
|
||||
ret_value = ecma_make_simple_completion_value (is_equal ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
ecma_make_simple_completion_value (ret_value, is_equal ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
}
|
||||
}
|
||||
else if ((is_x_null && is_y_undefined)
|
||||
|| (is_x_undefined && is_y_null))
|
||||
{ // 2., 3.
|
||||
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_TRUE);
|
||||
}
|
||||
else if (is_x_number && is_y_string)
|
||||
{
|
||||
// 4.
|
||||
ECMA_TRY_CATCH (y_num_value,
|
||||
ecma_op_to_number (y),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_number, y_num_value, y);
|
||||
|
||||
ret_value = ecma_op_abstract_equality_compare (x, y_num_value);
|
||||
ecma_op_abstract_equality_compare (ret_value, x, y_num_value);
|
||||
|
||||
ECMA_FINALIZE (y_num_value);
|
||||
}
|
||||
else if (is_x_string && is_y_number)
|
||||
{
|
||||
// 5.
|
||||
ECMA_TRY_CATCH (x_num_value,
|
||||
ecma_op_to_number (x),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_number, x_num_value, x);
|
||||
|
||||
ret_value = ecma_op_abstract_equality_compare (x_num_value, y);
|
||||
ecma_op_abstract_equality_compare (ret_value, x_num_value, y);
|
||||
|
||||
ECMA_FINALIZE (x_num_value);
|
||||
}
|
||||
else if (is_x_boolean)
|
||||
{
|
||||
// 6.
|
||||
ECMA_TRY_CATCH (x_num_value,
|
||||
ecma_op_to_number (x),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_number, x_num_value, x);
|
||||
|
||||
ret_value = ecma_op_abstract_equality_compare (x_num_value, y);
|
||||
ecma_op_abstract_equality_compare (ret_value, x_num_value, y);
|
||||
|
||||
ECMA_FINALIZE (x_num_value);
|
||||
}
|
||||
else if (is_y_boolean)
|
||||
{
|
||||
// 7.
|
||||
ECMA_TRY_CATCH (y_num_value,
|
||||
ecma_op_to_number (y),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_number, y_num_value, y);
|
||||
|
||||
ret_value = ecma_op_abstract_equality_compare (x, y_num_value);
|
||||
ecma_op_abstract_equality_compare (ret_value, x, y_num_value);
|
||||
|
||||
ECMA_FINALIZE (y_num_value);
|
||||
}
|
||||
@@ -180,11 +171,9 @@ ecma_op_abstract_equality_compare (const ecma_value_t& x, /**< first operand */
|
||||
&& (is_x_number || is_x_string))
|
||||
{
|
||||
// 8.
|
||||
ECMA_TRY_CATCH (y_prim_value,
|
||||
ecma_op_to_primitive (y, ECMA_PREFERRED_TYPE_NO),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_primitive, y_prim_value, y, ECMA_PREFERRED_TYPE_NO);
|
||||
|
||||
ret_value = ecma_op_abstract_equality_compare (x, y_prim_value);
|
||||
ecma_op_abstract_equality_compare (ret_value, x, y_prim_value);
|
||||
|
||||
ECMA_FINALIZE (y_prim_value);
|
||||
}
|
||||
@@ -192,20 +181,16 @@ ecma_op_abstract_equality_compare (const ecma_value_t& x, /**< first operand */
|
||||
&& (is_y_number || is_y_string))
|
||||
{
|
||||
// 9.
|
||||
ECMA_TRY_CATCH (x_prim_value,
|
||||
ecma_op_to_primitive (x, ECMA_PREFERRED_TYPE_NO),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_primitive, x_prim_value, x, ECMA_PREFERRED_TYPE_NO);
|
||||
|
||||
ret_value = ecma_op_abstract_equality_compare (x_prim_value, y);
|
||||
ecma_op_abstract_equality_compare (ret_value, x_prim_value, y);
|
||||
|
||||
ECMA_FINALIZE (x_prim_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_FALSE);
|
||||
}
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_op_abstract_equality_compare */
|
||||
|
||||
/**
|
||||
@@ -328,23 +313,20 @@ ecma_op_strict_equality_compare (const ecma_value_t& x, /**< first operand */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_abstract_relational_compare (const ecma_value_t& x, /**< first operand */
|
||||
void
|
||||
ecma_op_abstract_relational_compare (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& x, /**< first operand */
|
||||
const ecma_value_t& y, /**< second operand */
|
||||
bool left_first) /**< 'LeftFirst' flag */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
const ecma_value_t& first_converted_value = left_first ? x : y;
|
||||
const ecma_value_t& second_converted_value = left_first ? y : x;
|
||||
|
||||
// 1., 2.
|
||||
ECMA_TRY_CATCH(prim_first_converted_value,
|
||||
ecma_op_to_primitive (first_converted_value, ECMA_PREFERRED_TYPE_NUMBER),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH(prim_second_converted_value,
|
||||
ecma_op_to_primitive (second_converted_value, ECMA_PREFERRED_TYPE_NUMBER),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH(ret_value,
|
||||
ecma_op_to_primitive, prim_first_converted_value, first_converted_value, ECMA_PREFERRED_TYPE_NUMBER);
|
||||
ECMA_TRY_CATCH(ret_value,
|
||||
ecma_op_to_primitive, prim_second_converted_value, second_converted_value, ECMA_PREFERRED_TYPE_NUMBER);
|
||||
|
||||
const ecma_value_t &px = left_first ? prim_first_converted_value : prim_second_converted_value;
|
||||
const ecma_value_t &py = left_first ? prim_second_converted_value : prim_first_converted_value;
|
||||
@@ -365,7 +347,7 @@ ecma_op_abstract_relational_compare (const ecma_value_t& x, /**< first operand *
|
||||
|| ecma_number_is_nan (ny))
|
||||
{
|
||||
// c., d.
|
||||
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -428,8 +410,8 @@ ecma_op_abstract_relational_compare (const ecma_value_t& x, /**< first operand *
|
||||
JERRY_ASSERT (is_x_less_than_y_check == is_x_less_than_y);
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
|
||||
ret_value = ecma_make_simple_completion_value (is_x_less_than_y ?
|
||||
ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
ecma_make_simple_completion_value (ret_value,
|
||||
is_x_less_than_y ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
}
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (ny);
|
||||
@@ -444,14 +426,12 @@ ecma_op_abstract_relational_compare (const ecma_value_t& x, /**< first operand *
|
||||
|
||||
bool is_px_less = ecma_compare_ecma_strings_relational (str_x_p, str_y_p);
|
||||
|
||||
ret_value = ecma_make_simple_completion_value (is_px_less ? ECMA_SIMPLE_VALUE_TRUE
|
||||
: ECMA_SIMPLE_VALUE_FALSE);
|
||||
ecma_make_simple_completion_value (ret_value,
|
||||
is_px_less ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
}
|
||||
|
||||
ECMA_FINALIZE(prim_second_converted_value);
|
||||
ECMA_FINALIZE(prim_first_converted_value);
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_op_abstract_relational_compare */
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,13 +27,18 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
extern ecma_completion_value_t ecma_op_abstract_equality_compare (const ecma_value_t& x,
|
||||
const ecma_value_t& y);
|
||||
extern bool ecma_op_strict_equality_compare (const ecma_value_t& x,
|
||||
const ecma_value_t& y);
|
||||
extern ecma_completion_value_t ecma_op_abstract_relational_compare (const ecma_value_t& x,
|
||||
const ecma_value_t& y,
|
||||
bool left_first);
|
||||
extern void
|
||||
ecma_op_abstract_equality_compare (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t& x,
|
||||
const ecma_value_t& y);
|
||||
extern bool
|
||||
ecma_op_strict_equality_compare (const ecma_value_t& x,
|
||||
const ecma_value_t& y);
|
||||
extern void
|
||||
ecma_op_abstract_relational_compare (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t& x,
|
||||
const ecma_value_t& y,
|
||||
bool left_first);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -48,19 +48,20 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_check_object_coercible (const ecma_value_t& value) /**< ecma-value */
|
||||
void
|
||||
ecma_op_check_object_coercible (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& value) /**< ecma-value */
|
||||
{
|
||||
ecma_check_value_type_is_spec_defined (value);
|
||||
|
||||
if (ecma_is_value_undefined (value)
|
||||
|| ecma_is_value_null (value))
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
}
|
||||
} /* ecma_op_check_object_coercible */
|
||||
|
||||
@@ -156,8 +157,9 @@ ecma_op_same_value (const ecma_value_t& x, /**< ecma-value */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_to_primitive (const ecma_value_t& value, /**< ecma-value */
|
||||
void
|
||||
ecma_op_to_primitive (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& value, /**< ecma-value */
|
||||
ecma_preferred_type_hint_t preferred_type) /**< preferred type hint */
|
||||
{
|
||||
ecma_check_value_type_is_spec_defined (value);
|
||||
@@ -166,14 +168,14 @@ ecma_op_to_primitive (const ecma_value_t& value, /**< ecma-value */
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (value);
|
||||
|
||||
return ecma_op_object_default_value (obj_p, preferred_type);
|
||||
ecma_op_object_default_value (ret_value, obj_p, preferred_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_value_t value_copy;
|
||||
ecma_copy_value (value_copy, value, true);
|
||||
|
||||
return ecma_make_normal_completion_value (value_copy);
|
||||
ecma_make_normal_completion_value (ret_value, value_copy);
|
||||
}
|
||||
} /* ecma_op_to_primitive */
|
||||
|
||||
@@ -187,22 +189,23 @@ ecma_op_to_primitive (const ecma_value_t& value, /**< ecma-value */
|
||||
* Returned value is simple and so need not be freed.
|
||||
* However, ecma_free_completion_value may be called for it, but it is a no-op.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_to_boolean (const ecma_value_t& value) /**< ecma-value */
|
||||
void
|
||||
ecma_op_to_boolean (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& value) /**< ecma-value */
|
||||
{
|
||||
ecma_check_value_type_is_spec_defined (value);
|
||||
|
||||
ecma_simple_value_t ret_value;
|
||||
ecma_simple_value_t boolean;
|
||||
|
||||
if (ecma_is_value_boolean (value))
|
||||
{
|
||||
ret_value = (ecma_is_value_true (value) ?
|
||||
boolean = (ecma_is_value_true (value) ?
|
||||
ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
}
|
||||
else if (ecma_is_value_undefined (value)
|
||||
|| ecma_is_value_null (value))
|
||||
{
|
||||
ret_value = ECMA_SIMPLE_VALUE_FALSE;
|
||||
boolean = ECMA_SIMPLE_VALUE_FALSE;
|
||||
}
|
||||
else if (ecma_is_value_number (value))
|
||||
{
|
||||
@@ -211,11 +214,11 @@ ecma_op_to_boolean (const ecma_value_t& value) /**< ecma-value */
|
||||
if (ecma_number_is_nan (*num_p)
|
||||
|| ecma_number_is_zero (*num_p))
|
||||
{
|
||||
ret_value = ECMA_SIMPLE_VALUE_FALSE;
|
||||
boolean = ECMA_SIMPLE_VALUE_FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret_value = ECMA_SIMPLE_VALUE_TRUE;
|
||||
boolean = ECMA_SIMPLE_VALUE_TRUE;
|
||||
}
|
||||
}
|
||||
else if (ecma_is_value_string (value))
|
||||
@@ -224,21 +227,21 @@ ecma_op_to_boolean (const ecma_value_t& value) /**< ecma-value */
|
||||
|
||||
if (ecma_string_get_length (str_p) == 0)
|
||||
{
|
||||
ret_value = ECMA_SIMPLE_VALUE_FALSE;
|
||||
boolean = ECMA_SIMPLE_VALUE_FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret_value = ECMA_SIMPLE_VALUE_TRUE;
|
||||
boolean = ECMA_SIMPLE_VALUE_TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
JERRY_ASSERT (ecma_is_value_object (value));
|
||||
|
||||
ret_value = ECMA_SIMPLE_VALUE_TRUE;
|
||||
boolean = ECMA_SIMPLE_VALUE_TRUE;
|
||||
}
|
||||
|
||||
return ecma_make_simple_completion_value (ret_value);
|
||||
ecma_make_simple_completion_value (ret_value, boolean);
|
||||
} /* ecma_op_to_boolean */
|
||||
|
||||
/**
|
||||
@@ -250,8 +253,9 @@ ecma_op_to_boolean (const ecma_value_t& value) /**< ecma-value */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_to_number (const ecma_value_t& value) /**< ecma-value */
|
||||
void
|
||||
ecma_op_to_number (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& value) /**< ecma-value */
|
||||
{
|
||||
ecma_check_value_type_is_spec_defined (value);
|
||||
|
||||
@@ -260,7 +264,7 @@ ecma_op_to_number (const ecma_value_t& value) /**< ecma-value */
|
||||
ecma_value_t value_copy;
|
||||
ecma_copy_value (value_copy, value, true);
|
||||
|
||||
return ecma_make_normal_completion_value (value_copy);
|
||||
ecma_make_normal_completion_value (ret_value, value_copy);
|
||||
}
|
||||
else if (ecma_is_value_string (value))
|
||||
{
|
||||
@@ -269,21 +273,15 @@ ecma_op_to_number (const ecma_value_t& value) /**< ecma-value */
|
||||
ecma_number_t *num_p = ecma_alloc_number ();
|
||||
*num_p = ecma_string_to_number (str_p);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (num_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (num_p));
|
||||
}
|
||||
else if (ecma_is_value_object (value))
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_primitive, primitive_value, value, ECMA_PREFERRED_TYPE_NUMBER);
|
||||
|
||||
ECMA_TRY_CATCH (primitive_value,
|
||||
ecma_op_to_primitive (value, ECMA_PREFERRED_TYPE_NUMBER),
|
||||
ret_value);
|
||||
|
||||
ret_value = ecma_op_to_number (primitive_value);
|
||||
ecma_op_to_number (ret_value, primitive_value);
|
||||
|
||||
ECMA_FINALIZE (primitive_value);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -311,7 +309,7 @@ ecma_op_to_number (const ecma_value_t& value) /**< ecma-value */
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (num_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (num_p));
|
||||
}
|
||||
} /* ecma_op_to_number */
|
||||
|
||||
@@ -324,24 +322,21 @@ ecma_op_to_number (const ecma_value_t& value) /**< ecma-value */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_to_string (const ecma_value_t& value) /**< ecma-value */
|
||||
void
|
||||
ecma_op_to_string (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& value) /**< ecma-value */
|
||||
{
|
||||
ecma_check_value_type_is_spec_defined (value);
|
||||
|
||||
if (unlikely (ecma_is_value_object (value)))
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_primitive, prim_value, value, ECMA_PREFERRED_TYPE_STRING);
|
||||
|
||||
ECMA_TRY_CATCH (prim_value,
|
||||
ecma_op_to_primitive (value, ECMA_PREFERRED_TYPE_STRING),
|
||||
ret_value);
|
||||
|
||||
ret_value = ecma_op_to_string (prim_value);
|
||||
ecma_op_to_string (ret_value, prim_value);
|
||||
|
||||
ECMA_FINALIZE (prim_value);
|
||||
|
||||
return ret_value;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -379,7 +374,7 @@ ecma_op_to_string (const ecma_value_t& value) /**< ecma-value */
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (res_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (res_p));
|
||||
}
|
||||
} /* ecma_op_to_string */
|
||||
|
||||
@@ -392,38 +387,39 @@ ecma_op_to_string (const ecma_value_t& value) /**< ecma-value */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_to_object (const ecma_value_t& value) /**< ecma-value */
|
||||
void
|
||||
ecma_op_to_object (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& value) /**< ecma-value */
|
||||
{
|
||||
ecma_check_value_type_is_spec_defined (value);
|
||||
|
||||
if (ecma_is_value_number (value))
|
||||
{
|
||||
return ecma_op_create_number_object (value);
|
||||
ecma_op_create_number_object (ret_value, value);
|
||||
}
|
||||
else if (ecma_is_value_string (value))
|
||||
{
|
||||
return ecma_op_create_string_object (&value, 1);
|
||||
ecma_op_create_string_object (ret_value, &value, 1);
|
||||
}
|
||||
else if (ecma_is_value_object (value))
|
||||
{
|
||||
ecma_value_t value_copy;
|
||||
ecma_copy_value (value_copy, value, true);
|
||||
|
||||
return ecma_make_normal_completion_value (value_copy);
|
||||
ecma_make_normal_completion_value (ret_value, value_copy);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ecma_is_value_undefined (value)
|
||||
|| ecma_is_value_null (value))
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
else
|
||||
{
|
||||
JERRY_ASSERT (ecma_is_value_boolean (value));
|
||||
|
||||
return ecma_op_create_boolean_object (value);
|
||||
ecma_op_create_boolean_object (ret_value, value);
|
||||
}
|
||||
}
|
||||
} /* ecma_op_to_object */
|
||||
@@ -467,10 +463,11 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t* src_prop_des
|
||||
prop_desc.value = src_prop_desc_p->value;
|
||||
|
||||
ecma_string_t *value_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_VALUE);
|
||||
completion = ecma_op_object_define_own_property (obj_p,
|
||||
value_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
ecma_op_object_define_own_property (completion,
|
||||
obj_p,
|
||||
value_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
ecma_deref_ecma_string (value_magic_string_p);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
||||
|
||||
@@ -480,10 +477,11 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t* src_prop_des
|
||||
: ECMA_SIMPLE_VALUE_FALSE);
|
||||
|
||||
ecma_string_t *writable_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_WRITABLE);
|
||||
completion = ecma_op_object_define_own_property (obj_p,
|
||||
writable_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
ecma_op_object_define_own_property (completion,
|
||||
obj_p,
|
||||
writable_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
ecma_deref_ecma_string (writable_magic_string_p);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
||||
}
|
||||
@@ -503,10 +501,11 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t* src_prop_des
|
||||
}
|
||||
|
||||
ecma_string_t *get_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_GET);
|
||||
completion = ecma_op_object_define_own_property (obj_p,
|
||||
get_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
ecma_op_object_define_own_property (completion,
|
||||
obj_p,
|
||||
get_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
ecma_deref_ecma_string (get_magic_string_p);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
||||
|
||||
@@ -521,10 +520,11 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t* src_prop_des
|
||||
}
|
||||
|
||||
ecma_string_t *set_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_SET);
|
||||
completion = ecma_op_object_define_own_property (obj_p,
|
||||
set_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
ecma_op_object_define_own_property (completion,
|
||||
obj_p,
|
||||
set_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
ecma_deref_ecma_string (set_magic_string_p);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
||||
}
|
||||
@@ -534,10 +534,11 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t* src_prop_des
|
||||
: ECMA_SIMPLE_VALUE_FALSE);
|
||||
|
||||
ecma_string_t *enumerable_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_ENUMERABLE);
|
||||
completion = ecma_op_object_define_own_property (obj_p,
|
||||
enumerable_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
ecma_op_object_define_own_property (completion,
|
||||
obj_p,
|
||||
enumerable_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
ecma_deref_ecma_string (enumerable_magic_string_p);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
||||
|
||||
@@ -546,10 +547,11 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t* src_prop_des
|
||||
: ECMA_SIMPLE_VALUE_FALSE);
|
||||
|
||||
ecma_string_t *configurable_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_CONFIGURABLE);
|
||||
completion = ecma_op_object_define_own_property (obj_p,
|
||||
configurable_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
ecma_op_object_define_own_property (completion,
|
||||
obj_p,
|
||||
configurable_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
ecma_deref_ecma_string (configurable_magic_string_p);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
||||
|
||||
@@ -565,18 +567,19 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t* src_prop_des
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value */
|
||||
void
|
||||
ecma_op_to_property_descriptor (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& obj_value, /**< object value */
|
||||
ecma_property_descriptor_t *out_prop_desc_p) /**< out: filled property descriptor
|
||||
if return value is normal
|
||||
empty completion value */
|
||||
{
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
|
||||
// 1.
|
||||
if (!ecma_is_value_object (obj_value))
|
||||
{
|
||||
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -590,12 +593,8 @@ ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value
|
||||
|
||||
if (ecma_op_object_get_property (obj_p, enumerable_magic_string_p) != NULL)
|
||||
{
|
||||
ECMA_TRY_CATCH (enumerable_prop_value,
|
||||
ecma_op_object_get (obj_p, enumerable_magic_string_p),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (boolean_enumerable_prop_value,
|
||||
ecma_op_to_boolean (enumerable_prop_value),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_object_get, enumerable_prop_value, obj_p, enumerable_magic_string_p);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_boolean, boolean_enumerable_prop_value, enumerable_prop_value);
|
||||
|
||||
prop_desc.is_enumerable_defined = true;
|
||||
if (ecma_is_value_true (boolean_enumerable_prop_value))
|
||||
@@ -624,12 +623,8 @@ ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value
|
||||
|
||||
if (ecma_op_object_get_property (obj_p, configurable_magic_string_p) != NULL)
|
||||
{
|
||||
ECMA_TRY_CATCH (configurable_prop_value,
|
||||
ecma_op_object_get (obj_p, configurable_magic_string_p),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (boolean_configurable_prop_value,
|
||||
ecma_op_to_boolean (configurable_prop_value),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_object_get, configurable_prop_value, obj_p, configurable_magic_string_p);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_boolean, boolean_configurable_prop_value, configurable_prop_value);
|
||||
|
||||
prop_desc.is_configurable_defined = true;
|
||||
if (ecma_is_value_true (boolean_configurable_prop_value))
|
||||
@@ -659,9 +654,7 @@ ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value
|
||||
|
||||
if (ecma_op_object_get_property (obj_p, value_magic_string_p) != NULL)
|
||||
{
|
||||
ECMA_TRY_CATCH (value_prop_value,
|
||||
ecma_op_object_get (obj_p, value_magic_string_p),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_object_get, value_prop_value, obj_p, value_magic_string_p);
|
||||
|
||||
ecma_value_t value_copy;
|
||||
ecma_copy_value (value_copy, value_prop_value, true);
|
||||
@@ -684,12 +677,8 @@ ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value
|
||||
|
||||
if (ecma_op_object_get_property (obj_p, writable_magic_string_p) != NULL)
|
||||
{
|
||||
ECMA_TRY_CATCH (writable_prop_value,
|
||||
ecma_op_object_get (obj_p, writable_magic_string_p),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (boolean_writable_prop_value,
|
||||
ecma_op_to_boolean (writable_prop_value),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_object_get, writable_prop_value, obj_p, writable_magic_string_p);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_boolean, boolean_writable_prop_value, writable_prop_value);
|
||||
|
||||
prop_desc.is_writable_defined = true;
|
||||
if (ecma_is_value_true (boolean_writable_prop_value))
|
||||
@@ -719,14 +708,12 @@ ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value
|
||||
|
||||
if (ecma_op_object_get_property (obj_p, get_magic_string_p) != NULL)
|
||||
{
|
||||
ECMA_TRY_CATCH (get_prop_value,
|
||||
ecma_op_object_get (obj_p, get_magic_string_p),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_object_get, get_prop_value, obj_p, get_magic_string_p);
|
||||
|
||||
if (!ecma_op_is_callable (get_prop_value)
|
||||
&& !ecma_is_value_undefined (get_prop_value))
|
||||
{
|
||||
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -763,14 +750,12 @@ ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value
|
||||
|
||||
if (ecma_op_object_get_property (obj_p, set_magic_string_p) != NULL)
|
||||
{
|
||||
ECMA_TRY_CATCH (set_prop_value,
|
||||
ecma_op_object_get (obj_p, set_magic_string_p),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_object_get, set_prop_value, obj_p, set_magic_string_p);
|
||||
|
||||
if (!ecma_op_is_callable (set_prop_value)
|
||||
&& !ecma_is_value_undefined (set_prop_value))
|
||||
{
|
||||
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -808,7 +793,7 @@ ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value
|
||||
if (prop_desc.is_value_defined
|
||||
|| prop_desc.is_writable_defined)
|
||||
{
|
||||
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -824,8 +809,6 @@ ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value
|
||||
|
||||
*out_prop_desc_p = prop_desc;
|
||||
}
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_op_to_property_descriptor */
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,19 +38,34 @@ typedef enum
|
||||
ECMA_PREFERRED_TYPE_STRING /**< String */
|
||||
} ecma_preferred_type_hint_t;
|
||||
|
||||
extern ecma_completion_value_t ecma_op_check_object_coercible (const ecma_value_t& value);
|
||||
extern void
|
||||
ecma_op_check_object_coercible (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t& value);
|
||||
extern bool ecma_op_same_value (const ecma_value_t& x,
|
||||
const ecma_value_t& y);
|
||||
extern ecma_completion_value_t ecma_op_to_primitive (const ecma_value_t& value,
|
||||
ecma_preferred_type_hint_t preferred_type);
|
||||
extern ecma_completion_value_t ecma_op_to_boolean (const ecma_value_t& value);
|
||||
extern ecma_completion_value_t ecma_op_to_number (const ecma_value_t& value);
|
||||
extern ecma_completion_value_t ecma_op_to_string (const ecma_value_t& value);
|
||||
extern ecma_completion_value_t ecma_op_to_object (const ecma_value_t& value);
|
||||
extern void
|
||||
ecma_op_to_primitive (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t& value,
|
||||
ecma_preferred_type_hint_t preferred_type);
|
||||
extern void
|
||||
ecma_op_to_boolean (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t& value);
|
||||
extern void
|
||||
ecma_op_to_number (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t& value);
|
||||
extern void
|
||||
ecma_op_to_string (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t& value);
|
||||
extern void
|
||||
ecma_op_to_object (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t& value);
|
||||
|
||||
extern ecma_object_t* ecma_op_from_property_descriptor (const ecma_property_descriptor_t* src_prop_desc_p);
|
||||
extern ecma_completion_value_t ecma_op_to_property_descriptor (const ecma_value_t& obj_value,
|
||||
ecma_property_descriptor_t *out_prop_desc_p);
|
||||
extern ecma_object_t*
|
||||
ecma_op_from_property_descriptor (const ecma_property_descriptor_t* src_prop_desc_p);
|
||||
extern void
|
||||
ecma_op_to_property_descriptor (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t& obj_value,
|
||||
ecma_property_descriptor_t *out_prop_desc_p);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -193,10 +193,12 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
||||
length_prop_desc.value = (ecma_value_packed_t) ecma_value_t (len_p);
|
||||
|
||||
ecma_string_t* magic_string_length_p = ecma_get_magic_string (ECMA_MAGIC_STRING_LENGTH);
|
||||
ecma_completion_value_t completion = ecma_op_object_define_own_property (f,
|
||||
magic_string_length_p,
|
||||
&length_prop_desc,
|
||||
false);
|
||||
ecma_completion_value_t completion;
|
||||
ecma_op_object_define_own_property (completion,
|
||||
f,
|
||||
magic_string_length_p,
|
||||
&length_prop_desc,
|
||||
false);
|
||||
ecma_deref_ecma_string (magic_string_length_p);
|
||||
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion)
|
||||
@@ -225,20 +227,28 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
||||
}
|
||||
|
||||
ecma_string_t *magic_string_constructor_p = ecma_get_magic_string (ECMA_MAGIC_STRING_CONSTRUCTOR);
|
||||
ecma_op_object_define_own_property (proto_p,
|
||||
ecma_op_object_define_own_property (completion,
|
||||
proto_p,
|
||||
magic_string_constructor_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion)
|
||||
|| ecma_is_completion_value_normal_false (completion));
|
||||
|
||||
ecma_deref_ecma_string (magic_string_constructor_p);
|
||||
|
||||
// 18.
|
||||
prop_desc.value = (ecma_value_packed_t) ecma_value_t (proto_p);
|
||||
prop_desc.is_configurable = false;
|
||||
ecma_string_t *magic_string_prototype_p = ecma_get_magic_string (ECMA_MAGIC_STRING_PROTOTYPE);
|
||||
ecma_op_object_define_own_property (f,
|
||||
ecma_op_object_define_own_property (completion,
|
||||
f,
|
||||
magic_string_prototype_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion)
|
||||
|| ecma_is_completion_value_normal_false (completion));
|
||||
|
||||
ecma_deref_ecma_string (magic_string_prototype_p);
|
||||
|
||||
ecma_deref_object (proto_p);
|
||||
@@ -264,17 +274,25 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
||||
}
|
||||
|
||||
ecma_string_t *magic_string_caller_p = ecma_get_magic_string (ECMA_MAGIC_STRING_CALLER);
|
||||
ecma_op_object_define_own_property (f,
|
||||
ecma_op_object_define_own_property (completion,
|
||||
f,
|
||||
magic_string_caller_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion)
|
||||
|| ecma_is_completion_value_normal_false (completion));
|
||||
|
||||
ecma_deref_ecma_string (magic_string_caller_p);
|
||||
|
||||
ecma_string_t *magic_string_arguments_p = ecma_get_magic_string (ECMA_MAGIC_STRING_ARGUMENTS);
|
||||
ecma_op_object_define_own_property (f,
|
||||
ecma_op_object_define_own_property (completion,
|
||||
f,
|
||||
magic_string_arguments_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion)
|
||||
|| ecma_is_completion_value_normal_false (completion));
|
||||
|
||||
ecma_deref_ecma_string (magic_string_arguments_p);
|
||||
|
||||
ecma_deref_object (thrower_p);
|
||||
@@ -292,8 +310,9 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_function_call_setup_args_variables (ecma_object_t *func_obj_p, /**< Function object */
|
||||
static void
|
||||
ecma_function_call_setup_args_variables (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *func_obj_p, /**< Function object */
|
||||
ecma_object_t *env_p, /**< lexical environment */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len, /**< length of argument list */
|
||||
@@ -307,7 +326,8 @@ ecma_function_call_setup_args_variables (ecma_object_t *func_obj_p, /**< Functio
|
||||
|
||||
if (formal_parameters_p == NULL)
|
||||
{
|
||||
return ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
return;
|
||||
}
|
||||
|
||||
ecma_length_t formal_parameters_count = formal_parameters_p->unit_number;
|
||||
@@ -334,31 +354,37 @@ ecma_function_call_setup_args_variables (ecma_object_t *func_obj_p, /**< Functio
|
||||
bool arg_already_declared = ecma_op_has_binding (env_p, formal_parameter_name_string_p);
|
||||
if (!arg_already_declared)
|
||||
{
|
||||
ecma_completion_value_t completion = ecma_op_create_mutable_binding (env_p,
|
||||
formal_parameter_name_string_p,
|
||||
false);
|
||||
ecma_completion_value_t completion;
|
||||
ecma_op_create_mutable_binding (completion,
|
||||
env_p,
|
||||
formal_parameter_name_string_p,
|
||||
false);
|
||||
if (ecma_is_completion_value_throw (completion))
|
||||
{
|
||||
return completion;
|
||||
ret_value = completion;
|
||||
return;
|
||||
}
|
||||
|
||||
JERRY_ASSERT (ecma_is_completion_value_empty (completion));
|
||||
|
||||
completion = ecma_op_set_mutable_binding (env_p,
|
||||
formal_parameter_name_string_p,
|
||||
v,
|
||||
is_strict);
|
||||
ecma_op_set_mutable_binding (completion,
|
||||
env_p,
|
||||
formal_parameter_name_string_p,
|
||||
v,
|
||||
is_strict);
|
||||
|
||||
if (ecma_is_completion_value_throw (completion))
|
||||
{
|
||||
return completion;
|
||||
ret_value = completion;
|
||||
return;
|
||||
}
|
||||
|
||||
JERRY_ASSERT (ecma_is_completion_value_empty (completion));
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
return;
|
||||
} /* ecma_function_call_setup_args_variables */
|
||||
|
||||
/**
|
||||
@@ -371,8 +397,9 @@ ecma_function_call_setup_args_variables (ecma_object_t *func_obj_p, /**< Functio
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object */
|
||||
void
|
||||
ecma_op_function_has_instance (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *func_obj_p, /**< Function object */
|
||||
const ecma_value_t& value) /**< argument 'V' */
|
||||
{
|
||||
JERRY_ASSERT(func_obj_p != NULL
|
||||
@@ -382,22 +409,20 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object *
|
||||
{
|
||||
if (!ecma_is_value_object (value))
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
ecma_object_t* v_obj_p = ecma_get_object_from_value (value);
|
||||
|
||||
ecma_string_t *prototype_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_PROTOTYPE);
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (prototype_obj_value,
|
||||
ecma_op_object_get (func_obj_p, prototype_magic_string_p),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_object_get, prototype_obj_value, func_obj_p, prototype_magic_string_p);
|
||||
|
||||
if (!ecma_is_value_object (prototype_obj_value))
|
||||
{
|
||||
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -410,13 +435,13 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object *
|
||||
|
||||
if (v_obj_p == NULL)
|
||||
{
|
||||
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_FALSE);
|
||||
|
||||
break;
|
||||
}
|
||||
else if (v_obj_p == prototype_obj_p)
|
||||
{
|
||||
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_TRUE);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -426,12 +451,10 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object *
|
||||
ECMA_FINALIZE (prototype_obj_value);
|
||||
|
||||
ecma_deref_ecma_string (prototype_magic_string_p);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else if (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION)
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -451,8 +474,9 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object *
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
|
||||
void
|
||||
ecma_op_function_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *func_obj_p, /**< Function object */
|
||||
const ecma_value_t& this_arg_value, /**< 'this' argument's value */
|
||||
const ecma_value_t* arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< length of arguments list */
|
||||
@@ -466,11 +490,10 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
|
||||
{
|
||||
if (unlikely (ecma_get_object_is_builtin (func_obj_p)))
|
||||
{
|
||||
return ecma_builtin_dispatch_call (func_obj_p, this_arg_value, arguments_list_p, arguments_list_len);
|
||||
ecma_builtin_dispatch_call (ret_value, func_obj_p, this_arg_value, arguments_list_p, arguments_list_len);
|
||||
return;
|
||||
}
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
/* Entering Function Code (ECMA-262 v5, 10.4.3) */
|
||||
|
||||
ecma_property_t *scope_prop_p = ecma_get_internal_property (func_obj_p, ECMA_INTERNAL_PROPERTY_SCOPE);
|
||||
@@ -499,7 +522,8 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
|
||||
else
|
||||
{
|
||||
// 3., 4.
|
||||
ecma_completion_value_t to_obj_completion = ecma_op_to_object (this_arg_value);
|
||||
ecma_completion_value_t to_obj_completion;
|
||||
ecma_op_to_object (to_obj_completion, this_arg_value);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal (to_obj_completion));
|
||||
|
||||
ecma_get_completion_value_value (this_binding, to_obj_completion);
|
||||
@@ -509,25 +533,22 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
|
||||
ecma_object_t *local_env_p = ecma_create_decl_lex_env (scope_p);
|
||||
|
||||
// 9.
|
||||
ECMA_TRY_CATCH (args_var_declaration_ret,
|
||||
ecma_function_call_setup_args_variables (func_obj_p,
|
||||
local_env_p,
|
||||
arguments_list_p,
|
||||
arguments_list_len,
|
||||
is_strict),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_function_call_setup_args_variables, args_var_declaration_ret,
|
||||
func_obj_p, local_env_p, arguments_list_p, arguments_list_len, is_strict);
|
||||
|
||||
ecma_completion_value_t run_completion = run_int_from_pos (code_first_opcode_idx,
|
||||
this_binding,
|
||||
local_env_p,
|
||||
is_strict,
|
||||
false);
|
||||
ecma_completion_value_t run_completion;
|
||||
run_int_from_pos (run_completion,
|
||||
code_first_opcode_idx,
|
||||
this_binding,
|
||||
local_env_p,
|
||||
is_strict,
|
||||
false);
|
||||
if (ecma_is_completion_value_return (run_completion))
|
||||
{
|
||||
ecma_value_t value_to_ret;
|
||||
ecma_get_completion_value_value (value_to_ret, run_completion);
|
||||
|
||||
ret_value = ecma_make_normal_completion_value (value_to_ret);
|
||||
ecma_make_normal_completion_value (ret_value, value_to_ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -538,12 +559,10 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
|
||||
|
||||
ecma_deref_object (local_env_p);
|
||||
ecma_free_value (this_binding, true);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else if (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION)
|
||||
{
|
||||
return ecma_builtin_dispatch_call (func_obj_p, this_arg_value, arguments_list_p, arguments_list_len);
|
||||
ecma_builtin_dispatch_call (ret_value, func_obj_p, this_arg_value, arguments_list_p, arguments_list_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -561,8 +580,9 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
|
||||
void
|
||||
ecma_op_function_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *func_obj_p, /**< Function object */
|
||||
const ecma_value_t* arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< length of arguments list */
|
||||
{
|
||||
@@ -575,18 +595,15 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
|
||||
{
|
||||
if (unlikely (ecma_get_object_is_builtin (func_obj_p)))
|
||||
{
|
||||
return ecma_builtin_dispatch_construct (func_obj_p, arguments_list_p, arguments_list_len);
|
||||
ecma_builtin_dispatch_construct (ret_value, func_obj_p, arguments_list_p, arguments_list_len);
|
||||
return;
|
||||
}
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ecma_string_t *prototype_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_PROTOTYPE);
|
||||
|
||||
// 5.
|
||||
ECMA_TRY_CATCH (func_obj_prototype_prop_value,
|
||||
ecma_op_object_get (func_obj_p,
|
||||
prototype_magic_string_p),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value,
|
||||
ecma_op_object_get, func_obj_prototype_prop_value, func_obj_p, prototype_magic_string_p);
|
||||
|
||||
// 6.
|
||||
ecma_object_t *prototype_p;
|
||||
@@ -611,12 +628,9 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
|
||||
ecma_deref_object (prototype_p);
|
||||
|
||||
// 8.
|
||||
ECMA_TRY_CATCH (call_completion,
|
||||
ecma_op_function_call (func_obj_p,
|
||||
ecma_value_t (obj_p),
|
||||
arguments_list_p,
|
||||
arguments_list_len),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value,
|
||||
ecma_op_function_call, call_completion,
|
||||
func_obj_p, ecma_value_t (obj_p), arguments_list_p, arguments_list_len);
|
||||
|
||||
ecma_value_t obj_value;
|
||||
|
||||
@@ -633,14 +647,12 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
|
||||
obj_value = obj_p;
|
||||
}
|
||||
|
||||
ret_value = ecma_make_normal_completion_value (obj_value);
|
||||
ecma_make_normal_completion_value (ret_value, obj_value);
|
||||
|
||||
ECMA_FINALIZE (call_completion);
|
||||
ECMA_FINALIZE (func_obj_prototype_prop_value);
|
||||
|
||||
ecma_deref_ecma_string (prototype_magic_string_p);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -657,8 +669,9 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
|
||||
* @return completion value
|
||||
* returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_function_declaration (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
void
|
||||
ecma_op_function_declaration (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
ecma_string_t *function_name_p, /**< function name */
|
||||
opcode_counter_t function_code_opcode_idx, /**< index of first opcode of function code */
|
||||
ecma_string_t* formal_parameter_list_p[], /**< formal parameters list */
|
||||
@@ -678,14 +691,14 @@ ecma_op_function_declaration (ecma_object_t *lex_env_p, /**< lexical environment
|
||||
bool func_already_declared = ecma_op_has_binding (lex_env_p, function_name_p);
|
||||
|
||||
// d.
|
||||
ecma_completion_value_t completion = ecma_make_empty_completion_value ();
|
||||
ecma_completion_value_t completion;
|
||||
|
||||
if (!func_already_declared)
|
||||
{
|
||||
completion = ecma_op_create_mutable_binding (lex_env_p,
|
||||
function_name_p,
|
||||
is_configurable_bindings);
|
||||
|
||||
ecma_op_create_mutable_binding (completion,
|
||||
lex_env_p,
|
||||
function_name_p,
|
||||
is_configurable_bindings);
|
||||
JERRY_ASSERT (ecma_is_completion_value_empty (completion));
|
||||
}
|
||||
else if (ecma_is_lexical_environment_global (lex_env_p))
|
||||
@@ -712,14 +725,15 @@ ecma_op_function_declaration (ecma_object_t *lex_env_p, /**< lexical environment
|
||||
property_desc.is_configurable = is_configurable_bindings;
|
||||
}
|
||||
|
||||
completion = ecma_op_object_define_own_property (glob_obj_p,
|
||||
function_name_p,
|
||||
&property_desc,
|
||||
true);
|
||||
ecma_op_object_define_own_property (completion,
|
||||
glob_obj_p,
|
||||
function_name_p,
|
||||
&property_desc,
|
||||
true);
|
||||
}
|
||||
else if (existing_prop_p->type == ECMA_PROPERTY_NAMEDACCESSOR)
|
||||
{
|
||||
completion = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (completion, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -728,15 +742,13 @@ ecma_op_function_declaration (ecma_object_t *lex_env_p, /**< lexical environment
|
||||
if (!ecma_is_property_writable (existing_prop_p)
|
||||
|| !ecma_is_property_enumerable (existing_prop_p))
|
||||
{
|
||||
completion = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (completion, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
}
|
||||
|
||||
ecma_deref_object (glob_obj_p);
|
||||
}
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
if (ecma_is_completion_value_throw (completion))
|
||||
{
|
||||
ret_value = completion;
|
||||
@@ -746,15 +758,14 @@ ecma_op_function_declaration (ecma_object_t *lex_env_p, /**< lexical environment
|
||||
JERRY_ASSERT (ecma_is_completion_value_empty (completion));
|
||||
|
||||
// f.
|
||||
ret_value = ecma_op_set_mutable_binding (lex_env_p,
|
||||
function_name_p,
|
||||
ecma_value_t (func_obj_p),
|
||||
is_strict);
|
||||
ecma_op_set_mutable_binding (ret_value,
|
||||
lex_env_p,
|
||||
function_name_p,
|
||||
ecma_value_t (func_obj_p),
|
||||
is_strict);
|
||||
}
|
||||
|
||||
ecma_deref_object (func_obj_p);
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_op_function_declaration */
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,23 +37,27 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[],
|
||||
bool is_strict,
|
||||
opcode_counter_t first_opcode_idx);
|
||||
|
||||
extern ecma_completion_value_t
|
||||
ecma_op_function_call (ecma_object_t *func_obj_p,
|
||||
extern void
|
||||
ecma_op_function_call (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *func_obj_p,
|
||||
const ecma_value_t& this_arg_value,
|
||||
const ecma_value_t* arguments_list_p,
|
||||
ecma_length_t arguments_list_len);
|
||||
|
||||
extern ecma_completion_value_t
|
||||
ecma_op_function_construct (ecma_object_t *func_obj_p,
|
||||
extern void
|
||||
ecma_op_function_construct (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *func_obj_p,
|
||||
const ecma_value_t* arguments_list_p,
|
||||
ecma_length_t arguments_list_len);
|
||||
|
||||
extern ecma_completion_value_t
|
||||
ecma_op_function_has_instance (ecma_object_t *func_obj_p,
|
||||
extern void
|
||||
ecma_op_function_has_instance (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *func_obj_p,
|
||||
const ecma_value_t& value);
|
||||
|
||||
extern ecma_completion_value_t
|
||||
ecma_op_function_declaration (ecma_object_t *lex_env_p,
|
||||
extern void
|
||||
ecma_op_function_declaration (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *lex_env_p,
|
||||
ecma_string_t *function_name_p,
|
||||
opcode_counter_t function_code_opcode_idx,
|
||||
ecma_string_t* formal_parameter_list_p[],
|
||||
|
||||
@@ -43,8 +43,9 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_get_value_lex_env_base (ecma_object_t *ref_base_lex_env_p, /**< reference's base (lexical environment) */
|
||||
void
|
||||
ecma_op_get_value_lex_env_base (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *ref_base_lex_env_p, /**< reference's base (lexical environment) */
|
||||
ecma_string_t *var_name_string_p, /**< variable name */
|
||||
bool is_strict) /**< flag indicating strict mode */
|
||||
{
|
||||
@@ -53,7 +54,8 @@ ecma_op_get_value_lex_env_base (ecma_object_t *ref_base_lex_env_p, /**< referenc
|
||||
// 3.
|
||||
if (unlikely (is_unresolvable_reference))
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_REFERENCE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_REFERENCE));
|
||||
return;
|
||||
}
|
||||
|
||||
// 5.
|
||||
@@ -61,9 +63,10 @@ ecma_op_get_value_lex_env_base (ecma_object_t *ref_base_lex_env_p, /**< referenc
|
||||
&& ecma_is_lexical_environment (ref_base_lex_env_p));
|
||||
|
||||
// 5.a
|
||||
return ecma_op_get_binding_value (ref_base_lex_env_p,
|
||||
var_name_string_p,
|
||||
is_strict);
|
||||
ecma_op_get_binding_value (ret_value,
|
||||
ref_base_lex_env_p,
|
||||
var_name_string_p,
|
||||
is_strict);
|
||||
} /* ecma_op_get_value_lex_env_base */
|
||||
|
||||
/**
|
||||
@@ -74,8 +77,9 @@ ecma_op_get_value_lex_env_base (ecma_object_t *ref_base_lex_env_p, /**< referenc
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_get_value_object_base (const ecma_reference_t& ref) /**< ECMA-reference */
|
||||
void
|
||||
ecma_op_get_value_object_base (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_reference_t& ref) /**< ECMA-reference */
|
||||
{
|
||||
const ecma_value_t& base = ref.base;
|
||||
const bool is_unresolvable_reference = ecma_is_value_undefined (base);
|
||||
@@ -98,26 +102,22 @@ ecma_op_get_value_object_base (const ecma_reference_t& ref) /**< ECMA-reference
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
|
||||
return ecma_op_object_get (obj_p, ECMA_GET_NON_NULL_POINTER (ecma_string_t,
|
||||
ref.referenced_name_cp));
|
||||
ecma_op_object_get (ret_value, obj_p, ECMA_GET_NON_NULL_POINTER (ecma_string_t,
|
||||
ref.referenced_name_cp));
|
||||
}
|
||||
else
|
||||
{
|
||||
// 4.b case 2
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (obj_base, ecma_op_to_object (base), ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_object, obj_base, base);
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (obj_base);
|
||||
JERRY_ASSERT (obj_p != NULL
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
|
||||
ret_value = ecma_op_object_get (obj_p, ECMA_GET_NON_NULL_POINTER (ecma_string_t,
|
||||
ref.referenced_name_cp));
|
||||
ecma_op_object_get (ret_value, obj_p, ECMA_GET_NON_NULL_POINTER (ecma_string_t,
|
||||
ref.referenced_name_cp));
|
||||
|
||||
ECMA_FINALIZE (obj_base);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
} /* ecma_op_get_value_object_base */
|
||||
|
||||
@@ -129,8 +129,9 @@ ecma_op_get_value_object_base (const ecma_reference_t& ref) /**< ECMA-reference
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_put_value_lex_env_base (ecma_object_t *ref_base_lex_env_p, /**< reference's base (lexical environment) */
|
||||
void
|
||||
ecma_op_put_value_lex_env_base (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *ref_base_lex_env_p, /**< reference's base (lexical environment) */
|
||||
ecma_string_t *var_name_string_p, /**< variable name */
|
||||
bool is_strict, /**< flag indicating strict mode */
|
||||
const ecma_value_t& value) /**< ECMA-value */
|
||||
@@ -143,24 +144,28 @@ ecma_op_put_value_lex_env_base (ecma_object_t *ref_base_lex_env_p, /**< referenc
|
||||
// 3.a.
|
||||
if (is_strict)
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_REFERENCE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_REFERENCE));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 3.b.
|
||||
ecma_object_t *global_object_p = ecma_builtin_get (ECMA_BUILTIN_ID_GLOBAL);
|
||||
|
||||
ecma_completion_value_t completion = ecma_op_object_put (global_object_p,
|
||||
var_name_string_p,
|
||||
value,
|
||||
false);
|
||||
ecma_completion_value_t completion;
|
||||
ecma_op_object_put (completion,
|
||||
global_object_p,
|
||||
var_name_string_p,
|
||||
value,
|
||||
false);
|
||||
|
||||
ecma_deref_object (global_object_p);
|
||||
|
||||
JERRY_ASSERT(ecma_is_completion_value_normal_true (completion)
|
||||
|| ecma_is_completion_value_normal_false (completion));
|
||||
|
||||
return ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,10 +174,11 @@ ecma_op_put_value_lex_env_base (ecma_object_t *ref_base_lex_env_p, /**< referenc
|
||||
&& ecma_is_lexical_environment (ref_base_lex_env_p));
|
||||
|
||||
// 5.a
|
||||
return ecma_op_set_mutable_binding (ref_base_lex_env_p,
|
||||
var_name_string_p,
|
||||
value,
|
||||
is_strict);
|
||||
ecma_op_set_mutable_binding (ret_value,
|
||||
ref_base_lex_env_p,
|
||||
var_name_string_p,
|
||||
value,
|
||||
is_strict);
|
||||
} /* ecma_op_put_value_lex_env_base */
|
||||
|
||||
/**
|
||||
@@ -181,16 +187,17 @@ ecma_op_put_value_lex_env_base (ecma_object_t *ref_base_lex_env_p, /**< referenc
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_reject_put (bool is_throw) /**< Throw flag */
|
||||
static void
|
||||
ecma_reject_put (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
bool is_throw) /**< Throw flag */
|
||||
{
|
||||
if (is_throw)
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_EMPTY);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_EMPTY);
|
||||
}
|
||||
} /* ecma_reject_put */
|
||||
|
||||
@@ -202,8 +209,9 @@ ecma_reject_put (bool is_throw) /**< Throw flag */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_put_value_object_base (const ecma_reference_t& ref, /**< ECMA-reference */
|
||||
void
|
||||
ecma_op_put_value_object_base (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_reference_t& ref, /**< ECMA-reference */
|
||||
const ecma_value_t& value) /**< ECMA-value */
|
||||
{
|
||||
const ecma_value_t& base = ref.base;
|
||||
@@ -227,29 +235,21 @@ ecma_op_put_value_object_base (const ecma_reference_t& ref, /**< ECMA-reference
|
||||
JERRY_ASSERT (obj_p != NULL
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_object_put, put_ret_value, obj_p,
|
||||
ECMA_GET_NON_NULL_POINTER (ecma_string_t,
|
||||
ref.referenced_name_cp),
|
||||
value, ref.is_strict);
|
||||
|
||||
ECMA_TRY_CATCH (put_ret_value,
|
||||
ecma_op_object_put (obj_p,
|
||||
ECMA_GET_NON_NULL_POINTER (ecma_string_t,
|
||||
ref.referenced_name_cp),
|
||||
value,
|
||||
ref.is_strict),
|
||||
ret_value);
|
||||
|
||||
ret_value = ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
|
||||
ECMA_FINALIZE (put_ret_value);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 4.b case 2
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
// sub_1.
|
||||
ECMA_TRY_CATCH (obj_base, ecma_op_to_object (base), ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_object, obj_base, base);
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (obj_base);
|
||||
JERRY_ASSERT (obj_p != NULL
|
||||
@@ -261,7 +261,7 @@ ecma_op_put_value_object_base (const ecma_reference_t& ref, /**< ECMA-reference
|
||||
// sub_2.
|
||||
if (!ecma_op_object_can_put (obj_p, referenced_name_p))
|
||||
{
|
||||
ret_value = ecma_reject_put (ref.is_strict);
|
||||
ecma_reject_put (ret_value, ref.is_strict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -277,7 +277,7 @@ ecma_op_put_value_object_base (const ecma_reference_t& ref, /**< ECMA-reference
|
||||
|| (prop_p == NULL)
|
||||
|| (prop_p->type != ECMA_PROPERTY_NAMEDACCESSOR))
|
||||
{
|
||||
ret_value = ecma_reject_put (ref.is_strict);
|
||||
ecma_reject_put (ret_value, ref.is_strict);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -288,19 +288,15 @@ ecma_op_put_value_object_base (const ecma_reference_t& ref, /**< ECMA-reference
|
||||
prop_p->u.named_accessor_property.set_p);
|
||||
JERRY_ASSERT (setter_p != NULL);
|
||||
|
||||
ECMA_TRY_CATCH (call_ret,
|
||||
ecma_op_function_call (setter_p, base, &value, 1),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_function_call, call_ret, setter_p, base, &value, 1);
|
||||
|
||||
ret_value = ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
|
||||
ECMA_FINALIZE (call_ret);
|
||||
}
|
||||
}
|
||||
|
||||
ECMA_FINALIZE (obj_base);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
} /* ecma_op_put_value_object_base */
|
||||
|
||||
|
||||
@@ -69,8 +69,9 @@ ecma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
void
|
||||
ecma_op_create_mutable_binding (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
ecma_string_t *name_p, /**< argument N */
|
||||
bool is_deletable) /**< argument D */
|
||||
{
|
||||
@@ -105,14 +106,17 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme
|
||||
prop_desc.is_configurable = is_deletable;
|
||||
}
|
||||
|
||||
ecma_completion_value_t completion = ecma_op_object_define_own_property (binding_obj_p,
|
||||
name_p,
|
||||
&prop_desc,
|
||||
true);
|
||||
ecma_completion_value_t completion;
|
||||
ecma_op_object_define_own_property (completion,
|
||||
binding_obj_p,
|
||||
name_p,
|
||||
&prop_desc,
|
||||
true);
|
||||
|
||||
if (ecma_is_completion_value_throw (completion))
|
||||
{
|
||||
return completion;
|
||||
ret_value = completion;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -121,7 +125,7 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
} /* ecma_op_create_mutable_binding */
|
||||
|
||||
/**
|
||||
@@ -132,8 +136,9 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
void
|
||||
ecma_op_set_mutable_binding (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
ecma_string_t *name_p, /**< argument N */
|
||||
const ecma_value_t& value, /**< argument V */
|
||||
bool is_strict) /**< argument S */
|
||||
@@ -159,7 +164,8 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment
|
||||
|
||||
if (is_equal)
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR));
|
||||
return;
|
||||
}
|
||||
# endif /* CONFIG_ECMA_COMPACT_PROFILE */
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
@@ -172,7 +178,8 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment
|
||||
}
|
||||
else if (is_strict)
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -181,14 +188,17 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment
|
||||
|
||||
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
|
||||
|
||||
ecma_completion_value_t completion = ecma_op_object_put (binding_obj_p,
|
||||
name_p,
|
||||
value,
|
||||
is_strict);
|
||||
ecma_completion_value_t completion;
|
||||
ecma_op_object_put (completion,
|
||||
binding_obj_p,
|
||||
name_p,
|
||||
value,
|
||||
is_strict);
|
||||
|
||||
if (ecma_is_completion_value_throw (completion))
|
||||
{
|
||||
return completion;
|
||||
ret_value = completion;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -197,7 +207,7 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
} /* ecma_op_set_mutable_binding */
|
||||
|
||||
/**
|
||||
@@ -208,8 +218,9 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
void
|
||||
ecma_op_get_binding_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
ecma_string_t *name_p, /**< argument N */
|
||||
bool is_strict) /**< argument S */
|
||||
{
|
||||
@@ -234,7 +245,8 @@ ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
|
||||
if (is_equal)
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR));
|
||||
return;
|
||||
}
|
||||
# endif /* CONFIG_ECMA_COMPACT_PROFILE */
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
@@ -251,18 +263,20 @@ ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
/* unitialized immutable binding */
|
||||
if (is_strict)
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_REFERENCE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_REFERENCE));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ecma_value_t prop_value_copy;
|
||||
ecma_copy_value (prop_value_copy, prop_value, true);
|
||||
|
||||
return ecma_make_normal_completion_value (prop_value_copy);
|
||||
ecma_make_normal_completion_value (ret_value, prop_value_copy);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -274,15 +288,17 @@ ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
{
|
||||
if (is_strict)
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_REFERENCE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_REFERENCE));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_op_object_get (binding_obj_p, name_p);
|
||||
ecma_op_object_get (ret_value, binding_obj_p, name_p);
|
||||
}
|
||||
} /* ecma_op_get_binding_value */
|
||||
|
||||
@@ -295,8 +311,9 @@ ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
* Return value is simple and so need not be freed.
|
||||
* However, ecma_free_completion_value may be called for it, but it is a no-op.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
void
|
||||
ecma_op_delete_binding (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
ecma_string_t *name_p) /**< argument N */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL
|
||||
@@ -329,7 +346,7 @@ ecma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_make_simple_completion_value (ret_val);
|
||||
ecma_make_simple_completion_value (ret_value, ret_val);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -337,7 +354,7 @@ ecma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
|
||||
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
|
||||
|
||||
return ecma_op_object_delete (binding_obj_p, name_p, false);
|
||||
ecma_op_object_delete (ret_value, binding_obj_p, name_p, false);
|
||||
}
|
||||
} /* ecma_op_delete_binding */
|
||||
|
||||
@@ -349,15 +366,16 @@ ecma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_implicit_this_value (ecma_object_t *lex_env_p) /**< lexical environment */
|
||||
void
|
||||
ecma_op_implicit_this_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *lex_env_p) /**< lexical environment */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL
|
||||
&& ecma_is_lexical_environment (lex_env_p));
|
||||
|
||||
if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -368,11 +386,11 @@ ecma_op_implicit_this_value (ecma_object_t *lex_env_p) /**< lexical environment
|
||||
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
|
||||
ecma_ref_object (binding_obj_p);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (binding_obj_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (binding_obj_p));
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
}
|
||||
}
|
||||
} /* ecma_op_implicit_this_value */
|
||||
|
||||
@@ -31,33 +31,51 @@
|
||||
*/
|
||||
|
||||
/* ECMA-262 v5, 8.7.1 and 8.7.2 */
|
||||
extern ecma_completion_value_t ecma_op_get_value_lex_env_base (ecma_object_t *ref_base_lex_env_p,
|
||||
ecma_string_t *var_name_string_p,
|
||||
bool is_strict);
|
||||
extern ecma_completion_value_t ecma_op_get_value_object_base (const ecma_reference_t& ref);
|
||||
extern ecma_completion_value_t ecma_op_put_value_lex_env_base (ecma_object_t *ref_base_lex_env_p,
|
||||
ecma_string_t *var_name_string_p,
|
||||
bool is_strict,
|
||||
const ecma_value_t& value);
|
||||
extern ecma_completion_value_t ecma_op_put_value_object_base (const ecma_reference_t& ref,
|
||||
const ecma_value_t& value);
|
||||
extern void
|
||||
ecma_op_get_value_lex_env_base (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *ref_base_lex_env_p,
|
||||
ecma_string_t *var_name_string_p,
|
||||
bool is_strict);
|
||||
extern void
|
||||
ecma_op_get_value_object_base (ecma_completion_value_t &ret_value,
|
||||
const ecma_reference_t& ref);
|
||||
extern void
|
||||
ecma_op_put_value_lex_env_base (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *ref_base_lex_env_p,
|
||||
ecma_string_t *var_name_string_p,
|
||||
bool is_strict,
|
||||
const ecma_value_t& value);
|
||||
extern void
|
||||
ecma_op_put_value_object_base (ecma_completion_value_t &ret_value,
|
||||
const ecma_reference_t& ref,
|
||||
const ecma_value_t& value);
|
||||
|
||||
/* ECMA-262 v5, Table 17. Abstract methods of Environment Records */
|
||||
extern bool ecma_op_has_binding (ecma_object_t *lex_env_p,
|
||||
ecma_string_t *name_p);
|
||||
extern ecma_completion_value_t ecma_op_create_mutable_binding (ecma_object_t *lex_env_p,
|
||||
ecma_string_t *name_p,
|
||||
bool is_deletable);
|
||||
extern ecma_completion_value_t ecma_op_set_mutable_binding (ecma_object_t *lex_env_p,
|
||||
ecma_string_t *name_p,
|
||||
const ecma_value_t& value,
|
||||
bool is_strict);
|
||||
extern ecma_completion_value_t ecma_op_get_binding_value (ecma_object_t *lex_env_p,
|
||||
ecma_string_t *name_p,
|
||||
bool is_strict);
|
||||
extern ecma_completion_value_t ecma_op_delete_binding (ecma_object_t *lex_env_p,
|
||||
ecma_string_t *name_p);
|
||||
extern ecma_completion_value_t ecma_op_implicit_this_value (ecma_object_t *lex_env_p);
|
||||
extern void
|
||||
ecma_op_create_mutable_binding (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *lex_env_p,
|
||||
ecma_string_t *name_p,
|
||||
bool is_deletable);
|
||||
extern void
|
||||
ecma_op_set_mutable_binding (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *lex_env_p,
|
||||
ecma_string_t *name_p,
|
||||
const ecma_value_t& value,
|
||||
bool is_strict);
|
||||
extern void
|
||||
ecma_op_get_binding_value (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *lex_env_p,
|
||||
ecma_string_t *name_p,
|
||||
bool is_strict);
|
||||
extern void
|
||||
ecma_op_delete_binding (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *lex_env_p,
|
||||
ecma_string_t *name_p);
|
||||
extern void
|
||||
ecma_op_implicit_this_value (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *lex_env_p);
|
||||
|
||||
/* ECMA-262 v5, Table 18. Additional methods of Declarative Environment Records */
|
||||
extern void ecma_op_create_immutable_binding (ecma_object_t *lex_env_p,
|
||||
|
||||
@@ -38,14 +38,17 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_create_number_object (const ecma_value_t& arg) /**< argument passed to the Number constructor */
|
||||
void
|
||||
ecma_op_create_number_object (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& arg) /**< argument passed to the Number constructor */
|
||||
{
|
||||
ecma_completion_value_t to_num_completion = ecma_op_to_number (arg);
|
||||
ecma_completion_value_t to_num_completion;
|
||||
ecma_op_to_number (to_num_completion, arg);
|
||||
|
||||
if (!ecma_is_completion_value_normal (to_num_completion))
|
||||
{
|
||||
return to_num_completion;
|
||||
ret_value = to_num_completion;
|
||||
return;
|
||||
}
|
||||
|
||||
ecma_value_t num_value;
|
||||
@@ -71,5 +74,5 @@ ecma_op_create_number_object (const ecma_value_t& arg) /**< argument passed to t
|
||||
ECMA_INTERNAL_PROPERTY_PRIMITIVE_NUMBER_VALUE);
|
||||
ECMA_SET_POINTER (prim_value_prop_p->u.internal_property.value, prim_value_p);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (obj_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (obj_p));
|
||||
} /* ecma_op_create_number_object */
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
extern ecma_completion_value_t ecma_op_create_number_object (const ecma_value_t& arg);
|
||||
extern void
|
||||
ecma_op_create_number_object (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t& arg);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -81,10 +81,12 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
|
||||
prop_desc.is_configurable = true;
|
||||
}
|
||||
ecma_string_t *length_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_LENGTH);
|
||||
ecma_completion_value_t completion = ecma_op_object_define_own_property (obj_p,
|
||||
length_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
ecma_completion_value_t completion;
|
||||
ecma_op_object_define_own_property (completion,
|
||||
obj_p,
|
||||
length_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
||||
ecma_deref_ecma_string (length_magic_string_p);
|
||||
|
||||
@@ -112,10 +114,11 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
|
||||
|
||||
ecma_string_t *indx_string_p = ecma_new_ecma_string_from_number (ecma_uint32_to_number (indx));
|
||||
|
||||
completion = ecma_op_object_define_own_property (obj_p,
|
||||
indx_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
ecma_op_object_define_own_property (completion,
|
||||
obj_p,
|
||||
indx_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
||||
|
||||
ecma_deref_ecma_string (indx_string_p);
|
||||
@@ -176,10 +179,11 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
|
||||
prop_desc.value = (ecma_value_packed_t) ecma_value_t (name_p);
|
||||
}
|
||||
|
||||
completion = ecma_op_object_define_own_property (map_p,
|
||||
indx_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
ecma_op_object_define_own_property (completion,
|
||||
map_p,
|
||||
indx_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
||||
|
||||
ecma_deref_ecma_string (indx_string_p);
|
||||
@@ -224,10 +228,11 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
|
||||
|
||||
ecma_string_t *callee_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_CALLEE);
|
||||
|
||||
completion = ecma_op_object_define_own_property (obj_p,
|
||||
callee_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
ecma_op_object_define_own_property (completion,
|
||||
obj_p,
|
||||
callee_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
||||
|
||||
ecma_deref_ecma_string (callee_magic_string_p);
|
||||
@@ -255,10 +260,11 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
|
||||
ecma_string_t *callee_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_CALLEE);
|
||||
ecma_string_t *caller_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_CALLER);
|
||||
|
||||
completion = ecma_op_object_define_own_property (obj_p,
|
||||
callee_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
ecma_op_object_define_own_property (completion,
|
||||
obj_p,
|
||||
callee_magic_string_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
||||
|
||||
ecma_deref_ecma_string (callee_magic_string_p);
|
||||
@@ -275,8 +281,9 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_arguments_get_mapped_arg_value (ecma_object_t *map_p, /**< [[ParametersMap]] object */
|
||||
static void
|
||||
ecma_arguments_get_mapped_arg_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *map_p, /**< [[ParametersMap]] object */
|
||||
ecma_property_t *arg_name_prop_p) /**< property of [[ParametersMap]]
|
||||
corresponding to index and value
|
||||
equal to mapped argument's name */
|
||||
@@ -292,12 +299,8 @@ ecma_arguments_get_mapped_arg_value (ecma_object_t *map_p, /**< [[ParametersMap]
|
||||
|
||||
ecma_string_t *arg_name_p = ecma_get_string_from_value (arg_name_prop_value);
|
||||
|
||||
ecma_completion_value_t completion = ecma_op_get_binding_value (lex_env_p,
|
||||
arg_name_p,
|
||||
true);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal (completion));
|
||||
|
||||
return completion;
|
||||
ecma_op_get_binding_value (ret_value, lex_env_p, arg_name_p, true);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal (ret_value));
|
||||
} /* ecma_arguments_get_mapped_arg_value */
|
||||
|
||||
/**
|
||||
@@ -310,8 +313,9 @@ ecma_arguments_get_mapped_arg_value (ecma_object_t *map_p, /**< [[ParametersMap]
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_arguments_object_get (ecma_object_t *obj_p, /**< the object */
|
||||
void
|
||||
ecma_op_arguments_object_get (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
// 1.
|
||||
@@ -328,12 +332,12 @@ ecma_op_arguments_object_get (ecma_object_t *obj_p, /**< the object */
|
||||
/* We don't check for 'caller' (item 3.b) here, because the 'caller' property is defined
|
||||
as non-configurable and it's get/set are set to [[ThrowTypeError]] object */
|
||||
|
||||
return ecma_op_general_object_get (obj_p, property_name_p);
|
||||
ecma_op_general_object_get (ret_value, obj_p, property_name_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 4.
|
||||
return ecma_arguments_get_mapped_arg_value (map_p, mapped_prop_p);
|
||||
ecma_arguments_get_mapped_arg_value (ret_value, map_p, mapped_prop_p);
|
||||
}
|
||||
} /* ecma_op_arguments_object_get */
|
||||
|
||||
@@ -372,7 +376,8 @@ ecma_op_arguments_object_get_own_property (ecma_object_t *obj_p, /**< the object
|
||||
if (mapped_prop_p != NULL)
|
||||
{
|
||||
// a.
|
||||
ecma_completion_value_t get_mapped_arg_completion = ecma_arguments_get_mapped_arg_value (map_p, mapped_prop_p);
|
||||
ecma_completion_value_t get_mapped_arg_completion;
|
||||
ecma_arguments_get_mapped_arg_value (get_mapped_arg_completion, map_p, mapped_prop_p);
|
||||
|
||||
ecma_value_t value_to_assign;
|
||||
ecma_get_completion_value_value (value_to_assign, get_mapped_arg_completion);
|
||||
@@ -396,8 +401,9 @@ ecma_op_arguments_object_get_own_property (ecma_object_t *obj_p, /**< the object
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_arguments_object_define_own_property (ecma_object_t *obj_p, /**< the object */
|
||||
void
|
||||
ecma_op_arguments_object_define_own_property (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
const ecma_property_descriptor_t* property_desc_p, /**< property
|
||||
* descriptor */
|
||||
@@ -412,14 +418,8 @@ ecma_op_arguments_object_define_own_property (ecma_object_t *obj_p, /**< the obj
|
||||
ecma_property_t *mapped_prop_p = ecma_op_object_get_own_property (map_p, property_name_p);
|
||||
|
||||
// 3.
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (defined,
|
||||
ecma_op_general_object_define_own_property (obj_p,
|
||||
property_name_p,
|
||||
property_desc_p,
|
||||
is_throw),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_general_object_define_own_property, defined,
|
||||
obj_p, property_name_p, property_desc_p, is_throw);
|
||||
|
||||
// 5.
|
||||
if (mapped_prop_p != NULL)
|
||||
@@ -428,26 +428,28 @@ ecma_op_arguments_object_define_own_property (ecma_object_t *obj_p, /**< the obj
|
||||
if (property_desc_p->is_get_defined
|
||||
|| property_desc_p->is_set_defined)
|
||||
{
|
||||
ecma_completion_value_t completion = ecma_op_object_delete (map_p, property_name_p, false);
|
||||
ecma_completion_value_t completion;
|
||||
ecma_op_object_delete (completion, map_p, property_name_p, false);
|
||||
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
||||
|
||||
// 6.
|
||||
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// b.
|
||||
|
||||
ecma_completion_value_t completion = ecma_make_empty_completion_value ();
|
||||
ecma_completion_value_t completion;
|
||||
|
||||
// i.
|
||||
if (property_desc_p->is_value_defined)
|
||||
{
|
||||
completion = ecma_op_object_put (map_p,
|
||||
property_name_p,
|
||||
ecma_value_t (property_desc_p->value),
|
||||
is_throw);
|
||||
ecma_op_object_put (completion,
|
||||
map_p,
|
||||
property_name_p,
|
||||
ecma_value_t (property_desc_p->value),
|
||||
is_throw);
|
||||
}
|
||||
|
||||
if (unlikely (ecma_is_completion_value_throw (completion)))
|
||||
@@ -460,26 +462,24 @@ ecma_op_arguments_object_define_own_property (ecma_object_t *obj_p, /**< the obj
|
||||
if (property_desc_p->is_writable_defined
|
||||
&& !property_desc_p->is_writable)
|
||||
{
|
||||
completion = ecma_op_object_delete (map_p,
|
||||
property_name_p,
|
||||
false);
|
||||
|
||||
ecma_op_object_delete (completion,
|
||||
map_p,
|
||||
property_name_p,
|
||||
false);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
||||
}
|
||||
|
||||
// 6.
|
||||
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_TRUE);
|
||||
}
|
||||
|
||||
ECMA_FINALIZE (defined);
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_op_arguments_object_define_own_property */
|
||||
|
||||
/**
|
||||
@@ -492,8 +492,9 @@ ecma_op_arguments_object_define_own_property (ecma_object_t *obj_p, /**< the obj
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_arguments_object_delete (ecma_object_t *obj_p, /**< the object */
|
||||
void
|
||||
ecma_op_arguments_object_delete (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
bool is_throw) /**< flag that controls failure handling */
|
||||
{
|
||||
@@ -506,36 +507,30 @@ ecma_op_arguments_object_delete (ecma_object_t *obj_p, /**< the object */
|
||||
ecma_property_t *mapped_prop_p = ecma_op_object_get_own_property (map_p, property_name_p);
|
||||
|
||||
// 3.
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (delete_in_args_ret,
|
||||
ecma_op_general_object_delete (obj_p,
|
||||
property_name_p,
|
||||
is_throw),
|
||||
ret_value);
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_general_object_delete, delete_in_args_ret, obj_p, property_name_p, is_throw);
|
||||
|
||||
if (ecma_is_value_true (delete_in_args_ret))
|
||||
{
|
||||
if (mapped_prop_p != NULL)
|
||||
{
|
||||
ecma_completion_value_t delete_in_map_completion = ecma_op_object_delete (map_p,
|
||||
property_name_p,
|
||||
false);
|
||||
ecma_completion_value_t delete_in_map_completion;
|
||||
ecma_op_object_delete (delete_in_map_completion,
|
||||
map_p,
|
||||
property_name_p,
|
||||
false);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (delete_in_map_completion));
|
||||
}
|
||||
|
||||
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
JERRY_ASSERT (ecma_is_value_boolean (delete_in_args_ret));
|
||||
|
||||
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_FALSE);
|
||||
}
|
||||
|
||||
ECMA_FINALIZE (delete_in_args_ret);
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_op_arguments_object_delete */
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,15 +28,21 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p,
|
||||
ecma_length_t arguments_list_length,
|
||||
bool is_strict);
|
||||
|
||||
extern ecma_completion_value_t ecma_op_arguments_object_get (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern ecma_property_t *ecma_op_arguments_object_get_own_property (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern ecma_completion_value_t ecma_op_arguments_object_delete (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
bool is_throw);
|
||||
extern ecma_completion_value_t
|
||||
ecma_op_arguments_object_define_own_property (ecma_object_t *obj_p,
|
||||
extern void
|
||||
ecma_op_arguments_object_get (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern ecma_property_t*
|
||||
ecma_op_arguments_object_get_own_property (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern void
|
||||
ecma_op_arguments_object_delete (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
bool is_throw);
|
||||
extern void
|
||||
ecma_op_arguments_object_define_own_property (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
const ecma_property_descriptor_t* property_desc_p,
|
||||
bool is_throw);
|
||||
|
||||
@@ -36,16 +36,17 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
static ecma_completion_value_t
|
||||
ecma_reject (bool is_throw) /**< Throw flag */
|
||||
static void
|
||||
ecma_reject (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
bool is_throw) /**< Throw flag */
|
||||
{
|
||||
if (is_throw)
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_FALSE);
|
||||
}
|
||||
} /* ecma_reject */
|
||||
|
||||
@@ -79,8 +80,9 @@ ecma_op_create_object_object_noarg (void)
|
||||
*
|
||||
* @return pointer to newly created 'Object' object
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_create_object_object_arg (const ecma_value_t& value) /**< argument of constructor */
|
||||
void
|
||||
ecma_op_create_object_object_arg (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t& value) /**< argument of constructor */
|
||||
{
|
||||
ecma_check_value_type_is_spec_defined (value);
|
||||
|
||||
@@ -90,7 +92,7 @@ ecma_op_create_object_object_arg (const ecma_value_t& value) /**< argument of co
|
||||
|| ecma_is_value_boolean (value))
|
||||
{
|
||||
// 1.b, 1.c, 1.d
|
||||
return ecma_op_to_object (value);
|
||||
ecma_op_to_object (ret_value, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -100,7 +102,7 @@ ecma_op_create_object_object_arg (const ecma_value_t& value) /**< argument of co
|
||||
|
||||
ecma_object_t *obj_p = ecma_op_create_object_object_noarg ();
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (obj_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (obj_p));
|
||||
}
|
||||
} /* ecma_op_create_object_object_arg */
|
||||
|
||||
@@ -114,8 +116,9 @@ ecma_op_create_object_object_arg (const ecma_value_t& value) /**< argument of co
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_general_object_get (ecma_object_t *obj_p, /**< the object */
|
||||
void
|
||||
ecma_op_general_object_get (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
@@ -128,7 +131,8 @@ ecma_op_general_object_get (ecma_object_t *obj_p, /**< the object */
|
||||
// 2.
|
||||
if (prop_p == NULL)
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
return;
|
||||
}
|
||||
|
||||
// 3.
|
||||
@@ -140,7 +144,7 @@ ecma_op_general_object_get (ecma_object_t *obj_p, /**< the object */
|
||||
ecma_value_t prop_value_copy;
|
||||
ecma_copy_value (prop_value_copy, prop_value, true);
|
||||
|
||||
return ecma_make_normal_completion_value (prop_value_copy);
|
||||
ecma_make_normal_completion_value (ret_value, prop_value_copy);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -151,18 +155,17 @@ ecma_op_general_object_get (ecma_object_t *obj_p, /**< the object */
|
||||
// 5.
|
||||
if (getter_p == NULL)
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_op_function_call (getter_p,
|
||||
ecma_value_t (obj_p),
|
||||
NULL,
|
||||
0);
|
||||
ecma_op_function_call (ret_value,
|
||||
getter_p,
|
||||
ecma_value_t (obj_p),
|
||||
NULL,
|
||||
0);
|
||||
}
|
||||
}
|
||||
|
||||
JERRY_UNREACHABLE();
|
||||
} /* ecma_op_general_object_get */
|
||||
|
||||
/**
|
||||
@@ -237,8 +240,9 @@ ecma_op_general_object_get_property (ecma_object_t *obj_p, /**< the object */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_general_object_put (ecma_object_t *obj_p, /**< the object */
|
||||
void
|
||||
ecma_op_general_object_put (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
const ecma_value_t& value, /**< ecma-value */
|
||||
bool is_throw) /**< flag that controls failure handling */
|
||||
@@ -253,12 +257,14 @@ ecma_op_general_object_put (ecma_object_t *obj_p, /**< the object */
|
||||
if (is_throw)
|
||||
{
|
||||
// a.
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// b.
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_FALSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,10 +283,12 @@ ecma_op_general_object_put (ecma_object_t *obj_p, /**< the object */
|
||||
}
|
||||
|
||||
// b., c.
|
||||
return ecma_op_object_define_own_property (obj_p,
|
||||
property_name_p,
|
||||
&value_desc,
|
||||
is_throw);
|
||||
ecma_op_object_define_own_property (ret_value,
|
||||
obj_p,
|
||||
property_name_p,
|
||||
&value_desc,
|
||||
is_throw);
|
||||
return;
|
||||
}
|
||||
|
||||
// 4.
|
||||
@@ -295,20 +303,11 @@ ecma_op_general_object_put (ecma_object_t *obj_p, /**< the object */
|
||||
desc_p->u.named_accessor_property.set_p);
|
||||
JERRY_ASSERT(setter_p != NULL);
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_function_call, call_ret, setter_p, ecma_value_t (obj_p), &value, 1);
|
||||
|
||||
ECMA_TRY_CATCH (call_ret,
|
||||
ecma_op_function_call (setter_p,
|
||||
ecma_value_t (obj_p),
|
||||
&value,
|
||||
1),
|
||||
ret_value);
|
||||
|
||||
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_TRUE);
|
||||
|
||||
ECMA_FINALIZE (call_ret);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -331,13 +330,12 @@ ecma_op_general_object_put (ecma_object_t *obj_p, /**< the object */
|
||||
}
|
||||
|
||||
// b.
|
||||
return ecma_op_object_define_own_property (obj_p,
|
||||
property_name_p,
|
||||
&new_desc,
|
||||
is_throw);
|
||||
ecma_op_object_define_own_property (ret_value,
|
||||
obj_p,
|
||||
property_name_p,
|
||||
&new_desc,
|
||||
is_throw);
|
||||
}
|
||||
|
||||
JERRY_UNREACHABLE();
|
||||
} /* ecma_op_general_object_put */
|
||||
|
||||
/**
|
||||
@@ -452,8 +450,9 @@ ecma_op_general_object_can_put (ecma_object_t *obj_p, /**< the object */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */
|
||||
void
|
||||
ecma_op_general_object_delete (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
bool is_throw) /**< flag that controls failure handling */
|
||||
{
|
||||
@@ -467,7 +466,8 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */
|
||||
// 2.
|
||||
if (desc_p == NULL)
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
// 3.
|
||||
@@ -477,20 +477,18 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */
|
||||
ecma_delete_property (obj_p, desc_p);
|
||||
|
||||
// b.
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_TRUE);
|
||||
}
|
||||
else if (is_throw)
|
||||
{
|
||||
// 4.
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
else
|
||||
{
|
||||
// 5.
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_FALSE);
|
||||
}
|
||||
|
||||
JERRY_UNREACHABLE();
|
||||
} /* ecma_op_general_object_delete */
|
||||
|
||||
/**
|
||||
@@ -503,8 +501,9 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */
|
||||
void
|
||||
ecma_op_general_object_default_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
ecma_preferred_type_hint_t hint) /**< hint on preferred result type */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
@@ -542,16 +541,18 @@ ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */
|
||||
|
||||
ecma_string_t *function_name_p = ecma_get_magic_string (function_name_magic_string_id);
|
||||
|
||||
ecma_completion_value_t function_value_get_completion = ecma_op_object_get (obj_p, function_name_p);
|
||||
ecma_completion_value_t function_value_get_completion;
|
||||
ecma_op_object_get (function_value_get_completion, obj_p, function_name_p);
|
||||
|
||||
ecma_deref_ecma_string (function_name_p);
|
||||
|
||||
if (!ecma_is_completion_value_normal (function_value_get_completion))
|
||||
{
|
||||
return function_value_get_completion;
|
||||
ret_value = function_value_get_completion;
|
||||
return;
|
||||
}
|
||||
|
||||
ecma_completion_value_t call_completion = ecma_make_empty_completion_value ();
|
||||
ecma_completion_value_t call_completion;
|
||||
|
||||
ecma_value_t function_value_get;
|
||||
ecma_get_completion_value_value (function_value_get, function_value_get_completion);
|
||||
@@ -560,16 +561,18 @@ ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */
|
||||
{
|
||||
ecma_object_t *func_obj_p = ecma_get_object_from_value (function_value_get);
|
||||
|
||||
call_completion = ecma_op_function_call (func_obj_p,
|
||||
ecma_value_t (obj_p),
|
||||
NULL, 0);
|
||||
ecma_op_function_call (call_completion,
|
||||
func_obj_p,
|
||||
ecma_value_t (obj_p),
|
||||
NULL, 0);
|
||||
}
|
||||
|
||||
ecma_free_completion_value (function_value_get_completion);
|
||||
|
||||
if (!ecma_is_completion_value_normal (call_completion))
|
||||
{
|
||||
return call_completion;
|
||||
ret_value = call_completion;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ecma_is_completion_value_empty (call_completion))
|
||||
@@ -579,14 +582,15 @@ ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */
|
||||
|
||||
if (!ecma_is_value_object (call_ret_value))
|
||||
{
|
||||
return call_completion;
|
||||
ret_value = call_completion;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ecma_free_completion_value (call_completion);
|
||||
}
|
||||
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
} /* ecma_op_general_object_default_value */
|
||||
|
||||
/**
|
||||
@@ -599,8 +603,9 @@ ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the object */
|
||||
void
|
||||
ecma_op_general_object_define_own_property (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
const ecma_property_descriptor_t* property_desc_p, /**< property
|
||||
* descriptor */
|
||||
@@ -630,7 +635,8 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
||||
// 3.
|
||||
if (!extensible)
|
||||
{
|
||||
return ecma_reject (is_throw);
|
||||
ecma_reject (ret_value, is_throw);
|
||||
return;
|
||||
}
|
||||
|
||||
// 4.
|
||||
@@ -661,7 +667,8 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
||||
|
||||
}
|
||||
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
// 5.
|
||||
@@ -669,7 +676,8 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
||||
&& !property_desc_p->is_enumerable_defined
|
||||
&& !property_desc_p->is_configurable_defined)
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
// 6.
|
||||
@@ -739,7 +747,8 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
||||
|
||||
if (is_every_field_in_desc_also_occurs_in_current_desc_with_same_value)
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
// 7.
|
||||
@@ -750,7 +759,8 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
||||
&& property_desc_p->is_enumerable != ecma_is_property_enumerable (current_p)))
|
||||
{
|
||||
// a., b.
|
||||
return ecma_reject (is_throw);
|
||||
ecma_reject (ret_value, is_throw);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -765,7 +775,8 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
||||
if (!ecma_is_property_configurable (current_p))
|
||||
{
|
||||
// a.
|
||||
return ecma_reject (is_throw);
|
||||
ecma_reject (ret_value, is_throw);
|
||||
return;
|
||||
}
|
||||
|
||||
ecma_delete_property (obj_p, current_p);
|
||||
@@ -803,7 +814,8 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
||||
// i.
|
||||
if (property_desc_p->is_writable)
|
||||
{
|
||||
return ecma_reject (is_throw);
|
||||
ecma_reject (ret_value, is_throw);
|
||||
return;
|
||||
}
|
||||
|
||||
// ii.
|
||||
@@ -814,7 +826,8 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
||||
&& !ecma_op_same_value (ecma_value_t (property_desc_p->value),
|
||||
prop_value))
|
||||
{
|
||||
return ecma_reject (is_throw);
|
||||
ecma_reject (ret_value, is_throw);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -837,7 +850,8 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
||||
current_p->u.named_accessor_property.set_p)))
|
||||
{
|
||||
// i., ii.
|
||||
return ecma_reject (is_throw);
|
||||
ecma_reject (ret_value, is_throw);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -887,7 +901,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
||||
ecma_set_property_configurable_attr (current_p, property_desc_p->is_configurable);
|
||||
}
|
||||
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_TRUE);
|
||||
} /* ecma_op_general_object_define_own_property */
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,28 +27,43 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
extern ecma_object_t* ecma_op_create_object_object_noarg (void);
|
||||
extern ecma_completion_value_t ecma_op_create_object_object_arg (const ecma_value_t& value);
|
||||
extern ecma_object_t*
|
||||
ecma_op_create_object_object_noarg (void);
|
||||
extern void
|
||||
ecma_op_create_object_object_arg (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t& value);
|
||||
|
||||
extern ecma_completion_value_t ecma_op_general_object_get (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern ecma_property_t *ecma_op_general_object_get_own_property (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern ecma_property_t *ecma_op_general_object_get_property (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern ecma_completion_value_t ecma_op_general_object_put (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
const ecma_value_t& value,
|
||||
bool is_throw);
|
||||
extern bool ecma_op_general_object_can_put (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern ecma_completion_value_t ecma_op_general_object_delete (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
bool is_throw);
|
||||
extern ecma_completion_value_t ecma_op_general_object_default_value (ecma_object_t *obj_p,
|
||||
ecma_preferred_type_hint_t hint);
|
||||
extern ecma_completion_value_t
|
||||
ecma_op_general_object_define_own_property (ecma_object_t *obj_p,
|
||||
extern void
|
||||
ecma_op_general_object_get (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern ecma_property_t*
|
||||
ecma_op_general_object_get_own_property (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern ecma_property_t*
|
||||
ecma_op_general_object_get_property (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern void
|
||||
ecma_op_general_object_put (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
const ecma_value_t& value,
|
||||
bool is_throw);
|
||||
extern bool
|
||||
ecma_op_general_object_can_put (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern void
|
||||
ecma_op_general_object_delete (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
bool is_throw);
|
||||
extern void
|
||||
ecma_op_general_object_default_value (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
ecma_preferred_type_hint_t hint);
|
||||
extern void
|
||||
ecma_op_general_object_define_own_property (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
const ecma_property_descriptor_t* property_desc_p,
|
||||
bool is_throw);
|
||||
|
||||
@@ -40,8 +40,9 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_object_get (ecma_object_t *obj_p, /**< the object */
|
||||
void
|
||||
ecma_op_object_get (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
@@ -60,19 +61,21 @@ ecma_op_object_get (ecma_object_t *obj_p, /**< the object */
|
||||
case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:
|
||||
case ECMA_OBJECT_TYPE_STRING:
|
||||
{
|
||||
return ecma_op_general_object_get (obj_p, property_name_p);
|
||||
ecma_op_general_object_get (ret_value, obj_p, property_name_p);
|
||||
return;
|
||||
}
|
||||
|
||||
case ECMA_OBJECT_TYPE_ARGUMENTS:
|
||||
{
|
||||
return ecma_op_arguments_object_get (obj_p, property_name_p);
|
||||
ecma_op_arguments_object_get (ret_value, obj_p, property_name_p);
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
JERRY_ASSERT (false);
|
||||
|
||||
return ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
}
|
||||
}
|
||||
} /* ecma_op_object_get */
|
||||
@@ -218,8 +221,9 @@ ecma_op_object_get_property (ecma_object_t *obj_p, /**< the object */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_object_put (ecma_object_t *obj_p, /**< the object */
|
||||
void
|
||||
ecma_op_object_put (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
const ecma_value_t& value, /**< ecma-value */
|
||||
bool is_throw) /**< flag that controls failure handling */
|
||||
@@ -247,7 +251,7 @@ ecma_op_object_put (ecma_object_t *obj_p, /**< the object */
|
||||
* return put[type] (obj_p, property_name_p);
|
||||
*/
|
||||
|
||||
return ecma_op_general_object_put (obj_p, property_name_p, value, is_throw);
|
||||
ecma_op_general_object_put (ret_value, obj_p, property_name_p, value, is_throw);
|
||||
} /* ecma_op_object_put */
|
||||
|
||||
/**
|
||||
@@ -298,8 +302,9 @@ ecma_op_object_can_put (ecma_object_t *obj_p, /**< the object */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_object_delete (ecma_object_t *obj_p, /**< the object */
|
||||
void
|
||||
ecma_op_object_delete (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
bool is_throw) /**< flag that controls failure handling */
|
||||
{
|
||||
@@ -319,23 +324,27 @@ ecma_op_object_delete (ecma_object_t *obj_p, /**< the object */
|
||||
case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:
|
||||
case ECMA_OBJECT_TYPE_STRING:
|
||||
{
|
||||
return ecma_op_general_object_delete (obj_p,
|
||||
property_name_p,
|
||||
is_throw);
|
||||
ecma_op_general_object_delete (ret_value,
|
||||
obj_p,
|
||||
property_name_p,
|
||||
is_throw);
|
||||
return;
|
||||
}
|
||||
|
||||
case ECMA_OBJECT_TYPE_ARGUMENTS:
|
||||
{
|
||||
return ecma_op_arguments_object_delete (obj_p,
|
||||
property_name_p,
|
||||
is_throw);
|
||||
ecma_op_arguments_object_delete (ret_value,
|
||||
obj_p,
|
||||
property_name_p,
|
||||
is_throw);
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
JERRY_ASSERT (false);
|
||||
|
||||
return ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
}
|
||||
}
|
||||
} /* ecma_op_object_delete */
|
||||
@@ -349,8 +358,9 @@ ecma_op_object_delete (ecma_object_t *obj_p, /**< the object */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_object_default_value (ecma_object_t *obj_p, /**< the object */
|
||||
void
|
||||
ecma_op_object_default_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
ecma_preferred_type_hint_t hint) /**< hint on preferred result type */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
@@ -375,7 +385,7 @@ ecma_op_object_default_value (ecma_object_t *obj_p, /**< the object */
|
||||
* return default_value[type] (obj_p, property_name_p);
|
||||
*/
|
||||
|
||||
return ecma_op_general_object_default_value (obj_p, hint);
|
||||
ecma_op_general_object_default_value (ret_value, obj_p, hint);
|
||||
} /* ecma_op_object_default_value */
|
||||
|
||||
/**
|
||||
@@ -387,8 +397,9 @@ ecma_op_object_default_value (ecma_object_t *obj_p, /**< the object */
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_object_define_own_property (ecma_object_t *obj_p, /**< the object */
|
||||
void
|
||||
ecma_op_object_define_own_property (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
const ecma_property_descriptor_t* property_desc_p, /**< property
|
||||
* descriptor */
|
||||
@@ -409,33 +420,39 @@ ecma_op_object_define_own_property (ecma_object_t *obj_p, /**< the object */
|
||||
case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:
|
||||
case ECMA_OBJECT_TYPE_STRING:
|
||||
{
|
||||
return ecma_op_general_object_define_own_property (obj_p,
|
||||
property_name_p,
|
||||
property_desc_p,
|
||||
is_throw);
|
||||
ecma_op_general_object_define_own_property (ret_value,
|
||||
obj_p,
|
||||
property_name_p,
|
||||
property_desc_p,
|
||||
is_throw);
|
||||
return;
|
||||
}
|
||||
|
||||
case ECMA_OBJECT_TYPE_ARRAY:
|
||||
{
|
||||
return ecma_op_array_object_define_own_property (obj_p,
|
||||
property_name_p,
|
||||
property_desc_p,
|
||||
is_throw);
|
||||
ecma_op_array_object_define_own_property (ret_value,
|
||||
obj_p,
|
||||
property_name_p,
|
||||
property_desc_p,
|
||||
is_throw);
|
||||
return;
|
||||
}
|
||||
|
||||
case ECMA_OBJECT_TYPE_ARGUMENTS:
|
||||
{
|
||||
return ecma_op_arguments_object_define_own_property (obj_p,
|
||||
property_name_p,
|
||||
property_desc_p,
|
||||
is_throw);
|
||||
ecma_op_arguments_object_define_own_property (ret_value,
|
||||
obj_p,
|
||||
property_name_p,
|
||||
property_desc_p,
|
||||
is_throw);
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
JERRY_ASSERT (false);
|
||||
|
||||
return ecma_make_empty_completion_value ();
|
||||
ecma_make_empty_completion_value (ret_value);
|
||||
}
|
||||
}
|
||||
} /* ecma_op_object_define_own_property */
|
||||
@@ -446,8 +463,9 @@ ecma_op_object_define_own_property (ecma_object_t *obj_p, /**< the object */
|
||||
* See also:
|
||||
* ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 9
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_object_has_instance (ecma_object_t *obj_p, /**< the object */
|
||||
void
|
||||
ecma_op_object_has_instance (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
const ecma_value_t& value) /**< argument 'V' */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
@@ -462,14 +480,16 @@ ecma_op_object_has_instance (ecma_object_t *obj_p, /**< the object */
|
||||
case ECMA_OBJECT_TYPE_STRING:
|
||||
case ECMA_OBJECT_TYPE_ARGUMENTS:
|
||||
{
|
||||
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
return;
|
||||
}
|
||||
|
||||
case ECMA_OBJECT_TYPE_FUNCTION:
|
||||
case ECMA_OBJECT_TYPE_BOUND_FUNCTION:
|
||||
case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:
|
||||
{
|
||||
return ecma_op_function_has_instance (obj_p, value);
|
||||
ecma_op_function_has_instance (ret_value, obj_p, value);
|
||||
return;
|
||||
}
|
||||
|
||||
case ECMA_OBJECT_TYPE__COUNT:
|
||||
|
||||
@@ -27,25 +27,44 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
extern ecma_completion_value_t ecma_op_object_get (ecma_object_t *obj_p, ecma_string_t *property_name_p);
|
||||
extern ecma_property_t *ecma_op_object_get_own_property (ecma_object_t *obj_p, ecma_string_t *property_name_p);
|
||||
extern ecma_property_t *ecma_op_object_get_property (ecma_object_t *obj_p, ecma_string_t *property_name_p);
|
||||
extern ecma_completion_value_t ecma_op_object_put (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
const ecma_value_t& value,
|
||||
bool is_throw);
|
||||
extern bool ecma_op_object_can_put (ecma_object_t *obj_p, ecma_string_t *property_name_p);
|
||||
extern ecma_completion_value_t ecma_op_object_delete (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
bool is_throw);
|
||||
extern ecma_completion_value_t ecma_op_object_default_value (ecma_object_t *obj_p, ecma_preferred_type_hint_t hint);
|
||||
extern ecma_completion_value_t
|
||||
ecma_op_object_define_own_property (ecma_object_t *obj_p,
|
||||
extern void
|
||||
ecma_op_object_get (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern ecma_property_t*
|
||||
ecma_op_object_get_own_property (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern ecma_property_t*
|
||||
ecma_op_object_get_property (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern void
|
||||
ecma_op_object_put (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
const ecma_value_t& value,
|
||||
bool is_throw);
|
||||
extern bool
|
||||
ecma_op_object_can_put (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern void
|
||||
ecma_op_object_delete (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
bool is_throw);
|
||||
extern void
|
||||
ecma_op_object_default_value (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
ecma_preferred_type_hint_t hint);
|
||||
extern void
|
||||
ecma_op_object_define_own_property (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
const ecma_property_descriptor_t* property_desc_p,
|
||||
bool is_throw);
|
||||
extern ecma_completion_value_t ecma_op_object_has_instance (ecma_object_t *obj_p,
|
||||
const ecma_value_t& value);
|
||||
extern void
|
||||
ecma_op_object_has_instance (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_value_t& value);
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
|
||||
@@ -38,8 +38,9 @@
|
||||
* @return completion value
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of arguments that
|
||||
void
|
||||
ecma_op_create_string_object (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
const ecma_value_t *arguments_list_p, /**< list of arguments that
|
||||
are passed to String constructor */
|
||||
ecma_length_t arguments_list_len) /**< length of the arguments' list */
|
||||
{
|
||||
@@ -57,11 +58,13 @@ ecma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_completion_value_t to_str_arg_completion = ecma_op_to_string (arguments_list_p [0]);
|
||||
ecma_completion_value_t to_str_arg_completion;
|
||||
ecma_op_to_string (to_str_arg_completion, arguments_list_p [0]);
|
||||
|
||||
if (ecma_is_completion_value_throw (to_str_arg_completion))
|
||||
{
|
||||
return to_str_arg_completion;
|
||||
ret_value = to_str_arg_completion;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -108,7 +111,7 @@ ecma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of
|
||||
ecma_set_named_data_property_value (length_prop_p, ecma_value_t (length_prop_value_p));
|
||||
ecma_deref_ecma_string (length_magic_string_p);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_value_t (obj_p));
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (obj_p));
|
||||
} /* ecma_op_create_string_object */
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,8 +26,9 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
extern ecma_completion_value_t
|
||||
ecma_op_create_string_object (const ecma_value_t *arguments_list_p,
|
||||
extern void
|
||||
ecma_op_create_string_object (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t *arguments_list_p,
|
||||
ecma_length_t arguments_list_len);
|
||||
|
||||
extern ecma_property_t*
|
||||
|
||||
@@ -29,8 +29,9 @@
|
||||
* Each ECMA_TRY_CATCH should have it's own corresponding ECMA_FINALIZE
|
||||
* statement with same argument as corresponding ECMA_TRY_CATCH's first argument.
|
||||
*/
|
||||
#define ECMA_TRY_CATCH(var, op, return_value) \
|
||||
ecma_completion_value_t var ## _completion = op; \
|
||||
#define ECMA_TRY_CATCH(return_value, op, var, ...) \
|
||||
ecma_completion_value_t var ## _completion; \
|
||||
op (var ## _completion, __VA_ARGS__); \
|
||||
if (unlikely (ecma_is_completion_value_throw (var ## _completion))) \
|
||||
{ \
|
||||
return_value = var ## _completion; \
|
||||
@@ -65,7 +66,7 @@
|
||||
* statement with same argument as corresponding ECMA_OP_TO_NUMBER_TRY_CATCH's first argument.
|
||||
*/
|
||||
#define ECMA_OP_TO_NUMBER_TRY_CATCH(num_var, value, return_value) \
|
||||
JERRY_ASSERT (ecma_is_completion_value_empty (return_value)); \
|
||||
ecma_make_empty_completion_value (return_value); \
|
||||
ecma_number_t num_var = ecma_number_make_nan (); \
|
||||
if (ecma_is_value_number (value)) \
|
||||
{ \
|
||||
@@ -73,9 +74,7 @@
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
ECMA_TRY_CATCH (to_number_value, \
|
||||
ecma_op_to_number (value), \
|
||||
return_value); \
|
||||
ECMA_TRY_CATCH (return_value, ecma_op_to_number, to_number_value, value); \
|
||||
\
|
||||
num_var = *ecma_get_number_from_value (to_number_value); \
|
||||
\
|
||||
|
||||
Reference in New Issue
Block a user