Remove several ecma_op_object_get_[own_]property calls.

The ecma_op_object_get_[own_]property calls should be phased out from
the project eventually and virtual properties should be introduced instead.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2016-09-08 23:38:45 -07:00
parent 7f80b76009
commit da02a37a02
22 changed files with 479 additions and 463 deletions
@@ -652,8 +652,8 @@ ecma_builtin_array_prototype_object_reverse (ecma_value_t this_arg) /**< this ar
ECMA_TRY_CATCH (upper_value, ecma_op_object_get (obj_p, upper_str_p), ret_value);
/* 6.f and 6.g */
bool lower_exist = (ecma_op_object_get_property (obj_p, lower_str_p) != NULL);
bool upper_exist = (ecma_op_object_get_property (obj_p, upper_str_p) != NULL);
bool lower_exist = ecma_op_object_has_property (obj_p, lower_str_p);
bool upper_exist = ecma_op_object_has_property (obj_p, upper_str_p);
/* 6.h */
if (lower_exist && upper_exist)
@@ -759,16 +759,14 @@ ecma_builtin_array_prototype_object_shift (ecma_value_t this_arg) /**< this argu
ecma_string_t *to_str_p = ecma_new_ecma_string_from_uint32 (k - 1);
/* 7.c */
if (ecma_op_object_get_property (obj_p, from_str_p) != NULL)
{
/* 7.d.i */
ECMA_TRY_CATCH (curr_value, ecma_op_object_get (obj_p, from_str_p), ret_value);
ECMA_TRY_CATCH (curr_value, ecma_op_object_find (obj_p, from_str_p), ret_value);
/* 7.d.ii*/
if (ecma_is_value_found (curr_value))
{
/* 7.d.i, 7.d.ii */
ECMA_TRY_CATCH (put_value, ecma_op_object_put (obj_p, to_str_p, curr_value, true), ret_value);
ECMA_FINALIZE (put_value);
ECMA_FINALIZE (curr_value);
}
else
{
@@ -777,6 +775,8 @@ ecma_builtin_array_prototype_object_shift (ecma_value_t this_arg) /**< this argu
ECMA_FINALIZE (del_value);
}
ECMA_FINALIZE (curr_value);
ecma_deref_ecma_string (to_str_p);
ecma_deref_ecma_string (from_str_p);
}
@@ -886,11 +886,11 @@ ecma_builtin_array_prototype_object_slice (ecma_value_t this_arg, /**< 'this' ar
ecma_string_t *curr_idx_str_p = ecma_new_ecma_string_from_uint32 (k);
/* 10.c */
if (ecma_op_object_get_property (obj_p, curr_idx_str_p) != NULL)
ECMA_TRY_CATCH (get_value, ecma_op_object_find (obj_p, curr_idx_str_p), ret_value);
if (ecma_is_value_found (get_value))
{
/* 10.c.i */
ECMA_TRY_CATCH (get_value, ecma_op_object_get (obj_p, curr_idx_str_p), ret_value);
ecma_string_t *to_idx_str_p = ecma_new_ecma_string_from_uint32 (n);
/* 10.c.ii */
@@ -905,10 +905,10 @@ ecma_builtin_array_prototype_object_slice (ecma_value_t this_arg, /**< 'this' ar
JERRY_ASSERT (ecma_is_value_true (put_comp));
ecma_deref_ecma_string (to_idx_str_p);
ECMA_FINALIZE (get_value);
}
ECMA_FINALIZE (get_value);
ecma_deref_ecma_string (curr_idx_str_p);
}
@@ -1441,12 +1441,11 @@ ecma_builtin_array_prototype_object_splice (ecma_value_t this_arg, /**< this arg
ecma_string_t *idx_str_p = ecma_new_ecma_string_from_uint32 (del_item_idx);
/* 9.b */
if (ecma_op_object_get_property (obj_p, idx_str_p) != NULL)
ECMA_TRY_CATCH (get_value, ecma_op_object_find (obj_p, idx_str_p), ret_value);
if (ecma_is_value_found (get_value))
{
/* 9.c.i */
ECMA_TRY_CATCH (get_value,
ecma_op_object_get (obj_p, idx_str_p),
ret_value);
ecma_string_t *idx_str_new_p = ecma_new_ecma_string_from_uint32 (k);
@@ -1462,9 +1461,10 @@ ecma_builtin_array_prototype_object_splice (ecma_value_t this_arg, /**< this arg
JERRY_ASSERT (ecma_is_value_true (put_comp));
ecma_deref_ecma_string (idx_str_new_p);
ECMA_FINALIZE (get_value);
}
ECMA_FINALIZE (get_value);
ecma_deref_ecma_string (idx_str_p);
}
@@ -1499,19 +1499,16 @@ ecma_builtin_array_prototype_object_splice (ecma_value_t this_arg, /**< this arg
ecma_string_t *to_str_p = ecma_new_ecma_string_from_uint32 (to);
/* 12.b.iii */
if (ecma_op_object_get_property (obj_p, from_str_p) != NULL)
ECMA_TRY_CATCH (get_value, ecma_op_object_find (obj_p, from_str_p), ret_value);
if (ecma_is_value_found (get_value))
{
/* 12.b.iv */
ECMA_TRY_CATCH (get_value,
ecma_op_object_get (obj_p, from_str_p),
ret_value);
ECMA_TRY_CATCH (put_value,
ecma_op_object_put (obj_p, to_str_p, get_value, true),
ret_value);
ECMA_FINALIZE (put_value);
ECMA_FINALIZE (get_value);
}
else
{
@@ -1523,6 +1520,8 @@ ecma_builtin_array_prototype_object_splice (ecma_value_t this_arg, /**< this arg
ECMA_FINALIZE (del_value);
}
ECMA_FINALIZE (get_value);
ecma_deref_ecma_string (to_str_p);
ecma_deref_ecma_string (from_str_p);
}
@@ -1552,19 +1551,16 @@ ecma_builtin_array_prototype_object_splice (ecma_value_t this_arg, /**< this arg
ecma_string_t *to_str_p = ecma_new_ecma_string_from_uint32 (to);
/* 13.b.iii */
if (ecma_op_object_get_property (obj_p, from_str_p) != NULL)
ECMA_TRY_CATCH (get_value, ecma_op_object_find (obj_p, from_str_p), ret_value);
if (ecma_is_value_found (get_value))
{
/* 13.b.iv */
ECMA_TRY_CATCH (get_value,
ecma_op_object_get (obj_p, from_str_p),
ret_value);
ECMA_TRY_CATCH (put_value,
ecma_op_object_put (obj_p, to_str_p, get_value, true),
ret_value);
ECMA_FINALIZE (put_value);
ECMA_FINALIZE (get_value);
}
else
{
@@ -1576,6 +1572,8 @@ ecma_builtin_array_prototype_object_splice (ecma_value_t this_arg, /**< this arg
ECMA_FINALIZE (del_value);
}
ECMA_FINALIZE (get_value);
ecma_deref_ecma_string (to_str_p);
ecma_deref_ecma_string (from_str_p);
}
@@ -1668,15 +1666,14 @@ ecma_builtin_array_prototype_object_unshift (ecma_value_t this_arg, /**< this ar
ecma_string_t *to_str_p = ecma_new_ecma_string_from_number (new_idx);
/* 6.c */
if (ecma_op_object_get_property (obj_p, from_str_p) != NULL)
ECMA_TRY_CATCH (get_value, ecma_op_object_find (obj_p, from_str_p), ret_value);
if (ecma_is_value_found (get_value))
{
/* 6.d.i */
ECMA_TRY_CATCH (get_value, ecma_op_object_get (obj_p, from_str_p), ret_value);
/* 6.d.ii */
/* 6.d.i, 6.d.ii */
ECMA_TRY_CATCH (put_value, ecma_op_object_put (obj_p, to_str_p, get_value, true), ret_value);
ECMA_FINALIZE (put_value);
ECMA_FINALIZE (get_value);
}
else
{
@@ -1685,6 +1682,8 @@ ecma_builtin_array_prototype_object_unshift (ecma_value_t this_arg, /**< this ar
ECMA_FINALIZE (del_value);
}
ECMA_FINALIZE (get_value);
ecma_deref_ecma_string (to_str_p);
ecma_deref_ecma_string (from_str_p);
}
@@ -1778,20 +1777,19 @@ ecma_builtin_array_prototype_object_index_of (ecma_value_t this_arg, /**< this a
ecma_string_t *idx_str_p = ecma_new_ecma_string_from_uint32 (from_idx);
/* 9.a */
if (ecma_op_object_get_property (obj_p, idx_str_p) != NULL)
{
/* 9.b.i */
ECMA_TRY_CATCH (get_value, ecma_op_object_get (obj_p, idx_str_p), ret_value);
ECMA_TRY_CATCH (get_value, ecma_op_object_find (obj_p, idx_str_p), ret_value);
/* 9.b.ii */
if (ecma_is_value_found (get_value))
{
/* 9.b.i, 9.b.ii */
if (ecma_op_strict_equality_compare (arg1, get_value))
{
found_index = ((ecma_number_t) from_idx);
}
ECMA_FINALIZE (get_value);
}
ECMA_FINALIZE (get_value);
ecma_deref_ecma_string (idx_str_p);
}
}
@@ -1930,20 +1928,19 @@ ecma_builtin_array_prototype_object_last_index_of (ecma_value_t this_arg, /**< t
ecma_string_t *idx_str_p = ecma_new_ecma_string_from_uint32 (from_idx);
/* 8.a */
if (ecma_op_object_get_property (obj_p, idx_str_p) != NULL)
{
/* 8.b.i */
ECMA_TRY_CATCH (get_value, ecma_op_object_get (obj_p, idx_str_p), ret_value);
ECMA_TRY_CATCH (get_value, ecma_op_object_find (obj_p, idx_str_p), ret_value);
/* 8.b.ii */
if (ecma_is_value_found (get_value))
{
/* 8.b.i, 8.b.ii */
if (ecma_op_strict_equality_compare (search_element, get_value))
{
num = ((ecma_number_t) from_idx);
}
ECMA_FINALIZE (get_value);
}
ECMA_FINALIZE (get_value);
ecma_deref_ecma_string (idx_str_p);
}
@@ -2018,11 +2015,11 @@ ecma_builtin_array_prototype_object_every (ecma_value_t this_arg, /**< this argu
ecma_string_t *index_str_p = ecma_new_ecma_string_from_uint32 (index);
/* 7.c */
if (ecma_op_object_get_property (obj_p, index_str_p) != NULL)
ECMA_TRY_CATCH (get_value, ecma_op_object_find (obj_p, index_str_p), ret_value);
if (ecma_is_value_found (get_value))
{
/* 7.c.i */
ECMA_TRY_CATCH (get_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
current_index = ecma_make_uint32_value (index);
ecma_value_t call_args[] = { get_value, current_index, obj_this };
@@ -2036,9 +2033,10 @@ ecma_builtin_array_prototype_object_every (ecma_value_t this_arg, /**< this argu
}
ECMA_FINALIZE (call_value);
ECMA_FINALIZE (get_value);
}
ECMA_FINALIZE (get_value);
ecma_deref_ecma_string (index_str_p);
}
@@ -2116,14 +2114,15 @@ ecma_builtin_array_prototype_object_some (ecma_value_t this_arg, /**< this argum
ecma_string_t *index_str_p = ecma_new_ecma_string_from_uint32 (index);
/* 7.c */
if (ecma_op_object_get_property (obj_p, index_str_p) != NULL)
ECMA_TRY_CATCH (get_value, ecma_op_object_find (obj_p, index_str_p), ret_value);
if (ecma_is_value_found (get_value))
{
/* 7.c.i */
ECMA_TRY_CATCH (get_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
current_index = ecma_make_uint32_value (index);
ecma_value_t call_args[] = { get_value, current_index, obj_this };
/* 7.c.ii */
ECMA_TRY_CATCH (call_value, ecma_op_function_call (func_object_p, arg2, call_args, 3), ret_value);
@@ -2134,9 +2133,10 @@ ecma_builtin_array_prototype_object_some (ecma_value_t this_arg, /**< this argum
}
ECMA_FINALIZE (call_value);
ECMA_FINALIZE (get_value);
}
ECMA_FINALIZE (get_value);
ecma_deref_ecma_string (index_str_p);
}
@@ -2213,11 +2213,11 @@ ecma_builtin_array_prototype_object_for_each (ecma_value_t this_arg, /**< this a
ecma_string_t *index_str_p = ecma_new_ecma_string_from_uint32 (index);
/* 7.b */
if (ecma_op_object_get_property (obj_p, index_str_p) != NULL)
ECMA_TRY_CATCH (current_value, ecma_op_object_find (obj_p, index_str_p), ret_value);
if (ecma_is_value_found (current_value))
{
/* 7.c.i */
ECMA_TRY_CATCH (current_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
current_index = ecma_make_uint32_value (index);
/* 7.c.ii */
@@ -2225,9 +2225,10 @@ ecma_builtin_array_prototype_object_for_each (ecma_value_t this_arg, /**< this a
ECMA_TRY_CATCH (call_value, ecma_op_function_call (func_object_p, arg2, call_args, 3), ret_value);
ECMA_FINALIZE (call_value);
ECMA_FINALIZE (current_value);
}
ECMA_FINALIZE (current_value);
ecma_deref_ecma_string (index_str_p);
}
@@ -2307,14 +2308,15 @@ ecma_builtin_array_prototype_object_map (ecma_value_t this_arg, /**< this argume
{
/* 8.a */
ecma_string_t *index_str_p = ecma_new_ecma_string_from_uint32 (index);
/* 8.b */
if (ecma_op_object_get_property (obj_p, index_str_p) != NULL)
ECMA_TRY_CATCH (current_value, ecma_op_object_find (obj_p, index_str_p), ret_value);
if (ecma_is_value_found (current_value))
{
/* 8.c.i */
ECMA_TRY_CATCH (current_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
/* 8.c.ii */
/* 8.c.i, 8.c.ii */
current_index = ecma_make_uint32_value (index);
ecma_value_t call_args[] = {current_value, current_index, obj_this};
ecma_value_t call_args[] = { current_value, current_index, obj_this };
ECMA_TRY_CATCH (mapped_value, ecma_op_function_call (func_object_p, arg2, call_args, 3), ret_value);
@@ -2330,9 +2332,10 @@ ecma_builtin_array_prototype_object_map (ecma_value_t this_arg, /**< this argume
JERRY_ASSERT (ecma_is_value_true (put_comp));
ECMA_FINALIZE (mapped_value);
ECMA_FINALIZE (current_value);
}
ECMA_FINALIZE (current_value);
ecma_deref_ecma_string (index_str_p);
}
@@ -2421,11 +2424,11 @@ ecma_builtin_array_prototype_object_filter (ecma_value_t this_arg, /**< this arg
ecma_string_t *index_str_p = ecma_new_ecma_string_from_uint32 (index);
/* 9.c */
if (ecma_op_object_get_property (obj_p, index_str_p) != NULL)
ECMA_TRY_CATCH (get_value, ecma_op_object_find (obj_p, index_str_p), ret_value);
if (ecma_is_value_found (get_value))
{
/* 9.c.i */
ECMA_TRY_CATCH (get_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
current_index = ecma_make_uint32_value (index);
ecma_value_t call_args[] = { get_value, current_index, obj_this };
@@ -2452,9 +2455,10 @@ ecma_builtin_array_prototype_object_filter (ecma_value_t this_arg, /**< this arg
}
ECMA_FINALIZE (call_value);
ECMA_FINALIZE (get_value);
}
ECMA_FINALIZE (get_value);
ecma_deref_ecma_string (index_str_p);
}
@@ -2545,24 +2549,34 @@ ecma_builtin_array_prototype_object_reduce (ecma_value_t this_arg, /**< this arg
{
/* 8.a */
bool k_present = false;
/* 8.b */
while (!k_present && index < len && ecma_is_value_empty (ret_value))
{
/* 8.b.i */
ecma_string_t *index_str_p = ecma_new_ecma_string_from_uint32 (index);
k_present = true;
/* 8.b.ii-iii */
if ((k_present = (ecma_op_object_get_property (obj_p, index_str_p) != NULL)))
ECMA_TRY_CATCH (current_value, ecma_op_object_find (obj_p, index_str_p), ret_value);
if (ecma_is_value_found (current_value))
{
ECMA_TRY_CATCH (current_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
accumulator = ecma_copy_value (current_value);
ECMA_FINALIZE (current_value);
}
else
{
k_present = false;
}
ECMA_FINALIZE (current_value);
/* 8.b.iv */
index++;
ecma_deref_ecma_string (index_str_p);
}
/* 8.c */
if (!k_present)
{
@@ -2576,12 +2590,13 @@ ecma_builtin_array_prototype_object_reduce (ecma_value_t this_arg, /**< this arg
{
/* 9.a */
ecma_string_t *index_str_p = ecma_new_ecma_string_from_uint32 (index);
/* 9.b */
if (ecma_op_object_get_property (obj_p, index_str_p) != NULL)
ECMA_TRY_CATCH (current_value, ecma_op_object_find (obj_p, index_str_p), ret_value);
if (ecma_is_value_found (current_value))
{
/* 9.c.i */
ECMA_TRY_CATCH (current_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
/* 9.c.ii */
/* 9.c.i, 9.c.ii */
current_index = ecma_make_uint32_value (index);
ecma_value_t call_args[] = {accumulator, current_value, current_index, obj_this};
@@ -2596,8 +2611,10 @@ ecma_builtin_array_prototype_object_reduce (ecma_value_t this_arg, /**< this arg
accumulator = ecma_copy_value (call_value);
ECMA_FINALIZE (call_value);
ECMA_FINALIZE (current_value);
}
ECMA_FINALIZE (current_value);
ecma_deref_ecma_string (index_str_p);
/* 9.d in for loop */
}
@@ -2688,24 +2705,34 @@ ecma_builtin_array_prototype_object_reduce_right (ecma_value_t this_arg, /**< th
{
/* 8.a */
bool k_present = false;
/* 8.b */
while (!k_present && index >= 0 && ecma_is_value_empty (ret_value))
{
/* 8.b.i */
ecma_string_t *index_str_p = ecma_new_ecma_string_from_uint32 ((uint32_t) index);
k_present = true;
/* 8.b.ii-iii */
if ((k_present = (ecma_op_object_get_property (obj_p, index_str_p) != NULL)))
ECMA_TRY_CATCH (current_value, ecma_op_object_find (obj_p, index_str_p), ret_value);
if (ecma_is_value_found (current_value))
{
ECMA_TRY_CATCH (current_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
accumulator = ecma_copy_value (current_value);
ECMA_FINALIZE (current_value);
}
else
{
k_present = false;
}
ECMA_FINALIZE (current_value);
/* 8.b.iv */
index--;
ecma_deref_ecma_string (index_str_p);
}
/* 8.c */
if (!k_present)
{
@@ -2719,12 +2746,13 @@ ecma_builtin_array_prototype_object_reduce_right (ecma_value_t this_arg, /**< th
{
/* 9.a */
ecma_string_t *index_str_p = ecma_new_ecma_string_from_uint32 ((uint32_t) index);
/* 9.b */
if (ecma_op_object_get_property (obj_p, index_str_p) != NULL)
ECMA_TRY_CATCH (current_value, ecma_op_object_find (obj_p, index_str_p), ret_value);
if (ecma_is_value_found (current_value))
{
/* 9.c.i */
ECMA_TRY_CATCH (current_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
/* 9.c.ii */
/* 9.c.i, 9.c.ii */
current_index = ecma_make_uint32_value ((uint32_t) index);
ecma_value_t call_args[] = {accumulator, current_value, current_index, obj_this};
@@ -2739,8 +2767,10 @@ ecma_builtin_array_prototype_object_reduce_right (ecma_value_t this_arg, /**< th
accumulator = ecma_copy_value (call_value);
ECMA_FINALIZE (call_value);
ECMA_FINALIZE (current_value);
}
ECMA_FINALIZE (current_value);
ecma_deref_ecma_string (index_str_p);
/* 9.d in for loop */
}
@@ -353,16 +353,15 @@ ecma_builtin_helper_array_concat_value (ecma_object_t *obj_p, /**< array */
ecma_string_t *array_index_string_p = ecma_new_ecma_string_from_uint32 (array_index);
/* 5.b.iii.2 */
if (ecma_op_object_get_property (ecma_get_object_from_value (value),
array_index_string_p) != NULL)
{
ecma_string_t *new_array_index_string_p = ecma_new_ecma_string_from_uint32 (*length_p + array_index);
ECMA_TRY_CATCH (get_value,
ecma_op_object_find (ecma_get_object_from_value (value),
array_index_string_p),
ret_value);
if (ecma_is_value_found (get_value))
{
/* 5.b.iii.3.a */
ECMA_TRY_CATCH (get_value,
ecma_op_object_get (ecma_get_object_from_value (value),
array_index_string_p),
ret_value);
ecma_string_t *new_array_index_string_p = ecma_new_ecma_string_from_uint32 (*length_p + array_index);
/* 5.b.iii.3.b */
/* This will always be a simple value since 'is_throw' is false, so no need to free. */
@@ -375,11 +374,11 @@ ecma_builtin_helper_array_concat_value (ecma_object_t *obj_p, /**< array */
false); /* Failure handling */
JERRY_ASSERT (ecma_is_value_true (put_comp));
ECMA_FINALIZE (get_value);
ecma_deref_ecma_string (new_array_index_string_p);
}
ECMA_FINALIZE (get_value);
ecma_deref_ecma_string (array_index_string_p);
}
@@ -151,9 +151,7 @@ ecma_builtin_object_prototype_object_has_own_property (ecma_value_t this_arg, /*
ecma_object_t *obj_p = ecma_get_object_from_value (obj_val);
/* 3. */
ecma_property_t *property_p = ecma_op_object_get_own_property (obj_p, property_name_string_p);
if (property_p != NULL)
if (ecma_op_object_has_own_property (obj_p, property_name_string_p))
{
return_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_TRUE);
}
@@ -161,6 +159,7 @@ ecma_builtin_object_prototype_object_has_own_property (ecma_value_t this_arg, /*
{
return_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_FALSE);
}
ECMA_FINALIZE (obj_val);
ECMA_FINALIZE (to_string_val);
@@ -72,7 +72,6 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this argument
}
else
{
ecma_string_t *pattern_string_p = NULL;
uint16_t flags = 0;
if (ecma_is_value_object (pattern_arg)
@@ -89,39 +88,44 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this argument
/* Get source. */
ecma_string_t *magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_SOURCE);
ecma_property_t *prop_p = ecma_op_object_get_property (target_p, magic_string_p);
pattern_string_p = ecma_get_string_from_value (ecma_get_named_data_property_value (prop_p));
ecma_value_t source_value = ecma_op_object_get_own_data_prop (target_p, magic_string_p);
ecma_deref_ecma_string (magic_string_p);
ecma_string_t *pattern_string_p = ecma_get_string_from_value (source_value);
/* Get flags. */
magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_GLOBAL);
prop_p = ecma_op_object_get_property (target_p, magic_string_p);
ecma_value_t global_value = ecma_op_object_get_own_data_prop (target_p, magic_string_p);
ecma_deref_ecma_string (magic_string_p);
if (ecma_is_value_true (ecma_get_named_data_property_value (prop_p)))
JERRY_ASSERT (ecma_is_value_boolean (global_value));
if (ecma_is_value_true (global_value))
{
flags |= RE_FLAG_GLOBAL;
}
ecma_deref_ecma_string (magic_string_p);
magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_IGNORECASE_UL);
prop_p = ecma_op_object_get_property (target_p, magic_string_p);
ecma_value_t ignore_case_value = ecma_op_object_get_own_data_prop (target_p, magic_string_p);
ecma_deref_ecma_string (magic_string_p);
if (ecma_is_value_true (ecma_get_named_data_property_value (prop_p)))
JERRY_ASSERT (ecma_is_value_boolean (ignore_case_value));
if (ecma_is_value_true (ignore_case_value))
{
flags |= RE_FLAG_IGNORE_CASE;
}
ecma_deref_ecma_string (magic_string_p);
magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_MULTILINE);
prop_p = ecma_op_object_get_property (target_p, magic_string_p);
ecma_value_t multiline_value = ecma_op_object_get_own_data_prop (target_p, magic_string_p);
ecma_deref_ecma_string (magic_string_p);
if (ecma_is_value_true (ecma_get_named_data_property_value (prop_p)))
JERRY_ASSERT (ecma_is_value_boolean (multiline_value));
if (ecma_is_value_true (multiline_value))
{
flags |= RE_FLAG_MULTILINE;
}
ecma_deref_ecma_string (magic_string_p);
ECMA_TRY_CATCH (obj_this, ecma_op_to_object (this_arg), ret_value);
ecma_object_t *this_obj_p = ecma_get_object_from_value (obj_this);
@@ -136,6 +140,8 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this argument
/* Should always succeed, since we're compiling from a source that has been compiled previously. */
JERRY_ASSERT (ecma_is_value_empty (bc_comp));
ecma_deref_ecma_string (pattern_string_p);
re_compiled_code_t *old_bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, *bc_prop_p);
if (old_bc_p != NULL)
@@ -155,6 +161,8 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this argument
}
else
{
ecma_string_t *pattern_string_p = NULL;
/* Get source string. */
if (!ecma_is_value_undefined (pattern_arg))
{
@@ -365,12 +373,13 @@ ecma_builtin_regexp_prototype_to_string (ecma_value_t this_arg) /**< this argume
/* Get RegExp source from the source property */
ecma_string_t *magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_SOURCE);
ecma_property_t *source_prop_p = ecma_op_object_get_property (obj_p, magic_string_p);
ecma_value_t source_value = ecma_op_object_get_own_data_prop (obj_p, magic_string_p);
ecma_deref_ecma_string (magic_string_p);
ecma_string_t *src_sep_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_SLASH_CHAR);
ecma_string_t *source_str_p = ecma_get_string_from_value (ecma_get_named_data_property_value (source_prop_p));
ecma_string_t *source_str_p = ecma_get_string_from_value (source_value);
ecma_string_t *output_str_p = ecma_concat_ecma_strings (src_sep_str_p, source_str_p);
ecma_deref_ecma_string (source_str_p);
ecma_string_t *concat_p = ecma_concat_ecma_strings (output_str_p, src_sep_str_p);
ecma_deref_ecma_string (src_sep_str_p);
@@ -379,10 +388,12 @@ ecma_builtin_regexp_prototype_to_string (ecma_value_t this_arg) /**< this argume
/* Check the global flag */
magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_GLOBAL);
ecma_property_t *global_prop_p = ecma_op_object_get_property (obj_p, magic_string_p);
ecma_value_t global_value = ecma_op_object_get_own_data_prop (obj_p, magic_string_p);
ecma_deref_ecma_string (magic_string_p);
if (ecma_is_value_true (ecma_get_named_data_property_value (global_prop_p)))
JERRY_ASSERT (ecma_is_value_boolean (global_value));
if (ecma_is_value_true (global_value))
{
ecma_string_t *g_flag_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_G_CHAR);
concat_p = ecma_concat_ecma_strings (output_str_p, g_flag_str_p);
@@ -393,10 +404,12 @@ ecma_builtin_regexp_prototype_to_string (ecma_value_t this_arg) /**< this argume
/* Check the ignoreCase flag */
magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_IGNORECASE_UL);
ecma_property_t *ignorecase_prop_p = ecma_op_object_get_property (obj_p, magic_string_p);
ecma_value_t ignore_case_value = ecma_op_object_get_own_data_prop (obj_p, magic_string_p);
ecma_deref_ecma_string (magic_string_p);
if (ecma_is_value_true (ecma_get_named_data_property_value (ignorecase_prop_p)))
JERRY_ASSERT (ecma_is_value_boolean (ignore_case_value));
if (ecma_is_value_true (ignore_case_value))
{
ecma_string_t *ic_flag_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_I_CHAR);
concat_p = ecma_concat_ecma_strings (output_str_p, ic_flag_str_p);
@@ -405,12 +418,14 @@ ecma_builtin_regexp_prototype_to_string (ecma_value_t this_arg) /**< this argume
output_str_p = concat_p;
}
/* Check the global flag */
/* Check the multiline flag */
magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_MULTILINE);
ecma_property_t *multiline_prop_p = ecma_op_object_get_property (obj_p, magic_string_p);
ecma_value_t multiline_value = ecma_op_object_get_own_data_prop (obj_p, magic_string_p);
ecma_deref_ecma_string (magic_string_p);
if (ecma_is_value_true (ecma_get_named_data_property_value (multiline_prop_p)))
JERRY_ASSERT (ecma_is_value_boolean (multiline_value));
if (ecma_is_value_true (multiline_value))
{
ecma_string_t *m_flag_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_M_CHAR);
concat_p = ecma_concat_ecma_strings (output_str_p, m_flag_str_p);
@@ -622,7 +622,7 @@ ecma_builtin_list_lazy_property_names (ecma_object_t *object_p, /**< a built-in
ecma_string_t *name_p = ecma_get_magic_string (curr_property_p->magic_string_id);
if (!was_instantiated || ecma_op_object_get_own_property (object_p, name_p) != NULL)
if (!was_instantiated || ecma_op_object_has_own_property (object_p, name_p))
{
ecma_append_to_values_collection (for_non_enumerable_p,
ecma_make_string_value (name_p),