@@ -1441,17 +1441,8 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
14411441#if ENABLED (JERRY_ES2015 )
14421442 if (bytecode_p -> status_flags & CBC_CODE_FLAG_HAS_TAGGED_LITERALS )
14431443 {
1444- ecma_length_t formal_params_number = ecma_compiled_code_get_formal_params (bytecode_p );
1445-
1446- uint8_t * byte_p = (uint8_t * ) bytecode_p ;
1447- byte_p += ((size_t ) bytecode_p -> size ) << JMEM_ALIGNMENT_LOG ;
1448-
1449- ecma_value_t * tagged_base_p = (ecma_value_t * ) byte_p ;
1450- tagged_base_p -= formal_params_number ;
1451-
1452- ecma_collection_t * coll_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t , tagged_base_p [-1 ]);
1453-
1454- ecma_collection_destroy (coll_p );
1444+ ecma_value_t * base_p = ecma_compiled_code_resolve_arguments_start (bytecode_p );
1445+ ecma_collection_destroy (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t , base_p [-2 ]));
14551446 }
14561447#endif /* ENABLED (JERRY_ES2015) */
14571448
@@ -1484,17 +1475,18 @@ ecma_compiled_code_get_tagged_template_collection (const ecma_compiled_code_t *b
14841475 JERRY_ASSERT (bytecode_header_p != NULL );
14851476 JERRY_ASSERT (bytecode_header_p -> status_flags & CBC_CODE_FLAG_HAS_TAGGED_LITERALS );
14861477
1487- uint8_t * byte_p = (uint8_t * ) bytecode_header_p ;
1488- byte_p += ((size_t ) bytecode_header_p -> size ) << JMEM_ALIGNMENT_LOG ;
1478+ ecma_value_t * tagged_base_p = ecma_compiled_code_resolve_arguments_start (bytecode_header_p );
14891479
1490- ecma_value_t * tagged_base_p = (ecma_value_t * ) byte_p ;
1491- tagged_base_p -= ecma_compiled_code_get_formal_params (bytecode_header_p );
1480+ if (!(bytecode_header_p -> status_flags & CBC_CODE_FLAGS_CLASS_CONSTRUCTOR ))
1481+ {
1482+ tagged_base_p -- ;
1483+ }
14921484
14931485 return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t , tagged_base_p [-1 ]);
14941486} /* ecma_compiled_code_get_tagged_template_collection */
14951487#endif /* ENABLED (JERRY_ES2015) */
14961488
1497- #if ENABLED (JERRY_LINE_INFO ) || ENABLED ( JERRY_ES2015_MODULE_SYSTEM ) || ENABLED (JERRY_ES2015 )
1489+ #if ENABLED (JERRY_RESOURCE_NAME ) || ENABLED (JERRY_ES2015 )
14981490/**
14991491 * Get the number of formal parameters of the compiled code
15001492 *
@@ -1515,7 +1507,35 @@ ecma_compiled_code_get_formal_params (const ecma_compiled_code_t *bytecode_heade
15151507
15161508 return ((cbc_uint8_arguments_t * ) bytecode_header_p )-> argument_end ;
15171509} /* ecma_compiled_code_get_formal_params */
1518- #endif /* ENABLED (JERRY_LINE_INFO) || ENABLED (JERRY_ES2015_MODULE_SYSTEM) || ENABLED (JERRY_ES2015) */
1510+
1511+ /**
1512+ * Resolve the position of the arguments list start of the compiled code
1513+ *
1514+ * @return start position of the arguments list start of the compiled code
1515+ */
1516+ ecma_value_t *
1517+ ecma_compiled_code_resolve_arguments_start (const ecma_compiled_code_t * bytecode_header_p )
1518+ {
1519+ JERRY_ASSERT (bytecode_header_p != NULL );
1520+
1521+ uint8_t * byte_p = (uint8_t * ) bytecode_header_p ;
1522+ byte_p += ((size_t ) bytecode_header_p -> size ) << JMEM_ALIGNMENT_LOG ;
1523+
1524+ return ((ecma_value_t * ) byte_p ) - ecma_compiled_code_get_formal_params (bytecode_header_p );
1525+ } /* ecma_compiled_code_resolve_arguments_start */
1526+
1527+ /**
1528+ * Resolve the position of the function name of the compiled code
1529+ *
1530+ * @return position of the function name of the compiled code
1531+ */
1532+ inline ecma_value_t * JERRY_ATTR_ALWAYS_INLINE
1533+ ecma_compiled_code_resolve_function_name (const ecma_compiled_code_t * bytecode_header_p )
1534+ {
1535+ JERRY_ASSERT (bytecode_header_p != NULL );
1536+ return ecma_compiled_code_resolve_arguments_start (bytecode_header_p ) - 1 ;
1537+ } /* ecma_compiled_code_resolve_function_name */
1538+ #endif /* ENABLED (JERRY_RESOURCE_NAME) || ENABLED (JERRY_ES2015) */
15191539
15201540#if (JERRY_STACK_LIMIT != 0 )
15211541/**
0 commit comments