Unifiy the comments of preprocessor conditionals
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
@@ -35,12 +35,12 @@
|
||||
|
||||
#ifndef JERRY_NDEBUG
|
||||
#define PARSER_DEBUG
|
||||
#endif
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
|
||||
#ifndef JERRY_NDEBUG
|
||||
/* Note: This flag is independent from debug mode. */
|
||||
#define PARSER_DUMP_BYTE_CODE
|
||||
#endif
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-regexp-object.h"
|
||||
@@ -98,9 +98,9 @@ typedef struct
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
struct
|
||||
#else
|
||||
#else /* !PARSER_DUMP_BYTE_CODE */
|
||||
union
|
||||
#endif
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
{
|
||||
uint16_t length; /**< length of ident / string literal */
|
||||
uint16_t index; /**< real index during post processing */
|
||||
|
||||
@@ -1836,7 +1836,7 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
|
||||
context_p->lit_object.literal_p = literal_p;
|
||||
context_p->lit_object.index = (uint16_t) (context_p->literal_count - 1);
|
||||
context_p->lit_object.type = LEXER_LITERAL_OBJECT_ANY;
|
||||
#else
|
||||
#else /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN */
|
||||
(void) parse_only;
|
||||
parser_raise_error (context_p, PARSER_ERR_UNSUPPORTED_REGEXP);
|
||||
#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN */
|
||||
|
||||
@@ -224,7 +224,7 @@ typedef struct parser_saved_context_t
|
||||
|
||||
#ifdef PARSER_DEBUG
|
||||
uint16_t context_stack_depth; /**< current context stack depth */
|
||||
#endif
|
||||
#endif /* PARSER_DEBUG */
|
||||
} parser_saved_context_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,31 +31,31 @@
|
||||
* Limit: LEXER_MAX_STRING_LENGTH. */
|
||||
#ifndef PARSER_MAXIMUM_IDENT_LENGTH
|
||||
#define PARSER_MAXIMUM_IDENT_LENGTH 255
|
||||
#endif /* PARSER_MAXIMUM_IDENT_LENGTH */
|
||||
#endif /* !PARSER_MAXIMUM_IDENT_LENGTH */
|
||||
|
||||
/* Maximum string length.
|
||||
* Limit: 65535. */
|
||||
#ifndef PARSER_MAXIMUM_STRING_LENGTH
|
||||
#define PARSER_MAXIMUM_STRING_LENGTH 65535
|
||||
#endif /* PARSER_MAXIMUM_STRING_LENGTH */
|
||||
#endif /* !PARSER_MAXIMUM_STRING_LENGTH */
|
||||
|
||||
/* Maximum number of literals.
|
||||
* Limit: 32767. Recommended: 510, 32767 */
|
||||
#ifndef PARSER_MAXIMUM_NUMBER_OF_LITERALS
|
||||
#define PARSER_MAXIMUM_NUMBER_OF_LITERALS 32767
|
||||
#endif /* PARSER_MAXIMUM_NUMBER_OF_LITERALS */
|
||||
#endif /* !PARSER_MAXIMUM_NUMBER_OF_LITERALS */
|
||||
|
||||
/* Maximum number of registers.
|
||||
* Limit: PARSER_MAXIMUM_NUMBER_OF_LITERALS */
|
||||
#ifndef PARSER_MAXIMUM_NUMBER_OF_REGISTERS
|
||||
#define PARSER_MAXIMUM_NUMBER_OF_REGISTERS 256
|
||||
#endif
|
||||
#endif /* !PARSER_MAXIMUM_NUMBER_OF_REGISTERS */
|
||||
|
||||
/* Maximum code size.
|
||||
* Limit: 16777215. Recommended: 65535, 16777215. */
|
||||
#ifndef PARSER_MAXIMUM_CODE_SIZE
|
||||
#define PARSER_MAXIMUM_CODE_SIZE (65535 << (MEM_ALIGNMENT_LOG))
|
||||
#endif
|
||||
#endif /* !PARSER_MAXIMUM_CODE_SIZE */
|
||||
|
||||
/* Maximum number of values pushed onto the stack by a function.
|
||||
* Limit: 65500. Recommended: 1024. */
|
||||
|
||||
@@ -496,7 +496,7 @@ parser_parse_with_statement_start (parser_context_t *context_p) /**< context */
|
||||
|
||||
#ifdef PARSER_DEBUG
|
||||
PARSER_PLUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_WITH_CONTEXT_STACK_ALLOCATION);
|
||||
#endif
|
||||
#endif /* PARSER_DEBUG */
|
||||
|
||||
context_p->status_flags |= PARSER_INSIDE_WITH | PARSER_LEXICAL_ENV_NEEDED;
|
||||
parser_emit_cbc_ext_forward_branch (context_p,
|
||||
@@ -527,7 +527,7 @@ parser_parse_with_statement_end (parser_context_t *context_p) /**< context */
|
||||
PARSER_MINUS_EQUAL_U16 (context_p->stack_depth, PARSER_WITH_CONTEXT_STACK_ALLOCATION);
|
||||
#ifdef PARSER_DEBUG
|
||||
PARSER_MINUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_WITH_CONTEXT_STACK_ALLOCATION);
|
||||
#endif
|
||||
#endif /* PARSER_DEBUG */
|
||||
|
||||
parser_emit_cbc (context_p, CBC_CONTEXT_END);
|
||||
parser_set_branch_to_current_position (context_p, &with_statement.branch);
|
||||
@@ -722,7 +722,7 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */
|
||||
|
||||
#ifdef PARSER_DEBUG
|
||||
PARSER_PLUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION);
|
||||
#endif
|
||||
#endif /* PARSER_DEBUG */
|
||||
|
||||
parser_emit_cbc_ext_forward_branch (context_p,
|
||||
CBC_EXT_FOR_IN_CREATE_CONTEXT,
|
||||
@@ -1122,7 +1122,7 @@ parser_parse_try_statement_end (parser_context_t *context_p) /**< context */
|
||||
PARSER_MINUS_EQUAL_U16 (context_p->stack_depth, PARSER_TRY_CONTEXT_STACK_ALLOCATION);
|
||||
#ifdef PARSER_DEBUG
|
||||
PARSER_MINUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_TRY_CONTEXT_STACK_ALLOCATION);
|
||||
#endif
|
||||
#endif /* PARSER_DEBUG */
|
||||
|
||||
parser_emit_cbc (context_p, CBC_CONTEXT_END);
|
||||
parser_set_branch_to_current_position (context_p, &try_statement.branch);
|
||||
@@ -1139,7 +1139,7 @@ parser_parse_try_statement_end (parser_context_t *context_p) /**< context */
|
||||
PARSER_MINUS_EQUAL_U16 (context_p->stack_depth, PARSER_TRY_CONTEXT_STACK_ALLOCATION);
|
||||
#ifdef PARSER_DEBUG
|
||||
PARSER_MINUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_TRY_CONTEXT_STACK_ALLOCATION);
|
||||
#endif
|
||||
#endif /* PARSER_DEBUG */
|
||||
|
||||
parser_emit_cbc (context_p, CBC_CONTEXT_END);
|
||||
parser_flush_cbc (context_p);
|
||||
@@ -1565,7 +1565,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||
uint32_t status_flags = context_p->status_flags;
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
int switch_to_strict_mode = PARSER_FALSE;
|
||||
#endif
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
|
||||
JERRY_ASSERT (context_p->stack_depth == 0);
|
||||
|
||||
@@ -1579,7 +1579,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
switch_to_strict_mode = PARSER_TRUE;
|
||||
#endif
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
}
|
||||
|
||||
lexer_next_token (context_p);
|
||||
@@ -1643,7 +1643,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||
{
|
||||
#ifdef PARSER_DEBUG
|
||||
JERRY_ASSERT (context_p->stack_depth == context_p->context_stack_depth);
|
||||
#endif
|
||||
#endif /* PARSER_DEBUG */
|
||||
|
||||
switch (context_p->token.type)
|
||||
{
|
||||
@@ -1749,7 +1749,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||
|
||||
#ifdef PARSER_DEBUG
|
||||
PARSER_PLUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_TRY_CONTEXT_STACK_ALLOCATION);
|
||||
#endif
|
||||
#endif /* PARSER_DEBUG */
|
||||
|
||||
try_statement.type = parser_try_block;
|
||||
parser_emit_cbc_ext_forward_branch (context_p,
|
||||
@@ -1924,7 +1924,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||
JERRY_ASSERT (context_p->stack_depth == 0);
|
||||
#ifdef PARSER_DEBUG
|
||||
JERRY_ASSERT (context_p->context_stack_depth == 0);
|
||||
#endif
|
||||
#endif /* PARSER_DEBUG */
|
||||
/* There is no lexer_next_token here, since the
|
||||
* next token belongs to the parent context. */
|
||||
return;
|
||||
@@ -2017,7 +2017,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||
PARSER_MINUS_EQUAL_U16 (context_p->stack_depth, PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION);
|
||||
#ifdef PARSER_DEBUG
|
||||
PARSER_MINUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION);
|
||||
#endif
|
||||
#endif /* PARSER_DEBUG */
|
||||
|
||||
parser_emit_cbc_ext_backward_branch (context_p,
|
||||
CBC_EXT_BRANCH_IF_FOR_IN_HAS_NEXT,
|
||||
@@ -2046,7 +2046,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||
JERRY_ASSERT (context_p->stack_depth == 0);
|
||||
#ifdef PARSER_DEBUG
|
||||
JERRY_ASSERT (context_p->context_stack_depth == 0);
|
||||
#endif
|
||||
#endif /* PARSER_DEBUG */
|
||||
|
||||
parser_stack_pop_uint8 (context_p);
|
||||
context_p->last_statement.current_p = NULL;
|
||||
|
||||
@@ -407,7 +407,7 @@ parser_emit_cbc_forward_branch (parser_context_t *context_p, /**< context */
|
||||
|
||||
#if PARSER_MAXIMUM_CODE_SIZE <= 65535
|
||||
opcode++;
|
||||
#else /* PARSER_MAXIMUM_CODE_SIZE <= 65535 */
|
||||
#else /* PARSER_MAXIMUM_CODE_SIZE > 65535 */
|
||||
PARSER_PLUS_EQUAL_U16 (opcode, 2);
|
||||
#endif /* PARSER_MAXIMUM_CODE_SIZE <= 65535 */
|
||||
|
||||
@@ -420,7 +420,7 @@ parser_emit_cbc_forward_branch (parser_context_t *context_p, /**< context */
|
||||
#if PARSER_MAXIMUM_CODE_SIZE <= 65535
|
||||
PARSER_APPEND_TO_BYTE_CODE (context_p, 0);
|
||||
context_p->byte_code_size += 3;
|
||||
#else /* PARSER_MAXIMUM_CODE_SIZE <= 65535 */
|
||||
#else /* PARSER_MAXIMUM_CODE_SIZE > 65535 */
|
||||
parser_emit_two_bytes (context_p, 0, 0);
|
||||
context_p->byte_code_size += 4;
|
||||
#endif /* PARSER_MAXIMUM_CODE_SIZE <= 65535 */
|
||||
@@ -522,7 +522,7 @@ parser_emit_cbc_backward_branch (parser_context_t *context_p, /**< context */
|
||||
opcode++;
|
||||
context_p->byte_code_size++;
|
||||
}
|
||||
#else /* PARSER_MAXIMUM_CODE_SIZE <= 65535 */
|
||||
#else /* PARSER_MAXIMUM_CODE_SIZE > 65535 */
|
||||
if (offset > 65535)
|
||||
{
|
||||
PARSER_PLUS_EQUAL_U16 (opcode, 2);
|
||||
@@ -587,7 +587,7 @@ parser_set_branch_to_current_position (parser_context_t *context_p, /**< context
|
||||
page_p = page_p->next_p;
|
||||
offset = 0;
|
||||
}
|
||||
#else
|
||||
#else /* PARSER_MAXIMUM_CODE_SIZE > 65535 */
|
||||
page_p->bytes[offset++] = (uint8_t) (delta >> 16);
|
||||
if (offset >= PARSER_CBC_STREAM_PAGE_SIZE)
|
||||
{
|
||||
@@ -600,7 +600,7 @@ parser_set_branch_to_current_position (parser_context_t *context_p, /**< context
|
||||
page_p = page_p->next_p;
|
||||
offset = 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* PARSER_MAXIMUM_CODE_SIZE <= 65535 */
|
||||
page_p->bytes[offset++] = delta & 0xff;
|
||||
} /* parser_set_branch_to_current_position */
|
||||
|
||||
|
||||
@@ -529,7 +529,7 @@ parser_generate_initializers (parser_context_t *context_p, /**< context */
|
||||
{
|
||||
mem_heap_free_block_size_stored ((void *) literal_p->u.char_p);
|
||||
}
|
||||
#else /* PARSER_DUMP_BYTE_CODE */
|
||||
#else /* !PARSER_DUMP_BYTE_CODE */
|
||||
literal_pool_p[literal_p->prop.index] = literal_p->u.value;
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
}
|
||||
@@ -1395,7 +1395,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
int prefix_zero = PARSER_TRUE;
|
||||
#if PARSER_MAXIMUM_CODE_SIZE <= 65535
|
||||
cbc_opcode_t jump_forward = CBC_JUMP_FORWARD_2;
|
||||
#else /* PARSER_MAXIMUM_CODE_SIZE <= 65535 */
|
||||
#else /* PARSER_MAXIMUM_CODE_SIZE > 65535 */
|
||||
cbc_opcode_t jump_forward = CBC_JUMP_FORWARD_3;
|
||||
#endif /* PARSER_MAXIMUM_CODE_SIZE <= 65535 */
|
||||
|
||||
@@ -1554,7 +1554,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
/* These opcodes are deleted from the stream. */
|
||||
#if PARSER_MAXIMUM_CODE_SIZE <= 65535
|
||||
size_t length = 3;
|
||||
#else /* PARSER_MAXIMUM_CODE_SIZE <= 65535 */
|
||||
#else /* PARSER_MAXIMUM_CODE_SIZE > 65535 */
|
||||
size_t length = 4;
|
||||
#endif /* PARSER_MAXIMUM_CODE_SIZE <= 65535 */
|
||||
|
||||
@@ -1699,7 +1699,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#else /* !PARSER_DUMP_BYTE_CODE */
|
||||
if (context_p->status_flags & PARSER_HAS_LATE_LIT_INIT)
|
||||
{
|
||||
parser_list_iterator_t literal_iterator;
|
||||
@@ -1966,7 +1966,7 @@ parser_parse_function (parser_context_t *context_p, /**< context */
|
||||
|
||||
#ifdef PARSER_DEBUG
|
||||
saved_context.context_stack_depth = context_p->context_stack_depth;
|
||||
#endif
|
||||
#endif /* PARSER_DEBUG */
|
||||
|
||||
/* Reset private part of the context. */
|
||||
|
||||
@@ -2183,7 +2183,7 @@ parser_parse_function (parser_context_t *context_p, /**< context */
|
||||
|
||||
#ifdef PARSER_DEBUG
|
||||
context_p->context_stack_depth = saved_context.context_stack_depth;
|
||||
#endif
|
||||
#endif /* PARSER_DEBUG */
|
||||
|
||||
return compiled_code_p;
|
||||
} /* parser_parse_function */
|
||||
@@ -2231,7 +2231,7 @@ parser_set_show_instrs (int show_instrs) /**< flag indicating whether to dump by
|
||||
{
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
parser_show_instrs = show_instrs;
|
||||
#else
|
||||
#else /* !PARSER_DUMP_BYTE_CODE */
|
||||
(void) show_instrs;
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
} /* parser_set_show_instrs */
|
||||
|
||||
@@ -117,7 +117,7 @@ void re_bytecode_list_insert (re_bytecode_ctx_t *, size_t, uint8_t *, size_t);
|
||||
|
||||
#ifdef JERRY_ENABLE_LOG
|
||||
void re_dump_bytecode (re_bytecode_ctx_t *bc_ctx);
|
||||
#endif
|
||||
#endif /* JERRY_ENABLE_LOG */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -604,7 +604,7 @@ re_compile_bytecode (const re_compiled_code_t **out_bytecode_p, /**< [out] point
|
||||
{
|
||||
#ifdef JERRY_ENABLE_LOG
|
||||
re_dump_bytecode (&bc_ctx);
|
||||
#endif
|
||||
#endif /* JERRY_ENABLE_LOG */
|
||||
|
||||
/* 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);
|
||||
|
||||
Reference in New Issue
Block a user