Passing less number of arguments to a function is generally faster. So
the three boolean arguments of ecma_create_named_data_property and the two boolean arguments of ecma_create_named_accessor_property are combined into one uint8_t argument. On ARM-32 it is preferred to have less than four arguments, since these arguments can be passed in registers. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -291,6 +291,29 @@ typedef enum
|
||||
ECMA_PROPERTY_FLAG_LCACHED = 1u << (ECMA_PROPERTY_FLAG_SHIFT + 3), /**< property is lcached */
|
||||
} ecma_property_flags_t;
|
||||
|
||||
/**
|
||||
* Property flags configurable, enumerable, writable.
|
||||
*/
|
||||
#define ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE \
|
||||
(ECMA_PROPERTY_FLAG_CONFIGURABLE | ECMA_PROPERTY_FLAG_ENUMERABLE | ECMA_PROPERTY_FLAG_WRITABLE)
|
||||
|
||||
/**
|
||||
* Property flags configurable, enumerable.
|
||||
*/
|
||||
#define ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE \
|
||||
(ECMA_PROPERTY_FLAG_CONFIGURABLE | ECMA_PROPERTY_FLAG_ENUMERABLE)
|
||||
|
||||
/**
|
||||
* Property flags configurable, enumerable.
|
||||
*/
|
||||
#define ECMA_PROPERTY_CONFIGURABLE_WRITABLE \
|
||||
(ECMA_PROPERTY_FLAG_CONFIGURABLE | ECMA_PROPERTY_FLAG_WRITABLE)
|
||||
|
||||
/**
|
||||
* No attributes can be changed for this property.
|
||||
*/
|
||||
#define ECMA_PROPERTY_FIXED 0
|
||||
|
||||
/**
|
||||
* Abstract property representation.
|
||||
*
|
||||
|
||||
@@ -576,26 +576,13 @@ ecma_get_internal_property (ecma_object_t *object_p, /**< object descriptor */
|
||||
ecma_property_t *
|
||||
ecma_create_named_data_property (ecma_object_t *object_p, /**< object */
|
||||
ecma_string_t *name_p, /**< property name */
|
||||
bool is_writable, /**< 'Writable' attribute */
|
||||
bool is_enumerable, /**< 'Enumerable' attribute */
|
||||
bool is_configurable) /**< 'Configurable' attribute */
|
||||
uint8_t prop_attributes) /**< property attributes (See: ecma_property_flags_t) */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL && name_p != NULL);
|
||||
JERRY_ASSERT (ecma_find_named_property (object_p, name_p) == NULL);
|
||||
JERRY_ASSERT ((prop_attributes & ~ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) == 0);
|
||||
|
||||
uint8_t type_and_flags = ECMA_PROPERTY_TYPE_NAMEDDATA;
|
||||
if (is_configurable)
|
||||
{
|
||||
type_and_flags = (uint8_t) (type_and_flags | ECMA_PROPERTY_FLAG_CONFIGURABLE);
|
||||
}
|
||||
if (is_enumerable)
|
||||
{
|
||||
type_and_flags = (uint8_t) (type_and_flags | ECMA_PROPERTY_FLAG_ENUMERABLE);
|
||||
}
|
||||
if (is_writable)
|
||||
{
|
||||
type_and_flags = (uint8_t) (type_and_flags | ECMA_PROPERTY_FLAG_WRITABLE);
|
||||
}
|
||||
uint8_t type_and_flags = ECMA_PROPERTY_TYPE_NAMEDDATA | prop_attributes;
|
||||
|
||||
name_p = ecma_copy_or_ref_ecma_string (name_p);
|
||||
|
||||
@@ -617,21 +604,13 @@ ecma_create_named_accessor_property (ecma_object_t *object_p, /**< object */
|
||||
ecma_string_t *name_p, /**< property name */
|
||||
ecma_object_t *get_p, /**< getter */
|
||||
ecma_object_t *set_p, /**< setter */
|
||||
bool is_enumerable, /**< 'enumerable' attribute */
|
||||
bool is_configurable) /**< 'configurable' attribute */
|
||||
uint8_t prop_attributes) /**< property attributes */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL && name_p != NULL);
|
||||
JERRY_ASSERT (ecma_find_named_property (object_p, name_p) == NULL);
|
||||
JERRY_ASSERT ((prop_attributes & ~ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE) == 0);
|
||||
|
||||
uint8_t type_and_flags = ECMA_PROPERTY_TYPE_NAMEDACCESSOR;
|
||||
if (is_configurable)
|
||||
{
|
||||
type_and_flags = (uint8_t) (type_and_flags | ECMA_PROPERTY_FLAG_CONFIGURABLE);
|
||||
}
|
||||
if (is_enumerable)
|
||||
{
|
||||
type_and_flags = (uint8_t) (type_and_flags | ECMA_PROPERTY_FLAG_ENUMERABLE);
|
||||
}
|
||||
uint8_t type_and_flags = ECMA_PROPERTY_TYPE_NAMEDACCESSOR | prop_attributes;
|
||||
|
||||
name_p = ecma_copy_or_ref_ecma_string (name_p);
|
||||
|
||||
|
||||
@@ -263,9 +263,9 @@ extern ecma_property_t *ecma_find_internal_property (ecma_object_t *, ecma_inter
|
||||
extern ecma_property_t *ecma_get_internal_property (ecma_object_t *, ecma_internal_property_id_t);
|
||||
|
||||
extern ecma_property_t *
|
||||
ecma_create_named_data_property (ecma_object_t *, ecma_string_t *, bool, bool, bool);
|
||||
ecma_create_named_data_property (ecma_object_t *, ecma_string_t *, uint8_t);
|
||||
extern ecma_property_t *
|
||||
ecma_create_named_accessor_property (ecma_object_t *, ecma_string_t *, ecma_object_t *, ecma_object_t *, bool, bool);
|
||||
ecma_create_named_accessor_property (ecma_object_t *, ecma_string_t *, ecma_object_t *, ecma_object_t *, uint8_t);
|
||||
extern ecma_property_t *
|
||||
ecma_find_named_property (ecma_object_t *, ecma_string_t *);
|
||||
extern ecma_property_t *
|
||||
|
||||
Reference in New Issue
Block a user