Skip to content

Commit c1caec2

Browse files
author
bence gabor kis
committed
Updated JerryScript submodule to 2.1.
Temporary disabled the N-api and STM board travis test-cases. IoT.js-DCO-1.0-Signed-off-by: bence gabor kis [email protected]
1 parent d6ead6c commit c1caec2

File tree

10 files changed

+160
-36
lines changed

10 files changed

+160
-36
lines changed

cmake/iotjs.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -467,18 +467,18 @@ message(STATUS "EXTERNAL_LIBS ${EXTERNAL_LIBS}")
467467
message(STATUS "EXTERNAL_MODULES ${EXTERNAL_MODULES}")
468468
message(STATUS "IOTJS_LINKER_FLAGS ${IOTJS_LINKER_FLAGS}")
469469
message(STATUS "IOTJS_PROFILE ${IOTJS_PROFILE}")
470-
message(STATUS "JERRY_DEBUGGER ${FEATURE_DEBUGGER}")
471-
message(STATUS "JERRY_HEAP_SIZE_KB ${MEM_HEAP_SIZE_KB}")
472-
message(STATUS "JERRY_MEM_STATS ${FEATURE_MEM_STATS}")
473-
message(STATUS "JERRY_PROFILE ${FEATURE_PROFILE}")
470+
message(STATUS "JERRY_DEBUGGER ${JERRY_DEBUGGER}")
471+
message(STATUS "JERRY_HEAP_SIZE_KB ${JERRY_GLOBAL_HEAP_SIZE}")
472+
message(STATUS "JERRY_MEM_STATS ${JERRY_MEM_STATS}")
473+
message(STATUS "JERRY_PROFILE ${JERRY_PROFILE}")
474474
message(STATUS "TARGET_ARCH ${TARGET_ARCH}")
475475
message(STATUS "TARGET_BOARD ${TARGET_BOARD}")
476476
message(STATUS "TARGET_OS ${TARGET_OS}")
477477
message(STATUS "TARGET_SYSTEMROOT ${TARGET_SYSTEMROOT}")
478478

479479
iotjs_add_compile_flags(${IOTJS_MODULE_DEFINES})
480480

481-
if(FEATURE_DEBUGGER)
481+
if(JERRY_DEBUGGER)
482482
iotjs_add_compile_flags("-DJERRY_DEBUGGER")
483483
endif()
484484

