Create extend byte code flags with function types. (#3802)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2020-06-15 13:40:55 +02:00
committed by GitHub
parent fde0d556ac
commit 1b2e0aec8c
10 changed files with 197 additions and 109 deletions
+2 -2
View File
@@ -683,7 +683,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
#if ENABLED (JERRY_ESNEXT)
const ecma_compiled_code_t *byte_code_p = ecma_op_function_get_compiled_code (ext_func_p);
if (byte_code_p->status_flags & CBC_CODE_FLAGS_ARROW_FUNCTION)
if (CBC_FUNCTION_GET_TYPE (byte_code_p->status_flags) == CBC_FUNCTION_ARROW)
{
ecma_arrow_function_t *arrow_func_p = (ecma_arrow_function_t *) object_p;
@@ -1201,7 +1201,7 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
ext_func_p->u.function.bytecode_cp));
#if ENABLED (JERRY_ESNEXT)
if (byte_code_p->status_flags & CBC_CODE_FLAGS_ARROW_FUNCTION)
if (CBC_FUNCTION_GET_TYPE (byte_code_p->status_flags) == CBC_FUNCTION_ARROW)
{
ecma_free_value_if_not_object (((ecma_arrow_function_t *) object_p)->this_binding);
ecma_free_value_if_not_object (((ecma_arrow_function_t *) object_p)->new_target);
+2 -2
View File
@@ -963,8 +963,8 @@ typedef struct
uint16_t size; /**< real size >> JMEM_ALIGNMENT_LOG */
uint16_t refs; /**< reference counter for the byte code */
uint16_t status_flags; /**< various status flags:
* CBC_CODE_FLAGS_FUNCTION flag tells whether
* the byte code is function or regular expression.
* CBC_IS_FUNCTION check tells whether the byte code
* is function or regular expression.
* If function, the other flags must be CBC_CODE_FLAGS...
* If regexp, the other flags must be RE_FLAG... */
} ecma_compiled_code_t;
+4 -4
View File
@@ -1367,7 +1367,7 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
return;
}
if (bytecode_p->status_flags & CBC_CODE_FLAGS_FUNCTION)
if (CBC_IS_FUNCTION (bytecode_p->status_flags))
{
ecma_value_t *literal_start_p = NULL;
uint32_t literal_end;
@@ -1439,7 +1439,7 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
#endif /* ENABLED (JERRY_DEBUGGER) */
#if ENABLED (JERRY_ESNEXT)
if (bytecode_p->status_flags & CBC_CODE_FLAG_HAS_TAGGED_LITERALS)
if (bytecode_p->status_flags & CBC_CODE_FLAGS_HAS_TAGGED_LITERALS)
{
ecma_collection_t *collection_p = ecma_compiled_code_get_tagged_template_collection (bytecode_p);
@@ -1477,7 +1477,7 @@ ecma_collection_t *
ecma_compiled_code_get_tagged_template_collection (const ecma_compiled_code_t *bytecode_header_p) /**< compiled code */
{
JERRY_ASSERT (bytecode_header_p != NULL);
JERRY_ASSERT (bytecode_header_p->status_flags & CBC_CODE_FLAG_HAS_TAGGED_LITERALS);
JERRY_ASSERT (bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_TAGGED_LITERALS);
ecma_value_t *base_p = ecma_compiled_code_resolve_function_name (bytecode_header_p);
@@ -1539,7 +1539,7 @@ ecma_compiled_code_resolve_function_name (const ecma_compiled_code_t *bytecode_h
ecma_value_t *base_p = ecma_compiled_code_resolve_arguments_start (bytecode_header_p);
#if ENABLED (JERRY_ESNEXT)
if (!(bytecode_header_p->status_flags & CBC_CODE_FLAGS_CLASS_CONSTRUCTOR))
if (CBC_FUNCTION_GET_TYPE (bytecode_header_p->status_flags) != CBC_FUNCTION_CONSTRUCTOR)
{
base_p--;
}
+3 -3
View File
@@ -334,7 +334,7 @@ ecma_save_literals_add_compiled_code (const ecma_compiled_code_t *compiled_code_
uint32_t const_literal_end;
uint32_t literal_end;
JERRY_ASSERT (compiled_code_p->status_flags & CBC_CODE_FLAGS_FUNCTION);
JERRY_ASSERT (CBC_IS_FUNCTION (compiled_code_p->status_flags));
if (compiled_code_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)
{
@@ -377,7 +377,7 @@ ecma_save_literals_add_compiled_code (const ecma_compiled_code_t *compiled_code_
ecma_compiled_code_t *bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
literal_p[i]);
if ((bytecode_p->status_flags & CBC_CODE_FLAGS_FUNCTION)
if (CBC_IS_FUNCTION (bytecode_p->status_flags)
&& bytecode_p != compiled_code_p)
{
ecma_save_literals_add_compiled_code (bytecode_p, lit_pool_p);
@@ -570,7 +570,7 @@ ecma_snapshot_resolve_serializable_values (ecma_compiled_code_t *compiled_code_p
#if ENABLED (JERRY_ESNEXT)
/* function name */
if (!(compiled_code_p->status_flags & CBC_CODE_FLAGS_CLASS_CONSTRUCTOR))
if (CBC_FUNCTION_GET_TYPE (compiled_code_p->status_flags) != CBC_FUNCTION_CONSTRUCTOR)
{
base_p--;
}