@@ -459,8 +459,8 @@ jerry_parse_common (void *source_p, /**< script source */
459
459
ecma_object_t * object_p = ecma_create_object (NULL , sizeof (ecma_extended_object_t ), ECMA_OBJECT_TYPE_CLASS );
460
460
461
461
ecma_extended_object_t * ext_object_p = (ecma_extended_object_t * ) object_p ;
462
- ext_object_p -> u .cls .type = ECMA_OBJECT_CLASS_SCRIPT ;
463
- ECMA_SET_INTERNAL_VALUE_POINTER (ext_object_p -> u . cls . u3 . value , bytecode_data_p );
462
+ ext_object_p -> u .cls .head . type = ECMA_OBJECT_CLASS_SCRIPT ;
463
+ ECMA_SET_INTERNAL_VALUE_POINTER (ecma_object_cls_general ( ext_object_p ) -> value , bytecode_data_p );
464
464
465
465
return ecma_make_object_value (object_p );
466
466
} /* jerry_parse_common */
@@ -547,7 +547,8 @@ jerry_run (const jerry_value_t script) /**< script or module to run */
547
547
ecma_extended_object_t * ext_object_p = (ecma_extended_object_t * ) object_p ;
548
548
549
549
const ecma_compiled_code_t * bytecode_data_p ;
550
- bytecode_data_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t , ext_object_p -> u .cls .u3 .value );
550
+ bytecode_data_p =
551
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t , ecma_object_cls_general (ext_object_p )-> value );
551
552
552
553
JERRY_ASSERT (CBC_FUNCTION_GET_TYPE (bytecode_data_p -> status_flags ) == CBC_FUNCTION_SCRIPT );
553
554
@@ -644,7 +645,7 @@ jerry_module_evaluate (const jerry_value_t module) /**< root module */
644
645
return jerry_throw_sz (JERRY_ERROR_TYPE , ecma_get_error_msg (ECMA_ERR_NOT_MODULE ));
645
646
}
646
647
647
- if (module_p -> header .u .cls .u1 . module_state != JERRY_MODULE_STATE_LINKED )
648
+ if (module_p -> header .u .cls .module . state != JERRY_MODULE_STATE_LINKED )
648
649
{
649
650
return jerry_throw_sz (JERRY_ERROR_TYPE , ecma_get_error_msg (ECMA_ERR_MODULE_MUST_BE_IN_LINKED_STATE ));
650
651
}
@@ -676,7 +677,7 @@ jerry_module_state (const jerry_value_t module) /**< module object */
676
677
return JERRY_MODULE_STATE_INVALID ;
677
678
}
678
679
679
- return (jerry_module_state_t ) module_p -> header .u .cls .u1 . module_state ;
680
+ return (jerry_module_state_t ) module_p -> header .u .cls .module . state ;
680
681
#else /* !JERRY_MODULE_SYSTEM */
681
682
JERRY_UNUSED (module );
682
683
@@ -824,8 +825,8 @@ jerry_module_namespace (const jerry_value_t module) /**< module */
824
825
return jerry_throw_sz (JERRY_ERROR_TYPE , ecma_get_error_msg (ECMA_ERR_NOT_MODULE ));
825
826
}
826
827
827
- if (module_p -> header .u .cls .u1 . module_state < JERRY_MODULE_STATE_LINKED
828
- || module_p -> header .u .cls .u1 . module_state > JERRY_MODULE_STATE_EVALUATED )
828
+ if (module_p -> header .u .cls .module . state < JERRY_MODULE_STATE_LINKED
829
+ || module_p -> header .u .cls .module . state > JERRY_MODULE_STATE_EVALUATED )
829
830
{
830
831
return jerry_throw_sz (JERRY_ERROR_RANGE , ecma_get_error_msg (ECMA_ERR_NAMESPACE_OBJECT_IS_NOT_AVAILABLE ));
831
832
}
@@ -958,7 +959,7 @@ jerry_native_module (jerry_native_module_evaluate_cb_t callback, /**< evaluation
958
959
959
960
ecma_module_t * module_p = ecma_module_create ();
960
961
961
- module_p -> header .u .cls .u2 . module_flags |= ECMA_MODULE_IS_NATIVE ;
962
+ module_p -> header .u .cls .module . flags |= ECMA_MODULE_IS_NATIVE ;
962
963
module_p -> scope_p = scope_p ;
963
964
module_p -> local_exports_p = local_exports_p ;
964
965
module_p -> u .callback = callback ;
@@ -999,7 +1000,7 @@ jerry_native_module_get (const jerry_value_t native_module, /**< a native module
999
1000
return jerry_throw_sz (JERRY_ERROR_TYPE , ecma_get_error_msg (ECMA_ERR_NOT_MODULE ));
1000
1001
}
1001
1002
1002
- if (!(module_p -> header .u .cls .u2 . module_flags & ECMA_MODULE_IS_NATIVE ) || !ecma_is_value_string (export_name ))
1003
+ if (!(module_p -> header .u .cls .module . flags & ECMA_MODULE_IS_NATIVE ) || !ecma_is_value_string (export_name ))
1003
1004
{
1004
1005
return jerry_throw_sz (JERRY_ERROR_TYPE , ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG ));
1005
1006
}
@@ -1044,7 +1045,7 @@ jerry_native_module_set (jerry_value_t native_module, /**< a native module objec
1044
1045
return jerry_throw_sz (JERRY_ERROR_TYPE , ecma_get_error_msg (ECMA_ERR_NOT_MODULE ));
1045
1046
}
1046
1047
1047
- if (!(module_p -> header .u .cls .u2 . module_flags & ECMA_MODULE_IS_NATIVE ) || !ecma_is_value_string (export_name )
1048
+ if (!(module_p -> header .u .cls .module . flags & ECMA_MODULE_IS_NATIVE ) || !ecma_is_value_string (export_name )
1048
1049
|| ecma_is_value_exception (value ))
1049
1050
{
1050
1051
return jerry_throw_sz (JERRY_ERROR_TYPE , ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG ));
@@ -1540,8 +1541,8 @@ jerry_object_type (const jerry_value_t value) /**< input value to check */
1540
1541
case ECMA_OBJECT_TYPE_CLASS :
1541
1542
case ECMA_OBJECT_TYPE_BUILT_IN_CLASS :
1542
1543
{
1543
- JERRY_ASSERT (ext_obj_p -> u .cls .type < ECMA_OBJECT_CLASS__MAX );
1544
- return jerry_class_object_type [ext_obj_p -> u .cls .type ];
1544
+ JERRY_ASSERT (ext_obj_p -> u .cls .head . type < ECMA_OBJECT_CLASS__MAX );
1545
+ return jerry_class_object_type [ext_obj_p -> u .cls .head . type ];
1545
1546
}
1546
1547
case ECMA_OBJECT_TYPE_ARRAY :
1547
1548
case ECMA_OBJECT_TYPE_BUILT_IN_ARRAY :
@@ -1650,7 +1651,7 @@ jerry_iterator_type (const jerry_value_t value) /**< input value to check */
1650
1651
1651
1652
if (ecma_get_object_type (obj_p ) == ECMA_OBJECT_TYPE_CLASS )
1652
1653
{
1653
- switch (ext_obj_p -> u .cls .type )
1654
+ switch (ext_obj_p -> u .cls .head . type )
1654
1655
{
1655
1656
case ECMA_OBJECT_CLASS_ARRAY_ITERATOR :
1656
1657
{
@@ -3616,7 +3617,7 @@ jerry_object_set_internal (jerry_value_t object, /**< object value */
3616
3617
internal_object_p = ecma_create_object (NULL , sizeof (ecma_extended_object_t ), ECMA_OBJECT_TYPE_CLASS );
3617
3618
{
3618
3619
ecma_extended_object_t * container_p = (ecma_extended_object_t * ) internal_object_p ;
3619
- container_p -> u .cls .type = ECMA_OBJECT_CLASS_INTERNAL_OBJECT ;
3620
+ container_p -> u .cls .head . type = ECMA_OBJECT_CLASS_INTERNAL_OBJECT ;
3620
3621
}
3621
3622
3622
3623
value_p -> value = ecma_make_object_value (internal_object_p );
@@ -4147,7 +4148,7 @@ jerry_object_is_valid_foreach (ecma_object_t *object_p) /**< object to test */
4147
4148
if (object_type == ECMA_OBJECT_TYPE_CLASS )
4148
4149
{
4149
4150
ecma_extended_object_t * ext_object_p = (ecma_extended_object_t * ) object_p ;
4150
- switch (ext_object_p -> u .cls .type )
4151
+ switch (ext_object_p -> u .cls .head . type )
4151
4152
{
4152
4153
/* An object's internal property object should not be iterable by foreach. */
4153
4154
case ECMA_OBJECT_CLASS_INTERNAL_OBJECT :
@@ -5653,16 +5654,17 @@ jerry_source_info (const jerry_value_t value) /**< jerry api value */
5653
5654
ecma_extended_object_t * ext_object_p = (ecma_extended_object_t * ) object_p ;
5654
5655
const ecma_compiled_code_t * bytecode_p = NULL ;
5655
5656
5656
- if (ext_object_p -> u .cls .type == ECMA_OBJECT_CLASS_SCRIPT )
5657
+ if (ext_object_p -> u .cls .head . type == ECMA_OBJECT_CLASS_SCRIPT )
5657
5658
{
5658
- bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t , ext_object_p -> u .cls .u3 .value );
5659
+ bytecode_p =
5660
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t , ecma_object_cls_general (ext_object_p )-> value );
5659
5661
}
5660
5662
#if JERRY_MODULE_SYSTEM
5661
- else if (ext_object_p -> u .cls .type == ECMA_OBJECT_CLASS_MODULE )
5663
+ else if (ext_object_p -> u .cls .head . type == ECMA_OBJECT_CLASS_MODULE )
5662
5664
{
5663
5665
ecma_module_t * module_p = (ecma_module_t * ) object_p ;
5664
5666
5665
- if (!(module_p -> header .u .cls .u2 . module_flags & ECMA_MODULE_IS_NATIVE ))
5667
+ if (!(module_p -> header .u .cls .module . flags & ECMA_MODULE_IS_NATIVE ))
5666
5668
{
5667
5669
bytecode_p = module_p -> u .compiled_code_p ;
5668
5670
}
@@ -5993,7 +5995,7 @@ jerry_arraybuffer_external (uint8_t *buffer_p, /**< the backing store used by th
5993
5995
5994
5996
if (buffer_p != NULL )
5995
5997
{
5996
- arraybuffer_pointer_p -> extended_object .u .cls .u1 . array_buffer_flags |= ECMA_ARRAYBUFFER_ALLOCATED ;
5998
+ arraybuffer_pointer_p -> extended_object .u .cls .arraybuffer . flags |= ECMA_ARRAYBUFFER_ALLOCATED ;
5997
5999
arraybuffer_pointer_p -> buffer_p = buffer_p ;
5998
6000
}
5999
6001
}
@@ -6081,7 +6083,7 @@ jerry_shared_arraybuffer_external (uint8_t *buffer_p, /**< the backing store use
6081
6083
6082
6084
if (buffer_p != NULL )
6083
6085
{
6084
- shared_arraybuffer_pointer_p -> extended_object .u .cls .u1 . array_buffer_flags |= ECMA_ARRAYBUFFER_ALLOCATED ;
6086
+ shared_arraybuffer_pointer_p -> extended_object .u .cls .arraybuffer . flags |= ECMA_ARRAYBUFFER_ALLOCATED ;
6085
6087
shared_arraybuffer_pointer_p -> buffer_p = buffer_p ;
6086
6088
}
6087
6089
}
@@ -6529,7 +6531,7 @@ jerry_dataview_buffer (const jerry_value_t value, /**< DataView to get the array
6529
6531
6530
6532
if (byte_length != NULL )
6531
6533
{
6532
- * byte_length = dataview_p -> header .u .cls .u3 .length ;
6534
+ * byte_length = dataview_p -> header .u .cls .dataview .length ;
6533
6535
}
6534
6536
6535
6537
ecma_object_t * arraybuffer_p = dataview_p -> buffer_p ;
@@ -7032,7 +7034,7 @@ jerry_container_type (const jerry_value_t value) /**< the container object */
7032
7034
7033
7035
if (ecma_object_class_is (obj_p , ECMA_OBJECT_CLASS_CONTAINER ))
7034
7036
{
7035
- switch (((ecma_extended_object_t * ) obj_p )-> u .cls .u2 . container_id )
7037
+ switch (((ecma_extended_object_t * ) obj_p )-> u .cls .container . id )
7036
7038
{
7037
7039
case LIT_MAGIC_STRING_MAP_UL :
7038
7040
{
@@ -7103,10 +7105,10 @@ jerry_container_to_array (const jerry_value_t value, /**< the container or itera
7103
7105
7104
7106
* is_key_value_p = false;
7105
7107
7106
- if (ext_obj_p -> u .cls .type == ECMA_OBJECT_CLASS_MAP_ITERATOR
7107
- || ext_obj_p -> u .cls .type == ECMA_OBJECT_CLASS_SET_ITERATOR )
7108
+ if (ext_obj_p -> u .cls .head . type == ECMA_OBJECT_CLASS_MAP_ITERATOR
7109
+ || ext_obj_p -> u .cls .head . type == ECMA_OBJECT_CLASS_SET_ITERATOR )
7108
7110
{
7109
- ecma_value_t iterated_value = ext_obj_p -> u .cls .u3 . iterated_value ;
7111
+ ecma_value_t iterated_value = ext_obj_p -> u .cls .iterator . value ;
7110
7112
7111
7113
if (ecma_is_value_empty (iterated_value ))
7112
7114
{
@@ -7115,27 +7117,29 @@ jerry_container_to_array (const jerry_value_t value, /**< the container or itera
7115
7117
7116
7118
ecma_extended_object_t * map_object_p = (ecma_extended_object_t * ) (ecma_get_object_from_value (iterated_value ));
7117
7119
7118
- ecma_collection_t * container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t , map_object_p -> u .cls .u3 .value );
7120
+ ecma_collection_t * container_p =
7121
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t , map_object_p -> u .cls .container .value );
7119
7122
entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p );
7120
- index = ext_obj_p -> u .cls .u2 . iterator_index ;
7123
+ index = ext_obj_p -> u .cls .iterator . index ;
7121
7124
7122
- entry_size = ecma_op_container_entry_size (map_object_p -> u .cls .u2 . container_id );
7125
+ entry_size = ecma_op_container_entry_size (map_object_p -> u .cls .container . id );
7123
7126
start_p = ECMA_CONTAINER_START (container_p );
7124
7127
7125
- iterator_kind = ext_obj_p -> u .cls .u1 . iterator_kind ;
7128
+ iterator_kind = ext_obj_p -> u .cls .iterator . kind ;
7126
7129
}
7127
7130
else if (jerry_container_type (value ) != JERRY_CONTAINER_TYPE_INVALID )
7128
7131
{
7129
- ecma_collection_t * container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t , ext_obj_p -> u .cls .u3 .value );
7132
+ ecma_collection_t * container_p =
7133
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t , ext_obj_p -> u .cls .container .value );
7130
7134
entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p );
7131
- entry_size = ecma_op_container_entry_size (ext_obj_p -> u .cls .u2 . container_id );
7135
+ entry_size = ecma_op_container_entry_size (ext_obj_p -> u .cls .container . id );
7132
7136
7133
7137
index = 0 ;
7134
7138
iterator_kind = ECMA_ITERATOR_KEYS ;
7135
7139
start_p = ECMA_CONTAINER_START (container_p );
7136
7140
7137
- if (ext_obj_p -> u .cls .u2 . container_id == LIT_MAGIC_STRING_MAP_UL
7138
- || ext_obj_p -> u .cls .u2 . container_id == LIT_MAGIC_STRING_WEAKMAP_UL )
7141
+ if (ext_obj_p -> u .cls .container . id == LIT_MAGIC_STRING_MAP_UL
7142
+ || ext_obj_p -> u .cls .container . id == LIT_MAGIC_STRING_WEAKMAP_UL )
7139
7143
{
7140
7144
iterator_kind = ECMA_ITERATOR_ENTRIES ;
7141
7145
}
@@ -7200,7 +7204,7 @@ jerry_container_op (jerry_container_op_t operation, /**< container operation */
7200
7204
{
7201
7205
return jerry_throw_sz (JERRY_ERROR_TYPE , ecma_get_error_msg (ECMA_ERR_CONTAINER_IS_NOT_A_CONTAINER_OBJECT ));
7202
7206
}
7203
- uint16_t type = ((ecma_extended_object_t * ) obj_p )-> u .cls .u2 . container_id ;
7207
+ uint16_t type = ((ecma_extended_object_t * ) obj_p )-> u .cls .container . id ;
7204
7208
ecma_extended_object_t * container_object_p = ecma_op_container_get_object (container , type );
7205
7209
7206
7210
if (container_object_p == NULL )
0 commit comments