Rework storing the line/column/bytecode info (#4707)

This information is stored in a separate memory block instead
of being part of the byte code. Snapshot does not supported.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2021-07-15 13:45:10 +02:00
committed by GitHub
parent 4be05a74eb
commit 998e49a969
22 changed files with 1218 additions and 201 deletions
+45
View File
@@ -19,6 +19,7 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-lcache.h"
#include "ecma-line-info.h"
#include "ecma-property-hashmap.h"
#include "jcontext.h"
#include "jrt-bit-fields.h"
@@ -1525,6 +1526,13 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
}
#endif /* JERRY_ESNEXT */
#if JERRY_LINE_INFO
if (bytecode_p->status_flags & CBC_CODE_FLAGS_HAS_LINE_INFO)
{
ecma_line_info_free (ecma_compiled_code_get_line_info (bytecode_p));
}
#endif /* JERRY_LINE_INFO */
#if JERRY_DEBUGGER
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& !(bytecode_p->status_flags & CBC_CODE_FLAGS_DEBUGGER_IGNORE)
@@ -1657,6 +1665,43 @@ ecma_compiled_code_get_tagged_template_collection (const ecma_compiled_code_t *b
#endif /* JERRY_ESNEXT */
#if JERRY_LINE_INFO
/**
* Get the line info data from the byte code
*
* @return pointer to the line info data
*/
uint8_t *
ecma_compiled_code_get_line_info (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_FLAGS_HAS_LINE_INFO);
ecma_value_t *base_p = ecma_compiled_code_resolve_arguments_start (bytecode_header_p);
#if JERRY_ESNEXT
if (CBC_FUNCTION_GET_TYPE (bytecode_header_p->status_flags) != CBC_FUNCTION_CONSTRUCTOR)
{
base_p--;
}
if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_EXTENDED_INFO)
{
base_p--;
}
if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_TAGGED_LITERALS)
{
base_p--;
}
#endif /* JERRY_ESNEXT */
return ECMA_GET_INTERNAL_VALUE_POINTER (uint8_t, base_p[-1]);
} /* ecma_compiled_code_get_line_info */
#endif /* JERRY_LINE_INFO */
/**
* Get the resource name of a compiled code.
*