Skip to content
Closed
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
10 changes: 5 additions & 5 deletions cmake/iotjs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -467,18 +467,18 @@ message(STATUS "EXTERNAL_LIBS ${EXTERNAL_LIBS}")
message(STATUS "EXTERNAL_MODULES ${EXTERNAL_MODULES}")
message(STATUS "IOTJS_LINKER_FLAGS ${IOTJS_LINKER_FLAGS}")
message(STATUS "IOTJS_PROFILE ${IOTJS_PROFILE}")
message(STATUS "JERRY_DEBUGGER ${FEATURE_DEBUGGER}")
message(STATUS "JERRY_HEAP_SIZE_KB ${MEM_HEAP_SIZE_KB}")
message(STATUS "JERRY_MEM_STATS ${FEATURE_MEM_STATS}")
message(STATUS "JERRY_PROFILE ${FEATURE_PROFILE}")
message(STATUS "JERRY_DEBUGGER ${JERRY_DEBUGGER}")
message(STATUS "JERRY_HEAP_SIZE_KB ${JERRY_GLOBAL_HEAP_SIZE}")
message(STATUS "JERRY_MEM_STATS ${JERRY_MEM_STATS}")
message(STATUS "JERRY_PROFILE ${JERRY_PROFILE}")
message(STATUS "TARGET_ARCH ${TARGET_ARCH}")
message(STATUS "TARGET_BOARD ${TARGET_BOARD}")
message(STATUS "TARGET_OS ${TARGET_OS}")
message(STATUS "TARGET_SYSTEMROOT ${TARGET_SYSTEMROOT}")

iotjs_add_compile_flags(${IOTJS_MODULE_DEFINES})

if(FEATURE_DEBUGGER)
if(JERRY_DEBUGGER)
iotjs_add_compile_flags("-DJERRY_DEBUGGER")
endif()

