Renaming rest camelCase-named identifiers according to underscore_named_value-naming.
This commit is contained in:
@@ -51,34 +51,34 @@ JERRY_STATIC_ASSERT( sizeof (ecma_completion_value_t) == sizeof(uint32_t) );
|
||||
*
|
||||
* FIXME: Run GC only if allocation failed.
|
||||
*/
|
||||
#define ALLOC( ecmaType) ecma_ ## ecmaType ## _t * \
|
||||
ecma_alloc_ ## ecmaType (void) \
|
||||
#define ALLOC( ecma_type) ecma_ ## ecma_type ## _t * \
|
||||
ecma_alloc_ ## ecma_type (void) \
|
||||
{ \
|
||||
ecma_ ## ecmaType ## _t *p ## ecmaType = (ecma_ ## ecmaType ## _t *) \
|
||||
mem_pools_alloc( mem_size_to_pool_chunk_type( sizeof(ecma_ ## ecmaType ## _t))); \
|
||||
ecma_ ## ecma_type ## _t *p ## ecma_type = (ecma_ ## ecma_type ## _t *) \
|
||||
mem_pools_alloc( mem_size_to_pool_chunk_type( sizeof(ecma_ ## ecma_type ## _t))); \
|
||||
\
|
||||
ecma_gc_run(); \
|
||||
JERRY_ASSERT( p ## ecmaType != NULL ); \
|
||||
JERRY_ASSERT( p ## ecma_type != NULL ); \
|
||||
\
|
||||
return p ## ecmaType; \
|
||||
return p ## ecma_type; \
|
||||
}
|
||||
|
||||
/**
|
||||
* Deallocation routine template
|
||||
*/
|
||||
#define DEALLOC( ecmaType) void \
|
||||
ecma_dealloc_ ## ecmaType( ecma_ ## ecmaType ## _t *p ## ecmaType) \
|
||||
#define DEALLOC( ecma_type) void \
|
||||
ecma_dealloc_ ## ecma_type( ecma_ ## ecma_type ## _t *p ## ecma_type) \
|
||||
{ \
|
||||
mem_pools_free( mem_size_to_pool_chunk_type( sizeof(ecma_ ## ecmaType ## _t)), \
|
||||
(uint8_t*) p ## ecmaType); \
|
||||
mem_pools_free( mem_size_to_pool_chunk_type( sizeof(ecma_ ## ecma_type ## _t)), \
|
||||
(uint8_t*) p ## ecma_type); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Declaration of alloc/free routine for specified ecma-type.
|
||||
*/
|
||||
#define DECLARE_ROUTINES_FOR( ecmaType) \
|
||||
ALLOC( ecmaType) \
|
||||
DEALLOC( ecmaType)
|
||||
#define DECLARE_ROUTINES_FOR( ecma_type) \
|
||||
ALLOC( ecma_type) \
|
||||
DEALLOC( ecma_type)
|
||||
|
||||
DECLARE_ROUTINES_FOR (object)
|
||||
DECLARE_ROUTINES_FOR (property)
|
||||
|
||||
@@ -35,7 +35,7 @@ extern ecma_object_t *ecma_alloc_object(void);
|
||||
/**
|
||||
* Dealloc memory from an ecma-object
|
||||
*/
|
||||
extern void ecma_dealloc_object( ecma_object_t *pObject);
|
||||
extern void ecma_dealloc_object( ecma_object_t *object_p);
|
||||
|
||||
/**
|
||||
* Allocate memory for ecma-property
|
||||
@@ -47,7 +47,7 @@ extern ecma_property_t *ecma_alloc_property(void);
|
||||
/**
|
||||
* Dealloc memory from an ecma-property
|
||||
*/
|
||||
extern void ecma_dealloc_property( ecma_property_t *pProperty);
|
||||
extern void ecma_dealloc_property( ecma_property_t *property_p);
|
||||
|
||||
/**
|
||||
* Allocate memory for ecma-number
|
||||
@@ -59,7 +59,7 @@ extern ecma_number_t *ecma_alloc_number(void);
|
||||
/**
|
||||
* Dealloc memory from an ecma-number
|
||||
*/
|
||||
extern void ecma_dealloc_number( ecma_number_t *pNumber);
|
||||
extern void ecma_dealloc_number( ecma_number_t *number_p);
|
||||
|
||||
/**
|
||||
* Allocate memory for first chunk of an ecma-array
|
||||
@@ -71,7 +71,7 @@ extern ecma_array_first_chunk_t *ecma_alloc_array_first_chunk(void);
|
||||
/**
|
||||
* Dealloc memory from first chunk of an ecma-array
|
||||
*/
|
||||
extern void ecma_dealloc_array_first_chunk( ecma_array_first_chunk_t *pFirstChunk);
|
||||
extern void ecma_dealloc_array_first_chunk( ecma_array_first_chunk_t *first_chunk_p);
|
||||
|
||||
/**
|
||||
* Allocate memory for non-first chunk of an ecma-array
|
||||
@@ -83,7 +83,7 @@ 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_dealloc_array_non_first_chunk( ecma_array_non_first_chunk_t *pNumber);
|
||||
extern void ecma_dealloc_array_non_first_chunk( ecma_array_non_first_chunk_t *number_p);
|
||||
|
||||
#endif /* JERRY_ECMA_ALLOC_H */
|
||||
|
||||
|
||||
@@ -42,49 +42,49 @@ static ecma_object_t *ecma_gc_objs_to_free_queue;
|
||||
* After this operation the object is not longer valid for general use.
|
||||
*/
|
||||
static void
|
||||
ecma_gc_queue( ecma_object_t *pObject) /**< object */
|
||||
ecma_gc_queue( ecma_object_t *object_p) /**< object */
|
||||
{
|
||||
JERRY_ASSERT( pObject != NULL );
|
||||
JERRY_ASSERT( pObject->GCInfo.IsObjectValid );
|
||||
JERRY_ASSERT( pObject->GCInfo.u.Refs == 0 );
|
||||
JERRY_ASSERT( object_p != NULL );
|
||||
JERRY_ASSERT( object_p->GCInfo.is_object_valid );
|
||||
JERRY_ASSERT( object_p->GCInfo.u.refs == 0 );
|
||||
|
||||
pObject->GCInfo.IsObjectValid = false;
|
||||
ecma_set_pointer( pObject->GCInfo.u.NextQueuedForGC, ecma_gc_objs_to_free_queue);
|
||||
object_p->GCInfo.is_object_valid = false;
|
||||
ecma_set_pointer( object_p->GCInfo.u.next_queued_for_gc, ecma_gc_objs_to_free_queue);
|
||||
|
||||
ecma_gc_objs_to_free_queue = pObject;
|
||||
ecma_gc_objs_to_free_queue = object_p;
|
||||
} /* ecma_gc_queue */
|
||||
|
||||
/**
|
||||
* Increase reference counter of an object
|
||||
*/
|
||||
void
|
||||
ecma_ref_object(ecma_object_t *pObject) /**< object */
|
||||
ecma_ref_object(ecma_object_t *object_p) /**< object */
|
||||
{
|
||||
JERRY_ASSERT(pObject->GCInfo.IsObjectValid);
|
||||
JERRY_ASSERT(object_p->GCInfo.is_object_valid);
|
||||
|
||||
pObject->GCInfo.u.Refs++;
|
||||
object_p->GCInfo.u.refs++;
|
||||
|
||||
/**
|
||||
* Check that value was not overflowed
|
||||
*/
|
||||
JERRY_ASSERT(pObject->GCInfo.u.Refs > 0);
|
||||
JERRY_ASSERT(object_p->GCInfo.u.refs > 0);
|
||||
} /* ecma_ref_object */
|
||||
|
||||
/**
|
||||
* Decrease reference counter of an object
|
||||
*/
|
||||
void
|
||||
ecma_deref_object(ecma_object_t *pObject) /**< object */
|
||||
ecma_deref_object(ecma_object_t *object_p) /**< object */
|
||||
{
|
||||
JERRY_ASSERT(pObject != NULL);
|
||||
JERRY_ASSERT(pObject->GCInfo.IsObjectValid);
|
||||
JERRY_ASSERT(pObject->GCInfo.u.Refs > 0);
|
||||
JERRY_ASSERT(object_p != NULL);
|
||||
JERRY_ASSERT(object_p->GCInfo.is_object_valid);
|
||||
JERRY_ASSERT(object_p->GCInfo.u.refs > 0);
|
||||
|
||||
pObject->GCInfo.u.Refs--;
|
||||
object_p->GCInfo.u.refs--;
|
||||
|
||||
if ( pObject->GCInfo.u.Refs == 0 )
|
||||
if ( object_p->GCInfo.u.refs == 0 )
|
||||
{
|
||||
ecma_gc_queue( pObject);
|
||||
ecma_gc_queue( object_p);
|
||||
}
|
||||
} /* ecma_deref_object */
|
||||
|
||||
@@ -105,39 +105,39 @@ ecma_gc_run( void)
|
||||
{
|
||||
while ( ecma_gc_objs_to_free_queue != NULL )
|
||||
{
|
||||
ecma_object_t *pObject = ecma_gc_objs_to_free_queue;
|
||||
ecma_gc_objs_to_free_queue = ecma_get_pointer( pObject->GCInfo.u.NextQueuedForGC);
|
||||
ecma_object_t *object_p = ecma_gc_objs_to_free_queue;
|
||||
ecma_gc_objs_to_free_queue = ecma_get_pointer( object_p->GCInfo.u.next_queued_for_gc);
|
||||
|
||||
JERRY_ASSERT( !pObject->GCInfo.IsObjectValid );
|
||||
JERRY_ASSERT( !object_p->GCInfo.is_object_valid );
|
||||
|
||||
for ( ecma_property_t *property = ecma_get_pointer( pObject->pProperties), *pNextProperty;
|
||||
for ( ecma_property_t *property = ecma_get_pointer( object_p->properties_p), *next_property_p;
|
||||
property != NULL;
|
||||
property = pNextProperty )
|
||||
property = next_property_p )
|
||||
{
|
||||
pNextProperty = ecma_get_pointer( property->pNextProperty);
|
||||
next_property_p = ecma_get_pointer( property->next_property_p);
|
||||
|
||||
ecma_free_property( property);
|
||||
}
|
||||
|
||||
if ( pObject->IsLexicalEnvironment )
|
||||
if ( object_p->is_lexical_environment )
|
||||
{
|
||||
ecma_object_t *pOuterLexicalEnvironment = ecma_get_pointer( pObject->u.LexicalEnvironment.pOuterReference);
|
||||
ecma_object_t *outer_lexical_environment_p = ecma_get_pointer( object_p->u.lexical_environment.outer_reference_p);
|
||||
|
||||
if ( pOuterLexicalEnvironment != NULL )
|
||||
if ( outer_lexical_environment_p != NULL )
|
||||
{
|
||||
ecma_deref_object( pOuterLexicalEnvironment);
|
||||
ecma_deref_object( outer_lexical_environment_p);
|
||||
}
|
||||
} else
|
||||
{
|
||||
ecma_object_t *pPrototypeObject = ecma_get_pointer( pObject->u.Object.pPrototypeObject);
|
||||
ecma_object_t *prototype_object_p = ecma_get_pointer( object_p->u.object.prototype_object_p);
|
||||
|
||||
if ( pPrototypeObject != NULL )
|
||||
if ( prototype_object_p != NULL )
|
||||
{
|
||||
ecma_deref_object( pPrototypeObject);
|
||||
ecma_deref_object( prototype_object_p);
|
||||
}
|
||||
}
|
||||
|
||||
ecma_dealloc_object( pObject);
|
||||
ecma_dealloc_object( object_p);
|
||||
}
|
||||
} /* ecma_gc_run */
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
#include "ecma-globals.h"
|
||||
|
||||
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_ref_object(ecma_object_t *object_p);
|
||||
extern void ecma_deref_object(ecma_object_t *object_p);
|
||||
extern void ecma_gc_run( void);
|
||||
|
||||
#endif /* !ECMA_GC_H */
|
||||
|
||||
@@ -103,12 +103,12 @@ typedef enum {
|
||||
*/
|
||||
typedef struct {
|
||||
/** Value type (ecma_type_t) */
|
||||
unsigned int ValueType : 2;
|
||||
unsigned int value_type : 2;
|
||||
|
||||
/**
|
||||
* Simple value (ecma_simple_value_t) or compressed pointer to value (depending on ValueType)
|
||||
* Simple value (ecma_simple_value_t) or compressed pointer to value (depending on value_type)
|
||||
*/
|
||||
unsigned int Value : ECMA_POINTER_FIELD_WIDTH;
|
||||
unsigned int value : ECMA_POINTER_FIELD_WIDTH;
|
||||
} __packed ecma_value_t;
|
||||
|
||||
/**
|
||||
@@ -187,10 +187,10 @@ typedef enum
|
||||
*/
|
||||
typedef struct ecma_property_t {
|
||||
/** Property's type (ecma_property_type_t) */
|
||||
unsigned int Type : 2;
|
||||
unsigned int type : 2;
|
||||
|
||||
/** Compressed pointer to next property */
|
||||
unsigned int pNextProperty : ECMA_POINTER_FIELD_WIDTH;
|
||||
unsigned int next_property_p : ECMA_POINTER_FIELD_WIDTH;
|
||||
|
||||
/** Property's details (depending on Type) */
|
||||
union {
|
||||
@@ -198,47 +198,47 @@ typedef struct ecma_property_t {
|
||||
/** Description of named data property */
|
||||
struct __packed ecma_named_data_property_t {
|
||||
/** Compressed pointer to property's name (pointer to String) */
|
||||
unsigned int pName : ECMA_POINTER_FIELD_WIDTH;
|
||||
unsigned int name_p : ECMA_POINTER_FIELD_WIDTH;
|
||||
|
||||
/** Attribute 'Writable' (ecma_property_writable_value_t) */
|
||||
unsigned int Writable : 1;
|
||||
unsigned int writable : 1;
|
||||
|
||||
/** Attribute 'Enumerable' (ecma_property_enumerable_value_t) */
|
||||
unsigned int Enumerable : 1;
|
||||
unsigned int enumerable : 1;
|
||||
|
||||
/** Attribute 'Configurable' (ecma_property_configurable_value_t) */
|
||||
unsigned int Configurable : 1;
|
||||
unsigned int configurable : 1;
|
||||
|
||||
/** Value */
|
||||
ecma_value_t Value;
|
||||
} NamedDataProperty;
|
||||
ecma_value_t value;
|
||||
} named_data_property;
|
||||
|
||||
/** Description of named accessor property */
|
||||
struct __packed ecma_named_accessor_property_t {
|
||||
/** Compressed pointer to property's name (pointer to String) */
|
||||
unsigned int pName : ECMA_POINTER_FIELD_WIDTH;
|
||||
unsigned int name_p : ECMA_POINTER_FIELD_WIDTH;
|
||||
|
||||
/** Attribute 'Enumerable' (ecma_property_enumerable_value_t) */
|
||||
unsigned int Enumerable : 1;
|
||||
unsigned int enumerable : 1;
|
||||
|
||||
/** Attribute 'Configurable' (ecma_property_configurable_value_t) */
|
||||
unsigned int Configurable : 1;
|
||||
unsigned int configurable : 1;
|
||||
|
||||
/** Compressed pointer to property's getter */
|
||||
unsigned int pGet : ECMA_POINTER_FIELD_WIDTH;
|
||||
unsigned int get_p : ECMA_POINTER_FIELD_WIDTH;
|
||||
|
||||
/** Compressed pointer to property's setter */
|
||||
unsigned int pSet : ECMA_POINTER_FIELD_WIDTH;
|
||||
} NamedAccessorProperty;
|
||||
unsigned int set_p : ECMA_POINTER_FIELD_WIDTH;
|
||||
} named_accessor_property;
|
||||
|
||||
/** Description of internal property */
|
||||
struct __packed ecma_internal_property_t {
|
||||
/** Internal property's type */
|
||||
unsigned int InternalPropertyType : 4;
|
||||
unsigned int internal_property_type : 4;
|
||||
|
||||
/** Value (may be a compressed pointer) */
|
||||
unsigned int Value : ECMA_POINTER_FIELD_WIDTH;
|
||||
} InternalProperty;
|
||||
unsigned int value : ECMA_POINTER_FIELD_WIDTH;
|
||||
} internal_property;
|
||||
} u;
|
||||
} ecma_property_t;
|
||||
|
||||
@@ -250,22 +250,22 @@ typedef struct {
|
||||
* Flag that indicates if the object is valid for normal usage.
|
||||
* If the flag is zero, then the object is not valid and is queued for GC.
|
||||
*/
|
||||
unsigned int IsObjectValid : 1;
|
||||
unsigned int is_object_valid : 1;
|
||||
|
||||
/** Details (depending on IsObjectValid) */
|
||||
/** Details (depending on is_object_valid) */
|
||||
union {
|
||||
/**
|
||||
* Number of refs to the object (if IsObjectValid).
|
||||
* Number of refs to the object (if is_object_valid).
|
||||
*
|
||||
* Note: It is not a pointer. Maximum value of reference counter
|
||||
* willn't be bigger than overall count of variables/objects/properties,
|
||||
* which is limited by size of address space allocated for JerryScript
|
||||
* (and, consequently, by ECMA_POINTER_FIELD_WIDTH).
|
||||
*/
|
||||
unsigned int Refs : ECMA_POINTER_FIELD_WIDTH;
|
||||
unsigned int refs : ECMA_POINTER_FIELD_WIDTH;
|
||||
|
||||
/** Compressed pointer to next object in the list of objects, queued for GC (if !IsObjectValid) */
|
||||
unsigned int NextQueuedForGC : ECMA_POINTER_FIELD_WIDTH;
|
||||
/** Compressed pointer to next object in the list of objects, queued for GC (if !is_object_valid) */
|
||||
unsigned int next_queued_for_gc : ECMA_POINTER_FIELD_WIDTH;
|
||||
} __packed u;
|
||||
} ecma_gc_info_t;
|
||||
|
||||
@@ -279,44 +279,44 @@ typedef enum {
|
||||
|
||||
/**
|
||||
* Description of ECMA-object or lexical environment
|
||||
* (depending on IsLexicalEnvironment).
|
||||
* (depending on is_lexical_environment).
|
||||
*/
|
||||
typedef struct ecma_object_t {
|
||||
/** Compressed pointer to property list */
|
||||
unsigned int pProperties : ECMA_POINTER_FIELD_WIDTH;
|
||||
unsigned int properties_p : ECMA_POINTER_FIELD_WIDTH;
|
||||
|
||||
/** Flag indicating whether it is a general object (false)
|
||||
or a lexical environment (true) */
|
||||
unsigned int IsLexicalEnvironment : 1;
|
||||
unsigned int is_lexical_environment : 1;
|
||||
|
||||
/**
|
||||
* Attributes of either general object or lexical environment
|
||||
* (depending on IsLexicalEnvironment)
|
||||
* (depending on is_lexical_environment)
|
||||
*/
|
||||
union {
|
||||
/**
|
||||
* A general object's attributes (if !IsLexicalEnvironment)
|
||||
* A general object's attributes (if !is_lexical_environment)
|
||||
*/
|
||||
struct {
|
||||
/** Attribute 'Extensible' */
|
||||
unsigned int Extensible : 1;
|
||||
unsigned int extensible : 1;
|
||||
|
||||
/** Compressed pointer to prototype object (ecma_object_t) */
|
||||
unsigned int pPrototypeObject : ECMA_POINTER_FIELD_WIDTH;
|
||||
} __packed Object;
|
||||
unsigned int prototype_object_p : ECMA_POINTER_FIELD_WIDTH;
|
||||
} __packed object;
|
||||
|
||||
/**
|
||||
* A lexical environment's attribute (if IsLexicalEnvironment)
|
||||
* A lexical environment's attribute (if is_lexical_environment)
|
||||
*/
|
||||
struct {
|
||||
/**
|
||||
* Type of lexical environment (ecma_lexical_environment_type_t).
|
||||
*/
|
||||
unsigned int Type : 1;
|
||||
unsigned int type : 1;
|
||||
|
||||
/** Compressed pointer to outer lexical environment */
|
||||
unsigned int pOuterReference : ECMA_POINTER_FIELD_WIDTH;
|
||||
} __packed LexicalEnvironment;
|
||||
unsigned int outer_reference_p : ECMA_POINTER_FIELD_WIDTH;
|
||||
} __packed lexical_environment;
|
||||
|
||||
} __packed u;
|
||||
|
||||
@@ -344,10 +344,10 @@ typedef uint16_t ecma_length_t;
|
||||
*/
|
||||
typedef struct {
|
||||
/** Compressed pointer to next chunk */
|
||||
uint16_t pNextChunk;
|
||||
uint16_t next_chunk_p;
|
||||
|
||||
/** Number of elements in the Array */
|
||||
ecma_length_t UnitNumber;
|
||||
ecma_length_t unit_number;
|
||||
} ecma_array_header_t;
|
||||
|
||||
/**
|
||||
@@ -360,10 +360,10 @@ typedef struct {
|
||||
*/
|
||||
typedef struct {
|
||||
/** Array's header */
|
||||
ecma_array_header_t Header;
|
||||
ecma_array_header_t header;
|
||||
|
||||
/** Elements */
|
||||
uint8_t Data[ ECMA_ARRAY_CHUNK_SIZE_IN_BYTES - sizeof (ecma_array_header_t) ];
|
||||
uint8_t data[ ECMA_ARRAY_CHUNK_SIZE_IN_BYTES - sizeof (ecma_array_header_t) ];
|
||||
} ecma_array_first_chunk_t;
|
||||
|
||||
/**
|
||||
@@ -371,10 +371,10 @@ typedef struct {
|
||||
*/
|
||||
typedef struct {
|
||||
/** Compressed pointer to next chunk */
|
||||
uint16_t pNextChunk;
|
||||
uint16_t next_chunk_p;
|
||||
|
||||
/** Characters */
|
||||
uint8_t Data[ ECMA_ARRAY_CHUNK_SIZE_IN_BYTES - sizeof (uint16_t) ];
|
||||
uint8_t data[ ECMA_ARRAY_CHUNK_SIZE_IN_BYTES - sizeof (uint16_t) ];
|
||||
} ecma_array_non_first_chunk_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
bool
|
||||
ecma_is_value_undefined( ecma_value_t value) /**< ecma-value */
|
||||
{
|
||||
return ( value.ValueType == ECMA_TYPE_SIMPLE && value.Value == ECMA_SIMPLE_VALUE_UNDEFINED );
|
||||
return ( value.value_type == ECMA_TYPE_SIMPLE && value.value == ECMA_SIMPLE_VALUE_UNDEFINED );
|
||||
} /* ecma_is_value_undefined */
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ ecma_is_value_undefined( ecma_value_t value) /**< ecma-value */
|
||||
bool
|
||||
ecma_is_value_null( ecma_value_t value) /**< ecma-value */
|
||||
{
|
||||
return ( value.ValueType == ECMA_TYPE_SIMPLE && value.Value == ECMA_SIMPLE_VALUE_NULL );
|
||||
return ( value.value_type == ECMA_TYPE_SIMPLE && value.value == ECMA_SIMPLE_VALUE_NULL );
|
||||
} /* ecma_is_value_null */
|
||||
|
||||
/**
|
||||
@@ -59,8 +59,8 @@ ecma_is_value_null( ecma_value_t value) /**< ecma-value */
|
||||
bool
|
||||
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 ) );
|
||||
return ( ( value.value_type == ECMA_TYPE_SIMPLE && value.value == ECMA_SIMPLE_VALUE_FALSE )
|
||||
|| ( value.value_type == ECMA_TYPE_SIMPLE && value.value == ECMA_SIMPLE_VALUE_TRUE ) );
|
||||
} /* ecma_is_value_boolean */
|
||||
|
||||
/**
|
||||
@@ -77,7 +77,7 @@ ecma_is_value_true( ecma_value_t value) /**< ecma-value */
|
||||
{
|
||||
JERRY_ASSERT( ecma_is_value_boolean( value) );
|
||||
|
||||
return ( value.ValueType == ECMA_TYPE_SIMPLE && value.Value == ECMA_SIMPLE_VALUE_TRUE );
|
||||
return ( value.value_type == ECMA_TYPE_SIMPLE && value.value == ECMA_SIMPLE_VALUE_TRUE );
|
||||
} /* ecma_is_value_true */
|
||||
|
||||
/**
|
||||
@@ -86,7 +86,7 @@ ecma_is_value_true( ecma_value_t value) /**< ecma-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 };
|
||||
return (ecma_value_t) { .value_type = ECMA_TYPE_SIMPLE, .value = value };
|
||||
} /* ecma_make_simple_value */
|
||||
|
||||
/**
|
||||
@@ -99,8 +99,8 @@ ecma_make_number_value( ecma_number_t* num_p) /**< number to reference in value
|
||||
|
||||
ecma_value_t number_value;
|
||||
|
||||
number_value.ValueType = ECMA_TYPE_NUMBER;
|
||||
ecma_set_pointer( number_value.Value, num_p);
|
||||
number_value.value_type = ECMA_TYPE_NUMBER;
|
||||
ecma_set_pointer( number_value.value, num_p);
|
||||
|
||||
return number_value;
|
||||
} /* ecma_make_number_value */
|
||||
@@ -115,14 +115,14 @@ ecma_make_string_value( ecma_array_first_chunk_t* ecma_string_p) /**< string to
|
||||
|
||||
ecma_value_t string_value;
|
||||
|
||||
string_value.ValueType = ECMA_TYPE_STRING;
|
||||
ecma_set_pointer( string_value.Value, ecma_string_p);
|
||||
string_value.value_type = ECMA_TYPE_STRING;
|
||||
ecma_set_pointer( string_value.value, ecma_string_p);
|
||||
|
||||
return string_value;
|
||||
} /* ecma_make_string_value */
|
||||
|
||||
/**
|
||||
* Object value constructor
|
||||
* object value constructor
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_make_object_value( ecma_object_t* object_p) /**< object to reference in value */
|
||||
@@ -131,8 +131,8 @@ ecma_make_object_value( ecma_object_t* object_p) /**< object to reference in val
|
||||
|
||||
ecma_value_t object_value;
|
||||
|
||||
object_value.ValueType = ECMA_TYPE_OBJECT;
|
||||
ecma_set_pointer( object_value.Value, object_p);
|
||||
object_value.value_type = ECMA_TYPE_OBJECT;
|
||||
ecma_set_pointer( object_value.value, object_p);
|
||||
|
||||
return object_value;
|
||||
} /* ecma_make_object_value */
|
||||
@@ -163,7 +163,7 @@ ecma_copy_value( const ecma_value_t value) /**< ecma-value */
|
||||
{
|
||||
ecma_value_t value_copy;
|
||||
|
||||
switch ( (ecma_type_t)value.ValueType )
|
||||
switch ( (ecma_type_t)value.value_type )
|
||||
{
|
||||
case ECMA_TYPE_SIMPLE:
|
||||
{
|
||||
@@ -173,32 +173,32 @@ ecma_copy_value( const ecma_value_t value) /**< ecma-value */
|
||||
}
|
||||
case ECMA_TYPE_NUMBER:
|
||||
{
|
||||
ecma_number_t *num_p = ecma_get_pointer( value.Value);
|
||||
ecma_number_t *num_p = ecma_get_pointer( value.value);
|
||||
JERRY_ASSERT( num_p != NULL );
|
||||
|
||||
ecma_number_t *number_copy_p = ecma_alloc_number();
|
||||
*number_copy_p = *num_p;
|
||||
|
||||
value_copy = (ecma_value_t) { .ValueType = ECMA_TYPE_NUMBER };
|
||||
ecma_set_pointer( value_copy.Value, number_copy_p);
|
||||
value_copy = (ecma_value_t) { .value_type = ECMA_TYPE_NUMBER };
|
||||
ecma_set_pointer( value_copy.value, number_copy_p);
|
||||
|
||||
break;
|
||||
}
|
||||
case ECMA_TYPE_STRING:
|
||||
{
|
||||
ecma_array_first_chunk_t *string_p = ecma_get_pointer( value.Value);
|
||||
ecma_array_first_chunk_t *string_p = ecma_get_pointer( value.value);
|
||||
JERRY_ASSERT( string_p != NULL );
|
||||
|
||||
ecma_array_first_chunk_t *string_copy_p = ecma_duplicate_ecma_string( string_p);
|
||||
|
||||
value_copy = (ecma_value_t) { .ValueType = ECMA_TYPE_STRING };
|
||||
ecma_set_pointer( value_copy.Value, string_copy_p);
|
||||
value_copy = (ecma_value_t) { .value_type = ECMA_TYPE_STRING };
|
||||
ecma_set_pointer( value_copy.value, string_copy_p);
|
||||
|
||||
break;
|
||||
}
|
||||
case ECMA_TYPE_OBJECT:
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_pointer( value.Value);
|
||||
ecma_object_t *obj_p = ecma_get_pointer( value.value);
|
||||
JERRY_ASSERT( obj_p != NULL );
|
||||
|
||||
ecma_ref_object( obj_p);
|
||||
@@ -222,7 +222,7 @@ ecma_copy_value( const ecma_value_t value) /**< ecma-value */
|
||||
void
|
||||
ecma_free_value( ecma_value_t value) /**< value description */
|
||||
{
|
||||
switch ( (ecma_type_t) value.ValueType )
|
||||
switch ( (ecma_type_t) value.value_type )
|
||||
{
|
||||
case ECMA_TYPE_SIMPLE:
|
||||
{
|
||||
@@ -232,21 +232,21 @@ ecma_free_value( ecma_value_t value) /**< value description */
|
||||
|
||||
case ECMA_TYPE_NUMBER:
|
||||
{
|
||||
ecma_number_t *pNumber = ecma_get_pointer( value.Value);
|
||||
ecma_dealloc_number( pNumber);
|
||||
ecma_number_t *number_p = ecma_get_pointer( value.value);
|
||||
ecma_dealloc_number( number_p);
|
||||
break;
|
||||
}
|
||||
|
||||
case ECMA_TYPE_STRING:
|
||||
{
|
||||
ecma_array_first_chunk_t *pString = ecma_get_pointer( value.Value);
|
||||
ecma_free_array( pString);
|
||||
ecma_array_first_chunk_t *string_p = ecma_get_pointer( value.value);
|
||||
ecma_free_array( string_p);
|
||||
break;
|
||||
}
|
||||
|
||||
case ECMA_TYPE_OBJECT:
|
||||
{
|
||||
ecma_deref_object( ecma_get_pointer( value.Value));
|
||||
ecma_deref_object( ecma_get_pointer( value.value));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ ecma_make_completion_value(ecma_completion_type_t type, /**< type */
|
||||
ecma_completion_value_t
|
||||
ecma_make_throw_value( ecma_object_t *exception_p) /**< an object */
|
||||
{
|
||||
JERRY_ASSERT( exception_p != NULL && !exception_p->IsLexicalEnvironment );
|
||||
JERRY_ASSERT( exception_p != NULL && !exception_p->is_lexical_environment );
|
||||
|
||||
ecma_value_t exception = ecma_make_object_value( exception_p);
|
||||
|
||||
@@ -329,7 +329,7 @@ ecma_free_completion_value( ecma_completion_value_t completion_value) /**< compl
|
||||
case ECMA_COMPLETION_TYPE_CONTINUE:
|
||||
case ECMA_COMPLETION_TYPE_BREAK:
|
||||
case ECMA_COMPLETION_TYPE_EXIT:
|
||||
JERRY_ASSERT( completion_value.value.ValueType == ECMA_TYPE_SIMPLE );
|
||||
JERRY_ASSERT( completion_value.value.value_type == ECMA_TYPE_SIMPLE );
|
||||
break;
|
||||
}
|
||||
} /* ecma_free_completion_value */
|
||||
@@ -370,8 +370,8 @@ ecma_is_completion_value_normal_simple_value(ecma_completion_value_t 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
|
||||
&& value.value.Value == simple_value );
|
||||
&& value.value.value_type == ECMA_TYPE_SIMPLE
|
||||
&& value.value.value == simple_value );
|
||||
} /* ecma_is_completion_value_normal_simple_value */
|
||||
|
||||
/**
|
||||
|
||||
+183
-183
@@ -37,35 +37,35 @@ ecma_compress_pointer(void *pointer) /**< pointer to compress */
|
||||
return ECMA_NULL_POINTER;
|
||||
}
|
||||
|
||||
uintptr_t intPtr = (uintptr_t) pointer;
|
||||
uintptr_t int_ptr = (uintptr_t) pointer;
|
||||
|
||||
JERRY_ASSERT(intPtr % MEM_ALIGNMENT == 0);
|
||||
JERRY_ASSERT(int_ptr % MEM_ALIGNMENT == 0);
|
||||
|
||||
intPtr -= mem_get_base_pointer();
|
||||
intPtr >>= MEM_ALIGNMENT_LOG;
|
||||
int_ptr -= mem_get_base_pointer();
|
||||
int_ptr >>= MEM_ALIGNMENT_LOG;
|
||||
|
||||
JERRY_ASSERT((intPtr & ~((1u << ECMA_POINTER_FIELD_WIDTH) - 1)) == 0);
|
||||
JERRY_ASSERT((int_ptr & ~((1u << ECMA_POINTER_FIELD_WIDTH) - 1)) == 0);
|
||||
|
||||
return intPtr;
|
||||
return int_ptr;
|
||||
} /* ecma_compress_pointer */
|
||||
|
||||
/**
|
||||
* Decompress pointer.
|
||||
*/
|
||||
void*
|
||||
ecma_decompress_pointer(uintptr_t compressedPointer) /**< pointer to decompress */
|
||||
ecma_decompress_pointer(uintptr_t compressed_pointer) /**< pointer to decompress */
|
||||
{
|
||||
if ( compressedPointer == ECMA_NULL_POINTER )
|
||||
if ( compressed_pointer == ECMA_NULL_POINTER )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uintptr_t intPtr = compressedPointer;
|
||||
uintptr_t int_ptr = compressed_pointer;
|
||||
|
||||
intPtr <<= MEM_ALIGNMENT_LOG;
|
||||
intPtr += mem_get_base_pointer();
|
||||
int_ptr <<= MEM_ALIGNMENT_LOG;
|
||||
int_ptr += mem_get_base_pointer();
|
||||
|
||||
return (void*) intPtr;
|
||||
return (void*) int_ptr;
|
||||
} /* ecma_decompress_pointer */
|
||||
|
||||
/**
|
||||
@@ -78,23 +78,23 @@ ecma_decompress_pointer(uintptr_t compressedPointer) /**< pointer to decompress
|
||||
* @return pointer to the object's descriptor
|
||||
*/
|
||||
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_create_object( ecma_object_t *prototype_object_p, /**< pointer to prototybe of the object (or NULL) */
|
||||
bool is_extensible) /**< value of extensible attribute */
|
||||
{
|
||||
ecma_object_t *pObject = ecma_alloc_object();
|
||||
ecma_object_t *object_p = ecma_alloc_object();
|
||||
|
||||
pObject->pProperties = ECMA_NULL_POINTER;
|
||||
pObject->IsLexicalEnvironment = false;
|
||||
pObject->GCInfo.IsObjectValid = true;
|
||||
object_p->properties_p = ECMA_NULL_POINTER;
|
||||
object_p->is_lexical_environment = false;
|
||||
object_p->GCInfo.is_object_valid = true;
|
||||
|
||||
/* The global object is always referenced
|
||||
* (at least with the ctx_GlobalObject variable) */
|
||||
pObject->GCInfo.u.Refs = 1;
|
||||
object_p->GCInfo.u.refs = 1;
|
||||
|
||||
pObject->u.Object.Extensible = isExtensible;
|
||||
ecma_set_pointer( pObject->u.Object.pPrototypeObject, pPrototypeObject);
|
||||
object_p->u.object.extensible = is_extensible;
|
||||
ecma_set_pointer( object_p->u.object.prototype_object_p, prototype_object_p);
|
||||
|
||||
return pObject;
|
||||
return object_p;
|
||||
} /* ecma_create_object */
|
||||
|
||||
/**
|
||||
@@ -110,22 +110,22 @@ ecma_create_object( ecma_object_t *pPrototypeObject, /**< pointer to prototybe o
|
||||
* @return pointer to the descriptor of lexical environment
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_create_lexical_environment(ecma_object_t *pOuterLexicalEnvironment, /**< outer lexical environment */
|
||||
ecma_create_lexical_environment(ecma_object_t *outer_lexical_environment_p, /**< outer lexical environment */
|
||||
ecma_lexical_environment_type_t type) /**< type of lexical environment to create */
|
||||
{
|
||||
ecma_object_t *pNewLexicalEnvironment = ecma_alloc_object();
|
||||
ecma_object_t *new_lexical_environment_p = ecma_alloc_object();
|
||||
|
||||
pNewLexicalEnvironment->IsLexicalEnvironment = true;
|
||||
pNewLexicalEnvironment->u.LexicalEnvironment.Type = type;
|
||||
new_lexical_environment_p->is_lexical_environment = true;
|
||||
new_lexical_environment_p->u.lexical_environment.type = type;
|
||||
|
||||
pNewLexicalEnvironment->pProperties = ECMA_NULL_POINTER;
|
||||
new_lexical_environment_p->properties_p = ECMA_NULL_POINTER;
|
||||
|
||||
pNewLexicalEnvironment->GCInfo.IsObjectValid = true;
|
||||
pNewLexicalEnvironment->GCInfo.u.Refs = 1;
|
||||
new_lexical_environment_p->GCInfo.is_object_valid = true;
|
||||
new_lexical_environment_p->GCInfo.u.refs = 1;
|
||||
|
||||
ecma_set_pointer( pNewLexicalEnvironment->u.LexicalEnvironment.pOuterReference, pOuterLexicalEnvironment);
|
||||
ecma_set_pointer( new_lexical_environment_p->u.lexical_environment.outer_reference_p, outer_lexical_environment_p);
|
||||
|
||||
return pNewLexicalEnvironment;
|
||||
return new_lexical_environment_p;
|
||||
} /* ecma_create_lexical_environment */
|
||||
|
||||
/**
|
||||
@@ -135,20 +135,20 @@ ecma_create_lexical_environment(ecma_object_t *pOuterLexicalEnvironment, /**< ou
|
||||
* @return pointer to newly created property's des
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_create_internal_property(ecma_object_t *pObject, /**< the object */
|
||||
ecma_internal_property_id_t propertyId) /**< internal property identifier */
|
||||
ecma_create_internal_property(ecma_object_t *object_p, /**< the object */
|
||||
ecma_internal_property_id_t property_id) /**< internal property identifier */
|
||||
{
|
||||
ecma_property_t *pNewProperty = ecma_alloc_property();
|
||||
ecma_property_t *new_property_p = ecma_alloc_property();
|
||||
|
||||
pNewProperty->Type = ECMA_PROPERTY_INTERNAL;
|
||||
new_property_p->type = ECMA_PROPERTY_INTERNAL;
|
||||
|
||||
ecma_set_pointer( pNewProperty->pNextProperty, ecma_get_pointer( pObject->pProperties));
|
||||
ecma_set_pointer( pObject->pProperties, pNewProperty);
|
||||
ecma_set_pointer( new_property_p->next_property_p, ecma_get_pointer( object_p->properties_p));
|
||||
ecma_set_pointer( object_p->properties_p, new_property_p);
|
||||
|
||||
pNewProperty->u.InternalProperty.InternalPropertyType = propertyId;
|
||||
pNewProperty->u.InternalProperty.Value = ECMA_NULL_POINTER;
|
||||
new_property_p->u.internal_property.internal_property_type = property_id;
|
||||
new_property_p->u.internal_property.value = ECMA_NULL_POINTER;
|
||||
|
||||
return pNewProperty;
|
||||
return new_property_p;
|
||||
} /* ecma_create_internal_property */
|
||||
|
||||
/**
|
||||
@@ -158,23 +158,23 @@ ecma_create_internal_property(ecma_object_t *pObject, /**< the object */
|
||||
* NULL - otherwise.
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_find_internal_property(ecma_object_t *pObject, /**< object descriptor */
|
||||
ecma_internal_property_id_t propertyId) /**< internal property identifier */
|
||||
ecma_find_internal_property(ecma_object_t *object_p, /**< object descriptor */
|
||||
ecma_internal_property_id_t property_id) /**< internal property identifier */
|
||||
{
|
||||
JERRY_ASSERT( pObject != NULL );
|
||||
JERRY_ASSERT( object_p != NULL );
|
||||
|
||||
JERRY_ASSERT( propertyId != ECMA_INTERNAL_PROPERTY_PROTOTYPE
|
||||
&& propertyId != ECMA_INTERNAL_PROPERTY_EXTENSIBLE );
|
||||
JERRY_ASSERT( property_id != ECMA_INTERNAL_PROPERTY_PROTOTYPE
|
||||
&& property_id != ECMA_INTERNAL_PROPERTY_EXTENSIBLE );
|
||||
|
||||
for ( ecma_property_t *pProperty = ecma_get_pointer( pObject->pProperties);
|
||||
pProperty != NULL;
|
||||
pProperty = ecma_get_pointer( pProperty->pNextProperty) )
|
||||
for ( ecma_property_t *property_p = ecma_get_pointer( object_p->properties_p);
|
||||
property_p != NULL;
|
||||
property_p = ecma_get_pointer( property_p->next_property_p) )
|
||||
{
|
||||
if ( pProperty->Type == ECMA_PROPERTY_INTERNAL )
|
||||
if ( property_p->type == ECMA_PROPERTY_INTERNAL )
|
||||
{
|
||||
if ( pProperty->u.InternalProperty.InternalPropertyType == propertyId )
|
||||
if ( property_p->u.internal_property.internal_property_type == property_id )
|
||||
{
|
||||
return pProperty;
|
||||
return property_p;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -191,14 +191,14 @@ ecma_find_internal_property(ecma_object_t *pObject, /**< object descriptor */
|
||||
* @return pointer to the property
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_get_internal_property(ecma_object_t *pObject, /**< object descriptor */
|
||||
ecma_internal_property_id_t propertyId) /**< internal property identifier */
|
||||
ecma_get_internal_property(ecma_object_t *object_p, /**< object descriptor */
|
||||
ecma_internal_property_id_t property_id) /**< internal property identifier */
|
||||
{
|
||||
ecma_property_t *pProperty = ecma_find_internal_property( pObject, propertyId);
|
||||
ecma_property_t *property_p = ecma_find_internal_property( object_p, property_id);
|
||||
|
||||
JERRY_ASSERT( pProperty != NULL );
|
||||
JERRY_ASSERT( property_p != NULL );
|
||||
|
||||
return pProperty;
|
||||
return property_p;
|
||||
} /* ecma_get_internal_property */
|
||||
|
||||
/**
|
||||
@@ -218,18 +218,18 @@ ecma_create_named_property(ecma_object_t *obj_p, /**< object */
|
||||
|
||||
ecma_property_t *prop = ecma_alloc_property();
|
||||
|
||||
prop->Type = ECMA_PROPERTY_NAMEDDATA;
|
||||
prop->type = ECMA_PROPERTY_NAMEDDATA;
|
||||
|
||||
ecma_set_pointer( prop->u.NamedDataProperty.pName, ecma_new_ecma_string( name_p));
|
||||
ecma_set_pointer( prop->u.named_data_property.name_p, ecma_new_ecma_string( name_p));
|
||||
|
||||
prop->u.NamedDataProperty.Writable = writable;
|
||||
prop->u.NamedDataProperty.Enumerable = enumerable;
|
||||
prop->u.NamedDataProperty.Configurable = configurable;
|
||||
prop->u.named_data_property.writable = writable;
|
||||
prop->u.named_data_property.enumerable = enumerable;
|
||||
prop->u.named_data_property.configurable = configurable;
|
||||
|
||||
prop->u.NamedDataProperty.Value = ecma_make_simple_value( ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
prop->u.named_data_property.value = ecma_make_simple_value( ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
|
||||
ecma_set_pointer( prop->pNextProperty, ecma_get_pointer( obj_p->pProperties));
|
||||
ecma_set_pointer( obj_p->pProperties, prop);
|
||||
ecma_set_pointer( prop->next_property_p, ecma_get_pointer( obj_p->properties_p));
|
||||
ecma_set_pointer( obj_p->properties_p, prop);
|
||||
|
||||
return prop;
|
||||
} /* ecma_create_named_property */
|
||||
@@ -247,18 +247,18 @@ ecma_find_named_property(ecma_object_t *obj_p, /**< object to find property in *
|
||||
JERRY_ASSERT( obj_p != NULL );
|
||||
JERRY_ASSERT( name_p != NULL );
|
||||
|
||||
for ( ecma_property_t *property_p = ecma_get_pointer( obj_p->pProperties);
|
||||
for ( ecma_property_t *property_p = ecma_get_pointer( obj_p->properties_p);
|
||||
property_p != NULL;
|
||||
property_p = ecma_get_pointer( property_p->pNextProperty) )
|
||||
property_p = ecma_get_pointer( property_p->next_property_p) )
|
||||
{
|
||||
ecma_array_first_chunk_t *property_name_p;
|
||||
|
||||
if ( property_p->Type == ECMA_PROPERTY_NAMEDDATA )
|
||||
if ( property_p->type == ECMA_PROPERTY_NAMEDDATA )
|
||||
{
|
||||
property_name_p = ecma_get_pointer( property_p->u.NamedDataProperty.pName);
|
||||
} else if ( property_p->Type == ECMA_PROPERTY_NAMEDACCESSOR )
|
||||
property_name_p = ecma_get_pointer( property_p->u.named_data_property.name_p);
|
||||
} else if ( property_p->type == ECMA_PROPERTY_NAMEDACCESSOR )
|
||||
{
|
||||
property_name_p = ecma_get_pointer( property_p->u.NamedAccessorProperty.pName);
|
||||
property_name_p = ecma_get_pointer( property_p->u.named_accessor_property.name_p);
|
||||
} else
|
||||
{
|
||||
continue;
|
||||
@@ -316,7 +316,7 @@ ecma_get_named_data_property(ecma_object_t *obj_p, /**< object to find property
|
||||
|
||||
ecma_property_t *property_p = ecma_find_named_property( obj_p, name_p);
|
||||
|
||||
JERRY_ASSERT( property_p != NULL && property_p->Type == ECMA_PROPERTY_NAMEDDATA );
|
||||
JERRY_ASSERT( property_p != NULL && property_p->type == ECMA_PROPERTY_NAMEDDATA );
|
||||
|
||||
return property_p;
|
||||
} /* ecma_get_named_data_property */
|
||||
@@ -325,67 +325,67 @@ ecma_get_named_data_property(ecma_object_t *obj_p, /**< object to find property
|
||||
* Free the named data property and values it references.
|
||||
*/
|
||||
void
|
||||
ecma_free_named_data_property( ecma_property_t *pProperty) /**< the property */
|
||||
ecma_free_named_data_property( ecma_property_t *property_p) /**< the property */
|
||||
{
|
||||
JERRY_ASSERT( pProperty->Type == ECMA_PROPERTY_NAMEDDATA );
|
||||
JERRY_ASSERT( property_p->type == ECMA_PROPERTY_NAMEDDATA );
|
||||
|
||||
ecma_free_array( ecma_get_pointer( pProperty->u.NamedDataProperty.pName));
|
||||
ecma_free_value( pProperty->u.NamedDataProperty.Value);
|
||||
ecma_free_array( ecma_get_pointer( property_p->u.named_data_property.name_p));
|
||||
ecma_free_value( property_p->u.named_data_property.value);
|
||||
|
||||
ecma_dealloc_property( pProperty);
|
||||
ecma_dealloc_property( property_p);
|
||||
} /* ecma_free_named_data_property */
|
||||
|
||||
/**
|
||||
* Free the named accessor property and values it references.
|
||||
*/
|
||||
void
|
||||
ecma_free_named_accessor_property( ecma_property_t *pProperty) /**< the property */
|
||||
ecma_free_named_accessor_property( ecma_property_t *property_p) /**< the property */
|
||||
{
|
||||
JERRY_ASSERT( pProperty->Type == ECMA_PROPERTY_NAMEDACCESSOR );
|
||||
JERRY_ASSERT( property_p->type == ECMA_PROPERTY_NAMEDACCESSOR );
|
||||
|
||||
ecma_free_array( ecma_get_pointer( pProperty->u.NamedAccessorProperty.pName));
|
||||
ecma_free_array( ecma_get_pointer( property_p->u.named_accessor_property.name_p));
|
||||
|
||||
ecma_object_t *pGet = ecma_get_pointer(pProperty->u.NamedAccessorProperty.pGet);
|
||||
ecma_object_t *pSet = ecma_get_pointer(pProperty->u.NamedAccessorProperty.pSet);
|
||||
ecma_object_t *get_p = ecma_get_pointer(property_p->u.named_accessor_property.get_p);
|
||||
ecma_object_t *set_p = ecma_get_pointer(property_p->u.named_accessor_property.set_p);
|
||||
|
||||
if ( pGet != NULL )
|
||||
if ( get_p != NULL )
|
||||
{
|
||||
ecma_deref_object( pGet);
|
||||
ecma_deref_object( get_p);
|
||||
}
|
||||
|
||||
if ( pSet != NULL )
|
||||
if ( set_p != NULL )
|
||||
{
|
||||
ecma_deref_object( pSet);
|
||||
ecma_deref_object( set_p);
|
||||
}
|
||||
|
||||
ecma_dealloc_property( pProperty);
|
||||
ecma_dealloc_property( property_p);
|
||||
} /* ecma_free_named_accessor_property */
|
||||
|
||||
/**
|
||||
* Free the internal property and values it references.
|
||||
*/
|
||||
void
|
||||
ecma_free_internal_property( ecma_property_t *pProperty) /**< the property */
|
||||
ecma_free_internal_property( ecma_property_t *property_p) /**< the property */
|
||||
{
|
||||
JERRY_ASSERT( pProperty->Type == ECMA_PROPERTY_INTERNAL );
|
||||
JERRY_ASSERT( property_p->type == ECMA_PROPERTY_INTERNAL );
|
||||
|
||||
ecma_internal_property_id_t propertyId = pProperty->u.InternalProperty.InternalPropertyType;
|
||||
uint32_t propertyValue = pProperty->u.InternalProperty.Value;
|
||||
ecma_internal_property_id_t property_id = property_p->u.internal_property.internal_property_type;
|
||||
uint32_t property_value = property_p->u.internal_property.value;
|
||||
|
||||
switch ( propertyId )
|
||||
switch ( property_id )
|
||||
{
|
||||
case ECMA_INTERNAL_PROPERTY_CLASS: /* a string */
|
||||
case ECMA_INTERNAL_PROPERTY_NUMBER_INDEXED_ARRAY_VALUES: /* an array */
|
||||
case ECMA_INTERNAL_PROPERTY_STRING_INDEXED_ARRAY_VALUES: /* an array */
|
||||
{
|
||||
ecma_free_array( ecma_get_pointer( propertyValue));
|
||||
ecma_free_array( ecma_get_pointer( property_value));
|
||||
break;
|
||||
}
|
||||
|
||||
case ECMA_INTERNAL_PROPERTY_SCOPE: /* a lexical environment */
|
||||
case ECMA_INTERNAL_PROPERTY_BINDING_OBJECT: /* an object */
|
||||
{
|
||||
ecma_deref_object( ecma_get_pointer( propertyValue));
|
||||
ecma_deref_object( ecma_get_pointer( property_value));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ ecma_free_internal_property( ecma_property_t *pProperty) /**< the property */
|
||||
}
|
||||
}
|
||||
|
||||
ecma_dealloc_property( pProperty);
|
||||
ecma_dealloc_property( property_p);
|
||||
} /* ecma_free_internal_property */
|
||||
|
||||
/**
|
||||
@@ -406,7 +406,7 @@ ecma_free_internal_property( ecma_property_t *pProperty) /**< the property */
|
||||
void
|
||||
ecma_free_property(ecma_property_t *prop_p) /**< property */
|
||||
{
|
||||
switch ( (ecma_property_type_t) prop_p->Type )
|
||||
switch ( (ecma_property_type_t) prop_p->type )
|
||||
{
|
||||
case ECMA_PROPERTY_NAMEDDATA:
|
||||
{
|
||||
@@ -440,11 +440,11 @@ void
|
||||
ecma_delete_property(ecma_object_t *obj_p, /**< object */
|
||||
ecma_property_t *prop_p) /**< property */
|
||||
{
|
||||
for ( ecma_property_t *cur_prop_p = ecma_get_pointer( obj_p->pProperties), *prev_prop_p = NULL, *next_prop_p;
|
||||
for ( ecma_property_t *cur_prop_p = ecma_get_pointer( obj_p->properties_p), *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_get_pointer( cur_prop_p->pNextProperty);
|
||||
next_prop_p = ecma_get_pointer( cur_prop_p->next_property_p);
|
||||
|
||||
if ( cur_prop_p == prop_p )
|
||||
{
|
||||
@@ -452,10 +452,10 @@ ecma_delete_property(ecma_object_t *obj_p, /**< object */
|
||||
|
||||
if ( prev_prop_p == NULL )
|
||||
{
|
||||
ecma_set_pointer( obj_p->pProperties, next_prop_p);
|
||||
ecma_set_pointer( obj_p->properties_p, next_prop_p);
|
||||
} else
|
||||
{
|
||||
ecma_set_pointer( prev_prop_p->pNextProperty, next_prop_p);
|
||||
ecma_set_pointer( prev_prop_p->next_property_p, next_prop_p);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -471,53 +471,53 @@ ecma_delete_property(ecma_object_t *obj_p, /**< object */
|
||||
* @return Pointer to first chunk of an array, containing allocated string
|
||||
*/
|
||||
ecma_array_first_chunk_t*
|
||||
ecma_new_ecma_string(const ecma_char_t *pString) /**< zero-terminated string of ecma-characters */
|
||||
ecma_new_ecma_string(const ecma_char_t *string_p) /**< zero-terminated string of ecma-characters */
|
||||
{
|
||||
ecma_length_t length = 0;
|
||||
|
||||
/*
|
||||
* TODO: Do not precalculate length.
|
||||
*/
|
||||
if ( pString != NULL )
|
||||
if ( string_p != NULL )
|
||||
{
|
||||
const ecma_char_t *iter_p = pString;
|
||||
const ecma_char_t *iter_p = string_p;
|
||||
while ( *iter_p++ )
|
||||
{
|
||||
length++;
|
||||
}
|
||||
}
|
||||
|
||||
ecma_array_first_chunk_t *pStringFirstChunk = ecma_alloc_array_first_chunk();
|
||||
ecma_array_first_chunk_t *string_first_chunk_p = 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));
|
||||
charsLeft -= charsToCopy;
|
||||
copyPointer += charsToCopy * sizeof (ecma_char_t);
|
||||
string_first_chunk_p->header.unit_number = length;
|
||||
uint8_t *copy_pointer = (uint8_t*) string_p;
|
||||
size_t chars_left = length;
|
||||
size_t chars_to_copy = JERRY_MIN( length, sizeof (string_first_chunk_p->data) / sizeof (ecma_char_t));
|
||||
__memcpy(string_first_chunk_p->data, copy_pointer, chars_to_copy * sizeof (ecma_char_t));
|
||||
chars_left -= chars_to_copy;
|
||||
copy_pointer += chars_to_copy * sizeof (ecma_char_t);
|
||||
|
||||
ecma_array_non_first_chunk_t *pStringNonFirstChunk;
|
||||
ecma_array_non_first_chunk_t *string_non_first_chunk_p;
|
||||
|
||||
JERRY_STATIC_ASSERT( ECMA_POINTER_FIELD_WIDTH <= sizeof(uint16_t) * JERRY_BITSINBYTE );
|
||||
uint16_t *pNextChunkCompressedPointer = &pStringFirstChunk->Header.pNextChunk;
|
||||
uint16_t *next_chunk_compressed_pointer_p = &string_first_chunk_p->header.next_chunk_p;
|
||||
|
||||
while ( charsLeft > 0 )
|
||||
while ( chars_left > 0 )
|
||||
{
|
||||
pStringNonFirstChunk = ecma_alloc_array_non_first_chunk();
|
||||
string_non_first_chunk_p = 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));
|
||||
charsLeft -= charsToCopy;
|
||||
copyPointer += charsToCopy * sizeof (ecma_char_t);
|
||||
size_t chars_to_copy = JERRY_MIN( chars_left, sizeof (string_non_first_chunk_p->data) / sizeof (ecma_char_t));
|
||||
__memcpy(string_non_first_chunk_p->data, copy_pointer, chars_to_copy * sizeof (ecma_char_t));
|
||||
chars_left -= chars_to_copy;
|
||||
copy_pointer += chars_to_copy * sizeof (ecma_char_t);
|
||||
|
||||
ecma_set_pointer( *pNextChunkCompressedPointer, pStringNonFirstChunk);
|
||||
pNextChunkCompressedPointer = &pStringNonFirstChunk->pNextChunk;
|
||||
ecma_set_pointer( *next_chunk_compressed_pointer_p, string_non_first_chunk_p);
|
||||
next_chunk_compressed_pointer_p = &string_non_first_chunk_p->next_chunk_p;
|
||||
}
|
||||
|
||||
*pNextChunkCompressedPointer = ECMA_NULL_POINTER;
|
||||
*next_chunk_compressed_pointer_p = ECMA_NULL_POINTER;
|
||||
|
||||
return pStringFirstChunk;
|
||||
return string_first_chunk_p;
|
||||
} /* ecma_new_ecma_string */
|
||||
|
||||
/**
|
||||
@@ -530,44 +530,44 @@ ecma_new_ecma_string(const ecma_char_t *pString) /**< zero-terminated string of
|
||||
* to hold the string's content (in case size of buffer is insuficcient).
|
||||
*/
|
||||
ssize_t
|
||||
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_copy_ecma_string_chars_to_buffer(ecma_array_first_chunk_t *first_chunk_p, /**< first chunk of ecma-string */
|
||||
uint8_t *buffer_p, /**< destination buffer */
|
||||
size_t buffer_size) /**< 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 string_length = first_chunk_p->header.unit_number;
|
||||
size_t required_buffer_size = sizeof (ecma_length_t) + sizeof (ecma_char_t) * string_length;
|
||||
|
||||
if ( requiredBufferSize < bufferSize )
|
||||
if ( required_buffer_size < buffer_size )
|
||||
{
|
||||
return -(ssize_t) requiredBufferSize;
|
||||
return -(ssize_t) required_buffer_size;
|
||||
}
|
||||
|
||||
*(ecma_length_t*) pBuffer = stringLength;
|
||||
*(ecma_length_t*) buffer_p = string_length;
|
||||
|
||||
size_t charsLeft = stringLength;
|
||||
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);
|
||||
charsLeft -= copyChunkChars;
|
||||
size_t chars_left = string_length;
|
||||
uint8_t *dest_pointer = buffer_p + sizeof (ecma_length_t);
|
||||
size_t copy_chunk_chars = JERRY_MIN(sizeof (first_chunk_p->data) / sizeof (ecma_char_t),
|
||||
chars_left);
|
||||
__memcpy( dest_pointer, first_chunk_p->data, copy_chunk_chars * sizeof (ecma_char_t));
|
||||
dest_pointer += copy_chunk_chars * sizeof (ecma_char_t);
|
||||
chars_left -= copy_chunk_chars;
|
||||
|
||||
ecma_array_non_first_chunk_t *pNonFirstChunk = ecma_get_pointer( pFirstChunk->Header.pNextChunk);
|
||||
ecma_array_non_first_chunk_t *non_first_chunk_p = ecma_get_pointer( first_chunk_p->header.next_chunk_p);
|
||||
|
||||
while ( charsLeft > 0 )
|
||||
while ( chars_left > 0 )
|
||||
{
|
||||
JERRY_ASSERT( charsLeft < stringLength );
|
||||
JERRY_ASSERT( chars_left < string_length );
|
||||
|
||||
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);
|
||||
charsLeft -= copyChunkChars;
|
||||
copy_chunk_chars = JERRY_MIN(sizeof (non_first_chunk_p->data) / sizeof (ecma_char_t),
|
||||
chars_left);
|
||||
__memcpy( dest_pointer, non_first_chunk_p->data, copy_chunk_chars * sizeof (ecma_char_t));
|
||||
dest_pointer += copy_chunk_chars * sizeof (ecma_char_t);
|
||||
chars_left -= copy_chunk_chars;
|
||||
|
||||
pNonFirstChunk = ecma_get_pointer( pNonFirstChunk->pNextChunk);
|
||||
non_first_chunk_p = ecma_get_pointer( non_first_chunk_p->next_chunk_p);
|
||||
}
|
||||
|
||||
return (ssize_t) requiredBufferSize;
|
||||
return (ssize_t) required_buffer_size;
|
||||
} /* ecma_copy_ecma_string_chars_to_buffer */
|
||||
|
||||
/**
|
||||
@@ -576,31 +576,31 @@ ecma_copy_ecma_string_chars_to_buffer(ecma_array_first_chunk_t *pFirstChunk, /**
|
||||
* @return pointer to new ecma-string's first chunk
|
||||
*/
|
||||
ecma_array_first_chunk_t*
|
||||
ecma_duplicate_ecma_string( ecma_array_first_chunk_t *pFirstChunk) /**< first chunk of string to duplicate */
|
||||
ecma_duplicate_ecma_string( ecma_array_first_chunk_t *first_chunk_p) /**< first chunk of string to duplicate */
|
||||
{
|
||||
JERRY_ASSERT( pFirstChunk != NULL );
|
||||
JERRY_ASSERT( first_chunk_p != NULL );
|
||||
|
||||
ecma_array_first_chunk_t *pFirstChunkCopy = ecma_alloc_array_first_chunk();
|
||||
__memcpy( pFirstChunkCopy, pFirstChunk, sizeof (ecma_array_first_chunk_t));
|
||||
ecma_array_first_chunk_t *first_chunk_copy_p = ecma_alloc_array_first_chunk();
|
||||
__memcpy( first_chunk_copy_p, first_chunk_p, sizeof (ecma_array_first_chunk_t));
|
||||
|
||||
ecma_array_non_first_chunk_t *pNonFirstChunk, *pNonFirstChunkCopy;
|
||||
pNonFirstChunk = ecma_get_pointer( pFirstChunk->Header.pNextChunk);
|
||||
uint16_t *pNextPointer = &pFirstChunkCopy->Header.pNextChunk;
|
||||
ecma_array_non_first_chunk_t *non_first_chunk_p, *non_first_chunk_copy_p;
|
||||
non_first_chunk_p = ecma_get_pointer( first_chunk_p->header.next_chunk_p);
|
||||
uint16_t *next_pointer_p = &first_chunk_copy_p->header.next_chunk_p;
|
||||
|
||||
while ( pNonFirstChunk != NULL )
|
||||
while ( non_first_chunk_p != NULL )
|
||||
{
|
||||
pNonFirstChunkCopy = ecma_alloc_array_non_first_chunk();
|
||||
ecma_set_pointer( *pNextPointer, pNonFirstChunkCopy);
|
||||
pNextPointer = &pNonFirstChunkCopy->pNextChunk;
|
||||
non_first_chunk_copy_p = ecma_alloc_array_non_first_chunk();
|
||||
ecma_set_pointer( *next_pointer_p, non_first_chunk_copy_p);
|
||||
next_pointer_p = &non_first_chunk_copy_p->next_chunk_p;
|
||||
|
||||
__memcpy( pNonFirstChunkCopy, pNonFirstChunk, sizeof (ecma_array_non_first_chunk_t));
|
||||
__memcpy( non_first_chunk_copy_p, non_first_chunk_p, sizeof (ecma_array_non_first_chunk_t));
|
||||
|
||||
pNonFirstChunk = ecma_get_pointer( pNonFirstChunk->pNextChunk);
|
||||
non_first_chunk_p = ecma_get_pointer( non_first_chunk_p->next_chunk_p);
|
||||
}
|
||||
|
||||
*pNextPointer = ECMA_NULL_POINTER;
|
||||
*next_pointer_p = ECMA_NULL_POINTER;
|
||||
|
||||
return pFirstChunkCopy;
|
||||
return first_chunk_copy_p;
|
||||
} /* ecma_duplicate_ecma_string */
|
||||
|
||||
/**
|
||||
@@ -623,20 +623,20 @@ ecma_compare_ecma_string_to_ecma_string(const ecma_array_first_chunk_t *string1_
|
||||
* false - otherwise.
|
||||
*/
|
||||
bool
|
||||
ecma_compare_zt_string_to_ecma_string(const ecma_char_t *pString, /**< zero-terminated string */
|
||||
const ecma_array_first_chunk_t *pEcmaString) /* ecma-string */
|
||||
ecma_compare_zt_string_to_ecma_string(const ecma_char_t *string_p, /**< zero-terminated string */
|
||||
const ecma_array_first_chunk_t *ecma_string_p) /* ecma-string */
|
||||
{
|
||||
JERRY_ASSERT( pString != NULL );
|
||||
JERRY_ASSERT( pEcmaString != NULL );
|
||||
JERRY_ASSERT( string_p != NULL );
|
||||
JERRY_ASSERT( ecma_string_p != 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
|
||||
+ sizeof(pEcmaString->Data));
|
||||
const ecma_char_t *str_iter_p = string_p;
|
||||
ecma_length_t ecma_str_len = ecma_string_p->header.unit_number;
|
||||
const ecma_char_t *current_chunk_chars_cur = (ecma_char_t*) ecma_string_p->data,
|
||||
*current_chunk_chars_end = (ecma_char_t*) (ecma_string_p->data
|
||||
+ sizeof(ecma_string_p->data));
|
||||
|
||||
JERRY_STATIC_ASSERT( ECMA_POINTER_FIELD_WIDTH <= sizeof(uint16_t) * JERRY_BITSINBYTE );
|
||||
const uint16_t *next_chunk_compressed_pointer_p = &pEcmaString->Header.pNextChunk;
|
||||
const uint16_t *next_chunk_compressed_pointer_p = &ecma_string_p->header.next_chunk_p;
|
||||
|
||||
for ( ecma_length_t str_index = 0;
|
||||
str_index < ecma_str_len;
|
||||
@@ -651,10 +651,10 @@ ecma_compare_zt_string_to_ecma_string(const ecma_char_t *pString, /**< zero-term
|
||||
|
||||
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*) ecma_string_p->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;
|
||||
next_chunk_compressed_pointer_p = &next_chunk_p->next_chunk_p;
|
||||
}
|
||||
|
||||
if ( *str_iter_p != *current_chunk_chars_cur )
|
||||
@@ -682,21 +682,21 @@ ecma_compare_zt_string_to_ecma_string(const ecma_char_t *pString, /**< zero-term
|
||||
* Free all chunks of an array
|
||||
*/
|
||||
void
|
||||
ecma_free_array( ecma_array_first_chunk_t *pFirstChunk) /**< first chunk of the array */
|
||||
ecma_free_array( ecma_array_first_chunk_t *first_chunk_p) /**< first chunk of the array */
|
||||
{
|
||||
JERRY_ASSERT( pFirstChunk != NULL );
|
||||
JERRY_ASSERT( first_chunk_p != NULL );
|
||||
|
||||
ecma_array_non_first_chunk_t *pNonFirstChunk = ecma_get_pointer( pFirstChunk->Header.pNextChunk);
|
||||
ecma_array_non_first_chunk_t *non_first_chunk_p = ecma_get_pointer( first_chunk_p->header.next_chunk_p);
|
||||
|
||||
ecma_dealloc_array_first_chunk( pFirstChunk);
|
||||
ecma_dealloc_array_first_chunk( first_chunk_p);
|
||||
|
||||
while ( pNonFirstChunk != NULL )
|
||||
while ( non_first_chunk_p != NULL )
|
||||
{
|
||||
ecma_array_non_first_chunk_t *pNextChunk = ecma_get_pointer( pNonFirstChunk->pNextChunk);
|
||||
ecma_array_non_first_chunk_t *next_chunk_p = ecma_get_pointer( non_first_chunk_p->next_chunk_p);
|
||||
|
||||
ecma_dealloc_array_non_first_chunk( pNonFirstChunk);
|
||||
ecma_dealloc_array_non_first_chunk( non_first_chunk_p);
|
||||
|
||||
pNonFirstChunk = pNextChunk;
|
||||
non_first_chunk_p = next_chunk_p;
|
||||
}
|
||||
} /* ecma_free_array */
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "ecma-globals.h"
|
||||
|
||||
extern uintptr_t ecma_compress_pointer(void *pointer);
|
||||
extern void* ecma_decompress_pointer(uintptr_t compressedPointer);
|
||||
extern void* ecma_decompress_pointer(uintptr_t compressed_pointer);
|
||||
|
||||
/**
|
||||
* Get value of pointer from specified compressed pointer field.
|
||||
@@ -36,10 +36,10 @@ extern void* ecma_decompress_pointer(uintptr_t compressedPointer);
|
||||
|
||||
/**
|
||||
* Set value of compressed pointer field so that it will correspond
|
||||
* to specified nonCompressedPointer.
|
||||
* to specified non_compressed_pointer.
|
||||
*/
|
||||
#define ecma_set_pointer( field, nonCompressedPointer) \
|
||||
(field) = ecma_compress_pointer( nonCompressedPointer) & ( ( 1u << ECMA_POINTER_FIELD_WIDTH ) - 1)
|
||||
#define ecma_set_pointer( field, non_compressed_pointer) \
|
||||
(field) = ecma_compress_pointer( non_compressed_pointer) & ( ( 1u << ECMA_POINTER_FIELD_WIDTH ) - 1)
|
||||
|
||||
/* ecma-helpers-value.c */
|
||||
extern bool ecma_is_value_undefined( ecma_value_t value);
|
||||
@@ -66,13 +66,13 @@ extern bool ecma_is_completion_value_normal_simple_value( ecma_completion_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_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);
|
||||
extern ecma_object_t* ecma_create_object( ecma_object_t *prototype_object_p, bool is_extensible);
|
||||
extern ecma_object_t* ecma_create_lexical_environment( ecma_object_t *outer_lexical_environment_p, ecma_lexical_environment_type_t type);
|
||||
|
||||
/* ecma-helpers.c */
|
||||
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_create_internal_property(ecma_object_t *object_p, ecma_internal_property_id_t property_id);
|
||||
extern ecma_property_t* ecma_find_internal_property(ecma_object_t *object_p, ecma_internal_property_id_t property_id);
|
||||
extern ecma_property_t* ecma_get_internal_property(ecma_object_t *object_p, ecma_internal_property_id_t property_id);
|
||||
|
||||
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);
|
||||
@@ -86,12 +86,12 @@ extern void ecma_free_property(ecma_property_t *prop_p);
|
||||
|
||||
extern void ecma_delete_property( ecma_object_t *obj_p, ecma_property_t *prop_p);
|
||||
|
||||
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 ecma_array_first_chunk_t* ecma_new_ecma_string( const ecma_char_t *string_p);
|
||||
extern ssize_t ecma_copy_ecma_string_chars_to_buffer( ecma_array_first_chunk_t *first_chunk_p, uint8_t *buffer_p, size_t buffer_size);
|
||||
extern ecma_array_first_chunk_t* ecma_duplicate_ecma_string( ecma_array_first_chunk_t *first_chunk_p);
|
||||
extern bool ecma_compare_zt_string_to_ecma_string( const ecma_char_t *string_p, const ecma_array_first_chunk_t *ecma_string_p);
|
||||
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);
|
||||
extern void ecma_free_array( ecma_array_first_chunk_t *first_chunk_p);
|
||||
|
||||
#endif /* !JERRY_ECMA_HELPERS_H */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user