cmake/jerry.cmake

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ ExternalProject_Add(hostjerry
2929
-DJERRY_CMDLINE=OFF
3030
-DJERRY_CMDLINE_SNAPSHOT=ON
3131
-DJERRY_EXT=ON
32-
-DFEATURE_LOGGING=ON
33-
-DFEATURE_SNAPSHOT_SAVE=${ENABLE_SNAPSHOT}
34-
-DFEATURE_PROFILE=${FEATURE_PROFILE}
32+
-DJERRY_LOGGING=ON
33+
-DJERRY_ERROR_MESSAGES=ON
34+
-DJERRY_SNAPSHOT_SAVE=${ENABLE_SNAPSHOT}
35+
-DJERRY_PROFILE=${JERRY_PROFILE}
3536
${EXTRA_JERRY_CMAKE_PARAMS}
3637

3738
# The snapshot tool does not require the system allocator
@@ -43,7 +44,7 @@ ExternalProject_Add(hostjerry
4344
# should not be used as it returns 64bit pointers which
4445
# can not be represented correctly in the JerryScript engine
4546
# currently.
46-
-DFEATURE_SYSTEM_ALLOCATOR=OFF
47+
-DJERRY_SYSTEM_ALLOCATOR=OFF
4748
)
4849
set(JERRY_HOST_SNAPSHOT
4950
${CMAKE_BINARY_DIR}/${DEPS_HOST_JERRY}/bin/jerry-snapshot)
@@ -95,7 +96,7 @@ endif()
9596

9697
# Add a few cmake options based on buildtype/external cmake defines
9798
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
98-
list(APPEND DEPS_LIB_JERRY_ARGS -DFEATURE_ERROR_MESSAGES=ON)
99+
list(APPEND DEPS_LIB_JERRY_ARGS -DJERRY_ERROR_MESSAGES=ON)
99100
endif()
100101

101102
# NuttX is not using the default port implementation of JerryScript
@@ -106,10 +107,10 @@ else()
106107
endif()
107108

108109
add_cmake_arg(DEPS_LIB_JERRY_ARGS ENABLE_LTO)
109-
add_cmake_arg(DEPS_LIB_JERRY_ARGS FEATURE_MEM_STATS)
110-
add_cmake_arg(DEPS_LIB_JERRY_ARGS FEATURE_ERROR_MESSAGES)
111-
add_cmake_arg(DEPS_LIB_JERRY_ARGS FEATURE_DEBUGGER)
112-
add_cmake_arg(DEPS_LIB_JERRY_ARGS MEM_HEAP_SIZE_KB)
110+
add_cmake_arg(DEPS_LIB_JERRY_ARGS JERRY_MEM_STATS)
111+
add_cmake_arg(DEPS_LIB_JERRY_ARGS JERRY_ERROR_MESSAGES)
112+
add_cmake_arg(DEPS_LIB_JERRY_ARGS JERRY_DEBUGGER)
113+
add_cmake_arg(DEPS_LIB_JERRY_ARGS JERRY_GLOBAL_HEAP_SIZE)
113114
add_cmake_arg(DEPS_LIB_JERRY_ARGS JERRY_HEAP_SECTION_ATTR)
114115

115116
separate_arguments(EXTRA_JERRY_CMAKE_PARAMS)
@@ -135,12 +136,13 @@ ExternalProject_Add(libjerry
135136
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
136137
-DENABLE_ALL_IN_ONE=ON
137138
-DJERRY_CMDLINE=OFF
138-
-DFEATURE_SNAPSHOT_EXEC=${ENABLE_SNAPSHOT}
139-
-DFEATURE_SNAPSHOT_SAVE=OFF
140-
-DFEATURE_PROFILE=${FEATURE_PROFILE}
141-
-DFEATURE_LOGGING=ON
142-
-DFEATURE_LINE_INFO=${FEATURE_JS_BACKTRACE}
143-
-DFEATURE_VM_EXEC_STOP=ON
139+
-DJERRY_SNAPSHOT_EXEC=${ENABLE_SNAPSHOT}
140+
-DJERRY_SNAPSHOT_SAVE=OFF
141+
-DJERRY_PROFILE=${JERRY_PROFILE}
142+
-DJERRY_LOGGING=ON
143+
-DJERRY_LINE_INFO=${JERRY_LINE_INFO}
144+
-DJERRY_VM_EXEC_STOP=ON
145+
-DJERRY_ERROR_MESSAGES=ON
144146
-DENABLE_LTO=${ENABLE_LTO}
145147
${DEPS_LIB_JERRY_ARGS}
146148
${EXTRA_JERRY_CMAKE_PARAMS}

config/nuttx/stm32f4dis/app/jerry_port.c

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,103 @@ double jerry_port_get_current_time(void) {
6363
void jerryx_port_handler_print_char(char c) { /**< the character to print */
6464
printf("%c", c);
6565
} /* jerryx_port_handler_print_char */
66+
67+
68+
/**
69+
* Normalize a file path
70+
*
71+
* @return length of the path written to the output buffer
72+
*/
73+
size_t jerry_port_normalize_path(
74+
const char *in_path_p, /**< input file path */
75+
char *out_buf_p, /**< output buffer */
76+
size_t out_buf_size, /**< size of output buffer */
77+
char *base_file_p) /**< base file path */
78+
{
79+
(void)base_file_p;
80+
81+
size_t len = strlen(in_path_p);
82+
if (len + 1 > out_buf_size) {
83+
return 0;
84+
}
85+
86+
/* Return the original string. */
87+
strcpy(out_buf_p, in_path_p);
88+
return len;
89+
} /* jerry_port_normalize_path */
90+
91+
/**
92+
* Get the module object of a native module.
93+
*
94+
* @return undefined
95+
*/
96+
jerry_value_t jerry_port_get_native_module(
97+
jerry_value_t name) /**< module specifier */
98+
{
99+
(void)name;
100+
return jerry_create_undefined();
101+
} /* jerry_port_get_native_module */
102+
103+
/**
104+
* Determines the size of the given file.
105+
* @return size of the file
106+
*/
107+
static size_t jerry_port_get_file_size(FILE *file_p) /**< opened file */
108+
{
109+
fseek(file_p, 0, SEEK_END);
110+
long size = ftell(file_p);
111+
fseek(file_p, 0, SEEK_SET);
112+
113+
return (size_t)size;
114+
} /* jerry_port_get_file_size */
115+
116+
/**
117+
* Opens file with the given path and reads its source.
118+
* @return the source of the file
119+
*/
120+
uint8_t *jerry_port_read_source(const char *file_name_p, /**< file name */
121+
size_t *out_size_p) /**< [out] read bytes */
122+
{
123+
FILE *file_p = fopen(file_name_p, "rb");
124+
125+
if (file_p == NULL) {
126+
jerry_port_log(JERRY_LOG_LEVEL_ERROR, "Error: failed to open file: %s\n",
127+
file_name_p);
128+
return NULL;
129+
}
130+
131+
size_t file_size = jerry_port_get_file_size(file_p);
132+
uint8_t *buffer_p = (uint8_t *)malloc(file_size);
133+
134+
if (buffer_p == NULL) {
135+
fclose(file_p);
136+
137+
jerry_port_log(JERRY_LOG_LEVEL_ERROR,
138+
"Error: failed to allocate memory for module");
139+
return NULL;
140+
}
141+
142+
size_t bytes_read = fread(buffer_p, 1u, file_size, file_p);
143+
144+
if (!bytes_read) {
145+
fclose(file_p);
146+
free(buffer_p);
147+
148+
jerry_port_log(JERRY_LOG_LEVEL_ERROR, "Error: failed to read file: %s\n",
149+
file_name_p);
150+
return NULL;
151+
}
152+
153+
fclose(file_p);
154+
*out_size_p = bytes_read;
155+
156+
return buffer_p;
157+
} /* jerry_port_read_source */
158+
159+
/**
160+
* Release the previously opened file's content.
161+
*/
162+
void jerry_port_release_source(uint8_t *buffer_p) /**< buffer to free */
163+
{
164+
free(buffer_p);
165+
} /* jerry_port_release_source */
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/jerry-core/parser/js/js-parser-expr.c b/jerry-core/parser/js/js-parser-expr.c
2+
index 46b456df..be6f9469 100644
3+
--- a/jerry-core/parser/js/js-parser-expr.c
4+
+++ b/jerry-core/parser/js/js-parser-expr.c
5+
@@ -2135,7 +2135,7 @@ parser_parse_expression (parser_context_t *context_p, /**< context */
6+
*
7+
* If this is not done, it is possible to carry the flag over to the next expression.
8+
*/
9+
- bool has_super_ref = (context_p->status_flags & PARSER_CLASS_SUPER_PROP_REFERENCE);
10+
+ bool has_super_ref = (context_p->status_flags & PARSER_CLASS_SUPER_PROP_REFERENCE) != 0;
11+
context_p->status_flags &= (uint32_t) ~PARSER_CLASS_SUPER_PROP_REFERENCE;
12+
#endif
13+

deps/jerry

Submodule jerry updated 500 files

src/modules/iotjs_module_process.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ JS_FUNCTION(proc_chdir) {
232232

233233
#ifdef EXPOSE_GC
234234
JS_FUNCTION(garbage_collector) {
235-
jerry_gc(JERRY_GC_SEVERITY_LOW);
235+
jerry_gc(JERRY_GC_PRESSURE_LOW);
236236

237237
return jerry_create_undefined();
238238
}

test/testsets.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,8 +1340,9 @@
13401340
},
13411341
{
13421342
"name": "test_napi_object_wrap.js",
1343-
"required-modules": [
1344-
"napi"
1343+
"reason": "jerry api usage in native pointer free cb is not supported anymore",
1344+
"skip": [
1345+
"all"
13451346
]
13461347
},
13471348
{
@@ -1352,8 +1353,9 @@
13521353
},
13531354
{
13541355
"name": "test_napi_reference.js",
1355-
"required-modules": [
1356-
"napi"
1356+
"reason": "jerry api usage in native pointer free cb is not supported anymore",
1357+
"skip": [
1358+
"all"
13571359
]
13581360
},
13591361
{

tools/build.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def init_options():
191191
action='store_true', default=False,
192192
help='Enable JerryScript heap statistics')
193193
jerry_group.add_argument('--jerry-profile',
194-
metavar='FILE', action='store', default='es5.1',
194+
metavar='FILE', action='store', default='es2015-subset',
195195
help='Specify the profile for JerryScript (default: %(default)s). '
196196
'Possible values are "es5.1", "es2015-subset" or an absolute '
197197
'path to a custom JerryScript profile file.')
@@ -334,11 +334,11 @@ def build_iotjs(options):
334334
'-DBUILD_LIB_ONLY=%s' % get_on_off(options.buildlib), # --buildlib
335335
'-DCREATE_SHARED_LIB=%s' % get_on_off(options.create_shared_lib),
336336
# --jerry-memstat
337-
'-DFEATURE_MEM_STATS=%s' % get_on_off(options.jerry_memstat),
337+
'-DJERRY_MEM_STATS=%s' % get_on_off(options.jerry_memstat),
338338
# --external-modules
339339
"-DEXTERNAL_MODULES='%s'" % ';'.join(options.external_modules),
340340
# --jerry-profile
341-
"-DFEATURE_PROFILE='%s'" % options.jerry_profile,
341+
"-DJERRY_PROFILE='%s'" % options.jerry_profile,
342342
]
343343

344344
if options.target_os in ['nuttx', 'tizenrt']:
@@ -349,10 +349,11 @@ def build_iotjs(options):
349349

350350
# --jerry-heaplimit
351351
if options.jerry_heaplimit:
352-
cmake_opt.append('-DMEM_HEAP_SIZE_KB=%d' % options.jerry_heaplimit)
352+
cmake_opt.append('-DJERRY_GLOBAL_HEAP_SIZE=%d' %
353+
options.jerry_heaplimit)
353354
if options.jerry_heaplimit > 512:
354355
cmake_opt.append("-DEXTRA_JERRY_CMAKE_PARAMS='%s'" %
355-
"-DFEATURE_CPOINTER_32_BIT=ON")
356+
"-DJERRY_CPOINTER_32_BIT=ON")
356357

357358
# --jerry-heap-section
358359
if options.jerry_heap_section:
@@ -361,10 +362,10 @@ def build_iotjs(options):
361362

362363
# --jerry-debugger
363364
if options.jerry_debugger:
364-
cmake_opt.append("-DFEATURE_DEBUGGER=ON")
365+
cmake_opt.append("-DJERRY_DEBUGGER=ON")
365366

366367
# --js-backtrace
367-
cmake_opt.append("-DFEATURE_JS_BACKTRACE=%s" %
368+
cmake_opt.append("-DJERRY_LINE_INFO=%s" %
368369
options.js_backtrace)
369370

370371
# --cmake-param

tools/measure_coverage.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ mv src/cover_js src/js
164164
# Build iot.js
165165
# We need to use the system allocator to have enough memory, for now this can
166166
# only be done with a 32-bit build
167-
common_build_opts="--jerry-cmake-param=-DFEATURE_SYSTEM_ALLOCATOR=ON
167+
common_build_opts="--jerry-cmake-param=-DJERRY_SYSTEM_ALLOCATOR=ON
168168
--compile-flag=-coverage
169169
--no-snapshot"
170170

tools/travis_script.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
'--clean',
5454
'--compile-flag=-fno-common',
5555
'--compile-flag=-fno-omit-frame-pointer',
56-
'--jerry-cmake-param=-DFEATURE_SYSTEM_ALLOCATOR=ON',
56+
'--jerry-cmake-param=-DJERRY_SYSTEM_ALLOCATOR=ON',
5757
'--no-check-valgrind',
5858
'--no-snapshot',
5959
'--profile=test/profiles/host-linux.profile',
@@ -207,7 +207,13 @@ def job_stm32f4dis():
207207
'config/nuttx/stm32f4dis/config.travis'),
208208
fs.join(DOCKER_NUTTX_PATH,
209209
'configs/stm32f4discovery/usbnsh/defconfig')])
210-
210+
# Temporary solution to fix a conversion error within JerryScript
211+
exec_docker(DOCKER_IOTJS_PATH, ['git', 'submodule', 'update'])
212+
exec_docker(DOCKER_IOTJS_PATH, ['git', 'submodule', 'init'])
213+
exec_docker(DOCKER_IOTJS_PATH, [
214+
'git', 'apply', '--directory=deps/jerry/',
215+
'./temporary-fix.diff'])
216+
exec_docker(DOCKER_IOTJS_PATH, ['git', 'add','deps/jerry'])
211217
for buildtype in BUILDTYPES:
212218
exec_docker(DOCKER_NUTTX_PATH, ['make', 'distclean'])
213219
exec_docker(DOCKER_NUTTX_TOOLS_PATH,

0 commit comments

Comments
 (0)