1313 * limitations under the License.
1414 */
1515
16- #include " mem-allocator .h"
16+ #include " ecma-helpers .h"
1717#include " jrt-libc-includes.h"
18+ #include " jsp-mm.h"
1819#include " lexer.h"
1920#include " syntax-errors.h"
20- #include " ecma-helpers.h"
2121
2222static token saved_token, prev_token, sent_token, empty_token;
2323
@@ -474,9 +474,7 @@ convert_string_to_token_transform_escape_seq (token_type tok_type, /**< type of
474474 JERRY_ASSERT (source_str_p != NULL );
475475 }
476476
477- MEM_DEFINE_LOCAL_ARRAY (str_buf_p,
478- source_str_size,
479- ecma_char_t );
477+ ecma_char_t *str_buf_p = (ecma_char_t *) jsp_mm_alloc (source_str_size * sizeof (ecma_char_t ));
480478
481479 const char *source_str_iter_p = source_str_p;
482480 ecma_char_t *str_buf_iter_p = str_buf_p;
@@ -632,7 +630,7 @@ convert_string_to_token_transform_escape_seq (token_type tok_type, /**< type of
632630 PARSE_ERROR (" Malformed escape sequence" , source_str_p - buffer_start);
633631 }
634632
635- MEM_FINALIZE_LOCAL_ARRAY (str_buf_p);
633+ jsp_mm_free (str_buf_p);
636634
637635 return ret;
638636} /* convert_string_to_token_transform_escape_seq */
@@ -860,13 +858,12 @@ parse_number (void)
860858 tok_length = (size_t ) (buffer - token_start);;
861859 if (is_fp || is_exp)
862860 {
863- ecma_char_t *temp = (ecma_char_t *) mem_heap_alloc_block ((size_t ) (tok_length + 1 ),
864- MEM_HEAP_ALLOC_SHORT_TERM);
861+ ecma_char_t *temp = (ecma_char_t *) jsp_mm_alloc ((size_t ) (tok_length + 1 ) * sizeof (ecma_char_t ));
865862 strncpy ((char *) temp, token_start, (size_t ) (tok_length));
866863 temp[tok_length] = ' \0 ' ;
867864 ecma_number_t res = ecma_zt_string_to_number (temp);
868865 JERRY_ASSERT (!ecma_number_is_nan (res));
869- mem_heap_free_block (temp);
866+ jsp_mm_free (temp);
870867 known_token = convert_seen_num_to_token (res);
871868 token_start = NULL ;
872869 return known_token;
@@ -1467,28 +1464,22 @@ lexer_are_tokens_with_same_identifier (token id1, /**< identifier token (TOK_NAM
14671464} /* lexer_are_tokens_with_same_identifier */
14681465
14691466/* *
1470- * Initialize lexer to start parsing of a new source
1467+ * Intitialize lexer
14711468 */
14721469void
1473- lexer_init_source (const char *source, /* *< script source */
1474- size_t source_size) /* *< script source size in bytes */
1470+ lexer_init (const char *source, /* *< script source */
1471+ size_t source_size /* *< script source size in bytes */ ,
1472+ bool show_opcodes) /* *< flag indicating if to dump opcodes */
14751473{
1474+ empty_token.type = TOK_EMPTY;
1475+ empty_token.uid = 0 ;
1476+ empty_token.loc = 0 ;
1477+
14761478 saved_token = prev_token = sent_token = empty_token;
14771479
14781480 buffer_size = source_size;
14791481 lexer_set_source (source);
14801482 lexer_set_strict_mode (false );
1481- } /* lexer_init_source */
1482-
1483- /* *
1484- * Intitialize lexer
1485- */
1486- void
1487- lexer_init (bool show_opcodes) /* *< flag indicating if to dump opcodes */
1488- {
1489- empty_token.type = TOK_EMPTY;
1490- empty_token.uid = 0 ;
1491- empty_token.loc = 0 ;
14921483
14931484#ifndef JERRY_NDEBUG
14941485 allow_dump_lines = show_opcodes;
@@ -1497,8 +1488,3 @@ lexer_init (bool show_opcodes) /**< flag indicating if to dump opcodes */
14971488 allow_dump_lines = false ;
14981489#endif /* JERRY_NDEBUG */
14991490} /* lexer_init */
1500-
1501- void
1502- lexer_free (void )
1503- {
1504- }
0 commit comments