Expand Down
32 changes: 17 additions & 15 deletions cmake/jerry.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ ExternalProject_Add(hostjerry
-DJERRY_CMDLINE=OFF
-DJERRY_CMDLINE_SNAPSHOT=ON
-DJERRY_EXT=ON
-DFEATURE_LOGGING=ON
-DFEATURE_SNAPSHOT_SAVE=${ENABLE_SNAPSHOT}
-DFEATURE_PROFILE=${FEATURE_PROFILE}
-DJERRY_LOGGING=ON
-DJERRY_ERROR_MESSAGES=ON
-DJERRY_SNAPSHOT_SAVE=${ENABLE_SNAPSHOT}
-DJERRY_PROFILE=${JERRY_PROFILE}
${EXTRA_JERRY_CMAKE_PARAMS}

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

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

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

add_cmake_arg(DEPS_LIB_JERRY_ARGS ENABLE_LTO)
add_cmake_arg(DEPS_LIB_JERRY_ARGS FEATURE_MEM_STATS)
add_cmake_arg(DEPS_LIB_JERRY_ARGS FEATURE_ERROR_MESSAGES)
add_cmake_arg(DEPS_LIB_JERRY_ARGS FEATURE_DEBUGGER)
add_cmake_arg(DEPS_LIB_JERRY_ARGS MEM_HEAP_SIZE_KB)
add_cmake_arg(DEPS_LIB_JERRY_ARGS JERRY_MEM_STATS)
add_cmake_arg(DEPS_LIB_JERRY_ARGS JERRY_ERROR_MESSAGES)
add_cmake_arg(DEPS_LIB_JERRY_ARGS JERRY_DEBUGGER)
add_cmake_arg(DEPS_LIB_JERRY_ARGS JERRY_GLOBAL_HEAP_SIZE)
add_cmake_arg(DEPS_LIB_JERRY_ARGS JERRY_HEAP_SECTION_ATTR)

separate_arguments(EXTRA_JERRY_CMAKE_PARAMS)
Expand All @@ -135,12 +136,13 @@ ExternalProject_Add(libjerry
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DENABLE_ALL_IN_ONE=ON
-DJERRY_CMDLINE=OFF
-DFEATURE_SNAPSHOT_EXEC=${ENABLE_SNAPSHOT}
-DFEATURE_SNAPSHOT_SAVE=OFF
-DFEATURE_PROFILE=${FEATURE_PROFILE}
-DFEATURE_LOGGING=ON
-DFEATURE_LINE_INFO=${FEATURE_JS_BACKTRACE}
-DFEATURE_VM_EXEC_STOP=ON
-DJERRY_SNAPSHOT_EXEC=${ENABLE_SNAPSHOT}
-DJERRY_SNAPSHOT_SAVE=OFF
-DJERRY_PROFILE=${JERRY_PROFILE}
-DJERRY_LOGGING=ON
-DJERRY_LINE_INFO=${JERRY_LINE_INFO}
-DJERRY_VM_EXEC_STOP=ON
-DJERRY_ERROR_MESSAGES=ON
-DENABLE_LTO=${ENABLE_LTO}
${DEPS_LIB_JERRY_ARGS}
${EXTRA_JERRY_CMAKE_PARAMS}
Expand Down
100 changes: 100 additions & 0 deletions config/nuttx/stm32f4dis/app/jerry_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,103 @@ double jerry_port_get_current_time(void) {
void jerryx_port_handler_print_char(char c) { /**< the character to print */
printf("%c", c);
} /* jerryx_port_handler_print_char */


/**
* Normalize a file path
*
* @return length of the path written to the output buffer
*/
size_t jerry_port_normalize_path(
const char *in_path_p, /**< input file path */
char *out_buf_p, /**< output buffer */
size_t out_buf_size, /**< size of output buffer */
char *base_file_p) /**< base file path */
{
(void)base_file_p;

size_t len = strlen(in_path_p);
if (len + 1 > out_buf_size) {
return 0;
}

/* Return the original string. */
strcpy(out_buf_p, in_path_p);
return len;
} /* jerry_port_normalize_path */

/**
* Get the module object of a native module.
*
* @return undefined
*/
jerry_value_t jerry_port_get_native_module(
jerry_value_t name) /**< module specifier */
{
(void)name;
return jerry_create_undefined();
} /* jerry_port_get_native_module */

/**
* Determines the size of the given file.
* @return size of the file
*/
static size_t jerry_port_get_file_size(FILE *file_p) /**< opened file */
{
fseek(file_p, 0, SEEK_END);
long size = ftell(file_p);
fseek(file_p, 0, SEEK_SET);

return (size_t)size;
} /* jerry_port_get_file_size */

/**
* Opens file with the given path and reads its source.
* @return the source of the file
*/
uint8_t *jerry_port_read_source(const char *file_name_p, /**< file name */
size_t *out_size_p) /**< [out] read bytes */
{
FILE *file_p = fopen(file_name_p, "rb");

if (file_p == NULL) {
jerry_port_log(JERRY_LOG_LEVEL_ERROR, "Error: failed to open file: %s\n",
file_name_p);
return NULL;
}

size_t file_size = jerry_port_get_file_size(file_p);
uint8_t *buffer_p = (uint8_t *)malloc(file_size);

if (buffer_p == NULL) {
fclose(file_p);

jerry_port_log(JERRY_LOG_LEVEL_ERROR,
"Error: failed to allocate memory for module");
return NULL;
}

size_t bytes_read = fread(buffer_p, 1u, file_size, file_p);

if (!bytes_read) {
fclose(file_p);
free(buffer_p);

jerry_port_log(JERRY_LOG_LEVEL_ERROR, "Error: failed to read file: %s\n",
file_name_p);
return NULL;
}

fclose(file_p);
*out_size_p = bytes_read;

return buffer_p;
} /* jerry_port_read_source */

/**
* Release the previously opened file's content.
*/
void jerry_port_release_source(uint8_t *buffer_p) /**< buffer to free */
{
free(buffer_p);
} /* jerry_port_release_source */
13 changes: 13 additions & 0 deletions config/nuttx/stm32f4dis/temporary-fix.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/jerry-core/parser/js/js-parser-expr.c b/jerry-core/parser/js/js-parser-expr.c
index 46b456df..be6f9469 100644
--- a/jerry-core/parser/js/js-parser-expr.c
+++ b/jerry-core/parser/js/js-parser-expr.c
@@ -2135,7 +2135,7 @@ parser_parse_expression (parser_context_t *context_p, /**< context */
*
* If this is not done, it is possible to carry the flag over to the next expression.
*/
- bool has_super_ref = (context_p->status_flags & PARSER_CLASS_SUPER_PROP_REFERENCE);
+ bool has_super_ref = (context_p->status_flags & PARSER_CLASS_SUPER_PROP_REFERENCE) != 0;
context_p->status_flags &= (uint32_t) ~PARSER_CLASS_SUPER_PROP_REFERENCE;
#endif

2 changes: 1 addition & 1 deletion deps/jerry
Submodule jerry updated 500 files
2 changes: 1 addition & 1 deletion src/modules/iotjs_module_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ JS_FUNCTION(proc_chdir) {

#ifdef EXPOSE_GC
JS_FUNCTION(garbage_collector) {
jerry_gc(JERRY_GC_SEVERITY_LOW);
jerry_gc(JERRY_GC_PRESSURE_LOW);

return jerry_create_undefined();
}
Expand Down
10 changes: 6 additions & 4 deletions test/testsets.json
Original file line number Diff line number Diff line change
Expand Up @@ -1340,8 +1340,9 @@
},
{
"name": "test_napi_object_wrap.js",
"required-modules": [
"napi"
"reason": "jerry api usage is not used currently at the moment ",
"skip": [
"all"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add a reason for the skip?

]
},
{
Expand All @@ -1352,8 +1353,9 @@
},
{
"name": "test_napi_reference.js",
"required-modules": [
"napi"
"reason": "jerry api usage is not used currently at the moment",
"skip": [
"all"
]
},
{
Expand Down
15 changes: 8 additions & 7 deletions tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def init_options():
action='store_true', default=False,
help='Enable JerryScript heap statistics')
jerry_group.add_argument('--jerry-profile',
metavar='FILE', action='store', default='es5.1',
metavar='FILE', action='store', default='es2015-subset',
help='Specify the profile for JerryScript (default: %(default)s). '
'Possible values are "es5.1", "es2015-subset" or an absolute '
'path to a custom JerryScript profile file.')
Expand Down Expand Up @@ -334,11 +334,11 @@ def build_iotjs(options):
'-DBUILD_LIB_ONLY=%s' % get_on_off(options.buildlib), # --buildlib
'-DCREATE_SHARED_LIB=%s' % get_on_off(options.create_shared_lib),
# --jerry-memstat
'-DFEATURE_MEM_STATS=%s' % get_on_off(options.jerry_memstat),
'-DJERRY_MEM_STATS=%s' % get_on_off(options.jerry_memstat),
# --external-modules
"-DEXTERNAL_MODULES='%s'" % ';'.join(options.external_modules),
# --jerry-profile
"-DFEATURE_PROFILE='%s'" % options.jerry_profile,
"-DJERRY_PROFILE='%s'" % options.jerry_profile,
]

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

# --jerry-heaplimit
if options.jerry_heaplimit:
cmake_opt.append('-DMEM_HEAP_SIZE_KB=%d' % options.jerry_heaplimit)
cmake_opt.append('-DJERRY_GLOBAL_HEAP_SIZE=%d' %
options.jerry_heaplimit)
if options.jerry_heaplimit > 512:
cmake_opt.append("-DEXTRA_JERRY_CMAKE_PARAMS='%s'" %
"-DFEATURE_CPOINTER_32_BIT=ON")
"-DJERRY_CPOINTER_32_BIT=ON")

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

# --jerry-debugger
if options.jerry_debugger:
cmake_opt.append("-DFEATURE_DEBUGGER=ON")
cmake_opt.append("-DJERRY_DEBUGGER=ON")

# --js-backtrace
cmake_opt.append("-DFEATURE_JS_BACKTRACE=%s" %
cmake_opt.append("-DJERRY_LINE_INFO=%s" %
options.js_backtrace)

# --cmake-param
Expand Down
2 changes: 1 addition & 1 deletion tools/measure_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ mv src/cover_js src/js
# Build iot.js
# We need to use the system allocator to have enough memory, for now this can
# only be done with a 32-bit build
common_build_opts="--jerry-cmake-param=-DFEATURE_SYSTEM_ALLOCATOR=ON
common_build_opts="--jerry-cmake-param=-DJERRY_SYSTEM_ALLOCATOR=ON
--compile-flag=-coverage
--no-snapshot"

Expand Down
10 changes: 8 additions & 2 deletions tools/travis_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
'--clean',
'--compile-flag=-fno-common',
'--compile-flag=-fno-omit-frame-pointer',
'--jerry-cmake-param=-DFEATURE_SYSTEM_ALLOCATOR=ON',
'--jerry-cmake-param=-DJERRY_SYSTEM_ALLOCATOR=ON',
'--no-check-valgrind',
'--no-snapshot',
'--profile=test/profiles/host-linux.profile',
Expand Down Expand Up @@ -207,7 +207,13 @@ def job_stm32f4dis():
'config/nuttx/stm32f4dis/config.travis'),
fs.join(DOCKER_NUTTX_PATH,
'configs/stm32f4discovery/usbnsh/defconfig')])

# Temporary solution to fix a conversion error within JerryScript
exec_docker(DOCKER_IOTJS_PATH, ['git', 'submodule', 'update'])
exec_docker(DOCKER_IOTJS_PATH, ['git', 'submodule', 'init'])
exec_docker(DOCKER_IOTJS_PATH, [
'git', 'apply', '--directory=deps/jerry/',
'./config/nuttx/stm32f4dis/temporary-fix.diff'])
exec_docker(DOCKER_IOTJS_PATH, ['git', 'add','deps/jerry'])
for buildtype in BUILDTYPES:
exec_docker(DOCKER_NUTTX_PATH, ['make', 'distclean'])
exec_docker(DOCKER_NUTTX_TOOLS_PATH,
Expand Down