Skip to content

Commit 0ac8af9

Browse files
committed
Turn some global variables static const
Generally, it helps the optimizing passes of the compiler if global varibles are `static`, and it is good for RAM usage to have data marked read-only `const`. Found some globals, which could benefit from these qualifiers. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss [email protected]
1 parent 0d7ea70 commit 0ac8af9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

jerry-core/parser/js/js-lexer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,12 +1904,12 @@ lexer_expect_identifier (parser_context_t *context_p, /**< context */
19041904
parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);
19051905
} /* lexer_expect_identifier */
19061906

1907-
static lexer_lit_location_t lexer_get_literal =
1907+
static const lexer_lit_location_t lexer_get_literal =
19081908
{
19091909
(const uint8_t *) "get", 3, LEXER_IDENT_LITERAL, PARSER_FALSE
19101910
};
19111911

1912-
static lexer_lit_location_t lexer_set_literal =
1912+
static const lexer_lit_location_t lexer_set_literal =
19131913
{
19141914
(const uint8_t *) "set", 3, LEXER_IDENT_LITERAL, PARSER_FALSE
19151915
};

jerry-core/vm/vm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,15 @@ vm_init (ecma_compiled_code_t *program_p, /**< pointer to byte-code data */
157157
/**
158158
* Decode table for opcodes.
159159
*/
160-
uint32_t vm_decode_table[] =
160+
static const uint32_t vm_decode_table[] =
161161
{
162162
CBC_OPCODE_LIST
163163
};
164164

165165
/**
166166
* Decode table for extended opcodes.
167167
*/
168-
uint32_t vm_ext_decode_table[] =
168+
static const uint32_t vm_ext_decode_table[] =
169169
{
170170
CBC_EXT_OPCODE_LIST
171171
};

0 commit comments

Comments
 (0)