Follow-up refactoring of logging-related parts
This patch: * Ensures that all calls to `jerry_port_log` in jerry-core happen via macros defined in jrt.h. Also, it unifies the names of those macros: as `JERRY_ERROR_MSG` and `JERRY_WARNING_MSG` gave a good pattern that was well aligned with the naming scheme of the log level enum, `JERRY_DLOG` and `JERRY_DDLOG` were rewritten to `JERRY_DEBUG_MSG` and `JERRY_TRACE_MSG`. * Ensures that all debug logging code parts of jerry-core (i.e., memory statistics, JS byte-code dumps, and RegExp byte-code dumps) are guarded by macros: `JMEM_STATS`, `PARSER_DUMP_BYTE_CODE`, and `REGEXP_DUMP_BYTE_CODE`, which in turn are controled by cmake build system feature flags `FEATURE_MEM_STATS`, `FEATURE_PARSER_DUMP`, and `FEATURE_REGEXP_DUMP`. * Ensures that all debug logging functionalities can be controled during run time (provided that they were enabled during build time): the engine has `JERRY_INIT_MEM_STATS[_SEPARATE]`, `JERRY_INIT_SHOW_OPCODES`, `JERRY_INIT_SHOW_REGEXP_OPCODES` init flags, and the default unix/linux command line app has corresponding command line switches.` * Drops `FEATURE_LOG`, `JERRY_ENABLE_LOG`, and `JERRY_INIT_ENABLE_LOG`, as their name was misleadingly general, even though they mostly controled the regexp engine only. The above-mentioned `*REGEXP*` things mostly act as their replacements. * Updates build, test, and measurement tool scripts, and documentation. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
@@ -232,7 +232,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 JERRY_ENABLE_LOG
|
||||
#ifdef REGEXP_DUMP_BYTE_CODE
|
||||
/**
|
||||
* RegExp bytecode dumper
|
||||
*/
|
||||
@@ -240,9 +240,9 @@ void
|
||||
re_dump_bytecode (re_bytecode_ctx_t *bc_ctx_p) /**< RegExp bytecode context */
|
||||
{
|
||||
re_compiled_code_t *compiled_code_p = (re_compiled_code_t *) bc_ctx_p->block_start_p;
|
||||
JERRY_DLOG ("%d ", compiled_code_p->header.status_flags);
|
||||
JERRY_DLOG ("%d ", compiled_code_p->num_of_captures);
|
||||
JERRY_DLOG ("%d | ", compiled_code_p->num_of_non_captures);
|
||||
JERRY_DEBUG_MSG ("%d ", compiled_code_p->header.status_flags);
|
||||
JERRY_DEBUG_MSG ("%d ", compiled_code_p->num_of_captures);
|
||||
JERRY_DEBUG_MSG ("%d | ", compiled_code_p->num_of_non_captures);
|
||||
|
||||
uint8_t *bytecode_p = (uint8_t *) (compiled_code_p + 1);
|
||||
|
||||
@@ -253,188 +253,188 @@ re_dump_bytecode (re_bytecode_ctx_t *bc_ctx_p) /**< RegExp bytecode context */
|
||||
{
|
||||
case RE_OP_MATCH:
|
||||
{
|
||||
JERRY_DLOG ("MATCH, ");
|
||||
JERRY_DEBUG_MSG ("MATCH, ");
|
||||
break;
|
||||
}
|
||||
case RE_OP_CHAR:
|
||||
{
|
||||
JERRY_DLOG ("CHAR ");
|
||||
JERRY_DLOG ("%c, ", (char) re_get_char (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("CHAR ");
|
||||
JERRY_DEBUG_MSG ("%c, ", (char) re_get_char (&bytecode_p));
|
||||
break;
|
||||
}
|
||||
case RE_OP_CAPTURE_NON_GREEDY_ZERO_GROUP_START:
|
||||
{
|
||||
JERRY_DLOG ("N");
|
||||
JERRY_DEBUG_MSG ("N");
|
||||
/* FALLTHRU */
|
||||
}
|
||||
case RE_OP_CAPTURE_GREEDY_ZERO_GROUP_START:
|
||||
{
|
||||
JERRY_DLOG ("GZ_START ");
|
||||
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("GZ_START ");
|
||||
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
|
||||
break;
|
||||
}
|
||||
case RE_OP_CAPTURE_GROUP_START:
|
||||
{
|
||||
JERRY_DLOG ("START ");
|
||||
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("START ");
|
||||
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
|
||||
break;
|
||||
}
|
||||
case RE_OP_CAPTURE_NON_GREEDY_GROUP_END:
|
||||
{
|
||||
JERRY_DLOG ("N");
|
||||
JERRY_DEBUG_MSG ("N");
|
||||
/* FALLTHRU */
|
||||
}
|
||||
case RE_OP_CAPTURE_GREEDY_GROUP_END:
|
||||
{
|
||||
JERRY_DLOG ("G_END ");
|
||||
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("G_END ");
|
||||
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
|
||||
break;
|
||||
}
|
||||
case RE_OP_NON_CAPTURE_NON_GREEDY_ZERO_GROUP_START:
|
||||
{
|
||||
JERRY_DLOG ("N");
|
||||
JERRY_DEBUG_MSG ("N");
|
||||
/* FALLTHRU */
|
||||
}
|
||||
case RE_OP_NON_CAPTURE_GREEDY_ZERO_GROUP_START:
|
||||
{
|
||||
JERRY_DLOG ("GZ_NC_START ");
|
||||
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("GZ_NC_START ");
|
||||
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
|
||||
break;
|
||||
}
|
||||
case RE_OP_NON_CAPTURE_GROUP_START:
|
||||
{
|
||||
JERRY_DLOG ("NC_START ");
|
||||
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("NC_START ");
|
||||
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
|
||||
break;
|
||||
}
|
||||
case RE_OP_NON_CAPTURE_NON_GREEDY_GROUP_END:
|
||||
{
|
||||
JERRY_DLOG ("N");
|
||||
JERRY_DEBUG_MSG ("N");
|
||||
/* FALLTHRU */
|
||||
}
|
||||
case RE_OP_NON_CAPTURE_GREEDY_GROUP_END:
|
||||
{
|
||||
JERRY_DLOG ("G_NC_END ");
|
||||
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("G_NC_END ");
|
||||
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
|
||||
break;
|
||||
}
|
||||
case RE_OP_SAVE_AT_START:
|
||||
{
|
||||
JERRY_DLOG ("RE_START ");
|
||||
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("RE_START ");
|
||||
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
|
||||
break;
|
||||
}
|
||||
case RE_OP_SAVE_AND_MATCH:
|
||||
{
|
||||
JERRY_DLOG ("RE_END, ");
|
||||
JERRY_DEBUG_MSG ("RE_END, ");
|
||||
break;
|
||||
}
|
||||
case RE_OP_GREEDY_ITERATOR:
|
||||
{
|
||||
JERRY_DLOG ("GREEDY_ITERATOR ");
|
||||
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("GREEDY_ITERATOR ");
|
||||
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
|
||||
break;
|
||||
}
|
||||
case RE_OP_NON_GREEDY_ITERATOR:
|
||||
{
|
||||
JERRY_DLOG ("NON_GREEDY_ITERATOR ");
|
||||
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
|
||||
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
|
||||
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("NON_GREEDY_ITERATOR ");
|
||||
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
|
||||
break;
|
||||
}
|
||||
case RE_OP_PERIOD:
|
||||
{
|
||||
JERRY_DLOG ("PERIOD ");
|
||||
JERRY_DEBUG_MSG ("PERIOD ");
|
||||
break;
|
||||
}
|
||||
case RE_OP_ALTERNATIVE:
|
||||
{
|
||||
JERRY_DLOG ("ALTERNATIVE ");
|
||||
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("ALTERNATIVE ");
|
||||
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
|
||||
break;
|
||||
}
|
||||
case RE_OP_ASSERT_START:
|
||||
{
|
||||
JERRY_DLOG ("ASSERT_START ");
|
||||
JERRY_DEBUG_MSG ("ASSERT_START ");
|
||||
break;
|
||||
}
|
||||
case RE_OP_ASSERT_END:
|
||||
{
|
||||
JERRY_DLOG ("ASSERT_END ");
|
||||
JERRY_DEBUG_MSG ("ASSERT_END ");
|
||||
break;
|
||||
}
|
||||
case RE_OP_ASSERT_WORD_BOUNDARY:
|
||||
{
|
||||
JERRY_DLOG ("ASSERT_WORD_BOUNDARY ");
|
||||
JERRY_DEBUG_MSG ("ASSERT_WORD_BOUNDARY ");
|
||||
break;
|
||||
}
|
||||
case RE_OP_ASSERT_NOT_WORD_BOUNDARY:
|
||||
{
|
||||
JERRY_DLOG ("ASSERT_NOT_WORD_BOUNDARY ");
|
||||
JERRY_DEBUG_MSG ("ASSERT_NOT_WORD_BOUNDARY ");
|
||||
break;
|
||||
}
|
||||
case RE_OP_LOOKAHEAD_POS:
|
||||
{
|
||||
JERRY_DLOG ("LOOKAHEAD_POS ");
|
||||
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("LOOKAHEAD_POS ");
|
||||
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
|
||||
break;
|
||||
}
|
||||
case RE_OP_LOOKAHEAD_NEG:
|
||||
{
|
||||
JERRY_DLOG ("LOOKAHEAD_NEG ");
|
||||
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("LOOKAHEAD_NEG ");
|
||||
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
|
||||
break;
|
||||
}
|
||||
case RE_OP_BACKREFERENCE:
|
||||
{
|
||||
JERRY_DLOG ("BACKREFERENCE ");
|
||||
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("BACKREFERENCE ");
|
||||
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
|
||||
break;
|
||||
}
|
||||
case RE_OP_INV_CHAR_CLASS:
|
||||
{
|
||||
JERRY_DLOG ("INV_");
|
||||
JERRY_DEBUG_MSG ("INV_");
|
||||
/* FALLTHRU */
|
||||
}
|
||||
case RE_OP_CHAR_CLASS:
|
||||
{
|
||||
JERRY_DLOG ("CHAR_CLASS ");
|
||||
JERRY_DEBUG_MSG ("CHAR_CLASS ");
|
||||
uint32_t num_of_class = re_get_value (&bytecode_p);
|
||||
JERRY_DLOG ("%d", num_of_class);
|
||||
JERRY_DEBUG_MSG ("%d", num_of_class);
|
||||
while (num_of_class)
|
||||
{
|
||||
JERRY_DLOG (" %d", re_get_char (&bytecode_p));
|
||||
JERRY_DLOG ("-%d", re_get_char (&bytecode_p));
|
||||
JERRY_DEBUG_MSG (" %d", re_get_char (&bytecode_p));
|
||||
JERRY_DEBUG_MSG ("-%d", re_get_char (&bytecode_p));
|
||||
num_of_class--;
|
||||
}
|
||||
JERRY_DLOG (", ");
|
||||
JERRY_DEBUG_MSG (", ");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
JERRY_DLOG ("UNKNOWN(%d), ", (uint32_t) op);
|
||||
JERRY_DEBUG_MSG ("UNKNOWN(%d), ", (uint32_t) op);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
JERRY_DLOG ("EOF\n");
|
||||
JERRY_DEBUG_MSG ("EOF\n");
|
||||
} /* re_dump_bytecode */
|
||||
#endif /* JERRY_ENABLE_LOG */
|
||||
#endif /* REGEXP_DUMP_BYTE_CODE */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -115,9 +115,9 @@ void re_insert_opcode (re_bytecode_ctx_t *, uint32_t, re_opcode_t);
|
||||
void re_insert_u32 (re_bytecode_ctx_t *, uint32_t, uint32_t);
|
||||
void re_bytecode_list_insert (re_bytecode_ctx_t *, size_t, uint8_t *, size_t);
|
||||
|
||||
#ifdef JERRY_ENABLE_LOG
|
||||
#ifdef REGEXP_DUMP_BYTE_CODE
|
||||
void re_dump_bytecode (re_bytecode_ctx_t *bc_ctx);
|
||||
#endif /* JERRY_ENABLE_LOG */
|
||||
#endif /* REGEXP_DUMP_BYTE_CODE */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -237,7 +237,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
|
||||
case RE_TOK_START_CAPTURE_GROUP:
|
||||
{
|
||||
idx = re_ctx_p->num_of_captures++;
|
||||
JERRY_DDLOG ("Compile a capture group start (idx: %d)\n", idx);
|
||||
JERRY_TRACE_MSG ("Compile a capture group start (idx: %d)\n", idx);
|
||||
|
||||
ret_value = re_parse_alternative (re_ctx_p, false);
|
||||
|
||||
@@ -251,7 +251,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
|
||||
case RE_TOK_START_NON_CAPTURE_GROUP:
|
||||
{
|
||||
idx = re_ctx_p->num_of_non_captures++;
|
||||
JERRY_DDLOG ("Compile a non-capture group start (idx: %d)\n", idx);
|
||||
JERRY_TRACE_MSG ("Compile a non-capture group start (idx: %d)\n", idx);
|
||||
|
||||
ret_value = re_parse_alternative (re_ctx_p, false);
|
||||
|
||||
@@ -264,8 +264,8 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
|
||||
}
|
||||
case RE_TOK_CHAR:
|
||||
{
|
||||
JERRY_DDLOG ("Compile character token: %c, qmin: %d, qmax: %d\n",
|
||||
re_ctx_p->current_token.value, re_ctx_p->current_token.qmin, re_ctx_p->current_token.qmax);
|
||||
JERRY_TRACE_MSG ("Compile character token: %c, qmin: %d, qmax: %d\n",
|
||||
re_ctx_p->current_token.value, re_ctx_p->current_token.qmin, re_ctx_p->current_token.qmax);
|
||||
|
||||
re_append_opcode (bc_ctx_p, RE_OP_CHAR);
|
||||
re_append_char (bc_ctx_p, re_canonicalize ((ecma_char_t) re_ctx_p->current_token.value,
|
||||
@@ -279,7 +279,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
|
||||
}
|
||||
case RE_TOK_PERIOD:
|
||||
{
|
||||
JERRY_DDLOG ("Compile a period\n");
|
||||
JERRY_TRACE_MSG ("Compile a period\n");
|
||||
re_append_opcode (bc_ctx_p, RE_OP_PERIOD);
|
||||
|
||||
if ((re_ctx_p->current_token.qmin != 1) || (re_ctx_p->current_token.qmax != 1))
|
||||
@@ -290,7 +290,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
|
||||
}
|
||||
case RE_TOK_ALTERNATIVE:
|
||||
{
|
||||
JERRY_DDLOG ("Compile an alternative\n");
|
||||
JERRY_TRACE_MSG ("Compile an alternative\n");
|
||||
re_insert_u32 (bc_ctx_p, alterantive_offset, re_get_bytecode_length (bc_ctx_p) - alterantive_offset);
|
||||
re_append_opcode (bc_ctx_p, RE_OP_ALTERNATIVE);
|
||||
alterantive_offset = re_get_bytecode_length (re_ctx_p->bytecode_ctx_p);
|
||||
@@ -298,31 +298,31 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
|
||||
}
|
||||
case RE_TOK_ASSERT_START:
|
||||
{
|
||||
JERRY_DDLOG ("Compile a start assertion\n");
|
||||
JERRY_TRACE_MSG ("Compile a start assertion\n");
|
||||
re_append_opcode (bc_ctx_p, RE_OP_ASSERT_START);
|
||||
break;
|
||||
}
|
||||
case RE_TOK_ASSERT_END:
|
||||
{
|
||||
JERRY_DDLOG ("Compile an end assertion\n");
|
||||
JERRY_TRACE_MSG ("Compile an end assertion\n");
|
||||
re_append_opcode (bc_ctx_p, RE_OP_ASSERT_END);
|
||||
break;
|
||||
}
|
||||
case RE_TOK_ASSERT_WORD_BOUNDARY:
|
||||
{
|
||||
JERRY_DDLOG ("Compile a word boundary assertion\n");
|
||||
JERRY_TRACE_MSG ("Compile a word boundary assertion\n");
|
||||
re_append_opcode (bc_ctx_p, RE_OP_ASSERT_WORD_BOUNDARY);
|
||||
break;
|
||||
}
|
||||
case RE_TOK_ASSERT_NOT_WORD_BOUNDARY:
|
||||
{
|
||||
JERRY_DDLOG ("Compile a not word boundary assertion\n");
|
||||
JERRY_TRACE_MSG ("Compile a not word boundary assertion\n");
|
||||
re_append_opcode (bc_ctx_p, RE_OP_ASSERT_NOT_WORD_BOUNDARY);
|
||||
break;
|
||||
}
|
||||
case RE_TOK_ASSERT_START_POS_LOOKAHEAD:
|
||||
{
|
||||
JERRY_DDLOG ("Compile a positive lookahead assertion\n");
|
||||
JERRY_TRACE_MSG ("Compile a positive lookahead assertion\n");
|
||||
idx = re_ctx_p->num_of_non_captures++;
|
||||
re_append_opcode (bc_ctx_p, RE_OP_LOOKAHEAD_POS);
|
||||
|
||||
@@ -339,7 +339,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
|
||||
}
|
||||
case RE_TOK_ASSERT_START_NEG_LOOKAHEAD:
|
||||
{
|
||||
JERRY_DDLOG ("Compile a negative lookahead assertion\n");
|
||||
JERRY_TRACE_MSG ("Compile a negative lookahead assertion\n");
|
||||
idx = re_ctx_p->num_of_non_captures++;
|
||||
re_append_opcode (bc_ctx_p, RE_OP_LOOKAHEAD_NEG);
|
||||
|
||||
@@ -364,7 +364,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
|
||||
re_ctx_p->highest_backref = backref;
|
||||
}
|
||||
|
||||
JERRY_DDLOG ("Compile a backreference: %d\n", backref);
|
||||
JERRY_TRACE_MSG ("Compile a backreference: %d\n", backref);
|
||||
re_append_opcode (bc_ctx_p, RE_OP_BACKREFERENCE);
|
||||
re_append_u32 (bc_ctx_p, backref);
|
||||
|
||||
@@ -380,7 +380,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
|
||||
case RE_TOK_START_CHAR_CLASS:
|
||||
case RE_TOK_START_INV_CHAR_CLASS:
|
||||
{
|
||||
JERRY_DDLOG ("Compile a character class\n");
|
||||
JERRY_TRACE_MSG ("Compile a character class\n");
|
||||
re_append_opcode (bc_ctx_p,
|
||||
re_ctx_p->current_token.type == RE_TOK_START_INV_CHAR_CLASS
|
||||
? RE_OP_INV_CHAR_CLASS
|
||||
@@ -406,7 +406,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
|
||||
}
|
||||
case RE_TOK_END_GROUP:
|
||||
{
|
||||
JERRY_DDLOG ("Compile a group end\n");
|
||||
JERRY_TRACE_MSG ("Compile a group end\n");
|
||||
|
||||
if (expect_eof)
|
||||
{
|
||||
@@ -469,7 +469,7 @@ re_find_bytecode_in_cache (ecma_string_t *pattern_str_p, /**< pattern string */
|
||||
if ((cached_bytecode_p->header.status_flags & RE_FLAGS_MASK) == flags
|
||||
&& ecma_compare_ecma_strings (cached_pattern_str_p, pattern_str_p))
|
||||
{
|
||||
JERRY_DDLOG ("RegExp is found in cache\n");
|
||||
JERRY_TRACE_MSG ("RegExp is found in cache\n");
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
@@ -480,7 +480,7 @@ re_find_bytecode_in_cache (ecma_string_t *pattern_str_p, /**< pattern string */
|
||||
}
|
||||
}
|
||||
|
||||
JERRY_DDLOG ("RegExp is NOT found in cache\n");
|
||||
JERRY_TRACE_MSG ("RegExp is NOT found in cache\n");
|
||||
return free_idx;
|
||||
} /* re_find_bytecode_in_cache */
|
||||
|
||||
@@ -594,15 +594,18 @@ re_compile_bytecode (const re_compiled_code_t **out_bytecode_p, /**< [out] point
|
||||
if (!ecma_is_value_empty (ret_value))
|
||||
{
|
||||
/* Compilation failed, free bytecode. */
|
||||
JERRY_DDLOG ("RegExp compilation failed!\n");
|
||||
JERRY_TRACE_MSG ("RegExp compilation failed!\n");
|
||||
jmem_heap_free_block (bc_ctx.block_start_p, byte_code_size);
|
||||
*out_bytecode_p = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef JERRY_ENABLE_LOG
|
||||
re_dump_bytecode (&bc_ctx);
|
||||
#endif /* JERRY_ENABLE_LOG */
|
||||
#ifdef REGEXP_DUMP_BYTE_CODE
|
||||
if (JERRY_CONTEXT (jerry_init_flags) & JERRY_INIT_SHOW_REGEXP_OPCODES)
|
||||
{
|
||||
re_dump_bytecode (&bc_ctx);
|
||||
}
|
||||
#endif /* 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);
|
||||
@@ -617,7 +620,7 @@ re_compile_bytecode (const re_compiled_code_t **out_bytecode_p, /**< [out] point
|
||||
JERRY_CONTEXT (re_cache_idx) = 0;
|
||||
}
|
||||
|
||||
JERRY_DDLOG ("RegExp cache is full! Remove the element on idx: %d\n", JERRY_CONTEXT (re_cache_idx));
|
||||
JERRY_TRACE_MSG ("RegExp cache is full! Remove the element on idx: %d\n", JERRY_CONTEXT (re_cache_idx));
|
||||
|
||||
cache_idx = JERRY_CONTEXT (re_cache_idx)++;
|
||||
|
||||
@@ -629,7 +632,7 @@ re_compile_bytecode (const re_compiled_code_t **out_bytecode_p, /**< [out] point
|
||||
}
|
||||
}
|
||||
|
||||
JERRY_DDLOG ("Insert bytecode into RegExp cache (idx: %d).\n", cache_idx);
|
||||
JERRY_TRACE_MSG ("Insert bytecode into RegExp cache (idx: %d).\n", cache_idx);
|
||||
ecma_bytecode_ref ((ecma_compiled_code_t *) *out_bytecode_p);
|
||||
JERRY_CONTEXT (re_cache)[cache_idx] = *out_bytecode_p;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user