Style fixes in libecmaoperations: space between function name and opening parenthesis, no space after opening parenthesis/before closing parenthesis. By mistake, the changes weren't commited with 8081e5cdb38ad0f9789a89c92362fc73a716d85c.
This commit is contained in:
@@ -36,17 +36,17 @@
|
||||
* @return packed value
|
||||
*/
|
||||
static uint32_t
|
||||
ecma_pack_code_internal_property_value( bool is_strict, /**< is code strict? */
|
||||
ecma_pack_code_internal_property_value (bool is_strict, /**< is code strict? */
|
||||
opcode_counter_t opcode_idx) /**< index of first opcode */
|
||||
{
|
||||
uint32_t value = opcode_idx;
|
||||
const uint32_t is_strict_bit_offset = sizeof(value) * JERRY_BITSINBYTE - 1;
|
||||
const uint32_t is_strict_bit_offset = sizeof (value) * JERRY_BITSINBYTE - 1;
|
||||
|
||||
JERRY_ASSERT( ( ( value ) & ( 1u << is_strict_bit_offset ) ) == 0 );
|
||||
JERRY_ASSERT(((value) & (1u << is_strict_bit_offset)) == 0);
|
||||
|
||||
if ( is_strict )
|
||||
if (is_strict)
|
||||
{
|
||||
value |= ( 1u << is_strict_bit_offset );
|
||||
value |= (1u << is_strict_bit_offset);
|
||||
}
|
||||
|
||||
return value;
|
||||
@@ -59,17 +59,17 @@ ecma_pack_code_internal_property_value( bool is_strict, /**< is code strict? */
|
||||
* @return opcode index
|
||||
*/
|
||||
static opcode_counter_t
|
||||
ecma_unpack_code_internal_property_value( uint32_t value, /**< packed value */
|
||||
ecma_unpack_code_internal_property_value (uint32_t value, /**< packed value */
|
||||
bool* out_is_strict_p) /**< out: is code strict? */
|
||||
{
|
||||
JERRY_ASSERT( out_is_strict_p != NULL );
|
||||
JERRY_ASSERT(out_is_strict_p != NULL);
|
||||
|
||||
const uint32_t is_strict_bit_offset = sizeof(value) * JERRY_BITSINBYTE - 1;
|
||||
const uint32_t is_strict_bit_offset = sizeof (value) * JERRY_BITSINBYTE - 1;
|
||||
|
||||
bool is_strict = ( ( value & ( 1u << is_strict_bit_offset ) ) != 0 );
|
||||
bool is_strict = ((value & (1u << is_strict_bit_offset)) != 0);
|
||||
*out_is_strict_p = is_strict;
|
||||
|
||||
opcode_counter_t opcode_idx = (opcode_counter_t) ( value & ~( 1u << is_strict_bit_offset ) );
|
||||
opcode_counter_t opcode_idx = (opcode_counter_t) (value & ~(1u << is_strict_bit_offset));
|
||||
|
||||
return opcode_idx;
|
||||
} /* ecma_unpack_code_internal_property_value */
|
||||
@@ -83,20 +83,20 @@ ecma_unpack_code_internal_property_value( uint32_t value, /**< packed value */
|
||||
* false - otherwise.
|
||||
*/
|
||||
bool
|
||||
ecma_op_is_callable( ecma_value_t value) /**< ecma-value */
|
||||
ecma_op_is_callable (ecma_value_t value) /**< ecma-value */
|
||||
{
|
||||
if ( value.value_type != ECMA_TYPE_OBJECT )
|
||||
if (value.value_type != ECMA_TYPE_OBJECT)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ecma_object_t *obj_p = ECMA_GET_POINTER( value.value);
|
||||
ecma_object_t *obj_p = ECMA_GET_POINTER(value.value);
|
||||
|
||||
JERRY_ASSERT( obj_p != NULL );
|
||||
JERRY_ASSERT( !obj_p->is_lexical_environment );
|
||||
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 );
|
||||
return (obj_p->u.object.type == ECMA_OBJECT_TYPE_FUNCTION
|
||||
|| obj_p->u.object.type == ECMA_OBJECT_TYPE_BOUND_FUNCTION);
|
||||
} /* ecma_op_is_callable */
|
||||
|
||||
/**
|
||||
@@ -107,16 +107,16 @@ ecma_op_is_callable( ecma_value_t value) /**< ecma-value */
|
||||
* @return pointer to newly created Function object
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_op_create_function_object( const ecma_char_t* formal_parameter_list_p[], /**< formal parameters list */
|
||||
ecma_op_create_function_object (const ecma_char_t* formal_parameter_list_p[], /**< formal parameters list */
|
||||
size_t formal_parameters_number, /**< formal parameters list's length */
|
||||
ecma_object_t *scope_p, /**< function's scope */
|
||||
bool is_strict, /**< 'strict' flag */
|
||||
opcode_counter_t first_opcode_idx) /**< index of first opcode of function's body */
|
||||
{
|
||||
// 1., 4., 13.
|
||||
FIXME( Setup prototype of Function object to built-in Function prototype object (15.3.3.1) );
|
||||
FIXME(Setup prototype of Function object to built-in Function prototype object (15.3.3.1));
|
||||
|
||||
ecma_object_t *f = ecma_create_object( NULL, true, ECMA_OBJECT_TYPE_FUNCTION);
|
||||
ecma_object_t *f = ecma_create_object (NULL, true, ECMA_OBJECT_TYPE_FUNCTION);
|
||||
|
||||
// 2., 6., 7., 8.
|
||||
/*
|
||||
@@ -126,35 +126,35 @@ ecma_op_create_function_object( const ecma_char_t* formal_parameter_list_p[], /*
|
||||
*/
|
||||
|
||||
// 3.
|
||||
ecma_property_t *class_prop_p = ecma_create_internal_property( f, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
ecma_property_t *class_prop_p = ecma_create_internal_property (f, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
class_prop_p->u.internal_property.value = ECMA_OBJECT_CLASS_FUNCTION;
|
||||
|
||||
// 9.
|
||||
ecma_property_t *scope_prop_p = ecma_create_internal_property( f, ECMA_INTERNAL_PROPERTY_SCOPE);
|
||||
ECMA_SET_POINTER( scope_prop_p->u.internal_property.value, scope_p);
|
||||
ecma_property_t *scope_prop_p = ecma_create_internal_property (f, ECMA_INTERNAL_PROPERTY_SCOPE);
|
||||
ECMA_SET_POINTER(scope_prop_p->u.internal_property.value, scope_p);
|
||||
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_object( f, scope_p);
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_object (f, scope_p);
|
||||
|
||||
// 10., 11., 14., 15.
|
||||
if ( formal_parameters_number != 0 )
|
||||
if (formal_parameters_number != 0)
|
||||
{
|
||||
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( formal_parameter_list_p);
|
||||
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS(formal_parameter_list_p);
|
||||
}
|
||||
|
||||
// 12.
|
||||
ecma_property_t *code_prop_p = ecma_create_internal_property( f, ECMA_INTERNAL_PROPERTY_CODE);
|
||||
code_prop_p->u.internal_property.value = ecma_pack_code_internal_property_value( is_strict,
|
||||
ecma_property_t *code_prop_p = ecma_create_internal_property (f, ECMA_INTERNAL_PROPERTY_CODE);
|
||||
code_prop_p->u.internal_property.value = ecma_pack_code_internal_property_value (is_strict,
|
||||
first_opcode_idx);
|
||||
|
||||
// 16.
|
||||
FIXME( Use 'new Object()' instead );
|
||||
ecma_object_t *proto_p = ecma_create_object( NULL, true, ECMA_OBJECT_TYPE_GENERAL);
|
||||
FIXME(Use 'new Object ()' instead);
|
||||
ecma_object_t *proto_p = ecma_create_object (NULL, true, ECMA_OBJECT_TYPE_GENERAL);
|
||||
|
||||
// 17.
|
||||
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_value_defined = true;
|
||||
prop_desc.value = ecma_make_object_value( f);
|
||||
prop_desc.value = ecma_make_object_value (f);
|
||||
|
||||
prop_desc.is_writable_defined = true;
|
||||
prop_desc.writable = ECMA_PROPERTY_WRITABLE;
|
||||
@@ -166,27 +166,27 @@ ecma_op_create_function_object( const ecma_char_t* formal_parameter_list_p[], /*
|
||||
prop_desc.configurable = ECMA_PROPERTY_CONFIGURABLE;
|
||||
}
|
||||
|
||||
ecma_op_object_define_own_property( proto_p,
|
||||
ecma_get_magic_string( ECMA_MAGIC_STRING_CONSTRUCTOR),
|
||||
ecma_op_object_define_own_property (proto_p,
|
||||
ecma_get_magic_string (ECMA_MAGIC_STRING_CONSTRUCTOR),
|
||||
prop_desc,
|
||||
false);
|
||||
|
||||
// 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;
|
||||
ecma_op_object_define_own_property( f,
|
||||
ecma_get_magic_string( ECMA_MAGIC_STRING_PROTOTYPE),
|
||||
ecma_op_object_define_own_property (f,
|
||||
ecma_get_magic_string (ECMA_MAGIC_STRING_PROTOTYPE),
|
||||
prop_desc,
|
||||
false);
|
||||
|
||||
ecma_deref_object( proto_p);
|
||||
ecma_deref_object (proto_p);
|
||||
|
||||
// 19.
|
||||
if ( is_strict )
|
||||
if (is_strict)
|
||||
{
|
||||
ecma_object_t *thrower_p = ecma_op_get_throw_type_error();
|
||||
ecma_object_t *thrower_p = ecma_op_get_throw_type_error ();
|
||||
|
||||
prop_desc = ecma_make_empty_property_descriptor();
|
||||
prop_desc = ecma_make_empty_property_descriptor ();
|
||||
{
|
||||
prop_desc.is_enumerable_defined = true;
|
||||
prop_desc.enumerable = ECMA_PROPERTY_NOT_ENUMERABLE;
|
||||
@@ -201,17 +201,17 @@ ecma_op_create_function_object( const ecma_char_t* formal_parameter_list_p[], /*
|
||||
prop_desc.set_p = thrower_p;
|
||||
}
|
||||
|
||||
ecma_op_object_define_own_property( f,
|
||||
ecma_get_magic_string( ECMA_MAGIC_STRING_CALLER),
|
||||
ecma_op_object_define_own_property (f,
|
||||
ecma_get_magic_string (ECMA_MAGIC_STRING_CALLER),
|
||||
prop_desc,
|
||||
false);
|
||||
|
||||
ecma_op_object_define_own_property( f,
|
||||
ecma_get_magic_string( ECMA_MAGIC_STRING_ARGUMENTS),
|
||||
ecma_op_object_define_own_property (f,
|
||||
ecma_get_magic_string (ECMA_MAGIC_STRING_ARGUMENTS),
|
||||
prop_desc,
|
||||
false);
|
||||
|
||||
ecma_deref_object( thrower_p);
|
||||
ecma_deref_object (thrower_p);
|
||||
}
|
||||
|
||||
return f;
|
||||
@@ -226,88 +226,88 @@ ecma_op_create_function_object( const ecma_char_t* formal_parameter_list_p[], /*
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_function_call( ecma_object_t *func_obj_p, /**< Function object */
|
||||
ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
|
||||
ecma_value_t this_arg_value, /**< 'this' argument's value */
|
||||
ecma_value_t* arguments_list_p, /**< arguments list */
|
||||
size_t arguments_list_len) /**< length of arguments list */
|
||||
{
|
||||
JERRY_ASSERT( func_obj_p != NULL && !func_obj_p->is_lexical_environment );
|
||||
JERRY_ASSERT( ecma_op_is_callable( ecma_make_object_value( func_obj_p)) );
|
||||
JERRY_ASSERT( arguments_list_len == 0 || arguments_list_p != NULL );
|
||||
JERRY_ASSERT(func_obj_p != NULL && !func_obj_p->is_lexical_environment);
|
||||
JERRY_ASSERT(ecma_op_is_callable (ecma_make_object_value (func_obj_p)));
|
||||
JERRY_ASSERT(arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
if ( func_obj_p->u.object.type == ECMA_OBJECT_TYPE_FUNCTION )
|
||||
if (func_obj_p->u.object.type == ECMA_OBJECT_TYPE_FUNCTION)
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
/* Entering Function Code (ECMA-262 v5, 10.4.3) */
|
||||
|
||||
ecma_property_t *scope_prop_p = ecma_get_internal_property( func_obj_p, ECMA_INTERNAL_PROPERTY_SCOPE);
|
||||
ecma_property_t *code_prop_p = ecma_get_internal_property( func_obj_p, ECMA_INTERNAL_PROPERTY_CODE);
|
||||
ecma_property_t *scope_prop_p = ecma_get_internal_property (func_obj_p, ECMA_INTERNAL_PROPERTY_SCOPE);
|
||||
ecma_property_t *code_prop_p = ecma_get_internal_property (func_obj_p, ECMA_INTERNAL_PROPERTY_CODE);
|
||||
|
||||
ecma_object_t *scope_p = ECMA_GET_POINTER( scope_prop_p->u.internal_property.value);
|
||||
ecma_object_t *scope_p = ECMA_GET_POINTER(scope_prop_p->u.internal_property.value);
|
||||
uint32_t code_prop_value = code_prop_p->u.internal_property.value;
|
||||
|
||||
bool is_strict;
|
||||
// 8.
|
||||
opcode_counter_t code_first_opcode_idx = ecma_unpack_code_internal_property_value( code_prop_value, &is_strict);
|
||||
opcode_counter_t code_first_opcode_idx = ecma_unpack_code_internal_property_value (code_prop_value, &is_strict);
|
||||
|
||||
ecma_value_t this_binding;
|
||||
// 1.
|
||||
if ( is_strict )
|
||||
if (is_strict)
|
||||
{
|
||||
this_binding = ecma_copy_value( this_arg_value, true);
|
||||
this_binding = ecma_copy_value (this_arg_value, true);
|
||||
}
|
||||
else if ( ecma_is_value_undefined( this_arg_value)
|
||||
|| ecma_is_value_null( this_arg_value) )
|
||||
else if (ecma_is_value_undefined (this_arg_value)
|
||||
|| ecma_is_value_null (this_arg_value))
|
||||
{
|
||||
// 2.
|
||||
FIXME( Assign Global object when it will be implemented );
|
||||
FIXME(Assign Global object when it will be implemented);
|
||||
|
||||
this_binding = ecma_make_simple_value( ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
this_binding = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 3., 4.
|
||||
ecma_completion_value_t completion = ecma_op_to_object( this_arg_value);
|
||||
JERRY_ASSERT( ecma_is_completion_value_normal( completion) );
|
||||
ecma_completion_value_t completion = ecma_op_to_object (this_arg_value);
|
||||
JERRY_ASSERT(ecma_is_completion_value_normal (completion));
|
||||
|
||||
this_binding = completion.value;
|
||||
}
|
||||
|
||||
// 5.
|
||||
ecma_object_t *local_env_p = ecma_create_decl_lex_env( scope_p);
|
||||
ecma_object_t *local_env_p = ecma_create_decl_lex_env (scope_p);
|
||||
|
||||
// 9.
|
||||
/* Declaration binding instantiation (ECMA-262 v5, 10.5), block 4 */
|
||||
TODO( Perform declaration binding instantion when [[FormalParameters]] list will be supported );
|
||||
if ( arguments_list_len != 0 )
|
||||
TODO(Perform declaration binding instantion when [[FormalParameters]] list will be supported);
|
||||
if (arguments_list_len != 0)
|
||||
{
|
||||
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( arguments_list_p );
|
||||
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS(arguments_list_p);
|
||||
}
|
||||
|
||||
ecma_completion_value_t completion = run_int_from_pos( code_first_opcode_idx,
|
||||
ecma_completion_value_t completion = run_int_from_pos (code_first_opcode_idx,
|
||||
this_binding,
|
||||
local_env_p,
|
||||
is_strict);
|
||||
if ( ecma_is_completion_value_normal( completion) )
|
||||
if (ecma_is_completion_value_normal (completion))
|
||||
{
|
||||
JERRY_ASSERT( ecma_is_empty_completion_value( completion) );
|
||||
JERRY_ASSERT(ecma_is_empty_completion_value (completion));
|
||||
|
||||
ret_value = ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret_value = completion;
|
||||
}
|
||||
|
||||
ecma_deref_object( local_env_p);
|
||||
ecma_free_value( this_binding, true);
|
||||
ecma_deref_object (local_env_p);
|
||||
ecma_free_value (this_binding, true);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
JERRY_ASSERT( func_obj_p->u.object.type == ECMA_OBJECT_TYPE_BOUND_FUNCTION );
|
||||
JERRY_ASSERT(func_obj_p->u.object.type == ECMA_OBJECT_TYPE_BOUND_FUNCTION);
|
||||
|
||||
JERRY_UNIMPLEMENTED();
|
||||
}
|
||||
@@ -319,9 +319,9 @@ ecma_op_function_call( ecma_object_t *func_obj_p, /**< Function object */
|
||||
* @return pointer to unique [[ThrowTypeError]] Function Object
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_op_get_throw_type_error( void)
|
||||
ecma_op_get_throw_type_error (void)
|
||||
{
|
||||
TODO( Create [[ThrowTypeError]] during engine initialization and return it from here );
|
||||
TODO(Create [[ThrowTypeError]] during engine initialization and return it from here);
|
||||
|
||||
JERRY_UNIMPLEMENTED();
|
||||
} /* ecma_op_get_throw_type_error */
|
||||
|
||||
Reference in New Issue
Block a user