Rework usages/naming of configuration macros [part 2] (#2903)
There are quite a few configuration macros in the project. As discussed in the #2520 issue there are a few awkward constructs. Main changes: * The following macros are now 0/1 switches: ** Renamed CONFIG_ECMA_LCACHE_DISABLE to JERRY_LCACHE. ** Renamed CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE to JERRY_PROPERTY_HASHMAP. ** Renamed CONFIG_DISABLE_UNICODE_CASE_CONVERSION to JERRY_UNICODE_CASE_CONVERSION. ** Renamed ENABLE_REGEXP_STRICT_MODE to JERRY_REGEXP_STRICT_MODE. ** Renamed JERRY_DISABLE_JS_PARSER to JERRY_PARSER. ** Renamed JERRY_ENABLE_ERROR_MESSAGES to JERRY_ERROR_MESSAGES. ** Renamed JERRY_ENABLE_EXTERNAL_CONTEXT to JERRY_EXTERNAL_CONTEXT. ** Renamed JERRY_ENABLE_LINE_INFO to JERRY_LINE_INFO. ** Renamed JERRY_ENABLE_LOGGING to JERRY_LOGGING. ** Renamed JERRY_ENABLE_SNAPSHOT_EXEC to JERRY_SNAPSHOT_EXEC. ** Renamed JERRY_ENABLE_SNAPSHOT_SAVE to JERRY_SNAPSHOT_SAVE. ** Renamed JERRY_SYSTEM_ALLOCATOR to JERRY_SYSTEM_ALLOCATOR. ** Renamed JERRY_VM_EXEC_STOP to JERRY_VM_EXEC_STOP. ** Renamed JMEM_GC_BEFORE_EACH_ALLOC to JERRY_MEM_GC_BEFORE_EACH_ALLOC. ** Renamed JMEM_STATS to JERRY_MEM_STATS. ** Renamed PARSER_DUMP_BYTE_CODE to JERRY_PARSER_DUMP_BYTE_CODE. ** Renamed REGEXP_DUMP_BYTE_CODE to JERRY_REGEXP_DUMP_BYTE_CODE. * Recursion check changes: ** Renamed REGEXP_RECURSION_LIMIT to JERRY_REGEXP_RECURSION_LIMIT. ** Renamed VM_RECURSION_LIMIT to JERRY_VM_RECURSION_LIMIT. * Attribute macro changes: ** Renamed JERRY_CONST_DATA to JERRY_ATTR_CONST_DATA. ** Renamed JERRY_HEAP_SECTION_ATTR to JERRY_ATTR_GLOBAL_HEAP. Now the macro can specify any attribute for the global heap object. * Other macro changes: ** Renamed CONFIG_MEM_HEAP_AREA_SIZE to JERRY_GLOBAL_HEAP_SIZE. Then new macro now specify the global heap size in kilobytes. * Updated documentations to reflect the new macro names. For more deatils please see jerry-core/config.h. JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
This commit is contained in:
@@ -21,7 +21,7 @@ JERRY_STATIC_ASSERT ((sizeof (cbc_uint8_arguments_t) % sizeof (jmem_cpointer_t))
|
||||
JERRY_STATIC_ASSERT ((sizeof (cbc_uint16_arguments_t) % sizeof (jmem_cpointer_t)) == 0,
|
||||
sizeof_cbc_uint16_arguments_t_must_be_divisible_by_sizeof_jmem_cpointer_t);
|
||||
|
||||
#ifndef JERRY_DISABLE_JS_PARSER
|
||||
#if ENABLED (JERRY_PARSER)
|
||||
|
||||
/** \addtogroup parser Parser
|
||||
* @{
|
||||
@@ -42,7 +42,7 @@ JERRY_STATIC_ASSERT ((sizeof (cbc_uint16_arguments_t) % sizeof (jmem_cpointer_t)
|
||||
/**
|
||||
* Flags of the opcodes.
|
||||
*/
|
||||
const uint8_t cbc_flags[] JERRY_CONST_DATA =
|
||||
const uint8_t cbc_flags[] JERRY_ATTR_CONST_DATA =
|
||||
{
|
||||
CBC_OPCODE_LIST
|
||||
};
|
||||
@@ -57,7 +57,7 @@ const uint8_t cbc_ext_flags[] =
|
||||
|
||||
#undef CBC_OPCODE
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
|
||||
#define CBC_OPCODE(arg1, arg2, arg3, arg4) #arg1,
|
||||
|
||||
@@ -79,7 +79,7 @@ const char * const cbc_ext_names[] =
|
||||
|
||||
#undef CBC_OPCODE
|
||||
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
@@ -87,4 +87,4 @@ const char * const cbc_ext_names[] =
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !JERRY_DISABLE_JS_PARSER */
|
||||
#endif /* ENABLED (JERRY_PARSER) */
|
||||
|
||||
@@ -692,7 +692,7 @@ typedef enum
|
||||
extern const uint8_t cbc_flags[];
|
||||
extern const uint8_t cbc_ext_flags[];
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
|
||||
/**
|
||||
* Opcode names for debugging.
|
||||
@@ -700,7 +700,7 @@ extern const uint8_t cbc_ext_flags[];
|
||||
extern const char * const cbc_names[];
|
||||
extern const char * const cbc_ext_names[];
|
||||
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "common.h"
|
||||
#include "ecma-helpers.h"
|
||||
|
||||
#ifndef JERRY_DISABLE_JS_PARSER
|
||||
#if ENABLED (JERRY_PARSER)
|
||||
|
||||
/** \addtogroup parser Parser
|
||||
* @{
|
||||
@@ -49,7 +49,7 @@ util_free_literal (lexer_literal_t *literal_p) /**< literal */
|
||||
}
|
||||
} /* util_free_literal */
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
|
||||
/**
|
||||
* Debug utility to print a character sequence.
|
||||
@@ -124,7 +124,7 @@ util_print_literal (lexer_literal_t *literal_p) /**< literal */
|
||||
JERRY_DEBUG_MSG (")");
|
||||
} /* util_print_literal */
|
||||
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
@@ -132,4 +132,4 @@ util_print_literal (lexer_literal_t *literal_p) /**< literal */
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !JERRY_DISABLE_JS_PARSER */
|
||||
#endif /* ENABLED (JERRY_PARSER) */
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-regexp-object.h"
|
||||
#include "jmem.h"
|
||||
@@ -74,11 +75,11 @@ typedef enum
|
||||
/**
|
||||
* Type of property length.
|
||||
*/
|
||||
#ifdef JERRY_CPOINTER_32_BIT
|
||||
#if ENABLED (JERRY_CPOINTER_32_BIT)
|
||||
typedef uint32_t prop_length_t;
|
||||
#else /* !JERRY_CPOINTER_32_BIT */
|
||||
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
|
||||
typedef uint16_t prop_length_t;
|
||||
#endif /* JERRY_CPOINTER_32_BIT */
|
||||
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
|
||||
|
||||
/**
|
||||
* Literal data.
|
||||
@@ -93,11 +94,11 @@ typedef struct
|
||||
uint32_t source_data; /**< encoded source literal */
|
||||
} u;
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
struct
|
||||
#else /* !PARSER_DUMP_BYTE_CODE */
|
||||
#else /* !ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
union
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
{
|
||||
prop_length_t length; /**< length of ident / string literal */
|
||||
uint16_t index; /**< real index during post processing */
|
||||
@@ -109,9 +110,9 @@ typedef struct
|
||||
|
||||
void util_free_literal (lexer_literal_t *literal_p);
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
void util_print_literal (lexer_literal_t *);
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
/* TRY/CATCH block */
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "lit-char-helpers.h"
|
||||
#include "jcontext.h"
|
||||
|
||||
#ifndef JERRY_DISABLE_JS_PARSER
|
||||
#if ENABLED (JERRY_PARSER)
|
||||
|
||||
/** \addtogroup parser Parser
|
||||
* @{
|
||||
@@ -2642,4 +2642,4 @@ lexer_convert_binary_lvalue_token_to_binary (uint8_t token) /**< binary lvalue t
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !JERRY_DISABLE_JS_PARSER */
|
||||
#endif /* ENABLED (JERRY_PARSER) */
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "js-parser-internal.h"
|
||||
|
||||
#ifndef JERRY_DISABLE_JS_PARSER
|
||||
#if ENABLED (JERRY_PARSER)
|
||||
#include "jcontext.h"
|
||||
|
||||
#include "ecma-helpers.h"
|
||||
@@ -2352,4 +2352,4 @@ parser_parse_expression (parser_context_t *context_p, /**< context */
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !JERRY_DISABLE_JS_PARSER */
|
||||
#endif /* ENABLED (JERRY_PARSER) */
|
||||
|
||||
@@ -383,10 +383,10 @@ typedef struct
|
||||
uint16_t context_stack_depth; /**< current context stack depth */
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
int is_show_opcodes; /**< show opcodes */
|
||||
uint32_t total_byte_code_size; /**< total byte code size */
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
#ifdef JERRY_DEBUGGER
|
||||
parser_breakpoint_info_t breakpoint_info[PARSER_MAX_BREAKPOINT_INFO_COUNT]; /**< breakpoint info list */
|
||||
@@ -394,9 +394,9 @@ typedef struct
|
||||
parser_line_counter_t last_breakpoint_line; /**< last line where breakpoint has been inserted */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
parser_line_counter_t last_line_info_line; /**< last line where line info has been inserted */
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
} parser_context_t;
|
||||
|
||||
/**
|
||||
@@ -611,11 +611,11 @@ void parser_append_breakpoint_info (parser_context_t *context_p, jerry_debugger_
|
||||
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
|
||||
void parser_emit_line_info (parser_context_t *context_p, uint32_t line, bool flush_cbc);
|
||||
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
* Maximum string limit.
|
||||
* Limit: 2147483647 / 65535.
|
||||
*/
|
||||
#ifdef JERRY_CPOINTER_32_BIT
|
||||
#if ENABLED (JERRY_CPOINTER_32_BIT)
|
||||
#define PARSER_MAXIMUM_STRING_LIMIT 2147483647
|
||||
#else /* !JERRY_CPOINTER_32_BIT */
|
||||
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
|
||||
#define PARSER_MAXIMUM_STRING_LIMIT 65535
|
||||
#endif /* JERRY_CPOINTER_32_BIT */
|
||||
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
|
||||
|
||||
/**
|
||||
* Maximum string length.
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "js-parser-internal.h"
|
||||
|
||||
#ifndef JERRY_DISABLE_JS_PARSER
|
||||
#if ENABLED (JERRY_PARSER)
|
||||
|
||||
/** \addtogroup mem Memory allocation
|
||||
* @{
|
||||
@@ -678,4 +678,4 @@ parser_stack_iterator_write (parser_stack_iterator_t *iterator, /**< iterator */
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !JERRY_DISABLE_JS_PARSER */
|
||||
#endif /* ENABLED (JERRY_PARSER) */
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "js-parser-internal.h"
|
||||
#include "lit-char-helpers.h"
|
||||
|
||||
#ifndef JERRY_DISABLE_JS_PARSER
|
||||
#if ENABLED (JERRY_PARSER)
|
||||
|
||||
/** \addtogroup parser Parser
|
||||
* @{
|
||||
@@ -1027,4 +1027,4 @@ parser_scan_until (parser_context_t *context_p, /**< context */
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !JERRY_DISABLE_JS_PARSER */
|
||||
#endif /* ENABLED (JERRY_PARSER) */
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "js-parser-internal.h"
|
||||
|
||||
#ifndef JERRY_DISABLE_JS_PARSER
|
||||
#if ENABLED (JERRY_PARSER)
|
||||
#include "jcontext.h"
|
||||
|
||||
#include "ecma-helpers.h"
|
||||
@@ -344,9 +344,9 @@ parser_parse_var_statement (parser_context_t *context_p) /**< context */
|
||||
JERRY_ASSERT (context_p->token.type == LEXER_LITERAL
|
||||
&& context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
|
||||
|
||||
#if defined (JERRY_DEBUGGER) || defined (JERRY_ENABLE_LINE_INFO)
|
||||
#if defined (JERRY_DEBUGGER) || ENABLED (JERRY_LINE_INFO)
|
||||
parser_line_counter_t ident_line_counter = context_p->token.line;
|
||||
#endif /* JERRY_DEBUGGER || JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* JERRY_DEBUGGER || ENABLED (JERRY_LINE_INFO) */
|
||||
|
||||
context_p->lit_object.literal_p->status_flags |= LEXER_FLAG_VAR;
|
||||
|
||||
@@ -375,12 +375,12 @@ parser_parse_var_statement (parser_context_t *context_p) /**< context */
|
||||
}
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
if (ident_line_counter != context_p->last_line_info_line)
|
||||
{
|
||||
parser_emit_line_info (context_p, ident_line_counter, false);
|
||||
}
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
|
||||
parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);
|
||||
parser_parse_expression (context_p,
|
||||
@@ -1307,9 +1307,9 @@ parser_parse_switch_statement_start (parser_context_t *context_p) /**< context *
|
||||
switch_case_was_found = false;
|
||||
default_case_was_found = false;
|
||||
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
uint32_t last_line_info_line = context_p->last_line_info_line;
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -1365,12 +1365,12 @@ parser_parse_switch_statement_start (parser_context_t *context_p) /**< context *
|
||||
|
||||
lexer_next_token (context_p);
|
||||
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
if (context_p->token.line != context_p->last_line_info_line)
|
||||
{
|
||||
parser_emit_line_info (context_p, context_p->token.line, true);
|
||||
}
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
|
||||
parser_parse_expression (context_p, PARSE_EXPR);
|
||||
|
||||
@@ -1386,9 +1386,9 @@ parser_parse_switch_statement_start (parser_context_t *context_p) /**< context *
|
||||
|
||||
JERRY_ASSERT (switch_case_was_found || default_case_was_found);
|
||||
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
context_p->last_line_info_line = last_line_info_line;
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
|
||||
if (!switch_case_was_found)
|
||||
{
|
||||
@@ -2190,14 +2190,14 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||
}
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
if (JERRY_CONTEXT (resource_name) != ECMA_VALUE_UNDEFINED)
|
||||
{
|
||||
parser_emit_cbc_ext (context_p, CBC_EXT_RESOURCE_NAME);
|
||||
parser_flush_cbc (context_p);
|
||||
}
|
||||
context_p->last_line_info_line = 0;
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
|
||||
while (context_p->token.type == LEXER_LITERAL
|
||||
&& context_p->token.lit_location.type == LEXER_STRING_LITERAL)
|
||||
@@ -2242,9 +2242,9 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||
context_p->last_breakpoint_line = context_p->token.line;
|
||||
}
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
parser_emit_line_info (context_p, context_p->token.line, false);
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
|
||||
lexer_construct_literal_object (context_p, &lit_location, LEXER_STRING_LITERAL);
|
||||
parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);
|
||||
@@ -2254,14 +2254,14 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
if (context_p->is_show_opcodes
|
||||
&& !(status_flags & PARSER_IS_STRICT)
|
||||
&& (context_p->status_flags & PARSER_IS_STRICT))
|
||||
{
|
||||
JERRY_DEBUG_MSG (" Note: switch to strict mode\n\n");
|
||||
}
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
if (context_p->token.type == LEXER_SEMICOLON)
|
||||
{
|
||||
@@ -2313,7 +2313,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||
}
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
if (context_p->token.line != context_p->last_line_info_line
|
||||
&& context_p->token.type != LEXER_SEMICOLON
|
||||
&& context_p->token.type != LEXER_LEFT_BRACE
|
||||
@@ -2325,7 +2325,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||
{
|
||||
parser_emit_line_info (context_p, context_p->token.line, true);
|
||||
}
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
|
||||
switch (context_p->token.type)
|
||||
{
|
||||
@@ -2932,4 +2932,4 @@ parser_free_jumps (parser_stack_iterator_t iterator) /**< iterator position */
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !JERRY_DISABLE_JS_PARSER */
|
||||
#endif /* ENABLED (JERRY_PARSER) */
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
|
||||
#include "js-parser-internal.h"
|
||||
|
||||
#ifndef JERRY_DISABLE_JS_PARSER
|
||||
#if ENABLED (JERRY_PARSER)
|
||||
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
#include "jcontext.h"
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
|
||||
/** \addtogroup parser Parser
|
||||
* @{
|
||||
@@ -171,7 +171,7 @@ parser_flush_cbc (parser_context_t *context_p) /**< context */
|
||||
context_p->byte_code_size++;
|
||||
}
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
if (context_p->is_show_opcodes)
|
||||
{
|
||||
JERRY_DEBUG_MSG (" [%3d] %s",
|
||||
@@ -224,7 +224,7 @@ parser_flush_cbc (parser_context_t *context_p) /**< context */
|
||||
|
||||
JERRY_DEBUG_MSG ("\n");
|
||||
}
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
if (context_p->stack_depth > context_p->stack_limit)
|
||||
{
|
||||
@@ -386,7 +386,7 @@ parser_emit_cbc_push_number (parser_context_t *context_p, /**< context */
|
||||
context_p->last_cbc.value = (uint16_t) (value - 1);
|
||||
} /* parser_emit_cbc_push_number */
|
||||
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
|
||||
/**
|
||||
* Append a line info data
|
||||
@@ -406,12 +406,12 @@ parser_emit_line_info (parser_context_t *context_p, /**< context */
|
||||
parser_flush_cbc (context_p);
|
||||
}
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
if (context_p->is_show_opcodes)
|
||||
{
|
||||
JERRY_DEBUG_MSG (" [%3d] CBC_EXT_LINE %d\n", (int) context_p->stack_depth, line);
|
||||
}
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
parser_emit_two_bytes (context_p, CBC_EXT_OPCODE, CBC_EXT_LINE);
|
||||
context_p->byte_code_size += 2;
|
||||
@@ -443,7 +443,7 @@ parser_emit_line_info (parser_context_t *context_p, /**< context */
|
||||
while (shift > 0);
|
||||
} /* parser_emit_line_info */
|
||||
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
|
||||
/**
|
||||
* Append a byte code with a branch argument
|
||||
@@ -488,14 +488,14 @@ parser_emit_cbc_forward_branch (parser_context_t *context_p, /**< context */
|
||||
|| (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
|
||||
PARSER_PLUS_EQUAL_U16 (context_p->stack_depth, CBC_STACK_ADJUST_VALUE (flags));
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
if (context_p->is_show_opcodes)
|
||||
{
|
||||
JERRY_DEBUG_MSG (" [%3d] %s\n",
|
||||
(int) context_p->stack_depth,
|
||||
extra_byte_code_increase == 0 ? cbc_names[opcode] : cbc_ext_names[opcode]);
|
||||
}
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
#if PARSER_MAXIMUM_CODE_SIZE <= 65535
|
||||
opcode++;
|
||||
@@ -559,9 +559,9 @@ parser_emit_cbc_backward_branch (parser_context_t *context_p, /**< context */
|
||||
uint32_t offset) /**< destination offset */
|
||||
{
|
||||
uint8_t flags;
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
const char *name;
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
if (context_p->last_cbc_opcode != PARSER_CBC_UNAVAILABLE)
|
||||
{
|
||||
@@ -576,9 +576,9 @@ parser_emit_cbc_backward_branch (parser_context_t *context_p, /**< context */
|
||||
JERRY_ASSERT (opcode < CBC_END);
|
||||
flags = cbc_flags[opcode];
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
name = cbc_names[opcode];
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -589,9 +589,9 @@ parser_emit_cbc_backward_branch (parser_context_t *context_p, /**< context */
|
||||
flags = cbc_ext_flags[opcode];
|
||||
context_p->byte_code_size++;
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
name = cbc_ext_names[opcode];
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
}
|
||||
|
||||
JERRY_ASSERT (flags & CBC_HAS_BRANCH_ARG);
|
||||
@@ -604,12 +604,12 @@ parser_emit_cbc_backward_branch (parser_context_t *context_p, /**< context */
|
||||
|| (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
|
||||
PARSER_PLUS_EQUAL_U16 (context_p->stack_depth, CBC_STACK_ADJUST_VALUE (flags));
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
if (context_p->is_show_opcodes)
|
||||
{
|
||||
JERRY_DEBUG_MSG (" [%3d] %s\n", (int) context_p->stack_depth, name);
|
||||
}
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
context_p->byte_code_size += 2;
|
||||
#if PARSER_MAXIMUM_CODE_SIZE <= 65535
|
||||
@@ -737,7 +737,7 @@ parser_set_continues_to_current_position (parser_context_t *context_p, /**< cont
|
||||
}
|
||||
} /* parser_set_continues_to_current_position */
|
||||
|
||||
#ifdef JERRY_ENABLE_ERROR_MESSAGES
|
||||
#if ENABLED (JERRY_ERROR_MESSAGES)
|
||||
/**
|
||||
* Returns with the string representation of the error
|
||||
*/
|
||||
@@ -1125,7 +1125,7 @@ parser_error_to_string (parser_error_t error) /**< error code */
|
||||
}
|
||||
}
|
||||
} /* parser_error_to_string */
|
||||
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
|
||||
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
@@ -1133,4 +1133,4 @@ parser_error_to_string (parser_error_t error) /**< error code */
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !JERRY_DISABLE_JS_PARSER */
|
||||
#endif /* ENABLED (JERRY_PARSER) */
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "jcontext.h"
|
||||
#include "js-parser-internal.h"
|
||||
|
||||
#ifndef JERRY_DISABLE_JS_PARSER
|
||||
#if ENABLED (JERRY_PARSER)
|
||||
|
||||
JERRY_STATIC_ASSERT ((int) ECMA_PARSE_STRICT_MODE == (int) PARSER_IS_STRICT,
|
||||
ecma_parse_strict_mode_must_be_equal_to_parser_is_strict);
|
||||
@@ -173,18 +173,18 @@ parser_compute_indicies (parser_context_t *context_p, /**< context */
|
||||
{
|
||||
if (literal_p->status_flags & LEXER_FLAG_UNUSED_IDENT)
|
||||
{
|
||||
#ifndef PARSER_DUMP_BYTE_CODE
|
||||
#if !ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
if (!(literal_p->status_flags & LEXER_FLAG_SOURCE_PTR))
|
||||
{
|
||||
jmem_heap_free_block ((void *) literal_p->u.char_p, literal_p->prop.length);
|
||||
}
|
||||
#endif /* !PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* !ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
context_p->literal_count--;
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifndef PARSER_DUMP_BYTE_CODE
|
||||
#if !ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
if (literal_p->type == LEXER_IDENT_LITERAL
|
||||
|| literal_p->type == LEXER_STRING_LITERAL)
|
||||
{
|
||||
@@ -218,7 +218,7 @@ parser_compute_indicies (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* !PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* !ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
switch (literal_p->type)
|
||||
{
|
||||
@@ -631,28 +631,26 @@ parser_generate_initializers (parser_context_t *context_p, /**< context */
|
||||
{
|
||||
if (literal_p->prop.index >= register_count)
|
||||
{
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
if (!(literal_p->status_flags & LEXER_FLAG_UNUSED_IDENT))
|
||||
{
|
||||
ecma_value_t lit_value = ecma_find_or_create_literal_string (literal_p->u.char_p,
|
||||
literal_p->prop.length);
|
||||
ecma_value_t lit_value;
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
lit_value = ecma_find_or_create_literal_string (literal_p->u.char_p,
|
||||
literal_p->prop.length);
|
||||
#else /* !ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
lit_value = literal_p->u.value;
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
literal_pool_p[literal_p->prop.index] = lit_value;
|
||||
}
|
||||
#else /* !PARSER_DUMP_BYTE_CODE */
|
||||
if (!(literal_p->status_flags & LEXER_FLAG_UNUSED_IDENT))
|
||||
{
|
||||
literal_pool_p[literal_p->prop.index] = literal_p->u.value;
|
||||
}
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
}
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
if (!context_p->is_show_opcodes
|
||||
&& !(literal_p->status_flags & LEXER_FLAG_SOURCE_PTR))
|
||||
{
|
||||
jmem_heap_free_block ((void *) literal_p->u.char_p, literal_p->prop.length);
|
||||
}
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
}
|
||||
else if ((literal_p->type == LEXER_FUNCTION_LITERAL)
|
||||
|| (literal_p->type == LEXER_REGEXP_LITERAL))
|
||||
@@ -961,7 +959,7 @@ parse_update_branches (parser_context_t *context_p, /**< context */
|
||||
context_p->byte_code.first_p = last_page_p;
|
||||
} /* parse_update_branches */
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
|
||||
/**
|
||||
* Print literal.
|
||||
@@ -1291,7 +1289,7 @@ parse_print_final_cbc (ecma_compiled_code_t *compiled_code_p, /**< compiled code
|
||||
JERRY_DEBUG_MSG (" %3d : %s", (int) cbc_offset, cbc_ext_names[ext_opcode]);
|
||||
byte_code_p += 2;
|
||||
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
if (ext_opcode == CBC_EXT_LINE)
|
||||
{
|
||||
uint32_t value = 0;
|
||||
@@ -1307,7 +1305,7 @@ parse_print_final_cbc (ecma_compiled_code_t *compiled_code_p, /**< compiled code
|
||||
JERRY_DEBUG_MSG (" %d\n", (int) value);
|
||||
continue;
|
||||
}
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
}
|
||||
|
||||
if (flags & (CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2))
|
||||
@@ -1374,7 +1372,7 @@ parse_print_final_cbc (ecma_compiled_code_t *compiled_code_p, /**< compiled code
|
||||
|
||||
#undef PARSER_READ_IDENTIFIER_INDEX
|
||||
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
#ifdef JERRY_DEBUGGER
|
||||
|
||||
@@ -1471,9 +1469,9 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
size_t length;
|
||||
size_t literal_length;
|
||||
size_t total_size;
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
|
||||
#if ENABLED (JERRY_SNAPSHOT_SAVE)
|
||||
size_t total_size_used;
|
||||
#endif
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
|
||||
size_t initializers_length;
|
||||
uint8_t real_offset;
|
||||
uint8_t *byte_code_p;
|
||||
@@ -1571,7 +1569,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
if (ext_opcode == CBC_EXT_LINE)
|
||||
{
|
||||
uint8_t last_byte = 0;
|
||||
@@ -1586,7 +1584,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
|
||||
continue;
|
||||
}
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
}
|
||||
|
||||
while (flags & (CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2))
|
||||
@@ -1738,31 +1736,31 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
total_size += context_p->argument_count * sizeof (ecma_value_t);
|
||||
}
|
||||
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
if (JERRY_CONTEXT (resource_name) != ECMA_VALUE_UNDEFINED)
|
||||
{
|
||||
total_size += sizeof (ecma_value_t);
|
||||
}
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
|
||||
#if ENABLED (JERRY_SNAPSHOT_SAVE)
|
||||
total_size_used = total_size;
|
||||
#endif
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
|
||||
total_size = JERRY_ALIGNUP (total_size, JMEM_ALIGNMENT);
|
||||
|
||||
compiled_code_p = (ecma_compiled_code_t *) parser_malloc (context_p, total_size);
|
||||
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
|
||||
#if ENABLED (JERRY_SNAPSHOT_SAVE)
|
||||
// Avoid getting junk bytes at the end when bytes at the end remain unused:
|
||||
if (total_size_used < total_size)
|
||||
{
|
||||
memset (((uint8_t *) compiled_code_p) + total_size_used, 0, total_size - total_size_used);
|
||||
}
|
||||
#endif
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
|
||||
|
||||
#ifdef JMEM_STATS
|
||||
#if ENABLED (JERRY_MEM_STATS)
|
||||
jmem_stats_allocate_byte_code_bytes (total_size);
|
||||
#endif /* JMEM_STATS */
|
||||
#endif /* ENABLED (JERRY_MEM_STATS) */
|
||||
|
||||
byte_code_p = (uint8_t *) compiled_code_p;
|
||||
compiled_code_p->size = (uint16_t) (total_size >> JMEM_ALIGNMENT_LOG);
|
||||
@@ -1925,7 +1923,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
real_offset++;
|
||||
PARSER_NEXT_BYTE_UPDATE (page_p, offset, real_offset);
|
||||
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
if (ext_opcode == CBC_EXT_LINE)
|
||||
{
|
||||
uint8_t last_byte = 0;
|
||||
@@ -1942,7 +1940,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
|
||||
continue;
|
||||
}
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
}
|
||||
|
||||
if (flags & CBC_HAS_BRANCH_ARG)
|
||||
@@ -2045,7 +2043,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
|
||||
parser_cbc_stream_free (&context_p->byte_code);
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
if (context_p->is_show_opcodes)
|
||||
{
|
||||
parser_list_iterator_t literal_iterator;
|
||||
@@ -2065,7 +2063,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
}
|
||||
}
|
||||
}
|
||||
#else /* !PARSER_DUMP_BYTE_CODE */
|
||||
#else /* !ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
if (context_p->status_flags & PARSER_HAS_LATE_LIT_INIT)
|
||||
{
|
||||
parser_list_iterator_t literal_iterator;
|
||||
@@ -2086,7 +2084,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
if ((context_p->status_flags & PARSER_ARGUMENTS_NEEDED)
|
||||
&& !(context_p->status_flags & PARSER_IS_STRICT))
|
||||
@@ -2135,7 +2133,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
if (JERRY_CONTEXT (resource_name) != ECMA_VALUE_UNDEFINED)
|
||||
{
|
||||
ecma_value_t *resource_name_p = (ecma_value_t *) (((uint8_t *) compiled_code_p) + total_size);
|
||||
@@ -2148,7 +2146,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
|
||||
resource_name_p[-1] = JERRY_CONTEXT (resource_name);
|
||||
}
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
|
||||
#ifdef JERRY_DEBUGGER
|
||||
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
|
||||
@@ -2427,7 +2425,7 @@ parser_parse_source (const uint8_t *arg_list_p, /**< function argument list */
|
||||
context.context_stack_depth = 0;
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
context.is_show_opcodes = (JERRY_CONTEXT (jerry_init_flags) & ECMA_INIT_SHOW_OPCODES);
|
||||
context.total_byte_code_size = 0;
|
||||
|
||||
@@ -2437,7 +2435,7 @@ parser_parse_source (const uint8_t *arg_list_p, /**< function argument list */
|
||||
(arg_list_p == NULL) ? "Script"
|
||||
: "Function");
|
||||
}
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
#ifdef JERRY_DEBUGGER
|
||||
context.breakpoint_info_count = 0;
|
||||
@@ -2482,7 +2480,7 @@ parser_parse_source (const uint8_t *arg_list_p, /**< function argument list */
|
||||
compiled_code_p = parser_post_processing (&context);
|
||||
parser_list_free (&context.literal_pool);
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
if (context.is_show_opcodes)
|
||||
{
|
||||
JERRY_DEBUG_MSG ("\n%s parsing successfully completed. Total byte code size: %d bytes\n",
|
||||
@@ -2490,7 +2488,7 @@ parser_parse_source (const uint8_t *arg_list_p, /**< function argument list */
|
||||
: "Function",
|
||||
(int) context.total_byte_code_size);
|
||||
}
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
}
|
||||
PARSER_CATCH
|
||||
{
|
||||
@@ -2526,14 +2524,14 @@ parser_parse_source (const uint8_t *arg_list_p, /**< function argument list */
|
||||
}
|
||||
PARSER_TRY_END
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
if (context.is_show_opcodes)
|
||||
{
|
||||
JERRY_DEBUG_MSG ("\n--- %s parsing end ---\n\n",
|
||||
(arg_list_p == NULL) ? "Script"
|
||||
: "Function");
|
||||
}
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
parser_stack_free (&context);
|
||||
|
||||
@@ -2647,7 +2645,7 @@ parser_parse_function (parser_context_t *context_p, /**< context */
|
||||
parser_save_context (context_p, &saved_context);
|
||||
context_p->status_flags |= status_flags;
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
if (context_p->is_show_opcodes)
|
||||
{
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
@@ -2658,7 +2656,7 @@ parser_parse_function (parser_context_t *context_p, /**< context */
|
||||
JERRY_DEBUG_MSG ("\n--- Function parsing start ---\n\n");
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
}
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
#ifdef JERRY_DEBUGGER
|
||||
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
|
||||
@@ -2694,13 +2692,13 @@ parser_parse_function (parser_context_t *context_p, /**< context */
|
||||
parser_raise_error (context_p, PARSER_ERR_ONE_ARGUMENT_EXPECTED);
|
||||
}
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
if (context_p->is_show_opcodes
|
||||
&& (context_p->status_flags & PARSER_HAS_NON_STRICT_ARG))
|
||||
{
|
||||
JERRY_DEBUG_MSG (" Note: legacy (non-strict) argument definition\n\n");
|
||||
}
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
if (context_p->token.type != LEXER_LEFT_BRACE)
|
||||
{
|
||||
@@ -2718,7 +2716,7 @@ parser_parse_function (parser_context_t *context_p, /**< context */
|
||||
parser_parse_statements (context_p);
|
||||
compiled_code_p = parser_post_processing (context_p);
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
if (context_p->is_show_opcodes)
|
||||
{
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
@@ -2729,7 +2727,7 @@ parser_parse_function (parser_context_t *context_p, /**< context */
|
||||
JERRY_DEBUG_MSG ("\n--- Function parsing end ---\n\n");
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
}
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
parser_restore_context (context_p, &saved_context);
|
||||
|
||||
@@ -2758,12 +2756,12 @@ parser_parse_arrow_function (parser_context_t *context_p, /**< context */
|
||||
context_p->status_flags |= saved_context.status_flags & PARSER_CLASS_HAS_SUPER;
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
if (context_p->is_show_opcodes)
|
||||
{
|
||||
JERRY_DEBUG_MSG ("\n--- Arrow function parsing start ---\n\n");
|
||||
}
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
#ifdef JERRY_DEBUGGER
|
||||
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
|
||||
@@ -2842,12 +2840,12 @@ parser_parse_arrow_function (parser_context_t *context_p, /**< context */
|
||||
|
||||
compiled_code_p = parser_post_processing (context_p);
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
if (context_p->is_show_opcodes)
|
||||
{
|
||||
JERRY_DEBUG_MSG ("\n--- Arrow function parsing end ---\n\n");
|
||||
}
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
|
||||
parser_restore_context (context_p, &saved_context);
|
||||
|
||||
@@ -2891,7 +2889,7 @@ parser_raise_error (parser_context_t *context_p, /**< context */
|
||||
JERRY_ASSERT (0);
|
||||
} /* parser_raise_error */
|
||||
|
||||
#endif /* !JERRY_DISABLE_JS_PARSER */
|
||||
#endif /* ENABLED (JERRY_PARSER) */
|
||||
|
||||
/**
|
||||
* Parse EcmaScript source code
|
||||
@@ -2911,7 +2909,7 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
|
||||
uint32_t parse_opts, /**< ecma_parse_opts_t option bits */
|
||||
ecma_compiled_code_t **bytecode_data_p) /**< [out] JS bytecode */
|
||||
{
|
||||
#ifndef JERRY_DISABLE_JS_PARSER
|
||||
#if ENABLED (JERRY_PARSER)
|
||||
parser_error_location_t parser_error;
|
||||
|
||||
#ifdef JERRY_DEBUGGER
|
||||
@@ -2954,7 +2952,7 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
|
||||
JERRY_CONTEXT (status_flags) |= ECMA_STATUS_EXCEPTION;
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
#ifdef JERRY_ENABLE_ERROR_MESSAGES
|
||||
#if ENABLED (JERRY_ERROR_MESSAGES)
|
||||
const lit_utf8_byte_t *err_bytes_p = (const lit_utf8_byte_t *) parser_error_to_string (parser_error.error);
|
||||
lit_utf8_size_t err_bytes_size = lit_zt_utf8_string_size (err_bytes_p);
|
||||
|
||||
@@ -2974,9 +2972,9 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
|
||||
ecma_free_value (err_str_val);
|
||||
|
||||
return error_value;
|
||||
#else /* !JERRY_ENABLE_ERROR_MESSAGES */
|
||||
#else /* !ENABLED (JERRY_ERROR_MESSAGES) */
|
||||
return ecma_raise_syntax_error ("");
|
||||
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
|
||||
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ES2015_MODULE_SYSTEM)
|
||||
@@ -3017,7 +3015,7 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
return ECMA_VALUE_TRUE;
|
||||
#else /* JERRY_DISABLE_JS_PARSER */
|
||||
#else /* !ENABLED (JERRY_PARSER) */
|
||||
JERRY_UNUSED (arg_list_p);
|
||||
JERRY_UNUSED (arg_list_size);
|
||||
JERRY_UNUSED (source_p);
|
||||
@@ -3026,7 +3024,7 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
|
||||
JERRY_UNUSED (bytecode_data_p);
|
||||
|
||||
return ecma_raise_syntax_error (ECMA_ERR_MSG ("The parser has been disabled."));
|
||||
#endif /* !JERRY_DISABLE_JS_PARSER */
|
||||
#endif /* ENABLED (JERRY_PARSER) */
|
||||
} /* parser_parse_script */
|
||||
|
||||
/**
|
||||
|
||||
@@ -169,9 +169,9 @@ ecma_value_t parser_parse_script (const uint8_t *arg_list_p, size_t arg_list_siz
|
||||
const uint8_t *source_p, size_t source_size,
|
||||
uint32_t parse_opts, ecma_compiled_code_t **bytecode_data_p);
|
||||
|
||||
#ifdef JERRY_ENABLE_ERROR_MESSAGES
|
||||
#if ENABLED (JERRY_ERROR_MESSAGES)
|
||||
const char *parser_error_to_string (parser_error_t);
|
||||
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
|
||||
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -233,7 +233,7 @@ re_insert_u32 (re_bytecode_ctx_t *bc_ctx_p, /**< RegExp bytecode context */
|
||||
re_bytecode_list_insert (bc_ctx_p, offset, (uint8_t *) &value, sizeof (uint32_t));
|
||||
} /* re_insert_u32 */
|
||||
|
||||
#ifdef REGEXP_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE)
|
||||
/**
|
||||
* RegExp bytecode dumper
|
||||
*/
|
||||
@@ -435,7 +435,7 @@ re_dump_bytecode (re_bytecode_ctx_t *bc_ctx_p) /**< RegExp bytecode context */
|
||||
}
|
||||
JERRY_DEBUG_MSG ("EOF\n");
|
||||
} /* re_dump_bytecode */
|
||||
#endif /* REGEXP_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -114,9 +114,9 @@ void re_insert_opcode (re_bytecode_ctx_t *bc_ctx_p, uint32_t offset, re_opcode_t
|
||||
void re_insert_u32 (re_bytecode_ctx_t *bc_ctx_p, uint32_t offset, uint32_t value);
|
||||
void re_bytecode_list_insert (re_bytecode_ctx_t *bc_ctx_p, size_t offset, uint8_t *bytecode_p, size_t length);
|
||||
|
||||
#ifdef REGEXP_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE)
|
||||
void re_dump_bytecode (re_bytecode_ctx_t *bc_ctx);
|
||||
#endif /* REGEXP_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -629,12 +629,12 @@ re_compile_bytecode (const re_compiled_code_t **out_bytecode_p, /**< [out] point
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef REGEXP_DUMP_BYTE_CODE
|
||||
#if ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE)
|
||||
if (JERRY_CONTEXT (jerry_init_flags) & ECMA_INIT_SHOW_REGEXP_OPCODES)
|
||||
{
|
||||
re_dump_bytecode (&bc_ctx);
|
||||
}
|
||||
#endif /* REGEXP_DUMP_BYTE_CODE */
|
||||
#endif /* ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE) */
|
||||
|
||||
/* The RegExp bytecode contains at least a RE_OP_SAVE_AT_START opdoce, so it cannot be NULL. */
|
||||
JERRY_ASSERT (bc_ctx.block_start_p != NULL);
|
||||
|
||||
@@ -41,9 +41,9 @@ typedef struct
|
||||
uint32_t num_of_captures; /**< number of capture groups */
|
||||
uint32_t num_of_non_captures; /**< number of non-capture groups */
|
||||
uint32_t highest_backref; /**< highest backreference */
|
||||
#ifdef REGEXP_RECURSION_LIMIT
|
||||
#if defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT != 0)
|
||||
uint32_t recursion_counter; /**< RegExp recursion counter */
|
||||
#endif /* REGEXP_RECURSION_LIMIT */
|
||||
#endif /* defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT != 0) */
|
||||
re_bytecode_ctx_t *bytecode_ctx_p; /**< pointer of RegExp bytecode context */
|
||||
re_token_t current_token; /**< current token */
|
||||
re_parser_ctx_t *parser_ctx_p; /**< pointer of RegExp parser context */
|
||||
|
||||
Reference in New Issue
Block a user