For 64 bit pointers, 0xffffffff as end-of-list marker pointer does
not work, as the marker is expected to be greater than the start
address of the heap area (and also max 0xffffffff away), but on 64
bit systems, the heap can start on higher addresses, i.e., above
0x100000000.
This patch changes JMEM_HEAP_END_OF_LIST from pointer to offset.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
- Fix some style issue, typos, and examples
- Follow the variable naming conventions
- Fix tables both in the project and on the webpage
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
- REPL mode also prints each error messages, not only each return values.
- If read_file fails, execution stops right away.
JerryScript-DCO-1.0-Signed-off-by: Youngil Choi duddlf.choi@samsung.com
Related PR: #1276
Since RegExp.protytype.exec doesn't change the ret_value any more when
filling the result array, its empty value check code can be removed.
JerryScript-DCO-1.0-Signed-off-by: Youngil Choi duddlf.choi@samsung.com
The original implementation used shell facility, but it was designed for
a unix shell like input, and automatically tokenized it into
space-separated "words", with limit of 10 (i.e. 9 spaces per line). For
JavaScript input, it is quite easy to have more than 9 spaces per line,
and get error:
Too many parameters (max 10)
After consultation with upstream
(https://jira.zephyrproject.org/browse/ZEP-532) it was decided that the
best approach is to skip using shell facility and use Zephyr console
facility. That however requires some Zephyr-specific boilerplate code.
This code was implemented as reusable modules in
https://github.com/pfalcon/zephyr_console_helpers repository, to be
usable for other console-based projects too. zephyr_getline.h/c in this
commits are direct imports from this repository.
JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
This patch fixes the failing unittests, which fails in 32-bit mode.
These compiler-options adjusted through the default toolchain file.
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
This is now required, as Zephyr for frdm_k64f is built with hard float ABI.
JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
Zephyr SDK 0.8.2 contains newlib 2.4.0 which doesn't provide gettimeofday()
declaration by default, but needs _XOPEN_SOURCE defined for this. While
this is definitely an issue with newlib 2.4.0 (to be fixed in one of the
next releases), defining _XOPEN_SOURCE is quite a harmless workaround.
JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
Apple does not support staticaly built applications on OSX, and all
dynamically built apps have to be linked against the System lib
(i.e., `-static` should not be used and `-lSystem` is a must).
As System contains all libc and libm functions, building (and
linking) the minimal jerry-libc and jerry-libm libs makes no sense.
Moreover, if JERRY_LIBC is ON, the compiler will use the jerry-libc
headers but will link the libc functions from System, which causes
heavy confusion and segfaults at run time.
Thus, this patch changes the build system to disable the building
of jerry-libc and jerry-libm, and enables the use of system
libraries when building on OSX.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Remove "-I/home/.../jerryscript/jerry-libc/__TARGET_HOST" and
"-D__TARGET_HOST" from compiler command line, they don't add
anything useful.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
The Math.pow implementation relies on libm's pow. However, the ISO C
and ES5.1 standards differ on pow:
* `x ** NAN` is NAN in ES but `+1 ** y` is 1 in C
* `+-1 ** +-INF` is NAN in ES but 1 in C
This patch:
* Modifies the Math.pow implementation to handle the special cases
instead calling pow.
* Adds a test case to jerry-test-suite as it did not test
`Math.pow(1,NaN)`.
* Fixes jerry-libm's pow, as it was not standard conforming, which
helped hiding the error in Math.pow.
* Updates the unit test for libm.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
The manual of `mktemp` states that "TEMPLATE must contain at least
3 consecutive 'X's in last component." Linux implementation seems
to be relaxed about this and accepts and rewrites X's even inside
the template, but mktemp of OSX is more strict and handles trailing
X's only. This patch makes sure that mktemp templates work on both
OS's.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This patch:
* Ensures that all calls to `jerry_port_log` in jerry-core happen
via macros defined in jrt.h. Also, it unifies the names of those
macros: as `JERRY_ERROR_MSG` and `JERRY_WARNING_MSG` gave a good
pattern that was well aligned with the naming scheme of the log
level enum, `JERRY_DLOG` and `JERRY_DDLOG` were rewritten to
`JERRY_DEBUG_MSG` and `JERRY_TRACE_MSG`.
* Ensures that all debug logging code parts of jerry-core (i.e.,
memory statistics, JS byte-code dumps, and RegExp byte-code
dumps) are guarded by macros: `JMEM_STATS`,
`PARSER_DUMP_BYTE_CODE`, and `REGEXP_DUMP_BYTE_CODE`, which in
turn are controled by cmake build system feature flags
`FEATURE_MEM_STATS`, `FEATURE_PARSER_DUMP`, and
`FEATURE_REGEXP_DUMP`.
* Ensures that all debug logging functionalities can be controled
during run time (provided that they were enabled during build
time): the engine has `JERRY_INIT_MEM_STATS[_SEPARATE]`,
`JERRY_INIT_SHOW_OPCODES`, `JERRY_INIT_SHOW_REGEXP_OPCODES` init
flags, and the default unix/linux command line app has
corresponding command line switches.`
* Drops `FEATURE_LOG`, `JERRY_ENABLE_LOG`, and
`JERRY_INIT_ENABLE_LOG`, as their name was misleadingly general,
even though they mostly controled the regexp engine only. The
above-mentioned `*REGEXP*` things mostly act as their
replacements.
* Updates build, test, and measurement tool scripts, and
documentation.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Unnecessary to set CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR, these values
are set by default. It also allows to use any C99-compliant compiler by using
the default CC enviroment variable or by setting the CMAKE_C_COMPILER value
using the build script's --cmake-param argument.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
- Update the API changes in mbed targets
- Build fix for mbed target after the build system patch.
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
The `cmake` directory already contains several toolchain files for
various platforms (operating system + architecture). However,
`tools/build.py` does not define a toolchain file for cmake unless
explicitly specified. This patch changes the script to look into
the `cmake` directory for a file named
`toolchain_$(os)_$(arch).cmake` and, if found, pass that to cmake
by default.
OS and arch are determined by `os.uname()`. As Linux on Raspberry
Pi identifies itself as "armv7l", the legacy "armv7l-hf" arch name
is shortened to "armv7l". This way, building jerry on RPi
(natively, not cross) becomes possible by simply running
`tools/build.py` without any extra options.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
The fact that the JS parser had been developed as a separate
component for a while is still visible from some macros that mirror
things from JRT. This patch removes those duplicates and makes the
JS parser rely on jrt.h. (The removed macros are: `PARSER_DEBUG`,
`PARSER_INLINE`, `PARSER_NOINLINE`.)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
- Zephyr now requires two passes to create the configuration for the cross compiling
- Added the missing bits required to build a valid new jerryscript minimal configuration
JerryScript-DCO-1.0-Signed-off-by: Sergio Martinez sergio.martinez.rodriguez@intel.com
CMakeLists already contains macros to ease adding compilation and
warning flags. This patch:
* Ensures that they are used whereever possible.
* Adds more macros to help with other flags as well.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
`jrt_read_from_buffer_by_offset` is not used anywhere in the code
while `jrt_write_to_buffer_by_offset` is only used by snapshot
saving functions. Thus, this patch removes the read variant
completely and moves the write variant as a static function to
jerry.c. This empties out jrt.c, thus deleting.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Until now, jerry had 3 different assert-like routines:
`jerry_assert_fail`, `jerry_unreachable`, and `jerry_unimplemented`,
and 3 corresponding macros (`JERRY_ASSERT`, `JERRY_UNREACHABLE`,
and `JERRY_UNIMPLEMENTED`). They had some irregularities, namely:
* All of them had a string parameter, although `jerry_unreachable`
never got anything there but NULL.
* Both `jerry_unreachable` and `jerry_unimplemented` checked its
string parameter for NULL, although it was always NULL for the
first one and never NULL for the second.
* `jerry_unreachable` is just a regular assert with a fixed error
message (i.e., control should not have got here), however, the
expansion of its corresponding macro in debug and release modes
differs from the behaviour of `JERRY_ASSERT`: `JERRY_ASSERT` is
a no-op in release, however, `JERRY_UNREACHABLE` was triggering
a crash even there.
* Moreover, `JERRY_UNIMPLEMENTED` was almost never used anymore but
in a few places (where often an `#ifdef` selected between
`JERRY_UNIMPLEMENTED` and `JERRY_UNREACHABLE`).
Because of the above, this patch makes the following changes:
* Drops `JERRY_UNIMPLEMENTED` completely and whereever it was still
used, replaces it with `JERRY_UNREACHABLE`. As a consequence, the
`jerry_unimplemented` function and the `ERR_UNIMPLEMENTED_CASE`
fatal error code are also removed.
* Makes `JERRY_UNREACHABLE` expand to no-op in release builds.
(Actually, to `__builtin_unreachable ()` to avoid warnings.) As
a consequence, makes both `jerry_assert_fail` and
`jerry_unreachable` be guarded by `#ifndef JERRY_NDEBUG`. Also,
changes `jerry_unreachable` not to expect a string parameter.
* Rewrites `TEST_ASSERT` not to rely on `jerry_assert_fail` as
`TEST_ASSERT` has to work in release builds as well. This also
allows changing the error message not to mention "ICE", which
would misleadingly suggest an assert within the engine, but
"TEST" instead.
As a side-effect of the cleanup, some refactorings happened in
jrt.h:
* Removed the definition of the unnecessary `__extension__` macro.
* Re-used `JERRY_UNUSED` and `unlikely` where possible.
* Moved some parts of the file around.
* Fixed some comments (`/**` should only be used for the docstring
of a single entity, for groups header comments, the regular `/*`
should be used).
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
The standard doesn't defines ECMAScript Compact Profile as a subset of Ecma-262 Edition 5.1.
Profile modes can be added easily like the minimal profile if required.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
- Bugfix for removing property hashmap in ecma_gc_run.
- Fixed bug in ecma_create_property() caused by the new property pair allocation.
JerryScript-DCO-1.0-Signed-off-by: István Kádár ikadar@inf.u-szeged.hu
As the comment of syscall error mentions, we should not try to log
(or print) anything in that case.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Zero out all globals (and remove unnecessary init() functions).
Move snapshot globals to a temporary stack variable.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com