@@ -58,7 +58,8 @@ typedef enum
5858 ECMA_TYPE_SIMPLE , /**< simple value */
5959 ECMA_TYPE_NUMBER , /**< 64-bit integer */
6060 ECMA_TYPE_STRING , /**< pointer to description of a string */
61- ECMA_TYPE_OBJECT /**< pointer to description of an object */
61+ ECMA_TYPE_OBJECT , /**< pointer to description of an object */
62+ ECMA_TYPE___MAX = ECMA_TYPE_OBJECT /** highest value for ecma types */
6263} ecma_type_t ;
6364
6465/**
@@ -85,34 +86,33 @@ typedef enum
8586/**
8687 * Description of an ecma value
8788 *
88- * Bit-field structure: type (2) | error (1) | value (ECMA_POINTER_FIELD_WIDTH )
89+ * Bit-field structure: type (2) | error (1) | value (29 )
8990 */
9091typedef uint32_t ecma_value_t ;
9192
93+ #if UINTPTR_MAX <= UINT32_MAX
94+
9295/**
93- * Value type (ecma_type_t)
96+ * MEM_ALIGNMENT_LOG aligned pointers can be stored directly in ecma_value_t
9497 */
95- #define ECMA_VALUE_TYPE_POS (0)
96- #define ECMA_VALUE_TYPE_WIDTH (2)
98+ #define ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
99+
100+ #endif /* UINTPTR_MAX <= UINT32_MAX */
97101
98102/**
99- * Value is error (boolean)
103+ * Mask for ecma types in ecma_type_t
100104 */
101- #define ECMA_VALUE_ERROR_POS (ECMA_VALUE_TYPE_POS + \
102- ECMA_VALUE_TYPE_WIDTH)
103- #define ECMA_VALUE_ERROR_WIDTH (1)
105+ #define ECMA_VALUE_TYPE_MASK 0x3u
104106
105107/**
106- * Simple value (ecma_simple_value_t) or compressed pointer to value (depending on value_type)
108+ * Error flag in ecma_type_t
107109 */
108- #define ECMA_VALUE_VALUE_POS (ECMA_VALUE_ERROR_POS + \
109- ECMA_VALUE_ERROR_WIDTH)
110- #define ECMA_VALUE_VALUE_WIDTH (ECMA_POINTER_FIELD_WIDTH)
110+ #define ECMA_VALUE_ERROR_FLAG 0x4u
111111
112112/**
113- * Size of ecma value description, in bits
113+ * Shift for value part in ecma_type_t
114114 */
115- #define ECMA_VALUE_SIZE (ECMA_VALUE_VALUE_POS + ECMA_VALUE_VALUE_WIDTH)
115+ #define ECMA_VALUE_SHIFT 3
116116
117117/**
118118 * Internal properties' identifiers.
0 commit comments