Implementing 'construct_n' opcode handler.

This commit is contained in:
Ruben Ayrapetyan
2014-08-26 17:47:14 +04:00
parent 9573b7234d
commit bf5bda11ed
3 changed files with 148 additions and 6 deletions
@@ -103,6 +103,29 @@ ecma_op_is_callable (ecma_value_t value) /**< ecma-value */
|| obj_p->u.object.type == ECMA_OBJECT_TYPE_BOUND_FUNCTION);
} /* ecma_op_is_callable */
/**
* Check whether the value is Object that implements [[Construct]].
*
* @return true, if value is constructor object;
* false - otherwise.
*/
bool
ecma_is_constructor (ecma_value_t value) /**< ecma-value */
{
if (value.value_type != ECMA_TYPE_OBJECT)
{
return false;
}
ecma_object_t *obj_p = ECMA_GET_POINTER(value.value);
JERRY_ASSERT(obj_p != NULL);
JERRY_ASSERT(!obj_p->is_lexical_environment);
return (obj_p->u.object.type == ECMA_OBJECT_TYPE_FUNCTION
|| obj_p->u.object.type == ECMA_OBJECT_TYPE_BOUND_FUNCTION);
} /* ecma_is_constructor */
/**
* Function object creation operation.
*