Create function variables using the data produced by the pre-scanner. (#3199)

The pre-scanner now is able to track all variable declarations and produces a compressed
stream which store this data for each function and catch block. When a function or
catch block is parsed, this information is decoded and the appropriate variables are
created. Furthermore a stack scope is created which contains the currently available
local variables and their register or literal index.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2019-10-17 15:20:04 +02:00
committed by GitHub
parent fd1f7eab9f
commit 7df87b7778
20 changed files with 2098 additions and 1219 deletions
+6 -8
View File
@@ -55,6 +55,8 @@ typedef enum
LEXER_REGEXP_LITERAL = 4, /**< regexp literal */
LEXER_UNUSED_LITERAL = 5, /**< unused literal, can only be
used by the byte code generator. */
LEXER_NEW_IDENT_LITERAL = 6, /**< new local variable, can only be
used by the byte code generator. */
} lexer_literal_type_t;
/**
@@ -67,15 +69,11 @@ typedef enum
*/
typedef enum
{
LEXER_FLAG_VAR = (1 << 0), /**< local identifier (var, function arg) */
LEXER_FLAG_NO_REG_STORE = (1 << 1), /**< this local identifier cannot be stored in register */
LEXER_FLAG_INITIALIZED = (1 << 2), /**< this local identifier is initialized with a value */
LEXER_FLAG_FUNCTION_ARGUMENT = (1 << 3), /**< this local identifier is a function argument */
LEXER_FLAG_UNUSED_IDENT = (1 << 4), /**< this identifier is referenced by sub-functions,
* but not referenced by the currently parsed function */
LEXER_FLAG_SOURCE_PTR = (1 << 5), /**< the literal is directly referenced in the source code
LEXER_FLAG_USED = (1 << 0), /**< this local identifier needs to be stored in the constant pool */
LEXER_FLAG_FUNCTION_ARGUMENT = (1 << 1), /**< this local identifier is a function argument */
LEXER_FLAG_SOURCE_PTR = (1 << 2), /**< the literal is directly referenced in the source code
* (no need to allocate memory) */
LEXER_FLAG_LATE_INIT = (1 << 6), /**< initialize this variable after the byte code is freed */
LEXER_FLAG_LATE_INIT = (1 << 3), /**< initialize this variable after the byte code is freed */
} lexer_literal_status_flags_t;
/**