Making built-ins' property numbers to be stored as static const instead of extern const.
This commit is contained in:
@@ -70,8 +70,8 @@ static const ecma_magic_string_id_t ecma_builtin_array_property_names[] =
|
||||
/**
|
||||
* Number of the Array object's built-in properties
|
||||
*/
|
||||
const ecma_length_t ecma_builtin_array_property_number = (sizeof (ecma_builtin_array_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
static const ecma_length_t ecma_builtin_array_property_number = (sizeof (ecma_builtin_array_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
|
||||
/**
|
||||
* The Array object's 'isArray' routine
|
||||
@@ -150,15 +150,21 @@ ecma_builtin_array_try_to_instantiate_property (ecma_object_t *obj_p, /**< objec
|
||||
bit = (uint32_t) 1u << index;
|
||||
}
|
||||
|
||||
ecma_property_t *mask_prop_p = ecma_get_internal_property (obj_p, mask_prop_id);
|
||||
ecma_property_t *mask_prop_p = ecma_find_internal_property (obj_p, mask_prop_id);
|
||||
if (mask_prop_p == NULL)
|
||||
{
|
||||
mask_prop_p = ecma_create_internal_property (obj_p, mask_prop_id);
|
||||
mask_prop_p->u.internal_property.value = 0;
|
||||
}
|
||||
|
||||
uint32_t bit_mask = mask_prop_p->u.internal_property.value;
|
||||
|
||||
if (!(bit_mask & bit))
|
||||
if (bit_mask & bit)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bit_mask &= ~bit;
|
||||
bit_mask |= bit;
|
||||
|
||||
mask_prop_p->u.internal_property.value = bit_mask;
|
||||
|
||||
|
||||
@@ -74,8 +74,8 @@ static const ecma_magic_string_id_t ecma_builtin_property_names[] =
|
||||
/**
|
||||
* Number of the Array.prototype object's built-in properties
|
||||
*/
|
||||
const ecma_length_t ecma_builtin_array_prototype_property_number = (sizeof (ecma_builtin_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
static const ecma_length_t ecma_builtin_array_prototype_property_number = (sizeof (ecma_builtin_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
|
||||
/**
|
||||
* The Array.prototype object's 'toString' routine
|
||||
@@ -139,15 +139,21 @@ ecma_builtin_array_prototype_try_to_instantiate_property (ecma_object_t *obj_p,
|
||||
bit = (uint32_t) 1u << index;
|
||||
}
|
||||
|
||||
ecma_property_t *mask_prop_p = ecma_get_internal_property (obj_p, mask_prop_id);
|
||||
ecma_property_t *mask_prop_p = ecma_find_internal_property (obj_p, mask_prop_id);
|
||||
if (mask_prop_p == NULL)
|
||||
{
|
||||
mask_prop_p = ecma_create_internal_property (obj_p, mask_prop_id);
|
||||
mask_prop_p->u.internal_property.value = 0;
|
||||
}
|
||||
|
||||
uint32_t bit_mask = mask_prop_p->u.internal_property.value;
|
||||
|
||||
if (!(bit_mask & bit))
|
||||
if (bit_mask & bit)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bit_mask &= ~bit;
|
||||
bit_mask |= bit;
|
||||
|
||||
mask_prop_p->u.internal_property.value = bit_mask;
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ static const ecma_magic_string_id_t ecma_builtin_boolean_property_names[] =
|
||||
/**
|
||||
* Number of the Boolean object's built-in properties
|
||||
*/
|
||||
const ecma_length_t ecma_builtin_boolean_property_number = (sizeof (ecma_builtin_boolean_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
static const ecma_length_t ecma_builtin_boolean_property_number = (sizeof (ecma_builtin_boolean_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
|
||||
/**
|
||||
* If the property's name is one of built-in properties of the Boolean object
|
||||
@@ -113,15 +113,21 @@ ecma_builtin_boolean_try_to_instantiate_property (ecma_object_t *obj_p, /**< obj
|
||||
bit = (uint32_t) 1u << index;
|
||||
}
|
||||
|
||||
ecma_property_t *mask_prop_p = ecma_get_internal_property (obj_p, mask_prop_id);
|
||||
ecma_property_t *mask_prop_p = ecma_find_internal_property (obj_p, mask_prop_id);
|
||||
if (mask_prop_p == NULL)
|
||||
{
|
||||
mask_prop_p = ecma_create_internal_property (obj_p, mask_prop_id);
|
||||
mask_prop_p->u.internal_property.value = 0;
|
||||
}
|
||||
|
||||
uint32_t bit_mask = mask_prop_p->u.internal_property.value;
|
||||
|
||||
if (!(bit_mask & bit))
|
||||
if (bit_mask & bit)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bit_mask &= ~bit;
|
||||
bit_mask |= bit;
|
||||
|
||||
mask_prop_p->u.internal_property.value = bit_mask;
|
||||
|
||||
|
||||
@@ -81,8 +81,8 @@ static const ecma_magic_string_id_t ecma_builtin_property_names[] =
|
||||
/**
|
||||
* Boolean of the Boolean.prototype object's built-in properties
|
||||
*/
|
||||
const ecma_length_t ecma_builtin_boolean_prototype_property_number = (sizeof (ecma_builtin_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
static const ecma_length_t ecma_builtin_boolean_prototype_property_number = (sizeof (ecma_builtin_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
|
||||
/**
|
||||
* The Boolean.prototype object's 'toString' routine
|
||||
@@ -211,15 +211,21 @@ ecma_builtin_boolean_prototype_try_to_instantiate_property (ecma_object_t *obj_p
|
||||
bit = (uint32_t) 1u << index;
|
||||
}
|
||||
|
||||
ecma_property_t *mask_prop_p = ecma_get_internal_property (obj_p, mask_prop_id);
|
||||
ecma_property_t *mask_prop_p = ecma_find_internal_property (obj_p, mask_prop_id);
|
||||
if (mask_prop_p == NULL)
|
||||
{
|
||||
mask_prop_p = ecma_create_internal_property (obj_p, mask_prop_id);
|
||||
mask_prop_p->u.internal_property.value = 0;
|
||||
}
|
||||
|
||||
uint32_t bit_mask = mask_prop_p->u.internal_property.value;
|
||||
|
||||
if (!(bit_mask & bit))
|
||||
if (bit_mask & bit)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bit_mask &= ~bit;
|
||||
bit_mask |= bit;
|
||||
|
||||
mask_prop_p->u.internal_property.value = bit_mask;
|
||||
|
||||
|
||||
@@ -62,8 +62,8 @@ static const ecma_magic_string_id_t ecma_builtin_function_property_names[] =
|
||||
/**
|
||||
* Number of the Function object's built-in properties
|
||||
*/
|
||||
const ecma_length_t ecma_builtin_function_property_number = (sizeof (ecma_builtin_function_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
static const ecma_length_t ecma_builtin_function_property_number = (sizeof (ecma_builtin_function_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
|
||||
/**
|
||||
* If the property's name is one of built-in properties of the Function object
|
||||
@@ -112,15 +112,21 @@ ecma_builtin_function_try_to_instantiate_property (ecma_object_t *obj_p, /**< ob
|
||||
bit = (uint32_t) 1u << index;
|
||||
}
|
||||
|
||||
ecma_property_t *mask_prop_p = ecma_get_internal_property (obj_p, mask_prop_id);
|
||||
ecma_property_t *mask_prop_p = ecma_find_internal_property (obj_p, mask_prop_id);
|
||||
if (mask_prop_p == NULL)
|
||||
{
|
||||
mask_prop_p = ecma_create_internal_property (obj_p, mask_prop_id);
|
||||
mask_prop_p->u.internal_property.value = 0;
|
||||
}
|
||||
|
||||
uint32_t bit_mask = mask_prop_p->u.internal_property.value;
|
||||
|
||||
if (!(bit_mask & bit))
|
||||
if (bit_mask & bit)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bit_mask &= ~bit;
|
||||
bit_mask |= bit;
|
||||
|
||||
mask_prop_p->u.internal_property.value = bit_mask;
|
||||
|
||||
|
||||
@@ -82,8 +82,8 @@ static const ecma_magic_string_id_t ecma_builtin_property_names[] =
|
||||
/**
|
||||
* Number of the Function.prototype object's built-in properties
|
||||
*/
|
||||
const ecma_length_t ecma_builtin_function_prototype_property_number = (sizeof (ecma_builtin_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
static const ecma_length_t ecma_builtin_function_prototype_property_number = (sizeof (ecma_builtin_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
|
||||
/**
|
||||
* The Function.prototype object's 'toString' routine
|
||||
@@ -226,15 +226,21 @@ ecma_builtin_function_prototype_try_to_instantiate_property (ecma_object_t *obj_
|
||||
bit = (uint32_t) 1u << index;
|
||||
}
|
||||
|
||||
ecma_property_t *mask_prop_p = ecma_get_internal_property (obj_p, mask_prop_id);
|
||||
ecma_property_t *mask_prop_p = ecma_find_internal_property (obj_p, mask_prop_id);
|
||||
if (mask_prop_p == NULL)
|
||||
{
|
||||
mask_prop_p = ecma_create_internal_property (obj_p, mask_prop_id);
|
||||
mask_prop_p->u.internal_property.value = 0;
|
||||
}
|
||||
|
||||
uint32_t bit_mask = mask_prop_p->u.internal_property.value;
|
||||
|
||||
if (!(bit_mask & bit))
|
||||
if (bit_mask & bit)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bit_mask &= ~bit;
|
||||
bit_mask |= bit;
|
||||
|
||||
mask_prop_p->u.internal_property.value = bit_mask;
|
||||
|
||||
|
||||
@@ -77,8 +77,8 @@ static const ecma_magic_string_id_t ecma_builtin_global_property_names[] =
|
||||
/**
|
||||
* Number of the Global object's built-in properties
|
||||
*/
|
||||
const ecma_length_t ecma_builtin_global_property_number = (sizeof (ecma_builtin_global_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
static const ecma_length_t ecma_builtin_global_property_number = (sizeof (ecma_builtin_global_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
JERRY_STATIC_ASSERT (sizeof (ecma_builtin_global_property_names) > sizeof (void*));
|
||||
|
||||
/**
|
||||
@@ -400,21 +400,26 @@ ecma_builtin_global_try_to_instantiate_property (ecma_object_t *obj_p, /**< obje
|
||||
|
||||
JERRY_ASSERT (index >= 0 && (uint32_t) index < sizeof (uint32_t) * JERRY_BITSINBYTE);
|
||||
|
||||
ecma_internal_property_id_t mask_prop_id = ECMA_INTERNAL_PROPERTY_NON_INSTANTIATED_BUILT_IN_MASK_0_31;
|
||||
uint32_t bit = (uint32_t) 1u << index;
|
||||
|
||||
ecma_property_t *mask_0_31_prop_p;
|
||||
mask_0_31_prop_p = ecma_get_internal_property (obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_NON_INSTANTIATED_BUILT_IN_MASK_0_31);
|
||||
uint32_t bit_mask = mask_0_31_prop_p->u.internal_property.value;
|
||||
ecma_property_t *mask_prop_p = ecma_find_internal_property (obj_p, mask_prop_id);
|
||||
if (mask_prop_p == NULL)
|
||||
{
|
||||
mask_prop_p = ecma_create_internal_property (obj_p, mask_prop_id);
|
||||
mask_prop_p->u.internal_property.value = 0;
|
||||
}
|
||||
|
||||
if (!(bit_mask & bit))
|
||||
uint32_t bit_mask = mask_prop_p->u.internal_property.value;
|
||||
|
||||
if (bit_mask & bit)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bit_mask &= ~bit;
|
||||
bit_mask |= bit;
|
||||
|
||||
mask_0_31_prop_p->u.internal_property.value = bit_mask;
|
||||
mask_prop_p->u.internal_property.value = bit_mask;
|
||||
|
||||
ecma_value_t value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
|
||||
ecma_property_writable_value_t writable = ECMA_PROPERTY_WRITABLE;
|
||||
|
||||
@@ -146,8 +146,8 @@ static const ecma_magic_string_id_t ecma_builtin_math_property_names[] =
|
||||
/**
|
||||
* Number of the Math object's built-in properties
|
||||
*/
|
||||
const ecma_length_t ecma_builtin_math_property_number = (sizeof (ecma_builtin_math_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
static const ecma_length_t ecma_builtin_math_property_number = (sizeof (ecma_builtin_math_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
JERRY_STATIC_ASSERT (sizeof (ecma_builtin_math_property_names) > sizeof (void*));
|
||||
|
||||
/**
|
||||
@@ -1044,15 +1044,21 @@ ecma_builtin_math_try_to_instantiate_property (ecma_object_t *obj_p, /**< object
|
||||
bit = (uint32_t) 1u << index;
|
||||
}
|
||||
|
||||
ecma_property_t *mask_prop_p = ecma_get_internal_property (obj_p, mask_prop_id);
|
||||
ecma_property_t *mask_prop_p = ecma_find_internal_property (obj_p, mask_prop_id);
|
||||
if (mask_prop_p == NULL)
|
||||
{
|
||||
mask_prop_p = ecma_create_internal_property (obj_p, mask_prop_id);
|
||||
mask_prop_p->u.internal_property.value = 0;
|
||||
}
|
||||
|
||||
uint32_t bit_mask = mask_prop_p->u.internal_property.value;
|
||||
|
||||
if (!(bit_mask & bit))
|
||||
if (bit_mask & bit)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bit_mask &= ~bit;
|
||||
bit_mask |= bit;
|
||||
|
||||
mask_prop_p->u.internal_property.value = bit_mask;
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@ static const ecma_magic_string_id_t ecma_builtin_number_property_names[] =
|
||||
/**
|
||||
* Number of the Number object's built-in properties
|
||||
*/
|
||||
const ecma_length_t ecma_builtin_number_property_number = (sizeof (ecma_builtin_number_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
static const ecma_length_t ecma_builtin_number_property_number = (sizeof (ecma_builtin_number_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
|
||||
/**
|
||||
* If the property's name is one of built-in properties of the Number object
|
||||
@@ -118,15 +118,21 @@ ecma_builtin_number_try_to_instantiate_property (ecma_object_t *obj_p, /**< obje
|
||||
bit = (uint32_t) 1u << index;
|
||||
}
|
||||
|
||||
ecma_property_t *mask_prop_p = ecma_get_internal_property (obj_p, mask_prop_id);
|
||||
ecma_property_t *mask_prop_p = ecma_find_internal_property (obj_p, mask_prop_id);
|
||||
if (mask_prop_p == NULL)
|
||||
{
|
||||
mask_prop_p = ecma_create_internal_property (obj_p, mask_prop_id);
|
||||
mask_prop_p->u.internal_property.value = 0;
|
||||
}
|
||||
|
||||
uint32_t bit_mask = mask_prop_p->u.internal_property.value;
|
||||
|
||||
if (!(bit_mask & bit))
|
||||
if (bit_mask & bit)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bit_mask &= ~bit;
|
||||
bit_mask |= bit;
|
||||
|
||||
mask_prop_p->u.internal_property.value = bit_mask;
|
||||
|
||||
|
||||
@@ -90,8 +90,8 @@ static const ecma_magic_string_id_t ecma_builtin_property_names[] =
|
||||
/**
|
||||
* Number of the Number.prototype object's built-in properties
|
||||
*/
|
||||
const ecma_length_t ecma_builtin_number_prototype_property_number = (sizeof (ecma_builtin_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
static const ecma_length_t ecma_builtin_number_prototype_property_number = (sizeof (ecma_builtin_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
|
||||
/**
|
||||
* The Number.prototype object's 'toString' routine
|
||||
@@ -299,15 +299,21 @@ ecma_builtin_number_prototype_try_to_instantiate_property (ecma_object_t *obj_p,
|
||||
bit = (uint32_t) 1u << index;
|
||||
}
|
||||
|
||||
ecma_property_t *mask_prop_p = ecma_get_internal_property (obj_p, mask_prop_id);
|
||||
ecma_property_t *mask_prop_p = ecma_find_internal_property (obj_p, mask_prop_id);
|
||||
if (mask_prop_p == NULL)
|
||||
{
|
||||
mask_prop_p = ecma_create_internal_property (obj_p, mask_prop_id);
|
||||
mask_prop_p->u.internal_property.value = 0;
|
||||
}
|
||||
|
||||
uint32_t bit_mask = mask_prop_p->u.internal_property.value;
|
||||
|
||||
if (!(bit_mask & bit))
|
||||
if (bit_mask & bit)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bit_mask &= ~bit;
|
||||
bit_mask |= bit;
|
||||
|
||||
mask_prop_p->u.internal_property.value = bit_mask;
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ static const ecma_magic_string_id_t ecma_builtin_object_property_names[] =
|
||||
/**
|
||||
* Number of the Object object's built-in properties
|
||||
*/
|
||||
const ecma_length_t ecma_builtin_object_property_number = (sizeof (ecma_builtin_object_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
static const ecma_length_t ecma_builtin_object_property_number = (sizeof (ecma_builtin_object_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
JERRY_STATIC_ASSERT (sizeof (ecma_builtin_object_property_names) > sizeof (void*));
|
||||
|
||||
/**
|
||||
@@ -559,21 +559,26 @@ ecma_builtin_object_try_to_instantiate_property (ecma_object_t *obj_p, /**< obje
|
||||
|
||||
JERRY_ASSERT (index >= 0 && (uint32_t) index < sizeof (uint32_t) * JERRY_BITSINBYTE);
|
||||
|
||||
ecma_internal_property_id_t mask_prop_id = ECMA_INTERNAL_PROPERTY_NON_INSTANTIATED_BUILT_IN_MASK_0_31;
|
||||
uint32_t bit = (uint32_t) 1u << index;
|
||||
|
||||
ecma_property_t *mask_0_31_prop_p;
|
||||
mask_0_31_prop_p = ecma_get_internal_property (obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_NON_INSTANTIATED_BUILT_IN_MASK_0_31);
|
||||
uint32_t bit_mask = mask_0_31_prop_p->u.internal_property.value;
|
||||
ecma_property_t *mask_prop_p = ecma_find_internal_property (obj_p, mask_prop_id);
|
||||
if (mask_prop_p == NULL)
|
||||
{
|
||||
mask_prop_p = ecma_create_internal_property (obj_p, mask_prop_id);
|
||||
mask_prop_p->u.internal_property.value = 0;
|
||||
}
|
||||
|
||||
if (!(bit_mask & bit))
|
||||
uint32_t bit_mask = mask_prop_p->u.internal_property.value;
|
||||
|
||||
if (bit_mask & bit)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bit_mask &= ~bit;
|
||||
bit_mask |= bit;
|
||||
|
||||
mask_0_31_prop_p->u.internal_property.value = bit_mask;
|
||||
mask_prop_p->u.internal_property.value = bit_mask;
|
||||
|
||||
ecma_value_t value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
|
||||
ecma_property_writable_value_t writable = ECMA_PROPERTY_WRITABLE;
|
||||
|
||||
@@ -90,8 +90,8 @@ static const ecma_magic_string_id_t ecma_builtin_property_names[] =
|
||||
/**
|
||||
* Number of the Object.prototype object's built-in properties
|
||||
*/
|
||||
const ecma_length_t ecma_builtin_object_prototype_property_number = (sizeof (ecma_builtin_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
static const ecma_length_t ecma_builtin_object_prototype_property_number = (sizeof (ecma_builtin_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
|
||||
/**
|
||||
* The Object.prototype object's 'toString' routine
|
||||
@@ -302,15 +302,21 @@ ecma_builtin_object_prototype_try_to_instantiate_property (ecma_object_t *obj_p,
|
||||
bit = (uint32_t) 1u << index;
|
||||
}
|
||||
|
||||
ecma_property_t *mask_prop_p = ecma_get_internal_property (obj_p, mask_prop_id);
|
||||
ecma_property_t *mask_prop_p = ecma_find_internal_property (obj_p, mask_prop_id);
|
||||
if (mask_prop_p == NULL)
|
||||
{
|
||||
mask_prop_p = ecma_create_internal_property (obj_p, mask_prop_id);
|
||||
mask_prop_p->u.internal_property.value = 0;
|
||||
}
|
||||
|
||||
uint32_t bit_mask = mask_prop_p->u.internal_property.value;
|
||||
|
||||
if (!(bit_mask & bit))
|
||||
if (bit_mask & bit)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bit_mask &= ~bit;
|
||||
bit_mask |= bit;
|
||||
|
||||
mask_prop_p->u.internal_property.value = bit_mask;
|
||||
|
||||
|
||||
@@ -70,8 +70,8 @@ static const ecma_magic_string_id_t ecma_builtin_string_property_names[] =
|
||||
/**
|
||||
* Number of the String object's built-in properties
|
||||
*/
|
||||
const ecma_length_t ecma_builtin_string_property_number = (sizeof (ecma_builtin_string_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
static const ecma_length_t ecma_builtin_string_property_number = (sizeof (ecma_builtin_string_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
|
||||
/**
|
||||
* The String object's 'fromCharCode' routine
|
||||
@@ -187,15 +187,21 @@ ecma_builtin_string_try_to_instantiate_property (ecma_object_t *obj_p, /**< obje
|
||||
bit = (uint32_t) 1u << index;
|
||||
}
|
||||
|
||||
ecma_property_t *mask_prop_p = ecma_get_internal_property (obj_p, mask_prop_id);
|
||||
ecma_property_t *mask_prop_p = ecma_find_internal_property (obj_p, mask_prop_id);
|
||||
if (mask_prop_p == NULL)
|
||||
{
|
||||
mask_prop_p = ecma_create_internal_property (obj_p, mask_prop_id);
|
||||
mask_prop_p->u.internal_property.value = 0;
|
||||
}
|
||||
|
||||
uint32_t bit_mask = mask_prop_p->u.internal_property.value;
|
||||
|
||||
if (!(bit_mask & bit))
|
||||
if (bit_mask & bit)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bit_mask &= ~bit;
|
||||
bit_mask |= bit;
|
||||
|
||||
mask_prop_p->u.internal_property.value = bit_mask;
|
||||
|
||||
|
||||
@@ -142,8 +142,8 @@ static const ecma_magic_string_id_t ecma_builtin_property_names[] =
|
||||
/**
|
||||
* Number of the String.prototype object's built-in properties
|
||||
*/
|
||||
const ecma_length_t ecma_builtin_string_prototype_property_number = (sizeof (ecma_builtin_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
static const ecma_length_t ecma_builtin_string_prototype_property_number = (sizeof (ecma_builtin_property_names) /
|
||||
sizeof (ecma_magic_string_id_t));
|
||||
|
||||
/**
|
||||
* The String.prototype object's 'toString' routine
|
||||
@@ -519,15 +519,21 @@ ecma_builtin_string_prototype_try_to_instantiate_property (ecma_object_t *obj_p,
|
||||
bit = (uint32_t) 1u << index;
|
||||
}
|
||||
|
||||
ecma_property_t *mask_prop_p = ecma_get_internal_property (obj_p, mask_prop_id);
|
||||
ecma_property_t *mask_prop_p = ecma_find_internal_property (obj_p, mask_prop_id);
|
||||
if (mask_prop_p == NULL)
|
||||
{
|
||||
mask_prop_p = ecma_create_internal_property (obj_p, mask_prop_id);
|
||||
mask_prop_p->u.internal_property.value = 0;
|
||||
}
|
||||
|
||||
uint32_t bit_mask = mask_prop_p->u.internal_property.value;
|
||||
|
||||
if (!(bit_mask & bit))
|
||||
if (bit_mask & bit)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bit_mask &= ~bit;
|
||||
bit_mask |= bit;
|
||||
|
||||
mask_prop_p->u.internal_property.value = bit_mask;
|
||||
|
||||
|
||||
@@ -156,14 +156,7 @@ ecma_builtin_ ## lowercase_name ## _dispatch_routine (ecma_magic_string_id_t bui
|
||||
extern ecma_property_t* \
|
||||
ecma_builtin_ ## lowercase_name ## _try_to_instantiate_property (ecma_object_t *obj_p, \
|
||||
ecma_string_t *prop_name_p);
|
||||
#define DECLARE_PROPERTY_NUMBER_VARIABLES(builtin_id, \
|
||||
object_type, \
|
||||
object_class, \
|
||||
object_prototype_builtin_id, \
|
||||
lowercase_name) \
|
||||
extern const ecma_length_t ecma_builtin_ ## lowercase_name ## _property_number;
|
||||
|
||||
ECMA_BUILTIN_LIST (DECLARE_PROPERTY_NUMBER_VARIABLES)
|
||||
ECMA_BUILTIN_LIST (DECLARE_DISPATCH_ROUTINES)
|
||||
|
||||
#undef DECLARE_PROPERTY_NUMBER_VARIABLES
|
||||
|
||||
@@ -88,8 +88,7 @@ static ecma_object_t*
|
||||
ecma_builtin_init_object (ecma_builtin_id_t obj_builtin_id, /**< built-in ID */
|
||||
ecma_object_t* prototype_obj_p, /**< prototype object */
|
||||
ecma_object_type_t obj_type, /**< object's type */
|
||||
ecma_magic_string_id_t obj_class, /**< object's class */
|
||||
ecma_length_t property_number) /**< number of the object's properties */
|
||||
ecma_magic_string_id_t obj_class) /**< object's class */
|
||||
{
|
||||
ecma_object_t *object_obj_p = ecma_create_object (prototype_obj_p, true, obj_type);
|
||||
|
||||
@@ -101,22 +100,6 @@ ecma_builtin_init_object (ecma_builtin_id_t obj_builtin_id, /**< built-in ID */
|
||||
ECMA_INTERNAL_PROPERTY_BUILT_IN_ID);
|
||||
built_in_id_prop_p->u.internal_property.value = obj_builtin_id;
|
||||
|
||||
JERRY_STATIC_ASSERT (property_number < sizeof (uint64_t) * JERRY_BITSINBYTE);
|
||||
uint64_t builtin_mask = ((uint32_t) 1u << property_number) - 1;
|
||||
|
||||
ecma_property_t *mask_0_31_prop_p;
|
||||
mask_0_31_prop_p = ecma_create_internal_property (object_obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_NON_INSTANTIATED_BUILT_IN_MASK_0_31);
|
||||
mask_0_31_prop_p->u.internal_property.value = (uint32_t) builtin_mask;
|
||||
|
||||
if (jrt_extract_bit_field (builtin_mask, 32, 32) != 0)
|
||||
{
|
||||
ecma_property_t *mask_32_63_prop_p;
|
||||
mask_32_63_prop_p = ecma_create_internal_property (object_obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_NON_INSTANTIATED_BUILT_IN_MASK_32_63);
|
||||
mask_32_63_prop_p->u.internal_property.value = (uint32_t) jrt_extract_bit_field (builtin_mask, 32, 32);
|
||||
}
|
||||
|
||||
ecma_set_object_is_builtin (object_obj_p, true);
|
||||
|
||||
/** Initializing [[PrimitiveValue]] properties of built-in prototype objects */
|
||||
@@ -141,7 +124,6 @@ ecma_builtin_init_object (ecma_builtin_id_t obj_builtin_id, /**< built-in ID */
|
||||
prim_value_prop_p = ecma_create_internal_property (object_obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_PRIMITIVE_NUMBER_VALUE);
|
||||
ECMA_SET_POINTER (prim_value_prop_p->u.internal_property.value, prim_prop_num_value_p);
|
||||
|
||||
break;
|
||||
}
|
||||
case ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE:
|
||||
@@ -195,8 +177,7 @@ ecma_init_builtins (void)
|
||||
ecma_object_t *builtin_obj_p = ecma_builtin_init_object (ECMA_BUILTIN_ID_ ## builtin_id, \
|
||||
prototype_obj_p, \
|
||||
ECMA_OBJECT_ ## object_type, \
|
||||
ECMA_MAGIC_STRING_ ## object_class, \
|
||||
ecma_builtin_ ## lowercase_name ## _property_number); \
|
||||
ECMA_MAGIC_STRING_ ## object_class); \
|
||||
ecma_builtin_objects [ECMA_BUILTIN_ID_ ## builtin_id] = builtin_obj_p; \
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user