Moving label descriptor from ecma_completion_value_t to separate structure on heap (fixing performance degradation that occured in commit 5d92544db57203603a6ed53b5c18562065a70b77).
This commit is contained in:
@@ -30,6 +30,7 @@ JERRY_STATIC_ASSERT (sizeof (ecma_collection_header_t) == sizeof (uint64_t));
|
|||||||
JERRY_STATIC_ASSERT (sizeof (ecma_collection_chunk_t) == sizeof (uint64_t));
|
JERRY_STATIC_ASSERT (sizeof (ecma_collection_chunk_t) == sizeof (uint64_t));
|
||||||
JERRY_STATIC_ASSERT (sizeof (ecma_string_t) == sizeof (uint64_t));
|
JERRY_STATIC_ASSERT (sizeof (ecma_string_t) == sizeof (uint64_t));
|
||||||
JERRY_STATIC_ASSERT (sizeof (ecma_completion_value_t) == sizeof (uint32_t));
|
JERRY_STATIC_ASSERT (sizeof (ecma_completion_value_t) == sizeof (uint32_t));
|
||||||
|
JERRY_STATIC_ASSERT (sizeof (ecma_label_descriptor_t) == sizeof (uint64_t));
|
||||||
|
|
||||||
/** \addtogroup ecma ECMA
|
/** \addtogroup ecma ECMA
|
||||||
* @{
|
* @{
|
||||||
@@ -101,6 +102,7 @@ DECLARE_ROUTINES_FOR (number)
|
|||||||
DECLARE_ROUTINES_FOR (collection_header)
|
DECLARE_ROUTINES_FOR (collection_header)
|
||||||
DECLARE_ROUTINES_FOR (collection_chunk)
|
DECLARE_ROUTINES_FOR (collection_chunk)
|
||||||
DECLARE_ROUTINES_FOR (string)
|
DECLARE_ROUTINES_FOR (string)
|
||||||
|
DECLARE_ROUTINES_FOR (label_descriptor)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
|
|||||||
@@ -97,6 +97,18 @@ extern ecma_string_t *ecma_alloc_string (void);
|
|||||||
*/
|
*/
|
||||||
extern void ecma_dealloc_string (ecma_string_t *string_p);
|
extern void ecma_dealloc_string (ecma_string_t *string_p);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate memory for label descriptor
|
||||||
|
*
|
||||||
|
* @return pointer to allocated memory
|
||||||
|
*/
|
||||||
|
extern ecma_label_descriptor_t *ecma_alloc_label_descriptor (void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dealloc memory from label descriptor
|
||||||
|
*/
|
||||||
|
extern void ecma_dealloc_label_descriptor (ecma_label_descriptor_t *label_desc_p);
|
||||||
|
|
||||||
#endif /* JERRY_ECMA_ALLOC_H */
|
#endif /* JERRY_ECMA_ALLOC_H */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -132,7 +132,10 @@ typedef struct
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
/** Type (ecma_completion_type_t) */
|
/** Type (ecma_completion_type_t) */
|
||||||
unsigned int type : 8;
|
uint8_t type;
|
||||||
|
|
||||||
|
/** Just padding for the structure */
|
||||||
|
uint8_t padding;
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
@@ -148,16 +151,23 @@ typedef struct
|
|||||||
*
|
*
|
||||||
* Used for break and continue completion types.
|
* Used for break and continue completion types.
|
||||||
*/
|
*/
|
||||||
struct
|
uint16_t label_desc_cp;
|
||||||
{
|
} u;
|
||||||
/** Levels to label left */
|
} ecma_completion_value_t;
|
||||||
uint8_t depth;
|
|
||||||
|
|
||||||
/** Target's offset */
|
/**
|
||||||
uint16_t offset;
|
* Label
|
||||||
} __packed target;
|
*
|
||||||
} __packed u;
|
* Used for break and continue completion types.
|
||||||
} __packed ecma_completion_value_t;
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
/** Target's offset */
|
||||||
|
uint32_t offset;
|
||||||
|
|
||||||
|
/** Levels to label left */
|
||||||
|
uint32_t depth;
|
||||||
|
} ecma_label_descriptor_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Target value indicating that target field
|
* Target value indicating that target field
|
||||||
|
|||||||
@@ -319,9 +319,15 @@ ecma_make_label_completion_value (ecma_completion_type_t type, /**< type */
|
|||||||
|
|
||||||
ecma_completion_value_t ret_value;
|
ecma_completion_value_t ret_value;
|
||||||
|
|
||||||
|
ecma_label_descriptor_t *label_desc_p = ecma_alloc_label_descriptor ();
|
||||||
|
*label_desc_p = (ecma_label_descriptor_t)
|
||||||
|
{
|
||||||
|
.offset = offset,
|
||||||
|
.depth = depth_level
|
||||||
|
};
|
||||||
|
|
||||||
ret_value.type = type;
|
ret_value.type = type;
|
||||||
ret_value.u.target.depth = depth_level;
|
ECMA_SET_POINTER (ret_value.u.label_desc_cp, label_desc_p);
|
||||||
ret_value.u.target.offset = offset;
|
|
||||||
|
|
||||||
return ret_value;
|
return ret_value;
|
||||||
} /* ecma_make_label_completion_value */
|
} /* ecma_make_label_completion_value */
|
||||||
@@ -470,6 +476,10 @@ ecma_free_completion_value (ecma_completion_value_t completion_value) /**< compl
|
|||||||
}
|
}
|
||||||
case ECMA_COMPLETION_TYPE_CONTINUE:
|
case ECMA_COMPLETION_TYPE_CONTINUE:
|
||||||
case ECMA_COMPLETION_TYPE_BREAK:
|
case ECMA_COMPLETION_TYPE_BREAK:
|
||||||
|
{
|
||||||
|
ecma_dealloc_label_descriptor (ECMA_GET_POINTER (completion_value.u.label_desc_cp));
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ECMA_COMPLETION_TYPE_META:
|
case ECMA_COMPLETION_TYPE_META:
|
||||||
{
|
{
|
||||||
JERRY_UNREACHABLE ();
|
JERRY_UNREACHABLE ();
|
||||||
|
|||||||
Reference in New Issue
Block a user