Removing m_ prefix from identifiers (m_ValueType -> ValueType, ...).

This commit is contained in:
Ruben Ayrapetyan
2014-07-23 11:41:58 +04:00
parent 3ef9ee9eb4
commit 2d4ed154ee
14 changed files with 370 additions and 370 deletions
+18 -18
View File
@@ -45,11 +45,11 @@ static void
ecma_GCQueue( ecma_Object_t *pObject) /**< object */
{
JERRY_ASSERT( pObject != NULL );
JERRY_ASSERT( pObject->m_GCInfo.m_IsObjectValid );
JERRY_ASSERT( pObject->m_GCInfo.u.m_Refs == 0 );
JERRY_ASSERT( pObject->GCInfo.IsObjectValid );
JERRY_ASSERT( pObject->GCInfo.u.Refs == 0 );
pObject->m_GCInfo.m_IsObjectValid = false;
ecma_SetPointer( pObject->m_GCInfo.u.m_NextQueuedForGC, ecma_GC_Queue);
pObject->GCInfo.IsObjectValid = false;
ecma_SetPointer( pObject->GCInfo.u.NextQueuedForGC, ecma_GC_Queue);
ecma_GC_Queue = pObject;
} /* ecma_QueueGC */
@@ -60,14 +60,14 @@ ecma_GCQueue( ecma_Object_t *pObject) /**< object */
void
ecma_RefObject(ecma_Object_t *pObject) /**< object */
{
JERRY_ASSERT(pObject->m_GCInfo.m_IsObjectValid);
JERRY_ASSERT(pObject->GCInfo.IsObjectValid);
pObject->m_GCInfo.u.m_Refs++;
pObject->GCInfo.u.Refs++;
/**
* Check that value was not overflowed
*/
JERRY_ASSERT(pObject->m_GCInfo.u.m_Refs > 0);
JERRY_ASSERT(pObject->GCInfo.u.Refs > 0);
} /* ecma_RefObject */
/**
@@ -77,12 +77,12 @@ void
ecma_DerefObject(ecma_Object_t *pObject) /**< object */
{
JERRY_ASSERT(pObject != NULL);
JERRY_ASSERT(pObject->m_GCInfo.m_IsObjectValid);
JERRY_ASSERT(pObject->m_GCInfo.u.m_Refs > 0);
JERRY_ASSERT(pObject->GCInfo.IsObjectValid);
JERRY_ASSERT(pObject->GCInfo.u.Refs > 0);
pObject->m_GCInfo.u.m_Refs--;
pObject->GCInfo.u.Refs--;
if ( pObject->m_GCInfo.u.m_Refs == 0 )
if ( pObject->GCInfo.u.Refs == 0 )
{
ecma_GCQueue( pObject);
}
@@ -106,22 +106,22 @@ ecma_GCRun( void)
while ( ecma_GC_Queue != NULL )
{
ecma_Object_t *pObject = ecma_GC_Queue;
ecma_GC_Queue = ecma_GetPointer( pObject->m_GCInfo.u.m_NextQueuedForGC);
ecma_GC_Queue = ecma_GetPointer( pObject->GCInfo.u.NextQueuedForGC);
JERRY_ASSERT( !pObject->m_GCInfo.m_IsObjectValid );
JERRY_ASSERT( !pObject->GCInfo.IsObjectValid );
for ( ecma_Property_t *property = ecma_GetPointer( pObject->m_pProperties), *pNextProperty;
for ( ecma_Property_t *property = ecma_GetPointer( pObject->pProperties), *pNextProperty;
property != NULL;
property = pNextProperty )
{
pNextProperty = ecma_GetPointer( property->m_pNextProperty);
pNextProperty = ecma_GetPointer( property->pNextProperty);
ecma_FreeProperty( property);
}
if ( pObject->m_IsLexicalEnvironment )
if ( pObject->IsLexicalEnvironment )
{
ecma_Object_t *pOuterLexicalEnvironment = ecma_GetPointer( pObject->u.m_LexicalEnvironment.m_pOuterReference);
ecma_Object_t *pOuterLexicalEnvironment = ecma_GetPointer( pObject->u.LexicalEnvironment.pOuterReference);
if ( pOuterLexicalEnvironment != NULL )
{
@@ -129,7 +129,7 @@ ecma_GCRun( void)
}
} else
{
ecma_Object_t *pPrototypeObject = ecma_GetPointer( pObject->u.m_Object.m_pPrototypeObject);
ecma_Object_t *pPrototypeObject = ecma_GetPointer( pObject->u.Object.pPrototypeObject);
if ( pPrototypeObject != NULL )
{
+46 -46
View File
@@ -103,12 +103,12 @@ typedef enum {
*/
typedef struct {
/** Value type (ecma_Type_t) */
unsigned int m_ValueType : 2;
unsigned int ValueType : 2;
/**
* Simple value (ecma_SimpleValue_t) or compressed pointer to value (depending on m_ValueType)
* Simple value (ecma_SimpleValue_t) or compressed pointer to value (depending on ValueType)
*/
unsigned int m_Value : ECMA_POINTER_FIELD_WIDTH;
unsigned int Value : ECMA_POINTER_FIELD_WIDTH;
} __packed ecma_Value_t;
/**
@@ -187,58 +187,58 @@ typedef enum
*/
typedef struct ecma_Property_t {
/** Property's type (ecma_PropertyType_t) */
unsigned int m_Type : 2;
unsigned int Type : 2;
/** Compressed pointer to next property */
unsigned int m_pNextProperty : ECMA_POINTER_FIELD_WIDTH;
unsigned int pNextProperty : ECMA_POINTER_FIELD_WIDTH;
/** Property's details (depending on m_Type) */
/** Property's details (depending on Type) */
union {
/** Description of named data property */
struct __packed ecma_NamedDataProperty_t {
/** Compressed pointer to property's name (pointer to String) */
unsigned int m_pName : ECMA_POINTER_FIELD_WIDTH;
unsigned int pName : ECMA_POINTER_FIELD_WIDTH;
/** Attribute 'Writable' (ecma_PropertyWritableValue_t) */
unsigned int m_Writable : 1;
unsigned int Writable : 1;
/** Attribute 'Enumerable' (ecma_PropertyEnumerableValue_t) */
unsigned int m_Enumerable : 1;
unsigned int Enumerable : 1;
/** Attribute 'Configurable' (ecma_PropertyConfigurableValue_t) */
unsigned int m_Configurable : 1;
unsigned int Configurable : 1;
/** Value */
ecma_Value_t m_Value;
} m_NamedDataProperty;
ecma_Value_t Value;
} NamedDataProperty;
/** Description of named accessor property */
struct __packed ecma_NamedAccessorProperty_t {
/** Compressed pointer to property's name (pointer to String) */
unsigned int m_pName : ECMA_POINTER_FIELD_WIDTH;
unsigned int pName : ECMA_POINTER_FIELD_WIDTH;
/** Attribute 'Enumerable' (ecma_PropertyEnumerableValue_t) */
unsigned int m_Enumerable : 1;
unsigned int Enumerable : 1;
/** Attribute 'Configurable' (ecma_PropertyConfigurableValue_t) */
unsigned int m_Configurable : 1;
unsigned int Configurable : 1;
/** Compressed pointer to property's getter */
unsigned int m_pGet : ECMA_POINTER_FIELD_WIDTH;
unsigned int pGet : ECMA_POINTER_FIELD_WIDTH;
/** Compressed pointer to property's setter */
unsigned int m_pSet : ECMA_POINTER_FIELD_WIDTH;
} m_NamedAccessorProperty;
unsigned int pSet : ECMA_POINTER_FIELD_WIDTH;
} NamedAccessorProperty;
/** Description of internal property */
struct __packed ecma_InternalProperty_t {
/** Internal property's type */
unsigned int m_InternalPropertyType : 4;
unsigned int InternalPropertyType : 4;
/** Value (may be a compressed pointer) */
unsigned int m_Value : ECMA_POINTER_FIELD_WIDTH;
} m_InternalProperty;
unsigned int Value : ECMA_POINTER_FIELD_WIDTH;
} InternalProperty;
} 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 m_IsObjectValid : 1;
unsigned int IsObjectValid : 1;
/** Details (depending on m_IsObjectValid) */
/** Details (depending on IsObjectValid) */
union {
/**
* Number of refs to the object (if m_IsObjectValid).
* Number of refs to the object (if IsObjectValid).
*
* 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 m_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 !m_IsObjectValid) */
unsigned int m_NextQueuedForGC : 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;
} __packed u;
} ecma_GCInfo_t;
@@ -279,49 +279,49 @@ typedef enum {
/**
* Description of ECMA-object or lexical environment
* (depending on m_IsLexicalEnvironment).
* (depending on IsLexicalEnvironment).
*/
typedef struct ecma_Object_t {
/** Compressed pointer to property list */
unsigned int m_pProperties : ECMA_POINTER_FIELD_WIDTH;
unsigned int pProperties : ECMA_POINTER_FIELD_WIDTH;
/** Flag indicating whether it is a general object (false)
or a lexical environment (true) */
unsigned int m_IsLexicalEnvironment : 1;
unsigned int IsLexicalEnvironment : 1;
/**
* Attributes of either general object or lexical environment
* (depending on m_IsLexicalEnvironment)
* (depending on IsLexicalEnvironment)
*/
union {
/**
* A general object's attributes (if !m_IsLexicalEnvironment)
* A general object's attributes (if !IsLexicalEnvironment)
*/
struct {
/** Attribute 'Extensible' */
unsigned int m_Extensible : 1;
unsigned int Extensible : 1;
/** Compressed pointer to prototype object (ecma_Object_t) */
unsigned int m_pPrototypeObject : ECMA_POINTER_FIELD_WIDTH;
} __packed m_Object;
unsigned int pPrototypeObject : ECMA_POINTER_FIELD_WIDTH;
} __packed Object;
/**
* A lexical environment's attribute (if m_IsLexicalEnvironment)
* A lexical environment's attribute (if IsLexicalEnvironment)
*/
struct {
/**
* Type of lexical environment (ecma_LexicalEnvironmentType_t).
*/
unsigned int m_Type : 1;
unsigned int Type : 1;
/** Compressed pointer to outer lexical environment */
unsigned int m_pOuterReference : ECMA_POINTER_FIELD_WIDTH;
} __packed m_LexicalEnvironment;
unsigned int pOuterReference : ECMA_POINTER_FIELD_WIDTH;
} __packed LexicalEnvironment;
} __packed u;
/** GC's information */
ecma_GCInfo_t m_GCInfo;
ecma_GCInfo_t GCInfo;
} ecma_Object_t;
/**
@@ -344,10 +344,10 @@ typedef uint16_t ecma_Length_t;
*/
typedef struct {
/** Compressed pointer to next chunk */
uint16_t m_pNextChunk;
uint16_t pNextChunk;
/** Number of elements in the Array */
ecma_Length_t m_UnitNumber;
ecma_Length_t UnitNumber;
} ecma_ArrayHeader_t;
/**
@@ -360,10 +360,10 @@ typedef struct {
*/
typedef struct {
/** Array's header */
ecma_ArrayHeader_t m_Header;
ecma_ArrayHeader_t Header;
/** Elements */
uint8_t m_Data[ ECMA_ARRAY_CHUNK_SIZE_IN_BYTES - sizeof (ecma_ArrayHeader_t) ];
uint8_t Data[ ECMA_ARRAY_CHUNK_SIZE_IN_BYTES - sizeof (ecma_ArrayHeader_t) ];
} ecma_ArrayFirstChunk_t;
/**
@@ -371,10 +371,10 @@ typedef struct {
*/
typedef struct {
/** Compressed pointer to next chunk */
uint16_t m_pNextChunk;
uint16_t pNextChunk;
/** Characters */
uint8_t m_Data[ ECMA_ARRAY_CHUNK_SIZE_IN_BYTES - sizeof (uint16_t) ];
uint8_t Data[ ECMA_ARRAY_CHUNK_SIZE_IN_BYTES - sizeof (uint16_t) ];
} ecma_ArrayNonFirstChunk_t;
/**
+28 -28
View File
@@ -35,7 +35,7 @@
bool
ecma_IsValueUndefined( ecma_Value_t value) /**< ecma-value */
{
return ( value.m_ValueType == ECMA_TYPE_SIMPLE && value.m_Value == ECMA_SIMPLE_VALUE_UNDEFINED );
return ( value.ValueType == ECMA_TYPE_SIMPLE && value.Value == ECMA_SIMPLE_VALUE_UNDEFINED );
} /* ecma_IsValueUndefined */
/**
@@ -47,7 +47,7 @@ ecma_IsValueUndefined( ecma_Value_t value) /**< ecma-value */
bool
ecma_IsValueNull( ecma_Value_t value) /**< ecma-value */
{
return ( value.m_ValueType == ECMA_TYPE_SIMPLE && value.m_Value == ECMA_SIMPLE_VALUE_NULL );
return ( value.ValueType == ECMA_TYPE_SIMPLE && value.Value == ECMA_SIMPLE_VALUE_NULL );
} /* ecma_IsValueNull */
/**
@@ -59,8 +59,8 @@ ecma_IsValueNull( ecma_Value_t value) /**< ecma-value */
bool
ecma_IsValueBoolean( ecma_Value_t value) /**< ecma-value */
{
return ( ( value.m_ValueType == ECMA_TYPE_SIMPLE && value.m_Value == ECMA_SIMPLE_VALUE_FALSE )
|| ( value.m_ValueType == ECMA_TYPE_SIMPLE && value.m_Value == ECMA_SIMPLE_VALUE_TRUE ) );
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 */
/**
@@ -77,7 +77,7 @@ ecma_IsValueTrue( ecma_Value_t value) /**< ecma-value */
{
JERRY_ASSERT( ecma_IsValueBoolean( value) );
return ( value.m_ValueType == ECMA_TYPE_SIMPLE && value.m_Value == ECMA_SIMPLE_VALUE_TRUE );
return ( value.ValueType == ECMA_TYPE_SIMPLE && value.Value == ECMA_SIMPLE_VALUE_TRUE );
} /* ecma_IsValueTrue */
/**
@@ -86,7 +86,7 @@ ecma_IsValueTrue( ecma_Value_t value) /**< ecma-value */
ecma_Value_t
ecma_MakeSimpleValue( ecma_SimpleValue_t value) /**< simple value */
{
return (ecma_Value_t) { .m_ValueType = ECMA_TYPE_SIMPLE, .m_Value = value };
return (ecma_Value_t) { .ValueType = ECMA_TYPE_SIMPLE, .Value = value };
} /* ecma_MakeSimpleValue */
/**
@@ -99,8 +99,8 @@ ecma_MakeNumberValue( ecma_Number_t* num_p) /**< number to reference in value */
ecma_Value_t number_value;
number_value.m_ValueType = ECMA_TYPE_NUMBER;
ecma_SetPointer( number_value.m_Value, num_p);
number_value.ValueType = ECMA_TYPE_NUMBER;
ecma_SetPointer( number_value.Value, num_p);
return number_value;
} /* ecma_MakeNumberValue */
@@ -115,8 +115,8 @@ ecma_make_string_value( ecma_ArrayFirstChunk_t* ecma_string_p) /**< string to re
ecma_Value_t string_value;
string_value.m_ValueType = ECMA_TYPE_STRING;
ecma_SetPointer( string_value.m_Value, ecma_string_p);
string_value.ValueType = ECMA_TYPE_STRING;
ecma_SetPointer( string_value.Value, ecma_string_p);
return string_value;
} /* ecma_make_string_value */
@@ -131,8 +131,8 @@ ecma_MakeObjectValue( ecma_Object_t* object_p) /**< object to reference in value
ecma_Value_t object_value;
object_value.m_ValueType = ECMA_TYPE_OBJECT;
ecma_SetPointer( object_value.m_Value, object_p);
object_value.ValueType = ECMA_TYPE_OBJECT;
ecma_SetPointer( object_value.Value, object_p);
return object_value;
} /* ecma_MakeObjectValue */
@@ -163,7 +163,7 @@ ecma_CopyValue( const ecma_Value_t value) /**< ecma-value */
{
ecma_Value_t value_copy;
switch ( (ecma_Type_t)value.m_ValueType )
switch ( (ecma_Type_t)value.ValueType )
{
case ECMA_TYPE_SIMPLE:
{
@@ -173,32 +173,32 @@ ecma_CopyValue( const ecma_Value_t value) /**< ecma-value */
}
case ECMA_TYPE_NUMBER:
{
ecma_Number_t *num_p = ecma_GetPointer( value.m_Value);
ecma_Number_t *num_p = ecma_GetPointer( value.Value);
JERRY_ASSERT( num_p != NULL );
ecma_Number_t *number_copy_p = ecma_AllocNumber();
*number_copy_p = *num_p;
value_copy = (ecma_Value_t) { .m_ValueType = ECMA_TYPE_NUMBER };
ecma_SetPointer( value_copy.m_Value, number_copy_p);
value_copy = (ecma_Value_t) { .ValueType = ECMA_TYPE_NUMBER };
ecma_SetPointer( value_copy.Value, number_copy_p);
break;
}
case ECMA_TYPE_STRING:
{
ecma_ArrayFirstChunk_t *string_p = ecma_GetPointer( value.m_Value);
ecma_ArrayFirstChunk_t *string_p = ecma_GetPointer( value.Value);
JERRY_ASSERT( string_p != NULL );
ecma_ArrayFirstChunk_t *string_copy_p = ecma_DuplicateEcmaString( string_p);
value_copy = (ecma_Value_t) { .m_ValueType = ECMA_TYPE_STRING };
ecma_SetPointer( value_copy.m_Value, string_copy_p);
value_copy = (ecma_Value_t) { .ValueType = ECMA_TYPE_STRING };
ecma_SetPointer( value_copy.Value, string_copy_p);
break;
}
case ECMA_TYPE_OBJECT:
{
ecma_Object_t *obj_p = ecma_GetPointer( value.m_Value);
ecma_Object_t *obj_p = ecma_GetPointer( value.Value);
JERRY_ASSERT( obj_p != NULL );
ecma_RefObject( obj_p);
@@ -222,7 +222,7 @@ ecma_CopyValue( const ecma_Value_t value) /**< ecma-value */
void
ecma_FreeValue( ecma_Value_t value) /**< value description */
{
switch ( (ecma_Type_t) value.m_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.m_Value);
ecma_Number_t *pNumber = ecma_GetPointer( value.Value);
ecma_DeallocNumber( pNumber);
break;
}
case ECMA_TYPE_STRING:
{
ecma_ArrayFirstChunk_t *pString = ecma_GetPointer( value.m_Value);
ecma_ArrayFirstChunk_t *pString = ecma_GetPointer( value.Value);
ecma_FreeArray( pString);
break;
}
case ECMA_TYPE_OBJECT:
{
ecma_DerefObject( ecma_GetPointer( value.m_Value));
ecma_DerefObject( ecma_GetPointer( value.Value));
break;
}
@@ -278,7 +278,7 @@ ecma_MakeCompletionValue(ecma_CompletionType_t type, /**< type */
ecma_CompletionValue_t
ecma_MakeThrowValue( ecma_Object_t *exception_p) /**< an object */
{
JERRY_ASSERT( exception_p != NULL && !exception_p->m_IsLexicalEnvironment );
JERRY_ASSERT( exception_p != NULL && !exception_p->IsLexicalEnvironment );
ecma_Value_t exception = ecma_MakeObjectValue( exception_p);
@@ -329,7 +329,7 @@ ecma_free_completion_value( ecma_CompletionValue_t completion_value) /**< comple
case ECMA_COMPLETION_TYPE_CONTINUE:
case ECMA_COMPLETION_TYPE_BREAK:
case ECMA_COMPLETION_TYPE_EXIT:
JERRY_ASSERT( completion_value.value.m_ValueType == ECMA_TYPE_SIMPLE );
JERRY_ASSERT( completion_value.value.ValueType == ECMA_TYPE_SIMPLE );
break;
}
} /* ecma_free_completion_value */
@@ -370,8 +370,8 @@ ecma_is_completion_value_normal_simple_value(ecma_CompletionValue_t value, /**<
ecma_SimpleValue_t simple_value) /**< simple value to check for equality with */
{
return ( value.type == ECMA_COMPLETION_TYPE_NORMAL
&& value.value.m_ValueType == ECMA_TYPE_SIMPLE
&& value.value.m_Value == simple_value );
&& value.value.ValueType == ECMA_TYPE_SIMPLE
&& value.value.Value == simple_value );
} /* ecma_is_completion_value_normal_simple_value */
/**
+79 -79
View File
@@ -83,16 +83,16 @@ ecma_CreateObject( ecma_Object_t *pPrototypeObject, /**< pointer to prototybe of
{
ecma_Object_t *pObject = ecma_AllocObject();
pObject->m_pProperties = ECMA_NULL_POINTER;
pObject->m_IsLexicalEnvironment = false;
pObject->m_GCInfo.m_IsObjectValid = true;
pObject->pProperties = ECMA_NULL_POINTER;
pObject->IsLexicalEnvironment = false;
pObject->GCInfo.IsObjectValid = true;
/* The global object is always referenced
* (at least with the ctx_GlobalObject variable) */
pObject->m_GCInfo.u.m_Refs = 1;
pObject->GCInfo.u.Refs = 1;
pObject->u.m_Object.m_Extensible = isExtensible;
ecma_SetPointer( pObject->u.m_Object.m_pPrototypeObject, pPrototypeObject);
pObject->u.Object.Extensible = isExtensible;
ecma_SetPointer( pObject->u.Object.pPrototypeObject, pPrototypeObject);
return pObject;
} /* ecma_CreateObject */
@@ -115,15 +115,15 @@ ecma_CreateLexicalEnvironment(ecma_Object_t *pOuterLexicalEnvironment, /**< oute
{
ecma_Object_t *pNewLexicalEnvironment = ecma_AllocObject();
pNewLexicalEnvironment->m_IsLexicalEnvironment = true;
pNewLexicalEnvironment->u.m_LexicalEnvironment.m_Type = type;
pNewLexicalEnvironment->IsLexicalEnvironment = true;
pNewLexicalEnvironment->u.LexicalEnvironment.Type = type;
pNewLexicalEnvironment->m_pProperties = ECMA_NULL_POINTER;
pNewLexicalEnvironment->pProperties = ECMA_NULL_POINTER;
pNewLexicalEnvironment->m_GCInfo.m_IsObjectValid = true;
pNewLexicalEnvironment->m_GCInfo.u.m_Refs = 1;
pNewLexicalEnvironment->GCInfo.IsObjectValid = true;
pNewLexicalEnvironment->GCInfo.u.Refs = 1;
ecma_SetPointer( pNewLexicalEnvironment->u.m_LexicalEnvironment.m_pOuterReference, pOuterLexicalEnvironment);
ecma_SetPointer( pNewLexicalEnvironment->u.LexicalEnvironment.pOuterReference, pOuterLexicalEnvironment);
return pNewLexicalEnvironment;
} /* ecma_CreateLexicalEnvironment */
@@ -140,13 +140,13 @@ ecma_CreateInternalProperty(ecma_Object_t *pObject, /**< the object */
{
ecma_Property_t *pNewProperty = ecma_AllocProperty();
pNewProperty->m_Type = ECMA_PROPERTY_INTERNAL;
pNewProperty->Type = ECMA_PROPERTY_INTERNAL;
ecma_SetPointer( pNewProperty->m_pNextProperty, ecma_GetPointer( pObject->m_pProperties));
ecma_SetPointer( pObject->m_pProperties, pNewProperty);
ecma_SetPointer( pNewProperty->pNextProperty, ecma_GetPointer( pObject->pProperties));
ecma_SetPointer( pObject->pProperties, pNewProperty);
pNewProperty->u.m_InternalProperty.m_InternalPropertyType = propertyId;
pNewProperty->u.m_InternalProperty.m_Value = ECMA_NULL_POINTER;
pNewProperty->u.InternalProperty.InternalPropertyType = propertyId;
pNewProperty->u.InternalProperty.Value = ECMA_NULL_POINTER;
return pNewProperty;
} /* ecma_CreateInternalProperty */
@@ -166,13 +166,13 @@ ecma_FindInternalProperty(ecma_Object_t *pObject, /**< object descriptor */
JERRY_ASSERT( propertyId != ECMA_INTERNAL_PROPERTY_PROTOTYPE
&& propertyId != ECMA_INTERNAL_PROPERTY_EXTENSIBLE );
for ( ecma_Property_t *pProperty = ecma_GetPointer( pObject->m_pProperties);
for ( ecma_Property_t *pProperty = ecma_GetPointer( pObject->pProperties);
pProperty != NULL;
pProperty = ecma_GetPointer( pProperty->m_pNextProperty) )
pProperty = ecma_GetPointer( pProperty->pNextProperty) )
{
if ( pProperty->m_Type == ECMA_PROPERTY_INTERNAL )
if ( pProperty->Type == ECMA_PROPERTY_INTERNAL )
{
if ( pProperty->u.m_InternalProperty.m_InternalPropertyType == propertyId )
if ( pProperty->u.InternalProperty.InternalPropertyType == propertyId )
{
return pProperty;
}
@@ -218,18 +218,18 @@ ecma_CreateNamedProperty(ecma_Object_t *obj_p, /**< object */
ecma_Property_t *prop = ecma_AllocProperty();
prop->m_Type = ECMA_PROPERTY_NAMEDDATA;
prop->Type = ECMA_PROPERTY_NAMEDDATA;
ecma_SetPointer( prop->u.m_NamedDataProperty.m_pName, ecma_NewEcmaString( name_p));
ecma_SetPointer( prop->u.NamedDataProperty.pName, ecma_NewEcmaString( name_p));
prop->u.m_NamedDataProperty.m_Writable = writable;
prop->u.m_NamedDataProperty.m_Enumerable = enumerable;
prop->u.m_NamedDataProperty.m_Configurable = configurable;
prop->u.NamedDataProperty.Writable = writable;
prop->u.NamedDataProperty.Enumerable = enumerable;
prop->u.NamedDataProperty.Configurable = configurable;
prop->u.m_NamedDataProperty.m_Value = ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_UNDEFINED);
prop->u.NamedDataProperty.Value = ecma_MakeSimpleValue( ECMA_SIMPLE_VALUE_UNDEFINED);
ecma_SetPointer( prop->m_pNextProperty, ecma_GetPointer( obj_p->m_pProperties));
ecma_SetPointer( obj_p->m_pProperties, prop);
ecma_SetPointer( prop->pNextProperty, ecma_GetPointer( obj_p->pProperties));
ecma_SetPointer( obj_p->pProperties, prop);
return prop;
} /* ecma_CreateNamedProperty */
@@ -247,18 +247,18 @@ ecma_FindNamedProperty(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_GetPointer( obj_p->m_pProperties);
for ( ecma_Property_t *property_p = ecma_GetPointer( obj_p->pProperties);
property_p != NULL;
property_p = ecma_GetPointer( property_p->m_pNextProperty) )
property_p = ecma_GetPointer( property_p->pNextProperty) )
{
ecma_ArrayFirstChunk_t *property_name_p;
if ( property_p->m_Type == ECMA_PROPERTY_NAMEDDATA )
if ( property_p->Type == ECMA_PROPERTY_NAMEDDATA )
{
property_name_p = ecma_GetPointer( property_p->u.m_NamedDataProperty.m_pName);
} else if ( property_p->m_Type == ECMA_PROPERTY_NAMEDACCESSOR )
property_name_p = ecma_GetPointer( property_p->u.NamedDataProperty.pName);
} else if ( property_p->Type == ECMA_PROPERTY_NAMEDACCESSOR )
{
property_name_p = ecma_GetPointer( property_p->u.m_NamedAccessorProperty.m_pName);
property_name_p = ecma_GetPointer( property_p->u.NamedAccessorProperty.pName);
} else
{
continue;
@@ -316,7 +316,7 @@ ecma_GetNamedDataProperty(ecma_Object_t *obj_p, /**< object to find property in
ecma_Property_t *property_p = ecma_FindNamedProperty( obj_p, name_p);
JERRY_ASSERT( property_p != NULL && property_p->m_Type == ECMA_PROPERTY_NAMEDDATA );
JERRY_ASSERT( property_p != NULL && property_p->Type == ECMA_PROPERTY_NAMEDDATA );
return property_p;
} /* ecma_GetNamedDataProperty */
@@ -327,10 +327,10 @@ ecma_GetNamedDataProperty(ecma_Object_t *obj_p, /**< object to find property in
void
ecma_FreeNamedDataProperty( ecma_Property_t *pProperty) /**< the property */
{
JERRY_ASSERT( pProperty->m_Type == ECMA_PROPERTY_NAMEDDATA );
JERRY_ASSERT( pProperty->Type == ECMA_PROPERTY_NAMEDDATA );
ecma_FreeArray( ecma_GetPointer( pProperty->u.m_NamedDataProperty.m_pName));
ecma_FreeValue( pProperty->u.m_NamedDataProperty.m_Value);
ecma_FreeArray( ecma_GetPointer( pProperty->u.NamedDataProperty.pName));
ecma_FreeValue( pProperty->u.NamedDataProperty.Value);
ecma_DeallocProperty( pProperty);
} /* ecma_FreeNamedDataProperty */
@@ -341,12 +341,12 @@ ecma_FreeNamedDataProperty( ecma_Property_t *pProperty) /**< the property */
void
ecma_FreeNamedAccessorProperty( ecma_Property_t *pProperty) /**< the property */
{
JERRY_ASSERT( pProperty->m_Type == ECMA_PROPERTY_NAMEDACCESSOR );
JERRY_ASSERT( pProperty->Type == ECMA_PROPERTY_NAMEDACCESSOR );
ecma_FreeArray( ecma_GetPointer( pProperty->u.m_NamedAccessorProperty.m_pName));
ecma_FreeArray( ecma_GetPointer( pProperty->u.NamedAccessorProperty.pName));
ecma_Object_t *pGet = ecma_GetPointer(pProperty->u.m_NamedAccessorProperty.m_pGet);
ecma_Object_t *pSet = ecma_GetPointer(pProperty->u.m_NamedAccessorProperty.m_pSet);
ecma_Object_t *pGet = ecma_GetPointer(pProperty->u.NamedAccessorProperty.pGet);
ecma_Object_t *pSet = ecma_GetPointer(pProperty->u.NamedAccessorProperty.pSet);
if ( pGet != NULL )
{
@@ -367,10 +367,10 @@ ecma_FreeNamedAccessorProperty( ecma_Property_t *pProperty) /**< the property */
void
ecma_FreeInternalProperty( ecma_Property_t *pProperty) /**< the property */
{
JERRY_ASSERT( pProperty->m_Type == ECMA_PROPERTY_INTERNAL );
JERRY_ASSERT( pProperty->Type == ECMA_PROPERTY_INTERNAL );
ecma_InternalPropertyId_t propertyId = pProperty->u.m_InternalProperty.m_InternalPropertyType;
uint32_t propertyValue = pProperty->u.m_InternalProperty.m_Value;
ecma_InternalPropertyId_t propertyId = pProperty->u.InternalProperty.InternalPropertyType;
uint32_t propertyValue = pProperty->u.InternalProperty.Value;
switch ( propertyId )
{
@@ -406,7 +406,7 @@ ecma_FreeInternalProperty( ecma_Property_t *pProperty) /**< the property */
void
ecma_FreeProperty(ecma_Property_t *prop_p) /**< property */
{
switch ( (ecma_PropertyType_t) prop_p->m_Type )
switch ( (ecma_PropertyType_t) prop_p->Type )
{
case ECMA_PROPERTY_NAMEDDATA:
{
@@ -440,11 +440,11 @@ void
ecma_DeleteProperty(ecma_Object_t *obj_p, /**< object */
ecma_Property_t *prop_p) /**< property */
{
for ( ecma_Property_t *cur_prop_p = ecma_GetPointer( obj_p->m_pProperties), *prev_prop_p = NULL, *next_prop_p;
for ( ecma_Property_t *cur_prop_p = ecma_GetPointer( 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->m_pNextProperty);
next_prop_p = ecma_GetPointer( cur_prop_p->pNextProperty);
if ( cur_prop_p == prop_p )
{
@@ -452,10 +452,10 @@ ecma_DeleteProperty(ecma_Object_t *obj_p, /**< object */
if ( prev_prop_p == NULL )
{
ecma_SetPointer( obj_p->m_pProperties, next_prop_p);
ecma_SetPointer( obj_p->pProperties, next_prop_p);
} else
{
ecma_SetPointer( prev_prop_p->m_pNextProperty, next_prop_p);
ecma_SetPointer( prev_prop_p->pNextProperty, next_prop_p);
}
return;
@@ -489,30 +489,30 @@ ecma_NewEcmaString(const ecma_Char_t *pString) /**< zero-terminated string of ec
ecma_ArrayFirstChunk_t *pStringFirstChunk = ecma_AllocArrayFirstChunk();
pStringFirstChunk->m_Header.m_UnitNumber = length;
pStringFirstChunk->Header.UnitNumber = length;
uint8_t *copyPointer = (uint8_t*) pString;
size_t charsLeft = length;
size_t charsToCopy = JERRY_MIN( length, sizeof (pStringFirstChunk->m_Data) / sizeof (ecma_Char_t));
__memcpy(pStringFirstChunk->m_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);
ecma_ArrayNonFirstChunk_t *pStringNonFirstChunk;
JERRY_STATIC_ASSERT( ECMA_POINTER_FIELD_WIDTH <= sizeof(uint16_t) * JERRY_BITSINBYTE );
uint16_t *pNextChunkCompressedPointer = &pStringFirstChunk->m_Header.m_pNextChunk;
uint16_t *pNextChunkCompressedPointer = &pStringFirstChunk->Header.pNextChunk;
while ( charsLeft > 0 )
{
pStringNonFirstChunk = ecma_AllocArrayNonFirstChunk();
size_t charsToCopy = JERRY_MIN( charsLeft, sizeof (pStringNonFirstChunk->m_Data) / sizeof (ecma_Char_t));
__memcpy(pStringNonFirstChunk->m_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);
ecma_SetPointer( *pNextChunkCompressedPointer, pStringNonFirstChunk);
pNextChunkCompressedPointer = &pStringNonFirstChunk->m_pNextChunk;
pNextChunkCompressedPointer = &pStringNonFirstChunk->pNextChunk;
}
*pNextChunkCompressedPointer = ECMA_NULL_POINTER;
@@ -534,7 +534,7 @@ ecma_CopyEcmaStringCharsToBuffer(ecma_ArrayFirstChunk_t *pFirstChunk, /**< first
uint8_t *pBuffer, /**< destination buffer */
size_t bufferSize) /**< size of buffer */
{
ecma_Length_t stringLength = pFirstChunk->m_Header.m_UnitNumber;
ecma_Length_t stringLength = pFirstChunk->Header.UnitNumber;
size_t requiredBufferSize = sizeof (ecma_Length_t) + sizeof (ecma_Char_t) * stringLength;
if ( requiredBufferSize < bufferSize )
@@ -546,25 +546,25 @@ ecma_CopyEcmaStringCharsToBuffer(ecma_ArrayFirstChunk_t *pFirstChunk, /**< first
size_t charsLeft = stringLength;
uint8_t *destPointer = pBuffer + sizeof (ecma_Length_t);
size_t copyChunkChars = JERRY_MIN(sizeof (pFirstChunk->m_Data) / sizeof (ecma_Char_t),
size_t copyChunkChars = JERRY_MIN(sizeof (pFirstChunk->Data) / sizeof (ecma_Char_t),
charsLeft);
__memcpy( destPointer, pFirstChunk->m_Data, 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->m_Header.m_pNextChunk);
ecma_ArrayNonFirstChunk_t *pNonFirstChunk = ecma_GetPointer( pFirstChunk->Header.pNextChunk);
while ( charsLeft > 0 )
{
JERRY_ASSERT( charsLeft < stringLength );
copyChunkChars = JERRY_MIN(sizeof (pNonFirstChunk->m_Data) / sizeof (ecma_Char_t),
copyChunkChars = JERRY_MIN(sizeof (pNonFirstChunk->Data) / sizeof (ecma_Char_t),
charsLeft);
__memcpy( destPointer, pNonFirstChunk->m_Data, 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->m_pNextChunk);
pNonFirstChunk = ecma_GetPointer( pNonFirstChunk->pNextChunk);
}
return (ssize_t) requiredBufferSize;
@@ -584,18 +584,18 @@ ecma_DuplicateEcmaString( ecma_ArrayFirstChunk_t *pFirstChunk) /**< first chunk
__memcpy( pFirstChunkCopy, pFirstChunk, sizeof (ecma_ArrayFirstChunk_t));
ecma_ArrayNonFirstChunk_t *pNonFirstChunk, *pNonFirstChunkCopy;
pNonFirstChunk = ecma_GetPointer( pFirstChunk->m_Header.m_pNextChunk);
uint16_t *pNextPointer = &pFirstChunkCopy->m_Header.m_pNextChunk;
pNonFirstChunk = ecma_GetPointer( pFirstChunk->Header.pNextChunk);
uint16_t *pNextPointer = &pFirstChunkCopy->Header.pNextChunk;
while ( pNonFirstChunk != NULL )
{
pNonFirstChunkCopy = ecma_AllocArrayNonFirstChunk();
ecma_SetPointer( *pNextPointer, pNonFirstChunkCopy);
pNextPointer = &pNonFirstChunkCopy->m_pNextChunk;
pNextPointer = &pNonFirstChunkCopy->pNextChunk;
__memcpy( pNonFirstChunkCopy, pNonFirstChunk, sizeof (ecma_ArrayNonFirstChunk_t));
pNonFirstChunk = ecma_GetPointer( pNonFirstChunk->m_pNextChunk);
pNonFirstChunk = ecma_GetPointer( pNonFirstChunk->pNextChunk);
}
*pNextPointer = ECMA_NULL_POINTER;
@@ -630,13 +630,13 @@ ecma_CompareZtStringToEcmaString(const ecma_Char_t *pString, /**< zero-terminate
JERRY_ASSERT( pEcmaString != NULL );
const ecma_Char_t *str_iter_p = pString;
ecma_Length_t ecma_str_len = pEcmaString->m_Header.m_UnitNumber;
const ecma_Char_t *current_chunk_chars_cur = (ecma_Char_t*) pEcmaString->m_Data,
*current_chunk_chars_end = (ecma_Char_t*) (pEcmaString->m_Data
+ sizeof(pEcmaString->m_Data));
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->m_Header.m_pNextChunk;
const uint16_t *next_chunk_compressed_pointer_p = &pEcmaString->Header.pNextChunk;
for ( ecma_Length_t str_index = 0;
str_index < ecma_str_len;
@@ -651,10 +651,10 @@ ecma_CompareZtStringToEcmaString(const ecma_Char_t *pString, /**< zero-terminate
JERRY_ASSERT( next_chunk_p != NULL );
current_chunk_chars_cur = (ecma_Char_t*) pEcmaString->m_Data;
current_chunk_chars_end = (ecma_Char_t*) (next_chunk_p->m_Data + sizeof(next_chunk_p->m_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->m_pNextChunk;
next_chunk_compressed_pointer_p = &next_chunk_p->pNextChunk;
}
if ( *str_iter_p != *current_chunk_chars_cur )
@@ -686,13 +686,13 @@ ecma_FreeArray( ecma_ArrayFirstChunk_t *pFirstChunk) /**< first chunk of the arr
{
JERRY_ASSERT( pFirstChunk != NULL );
ecma_ArrayNonFirstChunk_t *pNonFirstChunk = ecma_GetPointer( pFirstChunk->m_Header.m_pNextChunk);
ecma_ArrayNonFirstChunk_t *pNonFirstChunk = ecma_GetPointer( pFirstChunk->Header.pNextChunk);
ecma_DeallocArrayFirstChunk( pFirstChunk);
while ( pNonFirstChunk != NULL )
{
ecma_ArrayNonFirstChunk_t *pNextChunk = ecma_GetPointer( pNonFirstChunk->m_pNextChunk);
ecma_ArrayNonFirstChunk_t *pNextChunk = ecma_GetPointer( pNonFirstChunk->pNextChunk);
ecma_DeallocArrayNonFirstChunk( pNonFirstChunk);