Replacing ecma_builtin_is_*_object interfaces with ecma_builtin_is (object, builtin_id), and ecma_builtin_get_*_object with ecma_builtin_get (builtin_id).

This commit is contained in:
Ruben Ayrapetyan
2014-09-22 21:46:26 +04:00
parent 5f9a068a61
commit 1fed738217
9 changed files with 120 additions and 182 deletions
@@ -71,50 +71,17 @@ static const ecma_length_t ecma_builtin_object_property_number = (sizeof (ecma_b
sizeof (ecma_magic_string_id_t));
JERRY_STATIC_ASSERT (sizeof (ecma_builtin_object_property_names) > sizeof (void*));
/**
* Object object
*/
static ecma_object_t* ecma_object_object_p = NULL;
/**
* Get Object object
*
* @return pointer to the Object object
* caller should free the reference by calling ecma_deref_object
*/
ecma_object_t*
ecma_builtin_get_object_object (void)
{
JERRY_ASSERT(ecma_object_object_p != NULL);
ecma_ref_object (ecma_object_object_p);
return ecma_object_object_p;
} /* ecma_builtin_get_object_object */
/**
* Check if passed object is the Object object.
*
* @return true - if passed pointer points to the Object object,
* false - otherwise.
*/
bool
ecma_builtin_is_object_object (ecma_object_t *object_p) /**< an object */
{
return (object_p == ecma_object_object_p);
} /* ecma_builtin_is_object_object */
/**
* Initialize Object object.
*
* Warning:
* the routine should be called only from ecma_init_builtins
*
* @return pointer to the object
*/
void
ecma_object_t*
ecma_builtin_init_object_object (void)
{
JERRY_ASSERT(ecma_object_object_p == NULL);
ecma_object_t *object_obj_p = ecma_create_object (NULL, true, ECMA_OBJECT_TYPE_FUNCTION);
ecma_property_t *class_prop_p = ecma_create_internal_property (object_obj_p,
@@ -135,24 +102,9 @@ ecma_builtin_init_object_object (void)
ecma_set_object_is_builtin (object_obj_p, true);
ecma_object_object_p = object_obj_p;
return object_obj_p;
} /* ecma_builtin_init_object_object */
/**
* Remove global reference to the Object object.
*
* Warning:
* the routine should be called only from ecma_finalize_builtins
*/
void
ecma_builtin_finalize_object_object (void)
{
JERRY_ASSERT (ecma_object_object_p != NULL);
ecma_deref_object (ecma_object_object_p);
ecma_object_object_p = NULL;
} /* ecma_builtin_finalize_object_object */
/**
* Get number of routine's parameters
*
@@ -627,7 +579,7 @@ ecma_property_t*
ecma_builtin_object_try_to_instantiate_property (ecma_object_t *obj_p, /**< object */
ecma_string_t *prop_name_p) /**< property's name */
{
JERRY_ASSERT (ecma_builtin_is_object_object (obj_p));
JERRY_ASSERT (ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_OBJECT));
JERRY_ASSERT (ecma_find_named_property (obj_p, prop_name_p) == NULL);
ecma_magic_string_id_t id;