Renaming ecma_* identifiers from 'camelCase' to 'underscore_naming'.

This commit is contained in:
Ruben Ayrapetyan 2014-07-23 12:54:56 +04:00
parent b3b4c74cbe
commit bc0c7824c2
26 changed files with 702 additions and 702 deletions

View File

@ -45,14 +45,14 @@ run_int (void)
struct __int_data int_data;
int_data.pos = 0;
int_data.this_binding_p = NULL;
int_data.lex_env_p = ecma_CreateLexicalEnvironment( NULL,
ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);
int_data.lex_env_p = ecma_create_lexical_environment( NULL,
ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);
FIXME( Strict mode );
int_data.is_strict = false;
ecma_CompletionValue_t completion = run_int_from_pos( &int_data);
ecma_completion_value_t completion = run_int_from_pos( &int_data);
switch ( (ecma_CompletionType_t)completion.type )
switch ( (ecma_completion_type_t)completion.type )
{
case ECMA_COMPLETION_TYPE_NORMAL:
{
@ -60,7 +60,7 @@ run_int (void)
}
case ECMA_COMPLETION_TYPE_EXIT:
{
return ecma_IsValueTrue( completion.value);
return ecma_is_value_true( completion.value);
}
case ECMA_COMPLETION_TYPE_BREAK:
case ECMA_COMPLETION_TYPE_CONTINUE:
@ -81,10 +81,10 @@ run_int (void)
JERRY_UNREACHABLE();
}
ecma_CompletionValue_t
ecma_completion_value_t
run_int_from_pos (struct __int_data *int_data)
{
ecma_CompletionValue_t completion;
ecma_completion_value_t completion;
while ( true )
{
@ -123,7 +123,7 @@ run_int_from_pos (struct __int_data *int_data)
*/
ssize_t
try_get_string_by_idx(T_IDX idx, /**< literal id */
ecma_Char_t *buffer_p, /**< buffer */
ecma_char_t *buffer_p, /**< buffer */
ssize_t buffer_size) /**< buffer size */
{
TODO( Actual string literal retrievement );
@ -138,7 +138,7 @@ try_get_string_by_idx(T_IDX idx, /**< literal id */
}
// TODO
buffer_p[0] = (ecma_Char_t) ('a' + idx);
buffer_p[0] = (ecma_char_t) ('a' + idx);
buffer_p[1] = 0;
return req_length;
@ -149,10 +149,10 @@ try_get_string_by_idx(T_IDX idx, /**< literal id */
*
* @return value of number literal, corresponding to specified literal id
*/
ecma_Number_t
ecma_number_t
get_number_by_idx(T_IDX idx) /**< literal id */
{
TODO( Actual number literal retrievement );
return (ecma_Number_t)idx;
return (ecma_number_t)idx;
} /* get_number_by_idx */

View File

@ -23,17 +23,17 @@
struct __int_data
{
int pos; /**< current opcode to execute */
ecma_Object_t *this_binding_p; /**< this binding for current context */
ecma_Object_t *lex_env_p; /**< current lexical environment */
ecma_object_t *this_binding_p; /**< this binding for current context */
ecma_object_t *lex_env_p; /**< current lexical environment */
bool is_strict; /**< is current code execution mode strict? */
};
void init_int (const OPCODE* program_p);
bool run_int (void);
ecma_CompletionValue_t run_int_from_pos (struct __int_data *);
ecma_completion_value_t run_int_from_pos (struct __int_data *);
ssize_t try_get_string_by_idx( T_IDX idx, ecma_Char_t *buffer_p, ssize_t buffer_size);
ecma_Number_t get_number_by_idx(T_IDX idx);
ssize_t try_get_string_by_idx( T_IDX idx, ecma_char_t *buffer_p, ssize_t buffer_size);
ecma_number_t get_number_by_idx(T_IDX idx);
#endif /* INTERPRETER_H */

View File

@ -60,7 +60,7 @@
* statement with same argument as corresponding TRY_CATCH's first argument.
*/
#define TRY_CATCH(var, op, return_value) \
ecma_CompletionValue_t var = op; \
ecma_completion_value_t var = op; \
if ( unlikely( ecma_is_completion_value_throw( var) ) ) \
{ \
return_value = ecma_copy_completion_value( var); \
@ -86,8 +86,8 @@
*/
typedef struct
{
ecma_Char_t *str_p; /**< pointer to copied string literal */
ecma_Char_t literal_copy[32]; /**< buffer with string literal,
ecma_char_t *str_p; /**< pointer to copied string literal */
ecma_char_t literal_copy[32]; /**< buffer with string literal,
if it is stored locally
(i.e. not in the heap) */
} string_literal_copy;
@ -159,16 +159,16 @@ free_string_literal_copy(string_literal_copy *str_lit_descr_p) /**< string liter
* false - otherwise.
*/
static bool
do_strict_eval_arguments_check( ecma_Reference_t ref) /**< ECMA-reference */
do_strict_eval_arguments_check( ecma_reference_t ref) /**< ECMA-reference */
{
FIXME( Move magic strings to header file and make them ecma_Char_t[] );
FIXME( Replace strcmp with ecma_Char_t[] comparator );
FIXME( Move magic strings to header file and make them ecma_char_t[] );
FIXME( Replace strcmp with ecma_char_t[] comparator );
return ( ref.is_strict
&& ( __strcmp( (char*)ref.referenced_name_p, "eval") == 0
|| __strcmp( (char*)ref.referenced_name_p, "arguments") == 0 )
&& ( ref.base.ValueType == ECMA_TYPE_OBJECT )
&& ( ecma_GetPointer( ref.base.Value) != NULL )
&& ( ( (ecma_Object_t*) ecma_GetPointer( ref.base.Value) )->IsLexicalEnvironment ) );
&& ( ecma_get_pointer( ref.base.Value) != NULL )
&& ( ( (ecma_object_t*) ecma_get_pointer( ref.base.Value) )->IsLexicalEnvironment ) );
} /* do_strict_eval_arguments_check */
/**
@ -177,32 +177,32 @@ do_strict_eval_arguments_check( ecma_Reference_t ref) /**< ECMA-reference */
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
static ecma_CompletionValue_t
static ecma_completion_value_t
get_variable_value(struct __int_data *int_data, /**< interpreter context */
T_IDX var_idx, /**< variable identifier */
bool do_eval_or_arguments_check) /** run 'strict eval or arguments reference' check
See also: do_strict_eval_arguments_check */
{
string_literal_copy var_name;
ecma_Reference_t ref;
ecma_CompletionValue_t ret_value;
ecma_reference_t ref;
ecma_completion_value_t ret_value;
init_string_literal_copy( var_idx, &var_name);
ref = ecma_OpGetIdentifierReference( int_data->lex_env_p,
ref = ecma_op_get_identifier_reference( int_data->lex_env_p,
var_name.str_p,
int_data->is_strict);
if ( unlikely( do_eval_or_arguments_check
&& do_strict_eval_arguments_check( ref) ) )
{
ret_value = ecma_MakeThrowValue( ecma_NewStandardError( ECMA_ERROR_SYNTAX));
ret_value = ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_SYNTAX));
}
else
{
ret_value = ecma_op_get_value( ref);
}
ecma_FreeReference( ref);
ecma_free_reference( ref);
free_string_literal_copy( &var_name);
return ret_value;
@ -214,30 +214,30 @@ get_variable_value(struct __int_data *int_data, /**< interpreter context */
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
static ecma_CompletionValue_t
static ecma_completion_value_t
set_variable_value(struct __int_data *int_data, /**< interpreter context */
T_IDX var_idx, /**< variable identifier */
ecma_Value_t value) /**< value to set */
ecma_value_t value) /**< value to set */
{
string_literal_copy var_name;
ecma_Reference_t ref;
ecma_CompletionValue_t ret_value;
ecma_reference_t ref;
ecma_completion_value_t ret_value;
init_string_literal_copy( var_idx, &var_name);
ref = ecma_OpGetIdentifierReference( int_data->lex_env_p,
ref = ecma_op_get_identifier_reference( int_data->lex_env_p,
var_name.str_p,
int_data->is_strict);
if ( unlikely( do_strict_eval_arguments_check( ref) ) )
{
ret_value = ecma_MakeThrowValue( ecma_NewStandardError( ECMA_ERROR_SYNTAX));
ret_value = ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_SYNTAX));
}
else
{
ret_value = ecma_op_put_value( ref, value);
}
ecma_FreeReference( ref);
ecma_free_reference( ref);
free_string_literal_copy( &var_name);
return ret_value;
@ -266,23 +266,23 @@ typedef enum
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
static ecma_CompletionValue_t
static ecma_completion_value_t
do_number_arithmetic(struct __int_data *int_data, /**< interpreter context */
T_IDX dst_var_idx, /**< destination variable identifier */
number_arithmetic_op op, /**< number arithmetic operation */
ecma_Value_t left_value, /**< left value */
ecma_Value_t right_value) /** right value */
ecma_value_t left_value, /**< left value */
ecma_value_t right_value) /** right value */
{
ecma_CompletionValue_t ret_value;
ecma_completion_value_t ret_value;
TRY_CATCH(num_left_value, ecma_op_to_number( left_value), ret_value);
TRY_CATCH(num_right_value, ecma_op_to_number( right_value), ret_value);
ecma_Number_t *left_p, *right_p, *res_p;
left_p = (ecma_Number_t*)ecma_GetPointer( num_left_value.value.Value);
right_p = (ecma_Number_t*)ecma_GetPointer( num_right_value.value.Value);
ecma_number_t *left_p, *right_p, *res_p;
left_p = (ecma_number_t*)ecma_get_pointer( num_left_value.value.Value);
right_p = (ecma_number_t*)ecma_get_pointer( num_right_value.value.Value);
res_p = ecma_AllocNumber();
res_p = ecma_alloc_number();
switch ( op )
{
@ -305,9 +305,9 @@ do_number_arithmetic(struct __int_data *int_data, /**< interpreter context */
ret_value = set_variable_value(int_data,
dst_var_idx,
ecma_MakeNumberValue( res_p));
ecma_make_number_value( res_p));
ecma_DeallocNumber( res_p);
ecma_dealloc_number( res_p);
FINALIZE( num_right_value);
FINALIZE( num_left_value);
@ -382,13 +382,13 @@ do_number_arithmetic(struct __int_data *int_data, /**< interpreter context */
op(in)
#define DEFINE_UNIMPLEMENTED_OP(op) \
ecma_CompletionValue_t opfunc_ ## op(OPCODE opdata, struct __int_data *int_data) { \
ecma_completion_value_t opfunc_ ## op(OPCODE opdata, struct __int_data *int_data) { \
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( opdata, int_data); \
}
OP_UNIMPLEMENTED_LIST(DEFINE_UNIMPLEMENTED_OP)
#undef DEFINE_UNIMPLEMENTED_OP
ecma_CompletionValue_t
ecma_completion_value_t
opfunc_loop_inf (OPCODE opdata, struct __int_data *int_data)
{
#ifdef __HOST
@ -399,12 +399,12 @@ opfunc_loop_inf (OPCODE opdata, struct __int_data *int_data)
int_data->pos = opdata.data.loop_inf.loop_root;
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_EMPTY),
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value( ECMA_SIMPLE_VALUE_EMPTY),
ECMA_TARGET_ID_RESERVED);
}
ecma_CompletionValue_t
ecma_completion_value_t
opfunc_call_1 (OPCODE opdata __unused, struct __int_data *int_data)
{
#ifdef __HOST
@ -417,12 +417,12 @@ opfunc_call_1 (OPCODE opdata __unused, struct __int_data *int_data)
int_data->pos++;
// FIXME
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_EMPTY),
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value( ECMA_SIMPLE_VALUE_EMPTY),
ECMA_TARGET_ID_RESERVED);
}
ecma_CompletionValue_t
ecma_completion_value_t
opfunc_jmp (OPCODE opdata, struct __int_data *int_data)
{
#ifdef __HOST
@ -433,8 +433,8 @@ opfunc_jmp (OPCODE opdata, struct __int_data *int_data)
int_data->pos = opdata.data.jmp.opcode_idx;
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_EMPTY),
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value( ECMA_SIMPLE_VALUE_EMPTY),
ECMA_TARGET_ID_RESERVED);
}
@ -453,7 +453,7 @@ opfunc_jmp (OPCODE opdata, struct __int_data *int_data)
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_CompletionValue_t
ecma_completion_value_t
opfunc_assignment (OPCODE opdata, /**< operation data */
struct __int_data *int_data) /**< interpreter context */
{
@ -463,27 +463,27 @@ opfunc_assignment (OPCODE opdata, /**< operation data */
int_data->pos++;
ecma_CompletionValue_t get_value_completion;
ecma_completion_value_t get_value_completion;
switch ( type_value_right )
{
case OPCODE_ARG_TYPE_SIMPLE:
{
get_value_completion = ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeSimpleValue( src_val_descr),
get_value_completion = ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value( src_val_descr),
ECMA_TARGET_ID_RESERVED);
break;
}
case OPCODE_ARG_TYPE_STRING:
{
string_literal_copy str_value;
ecma_ArrayFirstChunk_t *ecma_string_p;
ecma_array_first_chunk_t *ecma_string_p;
init_string_literal_copy( src_val_descr, &str_value);
ecma_string_p = ecma_NewEcmaString( str_value.str_p);
ecma_string_p = ecma_new_ecma_string( str_value.str_p);
free_string_literal_copy( &str_value);
get_value_completion = ecma_MakeCompletionValue(ECMA_COMPLETION_TYPE_NORMAL,
get_value_completion = ecma_make_completion_value(ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_string_value( ecma_string_p),
ECMA_TARGET_ID_RESERVED);
break;
@ -498,21 +498,21 @@ opfunc_assignment (OPCODE opdata, /**< operation data */
}
case OPCODE_ARG_TYPE_NUMBER:
{
ecma_Number_t *num_p = ecma_AllocNumber();
ecma_number_t *num_p = ecma_alloc_number();
*num_p = get_number_by_idx( src_val_descr);
get_value_completion = ecma_MakeCompletionValue(ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeNumberValue( num_p),
get_value_completion = ecma_make_completion_value(ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_number_value( num_p),
ECMA_TARGET_ID_RESERVED);
break;
}
case OPCODE_ARG_TYPE_SMALLINT:
{
ecma_Number_t *num_p = ecma_AllocNumber();
ecma_number_t *num_p = ecma_alloc_number();
*num_p = src_val_descr;
get_value_completion = ecma_MakeCompletionValue(ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeNumberValue( num_p),
get_value_completion = ecma_make_completion_value(ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_number_value( num_p),
ECMA_TARGET_ID_RESERVED);
break;
}
@ -527,7 +527,7 @@ opfunc_assignment (OPCODE opdata, /**< operation data */
{
JERRY_ASSERT( ecma_is_completion_value_normal( get_value_completion) );
ecma_CompletionValue_t assignment_completion_value = set_variable_value(int_data,
ecma_completion_value_t assignment_completion_value = set_variable_value(int_data,
dst_var_idx,
get_value_completion.value);
@ -545,7 +545,7 @@ opfunc_assignment (OPCODE opdata, /**< operation data */
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_CompletionValue_t
ecma_completion_value_t
opfunc_addition(OPCODE opdata, /**< operation data */
struct __int_data *int_data) /**< interpreter context */
{
@ -555,7 +555,7 @@ opfunc_addition(OPCODE opdata, /**< operation data */
int_data->pos++;
ecma_CompletionValue_t ret_value;
ecma_completion_value_t ret_value;
TRY_CATCH(left_value, get_variable_value( int_data, left_var_idx, false), ret_value);
TRY_CATCH(right_value, get_variable_value( int_data, right_var_idx, false), ret_value);
@ -592,7 +592,7 @@ opfunc_addition(OPCODE opdata, /**< operation data */
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_CompletionValue_t
ecma_completion_value_t
opfunc_substraction(OPCODE opdata, /**< operation data */
struct __int_data *int_data) /**< interpreter context */
{
@ -602,7 +602,7 @@ opfunc_substraction(OPCODE opdata, /**< operation data */
int_data->pos++;
ecma_CompletionValue_t ret_value;
ecma_completion_value_t ret_value;
TRY_CATCH(left_value, get_variable_value( int_data, left_var_idx, false), ret_value);
TRY_CATCH(right_value, get_variable_value( int_data, right_var_idx, false), ret_value);
@ -627,7 +627,7 @@ opfunc_substraction(OPCODE opdata, /**< operation data */
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_CompletionValue_t
ecma_completion_value_t
opfunc_multiplication(OPCODE opdata, /**< operation data */
struct __int_data *int_data) /**< interpreter context */
{
@ -637,7 +637,7 @@ opfunc_multiplication(OPCODE opdata, /**< operation data */
int_data->pos++;
ecma_CompletionValue_t ret_value;
ecma_completion_value_t ret_value;
TRY_CATCH(left_value, get_variable_value( int_data, left_var_idx, false), ret_value);
TRY_CATCH(right_value, get_variable_value( int_data, right_var_idx, false), ret_value);
@ -662,7 +662,7 @@ opfunc_multiplication(OPCODE opdata, /**< operation data */
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_CompletionValue_t
ecma_completion_value_t
opfunc_division(OPCODE opdata, /**< operation data */
struct __int_data *int_data) /**< interpreter context */
{
@ -672,7 +672,7 @@ opfunc_division(OPCODE opdata, /**< operation data */
int_data->pos++;
ecma_CompletionValue_t ret_value;
ecma_completion_value_t ret_value;
TRY_CATCH(left_value, get_variable_value( int_data, left_var_idx, false), ret_value);
TRY_CATCH(right_value, get_variable_value( int_data, right_var_idx, false), ret_value);
@ -697,7 +697,7 @@ opfunc_division(OPCODE opdata, /**< operation data */
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_CompletionValue_t
ecma_completion_value_t
opfunc_remainder(OPCODE opdata, /**< operation data */
struct __int_data *int_data) /**< interpreter context */
{
@ -707,7 +707,7 @@ opfunc_remainder(OPCODE opdata, /**< operation data */
int_data->pos++;
ecma_CompletionValue_t ret_value;
ecma_completion_value_t ret_value;
TRY_CATCH(left_value, get_variable_value( int_data, left_var_idx, false), ret_value);
TRY_CATCH(right_value, get_variable_value( int_data, right_var_idx, false), ret_value);
@ -733,25 +733,25 @@ opfunc_remainder(OPCODE opdata, /**< operation data */
* Returned value is simple and so need not be freed.
* However, ecma_free_completion_value may be called for it, but it is a no-op.
*/
ecma_CompletionValue_t
ecma_completion_value_t
opfunc_var_decl(OPCODE opdata, /**< operation data */
struct __int_data *int_data __unused) /**< interpreter context */
{
string_literal_copy variable_name;
init_string_literal_copy( opdata.data.var_decl.variable_name, &variable_name);
if ( ecma_IsCompletionValueNormalFalse( ecma_OpHasBinding( int_data->lex_env_p,
if ( ecma_is_completion_value_normal_false( ecma_op_has_binding( int_data->lex_env_p,
variable_name.str_p)) )
{
FIXME( Pass configurableBindings that is true if and only if current code is eval code );
ecma_OpCreateMutableBinding( int_data->lex_env_p,
ecma_op_create_mutable_binding( int_data->lex_env_p,
variable_name.str_p,
false);
/* Skipping SetMutableBinding as we have already checked that there were not
* any binding with specified name in current lexical environment
* and CreateMutableBinding sets the created binding's value to undefined */
JERRY_ASSERT( ecma_is_completion_value_normal_simple_value( ecma_OpGetBindingValue( int_data->lex_env_p,
JERRY_ASSERT( ecma_is_completion_value_normal_simple_value( ecma_op_get_binding_value( int_data->lex_env_p,
variable_name.str_p,
true),
ECMA_SIMPLE_VALUE_UNDEFINED) );
@ -761,8 +761,8 @@ opfunc_var_decl(OPCODE opdata, /**< operation data */
int_data->pos++;
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_EMPTY),
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value( ECMA_SIMPLE_VALUE_EMPTY),
ECMA_TARGET_ID_RESERVED);
} /* opfunc_var_decl */
@ -779,16 +779,16 @@ opfunc_var_decl(OPCODE opdata, /**< operation data */
* Returned value is simple and so need not be freed.
* However, ecma_free_completion_value may be called for it, but it is a no-op.
*/
ecma_CompletionValue_t
ecma_completion_value_t
opfunc_exitval(OPCODE opdata, /**< operation data */
struct __int_data *int_data __unused) /**< interpreter context */
{
JERRY_ASSERT( opdata.data.exitval.status_code == 0
|| opdata.data.exitval.status_code == 1 );
ecma_Value_t exit_status = ecma_MakeSimpleValue( opdata.data.exitval.status_code == 0 ? ECMA_SIMPLE_VALUE_TRUE
ecma_value_t exit_status = ecma_make_simple_value( opdata.data.exitval.status_code == 0 ? ECMA_SIMPLE_VALUE_TRUE
: ECMA_SIMPLE_VALUE_FALSE);
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_EXIT,
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_EXIT,
exit_status,
ECMA_TARGET_ID_RESERVED);
} /* opfunc_exitval */

View File

@ -24,7 +24,7 @@ struct __int_data;
#define OP_STRUCT_FIELD(name) struct __op_##name name;
#define OP_ENUM_FIELD(name) __op__idx_##name ,
#define OP_FUNC_DECL(name) ecma_CompletionValue_t opfunc_##name (OPCODE, struct __int_data *);
#define OP_FUNC_DECL(name) ecma_completion_value_t opfunc_##name (OPCODE, struct __int_data *);
/** A single bytecode instruction is 32bit wide and has an 8bit opcode field
and several operand of 8 of 16 bit.*/
@ -33,7 +33,7 @@ struct __int_data;
#define T_IDX uint8_t /** index values */
OPCODE;
typedef ecma_CompletionValue_t (*opfunc)(OPCODE, struct __int_data *);
typedef ecma_completion_value_t (*opfunc)(OPCODE, struct __int_data *);
#define OP_LOOPS(op) \
op(loop_inf) \
@ -176,7 +176,7 @@ __packed;
*/
typedef enum
{
OPCODE_ARG_TYPE_SIMPLE, /**< ecma_SimpleValue_t */
OPCODE_ARG_TYPE_SIMPLE, /**< ecma_simple_value_t */
OPCODE_ARG_TYPE_SMALLINT, /**< small integer: from -128 to 127 */
OPCODE_ARG_TYPE_NUMBER, /**< index of number literal */
OPCODE_ARG_TYPE_STRING, /**< index of string literal */

View File

@ -38,13 +38,13 @@
#include "ecma-gc.h"
#include "mem-poolman.h"
JERRY_STATIC_ASSERT( sizeof (ecma_Value_t) <= sizeof (uint16_t) );
JERRY_STATIC_ASSERT( sizeof (ecma_Property_t) <= sizeof (uint64_t) );
JERRY_STATIC_ASSERT( sizeof (ecma_Object_t) <= sizeof (uint64_t) );
JERRY_STATIC_ASSERT( sizeof (ecma_ArrayHeader_t) <= sizeof (uint32_t) );
JERRY_STATIC_ASSERT( sizeof (ecma_ArrayFirstChunk_t) == ECMA_ARRAY_CHUNK_SIZE_IN_BYTES );
JERRY_STATIC_ASSERT( sizeof (ecma_ArrayNonFirstChunk_t) == ECMA_ARRAY_CHUNK_SIZE_IN_BYTES );
JERRY_STATIC_ASSERT( sizeof (ecma_CompletionValue_t) == sizeof(uint32_t) );
JERRY_STATIC_ASSERT( sizeof (ecma_value_t) <= sizeof (uint16_t) );
JERRY_STATIC_ASSERT( sizeof (ecma_property_t) <= sizeof (uint64_t) );
JERRY_STATIC_ASSERT( sizeof (ecma_object_t) <= sizeof (uint64_t) );
JERRY_STATIC_ASSERT( sizeof (ecma_array_header_t) <= sizeof (uint32_t) );
JERRY_STATIC_ASSERT( sizeof (ecma_array_first_chunk_t) == ECMA_ARRAY_CHUNK_SIZE_IN_BYTES );
JERRY_STATIC_ASSERT( sizeof (ecma_array_non_first_chunk_t) == ECMA_ARRAY_CHUNK_SIZE_IN_BYTES );
JERRY_STATIC_ASSERT( sizeof (ecma_completion_value_t) == sizeof(uint32_t) );
/**
* Template of an allocation routine.
@ -52,12 +52,12 @@ JERRY_STATIC_ASSERT( sizeof (ecma_CompletionValue_t) == sizeof(uint32_t) );
* FIXME: Run GC only if allocation failed.
*/
#define ALLOC( ecmaType) ecma_ ## ecmaType ## _t * \
ecma_Alloc ## ecmaType (void) \
ecma_alloc_ ## ecmaType (void) \
{ \
ecma_ ## ecmaType ## _t *p ## ecmaType = (ecma_ ## ecmaType ## _t *) \
mem_pools_alloc( mem_size_to_pool_chunk_type( sizeof(ecma_ ## ecmaType ## _t))); \
\
ecma_GCRun(); \
ecma_gc_run(); \
JERRY_ASSERT( p ## ecmaType != NULL ); \
\
return p ## ecmaType; \
@ -67,7 +67,7 @@ ecma_Alloc ## ecmaType (void) \
* Deallocation routine template
*/
#define DEALLOC( ecmaType) void \
ecma_Dealloc ## ecmaType( ecma_ ## ecmaType ## _t *p ## ecmaType) \
ecma_dealloc_ ## ecmaType( ecma_ ## ecmaType ## _t *p ## ecmaType) \
{ \
mem_pools_free( mem_size_to_pool_chunk_type( sizeof(ecma_ ## ecmaType ## _t)), \
(uint8_t*) p ## ecmaType); \
@ -80,11 +80,11 @@ ecma_Dealloc ## ecmaType( ecma_ ## ecmaType ## _t *p ## ecmaType) \
ALLOC( ecmaType) \
DEALLOC( ecmaType)
DECLARE_ROUTINES_FOR (Object)
DECLARE_ROUTINES_FOR (Property)
DECLARE_ROUTINES_FOR (Number)
DECLARE_ROUTINES_FOR (ArrayFirstChunk)
DECLARE_ROUTINES_FOR (ArrayNonFirstChunk)
DECLARE_ROUTINES_FOR (object)
DECLARE_ROUTINES_FOR (property)
DECLARE_ROUTINES_FOR (number)
DECLARE_ROUTINES_FOR (array_first_chunk)
DECLARE_ROUTINES_FOR (array_non_first_chunk)
/**
* @}

View File

@ -30,60 +30,60 @@
*
* @return pointer to allocated memory
*/
extern ecma_Object_t *ecma_AllocObject(void);
extern ecma_object_t *ecma_alloc_object(void);
/**
* Dealloc memory from an ecma-object
*/
extern void ecma_DeallocObject( ecma_Object_t *pObject);
extern void ecma_dealloc_object( ecma_object_t *pObject);
/**
* Allocate memory for ecma-property
*
* @return pointer to allocated memory
*/
extern ecma_Property_t *ecma_AllocProperty(void);
extern ecma_property_t *ecma_alloc_property(void);
/**
* Dealloc memory from an ecma-property
*/
extern void ecma_DeallocProperty( ecma_Property_t *pProperty);
extern void ecma_dealloc_property( ecma_property_t *pProperty);
/**
* Allocate memory for ecma-number
*
* @return pointer to allocated memory
*/
extern ecma_Number_t *ecma_AllocNumber(void);
extern ecma_number_t *ecma_alloc_number(void);
/**
* Dealloc memory from an ecma-number
*/
extern void ecma_DeallocNumber( ecma_Number_t *pNumber);
extern void ecma_dealloc_number( ecma_number_t *pNumber);
/**
* Allocate memory for first chunk of an ecma-array
*
* @return pointer to allocated memory
*/
extern ecma_ArrayFirstChunk_t *ecma_AllocArrayFirstChunk(void);
extern ecma_array_first_chunk_t *ecma_alloc_array_first_chunk(void);
/**
* Dealloc memory from first chunk of an ecma-array
*/
extern void ecma_DeallocArrayFirstChunk( ecma_ArrayFirstChunk_t *pFirstChunk);
extern void ecma_dealloc_array_first_chunk( ecma_array_first_chunk_t *pFirstChunk);
/**
* Allocate memory for non-first chunk of an ecma-array
*
* @return pointer to allocated memory
*/
extern ecma_ArrayNonFirstChunk_t *ecma_AllocArrayNonFirstChunk(void);
extern ecma_array_non_first_chunk_t *ecma_alloc_array_non_first_chunk(void);
/**
* Dealloc memory from non-first chunk of an ecma-array
*/
extern void ecma_DeallocArrayNonFirstChunk( ecma_ArrayNonFirstChunk_t *pNumber);
extern void ecma_dealloc_array_non_first_chunk( ecma_array_non_first_chunk_t *pNumber);
#endif /* JERRY_ECMA_ALLOC_H */

View File

@ -33,7 +33,7 @@
/**
* Queue of objects, awaiting for GC
*/
static ecma_Object_t *ecma_GC_Queue;
static ecma_object_t *ecma_gc_objs_to_free_queue;
/**
* Queue object for GC.
@ -42,23 +42,23 @@ static ecma_Object_t *ecma_GC_Queue;
* After this operation the object is not longer valid for general use.
*/
static void
ecma_GCQueue( ecma_Object_t *pObject) /**< object */
ecma_gc_queue( ecma_object_t *pObject) /**< object */
{
JERRY_ASSERT( pObject != NULL );
JERRY_ASSERT( pObject->GCInfo.IsObjectValid );
JERRY_ASSERT( pObject->GCInfo.u.Refs == 0 );
pObject->GCInfo.IsObjectValid = false;
ecma_SetPointer( pObject->GCInfo.u.NextQueuedForGC, ecma_GC_Queue);
ecma_set_pointer( pObject->GCInfo.u.NextQueuedForGC, ecma_gc_objs_to_free_queue);
ecma_GC_Queue = pObject;
} /* ecma_QueueGC */
ecma_gc_objs_to_free_queue = pObject;
} /* ecma_gc_queue */
/**
* Increase reference counter of an object
*/
void
ecma_RefObject(ecma_Object_t *pObject) /**< object */
ecma_ref_object(ecma_object_t *pObject) /**< object */
{
JERRY_ASSERT(pObject->GCInfo.IsObjectValid);
@ -68,13 +68,13 @@ ecma_RefObject(ecma_Object_t *pObject) /**< object */
* Check that value was not overflowed
*/
JERRY_ASSERT(pObject->GCInfo.u.Refs > 0);
} /* ecma_RefObject */
} /* ecma_ref_object */
/**
* Decrease reference counter of an object
*/
void
ecma_DerefObject(ecma_Object_t *pObject) /**< object */
ecma_deref_object(ecma_object_t *pObject) /**< object */
{
JERRY_ASSERT(pObject != NULL);
JERRY_ASSERT(pObject->GCInfo.IsObjectValid);
@ -84,62 +84,62 @@ ecma_DerefObject(ecma_Object_t *pObject) /**< object */
if ( pObject->GCInfo.u.Refs == 0 )
{
ecma_GCQueue( pObject);
ecma_gc_queue( pObject);
}
} /* ecma_DerefObject */
} /* ecma_deref_object */
/**
* Initialize garbage collector
*/
void
ecma_GCInit( void)
ecma_gc_init( void)
{
ecma_GC_Queue = NULL;
} /* ecma_GCInit */
ecma_gc_objs_to_free_queue = NULL;
} /* ecma_gc_init */
/**
* Run garbage collecting
*/
void
ecma_GCRun( void)
ecma_gc_run( void)
{
while ( ecma_GC_Queue != NULL )
while ( ecma_gc_objs_to_free_queue != NULL )
{
ecma_Object_t *pObject = ecma_GC_Queue;
ecma_GC_Queue = ecma_GetPointer( pObject->GCInfo.u.NextQueuedForGC);
ecma_object_t *pObject = ecma_gc_objs_to_free_queue;
ecma_gc_objs_to_free_queue = ecma_get_pointer( pObject->GCInfo.u.NextQueuedForGC);
JERRY_ASSERT( !pObject->GCInfo.IsObjectValid );
for ( ecma_Property_t *property = ecma_GetPointer( pObject->pProperties), *pNextProperty;
for ( ecma_property_t *property = ecma_get_pointer( pObject->pProperties), *pNextProperty;
property != NULL;
property = pNextProperty )
{
pNextProperty = ecma_GetPointer( property->pNextProperty);
pNextProperty = ecma_get_pointer( property->pNextProperty);
ecma_FreeProperty( property);
ecma_free_property( property);
}
if ( pObject->IsLexicalEnvironment )
{
ecma_Object_t *pOuterLexicalEnvironment = ecma_GetPointer( pObject->u.LexicalEnvironment.pOuterReference);
ecma_object_t *pOuterLexicalEnvironment = ecma_get_pointer( pObject->u.LexicalEnvironment.pOuterReference);
if ( pOuterLexicalEnvironment != NULL )
{
ecma_DerefObject( pOuterLexicalEnvironment);
ecma_deref_object( pOuterLexicalEnvironment);
}
} else
{
ecma_Object_t *pPrototypeObject = ecma_GetPointer( pObject->u.Object.pPrototypeObject);
ecma_object_t *pPrototypeObject = ecma_get_pointer( pObject->u.Object.pPrototypeObject);
if ( pPrototypeObject != NULL )
{
ecma_DerefObject( pPrototypeObject);
ecma_deref_object( pPrototypeObject);
}
}
ecma_DeallocObject( pObject);
ecma_dealloc_object( pObject);
}
} /* ecma_RunGC */
} /* ecma_gc_run */
/**
* @}

View File

@ -29,14 +29,14 @@
#include "ecma-globals.h"
extern void ecma_GCInit( void);
extern void ecma_RefObject(ecma_Object_t *pObject);
extern void ecma_DerefObject(ecma_Object_t *pObject);
extern void ecma_GCRun( void);
extern void ecma_gc_init( void);
extern void ecma_ref_object(ecma_object_t *pObject);
extern void ecma_deref_object(ecma_object_t *pObject);
extern void ecma_gc_run( void);
#endif /* !ECMA_GC_H */
/**
* @}
* @}
*/
*/

View File

@ -57,7 +57,7 @@ typedef enum {
ECMA_TYPE_STRING, /**< pointer to description of a string */
ECMA_TYPE_OBJECT, /**< pointer to description of an object */
ECMA_TYPE__COUNT /**< count of types */
} ecma_Type_t;
} ecma_type_t;
/**
* Simple ecma-values
@ -72,7 +72,7 @@ typedef enum {
but is stored directly in the array's property list
(used for array elements with non-default attribute values) */
ECMA_SIMPLE_VALUE__COUNT /** count of simple ecma-values */
} ecma_SimpleValue_t;
} ecma_simple_value_t;
/**
* Type of ecma-property
@ -81,7 +81,7 @@ typedef enum {
ECMA_PROPERTY_NAMEDDATA, /**< named data property */
ECMA_PROPERTY_NAMEDACCESSOR, /**< named accessor property */
ECMA_PROPERTY_INTERNAL /**< internal property */
} ecma_PropertyType_t;
} ecma_property_type_t;
/**
* Type of block evaluation (completion) result.
@ -96,20 +96,20 @@ typedef enum {
ECMA_COMPLETION_TYPE_THROW, /**< block completed with throw */
ECMA_COMPLETION_TYPE_EXIT /**< implementation-defined completion type
for finishing script execution */
} ecma_CompletionType_t;
} ecma_completion_type_t;
/**
* Description of an ecma-value
*/
typedef struct {
/** Value type (ecma_Type_t) */
/** Value type (ecma_type_t) */
unsigned int ValueType : 2;
/**
* Simple value (ecma_SimpleValue_t) or compressed pointer to value (depending on ValueType)
* Simple value (ecma_simple_value_t) or compressed pointer to value (depending on ValueType)
*/
unsigned int Value : ECMA_POINTER_FIELD_WIDTH;
} __packed ecma_Value_t;
} __packed ecma_value_t;
/**
* Description of a block completion value
@ -117,19 +117,19 @@ typedef struct {
* See also: ECMA-262 v5, 8.9.
*/
typedef struct {
/** Type (ecma_CompletionType_t) */
/** Type (ecma_completion_type_t) */
unsigned int type : 3;
/** Value */
ecma_Value_t value;
ecma_value_t value;
/** Target */
unsigned int target : 8;
} __packed ecma_CompletionValue_t;
} __packed ecma_completion_value_t;
/**
* Target value indicating that target field
* of ecma_CompletionValue_t defines no target.
* of ecma_completion_value_t defines no target.
*/
#define ECMA_TARGET_ID_RESERVED 255
@ -153,7 +153,7 @@ typedef enum {
/** Part of an array, that is indexed by strings */
ECMA_INTERNAL_PROPERTY_STRING_INDEXED_ARRAY_VALUES
} ecma_InternalPropertyId_t;
} ecma_internal_property_id_t;
/**
* Property's 'Writable' attribute's values description.
@ -162,7 +162,7 @@ typedef enum
{
ECMA_PROPERTY_NOT_WRITABLE, /**< property's 'Writable' attribute is false */
ECMA_PROPERTY_WRITABLE /**< property's 'Writable' attribute is true */
} ecma_PropertyWritableValue_t;
} ecma_property_writable_value_t;
/**
* Property's 'Enumerable' attribute's values description.
@ -171,7 +171,7 @@ typedef enum
{
ECMA_PROPERTY_NOT_ENUMERABLE, /**< property's 'Enumerable' attribute is false */
ECMA_PROPERTY_ENUMERABLE /**< property's 'Enumerable' attribute is true */
} ecma_PropertyEnumerableValue_t;
} ecma_property_enumerable_value_t;
/**
* Property's 'Configurable' attribute's values description.
@ -180,13 +180,13 @@ typedef enum
{
ECMA_PROPERTY_NOT_CONFIGURABLE, /**< property's 'Configurable' attribute is false */
ECMA_PROPERTY_CONFIGURABLE /**< property's 'Configurable' attribute is true */
} ecma_PropertyConfigurableValue_t;
} ecma_property_configurable_value_t;
/**
* Description of ecma-property.
*/
typedef struct ecma_Property_t {
/** Property's type (ecma_PropertyType_t) */
typedef struct ecma_property_t {
/** Property's type (ecma_property_type_t) */
unsigned int Type : 2;
/** Compressed pointer to next property */
@ -196,32 +196,32 @@ typedef struct ecma_Property_t {
union {
/** Description of named data property */
struct __packed ecma_NamedDataProperty_t {
struct __packed ecma_named_data_property_t {
/** Compressed pointer to property's name (pointer to String) */
unsigned int pName : ECMA_POINTER_FIELD_WIDTH;
/** Attribute 'Writable' (ecma_PropertyWritableValue_t) */
/** Attribute 'Writable' (ecma_property_writable_value_t) */
unsigned int Writable : 1;
/** Attribute 'Enumerable' (ecma_PropertyEnumerableValue_t) */
/** Attribute 'Enumerable' (ecma_property_enumerable_value_t) */
unsigned int Enumerable : 1;
/** Attribute 'Configurable' (ecma_PropertyConfigurableValue_t) */
/** Attribute 'Configurable' (ecma_property_configurable_value_t) */
unsigned int Configurable : 1;
/** Value */
ecma_Value_t Value;
ecma_value_t Value;
} NamedDataProperty;
/** Description of named accessor property */
struct __packed ecma_NamedAccessorProperty_t {
struct __packed ecma_named_accessor_property_t {
/** Compressed pointer to property's name (pointer to String) */
unsigned int pName : ECMA_POINTER_FIELD_WIDTH;
/** Attribute 'Enumerable' (ecma_PropertyEnumerableValue_t) */
/** Attribute 'Enumerable' (ecma_property_enumerable_value_t) */
unsigned int Enumerable : 1;
/** Attribute 'Configurable' (ecma_PropertyConfigurableValue_t) */
/** Attribute 'Configurable' (ecma_property_configurable_value_t) */
unsigned int Configurable : 1;
/** Compressed pointer to property's getter */
@ -232,7 +232,7 @@ typedef struct ecma_Property_t {
} NamedAccessorProperty;
/** Description of internal property */
struct __packed ecma_InternalProperty_t {
struct __packed ecma_internal_property_t {
/** Internal property's type */
unsigned int InternalPropertyType : 4;
@ -240,7 +240,7 @@ typedef struct ecma_Property_t {
unsigned int Value : ECMA_POINTER_FIELD_WIDTH;
} InternalProperty;
} u;
} ecma_Property_t;
} ecma_property_t;
/**
* Description of GC's information layout
@ -267,7 +267,7 @@ typedef struct {
/** Compressed pointer to next object in the list of objects, queued for GC (if !IsObjectValid) */
unsigned int NextQueuedForGC : ECMA_POINTER_FIELD_WIDTH;
} __packed u;
} ecma_GCInfo_t;
} ecma_GC_info_t;
/**
* Types of lexical environments
@ -275,13 +275,13 @@ typedef struct {
typedef enum {
ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE, /**< declarative lexical environment */
ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND /**< object-bound lexical environment */
} ecma_LexicalEnvironmentType_t;
} ecma_lexical_environment_type_t;
/**
* Description of ECMA-object or lexical environment
* (depending on IsLexicalEnvironment).
*/
typedef struct ecma_Object_t {
typedef struct ecma_object_t {
/** Compressed pointer to property list */
unsigned int pProperties : ECMA_POINTER_FIELD_WIDTH;
@ -301,7 +301,7 @@ typedef struct ecma_Object_t {
/** Attribute 'Extensible' */
unsigned int Extensible : 1;
/** Compressed pointer to prototype object (ecma_Object_t) */
/** Compressed pointer to prototype object (ecma_object_t) */
unsigned int pPrototypeObject : ECMA_POINTER_FIELD_WIDTH;
} __packed Object;
@ -310,7 +310,7 @@ typedef struct ecma_Object_t {
*/
struct {
/**
* Type of lexical environment (ecma_LexicalEnvironmentType_t).
* Type of lexical environment (ecma_lexical_environment_type_t).
*/
unsigned int Type : 1;
@ -321,23 +321,23 @@ typedef struct ecma_Object_t {
} __packed u;
/** GC's information */
ecma_GCInfo_t GCInfo;
} ecma_Object_t;
ecma_GC_info_t GCInfo;
} ecma_object_t;
/**
* Description of an ecma-character
*/
typedef uint8_t ecma_Char_t;
typedef uint8_t ecma_char_t;
/**
* Description of an ecma-number
*/
typedef float ecma_Number_t;
typedef float ecma_number_t;
/**
* Description of arrays'/strings' length
*/
typedef uint16_t ecma_Length_t;
typedef uint16_t ecma_length_t;
/**
* Description of an Array's header
@ -347,8 +347,8 @@ typedef struct {
uint16_t pNextChunk;
/** Number of elements in the Array */
ecma_Length_t UnitNumber;
} ecma_ArrayHeader_t;
ecma_length_t UnitNumber;
} ecma_array_header_t;
/**
* Size of a chunk, containing a String's part, in bytes
@ -360,11 +360,11 @@ typedef struct {
*/
typedef struct {
/** Array's header */
ecma_ArrayHeader_t Header;
ecma_array_header_t Header;
/** Elements */
uint8_t Data[ ECMA_ARRAY_CHUNK_SIZE_IN_BYTES - sizeof (ecma_ArrayHeader_t) ];
} ecma_ArrayFirstChunk_t;
uint8_t Data[ ECMA_ARRAY_CHUNK_SIZE_IN_BYTES - sizeof (ecma_array_header_t) ];
} ecma_array_first_chunk_t;
/**
* Description of non-first chunk in a chain of chunks that contains an Array
@ -375,7 +375,7 @@ typedef struct {
/** Characters */
uint8_t Data[ ECMA_ARRAY_CHUNK_SIZE_IN_BYTES - sizeof (uint16_t) ];
} ecma_ArrayNonFirstChunk_t;
} ecma_array_non_first_chunk_t;
/**
* \addtogroup reference ECMA-reference
@ -388,14 +388,14 @@ typedef struct {
typedef struct
{
/** base value */
ecma_Value_t base;
ecma_value_t base;
/** referenced name value pointer */
ecma_Char_t *referenced_name_p;
ecma_char_t *referenced_name_p;
/** strict reference flag */
bool is_strict;
} ecma_Reference_t;
} ecma_reference_t;
/**
* @}

View File

@ -33,10 +33,10 @@
* false - otherwise.
*/
bool
ecma_IsValueUndefined( ecma_Value_t value) /**< ecma-value */
ecma_is_value_undefined( ecma_value_t value) /**< ecma-value */
{
return ( value.ValueType == ECMA_TYPE_SIMPLE && value.Value == ECMA_SIMPLE_VALUE_UNDEFINED );
} /* ecma_IsValueUndefined */
} /* ecma_is_value_undefined */
/**
* Check if the value is null.
@ -45,10 +45,10 @@ ecma_IsValueUndefined( ecma_Value_t value) /**< ecma-value */
* false - otherwise.
*/
bool
ecma_IsValueNull( ecma_Value_t value) /**< ecma-value */
ecma_is_value_null( ecma_value_t value) /**< ecma-value */
{
return ( value.ValueType == ECMA_TYPE_SIMPLE && value.Value == ECMA_SIMPLE_VALUE_NULL );
} /* ecma_IsValueNull */
} /* ecma_is_value_null */
/**
* Check if the value is boolean.
@ -57,11 +57,11 @@ ecma_IsValueNull( ecma_Value_t value) /**< ecma-value */
* false - otherwise.
*/
bool
ecma_IsValueBoolean( ecma_Value_t value) /**< ecma-value */
ecma_is_value_boolean( ecma_value_t value) /**< ecma-value */
{
return ( ( value.ValueType == ECMA_TYPE_SIMPLE && value.Value == ECMA_SIMPLE_VALUE_FALSE )
|| ( value.ValueType == ECMA_TYPE_SIMPLE && value.Value == ECMA_SIMPLE_VALUE_TRUE ) );
} /* ecma_IsValueBoolean */
} /* ecma_is_value_boolean */
/**
* Check if the value is true.
@ -73,50 +73,50 @@ ecma_IsValueBoolean( ecma_Value_t value) /**< ecma-value */
* false - otherwise.
*/
bool
ecma_IsValueTrue( ecma_Value_t value) /**< ecma-value */
ecma_is_value_true( ecma_value_t value) /**< ecma-value */
{
JERRY_ASSERT( ecma_IsValueBoolean( value) );
JERRY_ASSERT( ecma_is_value_boolean( value) );
return ( value.ValueType == ECMA_TYPE_SIMPLE && value.Value == ECMA_SIMPLE_VALUE_TRUE );
} /* ecma_IsValueTrue */
} /* ecma_is_value_true */
/**
* Simple value constructor
*/
ecma_Value_t
ecma_MakeSimpleValue( ecma_SimpleValue_t value) /**< simple value */
ecma_value_t
ecma_make_simple_value( ecma_simple_value_t value) /**< simple value */
{
return (ecma_Value_t) { .ValueType = ECMA_TYPE_SIMPLE, .Value = value };
} /* ecma_MakeSimpleValue */
return (ecma_value_t) { .ValueType = ECMA_TYPE_SIMPLE, .Value = value };
} /* ecma_make_simple_value */
/**
* Number value constructor
*/
ecma_Value_t
ecma_MakeNumberValue( ecma_Number_t* num_p) /**< number to reference in value */
ecma_value_t
ecma_make_number_value( ecma_number_t* num_p) /**< number to reference in value */
{
JERRY_ASSERT( num_p != NULL );
ecma_Value_t number_value;
ecma_value_t number_value;
number_value.ValueType = ECMA_TYPE_NUMBER;
ecma_SetPointer( number_value.Value, num_p);
ecma_set_pointer( number_value.Value, num_p);
return number_value;
} /* ecma_MakeNumberValue */
} /* ecma_make_number_value */
/**
* String value constructor
*/
ecma_Value_t
ecma_make_string_value( ecma_ArrayFirstChunk_t* ecma_string_p) /**< string to reference in value */
ecma_value_t
ecma_make_string_value( ecma_array_first_chunk_t* ecma_string_p) /**< string to reference in value */
{
JERRY_ASSERT( ecma_string_p != NULL );
ecma_Value_t string_value;
ecma_value_t string_value;
string_value.ValueType = ECMA_TYPE_STRING;
ecma_SetPointer( string_value.Value, ecma_string_p);
ecma_set_pointer( string_value.Value, ecma_string_p);
return string_value;
} /* ecma_make_string_value */
@ -124,18 +124,18 @@ ecma_make_string_value( ecma_ArrayFirstChunk_t* ecma_string_p) /**< string to re
/**
* Object value constructor
*/
ecma_Value_t
ecma_MakeObjectValue( ecma_Object_t* object_p) /**< object to reference in value */
ecma_value_t
ecma_make_object_value( ecma_object_t* object_p) /**< object to reference in value */
{
JERRY_ASSERT( object_p != NULL );
ecma_Value_t object_value;
ecma_value_t object_value;
object_value.ValueType = ECMA_TYPE_OBJECT;
ecma_SetPointer( object_value.Value, object_p);
ecma_set_pointer( object_value.Value, object_p);
return object_value;
} /* ecma_MakeObjectValue */
} /* ecma_make_object_value */
/**
* Copy ecma-value.
@ -158,12 +158,12 @@ ecma_MakeObjectValue( ecma_Object_t* object_p) /**< object to reference in value
*
* @return See note.
*/
ecma_Value_t
ecma_CopyValue( const ecma_Value_t value) /**< ecma-value */
ecma_value_t
ecma_copy_value( const ecma_value_t value) /**< ecma-value */
{
ecma_Value_t value_copy;
ecma_value_t value_copy;
switch ( (ecma_Type_t)value.ValueType )
switch ( (ecma_type_t)value.ValueType )
{
case ECMA_TYPE_SIMPLE:
{
@ -173,35 +173,35 @@ ecma_CopyValue( const ecma_Value_t value) /**< ecma-value */
}
case ECMA_TYPE_NUMBER:
{
ecma_Number_t *num_p = ecma_GetPointer( value.Value);
ecma_number_t *num_p = ecma_get_pointer( value.Value);
JERRY_ASSERT( num_p != NULL );
ecma_Number_t *number_copy_p = ecma_AllocNumber();
ecma_number_t *number_copy_p = ecma_alloc_number();
*number_copy_p = *num_p;
value_copy = (ecma_Value_t) { .ValueType = ECMA_TYPE_NUMBER };
ecma_SetPointer( value_copy.Value, number_copy_p);
value_copy = (ecma_value_t) { .ValueType = ECMA_TYPE_NUMBER };
ecma_set_pointer( value_copy.Value, number_copy_p);
break;
}
case ECMA_TYPE_STRING:
{
ecma_ArrayFirstChunk_t *string_p = ecma_GetPointer( value.Value);
ecma_array_first_chunk_t *string_p = ecma_get_pointer( value.Value);
JERRY_ASSERT( string_p != NULL );
ecma_ArrayFirstChunk_t *string_copy_p = ecma_DuplicateEcmaString( string_p);
ecma_array_first_chunk_t *string_copy_p = ecma_duplicate_ecma_string( string_p);
value_copy = (ecma_Value_t) { .ValueType = ECMA_TYPE_STRING };
ecma_SetPointer( value_copy.Value, string_copy_p);
value_copy = (ecma_value_t) { .ValueType = ECMA_TYPE_STRING };
ecma_set_pointer( value_copy.Value, string_copy_p);
break;
}
case ECMA_TYPE_OBJECT:
{
ecma_Object_t *obj_p = ecma_GetPointer( value.Value);
ecma_object_t *obj_p = ecma_get_pointer( value.Value);
JERRY_ASSERT( obj_p != NULL );
ecma_RefObject( obj_p);
ecma_ref_object( obj_p);
value_copy = value;
@ -214,15 +214,15 @@ ecma_CopyValue( const ecma_Value_t value) /**< ecma-value */
}
return value_copy;
} /* ecma_CopyValue */
} /* ecma_copy_value */
/**
* Free the ecma-value
*/
void
ecma_FreeValue( ecma_Value_t value) /**< value description */
ecma_free_value( ecma_value_t value) /**< value description */
{
switch ( (ecma_Type_t) value.ValueType )
switch ( (ecma_type_t) value.ValueType )
{
case ECMA_TYPE_SIMPLE:
{
@ -232,21 +232,21 @@ ecma_FreeValue( ecma_Value_t value) /**< value description */
case ECMA_TYPE_NUMBER:
{
ecma_Number_t *pNumber = ecma_GetPointer( value.Value);
ecma_DeallocNumber( pNumber);
ecma_number_t *pNumber = ecma_get_pointer( value.Value);
ecma_dealloc_number( pNumber);
break;
}
case ECMA_TYPE_STRING:
{
ecma_ArrayFirstChunk_t *pString = ecma_GetPointer( value.Value);
ecma_FreeArray( pString);
ecma_array_first_chunk_t *pString = ecma_get_pointer( value.Value);
ecma_free_array( pString);
break;
}
case ECMA_TYPE_OBJECT:
{
ecma_DerefObject( ecma_GetPointer( value.Value));
ecma_deref_object( ecma_get_pointer( value.Value));
break;
}
@ -255,61 +255,61 @@ ecma_FreeValue( ecma_Value_t value) /**< value description */
JERRY_UNREACHABLE();
}
}
} /* ecma_FreeValue */
} /* ecma_free_value */
/**
* Completion value constructor
*
* @return completion value
*/
ecma_CompletionValue_t
ecma_MakeCompletionValue(ecma_CompletionType_t type, /**< type */
ecma_Value_t value, /**< value */
ecma_completion_value_t
ecma_make_completion_value(ecma_completion_type_t type, /**< type */
ecma_value_t value, /**< value */
uint8_t target) /**< target */
{
return (ecma_CompletionValue_t) { .type = type, .value = value, .target = target };
} /* ecma_MakeCompletionValue */
return (ecma_completion_value_t) { .type = type, .value = value, .target = target };
} /* ecma_make_completion_value */
/**
* Throw completion value constructor.
*
* @return 'throw' completion value
*/
ecma_CompletionValue_t
ecma_MakeThrowValue( ecma_Object_t *exception_p) /**< an object */
ecma_completion_value_t
ecma_make_throw_value( ecma_object_t *exception_p) /**< an object */
{
JERRY_ASSERT( exception_p != NULL && !exception_p->IsLexicalEnvironment );
ecma_Value_t exception = ecma_MakeObjectValue( exception_p);
ecma_value_t exception = ecma_make_object_value( exception_p);
return ecma_MakeCompletionValue(ECMA_COMPLETION_TYPE_THROW,
return ecma_make_completion_value(ECMA_COMPLETION_TYPE_THROW,
exception,
ECMA_TARGET_ID_RESERVED);
} /* ecma_MakeThrowValue */
} /* ecma_make_throw_value */
/**
* Empty completion value constructor.
*
* @return (normal, empty, reserved) completion value.
*/
ecma_CompletionValue_t
ecma_completion_value_t
ecma_make_empty_completion_value( void)
{
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_EMPTY),
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value( ECMA_SIMPLE_VALUE_EMPTY),
ECMA_TARGET_ID_RESERVED);
} /* ecma_make_empty_completion_value */
/**
* Copy ecma-completion value.
*
* @return (source.type, ecma_CopyValue( source.value), source.target).
* @return (source.type, ecma_copy_value( source.value), source.target).
*/
ecma_CompletionValue_t
ecma_copy_completion_value( ecma_CompletionValue_t value) /**< completion value */
ecma_completion_value_t
ecma_copy_completion_value( ecma_completion_value_t value) /**< completion value */
{
return ecma_MakeCompletionValue( value.type,
ecma_CopyValue( value.value),
return ecma_make_completion_value( value.type,
ecma_copy_value( value.value),
value.target);
} /* ecma_copy_completion_value */
@ -317,14 +317,14 @@ ecma_copy_completion_value( ecma_CompletionValue_t value) /**< completion value
* Free the completion value.
*/
void
ecma_free_completion_value( ecma_CompletionValue_t completion_value) /**< completion value */
ecma_free_completion_value( ecma_completion_value_t completion_value) /**< completion value */
{
switch ( completion_value.type )
{
case ECMA_COMPLETION_TYPE_NORMAL:
case ECMA_COMPLETION_TYPE_THROW:
case ECMA_COMPLETION_TYPE_RETURN:
ecma_FreeValue( completion_value.value);
ecma_free_value( completion_value.value);
break;
case ECMA_COMPLETION_TYPE_CONTINUE:
case ECMA_COMPLETION_TYPE_BREAK:
@ -341,7 +341,7 @@ ecma_free_completion_value( ecma_CompletionValue_t completion_value) /**< comple
* false - otherwise.
*/
bool
ecma_is_completion_value_normal( ecma_CompletionValue_t value) /**< completion value */
ecma_is_completion_value_normal( ecma_completion_value_t value) /**< completion value */
{
return ( value.type == ECMA_COMPLETION_TYPE_NORMAL );
} /* ecma_is_completion_value_normal */
@ -353,7 +353,7 @@ ecma_is_completion_value_normal( ecma_CompletionValue_t value) /**< completion v
* false - otherwise.
*/
bool
ecma_is_completion_value_throw( ecma_CompletionValue_t value) /**< completion value */
ecma_is_completion_value_throw( ecma_completion_value_t value) /**< completion value */
{
return ( value.type == ECMA_COMPLETION_TYPE_THROW );
} /* ecma_is_completion_value_throw */
@ -366,8 +366,8 @@ ecma_is_completion_value_throw( ecma_CompletionValue_t value) /**< completion va
* false - otherwise.
*/
bool
ecma_is_completion_value_normal_simple_value(ecma_CompletionValue_t value, /**< completion value */
ecma_SimpleValue_t simple_value) /**< simple value to check for equality with */
ecma_is_completion_value_normal_simple_value(ecma_completion_value_t value, /**< completion value */
ecma_simple_value_t simple_value) /**< simple value to check for equality with */
{
return ( value.type == ECMA_COMPLETION_TYPE_NORMAL
&& value.value.ValueType == ECMA_TYPE_SIMPLE
@ -382,10 +382,10 @@ ecma_is_completion_value_normal_simple_value(ecma_CompletionValue_t value, /**<
* false - otherwise.
*/
bool
ecma_IsCompletionValueNormalTrue( ecma_CompletionValue_t value) /**< completion value */
ecma_is_completion_value_normal_true( ecma_completion_value_t value) /**< completion value */
{
return ecma_is_completion_value_normal_simple_value( value, ECMA_SIMPLE_VALUE_TRUE);
} /* ecma_IsCompletionValueNormalTrue */
} /* ecma_is_completion_value_normal_true */
/**
* Check if the completion value is normal false.
@ -395,10 +395,10 @@ ecma_IsCompletionValueNormalTrue( ecma_CompletionValue_t value) /**< completion
* false - otherwise.
*/
bool
ecma_IsCompletionValueNormalFalse( ecma_CompletionValue_t value) /**< completion value */
ecma_is_completion_value_normal_false( ecma_completion_value_t value) /**< completion value */
{
return ecma_is_completion_value_normal_simple_value( value, ECMA_SIMPLE_VALUE_FALSE);
} /* ecma_IsCompletionValueNormalFalse */
} /* ecma_is_completion_value_normal_false */
/**
* @}

View File

@ -30,7 +30,7 @@
* Compress pointer.
*/
uintptr_t
ecma_CompressPointer(void *pointer) /**< pointer to compress */
ecma_compress_pointer(void *pointer) /**< pointer to compress */
{
if ( pointer == NULL )
{
@ -47,13 +47,13 @@ ecma_CompressPointer(void *pointer) /**< pointer to compress */
JERRY_ASSERT((intPtr & ~((1u << ECMA_POINTER_FIELD_WIDTH) - 1)) == 0);
return intPtr;
} /* ecma_CompressPointer */
} /* ecma_compress_pointer */
/**
* Decompress pointer.
*/
void*
ecma_DecompressPointer(uintptr_t compressedPointer) /**< pointer to decompress */
ecma_decompress_pointer(uintptr_t compressedPointer) /**< pointer to decompress */
{
if ( compressedPointer == ECMA_NULL_POINTER )
{
@ -66,7 +66,7 @@ ecma_DecompressPointer(uintptr_t compressedPointer) /**< pointer to decompress *
intPtr += mem_get_base_pointer();
return (void*) intPtr;
} /* ecma_DecompressPointer */
} /* ecma_decompress_pointer */
/**
* Create an object with specified prototype object
@ -77,11 +77,11 @@ ecma_DecompressPointer(uintptr_t compressedPointer) /**< pointer to decompress *
*
* @return pointer to the object's descriptor
*/
ecma_Object_t*
ecma_CreateObject( ecma_Object_t *pPrototypeObject, /**< pointer to prototybe of the object (or NULL) */
ecma_object_t*
ecma_create_object( ecma_object_t *pPrototypeObject, /**< pointer to prototybe of the object (or NULL) */
bool isExtensible) /**< value of extensible attribute */
{
ecma_Object_t *pObject = ecma_AllocObject();
ecma_object_t *pObject = ecma_alloc_object();
pObject->pProperties = ECMA_NULL_POINTER;
pObject->IsLexicalEnvironment = false;
@ -92,10 +92,10 @@ ecma_CreateObject( ecma_Object_t *pPrototypeObject, /**< pointer to prototybe of
pObject->GCInfo.u.Refs = 1;
pObject->u.Object.Extensible = isExtensible;
ecma_SetPointer( pObject->u.Object.pPrototypeObject, pPrototypeObject);
ecma_set_pointer( pObject->u.Object.pPrototypeObject, pPrototypeObject);
return pObject;
} /* ecma_CreateObject */
} /* ecma_create_object */
/**
* Create a lexical environment with specified outer lexical environment
@ -109,11 +109,11 @@ ecma_CreateObject( ecma_Object_t *pPrototypeObject, /**< pointer to prototybe of
*
* @return pointer to the descriptor of lexical environment
*/
ecma_Object_t*
ecma_CreateLexicalEnvironment(ecma_Object_t *pOuterLexicalEnvironment, /**< outer lexical environment */
ecma_LexicalEnvironmentType_t type) /**< type of lexical environment to create */
ecma_object_t*
ecma_create_lexical_environment(ecma_object_t *pOuterLexicalEnvironment, /**< outer lexical environment */
ecma_lexical_environment_type_t type) /**< type of lexical environment to create */
{
ecma_Object_t *pNewLexicalEnvironment = ecma_AllocObject();
ecma_object_t *pNewLexicalEnvironment = ecma_alloc_object();
pNewLexicalEnvironment->IsLexicalEnvironment = true;
pNewLexicalEnvironment->u.LexicalEnvironment.Type = type;
@ -123,10 +123,10 @@ ecma_CreateLexicalEnvironment(ecma_Object_t *pOuterLexicalEnvironment, /**< oute
pNewLexicalEnvironment->GCInfo.IsObjectValid = true;
pNewLexicalEnvironment->GCInfo.u.Refs = 1;
ecma_SetPointer( pNewLexicalEnvironment->u.LexicalEnvironment.pOuterReference, pOuterLexicalEnvironment);
ecma_set_pointer( pNewLexicalEnvironment->u.LexicalEnvironment.pOuterReference, pOuterLexicalEnvironment);
return pNewLexicalEnvironment;
} /* ecma_CreateLexicalEnvironment */
} /* ecma_create_lexical_environment */
/**
* Create internal property in an object and link it
@ -134,22 +134,22 @@ ecma_CreateLexicalEnvironment(ecma_Object_t *pOuterLexicalEnvironment, /**< oute
*
* @return pointer to newly created property's des
*/
ecma_Property_t*
ecma_CreateInternalProperty(ecma_Object_t *pObject, /**< the object */
ecma_InternalPropertyId_t propertyId) /**< internal property identifier */
ecma_property_t*
ecma_create_internal_property(ecma_object_t *pObject, /**< the object */
ecma_internal_property_id_t propertyId) /**< internal property identifier */
{
ecma_Property_t *pNewProperty = ecma_AllocProperty();
ecma_property_t *pNewProperty = ecma_alloc_property();
pNewProperty->Type = ECMA_PROPERTY_INTERNAL;
ecma_SetPointer( pNewProperty->pNextProperty, ecma_GetPointer( pObject->pProperties));
ecma_SetPointer( pObject->pProperties, pNewProperty);
ecma_set_pointer( pNewProperty->pNextProperty, ecma_get_pointer( pObject->pProperties));
ecma_set_pointer( pObject->pProperties, pNewProperty);
pNewProperty->u.InternalProperty.InternalPropertyType = propertyId;
pNewProperty->u.InternalProperty.Value = ECMA_NULL_POINTER;
return pNewProperty;
} /* ecma_CreateInternalProperty */
} /* ecma_create_internal_property */
/**
* Find internal property in the object's property set.
@ -157,18 +157,18 @@ ecma_CreateInternalProperty(ecma_Object_t *pObject, /**< the object */
* @return pointer to the property, if it is found,
* NULL - otherwise.
*/
ecma_Property_t*
ecma_FindInternalProperty(ecma_Object_t *pObject, /**< object descriptor */
ecma_InternalPropertyId_t propertyId) /**< internal property identifier */
ecma_property_t*
ecma_find_internal_property(ecma_object_t *pObject, /**< object descriptor */
ecma_internal_property_id_t propertyId) /**< internal property identifier */
{
JERRY_ASSERT( pObject != NULL );
JERRY_ASSERT( propertyId != ECMA_INTERNAL_PROPERTY_PROTOTYPE
&& propertyId != ECMA_INTERNAL_PROPERTY_EXTENSIBLE );
for ( ecma_Property_t *pProperty = ecma_GetPointer( pObject->pProperties);
for ( ecma_property_t *pProperty = ecma_get_pointer( pObject->pProperties);
pProperty != NULL;
pProperty = ecma_GetPointer( pProperty->pNextProperty) )
pProperty = ecma_get_pointer( pProperty->pNextProperty) )
{
if ( pProperty->Type == ECMA_PROPERTY_INTERNAL )
{
@ -180,7 +180,7 @@ ecma_FindInternalProperty(ecma_Object_t *pObject, /**< object descriptor */
}
return NULL;
} /* ecma_FindInternalProperty */
} /* ecma_find_internal_property */
/**
* Get an internal property.
@ -190,16 +190,16 @@ ecma_FindInternalProperty(ecma_Object_t *pObject, /**< object descriptor */
*
* @return pointer to the property
*/
ecma_Property_t*
ecma_GetInternalProperty(ecma_Object_t *pObject, /**< object descriptor */
ecma_InternalPropertyId_t propertyId) /**< internal property identifier */
ecma_property_t*
ecma_get_internal_property(ecma_object_t *pObject, /**< object descriptor */
ecma_internal_property_id_t propertyId) /**< internal property identifier */
{
ecma_Property_t *pProperty = ecma_FindInternalProperty( pObject, propertyId);
ecma_property_t *pProperty = ecma_find_internal_property( pObject, propertyId);
JERRY_ASSERT( pProperty != NULL );
return pProperty;
} /* ecma_GetInternalProperty */
} /* ecma_get_internal_property */
/**
* Create named data property with given name, attributes and undefined value
@ -207,32 +207,32 @@ ecma_GetInternalProperty(ecma_Object_t *pObject, /**< object descriptor */
*
* @return pointer to newly created property
*/
ecma_Property_t*
ecma_CreateNamedProperty(ecma_Object_t *obj_p, /**< object */
ecma_Char_t *name_p, /**< property name */
ecma_PropertyWritableValue_t writable, /**< 'writable' attribute */
ecma_PropertyEnumerableValue_t enumerable, /**< 'enumerable' attribute */
ecma_PropertyConfigurableValue_t configurable) /**< 'configurable' attribute */
ecma_property_t*
ecma_create_named_property(ecma_object_t *obj_p, /**< object */
ecma_char_t *name_p, /**< property name */
ecma_property_writable_value_t writable, /**< 'writable' attribute */
ecma_property_enumerable_value_t enumerable, /**< 'enumerable' attribute */
ecma_property_configurable_value_t configurable) /**< 'configurable' attribute */
{
JERRY_ASSERT( obj_p != NULL && name_p != NULL );
ecma_Property_t *prop = ecma_AllocProperty();
ecma_property_t *prop = ecma_alloc_property();
prop->Type = ECMA_PROPERTY_NAMEDDATA;
ecma_SetPointer( prop->u.NamedDataProperty.pName, ecma_NewEcmaString( name_p));
ecma_set_pointer( prop->u.NamedDataProperty.pName, ecma_new_ecma_string( name_p));
prop->u.NamedDataProperty.Writable = writable;
prop->u.NamedDataProperty.Enumerable = enumerable;
prop->u.NamedDataProperty.Configurable = configurable;
prop->u.NamedDataProperty.Value = ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_UNDEFINED);
prop->u.NamedDataProperty.Value = ecma_make_simple_value( ECMA_SIMPLE_VALUE_UNDEFINED);
ecma_SetPointer( prop->pNextProperty, ecma_GetPointer( obj_p->pProperties));
ecma_SetPointer( obj_p->pProperties, prop);
ecma_set_pointer( prop->pNextProperty, ecma_get_pointer( obj_p->pProperties));
ecma_set_pointer( obj_p->pProperties, prop);
return prop;
} /* ecma_CreateNamedProperty */
} /* ecma_create_named_property */
/**
* Find named data property or named access property in specified object.
@ -240,25 +240,25 @@ ecma_CreateNamedProperty(ecma_Object_t *obj_p, /**< object */
* @return pointer to the property, if it is found,
* NULL - otherwise.
*/
ecma_Property_t*
ecma_FindNamedProperty(ecma_Object_t *obj_p, /**< object to find property in */
ecma_Char_t *name_p) /**< property's name */
ecma_property_t*
ecma_find_named_property(ecma_object_t *obj_p, /**< object to find property in */
ecma_char_t *name_p) /**< property's name */
{
JERRY_ASSERT( obj_p != NULL );
JERRY_ASSERT( name_p != NULL );
for ( ecma_Property_t *property_p = ecma_GetPointer( obj_p->pProperties);
for ( ecma_property_t *property_p = ecma_get_pointer( obj_p->pProperties);
property_p != NULL;
property_p = ecma_GetPointer( property_p->pNextProperty) )
property_p = ecma_get_pointer( property_p->pNextProperty) )
{
ecma_ArrayFirstChunk_t *property_name_p;
ecma_array_first_chunk_t *property_name_p;
if ( property_p->Type == ECMA_PROPERTY_NAMEDDATA )
{
property_name_p = ecma_GetPointer( property_p->u.NamedDataProperty.pName);
property_name_p = ecma_get_pointer( property_p->u.NamedDataProperty.pName);
} else if ( property_p->Type == ECMA_PROPERTY_NAMEDACCESSOR )
{
property_name_p = ecma_GetPointer( property_p->u.NamedAccessorProperty.pName);
property_name_p = ecma_get_pointer( property_p->u.NamedAccessorProperty.pName);
} else
{
continue;
@ -266,14 +266,14 @@ ecma_FindNamedProperty(ecma_Object_t *obj_p, /**< object to find property in */
JERRY_ASSERT( property_name_p != NULL );
if ( ecma_CompareZtStringToEcmaString( name_p, property_name_p) )
if ( ecma_compare_zt_string_to_ecma_string( name_p, property_name_p) )
{
return property_p;
}
}
return NULL;
} /* ecma_FindNamedProperty */
} /* ecma_find_named_property */
/**
* Get named data property or named access property in specified object.
@ -284,19 +284,19 @@ ecma_FindNamedProperty(ecma_Object_t *obj_p, /**< object to find property in */
* @return pointer to the property, if it is found,
* NULL - otherwise.
*/
ecma_Property_t*
ecma_GetNamedProperty(ecma_Object_t *obj_p, /**< object to find property in */
ecma_Char_t *name_p) /**< property's name */
ecma_property_t*
ecma_get_named_property(ecma_object_t *obj_p, /**< object to find property in */
ecma_char_t *name_p) /**< property's name */
{
JERRY_ASSERT( obj_p != NULL );
JERRY_ASSERT( name_p != NULL );
ecma_Property_t *property_p = ecma_FindNamedProperty( obj_p, name_p);
ecma_property_t *property_p = ecma_find_named_property( obj_p, name_p);
JERRY_ASSERT( property_p != NULL );
return property_p;
} /* ecma_GetNamedProperty */
} /* ecma_get_named_property */
/**
* Get named data property in specified object.
@ -307,69 +307,69 @@ ecma_GetNamedProperty(ecma_Object_t *obj_p, /**< object to find property in */
* @return pointer to the property, if it is found,
* NULL - otherwise.
*/
ecma_Property_t*
ecma_GetNamedDataProperty(ecma_Object_t *obj_p, /**< object to find property in */
ecma_Char_t *name_p) /**< property's name */
ecma_property_t*
ecma_get_named_data_property(ecma_object_t *obj_p, /**< object to find property in */
ecma_char_t *name_p) /**< property's name */
{
JERRY_ASSERT( obj_p != NULL );
JERRY_ASSERT( name_p != NULL );
ecma_Property_t *property_p = ecma_FindNamedProperty( obj_p, name_p);
ecma_property_t *property_p = ecma_find_named_property( obj_p, name_p);
JERRY_ASSERT( property_p != NULL && property_p->Type == ECMA_PROPERTY_NAMEDDATA );
return property_p;
} /* ecma_GetNamedDataProperty */
} /* ecma_get_named_data_property */
/**
* Free the named data property and values it references.
*/
void
ecma_FreeNamedDataProperty( ecma_Property_t *pProperty) /**< the property */
ecma_free_named_data_property( ecma_property_t *pProperty) /**< the property */
{
JERRY_ASSERT( pProperty->Type == ECMA_PROPERTY_NAMEDDATA );
ecma_FreeArray( ecma_GetPointer( pProperty->u.NamedDataProperty.pName));
ecma_FreeValue( pProperty->u.NamedDataProperty.Value);
ecma_free_array( ecma_get_pointer( pProperty->u.NamedDataProperty.pName));
ecma_free_value( pProperty->u.NamedDataProperty.Value);
ecma_DeallocProperty( pProperty);
} /* ecma_FreeNamedDataProperty */
ecma_dealloc_property( pProperty);
} /* ecma_free_named_data_property */
/**
* Free the named accessor property and values it references.
*/
void
ecma_FreeNamedAccessorProperty( ecma_Property_t *pProperty) /**< the property */
ecma_free_named_accessor_property( ecma_property_t *pProperty) /**< the property */
{
JERRY_ASSERT( pProperty->Type == ECMA_PROPERTY_NAMEDACCESSOR );
ecma_FreeArray( ecma_GetPointer( pProperty->u.NamedAccessorProperty.pName));
ecma_free_array( ecma_get_pointer( pProperty->u.NamedAccessorProperty.pName));
ecma_Object_t *pGet = ecma_GetPointer(pProperty->u.NamedAccessorProperty.pGet);
ecma_Object_t *pSet = ecma_GetPointer(pProperty->u.NamedAccessorProperty.pSet);
ecma_object_t *pGet = ecma_get_pointer(pProperty->u.NamedAccessorProperty.pGet);
ecma_object_t *pSet = ecma_get_pointer(pProperty->u.NamedAccessorProperty.pSet);
if ( pGet != NULL )
{
ecma_DerefObject( pGet);
ecma_deref_object( pGet);
}
if ( pSet != NULL )
{
ecma_DerefObject( pSet);
ecma_deref_object( pSet);
}
ecma_DeallocProperty( pProperty);
} /* ecma_FreeNamedAccessorProperty */
ecma_dealloc_property( pProperty);
} /* ecma_free_named_accessor_property */
/**
* Free the internal property and values it references.
*/
void
ecma_FreeInternalProperty( ecma_Property_t *pProperty) /**< the property */
ecma_free_internal_property( ecma_property_t *pProperty) /**< the property */
{
JERRY_ASSERT( pProperty->Type == ECMA_PROPERTY_INTERNAL );
ecma_InternalPropertyId_t propertyId = pProperty->u.InternalProperty.InternalPropertyType;
ecma_internal_property_id_t propertyId = pProperty->u.InternalProperty.InternalPropertyType;
uint32_t propertyValue = pProperty->u.InternalProperty.Value;
switch ( propertyId )
@ -378,58 +378,58 @@ ecma_FreeInternalProperty( ecma_Property_t *pProperty) /**< the property */
case ECMA_INTERNAL_PROPERTY_NUMBER_INDEXED_ARRAY_VALUES: /* an array */
case ECMA_INTERNAL_PROPERTY_STRING_INDEXED_ARRAY_VALUES: /* an array */
{
ecma_FreeArray( ecma_GetPointer( propertyValue));
ecma_free_array( ecma_get_pointer( propertyValue));
break;
}
case ECMA_INTERNAL_PROPERTY_SCOPE: /* a lexical environment */
case ECMA_INTERNAL_PROPERTY_BINDING_OBJECT: /* an object */
{
ecma_DerefObject( ecma_GetPointer( propertyValue));
ecma_deref_object( ecma_get_pointer( propertyValue));
break;
}
case ECMA_INTERNAL_PROPERTY_PROTOTYPE: /* the property's value is located in ecma_Object_t */
case ECMA_INTERNAL_PROPERTY_EXTENSIBLE: /* the property's value is located in ecma_Object_t */
case ECMA_INTERNAL_PROPERTY_PROTOTYPE: /* the property's value is located in ecma_object_t */
case ECMA_INTERNAL_PROPERTY_EXTENSIBLE: /* the property's value is located in ecma_object_t */
case ECMA_INTERNAL_PROPERTY_PROVIDE_THIS: /* a boolean flag */
{
break;
}
}
ecma_DeallocProperty( pProperty);
} /* ecma_FreeInternalProperty */
ecma_dealloc_property( pProperty);
} /* ecma_free_internal_property */
/**
* Free the property and values it references.
*/
void
ecma_FreeProperty(ecma_Property_t *prop_p) /**< property */
ecma_free_property(ecma_property_t *prop_p) /**< property */
{
switch ( (ecma_PropertyType_t) prop_p->Type )
switch ( (ecma_property_type_t) prop_p->Type )
{
case ECMA_PROPERTY_NAMEDDATA:
{
ecma_FreeNamedDataProperty( prop_p);
ecma_free_named_data_property( prop_p);
break;
}
case ECMA_PROPERTY_NAMEDACCESSOR:
{
ecma_FreeNamedAccessorProperty( prop_p);
ecma_free_named_accessor_property( prop_p);
break;
}
case ECMA_PROPERTY_INTERNAL:
{
ecma_FreeInternalProperty( prop_p);
ecma_free_internal_property( prop_p);
break;
}
}
} /* ecma_FreeProperty */
} /* ecma_free_property */
/**
* Delete the object's property.
@ -437,25 +437,25 @@ ecma_FreeProperty(ecma_Property_t *prop_p) /**< property */
* Warning: specified property must be owned by specified object.
*/
void
ecma_DeleteProperty(ecma_Object_t *obj_p, /**< object */
ecma_Property_t *prop_p) /**< property */
ecma_delete_property(ecma_object_t *obj_p, /**< object */
ecma_property_t *prop_p) /**< property */
{
for ( ecma_Property_t *cur_prop_p = ecma_GetPointer( obj_p->pProperties), *prev_prop_p = NULL, *next_prop_p;
for ( ecma_property_t *cur_prop_p = ecma_get_pointer( obj_p->pProperties), *prev_prop_p = NULL, *next_prop_p;
cur_prop_p != NULL;
prev_prop_p = cur_prop_p, cur_prop_p = next_prop_p )
{
next_prop_p = ecma_GetPointer( cur_prop_p->pNextProperty);
next_prop_p = ecma_get_pointer( cur_prop_p->pNextProperty);
if ( cur_prop_p == prop_p )
{
ecma_FreeProperty( prop_p);
ecma_free_property( prop_p);
if ( prev_prop_p == NULL )
{
ecma_SetPointer( obj_p->pProperties, next_prop_p);
ecma_set_pointer( obj_p->pProperties, next_prop_p);
} else
{
ecma_SetPointer( prev_prop_p->pNextProperty, next_prop_p);
ecma_set_pointer( prev_prop_p->pNextProperty, next_prop_p);
}
return;
@ -463,62 +463,62 @@ ecma_DeleteProperty(ecma_Object_t *obj_p, /**< object */
}
JERRY_UNREACHABLE();
} /* ecma_DeleteProperty */
} /* ecma_delete_property */
/**
* Allocate new ecma-string and fill it with characters from specified buffer
*
* @return Pointer to first chunk of an array, containing allocated string
*/
ecma_ArrayFirstChunk_t*
ecma_NewEcmaString(const ecma_Char_t *pString) /**< zero-terminated string of ecma-characters */
ecma_array_first_chunk_t*
ecma_new_ecma_string(const ecma_char_t *pString) /**< zero-terminated string of ecma-characters */
{
ecma_Length_t length = 0;
ecma_length_t length = 0;
/*
* TODO: Do not precalculate length.
*/
if ( pString != NULL )
{
const ecma_Char_t *iter_p = pString;
const ecma_char_t *iter_p = pString;
while ( *iter_p++ )
{
length++;
}
}
ecma_ArrayFirstChunk_t *pStringFirstChunk = ecma_AllocArrayFirstChunk();
ecma_array_first_chunk_t *pStringFirstChunk = ecma_alloc_array_first_chunk();
pStringFirstChunk->Header.UnitNumber = length;
uint8_t *copyPointer = (uint8_t*) pString;
size_t charsLeft = length;
size_t charsToCopy = JERRY_MIN( length, sizeof (pStringFirstChunk->Data) / sizeof (ecma_Char_t));
__memcpy(pStringFirstChunk->Data, copyPointer, charsToCopy * sizeof (ecma_Char_t));
size_t charsToCopy = JERRY_MIN( length, sizeof (pStringFirstChunk->Data) / sizeof (ecma_char_t));
__memcpy(pStringFirstChunk->Data, copyPointer, charsToCopy * sizeof (ecma_char_t));
charsLeft -= charsToCopy;
copyPointer += charsToCopy * sizeof (ecma_Char_t);
copyPointer += charsToCopy * sizeof (ecma_char_t);
ecma_ArrayNonFirstChunk_t *pStringNonFirstChunk;
ecma_array_non_first_chunk_t *pStringNonFirstChunk;
JERRY_STATIC_ASSERT( ECMA_POINTER_FIELD_WIDTH <= sizeof(uint16_t) * JERRY_BITSINBYTE );
uint16_t *pNextChunkCompressedPointer = &pStringFirstChunk->Header.pNextChunk;
while ( charsLeft > 0 )
{
pStringNonFirstChunk = ecma_AllocArrayNonFirstChunk();
pStringNonFirstChunk = ecma_alloc_array_non_first_chunk();
size_t charsToCopy = JERRY_MIN( charsLeft, sizeof (pStringNonFirstChunk->Data) / sizeof (ecma_Char_t));
__memcpy(pStringNonFirstChunk->Data, copyPointer, charsToCopy * sizeof (ecma_Char_t));
size_t charsToCopy = JERRY_MIN( charsLeft, sizeof (pStringNonFirstChunk->Data) / sizeof (ecma_char_t));
__memcpy(pStringNonFirstChunk->Data, copyPointer, charsToCopy * sizeof (ecma_char_t));
charsLeft -= charsToCopy;
copyPointer += charsToCopy * sizeof (ecma_Char_t);
copyPointer += charsToCopy * sizeof (ecma_char_t);
ecma_SetPointer( *pNextChunkCompressedPointer, pStringNonFirstChunk);
ecma_set_pointer( *pNextChunkCompressedPointer, pStringNonFirstChunk);
pNextChunkCompressedPointer = &pStringNonFirstChunk->pNextChunk;
}
*pNextChunkCompressedPointer = ECMA_NULL_POINTER;
return pStringFirstChunk;
} /* ecma_NewEcmaString */
} /* ecma_new_ecma_string */
/**
* Copy ecma-string's contents to a buffer.
@ -530,78 +530,78 @@ ecma_NewEcmaString(const ecma_Char_t *pString) /**< zero-terminated string of ec
* to hold the string's content (in case size of buffer is insuficcient).
*/
ssize_t
ecma_CopyEcmaStringCharsToBuffer(ecma_ArrayFirstChunk_t *pFirstChunk, /**< first chunk of ecma-string */
ecma_copy_ecma_string_chars_to_buffer(ecma_array_first_chunk_t *pFirstChunk, /**< first chunk of ecma-string */
uint8_t *pBuffer, /**< destination buffer */
size_t bufferSize) /**< size of buffer */
{
ecma_Length_t stringLength = pFirstChunk->Header.UnitNumber;
size_t requiredBufferSize = sizeof (ecma_Length_t) + sizeof (ecma_Char_t) * stringLength;
ecma_length_t stringLength = pFirstChunk->Header.UnitNumber;
size_t requiredBufferSize = sizeof (ecma_length_t) + sizeof (ecma_char_t) * stringLength;
if ( requiredBufferSize < bufferSize )
{
return -(ssize_t) requiredBufferSize;
}
*(ecma_Length_t*) pBuffer = stringLength;
*(ecma_length_t*) pBuffer = stringLength;
size_t charsLeft = stringLength;
uint8_t *destPointer = pBuffer + sizeof (ecma_Length_t);
size_t copyChunkChars = JERRY_MIN(sizeof (pFirstChunk->Data) / sizeof (ecma_Char_t),
uint8_t *destPointer = pBuffer + sizeof (ecma_length_t);
size_t copyChunkChars = JERRY_MIN(sizeof (pFirstChunk->Data) / sizeof (ecma_char_t),
charsLeft);
__memcpy( destPointer, pFirstChunk->Data, copyChunkChars * sizeof (ecma_Char_t));
destPointer += copyChunkChars * sizeof (ecma_Char_t);
__memcpy( destPointer, pFirstChunk->Data, copyChunkChars * sizeof (ecma_char_t));
destPointer += copyChunkChars * sizeof (ecma_char_t);
charsLeft -= copyChunkChars;
ecma_ArrayNonFirstChunk_t *pNonFirstChunk = ecma_GetPointer( pFirstChunk->Header.pNextChunk);
ecma_array_non_first_chunk_t *pNonFirstChunk = ecma_get_pointer( pFirstChunk->Header.pNextChunk);
while ( charsLeft > 0 )
{
JERRY_ASSERT( charsLeft < stringLength );
copyChunkChars = JERRY_MIN(sizeof (pNonFirstChunk->Data) / sizeof (ecma_Char_t),
copyChunkChars = JERRY_MIN(sizeof (pNonFirstChunk->Data) / sizeof (ecma_char_t),
charsLeft);
__memcpy( destPointer, pNonFirstChunk->Data, copyChunkChars * sizeof (ecma_Char_t));
destPointer += copyChunkChars * sizeof (ecma_Char_t);
__memcpy( destPointer, pNonFirstChunk->Data, copyChunkChars * sizeof (ecma_char_t));
destPointer += copyChunkChars * sizeof (ecma_char_t);
charsLeft -= copyChunkChars;
pNonFirstChunk = ecma_GetPointer( pNonFirstChunk->pNextChunk);
pNonFirstChunk = ecma_get_pointer( pNonFirstChunk->pNextChunk);
}
return (ssize_t) requiredBufferSize;
} /* ecma_CopyEcmaStringCharsToBuffer */
} /* ecma_copy_ecma_string_chars_to_buffer */
/**
* Duplicate an ecma-string.
*
* @return pointer to new ecma-string's first chunk
*/
ecma_ArrayFirstChunk_t*
ecma_DuplicateEcmaString( ecma_ArrayFirstChunk_t *pFirstChunk) /**< first chunk of string to duplicate */
ecma_array_first_chunk_t*
ecma_duplicate_ecma_string( ecma_array_first_chunk_t *pFirstChunk) /**< first chunk of string to duplicate */
{
JERRY_ASSERT( pFirstChunk != NULL );
ecma_ArrayFirstChunk_t *pFirstChunkCopy = ecma_AllocArrayFirstChunk();
__memcpy( pFirstChunkCopy, pFirstChunk, sizeof (ecma_ArrayFirstChunk_t));
ecma_array_first_chunk_t *pFirstChunkCopy = ecma_alloc_array_first_chunk();
__memcpy( pFirstChunkCopy, pFirstChunk, sizeof (ecma_array_first_chunk_t));
ecma_ArrayNonFirstChunk_t *pNonFirstChunk, *pNonFirstChunkCopy;
pNonFirstChunk = ecma_GetPointer( pFirstChunk->Header.pNextChunk);
ecma_array_non_first_chunk_t *pNonFirstChunk, *pNonFirstChunkCopy;
pNonFirstChunk = ecma_get_pointer( pFirstChunk->Header.pNextChunk);
uint16_t *pNextPointer = &pFirstChunkCopy->Header.pNextChunk;
while ( pNonFirstChunk != NULL )
{
pNonFirstChunkCopy = ecma_AllocArrayNonFirstChunk();
ecma_SetPointer( *pNextPointer, pNonFirstChunkCopy);
pNonFirstChunkCopy = ecma_alloc_array_non_first_chunk();
ecma_set_pointer( *pNextPointer, pNonFirstChunkCopy);
pNextPointer = &pNonFirstChunkCopy->pNextChunk;
__memcpy( pNonFirstChunkCopy, pNonFirstChunk, sizeof (ecma_ArrayNonFirstChunk_t));
__memcpy( pNonFirstChunkCopy, pNonFirstChunk, sizeof (ecma_array_non_first_chunk_t));
pNonFirstChunk = ecma_GetPointer( pNonFirstChunk->pNextChunk);
pNonFirstChunk = ecma_get_pointer( pNonFirstChunk->pNextChunk);
}
*pNextPointer = ECMA_NULL_POINTER;
return pFirstChunkCopy;
} /* ecma_DuplicateEcmaString */
} /* ecma_duplicate_ecma_string */
/**
* Compare zero-terminated string to ecma-string
@ -610,11 +610,11 @@ ecma_DuplicateEcmaString( ecma_ArrayFirstChunk_t *pFirstChunk) /**< first chunk
* false - otherwise.
*/
bool
ecma_CompareEcmaStringToEcmaString(const ecma_ArrayFirstChunk_t *string1_p, /* ecma-string */
const ecma_ArrayFirstChunk_t *string2_p) /* ecma-string */
ecma_compare_ecma_string_to_ecma_string(const ecma_array_first_chunk_t *string1_p, /* ecma-string */
const ecma_array_first_chunk_t *string2_p) /* ecma-string */
{
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( string1_p, string2_p);
} /* ecma_CompareEcmaStringToEcmaString */
} /* ecma_compare_ecma_string_to_ecma_string */
/**
* Compare zero-terminated string to ecma-string
@ -623,22 +623,22 @@ ecma_CompareEcmaStringToEcmaString(const ecma_ArrayFirstChunk_t *string1_p, /* e
* false - otherwise.
*/
bool
ecma_CompareZtStringToEcmaString(const ecma_Char_t *pString, /**< zero-terminated string */
const ecma_ArrayFirstChunk_t *pEcmaString) /* ecma-string */
ecma_compare_zt_string_to_ecma_string(const ecma_char_t *pString, /**< zero-terminated string */
const ecma_array_first_chunk_t *pEcmaString) /* ecma-string */
{
JERRY_ASSERT( pString != NULL );
JERRY_ASSERT( pEcmaString != NULL );
const ecma_Char_t *str_iter_p = pString;
ecma_Length_t ecma_str_len = pEcmaString->Header.UnitNumber;
const ecma_Char_t *current_chunk_chars_cur = (ecma_Char_t*) pEcmaString->Data,
*current_chunk_chars_end = (ecma_Char_t*) (pEcmaString->Data
const ecma_char_t *str_iter_p = pString;
ecma_length_t ecma_str_len = pEcmaString->Header.UnitNumber;
const ecma_char_t *current_chunk_chars_cur = (ecma_char_t*) pEcmaString->Data,
*current_chunk_chars_end = (ecma_char_t*) (pEcmaString->Data
+ sizeof(pEcmaString->Data));
JERRY_STATIC_ASSERT( ECMA_POINTER_FIELD_WIDTH <= sizeof(uint16_t) * JERRY_BITSINBYTE );
const uint16_t *next_chunk_compressed_pointer_p = &pEcmaString->Header.pNextChunk;
for ( ecma_Length_t str_index = 0;
for ( ecma_length_t str_index = 0;
str_index < ecma_str_len;
str_index++, str_iter_p++, current_chunk_chars_cur++ )
{
@ -647,12 +647,12 @@ ecma_CompareZtStringToEcmaString(const ecma_Char_t *pString, /**< zero-terminate
if ( current_chunk_chars_cur == current_chunk_chars_end )
{
/* switching to next chunk */
ecma_ArrayNonFirstChunk_t *next_chunk_p = ecma_GetPointer( *next_chunk_compressed_pointer_p);
ecma_array_non_first_chunk_t *next_chunk_p = ecma_get_pointer( *next_chunk_compressed_pointer_p);
JERRY_ASSERT( next_chunk_p != NULL );
current_chunk_chars_cur = (ecma_Char_t*) pEcmaString->Data;
current_chunk_chars_end = (ecma_Char_t*) (next_chunk_p->Data + sizeof(next_chunk_p->Data));
current_chunk_chars_cur = (ecma_char_t*) pEcmaString->Data;
current_chunk_chars_end = (ecma_char_t*) (next_chunk_p->Data + sizeof(next_chunk_p->Data));
next_chunk_compressed_pointer_p = &next_chunk_p->pNextChunk;
}
@ -676,29 +676,29 @@ ecma_CompareZtStringToEcmaString(const ecma_Char_t *pString, /**< zero-terminate
* Otherwise zero-terminated string is longer.
*/
return ( *str_iter_p == 0 );
} /* ecma_CompareZtStringToEcmaString */
} /* ecma_compare_zt_string_to_ecma_string */
/**
* Free all chunks of an array
*/
void
ecma_FreeArray( ecma_ArrayFirstChunk_t *pFirstChunk) /**< first chunk of the array */
ecma_free_array( ecma_array_first_chunk_t *pFirstChunk) /**< first chunk of the array */
{
JERRY_ASSERT( pFirstChunk != NULL );
ecma_ArrayNonFirstChunk_t *pNonFirstChunk = ecma_GetPointer( pFirstChunk->Header.pNextChunk);
ecma_array_non_first_chunk_t *pNonFirstChunk = ecma_get_pointer( pFirstChunk->Header.pNextChunk);
ecma_DeallocArrayFirstChunk( pFirstChunk);
ecma_dealloc_array_first_chunk( pFirstChunk);
while ( pNonFirstChunk != NULL )
{
ecma_ArrayNonFirstChunk_t *pNextChunk = ecma_GetPointer( pNonFirstChunk->pNextChunk);
ecma_array_non_first_chunk_t *pNextChunk = ecma_get_pointer( pNonFirstChunk->pNextChunk);
ecma_DeallocArrayNonFirstChunk( pNonFirstChunk);
ecma_dealloc_array_non_first_chunk( pNonFirstChunk);
pNonFirstChunk = pNextChunk;
}
} /* ecma_FreeArray */
} /* ecma_free_array */
/**
* @}

View File

@ -25,73 +25,73 @@
#include "ecma-globals.h"
extern uintptr_t ecma_CompressPointer(void *pointer);
extern void* ecma_DecompressPointer(uintptr_t compressedPointer);
extern uintptr_t ecma_compress_pointer(void *pointer);
extern void* ecma_decompress_pointer(uintptr_t compressedPointer);
/**
* Get value of pointer from specified compressed pointer field.
*/
#define ecma_GetPointer( field) \
ecma_DecompressPointer( field)
#define ecma_get_pointer( field) \
ecma_decompress_pointer( field)
/**
* Set value of compressed pointer field so that it will correspond
* to specified nonCompressedPointer.
*/
#define ecma_SetPointer( field, nonCompressedPointer) \
(field) = ecma_CompressPointer( nonCompressedPointer) & ( ( 1u << ECMA_POINTER_FIELD_WIDTH ) - 1)
#define ecma_set_pointer( field, nonCompressedPointer) \
(field) = ecma_compress_pointer( nonCompressedPointer) & ( ( 1u << ECMA_POINTER_FIELD_WIDTH ) - 1)
/* ecma-helpers-value.c */
extern bool ecma_IsValueUndefined( ecma_Value_t value);
extern bool ecma_IsValueNull( ecma_Value_t value);
extern bool ecma_IsValueBoolean( ecma_Value_t value);
extern bool ecma_IsValueTrue( ecma_Value_t value);
extern bool ecma_is_value_undefined( ecma_value_t value);
extern bool ecma_is_value_null( ecma_value_t value);
extern bool ecma_is_value_boolean( ecma_value_t value);
extern bool ecma_is_value_true( ecma_value_t value);
extern ecma_Value_t ecma_MakeSimpleValue( ecma_SimpleValue_t value);
extern ecma_Value_t ecma_MakeNumberValue( ecma_Number_t* num_p);
extern ecma_Value_t ecma_make_string_value( ecma_ArrayFirstChunk_t* ecma_string_p);
extern ecma_Value_t ecma_MakeObjectValue( ecma_Object_t* object_p);
extern ecma_Value_t ecma_CopyValue( const ecma_Value_t value);
extern void ecma_FreeValue( const ecma_Value_t value);
extern ecma_value_t ecma_make_simple_value( ecma_simple_value_t value);
extern ecma_value_t ecma_make_number_value( ecma_number_t* num_p);
extern ecma_value_t ecma_make_string_value( ecma_array_first_chunk_t* ecma_string_p);
extern ecma_value_t ecma_make_object_value( ecma_object_t* object_p);
extern ecma_value_t ecma_copy_value( const ecma_value_t value);
extern void ecma_free_value( const ecma_value_t value);
extern ecma_CompletionValue_t ecma_MakeCompletionValue( ecma_CompletionType_t type, ecma_Value_t value, uint8_t target);
extern ecma_CompletionValue_t ecma_MakeThrowValue( ecma_Object_t *exception_p);
extern ecma_CompletionValue_t ecma_make_empty_completion_value( void);
extern ecma_CompletionValue_t ecma_copy_completion_value( ecma_CompletionValue_t value);
extern void ecma_free_completion_value( ecma_CompletionValue_t completion_value);
extern ecma_completion_value_t ecma_make_completion_value( ecma_completion_type_t type, ecma_value_t value, uint8_t target);
extern ecma_completion_value_t ecma_make_throw_value( ecma_object_t *exception_p);
extern ecma_completion_value_t ecma_make_empty_completion_value( void);
extern ecma_completion_value_t ecma_copy_completion_value( ecma_completion_value_t value);
extern void ecma_free_completion_value( ecma_completion_value_t completion_value);
extern bool ecma_is_completion_value_normal( ecma_CompletionValue_t value);
extern bool ecma_is_completion_value_throw( ecma_CompletionValue_t value);
extern bool ecma_is_completion_value_normal_simple_value( ecma_CompletionValue_t value, ecma_SimpleValue_t simple_value);
extern bool ecma_IsCompletionValueNormalFalse( ecma_CompletionValue_t value);
extern bool ecma_IsCompletionValueNormalTrue( ecma_CompletionValue_t value);
extern bool ecma_is_completion_value_normal( ecma_completion_value_t value);
extern bool ecma_is_completion_value_throw( ecma_completion_value_t value);
extern bool ecma_is_completion_value_normal_simple_value( ecma_completion_value_t value, ecma_simple_value_t simple_value);
extern bool ecma_is_completion_value_normal_false( ecma_completion_value_t value);
extern bool ecma_is_completion_value_normal_true( ecma_completion_value_t value);
extern ecma_Object_t* ecma_CreateObject( ecma_Object_t *pPrototypeObject, bool isExtensible);
extern ecma_Object_t* ecma_CreateLexicalEnvironment( ecma_Object_t *pOuterLexicalEnvironment, ecma_LexicalEnvironmentType_t type);
extern ecma_object_t* ecma_create_object( ecma_object_t *pPrototypeObject, bool isExtensible);
extern ecma_object_t* ecma_create_lexical_environment( ecma_object_t *pOuterLexicalEnvironment, ecma_lexical_environment_type_t type);
/* ecma-helpers.c */
extern ecma_Property_t* ecma_CreateInternalProperty(ecma_Object_t *pObject, ecma_InternalPropertyId_t propertyId);
extern ecma_Property_t* ecma_FindInternalProperty(ecma_Object_t *pObject, ecma_InternalPropertyId_t propertyId);
extern ecma_Property_t* ecma_GetInternalProperty(ecma_Object_t *pObject, ecma_InternalPropertyId_t propertyId);
extern ecma_property_t* ecma_create_internal_property(ecma_object_t *pObject, ecma_internal_property_id_t propertyId);
extern ecma_property_t* ecma_find_internal_property(ecma_object_t *pObject, ecma_internal_property_id_t propertyId);
extern ecma_property_t* ecma_get_internal_property(ecma_object_t *pObject, ecma_internal_property_id_t propertyId);
extern ecma_Property_t *ecma_CreateNamedProperty(ecma_Object_t *obj_p, ecma_Char_t *name_p, ecma_PropertyWritableValue_t writable, ecma_PropertyEnumerableValue_t enumerable, ecma_PropertyConfigurableValue_t configurable);
extern ecma_Property_t *ecma_FindNamedProperty(ecma_Object_t *obj_p, ecma_Char_t *name_p);
extern ecma_Property_t *ecma_GetNamedProperty(ecma_Object_t *obj_p, ecma_Char_t *name_p);
extern ecma_Property_t *ecma_GetNamedDataProperty(ecma_Object_t *obj_p, ecma_Char_t *name_p);
extern ecma_property_t *ecma_create_named_property(ecma_object_t *obj_p, ecma_char_t *name_p, ecma_property_writable_value_t writable, ecma_property_enumerable_value_t enumerable, ecma_property_configurable_value_t configurable);
extern ecma_property_t *ecma_find_named_property(ecma_object_t *obj_p, ecma_char_t *name_p);
extern ecma_property_t *ecma_get_named_property(ecma_object_t *obj_p, ecma_char_t *name_p);
extern ecma_property_t *ecma_get_named_data_property(ecma_object_t *obj_p, ecma_char_t *name_p);
extern void ecma_FreeInternalProperty(ecma_Property_t *prop_p);
extern void ecma_FreeNamedDataProperty(ecma_Property_t *prop_p);
extern void ecma_FreeNamedAccessorProperty(ecma_Property_t *prop_p);
extern void ecma_FreeProperty(ecma_Property_t *prop_p);
extern void ecma_free_internal_property(ecma_property_t *prop_p);
extern void ecma_free_named_data_property(ecma_property_t *prop_p);
extern void ecma_free_named_accessor_property(ecma_property_t *prop_p);
extern void ecma_free_property(ecma_property_t *prop_p);
extern void ecma_DeleteProperty( ecma_Object_t *obj_p, ecma_Property_t *prop_p);
extern void ecma_delete_property( ecma_object_t *obj_p, ecma_property_t *prop_p);
extern ecma_ArrayFirstChunk_t* ecma_NewEcmaString( const ecma_Char_t *pString);
extern ssize_t ecma_CopyEcmaStringCharsToBuffer( ecma_ArrayFirstChunk_t *pFirstChunk, uint8_t *pBuffer, size_t bufferSize);
extern ecma_ArrayFirstChunk_t* ecma_DuplicateEcmaString( ecma_ArrayFirstChunk_t *pFirstChunk);
extern bool ecma_CompareZtStringToEcmaString( const ecma_Char_t *pString, const ecma_ArrayFirstChunk_t *pEcmaString);
extern bool ecma_CompareEcmaStringToEcmaString(const ecma_ArrayFirstChunk_t *string1_p, const ecma_ArrayFirstChunk_t *string2_p);
extern void ecma_FreeArray( ecma_ArrayFirstChunk_t *pFirstChunk);
extern ecma_array_first_chunk_t* ecma_new_ecma_string( const ecma_char_t *pString);
extern ssize_t ecma_copy_ecma_string_chars_to_buffer( ecma_array_first_chunk_t *pFirstChunk, uint8_t *pBuffer, size_t bufferSize);
extern ecma_array_first_chunk_t* ecma_duplicate_ecma_string( ecma_array_first_chunk_t *pFirstChunk);
extern bool ecma_compare_zt_string_to_ecma_string( const ecma_char_t *pString, const ecma_array_first_chunk_t *pEcmaString);
extern bool ecma_compare_ecma_string_to_ecma_string(const ecma_array_first_chunk_t *string1_p, const ecma_array_first_chunk_t *string2_p);
extern void ecma_free_array( ecma_array_first_chunk_t *pFirstChunk);
#endif /* !JERRY_ECMA_HELPERS_H */

View File

@ -33,19 +33,19 @@
* false - otherwise.
*/
bool
ecma_abstract_equality_compare(ecma_Value_t x, /**< first operand */
ecma_Value_t y) /**< second operand */
ecma_abstract_equality_compare(ecma_value_t x, /**< first operand */
ecma_value_t y) /**< second operand */
{
const bool is_x_undefined = ecma_IsValueUndefined( x);
const bool is_x_null = ecma_IsValueNull( x);
const bool is_x_boolean = ecma_IsValueBoolean( x);
const bool is_x_undefined = ecma_is_value_undefined( x);
const bool is_x_null = ecma_is_value_null( x);
const bool is_x_boolean = ecma_is_value_boolean( x);
const bool is_x_number = ( x.ValueType == ECMA_TYPE_NUMBER );
const bool is_x_string = ( x.ValueType == ECMA_TYPE_STRING );
const bool is_x_object = ( x.ValueType == ECMA_TYPE_OBJECT );
const bool is_y_undefined = ecma_IsValueUndefined( y);
const bool is_y_null = ecma_IsValueNull( y);
const bool is_y_boolean = ecma_IsValueBoolean( y);
const bool is_y_undefined = ecma_is_value_undefined( y);
const bool is_y_null = ecma_is_value_null( y);
const bool is_y_boolean = ecma_is_value_boolean( y);
const bool is_y_number = ( y.ValueType == ECMA_TYPE_NUMBER );
const bool is_y_string = ( y.ValueType == ECMA_TYPE_STRING );
const bool is_y_object = ( y.ValueType == ECMA_TYPE_OBJECT );
@ -68,18 +68,18 @@ ecma_abstract_equality_compare(ecma_Value_t x, /**< first operand */
return true;
} else if ( is_x_number )
{ // c.
ecma_Number_t x_num = *(ecma_Number_t*)( ecma_GetPointer(x.Value) );
ecma_Number_t y_num = *(ecma_Number_t*)( ecma_GetPointer(y.Value) );
ecma_number_t x_num = *(ecma_number_t*)( ecma_get_pointer(x.Value) );
ecma_number_t y_num = *(ecma_number_t*)( ecma_get_pointer(y.Value) );
TODO( Implement according to ECMA );
return (x_num == y_num);
} else if ( is_x_string )
{ // d.
ecma_ArrayFirstChunk_t* x_str = (ecma_ArrayFirstChunk_t*)( ecma_GetPointer(x.Value) );
ecma_ArrayFirstChunk_t* y_str = (ecma_ArrayFirstChunk_t*)( ecma_GetPointer(y.Value) );
ecma_array_first_chunk_t* x_str = (ecma_array_first_chunk_t*)( ecma_get_pointer(x.Value) );
ecma_array_first_chunk_t* y_str = (ecma_array_first_chunk_t*)( ecma_get_pointer(y.Value) );
return ecma_CompareEcmaStringToEcmaString( x_str, y_str);
return ecma_compare_ecma_string_to_ecma_string( x_str, y_str);
} else if ( is_x_boolean )
{ // e.
return ( x.Value == y.Value );

View File

@ -26,7 +26,7 @@
* @{
*/
extern bool ecma_abstract_equality_compare( ecma_Value_t x, ecma_Value_t y);
extern bool ecma_abstract_equality_compare( ecma_value_t x, ecma_value_t y);
/**
* @}

View File

@ -37,19 +37,19 @@
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_CompletionValue_t
ecma_op_check_object_coercible( ecma_Value_t value) /**< ecma-value */
ecma_completion_value_t
ecma_op_check_object_coercible( ecma_value_t value) /**< ecma-value */
{
switch ( (ecma_Type_t)value.ValueType )
switch ( (ecma_type_t)value.ValueType )
{
case ECMA_TYPE_SIMPLE:
{
switch ( (ecma_SimpleValue_t)value.Value )
switch ( (ecma_simple_value_t)value.Value )
{
case ECMA_SIMPLE_VALUE_UNDEFINED:
case ECMA_SIMPLE_VALUE_NULL:
{
return ecma_MakeThrowValue( ecma_NewStandardError( ECMA_ERROR_TYPE));
return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_TYPE));
}
case ECMA_SIMPLE_VALUE_FALSE:
case ECMA_SIMPLE_VALUE_TRUE:
@ -78,9 +78,9 @@ ecma_op_check_object_coercible( ecma_Value_t value) /**< ecma-value */
}
}
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_EMPTY),
ECMA_TARGET_ID_RESERVED);
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value( ECMA_SIMPLE_VALUE_EMPTY),
ECMA_TARGET_ID_RESERVED);
} /* ecma_op_check_object_coercible */
/**
@ -92,18 +92,18 @@ ecma_op_check_object_coercible( ecma_Value_t value) /**< ecma-value */
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_CompletionValue_t
ecma_op_to_primitive( ecma_Value_t value) /**< ecma-value */
ecma_completion_value_t
ecma_op_to_primitive( ecma_value_t value) /**< ecma-value */
{
switch ( (ecma_Type_t)value.ValueType )
switch ( (ecma_type_t)value.ValueType )
{
case ECMA_TYPE_SIMPLE:
case ECMA_TYPE_NUMBER:
case ECMA_TYPE_STRING:
{
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_CopyValue( value),
ECMA_TARGET_ID_RESERVED);
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_copy_value( value),
ECMA_TARGET_ID_RESERVED);
}
case ECMA_TYPE_OBJECT:
{
@ -127,16 +127,16 @@ ecma_op_to_primitive( ecma_Value_t value) /**< ecma-value */
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_CompletionValue_t
ecma_op_to_number( ecma_Value_t value) /**< ecma-value */
ecma_completion_value_t
ecma_op_to_number( ecma_value_t value) /**< ecma-value */
{
switch ( (ecma_Type_t)value.ValueType )
switch ( (ecma_type_t)value.ValueType )
{
case ECMA_TYPE_NUMBER:
{
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_CopyValue( value),
ECMA_TARGET_ID_RESERVED);
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_copy_value( value),
ECMA_TARGET_ID_RESERVED);
}
case ECMA_TYPE_SIMPLE:
case ECMA_TYPE_STRING:
@ -145,10 +145,10 @@ ecma_op_to_number( ecma_Value_t value) /**< ecma-value */
}
case ECMA_TYPE_OBJECT:
{
ecma_CompletionValue_t completion_to_primitive = ecma_op_to_primitive( value);
ecma_completion_value_t completion_to_primitive = ecma_op_to_primitive( value);
JERRY_ASSERT( ecma_is_completion_value_normal( completion_to_primitive) );
ecma_CompletionValue_t completion_to_number = ecma_op_to_number( completion_to_primitive.value);
ecma_completion_value_t completion_to_number = ecma_op_to_number( completion_to_primitive.value);
ecma_free_completion_value( completion_to_primitive);
return completion_to_number;
@ -171,8 +171,8 @@ ecma_op_to_number( ecma_Value_t value) /**< ecma-value */
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_CompletionValue_t
ecma_op_to_object( ecma_Value_t value) /**< ecma-value */
ecma_completion_value_t
ecma_op_to_object( ecma_value_t value) /**< ecma-value */
{
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( value);
} /* ecma_op_to_object */

View File

@ -26,10 +26,10 @@
* @{
*/
extern ecma_CompletionValue_t ecma_op_check_object_coercible( ecma_Value_t value);
extern ecma_CompletionValue_t ecma_op_to_primitive( ecma_Value_t value);
extern ecma_CompletionValue_t ecma_op_to_number( ecma_Value_t value);
extern ecma_CompletionValue_t ecma_op_to_object( ecma_Value_t value);
extern ecma_completion_value_t ecma_op_check_object_coercible( ecma_value_t value);
extern ecma_completion_value_t ecma_op_to_primitive( ecma_value_t value);
extern ecma_completion_value_t ecma_op_to_number( ecma_value_t value);
extern ecma_completion_value_t ecma_op_to_object( ecma_value_t value);
/**
* @}

View File

@ -33,11 +33,11 @@
* @return pointer to ecma-object representing specified error
* with reference counter set to one.
*/
ecma_Object_t*
ecma_NewStandardError( ecma_StandardError_t error_type) /**< native error type */
ecma_object_t*
ecma_new_standard_error( ecma_standard_error_t error_type) /**< native error type */
{
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( error_type);
} /* ecma_NewStandardError */
} /* ecma_new_standard_error */
/**
* @}

View File

@ -41,9 +41,9 @@ typedef enum
ECMA_ERROR_SYNTAX, /**< SyntaxError */
ECMA_ERROR_TYPE, /**< TypeError */
ECMA_ERROR_URI /**< URIError */
} ecma_StandardError_t;
} ecma_standard_error_t;
extern ecma_Object_t *ecma_NewStandardError( ecma_StandardError_t error_type);
extern ecma_object_t *ecma_new_standard_error( ecma_standard_error_t error_type);
/**
* @}

View File

@ -37,22 +37,22 @@
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
ecma_CompletionValue_t
ecma_op_get_value( ecma_Reference_t ref) /**< ECMA-reference */
ecma_completion_value_t
ecma_op_get_value( ecma_reference_t ref) /**< ECMA-reference */
{
const ecma_Value_t base = ref.base;
const bool is_unresolvable_reference = ecma_IsValueUndefined( base);
const bool has_primitive_base = ( ecma_IsValueBoolean( base)
const ecma_value_t base = ref.base;
const bool is_unresolvable_reference = ecma_is_value_undefined( base);
const bool has_primitive_base = ( ecma_is_value_boolean( base)
|| base.ValueType == ECMA_TYPE_NUMBER
|| base.ValueType == ECMA_TYPE_STRING );
const bool has_object_base = ( base.ValueType == ECMA_TYPE_OBJECT
&& !((ecma_Object_t*)ecma_GetPointer(base.Value))->IsLexicalEnvironment );
&& !((ecma_object_t*)ecma_get_pointer(base.Value))->IsLexicalEnvironment );
const bool is_property_reference = has_primitive_base || has_object_base;
// GetValue_3
if ( is_unresolvable_reference )
{
return ecma_MakeThrowValue( ecma_NewStandardError( ECMA_ERROR_REFERENCE));
return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_REFERENCE));
}
// GetValue_4
@ -60,7 +60,7 @@ ecma_op_get_value( ecma_Reference_t ref) /**< ECMA-reference */
{
if ( !has_primitive_base ) // GetValue_4.a
{
ecma_Object_t *obj_p = ecma_GetPointer( base.Value);
ecma_object_t *obj_p = ecma_get_pointer( base.Value);
JERRY_ASSERT( obj_p != NULL && !obj_p->IsLexicalEnvironment );
// GetValue_4.b case 1
@ -69,24 +69,24 @@ ecma_op_get_value( ecma_Reference_t ref) /**< ECMA-reference */
} else
{ // GetValue_4.b case 2
/*
ecma_Object_t *obj_p = ecma_ToObject( base);
ecma_object_t *obj_p = ecma_ToObject( base);
JERRY_ASSERT( obj_p != NULL && !obj_p->IsLexicalEnvironment );
ecma_Property_t *property = obj_p->[[GetProperty]]( ref.referenced_name_p);
ecma_property_t *property = obj_p->[[GetProperty]]( ref.referenced_name_p);
if ( property->Type == ECMA_PROPERTY_NAMEDDATA )
{
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_CopyValue( property->u.NamedDataProperty.Value),
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_copy_value( property->u.NamedDataProperty.Value),
ECMA_TARGET_ID_RESERVED);
} else
{
JERRY_ASSERT( property->Type == ECMA_PROPERTY_NAMEDACCESSOR );
ecma_Object_t *getter = ecma_GetPointer( property->u.NamedAccessorProperty.pGet);
ecma_object_t *getter = ecma_get_pointer( property->u.NamedAccessorProperty.pGet);
if ( getter == NULL )
{
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_UNDEFINED),
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value( ECMA_SIMPLE_VALUE_UNDEFINED),
ECMA_TARGET_ID_RESERVED);
} else
{
@ -99,11 +99,11 @@ ecma_op_get_value( ecma_Reference_t ref) /**< ECMA-reference */
} else
{
// GetValue_5
ecma_Object_t *lex_env_p = ecma_GetPointer( base.Value);
ecma_object_t *lex_env_p = ecma_get_pointer( base.Value);
JERRY_ASSERT( lex_env_p != NULL && lex_env_p->IsLexicalEnvironment );
return ecma_OpGetBindingValue( lex_env_p, ref.referenced_name_p, ref.is_strict);
return ecma_op_get_binding_value( lex_env_p, ref.referenced_name_p, ref.is_strict);
}
} /* ecma_op_get_value */
@ -115,28 +115,28 @@ ecma_op_get_value( ecma_Reference_t ref) /**< ECMA-reference */
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
ecma_CompletionValue_t
ecma_op_put_value(ecma_Reference_t ref, /**< ECMA-reference */
ecma_Value_t value) /**< ECMA-value */
ecma_completion_value_t
ecma_op_put_value(ecma_reference_t ref, /**< ECMA-reference */
ecma_value_t value) /**< ECMA-value */
{
const ecma_Value_t base = ref.base;
const bool is_unresolvable_reference = ecma_IsValueUndefined( base);
const bool has_primitive_base = ( ecma_IsValueBoolean( base)
const ecma_value_t base = ref.base;
const bool is_unresolvable_reference = ecma_is_value_undefined( base);
const bool has_primitive_base = ( ecma_is_value_boolean( base)
|| base.ValueType == ECMA_TYPE_NUMBER
|| base.ValueType == ECMA_TYPE_STRING );
const bool has_object_base = ( base.ValueType == ECMA_TYPE_OBJECT
&& !((ecma_Object_t*)ecma_GetPointer(base.Value))->IsLexicalEnvironment );
&& !((ecma_object_t*)ecma_get_pointer(base.Value))->IsLexicalEnvironment );
const bool is_property_reference = has_primitive_base || has_object_base;
if ( is_unresolvable_reference ) // PutValue_3
{
if ( ref.is_strict ) // PutValue_3.a
{
return ecma_MakeThrowValue( ecma_NewStandardError( ECMA_ERROR_REFERENCE));
return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_REFERENCE));
} else // PutValue_3.b
{
/*
ecma_Object_t *global_object_p = ecma_GetGlobalObject();
ecma_object_t *global_object_p = ecma_GetGlobalObject();
return global_object_p->[[Put]]( ref.referenced_name_p, value, false);
*/
@ -157,7 +157,7 @@ ecma_op_put_value(ecma_Reference_t ref, /**< ECMA-reference */
/*
// PutValue_sub_1
ecma_Object_t *obj_p = ecma_ToObject( base);
ecma_object_t *obj_p = ecma_ToObject( base);
JERRY_ASSERT( obj_p != NULL && !obj_p->IsLexicalEnvironment );
// PutValue_sub_2
@ -166,17 +166,17 @@ ecma_op_put_value(ecma_Reference_t ref, /**< ECMA-reference */
// PutValue_sub_2.a
if ( ref.is_strict )
{
return ecma_MakeThrowValue( ecma_NewStandardError( ECMA_ERROR_TYPE));
return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_TYPE));
} else
{ // PutValue_sub_2.b
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_EMPTY),
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value( ECMA_SIMPLE_VALUE_EMPTY),
ECMA_TARGET_ID_RESERVED);
}
}
// PutValue_sub_3
ecma_Property_t *own_prop = obj_p->[[GetOwnProperty]]( ref.referenced_name_p);
ecma_property_t *own_prop = obj_p->[[GetOwnProperty]]( ref.referenced_name_p);
// PutValue_sub_4
if ( ecma_OpIsDataDescriptor( own_prop) )
@ -184,23 +184,23 @@ ecma_op_put_value(ecma_Reference_t ref, /**< ECMA-reference */
// PutValue_sub_4.a
if ( ref.is_strict )
{
return ecma_MakeThrowValue( ecma_NewStandardError( ECMA_ERROR_TYPE));
return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_TYPE));
} else
{ // PutValue_sub_4.b
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_EMPTY),
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value( ECMA_SIMPLE_VALUE_EMPTY),
ECMA_TARGET_ID_RESERVED);
}
}
// PutValue_sub_5
ecma_Property_t *prop = obj_p->[[GetProperty]]( ref.referenced_name_p);
ecma_property_t *prop = obj_p->[[GetProperty]]( ref.referenced_name_p);
// PutValue_sub_6
if ( ecma_OpIsAccessorDescriptor( prop) )
{
// PutValue_sub_6.a
ecma_Object_t *setter = ecma_GetPointer( property->u.NamedAccessorProperty.pSet);
ecma_object_t *setter = ecma_get_pointer( property->u.NamedAccessorProperty.pSet);
JERRY_ASSERT( setter != NULL );
// PutValue_sub_6.b
@ -210,13 +210,13 @@ ecma_op_put_value(ecma_Reference_t ref, /**< ECMA-reference */
// PutValue_sub_7.a
if ( ref.is_strict )
{
return ecma_MakeThrowValue( ecma_NewStandardError( ECMA_ERROR_TYPE));
return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_TYPE));
}
}
// PutValue_sub_8
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_EMPTY),
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value( ECMA_SIMPLE_VALUE_EMPTY),
ECMA_TARGET_ID_RESERVED);
*/
@ -225,11 +225,11 @@ ecma_op_put_value(ecma_Reference_t ref, /**< ECMA-reference */
} else
{
// PutValue_7
ecma_Object_t *lex_env_p = ecma_GetPointer( base.Value);
ecma_object_t *lex_env_p = ecma_get_pointer( base.Value);
JERRY_ASSERT( lex_env_p != NULL && lex_env_p->IsLexicalEnvironment );
return ecma_OpSetMutableBinding( lex_env_p, ref.referenced_name_p, value, ref.is_strict);
return ecma_op_set_mutable_binding( lex_env_p, ref.referenced_name_p, value, ref.is_strict);
}
} /* ecma_op_put_value */

