mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Set js-parser feature in the build script. (#1482)
Renamed FEATURE_PARSER_DISABLE to FEATURE_JS_PARSER. Fixed the build error that occurred in case of disabled js-parser. JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
This commit is contained in:
parent
233b885ad8
commit
e9ab1f14d3
@ -17,26 +17,26 @@ set(JERRY_CORE_NAME jerry-core)
|
||||
project (${JERRY_CORE_NAME} C)
|
||||
|
||||
# Optional features
|
||||
set(FEATURE_CPOINTER_32_BIT OFF CACHE BOOL "Enable 32 bit compressed pointers?")
|
||||
set(FEATURE_ERROR_MESSAGES OFF CACHE BOOL "Enable error messages?")
|
||||
set(FEATURE_MEM_STATS OFF CACHE BOOL "Enable memory statistics?")
|
||||
set(FEATURE_MEM_STRESS_TEST OFF CACHE BOOL "Enable mem-stress test?")
|
||||
set(FEATURE_PARSER_DISABLE OFF CACHE BOOL "Disable the parser and 'eval' and use only snapshots?")
|
||||
set(FEATURE_PARSER_DUMP OFF CACHE BOOL "Enable parser byte-code dumps?")
|
||||
set(FEATURE_CPOINTER_32_BIT OFF CACHE BOOL "Enable 32 bit compressed pointers?")
|
||||
set(FEATURE_ERROR_MESSAGES OFF CACHE BOOL "Enable error messages?")
|
||||
set(FEATURE_JS_PARSER ON CACHE BOOL "Enable js-parser?")
|
||||
set(FEATURE_MEM_STATS OFF CACHE BOOL "Enable memory statistics?")
|
||||
set(FEATURE_MEM_STRESS_TEST OFF CACHE BOOL "Enable mem-stress test?")
|
||||
set(FEATURE_PARSER_DUMP OFF CACHE BOOL "Enable parser byte-code dumps?")
|
||||
set(FEATURE_PROFILE "es5.1" CACHE STRING "Profile types: es5.1, minimal, es2015-subset")
|
||||
set(FEATURE_REGEXP_DUMP OFF CACHE BOOL "Enable regexp byte-code dumps?")
|
||||
set(FEATURE_SNAPSHOT_EXEC OFF CACHE BOOL "Enable executing snapshot files?")
|
||||
set(FEATURE_SNAPSHOT_SAVE OFF CACHE BOOL "Enable saving snapshot files?")
|
||||
set(FEATURE_VALGRIND OFF CACHE BOOL "Enable Valgrind support?")
|
||||
set(FEATURE_VALGRIND_FREYA OFF CACHE BOOL "Enable Valgrind-Freya support?")
|
||||
set(MEM_HEAP_SIZE_KB "512" CACHE STRING "Size of memory heap, in kilobytes")
|
||||
set(FEATURE_REGEXP_DUMP OFF CACHE BOOL "Enable regexp byte-code dumps?")
|
||||
set(FEATURE_SNAPSHOT_EXEC OFF CACHE BOOL "Enable executing snapshot files?")
|
||||
set(FEATURE_SNAPSHOT_SAVE OFF CACHE BOOL "Enable saving snapshot files?")
|
||||
set(FEATURE_VALGRIND OFF CACHE BOOL "Enable Valgrind support?")
|
||||
set(FEATURE_VALGRIND_FREYA OFF CACHE BOOL "Enable Valgrind-Freya support?")
|
||||
set(MEM_HEAP_SIZE_KB "512" CACHE STRING "Size of memory heap, in kilobytes")
|
||||
|
||||
# Status messages
|
||||
message(STATUS "FEATURE_CPOINTER_32_BIT " ${FEATURE_CPOINTER_32_BIT})
|
||||
message(STATUS "FEATURE_ERROR_MESSAGES " ${FEATURE_ERROR_MESSAGES})
|
||||
message(STATUS "FEATURE_JS_PARSER " ${FEATURE_JS_PARSER})
|
||||
message(STATUS "FEATURE_MEM_STATS " ${FEATURE_MEM_STATS})
|
||||
message(STATUS "FEATURE_MEM_STRESS_TEST " ${FEATURE_MEM_STRESS_TEST})
|
||||
message(STATUS "FEATURE_PARSER_DISABLE " ${FEATURE_PARSER_DISABLE})
|
||||
message(STATUS "FEATURE_PARSER_DUMP " ${FEATURE_PARSER_DUMP})
|
||||
message(STATUS "FEATURE_PROFILE " ${FEATURE_PROFILE})
|
||||
message(STATUS "FEATURE_REGEXP_DUMP " ${FEATURE_REGEXP_DUMP})
|
||||
@ -134,6 +134,20 @@ if(FEATURE_ERROR_MESSAGES)
|
||||
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ENABLE_ERROR_MESSAGES)
|
||||
endif()
|
||||
|
||||
# JS-Parser
|
||||
if(FEATURE_JS_PARSER)
|
||||
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_JS_PARSER)
|
||||
else()
|
||||
if(NOT FEATURE_SNAPSHOT_EXEC MATCHES ON)
|
||||
set(FEATURE_SNAPSHOT_EXEC ON)
|
||||
message(STATUS "JS-Parser has been disabled, snapshot is now on")
|
||||
endif()
|
||||
if(FEATURE_PARSER_DUMP)
|
||||
set(FEATURE_PARSER_DUMP OFF)
|
||||
message(STATUS "Parser byte-code dumps has been disabled")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Memory statistics
|
||||
if(FEATURE_MEM_STATS)
|
||||
set(DEFINES_JERRY ${DEFINES_JERRY} JMEM_STATS)
|
||||
@ -144,15 +158,6 @@ if(FEATURE_MEM_STRESS_TEST)
|
||||
set(DEFINES_JERRY ${DEFINES_JERRY} JMEM_GC_BEFORE_EACH_ALLOC)
|
||||
endif()
|
||||
|
||||
# Disable parser and enable snapshots
|
||||
if(FEATURE_PARSER_DISABLE)
|
||||
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_DISABLE_PARSER)
|
||||
if(NOT FEATURE_SNAPSHOT_EXEC MATCHES ON)
|
||||
set(FEATURE_SNAPSHOT_EXEC ON)
|
||||
message(STATUS "Parser has been disabled, snapshot is now on")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Parser byte-code dumps
|
||||
if(FEATURE_PARSER_DUMP)
|
||||
set(DEFINES_JERRY ${DEFINES_JERRY} PARSER_DUMP_BYTE_CODE)
|
||||
|
||||
@ -81,6 +81,7 @@ ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, /**< code characters b
|
||||
bool is_direct, /**< is eval called directly (ECMA-262 v5, 15.1.2.1.1) */
|
||||
bool is_called_from_strict_mode_code) /**< is eval is called from strict mode code */
|
||||
{
|
||||
#ifdef JERRY_JS_PARSER
|
||||
JERRY_ASSERT (code_p != NULL);
|
||||
|
||||
ecma_compiled_code_t *bytecode_data_p;
|
||||
@ -98,6 +99,14 @@ ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, /**< code characters b
|
||||
}
|
||||
|
||||
return vm_run_eval (bytecode_data_p, is_direct);
|
||||
#else /* !JERRY_JS_PARSER */
|
||||
JERRY_UNUSED (code_p);
|
||||
JERRY_UNUSED (code_buffer_size);
|
||||
JERRY_UNUSED (is_direct);
|
||||
JERRY_UNUSED (is_called_from_strict_mode_code);
|
||||
|
||||
return ecma_raise_syntax_error (ECMA_ERR_MSG ("The parser has been disabled."));
|
||||
#endif /* JERRY_JS_PARSER */
|
||||
} /* ecma_op_eval_chars_buffer */
|
||||
|
||||
/**
|
||||
|
||||
@ -49,6 +49,10 @@ JERRY_STATIC_ASSERT ((int) ECMA_ERROR_COMMON == (int) JERRY_ERROR_COMMON
|
||||
&& (int) ECMA_ERROR_URI == (int) JERRY_ERROR_URI,
|
||||
ecma_standard_error_t_must_be_equal_to_jerry_error_t);
|
||||
|
||||
#if !defined (JERRY_JS_PARSER) && !defined (JERRY_ENABLE_SNAPSHOT_EXEC)
|
||||
#error JERRY_JS_PARSER or JERRY_ENABLE_SNAPSHOT_EXEC must be defined!
|
||||
#endif /* !JERRY_JS_PARSER && !JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
|
||||
#ifdef JERRY_ENABLE_ERROR_MESSAGES
|
||||
|
||||
/**
|
||||
@ -249,6 +253,7 @@ jerry_parse (const jerry_char_t *source_p, /**< script source */
|
||||
size_t source_size, /**< script source size */
|
||||
bool is_strict) /**< strict mode */
|
||||
{
|
||||
#ifdef JERRY_JS_PARSER
|
||||
jerry_assert_api_available ();
|
||||
|
||||
ecma_compiled_code_t *bytecode_data_p;
|
||||
@ -282,6 +287,13 @@ jerry_parse (const jerry_char_t *source_p, /**< script source */
|
||||
ecma_bytecode_deref (bytecode_data_p);
|
||||
|
||||
return ecma_make_object_value (func_obj_p);
|
||||
#else /* !JERRY_JS_PARSER */
|
||||
JERRY_UNUSED (source_p);
|
||||
JERRY_UNUSED (source_size);
|
||||
JERRY_UNUSED (is_strict);
|
||||
|
||||
return ecma_raise_syntax_error (ECMA_ERR_MSG ("The parser has been disabled."));
|
||||
#endif /* JERRY_JS_PARSER */
|
||||
} /* jerry_parse */
|
||||
|
||||
/**
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
#include "js-parser-internal.h"
|
||||
|
||||
#ifndef JERRY_DISABLE_PARSER
|
||||
#ifdef JERRY_JS_PARSER
|
||||
|
||||
/** \addtogroup parser Parser
|
||||
* @{
|
||||
@ -78,4 +78,4 @@ const char * const cbc_ext_names[] =
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !JERRY_DISABLE_PARSER */
|
||||
#endif /* JERRY_JS_PARSER */
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
#include "common.h"
|
||||
#include "ecma-helpers.h"
|
||||
|
||||
#ifndef JERRY_DISABLE_PARSER
|
||||
#ifdef JERRY_JS_PARSER
|
||||
|
||||
/** \addtogroup parser Parser
|
||||
* @{
|
||||
@ -136,4 +136,4 @@ util_print_literal (lexer_literal_t *literal_p) /**< literal */
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !JERRY_DISABLE_PARSER */
|
||||
#endif /* JERRY_JS_PARSER */
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
#include "js-parser-internal.h"
|
||||
#include "lit-char-helpers.h"
|
||||
|
||||
#ifndef JERRY_DISABLE_PARSER
|
||||
#ifdef JERRY_JS_PARSER
|
||||
|
||||
/** \addtogroup parser Parser
|
||||
* @{
|
||||
@ -2140,4 +2140,4 @@ lexer_compare_identifier_to_current (parser_context_t *context_p, /**< co
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !JERRY_DISABLE_PARSER */
|
||||
#endif /* JERRY_JS_PARSER */
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
#include "js-parser-internal.h"
|
||||
|
||||
#ifndef JERRY_DISABLE_PARSER
|
||||
#ifdef JERRY_JS_PARSER
|
||||
|
||||
/** \addtogroup parser Parser
|
||||
* @{
|
||||
@ -1531,4 +1531,4 @@ parser_parse_expression (parser_context_t *context_p, /**< context */
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !JERRY_DISABLE_PARSER */
|
||||
#endif /* JERRY_JS_PARSER */
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
#include "js-parser-internal.h"
|
||||
|
||||
#ifndef JERRY_DISABLE_PARSER
|
||||
#ifdef JERRY_JS_PARSER
|
||||
|
||||
/** \addtogroup mem Memory allocation
|
||||
* @{
|
||||
@ -678,4 +678,4 @@ parser_stack_iterator_write (parser_stack_iterator_t *iterator, /**< iterator */
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !JERRY_DISABLE_PARSER */
|
||||
#endif /* JERRY_JS_PARSER */
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
#include "js-parser-internal.h"
|
||||
|
||||
#ifndef JERRY_DISABLE_PARSER
|
||||
#ifdef JERRY_JS_PARSER
|
||||
|
||||
/** \addtogroup parser Parser
|
||||
* @{
|
||||
@ -678,4 +678,4 @@ parser_scan_until (parser_context_t *context_p, /**< context */
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !JERRY_DISABLE_PARSER */
|
||||
#endif /* JERRY_JS_PARSER */
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
#include "js-parser-internal.h"
|
||||
|
||||
#ifndef JERRY_DISABLE_PARSER
|
||||
#ifdef JERRY_JS_PARSER
|
||||
|
||||
/** \addtogroup parser Parser
|
||||
* @{
|
||||
@ -2146,4 +2146,4 @@ parser_free_jumps (parser_stack_iterator_t iterator) /**< iterator position */
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !JERRY_DISABLE_PARSER */
|
||||
#endif /* JERRY_JS_PARSER */
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
#include "js-parser-internal.h"
|
||||
|
||||
#ifndef JERRY_DISABLE_PARSER
|
||||
#ifdef JERRY_JS_PARSER
|
||||
|
||||
/** \addtogroup parser Parser
|
||||
* @{
|
||||
@ -940,4 +940,4 @@ parser_error_to_string (parser_error_t error) /**< error code */
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !JERRY_DISABLE_PARSER */
|
||||
#endif /* JERRY_JS_PARSER */
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
#include "jcontext.h"
|
||||
#include "js-parser-internal.h"
|
||||
|
||||
#ifndef JERRY_DISABLE_PARSER
|
||||
#ifdef JERRY_JS_PARSER
|
||||
|
||||
/** \addtogroup parser Parser
|
||||
* @{
|
||||
@ -2230,7 +2230,7 @@ parser_raise_error (parser_context_t *context_p, /**< context */
|
||||
#define PARSE_ERR_POS_END "]"
|
||||
#define PARSE_ERR_POS_END_SIZE ((uint32_t) sizeof (PARSE_ERR_POS_END))
|
||||
|
||||
#endif /* !JERRY_DISABLE_PARSER */
|
||||
#endif /* JERRY_JS_PARSER */
|
||||
|
||||
/**
|
||||
* Parse EcamScript source code
|
||||
@ -2247,7 +2247,7 @@ parser_parse_script (const uint8_t *source_p, /**< source code */
|
||||
bool is_strict, /**< strict mode */
|
||||
ecma_compiled_code_t **bytecode_data_p) /**< [out] JS bytecode */
|
||||
{
|
||||
#ifndef JERRY_DISABLE_PARSER
|
||||
#ifdef JERRY_JS_PARSER
|
||||
parser_error_location_t parser_error;
|
||||
*bytecode_data_p = parser_parse_source (source_p, size, is_strict, &parser_error);
|
||||
|
||||
@ -2311,14 +2311,14 @@ parser_parse_script (const uint8_t *source_p, /**< source code */
|
||||
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
|
||||
}
|
||||
return ecma_make_simple_value (ECMA_SIMPLE_VALUE_TRUE);
|
||||
#else /* !JERRY_DISABLE_PARSER */
|
||||
#else /* !JERRY_JS_PARSER */
|
||||
JERRY_UNUSED (source_p);
|
||||
JERRY_UNUSED (size);
|
||||
JERRY_UNUSED (is_strict);
|
||||
JERRY_UNUSED (bytecode_data_p);
|
||||
|
||||
return ecma_raise_syntax_error (ECMA_ERR_MSG ("The parser has been disabled."));
|
||||
#endif /* JERRY_DISABLE_PARSER */
|
||||
#endif /* JERRY_JS_PARSER */
|
||||
} /* parser_parse_script */
|
||||
|
||||
/**
|
||||
|
||||
@ -54,6 +54,7 @@ def get_arguments():
|
||||
parser.add_argument('--jerry-cmdline-minimal', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help='build minimal version of the jerry command line tool (%(choices)s; default: %(default)s)')
|
||||
parser.add_argument('--jerry-libc', metavar='X', choices=['ON', 'OFF'], default='ON', type=str.upper, help='build and use jerry-libc (%(choices)s; default: %(default)s)')
|
||||
parser.add_argument('--jerry-libm', metavar='X', choices=['ON', 'OFF'], default='ON', type=str.upper, help='build and use jerry-libm (%(choices)s; default: %(default)s)')
|
||||
parser.add_argument('--js-parser', metavar='X', choices=['ON', 'OFF'], default='ON', type=str.upper, help='enable js-parser (%(choices)s; default: %(default)s)')
|
||||
parser.add_argument('--link-lib', metavar='OPT', action='append', default=[], help='add custom library to be linked')
|
||||
parser.add_argument('--linker-flag', metavar='OPT', action='append', default=[], help='add custom linker flag')
|
||||
parser.add_argument('--lto', metavar='X', choices=['ON', 'OFF'], default='ON', type=str.upper, help='enable link-time optimizations (%(choices)s; default: %(default)s)')
|
||||
@ -95,6 +96,7 @@ def generate_build_options(arguments):
|
||||
build_options.append('-DJERRY_CMDLINE_MINIMAL=%s' % arguments.jerry_cmdline_minimal)
|
||||
build_options.append('-DJERRY_LIBC=%s' % arguments.jerry_libc)
|
||||
build_options.append('-DJERRY_LIBM=%s' % arguments.jerry_libm)
|
||||
build_options.append('-DFEATURE_JS_PARSER=%s' % arguments.js_parser)
|
||||
build_options.append('-DEXTERNAL_LINK_LIBS=' + ' '.join(arguments.link_lib))
|
||||
build_options.append('-DEXTERNAL_LINKER_FLAGS=' + ' '.join(arguments.linker_flag))
|
||||
build_options.append('-DENABLE_LTO=%s' % arguments.lto)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user