Introducing getter and setter for named data property's value field, ecma_named_data_property_assign_value interface; using boolean flags for 'Writable', 'Enumerable' and 'Configurable' attributes values while passing them in routine arguments.
This commit is contained in:
@@ -880,10 +880,10 @@ opfunc_obj_decl (opcode_t opdata, /**< operation data */
|
|||||||
ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor ();
|
ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor ();
|
||||||
{
|
{
|
||||||
prop_desc.is_enumerable_defined = true;
|
prop_desc.is_enumerable_defined = true;
|
||||||
prop_desc.enumerable = ECMA_PROPERTY_ENUMERABLE;
|
prop_desc.is_enumerable = true;
|
||||||
|
|
||||||
prop_desc.is_configurable_defined = true;
|
prop_desc.is_configurable_defined = true;
|
||||||
prop_desc.configurable = ECMA_PROPERTY_CONFIGURABLE;
|
prop_desc.is_configurable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == OPCODE_META_TYPE_VARG_PROP_DATA)
|
if (type == OPCODE_META_TYPE_VARG_PROP_DATA)
|
||||||
@@ -892,7 +892,7 @@ opfunc_obj_decl (opcode_t opdata, /**< operation data */
|
|||||||
prop_desc.value = ecma_get_completion_value_value (value_for_prop_desc);
|
prop_desc.value = ecma_get_completion_value_value (value_for_prop_desc);
|
||||||
|
|
||||||
prop_desc.is_writable_defined = true;
|
prop_desc.is_writable_defined = true;
|
||||||
prop_desc.writable = ECMA_PROPERTY_WRITABLE;
|
prop_desc.is_writable = true;
|
||||||
|
|
||||||
if (!is_previous_undefined
|
if (!is_previous_undefined
|
||||||
&& ((is_previous_data_desc
|
&& ((is_previous_data_desc
|
||||||
|
|||||||
@@ -258,9 +258,7 @@ TRY_TO_INSTANTIATE_PROPERTY_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (ecma_object_t
|
|||||||
enumerable,
|
enumerable,
|
||||||
configurable);
|
configurable);
|
||||||
|
|
||||||
prop_p->u.named_data_property.value = ecma_copy_value (value, false);
|
ecma_named_data_property_assign_value (obj_p, prop_p, value);
|
||||||
ecma_gc_update_may_ref_younger_object_flag_by_value (obj_p,
|
|
||||||
prop_p->u.named_data_property.value);
|
|
||||||
|
|
||||||
ecma_free_value (value, true);
|
ecma_free_value (value, true);
|
||||||
|
|
||||||
|
|||||||
@@ -341,16 +341,14 @@ ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id, /**
|
|||||||
ecma_string_t* magic_string_length_p = ecma_get_magic_string (ECMA_MAGIC_STRING_LENGTH);
|
ecma_string_t* magic_string_length_p = ecma_get_magic_string (ECMA_MAGIC_STRING_LENGTH);
|
||||||
ecma_property_t *len_prop_p = ecma_create_named_data_property (func_obj_p,
|
ecma_property_t *len_prop_p = ecma_create_named_data_property (func_obj_p,
|
||||||
magic_string_length_p,
|
magic_string_length_p,
|
||||||
ECMA_PROPERTY_NOT_WRITABLE,
|
false, false, false);
|
||||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
|
||||||
ECMA_PROPERTY_NOT_CONFIGURABLE);
|
|
||||||
|
|
||||||
ecma_deref_ecma_string (magic_string_length_p);
|
ecma_deref_ecma_string (magic_string_length_p);
|
||||||
|
|
||||||
ecma_number_t* len_p = ecma_alloc_number ();
|
ecma_number_t* len_p = ecma_alloc_number ();
|
||||||
*len_p = length_prop_num_value;
|
*len_p = length_prop_num_value;
|
||||||
|
|
||||||
len_prop_p->u.named_data_property.value = ecma_make_number_value (len_p);
|
ecma_set_named_data_property_value (len_prop_p, ecma_make_number_value (len_p));
|
||||||
|
|
||||||
return func_obj_p;
|
return func_obj_p;
|
||||||
} /* ecma_builtin_make_function_object_for_routine */
|
} /* ecma_builtin_make_function_object_for_routine */
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ ecma_gc_mark (ecma_object_t *object_p, /**< start object */
|
|||||||
{
|
{
|
||||||
case ECMA_PROPERTY_NAMEDDATA:
|
case ECMA_PROPERTY_NAMEDDATA:
|
||||||
{
|
{
|
||||||
ecma_value_t value = property_p->u.named_data_property.value;
|
ecma_value_t value = ecma_get_named_data_property_value (property_p);
|
||||||
|
|
||||||
if (ecma_is_value_object (value))
|
if (ecma_is_value_object (value))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -527,13 +527,13 @@ typedef struct
|
|||||||
ecma_object_t* set_p;
|
ecma_object_t* set_p;
|
||||||
|
|
||||||
/** [[Writable]] */
|
/** [[Writable]] */
|
||||||
ecma_property_writable_value_t writable;
|
bool is_writable;
|
||||||
|
|
||||||
/** [[Enumerable]] */
|
/** [[Enumerable]] */
|
||||||
ecma_property_enumerable_value_t enumerable;
|
bool is_enumerable;
|
||||||
|
|
||||||
/** [[Configurable]] */
|
/** [[Configurable]] */
|
||||||
ecma_property_configurable_value_t configurable;
|
bool is_configurable;
|
||||||
} ecma_property_descriptor_t;
|
} ecma_property_descriptor_t;
|
||||||
|
|
||||||
#if CONFIG_ECMA_CHAR_ENCODING == CONFIG_ECMA_CHAR_ASCII
|
#if CONFIG_ECMA_CHAR_ENCODING == CONFIG_ECMA_CHAR_ASCII
|
||||||
|
|||||||
@@ -486,9 +486,9 @@ ecma_get_internal_property (ecma_object_t *object_p, /**< object descriptor */
|
|||||||
ecma_property_t*
|
ecma_property_t*
|
||||||
ecma_create_named_data_property (ecma_object_t *obj_p, /**< object */
|
ecma_create_named_data_property (ecma_object_t *obj_p, /**< object */
|
||||||
ecma_string_t *name_p, /**< property name */
|
ecma_string_t *name_p, /**< property name */
|
||||||
ecma_property_writable_value_t writable, /**< 'writable' attribute */
|
bool is_writable, /**< 'Writable' attribute */
|
||||||
ecma_property_enumerable_value_t enumerable, /**< 'enumerable' attribute */
|
bool is_enumerable, /**< 'Enumerable' attribute */
|
||||||
ecma_property_configurable_value_t configurable) /**< 'configurable' attribute */
|
bool is_configurable) /**< 'Configurable' attribute */
|
||||||
{
|
{
|
||||||
JERRY_ASSERT(obj_p != NULL && name_p != NULL);
|
JERRY_ASSERT(obj_p != NULL && name_p != NULL);
|
||||||
JERRY_ASSERT(ecma_find_named_property (obj_p, name_p) == NULL);
|
JERRY_ASSERT(ecma_find_named_property (obj_p, name_p) == NULL);
|
||||||
@@ -500,9 +500,10 @@ ecma_create_named_data_property (ecma_object_t *obj_p, /**< object */
|
|||||||
name_p = ecma_copy_or_ref_ecma_string (name_p);
|
name_p = ecma_copy_or_ref_ecma_string (name_p);
|
||||||
ECMA_SET_NON_NULL_POINTER(prop_p->u.named_data_property.name_p, name_p);
|
ECMA_SET_NON_NULL_POINTER(prop_p->u.named_data_property.name_p, name_p);
|
||||||
|
|
||||||
prop_p->u.named_data_property.writable = writable;
|
prop_p->u.named_data_property.writable = is_writable ? ECMA_PROPERTY_WRITABLE : ECMA_PROPERTY_NOT_WRITABLE;
|
||||||
prop_p->u.named_data_property.enumerable = enumerable;
|
prop_p->u.named_data_property.enumerable = is_enumerable ? ECMA_PROPERTY_ENUMERABLE : ECMA_PROPERTY_NOT_ENUMERABLE;
|
||||||
prop_p->u.named_data_property.configurable = configurable;
|
prop_p->u.named_data_property.configurable = (is_configurable ?
|
||||||
|
ECMA_PROPERTY_CONFIGURABLE : ECMA_PROPERTY_NOT_CONFIGURABLE);
|
||||||
|
|
||||||
prop_p->u.named_data_property.is_lcached = false;
|
prop_p->u.named_data_property.is_lcached = false;
|
||||||
|
|
||||||
@@ -527,8 +528,8 @@ ecma_create_named_accessor_property (ecma_object_t *obj_p, /**< object */
|
|||||||
ecma_string_t *name_p, /**< property name */
|
ecma_string_t *name_p, /**< property name */
|
||||||
ecma_object_t *get_p, /**< getter */
|
ecma_object_t *get_p, /**< getter */
|
||||||
ecma_object_t *set_p, /**< setter */
|
ecma_object_t *set_p, /**< setter */
|
||||||
ecma_property_enumerable_value_t enumerable, /**< 'enumerable' attribute */
|
bool is_enumerable, /**< 'enumerable' attribute */
|
||||||
ecma_property_configurable_value_t configurable) /**< 'configurable' attribute */
|
bool is_configurable) /**< 'configurable' attribute */
|
||||||
{
|
{
|
||||||
JERRY_ASSERT(obj_p != NULL && name_p != NULL);
|
JERRY_ASSERT(obj_p != NULL && name_p != NULL);
|
||||||
JERRY_ASSERT(ecma_find_named_property (obj_p, name_p) == NULL);
|
JERRY_ASSERT(ecma_find_named_property (obj_p, name_p) == NULL);
|
||||||
@@ -546,8 +547,10 @@ ecma_create_named_accessor_property (ecma_object_t *obj_p, /**< object */
|
|||||||
ECMA_SET_POINTER(prop_p->u.named_accessor_property.set_p, set_p);
|
ECMA_SET_POINTER(prop_p->u.named_accessor_property.set_p, set_p);
|
||||||
ecma_gc_update_may_ref_younger_object_flag_by_object (obj_p, set_p);
|
ecma_gc_update_may_ref_younger_object_flag_by_object (obj_p, set_p);
|
||||||
|
|
||||||
prop_p->u.named_accessor_property.enumerable = enumerable;
|
prop_p->u.named_accessor_property.enumerable = (is_enumerable ?
|
||||||
prop_p->u.named_accessor_property.configurable = configurable;
|
ECMA_PROPERTY_ENUMERABLE : ECMA_PROPERTY_NOT_ENUMERABLE);
|
||||||
|
prop_p->u.named_accessor_property.configurable = (is_configurable ?
|
||||||
|
ECMA_PROPERTY_CONFIGURABLE : ECMA_PROPERTY_NOT_CONFIGURABLE);
|
||||||
|
|
||||||
prop_p->u.named_accessor_property.is_lcached = false;
|
prop_p->u.named_accessor_property.is_lcached = false;
|
||||||
|
|
||||||
@@ -825,6 +828,94 @@ ecma_delete_property (ecma_object_t *obj_p, /**< object */
|
|||||||
JERRY_UNREACHABLE();
|
JERRY_UNREACHABLE();
|
||||||
} /* ecma_delete_property */
|
} /* ecma_delete_property */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get value field of named data property
|
||||||
|
*
|
||||||
|
* @return ecma-value
|
||||||
|
*/
|
||||||
|
ecma_value_t
|
||||||
|
ecma_get_named_data_property_value (const ecma_property_t *prop_p) /**< property */
|
||||||
|
{
|
||||||
|
JERRY_ASSERT (prop_p->type == ECMA_PROPERTY_NAMEDDATA);
|
||||||
|
|
||||||
|
return prop_p->u.named_data_property.value;
|
||||||
|
} /* ecma_get_named_data_property_value */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set value field of named data property
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ecma_set_named_data_property_value (ecma_property_t *prop_p, /**< property */
|
||||||
|
ecma_value_t value) /**< value to set */
|
||||||
|
{
|
||||||
|
JERRY_ASSERT (prop_p->type == ECMA_PROPERTY_NAMEDDATA);
|
||||||
|
|
||||||
|
/* 'May ref younger' flag should be updated upon assignment of object value */
|
||||||
|
JERRY_ASSERT (!ecma_is_value_object (value));
|
||||||
|
|
||||||
|
prop_p->u.named_data_property.value = value;
|
||||||
|
} /* ecma_set_named_data_property_value */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assign value to named data property
|
||||||
|
*
|
||||||
|
* Note:
|
||||||
|
* value previously stored in the property is freed
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ecma_named_data_property_assign_value (ecma_object_t *obj_p, /**< object */
|
||||||
|
ecma_property_t *prop_p, /**< property */
|
||||||
|
ecma_value_t value) /**< value to assign */
|
||||||
|
{
|
||||||
|
JERRY_ASSERT (prop_p->type == ECMA_PROPERTY_NAMEDDATA);
|
||||||
|
#ifndef JERRY_NDEBUG
|
||||||
|
ecma_property_t *prop_iter_p;
|
||||||
|
for (prop_iter_p = ecma_get_property_list (obj_p);
|
||||||
|
prop_iter_p != NULL;
|
||||||
|
prop_iter_p = ECMA_GET_POINTER(prop_iter_p->next_property_p))
|
||||||
|
{
|
||||||
|
if (prop_iter_p == prop_p)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JERRY_ASSERT (prop_iter_p != NULL);
|
||||||
|
#endif /* !JERRY_NDEBUG */
|
||||||
|
|
||||||
|
ecma_free_value (ecma_get_named_data_property_value (prop_p), false);
|
||||||
|
prop_p->u.named_data_property.value = ecma_copy_value (value, false);
|
||||||
|
ecma_gc_update_may_ref_younger_object_flag_by_value (obj_p,
|
||||||
|
prop_p->u.named_data_property.value);
|
||||||
|
} /* ecma_named_data_property_assign_value */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get property's 'Writable' attribute value
|
||||||
|
*
|
||||||
|
* @return true - property is writable,
|
||||||
|
* false - otherwise.
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
ecma_is_property_writable (ecma_property_t* prop_p) /**< property */
|
||||||
|
{
|
||||||
|
JERRY_ASSERT (prop_p->type == ECMA_PROPERTY_NAMEDDATA);
|
||||||
|
|
||||||
|
return (prop_p->u.named_data_property.writable == ECMA_PROPERTY_WRITABLE);
|
||||||
|
} /* ecma_is_property_writable */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set property's 'Writable' attribute value
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ecma_set_property_writable_attr (ecma_property_t* prop_p, /**< property */
|
||||||
|
bool is_writable) /**< should the property
|
||||||
|
* be writable? */
|
||||||
|
{
|
||||||
|
JERRY_ASSERT (prop_p->type == ECMA_PROPERTY_NAMEDDATA);
|
||||||
|
|
||||||
|
prop_p->u.named_data_property.writable = is_writable ? ECMA_PROPERTY_WRITABLE : ECMA_PROPERTY_NOT_WRITABLE;
|
||||||
|
} /* ecma_set_property_writable_attr */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get property's 'Enumerable' attribute value
|
* Get property's 'Enumerable' attribute value
|
||||||
*
|
*
|
||||||
@@ -846,6 +937,28 @@ ecma_is_property_enumerable (ecma_property_t* prop_p) /**< property */
|
|||||||
}
|
}
|
||||||
} /* ecma_is_property_enumerable */
|
} /* ecma_is_property_enumerable */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set property's 'Enumerable' attribute value
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ecma_set_property_enumerable_attr (ecma_property_t* prop_p, /**< property */
|
||||||
|
bool is_enumerable) /**< should the property
|
||||||
|
* be enumerable? */
|
||||||
|
{
|
||||||
|
if (prop_p->type == ECMA_PROPERTY_NAMEDDATA)
|
||||||
|
{
|
||||||
|
prop_p->u.named_data_property.enumerable = (is_enumerable ?
|
||||||
|
ECMA_PROPERTY_ENUMERABLE : ECMA_PROPERTY_NOT_ENUMERABLE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
JERRY_ASSERT (prop_p->type == ECMA_PROPERTY_NAMEDACCESSOR);
|
||||||
|
|
||||||
|
prop_p->u.named_accessor_property.enumerable = (is_enumerable ?
|
||||||
|
ECMA_PROPERTY_ENUMERABLE : ECMA_PROPERTY_NOT_ENUMERABLE);
|
||||||
|
}
|
||||||
|
} /* ecma_set_property_enumerable_attr */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get property's 'Configurable' attribute value
|
* Get property's 'Configurable' attribute value
|
||||||
*
|
*
|
||||||
@@ -867,6 +980,28 @@ ecma_is_property_configurable (ecma_property_t* prop_p) /**< property */
|
|||||||
}
|
}
|
||||||
} /* ecma_is_property_configurable */
|
} /* ecma_is_property_configurable */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set property's 'Configurable' attribute value
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ecma_set_property_configurable_attr (ecma_property_t* prop_p, /**< property */
|
||||||
|
bool is_configurable) /**< should the property
|
||||||
|
* be configurable? */
|
||||||
|
{
|
||||||
|
if (prop_p->type == ECMA_PROPERTY_NAMEDDATA)
|
||||||
|
{
|
||||||
|
prop_p->u.named_data_property.configurable = (is_configurable ?
|
||||||
|
ECMA_PROPERTY_CONFIGURABLE : ECMA_PROPERTY_NOT_CONFIGURABLE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
JERRY_ASSERT (prop_p->type == ECMA_PROPERTY_NAMEDACCESSOR);
|
||||||
|
|
||||||
|
prop_p->u.named_accessor_property.configurable = (is_configurable ?
|
||||||
|
ECMA_PROPERTY_CONFIGURABLE : ECMA_PROPERTY_NOT_CONFIGURABLE);
|
||||||
|
}
|
||||||
|
} /* ecma_set_property_configurable_attr */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the property is registered in LCache
|
* Check whether the property is registered in LCache
|
||||||
*
|
*
|
||||||
@@ -921,13 +1056,13 @@ ecma_make_empty_property_descriptor (void)
|
|||||||
.value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED),
|
.value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED),
|
||||||
|
|
||||||
.is_writable_defined = false,
|
.is_writable_defined = false,
|
||||||
.writable = ECMA_PROPERTY_NOT_WRITABLE,
|
.is_writable = false,
|
||||||
|
|
||||||
.is_enumerable_defined = false,
|
.is_enumerable_defined = false,
|
||||||
.enumerable = ECMA_PROPERTY_NOT_ENUMERABLE,
|
.is_enumerable = false,
|
||||||
|
|
||||||
.is_configurable_defined = false,
|
.is_configurable_defined = false,
|
||||||
.configurable = ECMA_PROPERTY_NOT_CONFIGURABLE,
|
.is_configurable = false,
|
||||||
|
|
||||||
.is_get_defined = false,
|
.is_get_defined = false,
|
||||||
.get_p = NULL,
|
.get_p = NULL,
|
||||||
|
|||||||
@@ -254,15 +254,15 @@ extern ecma_property_t* ecma_get_internal_property (ecma_object_t *object_p,
|
|||||||
|
|
||||||
extern ecma_property_t *ecma_create_named_data_property (ecma_object_t *obj_p,
|
extern ecma_property_t *ecma_create_named_data_property (ecma_object_t *obj_p,
|
||||||
ecma_string_t *name_p,
|
ecma_string_t *name_p,
|
||||||
ecma_property_writable_value_t writable,
|
bool is_writable,
|
||||||
ecma_property_enumerable_value_t enumerable,
|
bool is_enumerable,
|
||||||
ecma_property_configurable_value_t configurable);
|
bool is_configurable);
|
||||||
extern ecma_property_t *ecma_create_named_accessor_property (ecma_object_t *obj_p,
|
extern ecma_property_t *ecma_create_named_accessor_property (ecma_object_t *obj_p,
|
||||||
ecma_string_t *name_p,
|
ecma_string_t *name_p,
|
||||||
ecma_object_t *get_p,
|
ecma_object_t *get_p,
|
||||||
ecma_object_t *set_p,
|
ecma_object_t *set_p,
|
||||||
ecma_property_enumerable_value_t enumerable,
|
bool is_enumerable,
|
||||||
ecma_property_configurable_value_t configurable);
|
bool is_configurable);
|
||||||
extern ecma_property_t *ecma_find_named_property (ecma_object_t *obj_p,
|
extern ecma_property_t *ecma_find_named_property (ecma_object_t *obj_p,
|
||||||
ecma_string_t *name_p);
|
ecma_string_t *name_p);
|
||||||
extern ecma_property_t *ecma_get_named_property (ecma_object_t *obj_p,
|
extern ecma_property_t *ecma_get_named_property (ecma_object_t *obj_p,
|
||||||
@@ -274,8 +274,18 @@ extern void ecma_free_property (ecma_object_t *obj_p, ecma_property_t *prop_p);
|
|||||||
|
|
||||||
extern void ecma_delete_property (ecma_object_t *obj_p, ecma_property_t *prop_p);
|
extern void ecma_delete_property (ecma_object_t *obj_p, ecma_property_t *prop_p);
|
||||||
|
|
||||||
|
extern ecma_value_t ecma_get_named_data_property_value (const ecma_property_t *prop_p);
|
||||||
|
extern void ecma_set_named_data_property_value (ecma_property_t *prop_p, ecma_value_t value);
|
||||||
|
extern void ecma_named_data_property_assign_value (ecma_object_t *obj_p,
|
||||||
|
ecma_property_t *prop_p,
|
||||||
|
ecma_value_t value);
|
||||||
|
|
||||||
|
extern bool ecma_is_property_writable (ecma_property_t* prop_p);
|
||||||
|
extern void ecma_set_property_writable_attr (ecma_property_t* prop_p, bool is_writable);
|
||||||
extern bool ecma_is_property_enumerable (ecma_property_t* prop_p);
|
extern bool ecma_is_property_enumerable (ecma_property_t* prop_p);
|
||||||
|
extern void ecma_set_property_enumerable_attr (ecma_property_t* prop_p, bool is_enumerable);
|
||||||
extern bool ecma_is_property_configurable (ecma_property_t* prop_p);
|
extern bool ecma_is_property_configurable (ecma_property_t* prop_p);
|
||||||
|
extern void ecma_set_property_configurable_attr (ecma_property_t* prop_p, bool is_configurable);
|
||||||
|
|
||||||
extern bool ecma_is_property_lcached (ecma_property_t *prop_p);
|
extern bool ecma_is_property_lcached (ecma_property_t *prop_p);
|
||||||
extern void ecma_set_property_lcached (ecma_property_t *prop_p,
|
extern void ecma_set_property_lcached (ecma_property_t *prop_p,
|
||||||
|
|||||||
@@ -119,10 +119,8 @@ ecma_op_create_array_object (ecma_value_t *arguments_list_p, /**< list of argume
|
|||||||
|
|
||||||
ecma_property_t *length_prop_p = ecma_create_named_data_property (obj_p,
|
ecma_property_t *length_prop_p = ecma_create_named_data_property (obj_p,
|
||||||
length_magic_string_p,
|
length_magic_string_p,
|
||||||
true,
|
true, false, false);
|
||||||
false,
|
ecma_set_named_data_property_value (length_prop_p, ecma_make_number_value (length_num_p));
|
||||||
false);
|
|
||||||
length_prop_p->u.named_data_property.value = ecma_make_number_value (length_num_p);
|
|
||||||
|
|
||||||
ecma_deref_ecma_string (length_magic_string_p);
|
ecma_deref_ecma_string (length_magic_string_p);
|
||||||
|
|
||||||
@@ -138,13 +136,13 @@ ecma_op_create_array_object (ecma_value_t *arguments_list_p, /**< list of argume
|
|||||||
item_prop_desc.value = array_items_p [index];
|
item_prop_desc.value = array_items_p [index];
|
||||||
|
|
||||||
item_prop_desc.is_writable_defined = true;
|
item_prop_desc.is_writable_defined = true;
|
||||||
item_prop_desc.writable = ECMA_PROPERTY_WRITABLE;
|
item_prop_desc.is_writable = true;
|
||||||
|
|
||||||
item_prop_desc.is_enumerable_defined = true;
|
item_prop_desc.is_enumerable_defined = true;
|
||||||
item_prop_desc.enumerable = ECMA_PROPERTY_ENUMERABLE;
|
item_prop_desc.is_enumerable = true;
|
||||||
|
|
||||||
item_prop_desc.is_configurable_defined = true;
|
item_prop_desc.is_configurable_defined = true;
|
||||||
item_prop_desc.configurable = ECMA_PROPERTY_CONFIGURABLE;
|
item_prop_desc.is_configurable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ecma_op_object_define_own_property (obj_p,
|
ecma_op_object_define_own_property (obj_p,
|
||||||
@@ -183,7 +181,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
|||||||
JERRY_ASSERT (len_prop_p != NULL && len_prop_p->type == ECMA_PROPERTY_NAMEDDATA);
|
JERRY_ASSERT (len_prop_p != NULL && len_prop_p->type == ECMA_PROPERTY_NAMEDDATA);
|
||||||
|
|
||||||
// 2.
|
// 2.
|
||||||
ecma_value_t old_len_value = len_prop_p->u.named_data_property.value;
|
ecma_value_t old_len_value = ecma_get_named_data_property_value (len_prop_p);
|
||||||
|
|
||||||
ecma_number_t *num_p = ecma_get_number_from_value (old_len_value);
|
ecma_number_t *num_p = ecma_get_number_from_value (old_len_value);
|
||||||
uint32_t old_len_uint32 = ecma_number_to_uint32 (*num_p);
|
uint32_t old_len_uint32 = ecma_number_to_uint32 (*num_p);
|
||||||
@@ -251,7 +249,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// g.
|
// g.
|
||||||
if (len_prop_p->u.named_data_property.writable == ECMA_PROPERTY_NOT_WRITABLE)
|
if (!ecma_is_property_writable (len_prop_p))
|
||||||
{
|
{
|
||||||
ret_value = ecma_reject (is_throw);
|
ret_value = ecma_reject (is_throw);
|
||||||
}
|
}
|
||||||
@@ -260,7 +258,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
|||||||
// h.
|
// h.
|
||||||
bool new_writable;
|
bool new_writable;
|
||||||
if (!new_len_property_desc.is_writable_defined
|
if (!new_len_property_desc.is_writable_defined
|
||||||
|| new_len_property_desc.writable == ECMA_PROPERTY_WRITABLE)
|
|| new_len_property_desc.is_writable)
|
||||||
{
|
{
|
||||||
new_writable = true;
|
new_writable = true;
|
||||||
}
|
}
|
||||||
@@ -271,7 +269,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
|||||||
|
|
||||||
// iii.
|
// iii.
|
||||||
new_len_property_desc.is_writable_defined = true;
|
new_len_property_desc.is_writable_defined = true;
|
||||||
new_len_property_desc.writable = ECMA_PROPERTY_WRITABLE;
|
new_len_property_desc.is_writable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// j.
|
// j.
|
||||||
@@ -324,7 +322,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
|||||||
if (!new_writable)
|
if (!new_writable)
|
||||||
{
|
{
|
||||||
new_len_property_desc.is_writable_defined = true;
|
new_len_property_desc.is_writable_defined = true;
|
||||||
new_len_property_desc.writable = ECMA_PROPERTY_NOT_WRITABLE;
|
new_len_property_desc.is_writable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3.
|
// 3.
|
||||||
@@ -356,7 +354,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
|||||||
ecma_property_descriptor_t prop_desc_not_writable = ecma_make_empty_property_descriptor ();
|
ecma_property_descriptor_t prop_desc_not_writable = ecma_make_empty_property_descriptor ();
|
||||||
|
|
||||||
prop_desc_not_writable.is_writable_defined = true;
|
prop_desc_not_writable.is_writable_defined = true;
|
||||||
prop_desc_not_writable.writable = ECMA_PROPERTY_NOT_WRITABLE;
|
prop_desc_not_writable.is_writable = false;
|
||||||
|
|
||||||
ecma_completion_value_t completion_set_not_writable;
|
ecma_completion_value_t completion_set_not_writable;
|
||||||
magic_string_length_p = ecma_get_magic_string (ECMA_MAGIC_STRING_LENGTH);
|
magic_string_length_p = ecma_get_magic_string (ECMA_MAGIC_STRING_LENGTH);
|
||||||
@@ -420,7 +418,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
|||||||
|
|
||||||
// b.
|
// b.
|
||||||
if (index >= old_len_uint32
|
if (index >= old_len_uint32
|
||||||
&& len_prop_p->u.named_data_property.writable == ECMA_PROPERTY_NOT_WRITABLE)
|
&& !ecma_is_property_writable (len_prop_p))
|
||||||
{
|
{
|
||||||
return ecma_reject (is_throw);
|
return ecma_reject (is_throw);
|
||||||
}
|
}
|
||||||
@@ -446,8 +444,8 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
|
|||||||
ecma_number_t *num_p = ecma_alloc_number ();
|
ecma_number_t *num_p = ecma_alloc_number ();
|
||||||
*num_p = ecma_number_add (ecma_uint32_to_number (index), ECMA_NUMBER_ONE);
|
*num_p = ecma_number_add (ecma_uint32_to_number (index), ECMA_NUMBER_ONE);
|
||||||
|
|
||||||
ecma_free_value (len_prop_p->u.named_data_property.value, false);
|
ecma_free_value (ecma_get_named_data_property_value (len_prop_p), false);
|
||||||
len_prop_p->u.named_data_property.value = ecma_make_number_value (num_p);
|
ecma_set_named_data_property_value (len_prop_p, ecma_make_number_value (num_p));
|
||||||
}
|
}
|
||||||
|
|
||||||
// f.
|
// f.
|
||||||
|
|||||||
@@ -439,13 +439,13 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t src_prop_desc
|
|||||||
prop_desc.is_value_defined = true;
|
prop_desc.is_value_defined = true;
|
||||||
|
|
||||||
prop_desc.is_writable_defined = true;
|
prop_desc.is_writable_defined = true;
|
||||||
prop_desc.writable = ECMA_PROPERTY_WRITABLE;
|
prop_desc.is_writable = true;
|
||||||
|
|
||||||
prop_desc.is_enumerable_defined = true;
|
prop_desc.is_enumerable_defined = true;
|
||||||
prop_desc.enumerable = ECMA_PROPERTY_ENUMERABLE;
|
prop_desc.is_enumerable = true;
|
||||||
|
|
||||||
prop_desc.is_configurable_defined = true;
|
prop_desc.is_configurable_defined = true;
|
||||||
prop_desc.configurable = ECMA_PROPERTY_CONFIGURABLE;
|
prop_desc.is_configurable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3.
|
// 3.
|
||||||
@@ -466,7 +466,7 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t src_prop_desc
|
|||||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
||||||
|
|
||||||
// b.
|
// b.
|
||||||
const bool is_writable = (src_prop_desc.writable == ECMA_PROPERTY_WRITABLE);
|
const bool is_writable = (src_prop_desc.is_writable);
|
||||||
prop_desc.value = ecma_make_simple_value (is_writable ? ECMA_SIMPLE_VALUE_TRUE
|
prop_desc.value = ecma_make_simple_value (is_writable ? ECMA_SIMPLE_VALUE_TRUE
|
||||||
: ECMA_SIMPLE_VALUE_FALSE);
|
: ECMA_SIMPLE_VALUE_FALSE);
|
||||||
|
|
||||||
@@ -520,7 +520,7 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t src_prop_desc
|
|||||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool is_enumerable = (src_prop_desc.enumerable == ECMA_PROPERTY_ENUMERABLE);
|
const bool is_enumerable = src_prop_desc.is_enumerable;
|
||||||
prop_desc.value = ecma_make_simple_value (is_enumerable ? ECMA_SIMPLE_VALUE_TRUE
|
prop_desc.value = ecma_make_simple_value (is_enumerable ? ECMA_SIMPLE_VALUE_TRUE
|
||||||
: ECMA_SIMPLE_VALUE_FALSE);
|
: ECMA_SIMPLE_VALUE_FALSE);
|
||||||
|
|
||||||
@@ -532,7 +532,7 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t src_prop_desc
|
|||||||
ecma_deref_ecma_string (enumerable_magic_string_p);
|
ecma_deref_ecma_string (enumerable_magic_string_p);
|
||||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
||||||
|
|
||||||
const bool is_configurable = (src_prop_desc.configurable == ECMA_PROPERTY_CONFIGURABLE);
|
const bool is_configurable = src_prop_desc.is_configurable;
|
||||||
prop_desc.value = ecma_make_simple_value (is_configurable ? ECMA_SIMPLE_VALUE_TRUE
|
prop_desc.value = ecma_make_simple_value (is_configurable ? ECMA_SIMPLE_VALUE_TRUE
|
||||||
: ECMA_SIMPLE_VALUE_FALSE);
|
: ECMA_SIMPLE_VALUE_FALSE);
|
||||||
|
|
||||||
@@ -591,13 +591,13 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
|
|||||||
prop_desc.is_enumerable_defined = true;
|
prop_desc.is_enumerable_defined = true;
|
||||||
if (ecma_is_completion_value_normal_true (boolean_enumerable_prop_value))
|
if (ecma_is_completion_value_normal_true (boolean_enumerable_prop_value))
|
||||||
{
|
{
|
||||||
prop_desc.enumerable = ECMA_PROPERTY_ENUMERABLE;
|
prop_desc.is_enumerable = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (ecma_is_completion_value_normal_false (boolean_enumerable_prop_value));
|
JERRY_ASSERT (ecma_is_completion_value_normal_false (boolean_enumerable_prop_value));
|
||||||
|
|
||||||
prop_desc.enumerable = ECMA_PROPERTY_NOT_ENUMERABLE;
|
prop_desc.is_enumerable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ECMA_FINALIZE (boolean_enumerable_prop_value);
|
ECMA_FINALIZE (boolean_enumerable_prop_value);
|
||||||
@@ -625,13 +625,13 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
|
|||||||
prop_desc.is_configurable_defined = true;
|
prop_desc.is_configurable_defined = true;
|
||||||
if (ecma_is_completion_value_normal_true (boolean_configurable_prop_value))
|
if (ecma_is_completion_value_normal_true (boolean_configurable_prop_value))
|
||||||
{
|
{
|
||||||
prop_desc.configurable = ECMA_PROPERTY_CONFIGURABLE;
|
prop_desc.is_configurable = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (ecma_is_completion_value_normal_false (boolean_configurable_prop_value));
|
JERRY_ASSERT (ecma_is_completion_value_normal_false (boolean_configurable_prop_value));
|
||||||
|
|
||||||
prop_desc.configurable = ECMA_PROPERTY_NOT_CONFIGURABLE;
|
prop_desc.is_configurable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ECMA_FINALIZE (boolean_configurable_prop_value);
|
ECMA_FINALIZE (boolean_configurable_prop_value);
|
||||||
@@ -682,13 +682,13 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
|
|||||||
prop_desc.is_writable_defined = true;
|
prop_desc.is_writable_defined = true;
|
||||||
if (ecma_is_completion_value_normal_true (boolean_writable_prop_value))
|
if (ecma_is_completion_value_normal_true (boolean_writable_prop_value))
|
||||||
{
|
{
|
||||||
prop_desc.writable = ECMA_PROPERTY_WRITABLE;
|
prop_desc.is_writable = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (ecma_is_completion_value_normal_false (boolean_writable_prop_value));
|
JERRY_ASSERT (ecma_is_completion_value_normal_false (boolean_writable_prop_value));
|
||||||
|
|
||||||
prop_desc.writable = ECMA_PROPERTY_NOT_WRITABLE;
|
prop_desc.is_writable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ECMA_FINALIZE (boolean_writable_prop_value);
|
ECMA_FINALIZE (boolean_writable_prop_value);
|
||||||
|
|||||||
@@ -121,12 +121,10 @@ ecma_new_standard_error_with_message (ecma_standard_error_t error_type, /**< nat
|
|||||||
ecma_string_t *message_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_MESSAGE);
|
ecma_string_t *message_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_MESSAGE);
|
||||||
ecma_property_t *prop_p = ecma_create_named_data_property (new_error_obj_p,
|
ecma_property_t *prop_p = ecma_create_named_data_property (new_error_obj_p,
|
||||||
message_magic_string_p,
|
message_magic_string_p,
|
||||||
ECMA_PROPERTY_WRITABLE,
|
true, false, true);
|
||||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
|
||||||
ECMA_PROPERTY_CONFIGURABLE);
|
|
||||||
|
|
||||||
ecma_string_t *msg_string_p = ecma_copy_or_ref_ecma_string (message_string_p);
|
ecma_set_named_data_property_value (prop_p,
|
||||||
prop_p->u.named_data_property.value = ecma_make_string_value (msg_string_p);
|
ecma_make_string_value (ecma_copy_or_ref_ecma_string (message_string_p)));
|
||||||
ecma_deref_ecma_string (message_magic_string_p);
|
ecma_deref_ecma_string (message_magic_string_p);
|
||||||
|
|
||||||
return new_error_obj_p;
|
return new_error_obj_p;
|
||||||
|
|||||||
@@ -191,12 +191,6 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
|||||||
ecma_property_descriptor_t length_prop_desc = ecma_make_empty_property_descriptor ();
|
ecma_property_descriptor_t length_prop_desc = ecma_make_empty_property_descriptor ();
|
||||||
length_prop_desc.is_value_defined = true;
|
length_prop_desc.is_value_defined = true;
|
||||||
length_prop_desc.value = ecma_make_number_value (len_p);
|
length_prop_desc.value = ecma_make_number_value (len_p);
|
||||||
length_prop_desc.is_writable_defined = false;
|
|
||||||
length_prop_desc.writable = ECMA_PROPERTY_NOT_WRITABLE;
|
|
||||||
length_prop_desc.is_enumerable_defined = false;
|
|
||||||
length_prop_desc.enumerable = ECMA_PROPERTY_NOT_ENUMERABLE;
|
|
||||||
length_prop_desc.is_configurable_defined = false;
|
|
||||||
length_prop_desc.configurable = ECMA_PROPERTY_NOT_CONFIGURABLE;
|
|
||||||
|
|
||||||
ecma_string_t* magic_string_length_p = ecma_get_magic_string (ECMA_MAGIC_STRING_LENGTH);
|
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,
|
ecma_completion_value_t completion = ecma_op_object_define_own_property (f,
|
||||||
@@ -221,13 +215,13 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
|||||||
prop_desc.value = ecma_make_object_value (f);
|
prop_desc.value = ecma_make_object_value (f);
|
||||||
|
|
||||||
prop_desc.is_writable_defined = true;
|
prop_desc.is_writable_defined = true;
|
||||||
prop_desc.writable = ECMA_PROPERTY_WRITABLE;
|
prop_desc.is_writable = true;
|
||||||
|
|
||||||
prop_desc.is_enumerable_defined = true;
|
prop_desc.is_enumerable_defined = true;
|
||||||
prop_desc.enumerable = ECMA_PROPERTY_NOT_ENUMERABLE;
|
prop_desc.is_enumerable = false;
|
||||||
|
|
||||||
prop_desc.is_configurable_defined = true;
|
prop_desc.is_configurable_defined = true;
|
||||||
prop_desc.configurable = ECMA_PROPERTY_CONFIGURABLE;
|
prop_desc.is_configurable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ecma_string_t *magic_string_constructor_p = ecma_get_magic_string (ECMA_MAGIC_STRING_CONSTRUCTOR);
|
ecma_string_t *magic_string_constructor_p = ecma_get_magic_string (ECMA_MAGIC_STRING_CONSTRUCTOR);
|
||||||
@@ -239,7 +233,7 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
|||||||
|
|
||||||
// 18.
|
// 18.
|
||||||
prop_desc.value = ecma_make_object_value (proto_p);
|
prop_desc.value = ecma_make_object_value (proto_p);
|
||||||
prop_desc.configurable = ECMA_PROPERTY_NOT_CONFIGURABLE;
|
prop_desc.is_configurable = false;
|
||||||
ecma_string_t *magic_string_prototype_p = ecma_get_magic_string (ECMA_MAGIC_STRING_PROTOTYPE);
|
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 (f,
|
||||||
magic_string_prototype_p,
|
magic_string_prototype_p,
|
||||||
@@ -257,10 +251,10 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
|||||||
prop_desc = ecma_make_empty_property_descriptor ();
|
prop_desc = ecma_make_empty_property_descriptor ();
|
||||||
{
|
{
|
||||||
prop_desc.is_enumerable_defined = true;
|
prop_desc.is_enumerable_defined = true;
|
||||||
prop_desc.enumerable = ECMA_PROPERTY_NOT_ENUMERABLE;
|
prop_desc.is_enumerable = false;
|
||||||
|
|
||||||
prop_desc.is_configurable_defined = true;
|
prop_desc.is_configurable_defined = true;
|
||||||
prop_desc.configurable = ECMA_PROPERTY_NOT_CONFIGURABLE;
|
prop_desc.is_configurable = false;
|
||||||
|
|
||||||
prop_desc.is_get_defined = true;
|
prop_desc.is_get_defined = true;
|
||||||
prop_desc.get_p = thrower_p;
|
prop_desc.get_p = thrower_p;
|
||||||
@@ -708,15 +702,13 @@ ecma_op_function_declaration (ecma_object_t *lex_env_p, /**< lexical environment
|
|||||||
property_desc.value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
property_desc.value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||||
|
|
||||||
property_desc.is_writable_defined = true;
|
property_desc.is_writable_defined = true;
|
||||||
property_desc.writable = ECMA_PROPERTY_WRITABLE;
|
property_desc.is_writable = true;
|
||||||
|
|
||||||
property_desc.is_enumerable_defined = true;
|
property_desc.is_enumerable_defined = true;
|
||||||
property_desc.enumerable = ECMA_PROPERTY_ENUMERABLE;
|
property_desc.is_enumerable = true;
|
||||||
|
|
||||||
property_desc.is_configurable_defined = true;
|
property_desc.is_configurable_defined = true;
|
||||||
property_desc.configurable = (is_configurable_bindings ?
|
property_desc.is_configurable = is_configurable_bindings;
|
||||||
ECMA_PROPERTY_CONFIGURABLE :
|
|
||||||
ECMA_PROPERTY_NOT_CONFIGURABLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
completion = ecma_op_object_define_own_property (glob_obj_p,
|
completion = ecma_op_object_define_own_property (glob_obj_p,
|
||||||
@@ -732,8 +724,8 @@ ecma_op_function_declaration (ecma_object_t *lex_env_p, /**< lexical environment
|
|||||||
{
|
{
|
||||||
JERRY_ASSERT (existing_prop_p->type == ECMA_PROPERTY_NAMEDDATA);
|
JERRY_ASSERT (existing_prop_p->type == ECMA_PROPERTY_NAMEDDATA);
|
||||||
|
|
||||||
if (existing_prop_p->u.named_data_property.writable != ECMA_PROPERTY_WRITABLE
|
if (!ecma_is_property_writable (existing_prop_p)
|
||||||
|| existing_prop_p->u.named_data_property.enumerable != ECMA_PROPERTY_ENUMERABLE)
|
|| !ecma_is_property_enumerable (existing_prop_p))
|
||||||
{
|
{
|
||||||
completion = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
completion = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,10 +88,7 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme
|
|||||||
{
|
{
|
||||||
ecma_create_named_data_property (lex_env_p,
|
ecma_create_named_data_property (lex_env_p,
|
||||||
name_p,
|
name_p,
|
||||||
ECMA_PROPERTY_WRITABLE,
|
true, false, is_deletable);
|
||||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
|
||||||
is_deletable ? ECMA_PROPERTY_CONFIGURABLE
|
|
||||||
: ECMA_PROPERTY_NOT_CONFIGURABLE);
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -108,13 +105,13 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme
|
|||||||
prop_desc.value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
prop_desc.value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||||
|
|
||||||
prop_desc.is_writable_defined = true;
|
prop_desc.is_writable_defined = true;
|
||||||
prop_desc.writable = ECMA_PROPERTY_WRITABLE;
|
prop_desc.is_writable = true;
|
||||||
|
|
||||||
prop_desc.is_enumerable_defined = true;
|
prop_desc.is_enumerable_defined = true;
|
||||||
prop_desc.enumerable = ECMA_PROPERTY_ENUMERABLE;
|
prop_desc.is_enumerable = true;
|
||||||
|
|
||||||
prop_desc.is_configurable_defined = true;
|
prop_desc.is_configurable_defined = true;
|
||||||
prop_desc.configurable = is_deletable ? ECMA_PROPERTY_CONFIGURABLE : ECMA_PROPERTY_NOT_CONFIGURABLE;
|
prop_desc.is_configurable = is_deletable;
|
||||||
}
|
}
|
||||||
|
|
||||||
ecma_completion_value_t completion = ecma_op_object_define_own_property (binding_obj_p,
|
ecma_completion_value_t completion = ecma_op_object_define_own_property (binding_obj_p,
|
||||||
@@ -179,11 +176,9 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment
|
|||||||
|
|
||||||
ecma_property_t *property_p = ecma_get_named_data_property (lex_env_p, name_p);
|
ecma_property_t *property_p = ecma_get_named_data_property (lex_env_p, name_p);
|
||||||
|
|
||||||
if (property_p->u.named_data_property.writable == ECMA_PROPERTY_WRITABLE)
|
if (ecma_is_property_writable (property_p))
|
||||||
{
|
{
|
||||||
ecma_free_value (property_p->u.named_data_property.value, false);
|
ecma_named_data_property_assign_value (lex_env_p, property_p, value);
|
||||||
property_p->u.named_data_property.value = ecma_copy_value (value, false);
|
|
||||||
ecma_gc_update_may_ref_younger_object_flag_by_value (lex_env_p, property_p->u.named_data_property.value);
|
|
||||||
}
|
}
|
||||||
else if (is_strict)
|
else if (is_strict)
|
||||||
{
|
{
|
||||||
@@ -258,10 +253,10 @@ ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */
|
|||||||
|
|
||||||
ecma_property_t *property_p = ecma_get_named_data_property (lex_env_p, name_p);
|
ecma_property_t *property_p = ecma_get_named_data_property (lex_env_p, name_p);
|
||||||
|
|
||||||
ecma_value_t prop_value = property_p->u.named_data_property.value;
|
ecma_value_t prop_value = ecma_get_named_data_property_value (property_p);
|
||||||
|
|
||||||
/* is the binding mutable? */
|
/* is the binding mutable? */
|
||||||
if (property_p->u.named_data_property.writable == ECMA_PROPERTY_NOT_WRITABLE
|
if (!ecma_is_property_writable (property_p)
|
||||||
&& ecma_is_value_empty (prop_value))
|
&& ecma_is_value_empty (prop_value))
|
||||||
{
|
{
|
||||||
/* unitialized immutable binding */
|
/* unitialized immutable binding */
|
||||||
@@ -336,7 +331,7 @@ ecma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
|||||||
{
|
{
|
||||||
JERRY_ASSERT(prop_p->type == ECMA_PROPERTY_NAMEDDATA);
|
JERRY_ASSERT(prop_p->type == ECMA_PROPERTY_NAMEDDATA);
|
||||||
|
|
||||||
if (prop_p->u.named_data_property.configurable == ECMA_PROPERTY_NOT_CONFIGURABLE)
|
if (!ecma_is_property_configurable (prop_p))
|
||||||
{
|
{
|
||||||
ret_val = ECMA_SIMPLE_VALUE_FALSE;
|
ret_val = ECMA_SIMPLE_VALUE_FALSE;
|
||||||
}
|
}
|
||||||
@@ -422,13 +417,12 @@ ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, /**< lexical environ
|
|||||||
*/
|
*/
|
||||||
ecma_property_t *prop_p = ecma_create_named_data_property (lex_env_p,
|
ecma_property_t *prop_p = ecma_create_named_data_property (lex_env_p,
|
||||||
name_p,
|
name_p,
|
||||||
ECMA_PROPERTY_NOT_WRITABLE,
|
false, false, false);
|
||||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
|
||||||
ECMA_PROPERTY_NOT_CONFIGURABLE);
|
|
||||||
|
|
||||||
JERRY_ASSERT(ecma_is_value_undefined (prop_p->u.named_data_property.value));
|
JERRY_ASSERT(ecma_is_value_undefined (ecma_get_named_data_property_value (prop_p)));
|
||||||
|
|
||||||
prop_p->u.named_data_property.value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
|
ecma_set_named_data_property_value (prop_p,
|
||||||
|
ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -461,11 +455,10 @@ ecma_op_initialize_immutable_binding (ecma_object_t *lex_env_p, /**< lexical env
|
|||||||
ecma_property_t *prop_p = ecma_get_named_data_property (lex_env_p, name_p);
|
ecma_property_t *prop_p = ecma_get_named_data_property (lex_env_p, name_p);
|
||||||
|
|
||||||
/* The binding must be unitialized immutable binding */
|
/* The binding must be unitialized immutable binding */
|
||||||
JERRY_ASSERT(prop_p->u.named_data_property.writable == ECMA_PROPERTY_NOT_WRITABLE
|
JERRY_ASSERT(!ecma_is_property_writable (prop_p)
|
||||||
&& ecma_is_value_empty (prop_p->u.named_data_property.value));
|
&& ecma_is_value_empty (ecma_get_named_data_property_value (prop_p)));
|
||||||
|
|
||||||
prop_p->u.named_data_property.value = ecma_copy_value (value, false);
|
ecma_named_data_property_assign_value (lex_env_p, prop_p, value);
|
||||||
ecma_gc_update_may_ref_younger_object_flag_by_value (lex_env_p, prop_p->u.named_data_property.value);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,13 +72,13 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
|
|||||||
prop_desc.value = ecma_make_number_value (len_p);
|
prop_desc.value = ecma_make_number_value (len_p);
|
||||||
|
|
||||||
prop_desc.is_writable_defined = true;
|
prop_desc.is_writable_defined = true;
|
||||||
prop_desc.writable = ECMA_PROPERTY_WRITABLE;
|
prop_desc.is_writable = true;
|
||||||
|
|
||||||
prop_desc.is_enumerable_defined = true;
|
prop_desc.is_enumerable_defined = true;
|
||||||
prop_desc.enumerable = ECMA_PROPERTY_NOT_ENUMERABLE;
|
prop_desc.is_enumerable = false;
|
||||||
|
|
||||||
prop_desc.is_configurable_defined = true;
|
prop_desc.is_configurable_defined = true;
|
||||||
prop_desc.configurable = ECMA_PROPERTY_CONFIGURABLE;
|
prop_desc.is_configurable = true;
|
||||||
}
|
}
|
||||||
ecma_string_t *length_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_LENGTH);
|
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,
|
ecma_completion_value_t completion = ecma_op_object_define_own_property (obj_p,
|
||||||
@@ -101,13 +101,13 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
|
|||||||
prop_desc.value = arguments_list_p[indx];
|
prop_desc.value = arguments_list_p[indx];
|
||||||
|
|
||||||
prop_desc.is_writable_defined = true;
|
prop_desc.is_writable_defined = true;
|
||||||
prop_desc.writable = ECMA_PROPERTY_WRITABLE;
|
prop_desc.is_writable = true;
|
||||||
|
|
||||||
prop_desc.is_enumerable_defined = true;
|
prop_desc.is_enumerable_defined = true;
|
||||||
prop_desc.enumerable = ECMA_PROPERTY_ENUMERABLE;
|
prop_desc.is_enumerable = true;
|
||||||
|
|
||||||
prop_desc.is_configurable_defined = true;
|
prop_desc.is_configurable_defined = true;
|
||||||
prop_desc.configurable = ECMA_PROPERTY_CONFIGURABLE;
|
prop_desc.is_configurable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ecma_string_t *indx_string_p = ecma_new_ecma_string_from_number (ecma_uint32_to_number (indx));
|
ecma_string_t *indx_string_p = ecma_new_ecma_string_from_number (ecma_uint32_to_number (indx));
|
||||||
@@ -210,13 +210,13 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
|
|||||||
prop_desc.value = ecma_make_object_value (func_obj_p);
|
prop_desc.value = ecma_make_object_value (func_obj_p);
|
||||||
|
|
||||||
prop_desc.is_writable_defined = true;
|
prop_desc.is_writable_defined = true;
|
||||||
prop_desc.writable = ECMA_PROPERTY_WRITABLE;
|
prop_desc.is_writable = true;
|
||||||
|
|
||||||
prop_desc.is_enumerable_defined = true;
|
prop_desc.is_enumerable_defined = true;
|
||||||
prop_desc.enumerable = ECMA_PROPERTY_NOT_ENUMERABLE;
|
prop_desc.is_enumerable = false;
|
||||||
|
|
||||||
prop_desc.is_configurable_defined = true;
|
prop_desc.is_configurable_defined = true;
|
||||||
prop_desc.configurable = ECMA_PROPERTY_CONFIGURABLE;
|
prop_desc.is_configurable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ecma_string_t *callee_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_CALLEE);
|
ecma_string_t *callee_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_CALLEE);
|
||||||
@@ -243,10 +243,10 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
|
|||||||
prop_desc.set_p = thrower_p;
|
prop_desc.set_p = thrower_p;
|
||||||
|
|
||||||
prop_desc.is_enumerable_defined = true;
|
prop_desc.is_enumerable_defined = true;
|
||||||
prop_desc.enumerable = ECMA_PROPERTY_NOT_ENUMERABLE;
|
prop_desc.is_enumerable = false;
|
||||||
|
|
||||||
prop_desc.is_configurable_defined = true;
|
prop_desc.is_configurable_defined = true;
|
||||||
prop_desc.configurable = ECMA_PROPERTY_NOT_CONFIGURABLE;
|
prop_desc.is_configurable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ecma_string_t *callee_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_CALLEE);
|
ecma_string_t *callee_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_CALLEE);
|
||||||
@@ -283,7 +283,7 @@ ecma_arguments_get_mapped_arg_value (ecma_object_t *map_p, /**< [[ParametersMap]
|
|||||||
JERRY_ASSERT(lex_env_p != NULL
|
JERRY_ASSERT(lex_env_p != NULL
|
||||||
&& ecma_is_lexical_environment (lex_env_p));
|
&& ecma_is_lexical_environment (lex_env_p));
|
||||||
|
|
||||||
ecma_value_t arg_name_prop_value = arg_name_prop_p->u.named_data_property.value;
|
ecma_value_t arg_name_prop_value = ecma_get_named_data_property_value (arg_name_prop_p);
|
||||||
|
|
||||||
ecma_string_t *arg_name_p = ecma_get_string_from_value (arg_name_prop_value);
|
ecma_string_t *arg_name_p = ecma_get_string_from_value (arg_name_prop_value);
|
||||||
|
|
||||||
@@ -367,9 +367,7 @@ ecma_op_arguments_object_get_own_property (ecma_object_t *obj_p, /**< the object
|
|||||||
// a.
|
// a.
|
||||||
ecma_completion_value_t completion = ecma_arguments_get_mapped_arg_value (map_p, mapped_prop_p);
|
ecma_completion_value_t completion = ecma_arguments_get_mapped_arg_value (map_p, mapped_prop_p);
|
||||||
|
|
||||||
ecma_free_value (desc_p->u.named_data_property.value, false);
|
ecma_named_data_property_assign_value (obj_p, desc_p, ecma_get_completion_value_value (completion));
|
||||||
desc_p->u.named_data_property.value = ecma_copy_value (ecma_get_completion_value_value (completion), false);
|
|
||||||
ecma_gc_update_may_ref_younger_object_flag_by_value (obj_p, desc_p->u.named_data_property.value);
|
|
||||||
|
|
||||||
ecma_free_completion_value (completion);
|
ecma_free_completion_value (completion);
|
||||||
}
|
}
|
||||||
@@ -448,7 +446,7 @@ ecma_op_arguments_object_define_own_property (ecma_object_t *obj_p, /**< the obj
|
|||||||
{
|
{
|
||||||
// ii.
|
// ii.
|
||||||
if (property_desc.is_writable_defined
|
if (property_desc.is_writable_defined
|
||||||
&& property_desc.writable == ECMA_PROPERTY_NOT_WRITABLE)
|
&& !property_desc.is_writable)
|
||||||
{
|
{
|
||||||
completion = ecma_op_object_delete (map_p,
|
completion = ecma_op_object_delete (map_p,
|
||||||
property_name_p,
|
property_name_p,
|
||||||
|
|||||||
@@ -134,7 +134,8 @@ ecma_op_general_object_get (ecma_object_t *obj_p, /**< the object */
|
|||||||
// 3.
|
// 3.
|
||||||
if (prop_p->type == ECMA_PROPERTY_NAMEDDATA)
|
if (prop_p->type == ECMA_PROPERTY_NAMEDDATA)
|
||||||
{
|
{
|
||||||
return ecma_make_normal_completion_value (ecma_copy_value (prop_p->u.named_data_property.value, true));
|
return ecma_make_normal_completion_value (ecma_copy_value (ecma_get_named_data_property_value (prop_p),
|
||||||
|
true));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -313,13 +314,13 @@ ecma_op_general_object_put (ecma_object_t *obj_p, /**< the object */
|
|||||||
new_desc.value = value;
|
new_desc.value = value;
|
||||||
|
|
||||||
new_desc.is_writable_defined = true;
|
new_desc.is_writable_defined = true;
|
||||||
new_desc.writable = ECMA_PROPERTY_WRITABLE;
|
new_desc.is_writable = true;
|
||||||
|
|
||||||
new_desc.is_enumerable_defined = true;
|
new_desc.is_enumerable_defined = true;
|
||||||
new_desc.enumerable = ECMA_PROPERTY_ENUMERABLE;
|
new_desc.is_enumerable = true;
|
||||||
|
|
||||||
new_desc.is_configurable_defined = true;
|
new_desc.is_configurable_defined = true;
|
||||||
new_desc.configurable = ECMA_PROPERTY_CONFIGURABLE;
|
new_desc.is_configurable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// b.
|
// b.
|
||||||
@@ -376,7 +377,7 @@ ecma_op_general_object_can_put (ecma_object_t *obj_p, /**< the object */
|
|||||||
|
|
||||||
JERRY_ASSERT(prop_p->type == ECMA_PROPERTY_NAMEDDATA);
|
JERRY_ASSERT(prop_p->type == ECMA_PROPERTY_NAMEDDATA);
|
||||||
|
|
||||||
return (prop_p->u.named_data_property.writable == ECMA_PROPERTY_WRITABLE);
|
return ecma_is_property_writable (prop_p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,7 +426,7 @@ ecma_op_general_object_can_put (ecma_object_t *obj_p, /**< the object */
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// b.
|
// b.
|
||||||
return (inherited_p->u.named_data_property.writable == ECMA_PROPERTY_WRITABLE);
|
return ecma_is_property_writable (inherited_p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -484,19 +485,7 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 3.
|
// 3.
|
||||||
bool is_configurable;
|
if (ecma_is_property_configurable (desc_p))
|
||||||
if (desc_p->type == ECMA_PROPERTY_NAMEDACCESSOR)
|
|
||||||
{
|
|
||||||
is_configurable = desc_p->u.named_accessor_property.configurable;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
JERRY_ASSERT(desc_p->type == ECMA_PROPERTY_NAMEDDATA);
|
|
||||||
|
|
||||||
is_configurable = desc_p->u.named_data_property.configurable;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_configurable)
|
|
||||||
{
|
{
|
||||||
// a.
|
// a.
|
||||||
ecma_delete_property (obj_p, desc_p);
|
ecma_delete_property (obj_p, desc_p);
|
||||||
@@ -661,12 +650,11 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
|||||||
{
|
{
|
||||||
ecma_property_t *new_prop_p = ecma_create_named_data_property (obj_p,
|
ecma_property_t *new_prop_p = ecma_create_named_data_property (obj_p,
|
||||||
property_name_p,
|
property_name_p,
|
||||||
property_desc.writable,
|
property_desc.is_writable,
|
||||||
property_desc.enumerable,
|
property_desc.is_enumerable,
|
||||||
property_desc.configurable);
|
property_desc.is_configurable);
|
||||||
|
|
||||||
new_prop_p->u.named_data_property.value = ecma_copy_value (property_desc.value, false);
|
ecma_named_data_property_assign_value (obj_p, new_prop_p, property_desc.value);
|
||||||
ecma_gc_update_may_ref_younger_object_flag_by_value (obj_p, new_prop_p->u.named_data_property.value);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -677,8 +665,8 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
|||||||
property_name_p,
|
property_name_p,
|
||||||
property_desc.get_p,
|
property_desc.get_p,
|
||||||
property_desc.set_p,
|
property_desc.set_p,
|
||||||
property_desc.enumerable,
|
property_desc.is_enumerable,
|
||||||
property_desc.configurable);
|
property_desc.is_configurable);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -697,13 +685,6 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
|||||||
const bool is_current_data_descriptor = (current_p->type == ECMA_PROPERTY_NAMEDDATA);
|
const bool is_current_data_descriptor = (current_p->type == ECMA_PROPERTY_NAMEDDATA);
|
||||||
const bool is_current_accessor_descriptor = (current_p->type == ECMA_PROPERTY_NAMEDACCESSOR);
|
const bool is_current_accessor_descriptor = (current_p->type == ECMA_PROPERTY_NAMEDACCESSOR);
|
||||||
|
|
||||||
const ecma_property_enumerable_value_t current_enumerable = (ecma_is_property_enumerable (current_p) ?
|
|
||||||
ECMA_PROPERTY_ENUMERABLE :
|
|
||||||
ECMA_PROPERTY_NOT_ENUMERABLE);
|
|
||||||
const ecma_property_configurable_value_t current_configurable = (ecma_is_property_configurable (current_p) ?
|
|
||||||
ECMA_PROPERTY_CONFIGURABLE :
|
|
||||||
ECMA_PROPERTY_NOT_CONFIGURABLE);
|
|
||||||
|
|
||||||
JERRY_ASSERT(is_current_data_descriptor || is_current_accessor_descriptor);
|
JERRY_ASSERT(is_current_data_descriptor || is_current_accessor_descriptor);
|
||||||
|
|
||||||
bool is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = true;
|
bool is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = true;
|
||||||
@@ -711,7 +692,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
|||||||
{
|
{
|
||||||
if (!is_current_data_descriptor
|
if (!is_current_data_descriptor
|
||||||
|| !ecma_op_same_value (property_desc.value,
|
|| !ecma_op_same_value (property_desc.value,
|
||||||
current_p->u.named_data_property.value))
|
ecma_get_named_data_property_value (current_p)))
|
||||||
{
|
{
|
||||||
is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = false;
|
is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = false;
|
||||||
}
|
}
|
||||||
@@ -720,7 +701,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
|||||||
if (property_desc.is_writable_defined)
|
if (property_desc.is_writable_defined)
|
||||||
{
|
{
|
||||||
if (!is_current_data_descriptor
|
if (!is_current_data_descriptor
|
||||||
|| property_desc.writable != current_p->u.named_data_property.writable)
|
|| property_desc.is_writable != ecma_is_property_writable (current_p))
|
||||||
{
|
{
|
||||||
is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = false;
|
is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = false;
|
||||||
}
|
}
|
||||||
@@ -746,7 +727,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
|||||||
|
|
||||||
if (property_desc.is_enumerable_defined)
|
if (property_desc.is_enumerable_defined)
|
||||||
{
|
{
|
||||||
if (property_desc.enumerable != current_enumerable)
|
if (property_desc.is_enumerable != ecma_is_property_enumerable (current_p))
|
||||||
{
|
{
|
||||||
is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = false;
|
is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = false;
|
||||||
}
|
}
|
||||||
@@ -754,7 +735,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
|||||||
|
|
||||||
if (property_desc.is_configurable_defined)
|
if (property_desc.is_configurable_defined)
|
||||||
{
|
{
|
||||||
if (property_desc.configurable != current_configurable)
|
if (property_desc.is_configurable != ecma_is_property_configurable (current_p))
|
||||||
{
|
{
|
||||||
is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = false;
|
is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = false;
|
||||||
}
|
}
|
||||||
@@ -766,11 +747,11 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 7.
|
// 7.
|
||||||
if (current_configurable == ECMA_PROPERTY_NOT_CONFIGURABLE)
|
if (!ecma_is_property_configurable (current_p))
|
||||||
{
|
{
|
||||||
if (property_desc.configurable == ECMA_PROPERTY_CONFIGURABLE
|
if (property_desc.is_configurable
|
||||||
|| (property_desc.is_enumerable_defined
|
|| (property_desc.is_enumerable_defined
|
||||||
&& property_desc.enumerable != current_enumerable))
|
&& property_desc.is_enumerable != ecma_is_property_enumerable (current_p)))
|
||||||
{
|
{
|
||||||
// a., b.
|
// a., b.
|
||||||
return ecma_reject (is_throw);
|
return ecma_reject (is_throw);
|
||||||
@@ -785,7 +766,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
|||||||
else if (is_property_desc_data_descriptor != is_current_data_descriptor)
|
else if (is_property_desc_data_descriptor != is_current_data_descriptor)
|
||||||
{
|
{
|
||||||
// 9.
|
// 9.
|
||||||
if (current_configurable == ECMA_PROPERTY_NOT_CONFIGURABLE)
|
if (!ecma_is_property_configurable (current_p))
|
||||||
{
|
{
|
||||||
// a.
|
// a.
|
||||||
return ecma_reject (is_throw);
|
return ecma_reject (is_throw);
|
||||||
@@ -801,8 +782,8 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
|||||||
property_name_p,
|
property_name_p,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
current_enumerable,
|
ecma_is_property_enumerable (current_p),
|
||||||
current_configurable);
|
ecma_is_property_configurable (current_p));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -810,21 +791,21 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
|||||||
|
|
||||||
current_p = ecma_create_named_data_property (obj_p,
|
current_p = ecma_create_named_data_property (obj_p,
|
||||||
property_name_p,
|
property_name_p,
|
||||||
ECMA_PROPERTY_NOT_WRITABLE,
|
false,
|
||||||
current_enumerable,
|
ecma_is_property_enumerable (current_p),
|
||||||
current_configurable);
|
ecma_is_property_configurable (current_p));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (is_property_desc_data_descriptor && is_current_data_descriptor)
|
else if (is_property_desc_data_descriptor && is_current_data_descriptor)
|
||||||
{
|
{
|
||||||
// 10.
|
// 10.
|
||||||
if (current_configurable == ECMA_PROPERTY_NOT_CONFIGURABLE)
|
if (!ecma_is_property_configurable (current_p))
|
||||||
{
|
{
|
||||||
// a.
|
// a.
|
||||||
if (current_p->u.named_data_property.writable == ECMA_PROPERTY_NOT_WRITABLE)
|
if (!ecma_is_property_writable (current_p))
|
||||||
{
|
{
|
||||||
// i.
|
// i.
|
||||||
if (property_desc.writable == ECMA_PROPERTY_WRITABLE)
|
if (property_desc.is_writable)
|
||||||
{
|
{
|
||||||
return ecma_reject (is_throw);
|
return ecma_reject (is_throw);
|
||||||
}
|
}
|
||||||
@@ -832,7 +813,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
|||||||
// ii.
|
// ii.
|
||||||
if (property_desc.is_value_defined
|
if (property_desc.is_value_defined
|
||||||
&& !ecma_op_same_value (property_desc.value,
|
&& !ecma_op_same_value (property_desc.value,
|
||||||
current_p->u.named_data_property.value))
|
ecma_get_named_data_property_value (current_p)))
|
||||||
{
|
{
|
||||||
return ecma_reject (is_throw);
|
return ecma_reject (is_throw);
|
||||||
}
|
}
|
||||||
@@ -845,7 +826,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
|||||||
|
|
||||||
// 11.
|
// 11.
|
||||||
|
|
||||||
if (current_configurable == ECMA_PROPERTY_NOT_CONFIGURABLE)
|
if (!ecma_is_property_configurable (current_p))
|
||||||
{
|
{
|
||||||
// a.
|
// a.
|
||||||
|
|
||||||
@@ -865,16 +846,14 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
|||||||
{
|
{
|
||||||
JERRY_ASSERT(is_current_data_descriptor);
|
JERRY_ASSERT(is_current_data_descriptor);
|
||||||
|
|
||||||
ecma_free_value (current_p->u.named_data_property.value, false);
|
ecma_named_data_property_assign_value (obj_p, current_p, property_desc.value);
|
||||||
current_p->u.named_data_property.value = ecma_copy_value (property_desc.value, false);
|
|
||||||
ecma_gc_update_may_ref_younger_object_flag_by_value (obj_p, current_p->u.named_data_property.value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property_desc.is_writable_defined)
|
if (property_desc.is_writable_defined)
|
||||||
{
|
{
|
||||||
JERRY_ASSERT(is_current_data_descriptor);
|
JERRY_ASSERT(is_current_data_descriptor);
|
||||||
|
|
||||||
current_p->u.named_data_property.writable = property_desc.writable;
|
ecma_set_property_writable_attr (current_p, property_desc.is_writable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property_desc.is_get_defined)
|
if (property_desc.is_get_defined)
|
||||||
@@ -895,26 +874,12 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec
|
|||||||
|
|
||||||
if (property_desc.is_enumerable_defined)
|
if (property_desc.is_enumerable_defined)
|
||||||
{
|
{
|
||||||
if (is_current_data_descriptor)
|
ecma_set_property_enumerable_attr (current_p, property_desc.is_enumerable);
|
||||||
{
|
|
||||||
current_p->u.named_data_property.enumerable = property_desc.enumerable;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
current_p->u.named_accessor_property.enumerable = property_desc.enumerable;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property_desc.is_configurable_defined)
|
if (property_desc.is_configurable_defined)
|
||||||
{
|
{
|
||||||
if (is_current_data_descriptor)
|
ecma_set_property_configurable_attr (current_p, property_desc.is_configurable);
|
||||||
{
|
|
||||||
current_p->u.named_data_property.configurable = property_desc.configurable;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
current_p->u.named_accessor_property.configurable = property_desc.configurable;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||||
|
|||||||
@@ -99,12 +99,10 @@ ecma_op_create_string_object (ecma_value_t *arguments_list_p, /**< list of argum
|
|||||||
ecma_string_t *length_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_LENGTH);
|
ecma_string_t *length_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_LENGTH);
|
||||||
ecma_property_t *length_prop_p = ecma_create_named_data_property (obj_p,
|
ecma_property_t *length_prop_p = ecma_create_named_data_property (obj_p,
|
||||||
length_magic_string_p,
|
length_magic_string_p,
|
||||||
false,
|
false, false, false);
|
||||||
false,
|
|
||||||
false);
|
|
||||||
ecma_number_t *length_prop_value_p = ecma_alloc_number ();
|
ecma_number_t *length_prop_value_p = ecma_alloc_number ();
|
||||||
*length_prop_value_p = length_value;
|
*length_prop_value_p = length_value;
|
||||||
length_prop_p->u.named_data_property.value = ecma_make_number_value (length_prop_value_p);
|
ecma_set_named_data_property_value (length_prop_p, ecma_make_number_value (length_prop_value_p));
|
||||||
ecma_deref_ecma_string (length_magic_string_p);
|
ecma_deref_ecma_string (length_magic_string_p);
|
||||||
|
|
||||||
return ecma_make_normal_completion_value (ecma_make_object_value (obj_p));
|
return ecma_make_normal_completion_value (ecma_make_object_value (obj_p));
|
||||||
@@ -188,16 +186,15 @@ ecma_op_string_object_get_own_property (ecma_object_t *obj_p, /**< the array obj
|
|||||||
ecma_char_t c = ecma_string_get_char_at_pos (prim_value_str_p, uint32_index);
|
ecma_char_t c = ecma_string_get_char_at_pos (prim_value_str_p, uint32_index);
|
||||||
|
|
||||||
// 9.
|
// 9.
|
||||||
new_prop_p = ecma_create_named_data_property (obj_p,
|
|
||||||
new_prop_name_p,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
false);
|
|
||||||
|
|
||||||
ecma_char_t new_prop_zt_str_p [2] = { c, ECMA_CHAR_NULL };
|
ecma_char_t new_prop_zt_str_p [2] = { c, ECMA_CHAR_NULL };
|
||||||
ecma_string_t *new_prop_str_value_p = ecma_new_ecma_string (new_prop_zt_str_p);
|
ecma_string_t *new_prop_str_value_p = ecma_new_ecma_string (new_prop_zt_str_p);
|
||||||
ecma_value_t new_prop_str_value = ecma_make_string_value (new_prop_str_value_p);
|
|
||||||
new_prop_p->u.named_data_property.value = new_prop_str_value;
|
new_prop_p = ecma_create_named_data_property (obj_p,
|
||||||
|
new_prop_name_p,
|
||||||
|
false, true, false);
|
||||||
|
|
||||||
|
ecma_set_named_data_property_value (new_prop_p,
|
||||||
|
ecma_make_string_value (new_prop_str_value_p));
|
||||||
}
|
}
|
||||||
|
|
||||||
ecma_deref_ecma_string (new_prop_name_p);
|
ecma_deref_ecma_string (new_prop_name_p);
|
||||||
|
|||||||
Reference in New Issue
Block a user