Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jerryscript to master #4

Merged
merged 7 commits into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ Configuration variables

Set this if action required when snaps are updated, for example to rebuild SPIFFS image or update application.

.. envvar:: JERRY_WEB_COMPILER

(read-only)

Location of pre-compiled web compiler. See ``Advanced-Jsvm`` sample for example usage.


Credits
-------
Expand Down
13 changes: 10 additions & 3 deletions component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ endif
JERRY_WEB_COMPILER := $(COMPONENT_PATH)/jsc/$(JERRY_PROFILE)

COMPONENT_CFLAGS += \
-Wno-error=unused-function \
-DJERRY_GLOBAL_HEAP_SIZE=$(JERRY_GLOBAL_HEAP_SIZE) \
-DJERRY_LCACHE=0 \
-DJERRY_PARSER=0 \
Expand All @@ -49,17 +50,23 @@ COMPONENT_CFLAGS += \
# Build version of tool compatible with library
DEBUG_VARS += JERRY_SNAPSHOT_TOOL
JERRY_BUILD_DIR := $(COMPONENT_PATH)/jerryscript/out/$(call CalculateVariantHash,JERRY_COMPILER_FLAGS)
JERRY_SNAPSHOT_TOOL := $(JERRY_BUILD_DIR)/bin/jerry-snapshot$(TOOL_EXT)

ifeq ($(UNAME),Windows)
JERRY_SNAPSHOT_TOOL := $(JERRY_BUILD_DIR)/bin/MinSizeRel/jerry-snapshot.exe
else
JERRY_SNAPSHOT_TOOL := $(JERRY_BUILD_DIR)/bin/jerry-snapshot
JERRY_CMAKE_PARAMS := \
--cmake-param "-GMSYS Makefiles" \
--compile-flag "-I $(JERRYSCRIPT_ROOT)/../src/include" \
--compile-flag "-std=gnu11 " \
--compile-flag "-Wno-error=unused-parameter " \
--compile-flag "-D_POSIX_C_SOURCE=1 "
endif

$(JERRY_SNAPSHOT_TOOL):
$(Q) $(PYTHON) $(JERRYSCRIPT_ROOT)/tools/build.py \
--lto OFF \
--jerry-cmdline-snapshot ON \
--builddir "$(JERRY_BUILD_DIR)" \
$(JERRY_CMAKE_PARAMS) \
$(patsubst %,--compile-flag "-D %",$(JERRY_COMPILER_FLAGS))

jerryscript-clean: jerry-tools-clean
Expand Down
1 change: 1 addition & 0 deletions emscripten-snapshot-compiler/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ build:
--lto OFF \
--strip OFF \
--profile $(JERRY_PROFILE) \
--compile-flag "-Wno-implicit-int-float-conversion " \
--builddir $(BUILD_DIR)/jerryscript
mkdir -p $(BUILD_DIR)
cmake --verbose -DCMAKE_BUILD_TYPE=MinSizeRel -DJERRY_PROFILE=$(JERRY_PROFILE) -S . -B $(BUILD_DIR)
Expand Down
7 changes: 5 additions & 2 deletions emscripten-snapshot-compiler/emscripten-snapshot-compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ emscripten_snapshot_compiler_compile (const jerry_char_t *source_p, jerry_size_t
// Call jerry_parse () first, because this return errors if there are any,
// while jerry_parse_and_save_snapshot () does not return errors...
jerry_init (JERRY_INIT_EMPTY);
jerry_value_t rv = jerry_parse (NULL, 0, source_p, source_size, is_strict ? JERRY_PARSE_STRICT_MODE: JERRY_PARSE_NO_OPTS);
jerry_parse_options_t parse_options = {
.options = is_strict ? JERRY_PARSE_STRICT_MODE: JERRY_PARSE_NO_OPTS,
};
jerry_value_t rv = jerry_parse (source_p, source_size, &parse_options);
if (jerry_value_is_error (rv))
{
jerry_get_value_from_error (rv, false);
Expand All @@ -67,7 +70,7 @@ emscripten_snapshot_compiler_compile (const jerry_char_t *source_p, jerry_size_t
// No errors, let's create the snapshot:
uint32_t generate_snapshot_opts = 0;
(void)is_for_global;
jerry_value_t generate_result = jerry_generate_snapshot (NULL, 0, source_p, source_size, generate_snapshot_opts,
jerry_value_t generate_result = jerry_generate_snapshot (rv, generate_snapshot_opts,
buffer_p, buffer_size);

size_t snapshot_size = (size_t) jerry_get_number_value (generate_result);
Expand Down
2 changes: 1 addition & 1 deletion jerryscript
Submodule jerryscript updated 735 files
67 changes: 67 additions & 0 deletions jerryscript.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
diff --git a/jerry-core/parser/js/js-parser.c b/jerry-core/parser/js/js-parser.c
index b55baed5..bd6b41da 100644
--- a/jerry-core/parser/js/js-parser.c
+++ b/jerry-core/parser/js/js-parser.c
@@ -3356,12 +3356,9 @@ parser_parse_script (void *source_p, /**< source code */

return bytecode_p;
#else /* !JERRY_PARSER */
- JERRY_UNUSED (arg_list_p);
- JERRY_UNUSED (arg_list_size);
JERRY_UNUSED (source_p);
- JERRY_UNUSED (source_size);
JERRY_UNUSED (parse_opts);
- JERRY_UNUSED (resource_name);
+ JERRY_UNUSED (options_p);

ecma_raise_syntax_error (ECMA_ERR_PARSER_NOT_SUPPORTED);
return NULL;
diff --git a/jerry-core/ecma/operations/ecma-eval.c b/jerry-core/ecma/operations/ecma-eval.c
index e4a2d734..cd544844 100644
--- a/jerry-core/ecma/operations/ecma-eval.c
+++ b/jerry-core/ecma/operations/ecma-eval.c
@@ -94,8 +94,7 @@ ecma_op_eval_chars_buffer (void *source_p, /**< source code */

return vm_run_eval (bytecode_p, parse_opts);
#else /* !JERRY_PARSER */
- JERRY_UNUSED (code_p);
- JERRY_UNUSED (code_buffer_size);
+ JERRY_UNUSED (source_p);
JERRY_UNUSED (parse_opts);

return ecma_raise_syntax_error (ECMA_ERR_PARSER_NOT_SUPPORTED);
diff --git a/jerry-core/ecma/base/ecma-helpers.c b/jerry-core/ecma/base/ecma-helpers.c
index bd25d9d3..cce169bb 100644
--- a/jerry-core/ecma/base/ecma-helpers.c
+++ b/jerry-core/ecma/base/ecma-helpers.c
@@ -1626,11 +1626,13 @@ ecma_script_get_from_value (ecma_value_t value) /**< compiled code */
{
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;

+#if JERRY_PARSER
if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_SCRIPT)
{
bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value);
break;
}
+#endif

#if JERRY_MODULE_SYSTEM
if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_MODULE)
diff --git a/jerry-core/api/jerryscript.c b/jerry-core/api/jerryscript.c
index 13e3fd65..32444cd6 100644
--- a/jerry-core/api/jerryscript.c
+++ b/jerry-core/api/jerryscript.c
@@ -564,10 +564,12 @@ jerry_run (const jerry_value_t func_val) /**< function to run */

ecma_object_t *object_p = ecma_get_object_from_value (func_val);

+#if JERRY_PARSER
if (!ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_SCRIPT))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_WRONG_ARGS_MSG));
}
+#endif

ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;

Loading