View File

@ -37,19 +37,19 @@
* Return value is simple and so need not be freed.
* However, ecma_free_completion_value may be called for it, but it is a no-op.
*/
ecma_CompletionValue_t
ecma_OpHasBinding(ecma_Object_t *lex_env_p, /**< lexical environment */
ecma_Char_t *name_p) /**< argument N */
ecma_completion_value_t
ecma_op_has_binding(ecma_object_t *lex_env_p, /**< lexical environment */
ecma_char_t *name_p) /**< argument N */
{
JERRY_ASSERT( lex_env_p != NULL && lex_env_p->IsLexicalEnvironment );
ecma_SimpleValue_t has_binding = ECMA_SIMPLE_VALUE_UNDEFINED;
ecma_simple_value_t has_binding = ECMA_SIMPLE_VALUE_UNDEFINED;
switch ( (ecma_LexicalEnvironmentType_t) lex_env_p->u.LexicalEnvironment.Type )
switch ( (ecma_lexical_environment_type_t) lex_env_p->u.LexicalEnvironment.Type )
{
case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE:
{
ecma_Property_t *property_p = ecma_FindNamedProperty( lex_env_p, name_p);
ecma_property_t *property_p = ecma_find_named_property( lex_env_p, name_p);
has_binding = ( property_p != NULL ) ? ECMA_SIMPLE_VALUE_TRUE
: ECMA_SIMPLE_VALUE_FALSE;
@ -62,10 +62,10 @@ ecma_OpHasBinding(ecma_Object_t *lex_env_p, /**< lexical environment */
}
}
return ecma_MakeCompletionValue(ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeSimpleValue( has_binding),
return ecma_make_completion_value(ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value( has_binding),
ECMA_TARGET_ID_RESERVED);
} /* ecma_OpHasBinding */
} /* ecma_op_has_binding */
/**
* CreateMutableBinding operation.
@ -76,21 +76,21 @@ ecma_OpHasBinding(ecma_Object_t *lex_env_p, /**< lexical environment */
* Return value is simple and so need not be freed.
* However, ecma_free_completion_value may be called for it, but it is a no-op.
*/
ecma_CompletionValue_t
ecma_OpCreateMutableBinding(ecma_Object_t *lex_env_p, /**< lexical environment */
ecma_Char_t *name_p, /**< argument N */
ecma_completion_value_t
ecma_op_create_mutable_binding(ecma_object_t *lex_env_p, /**< lexical environment */
ecma_char_t *name_p, /**< argument N */
bool is_deletable) /**< argument D */
{
JERRY_ASSERT( lex_env_p != NULL && lex_env_p->IsLexicalEnvironment );
JERRY_ASSERT( name_p != NULL );
switch ( (ecma_LexicalEnvironmentType_t) lex_env_p->u.LexicalEnvironment.Type )
switch ( (ecma_lexical_environment_type_t) lex_env_p->u.LexicalEnvironment.Type )
{
case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE:
{
JERRY_ASSERT( ecma_IsCompletionValueNormalFalse( ecma_OpHasBinding( lex_env_p, name_p)) );
JERRY_ASSERT( ecma_is_completion_value_normal_false( ecma_op_has_binding( lex_env_p, name_p)) );
ecma_CreateNamedProperty( lex_env_p,
ecma_create_named_property( lex_env_p,
name_p,
ECMA_PROPERTY_WRITABLE,
ECMA_PROPERTY_NOT_ENUMERABLE,
@ -106,10 +106,10 @@ ecma_OpCreateMutableBinding(ecma_Object_t *lex_env_p, /**< lexical environment *
}
}
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_EMPTY),
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value( ECMA_SIMPLE_VALUE_EMPTY),
ECMA_TARGET_ID_RESERVED);
} /* ecma_OpCreateMutableBinding */
} /* ecma_op_create_mutable_binding */
/**
* SetMutableBinding operation.
@ -119,30 +119,30 @@ ecma_OpCreateMutableBinding(ecma_Object_t *lex_env_p, /**< lexical environment *
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
ecma_CompletionValue_t
ecma_OpSetMutableBinding(ecma_Object_t *lex_env_p, /**< lexical environment */
ecma_Char_t *name_p, /**< argument N */
ecma_Value_t value, /**< argument V */
ecma_completion_value_t
ecma_op_set_mutable_binding(ecma_object_t *lex_env_p, /**< lexical environment */
ecma_char_t *name_p, /**< argument N */
ecma_value_t value, /**< argument V */
bool is_strict) /**< argument S */
{
JERRY_ASSERT( lex_env_p != NULL && lex_env_p->IsLexicalEnvironment );
JERRY_ASSERT( name_p != NULL );
JERRY_ASSERT( ecma_IsCompletionValueNormalTrue( ecma_OpHasBinding( lex_env_p, name_p)) );
JERRY_ASSERT( ecma_is_completion_value_normal_true( ecma_op_has_binding( lex_env_p, name_p)) );
switch ( (ecma_LexicalEnvironmentType_t) lex_env_p->u.LexicalEnvironment.Type )
switch ( (ecma_lexical_environment_type_t) lex_env_p->u.LexicalEnvironment.Type )
{
case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE:
{
ecma_Property_t *property_p = ecma_GetNamedDataProperty( lex_env_p, name_p);
ecma_property_t *property_p = ecma_get_named_data_property( lex_env_p, name_p);
if ( property_p->u.NamedDataProperty.Writable == ECMA_PROPERTY_WRITABLE )
{
ecma_FreeValue( property_p->u.NamedDataProperty.Value);
property_p->u.NamedDataProperty.Value = ecma_CopyValue( value);
ecma_free_value( property_p->u.NamedDataProperty.Value);
property_p->u.NamedDataProperty.Value = ecma_copy_value( value);
} else if ( is_strict )
{
return ecma_MakeThrowValue( ecma_NewStandardError( ECMA_ERROR_TYPE));
return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_TYPE));
}
break;
@ -153,10 +153,10 @@ ecma_OpSetMutableBinding(ecma_Object_t *lex_env_p, /**< lexical environment */
}
}
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_EMPTY),
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value( ECMA_SIMPLE_VALUE_EMPTY),
ECMA_TARGET_ID_RESERVED);
} /* ecma_OpSetMutableBinding */
} /* ecma_op_set_mutable_binding */
/**
* GetBindingValue operation.
@ -166,29 +166,29 @@ ecma_OpSetMutableBinding(ecma_Object_t *lex_env_p, /**< lexical environment */
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
ecma_CompletionValue_t
ecma_OpGetBindingValue(ecma_Object_t *lex_env_p, /**< lexical environment */
ecma_Char_t *name_p, /**< argument N */
ecma_completion_value_t
ecma_op_get_binding_value(ecma_object_t *lex_env_p, /**< lexical environment */
ecma_char_t *name_p, /**< argument N */
bool is_strict) /**< argument S */
{
JERRY_ASSERT( lex_env_p != NULL && lex_env_p->IsLexicalEnvironment );
JERRY_ASSERT( name_p != NULL );
JERRY_ASSERT( ecma_IsCompletionValueNormalTrue( ecma_OpHasBinding( lex_env_p, name_p)) );
JERRY_ASSERT( ecma_is_completion_value_normal_true( ecma_op_has_binding( lex_env_p, name_p)) );
switch ( (ecma_LexicalEnvironmentType_t) lex_env_p->u.LexicalEnvironment.Type )
switch ( (ecma_lexical_environment_type_t) lex_env_p->u.LexicalEnvironment.Type )
{
case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE:
{
ecma_Property_t *property_p = ecma_GetNamedDataProperty( lex_env_p, name_p);
ecma_property_t *property_p = ecma_get_named_data_property( lex_env_p, name_p);
ecma_Value_t prop_value = property_p->u.NamedDataProperty.Value;
ecma_value_t prop_value = property_p->u.NamedDataProperty.Value;
/* is the binding mutable? */
if ( property_p->u.NamedDataProperty.Writable == ECMA_PROPERTY_WRITABLE )
{
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_CopyValue( prop_value),
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_copy_value( prop_value),
ECMA_TARGET_ID_RESERVED);
} else if ( prop_value.ValueType == ECMA_TYPE_SIMPLE
&& prop_value.Value == ECMA_SIMPLE_VALUE_EMPTY )
@ -196,11 +196,11 @@ ecma_OpGetBindingValue(ecma_Object_t *lex_env_p, /**< lexical environment */
/* unitialized immutable binding */
if ( is_strict )
{
return ecma_MakeThrowValue( ecma_NewStandardError( ECMA_ERROR_REFERENCE));
return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_REFERENCE));
} else
{
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_UNDEFINED),
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value( ECMA_SIMPLE_VALUE_UNDEFINED),
ECMA_TARGET_ID_RESERVED);
}
}
@ -214,7 +214,7 @@ ecma_OpGetBindingValue(ecma_Object_t *lex_env_p, /**< lexical environment */
}
JERRY_UNREACHABLE();
} /* ecma_OpGetBindingValue */
} /* ecma_op_get_binding_value */
/**
* DeleteBinding operation.
@ -225,19 +225,19 @@ ecma_OpGetBindingValue(ecma_Object_t *lex_env_p, /**< lexical environment */
* Return value is simple and so need not be freed.
* However, ecma_free_completion_value may be called for it, but it is a no-op.
*/
ecma_CompletionValue_t
ecma_OpDeleteBinding(ecma_Object_t *lex_env_p, /**< lexical environment */
ecma_Char_t *name_p) /**< argument N */
ecma_completion_value_t
ecma_op_delete_binding(ecma_object_t *lex_env_p, /**< lexical environment */
ecma_char_t *name_p) /**< argument N */
{
JERRY_ASSERT( lex_env_p != NULL && lex_env_p->IsLexicalEnvironment );
JERRY_ASSERT( name_p != NULL );
switch ( (ecma_LexicalEnvironmentType_t) lex_env_p->u.LexicalEnvironment.Type )
switch ( (ecma_lexical_environment_type_t) lex_env_p->u.LexicalEnvironment.Type )
{
case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE:
{
ecma_Property_t *prop_p = ecma_FindNamedProperty( lex_env_p, name_p);
ecma_SimpleValue_t ret_val;
ecma_property_t *prop_p = ecma_find_named_property( lex_env_p, name_p);
ecma_simple_value_t ret_val;
if ( prop_p == NULL )
{
@ -251,14 +251,14 @@ ecma_OpDeleteBinding(ecma_Object_t *lex_env_p, /**< lexical environment */
ret_val = ECMA_SIMPLE_VALUE_FALSE;
} else
{
ecma_DeleteProperty( lex_env_p, prop_p);
ecma_delete_property( lex_env_p, prop_p);
ret_val = ECMA_SIMPLE_VALUE_TRUE;
}
}
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeSimpleValue( ret_val),
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value( ret_val),
ECMA_TARGET_ID_RESERVED);
}
case ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND:
@ -268,7 +268,7 @@ ecma_OpDeleteBinding(ecma_Object_t *lex_env_p, /**< lexical environment */
}
JERRY_UNREACHABLE();
} /* ecma_OpDeleteBinding */
} /* ecma_op_delete_binding */
/**
* ImplicitThisValue operation.
@ -278,17 +278,17 @@ ecma_OpDeleteBinding(ecma_Object_t *lex_env_p, /**< lexical environment */
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
ecma_CompletionValue_t
ecma_OpImplicitThisValue( ecma_Object_t *lex_env_p) /**< lexical environment */
ecma_completion_value_t
ecma_op_implicit_this_value( ecma_object_t *lex_env_p) /**< lexical environment */
{
JERRY_ASSERT( lex_env_p != NULL && lex_env_p->IsLexicalEnvironment );
switch ( (ecma_LexicalEnvironmentType_t) lex_env_p->u.LexicalEnvironment.Type )
switch ( (ecma_lexical_environment_type_t) lex_env_p->u.LexicalEnvironment.Type )
{
case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE:
{
return ecma_MakeCompletionValue( ECMA_COMPLETION_TYPE_NORMAL,
ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_UNDEFINED),
return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value( ECMA_SIMPLE_VALUE_UNDEFINED),
ECMA_TARGET_ID_RESERVED);
}
case ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND:
@ -298,7 +298,7 @@ ecma_OpImplicitThisValue( ecma_Object_t *lex_env_p) /**< lexical environment */
}
JERRY_UNREACHABLE();
} /* ecma_OpImplicitThisValue */
} /* ecma_op_implicit_this_value */
/**
* CreateImmutableBinding operation.
@ -306,22 +306,22 @@ ecma_OpImplicitThisValue( ecma_Object_t *lex_env_p) /**< lexical environment */
* See also: ECMA-262 v5, 10.2.1
*/
void
ecma_OpCreateImmutableBinding(ecma_Object_t *lex_env_p, /**< lexical environment */
ecma_Char_t *name_p) /**< argument N */
ecma_op_create_immutable_binding(ecma_object_t *lex_env_p, /**< lexical environment */
ecma_char_t *name_p) /**< argument N */
{
JERRY_ASSERT( lex_env_p != NULL && lex_env_p->IsLexicalEnvironment );
switch ( (ecma_LexicalEnvironmentType_t) lex_env_p->u.LexicalEnvironment.Type )
switch ( (ecma_lexical_environment_type_t) lex_env_p->u.LexicalEnvironment.Type )
{
case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE:
{
JERRY_ASSERT( ecma_IsCompletionValueNormalFalse( ecma_OpHasBinding( lex_env_p, name_p)) );
JERRY_ASSERT( ecma_is_completion_value_normal_false( ecma_op_has_binding( lex_env_p, name_p)) );
/*
* Warning:
* Whether immutable bindings are deletable seems not to be defined by ECMA v5.
*/
ecma_Property_t *prop_p = ecma_CreateNamedProperty( lex_env_p,
ecma_property_t *prop_p = ecma_create_named_property( lex_env_p,
name_p,
ECMA_PROPERTY_NOT_WRITABLE,
ECMA_PROPERTY_NOT_ENUMERABLE,
@ -338,7 +338,7 @@ ecma_OpCreateImmutableBinding(ecma_Object_t *lex_env_p, /**< lexical environment
}
JERRY_UNREACHABLE();
} /* ecma_OpCreateImmutableBinding */
} /* ecma_op_create_immutable_binding */
/**
* InitializeImmutableBinding operation.
@ -346,26 +346,26 @@ ecma_OpCreateImmutableBinding(ecma_Object_t *lex_env_p, /**< lexical environment
* See also: ECMA-262 v5, 10.2.1
*/
void
ecma_OpInitializeImmutableBinding(ecma_Object_t *lex_env_p, /**< lexical environment */
ecma_Char_t *name_p, /**< argument N */
ecma_Value_t value) /**< argument V */
ecma_op_initialize_immutable_binding(ecma_object_t *lex_env_p, /**< lexical environment */
ecma_char_t *name_p, /**< argument N */
ecma_value_t value) /**< argument V */
{
JERRY_ASSERT( lex_env_p != NULL && lex_env_p->IsLexicalEnvironment );
switch ( (ecma_LexicalEnvironmentType_t) lex_env_p->u.LexicalEnvironment.Type )
switch ( (ecma_lexical_environment_type_t) lex_env_p->u.LexicalEnvironment.Type )
{
case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE:
{
JERRY_ASSERT( ecma_IsCompletionValueNormalTrue( ecma_OpHasBinding( lex_env_p, name_p)) );
JERRY_ASSERT( ecma_is_completion_value_normal_true( ecma_op_has_binding( lex_env_p, name_p)) );
ecma_Property_t *prop_p = ecma_GetNamedDataProperty( lex_env_p, name_p);
ecma_property_t *prop_p = ecma_get_named_data_property( lex_env_p, name_p);
/* The binding must be unitialized immutable binding */
JERRY_ASSERT( prop_p->u.NamedDataProperty.Writable == ECMA_PROPERTY_NOT_WRITABLE
&& prop_p->u.NamedDataProperty.Value.ValueType == ECMA_TYPE_SIMPLE
&& prop_p->u.NamedDataProperty.Value.Value == ECMA_SIMPLE_VALUE_EMPTY );
prop_p->u.NamedDataProperty.Value = ecma_CopyValue( value);
prop_p->u.NamedDataProperty.Value = ecma_copy_value( value);
}
case ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND:
{
@ -374,7 +374,7 @@ ecma_OpInitializeImmutableBinding(ecma_Object_t *lex_env_p, /**< lexical environ
}
JERRY_UNREACHABLE();
} /* ecma_OpInitializeImmutableBinding */
} /* ecma_op_initialize_immutable_binding */
/**
* @}

View File

@ -29,16 +29,16 @@
*/
/* ECMA-262 v5, Table 17. Abstract methods of Environment Records */
extern ecma_CompletionValue_t ecma_OpHasBinding( ecma_Object_t *lex_env_p, ecma_Char_t *name_p);
extern ecma_CompletionValue_t ecma_OpCreateMutableBinding( ecma_Object_t *lex_env_p, ecma_Char_t *name_p, bool is_deletable);
extern ecma_CompletionValue_t ecma_OpSetMutableBinding( ecma_Object_t *lex_env_p, ecma_Char_t *name_p, ecma_Value_t value, bool is_strict);
extern ecma_CompletionValue_t ecma_OpGetBindingValue( ecma_Object_t *lex_env_p, ecma_Char_t *name_p, bool is_strict);
extern ecma_CompletionValue_t ecma_OpDeleteBinding( ecma_Object_t *lex_env_p, ecma_Char_t *name_p);
extern ecma_CompletionValue_t ecma_OpImplicitThisValue( ecma_Object_t *lex_env_p);
extern ecma_completion_value_t ecma_op_has_binding( ecma_object_t *lex_env_p, ecma_char_t *name_p);
extern ecma_completion_value_t ecma_op_create_mutable_binding( ecma_object_t *lex_env_p, ecma_char_t *name_p, bool is_deletable);
extern ecma_completion_value_t ecma_op_set_mutable_binding( ecma_object_t *lex_env_p, ecma_char_t *name_p, ecma_value_t value, bool is_strict);
extern ecma_completion_value_t ecma_op_get_binding_value( ecma_object_t *lex_env_p, ecma_char_t *name_p, bool is_strict);
extern ecma_completion_value_t ecma_op_delete_binding( ecma_object_t *lex_env_p, ecma_char_t *name_p);
extern ecma_completion_value_t ecma_op_implicit_this_value( ecma_object_t *lex_env_p);
/* ECMA-262 v5, Table 18. Additional methods of Declarative Environment Records */
extern void ecma_OpCreateImmutableBinding( ecma_Object_t *lex_env_p, ecma_Char_t *name_p);
extern void ecma_OpInitializeImmutableBinding( ecma_Object_t *lex_env_p, ecma_Char_t *name_p, ecma_Value_t value);
extern void ecma_op_create_immutable_binding( ecma_object_t *lex_env_p, ecma_char_t *name_p);
extern void ecma_op_initialize_immutable_binding( ecma_object_t *lex_env_p, ecma_char_t *name_p, ecma_value_t value);
/**
* @}

View File

@ -33,9 +33,9 @@
*
* @return number - result of addition.
*/
ecma_Number_t
ecma_op_number_add(ecma_Number_t left_num, /**< left operand */
ecma_Number_t right_num) /**< right operand */
ecma_number_t
ecma_op_number_add(ecma_number_t left_num, /**< left operand */
ecma_number_t right_num) /**< right operand */
{
TODO( Implement according to ECMA );
@ -50,9 +50,9 @@ ecma_op_number_add(ecma_Number_t left_num, /**< left operand */
*
* @return number - result of substraction.
*/
ecma_Number_t
ecma_op_number_substract(ecma_Number_t left_num, /**< left operand */
ecma_Number_t right_num) /**< right operand */
ecma_number_t
ecma_op_number_substract(ecma_number_t left_num, /**< left operand */
ecma_number_t right_num) /**< right operand */
{
return ecma_op_number_add( left_num, ecma_op_number_negate( right_num));
} /* ecma_op_number_substract */
@ -65,9 +65,9 @@ ecma_op_number_substract(ecma_Number_t left_num, /**< left operand */
*
* @return number - result of multiplication.
*/
ecma_Number_t
ecma_op_number_multiply(ecma_Number_t left_num, /**< left operand */
ecma_Number_t right_num) /**< right operand */
ecma_number_t
ecma_op_number_multiply(ecma_number_t left_num, /**< left operand */
ecma_number_t right_num) /**< right operand */
{
TODO( Implement according to ECMA );
@ -82,9 +82,9 @@ ecma_op_number_multiply(ecma_Number_t left_num, /**< left operand */
*
* @return number - result of division.
*/
ecma_Number_t
ecma_op_number_divide(ecma_Number_t left_num, /**< left operand */
ecma_Number_t right_num) /**< right operand */
ecma_number_t
ecma_op_number_divide(ecma_number_t left_num, /**< left operand */
ecma_number_t right_num) /**< right operand */
{
TODO( Implement according to ECMA );
@ -99,15 +99,15 @@ ecma_op_number_divide(ecma_Number_t left_num, /**< left operand */
*
* @return number - calculated remainder.
*/
ecma_Number_t
ecma_op_number_remainder(ecma_Number_t left_num, /**< left operand */
ecma_Number_t right_num) /**< right operand */
ecma_number_t
ecma_op_number_remainder(ecma_number_t left_num, /**< left operand */
ecma_number_t right_num) /**< right operand */
{
TODO( Implement according to ECMA );
ecma_Number_t n = left_num, d = right_num;
ecma_number_t n = left_num, d = right_num;
return ( n - d * (ecma_Number_t)( (int32_t)( n / d ) ) );
return ( n - d * (ecma_number_t)( (int32_t)( n / d ) ) );
} /* ecma_op_number_remainder */
/**
@ -118,8 +118,8 @@ ecma_op_number_remainder(ecma_Number_t left_num, /**< left operand */
*
* @return number - result of negation.
*/
ecma_Number_t
ecma_op_number_negate(ecma_Number_t num) /**< operand */
ecma_number_t
ecma_op_number_negate(ecma_number_t num) /**< operand */
{
TODO( Implement according to ECMA );

View File

@ -27,12 +27,12 @@
* @{
*/
extern ecma_Number_t ecma_op_number_add( ecma_Number_t left_num, ecma_Number_t right_num);
extern ecma_Number_t ecma_op_number_substract( ecma_Number_t left_num, ecma_Number_t right_num);
extern ecma_Number_t ecma_op_number_multiply( ecma_Number_t left_num, ecma_Number_t right_num);
extern ecma_Number_t ecma_op_number_divide( ecma_Number_t left_num, ecma_Number_t right_num);
extern ecma_Number_t ecma_op_number_remainder( ecma_Number_t left_num, ecma_Number_t right_num);
extern ecma_Number_t ecma_op_number_negate( ecma_Number_t num);
extern ecma_number_t ecma_op_number_add( ecma_number_t left_num, ecma_number_t right_num);
extern ecma_number_t ecma_op_number_substract( ecma_number_t left_num, ecma_number_t right_num);
extern ecma_number_t ecma_op_number_multiply( ecma_number_t left_num, ecma_number_t right_num);
extern ecma_number_t ecma_op_number_divide( ecma_number_t left_num, ecma_number_t right_num);
extern ecma_number_t ecma_op_number_remainder( ecma_number_t left_num, ecma_number_t right_num);
extern ecma_number_t ecma_op_number_negate( ecma_number_t num);
/**
* @}

View File

@ -27,10 +27,10 @@
* @{
*/
extern ecma_Reference_t ecma_OpGetIdentifierReference( ecma_Object_t *lex_env_p, ecma_Char_t *name_p, bool is_strict);
extern ecma_reference_t ecma_op_get_identifier_reference( ecma_object_t *lex_env_p, ecma_char_t *name_p, bool is_strict);
extern ecma_CompletionValue_t ecma_op_get_value( ecma_Reference_t ref);
extern ecma_CompletionValue_t ecma_op_put_value( ecma_Reference_t ref, ecma_Value_t value);
extern ecma_completion_value_t ecma_op_get_value( ecma_reference_t ref);
extern ecma_completion_value_t ecma_op_put_value( ecma_reference_t ref, ecma_value_t value);
/**
* @}

View File

@ -37,39 +37,39 @@
* until the reference is freed.
*
* @return ECMA-reference
* Returned value must be freed through ecma_FreeReference.
* Returned value must be freed through ecma_free_reference.
*/
ecma_Reference_t
ecma_OpGetIdentifierReference(ecma_Object_t *lex_env_p, /**< lexical environment */
ecma_Char_t *name_p, /**< identifier's name */
ecma_reference_t
ecma_op_get_identifier_reference(ecma_object_t *lex_env_p, /**< lexical environment */
ecma_char_t *name_p, /**< identifier's name */
bool is_strict) /**< strict reference flag */
{
JERRY_ASSERT( lex_env_p != NULL );
ecma_Object_t *lex_env_iter_p = lex_env_p;
ecma_object_t *lex_env_iter_p = lex_env_p;
while ( lex_env_iter_p != NULL )
{
ecma_CompletionValue_t completion_value;
completion_value = ecma_OpHasBinding( lex_env_iter_p, name_p);
ecma_completion_value_t completion_value;
completion_value = ecma_op_has_binding( lex_env_iter_p, name_p);
if ( ecma_IsCompletionValueNormalTrue( completion_value) )
if ( ecma_is_completion_value_normal_true( completion_value) )
{
return ecma_MakeReference( ecma_MakeObjectValue( lex_env_iter_p),
return ecma_make_reference( ecma_make_object_value( lex_env_iter_p),
name_p,
is_strict);
} else
{
JERRY_ASSERT( ecma_IsCompletionValueNormalFalse( completion_value) );
JERRY_ASSERT( ecma_is_completion_value_normal_false( completion_value) );
}
lex_env_iter_p = ecma_GetPointer( lex_env_iter_p->u.LexicalEnvironment.pOuterReference);
lex_env_iter_p = ecma_get_pointer( lex_env_iter_p->u.LexicalEnvironment.pOuterReference);
}
return ecma_MakeReference( ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_UNDEFINED),
return ecma_make_reference( ecma_make_simple_value( ECMA_SIMPLE_VALUE_UNDEFINED),
name_p,
is_strict);
} /* ecma_OpGetIdentifierReference */
} /* ecma_op_get_identifier_reference */
/**
* ECMA-reference constructor.
@ -79,17 +79,17 @@ ecma_OpGetIdentifierReference(ecma_Object_t *lex_env_p, /**< lexical environment
* until the reference is freed.
*
* @return ECMA-reference
* Returned value must be freed through ecma_FreeReference.
* Returned value must be freed through ecma_free_reference.
*/
ecma_Reference_t
ecma_MakeReference(ecma_Value_t base, /**< base value */
ecma_Char_t *name_p, /**< referenced name */
ecma_reference_t
ecma_make_reference(ecma_value_t base, /**< base value */
ecma_char_t *name_p, /**< referenced name */
bool is_strict) /**< strict reference flag */
{
return (ecma_Reference_t) { .base = ecma_CopyValue( base),
return (ecma_reference_t) { .base = ecma_copy_value( base),
.referenced_name_p = name_p,
.is_strict = is_strict };
} /* ecma_MakeReference */
} /* ecma_make_reference */
/**
* Free specified ECMA-reference.
@ -98,10 +98,10 @@ ecma_MakeReference(ecma_Value_t base, /**< base value */
* freeing invalidates all copies of the reference.
*/
void
ecma_FreeReference( const ecma_Reference_t ref) /**< reference */
ecma_free_reference( const ecma_reference_t ref) /**< reference */
{
ecma_FreeValue( ref.base);
} /* ecma_FreeReference */
ecma_free_value( ref.base);
} /* ecma_free_reference */
/**
* @}

View File

@ -28,9 +28,9 @@
* @{
*/
extern ecma_Reference_t ecma_OpGetIdentifierReference(ecma_Object_t *lex_env_p, ecma_Char_t *name_p, bool is_strict);
extern ecma_Reference_t ecma_MakeReference( ecma_Value_t base, ecma_Char_t *name_p, bool is_strict);
extern void ecma_FreeReference( const ecma_Reference_t ref);
extern ecma_reference_t ecma_op_get_identifier_reference(ecma_object_t *lex_env_p, ecma_char_t *name_p, bool is_strict);
extern ecma_reference_t ecma_make_reference( ecma_value_t base, ecma_char_t *name_p, bool is_strict);
extern void ecma_free_reference( const ecma_reference_t ref);
/**
* @}