diff options
author | Zoltan Herczeg <zherczeg.u-szeged@partner.samsung.com> | 2018-05-30 12:57:12 +0200 |
---|---|---|
committer | yichoi <duddlf.choi@samsung.com> | 2018-05-30 19:57:12 +0900 |
commit | 7be9f91d222a255f7a75dc2e7addcc9aa2257ce8 (patch) | |
tree | db638fe5e17db99f3e34dc68b036de4dab4f1df9 /jerry-core | |
parent | d5593c12b43a25e41bc6b56945502a5008c1e27f (diff) |
Reverse the generation of line info. (#2363)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Diffstat (limited to 'jerry-core')
-rw-r--r-- | jerry-core/parser/js/js-parser-util.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/jerry-core/parser/js/js-parser-util.c b/jerry-core/parser/js/js-parser-util.c index b831802e..ad7c86e2 100644 --- a/jerry-core/parser/js/js-parser-util.c +++ b/jerry-core/parser/js/js-parser-util.c @@ -418,13 +418,21 @@ parser_emit_line_info (parser_context_t *context_p, /**< context */ context_p->last_line_info_line = line; + const uint32_t max_shift_plus_7 = 7 * 5; + uint32_t shift = 7; + + while (shift < max_shift_plus_7 && (line >> shift) > 0) + { + shift += 7; + } + do { - uint8_t byte = (uint8_t) (line & CBC_LOWER_SEVEN_BIT_MASK); + shift -= 7; - line >>= 7; + uint8_t byte = (uint8_t) ((line >> shift) & CBC_LOWER_SEVEN_BIT_MASK); - if (line > 0) + if (shift > 0) { byte = (uint8_t) (byte | CBC_HIGHEST_BIT_MASK); } @@ -432,7 +440,7 @@ parser_emit_line_info (parser_context_t *context_p, /**< context */ PARSER_APPEND_TO_BYTE_CODE (context_p, byte); context_p->byte_code_size++; } - while (line > 0); + while (shift > 0); } /* parser_emit_line_info */ #endif /* JERRY_ENABLE_LINE_INFO */ |