The algorithm is the following:
* introduced a counter variable, which value can be [0-4]
* if its value is 0, property hashmap allocation is enabled
* JMEM_FREE_UNUSED_MEMORY_SEVERITY_LOW -> decrease the counter
* JMEM_FREE_UNUSED_MEMORY_SEVERITY_HIGH -> increase the number
* if JMEM_FREE_UNUSED_MEMORY_SEVERITY_HIGH happens twice in a row increase the counter to 4
According to the measurements this algorithm provides better runtime results in low memory conditions.
JerryScript-DCO-1.0-Signed-off-by: István Kádár ikadar@inf.u-szeged.hu
It now has the same effect as defining _DEFAULT_SOURCE, but generates a
compile-time warning (unless _DEFAULT_SOURCE is also defined). To allow
code that requires _BSD_SOURCE in glibc 2.19 and earlier and _DEFAULT_SOURCE
in glibc 2.20 and later to compile without warnings, define both _BSD_SOURCE and _DEFAULT_SOURCE.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
This patch reduces memory consumption for strings such as "0" or "123"
by 8 bytes and "4294967295" by 16 bytes. The hash computation is changed
for using the lower 16 bits for these strings which is much faster than
converting the value to string first and compute the hash. The trade-of
is a small overhead when strings are created or concatenated.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Legacy implementation made incorrect assumptions on how many bits
of useful information is returned by libc's `rand()`. If `RAND_MAX`
had more than 16 useful bits, it assumed that `rand()` could return
32 useful random bits. However, e.g., jerry-libc's `RAND_MAX` is
`0x7fffffff`, which denotes 31 useful bits only. The consequence
was that `Math.random()` covered only the lower half of the
standard-mandated `[0,1)` interval.
This path fixes the error and always uses the exact value of
`RAND_MAX` to compute the random value, which will thus fully cover
`[0,1)`.
Fixes#1414
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
For a normal zephyr application the pristine target simply runs
"rm -rf outdir". However the JerryScript build overrides the output
directory [O=$(OUTPUT)] so Zephyr's implementation pristine is not able
to to a full aggressive clean up for all boards.
For this reason it is better for the JerryScript build wrapper to have
its own implementation of pristine.
JerryScript-DCO-1.0-Signed-off-by: Daniel Thompson daniel.thompson@linaro.org
Currently if USE_CCACHE=1 is set to one than the Zephyr build system
will include ccache in the CC variable. ccache cannot be passed to
cmake using EXTERNAL_CMAKE_C_COMPILER (even if we fix the quoting)
because it fails a PATH reachability test within cmake. For that
reasons we solve the build failure simply by removing ccahce from CC
before we pass it into cmake.
The problem described about is a regression due to commit ac1bf19c90d6
("build: Adopt outputexports") and the fix contained in this patch
restores the original behaviour (zephyr exploits ccache, jerryscript
library build does not).
JerryScript-DCO-1.0-Signed-off-by: Daniel Thompson daniel.thompson@linaro.org
The file was named jerry-entry.c and not even built. Rename for clarity,
and add jerry_port_fatal(), jerry_port_get_current_time(),
jerry_port_get_time_zone() functions. User-visible result is that
if Date builtin is enabled (e.g. if building "full" config, its
Date.now() method can be used to measure relative time difference,
e.g. for benchmarking).
JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
Some test cases were failed with enabled show-opcodes build option.
Example source:
"98765".replace(76)
print ("\ud801\udc00".replace("\ud801", "#") === "#\udc00");
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
* Rename 'jerry_targetjs.h' to 'jerry-targetjs.h',
because we use dashes in filen ames instead of underscores.
* Made destination and js souce directory configurable.
* Updated esp8266 target to the recent changes.
* Updated mbed and mbedos5 target to the recent changes.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This patch simplifies the integration with the zephyr build system
whilst at the same time enriching the set of build targets to allow
zephyr to be configured using its kbuild features.
It works by exploiting "make outputexports", a feature of the zephyr
build system that makes the zephyr compiler configuration available to
other build systems in an easily accessible manner.
Whilst looking at the build we also correct the implementation of clean
so that it no longer destroys any custom zephyr configuration. Like any
other zephyr application one must use "make pristine" to remove the
config too.
JerryScript-DCO-1.0-Signed-off-by: Daniel Thompson daniel.thompson@linaro.org
The new code does not use value collections which reduces the argument array size by half.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Example source:
var s = "hello";
if (s)
a[,] = s;
Output:
var s = "hello";
if (s)
a[,] = s;
~~~~^
Script Error: SyntaxError: Primary expression expected. [line: 3, column: 5]
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
Instead of allocating a helper object, argument names are appended right
after the arguments objects. This reduces memory consumption and improve
performance as well. In the future this could be further improved by a
bitfield, but that would require a reference to the byte code which
might increase memory consumption in a few corner cases.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
JerryScript Zephyr port overrides standard Zephyr output location. But
components integrating Zephyr port may want to override it again. Make
sure that arbitrary overrides are possible, and just set the default
value to Zephyr port's custom preference.
JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
Check the return value of 'ecma_op_put_value_lex_env_base' function.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
Class and value internal properties are always exists for primitive
types (e.g. Boolean, Regex) so they can be stored right after the
object. This improve property access (since internal properties are
searched by a slow linear algorithm) and reduces memory consumption,
since only 8 byte is allocated for these two properties instead of
16 which is the size of a property pair.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
The new set does not allocate memory when the size of the array is reduced.
Furthermore the [[PutObject]] method directly calls the new length setter.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
The new zephyr build system doesn't support the arduino_101_factory
board.
This change restores the default BOARD to arduino_101 which
is the current recommended method.
If you are in an older SDK / Zephyr you can still use.
`make -f ./targets/zephyr/Makefile.zephyr BOARD=arduino_101_factory`
JerryScript-DCO-1.0-Signed-off-by: Sergio Martinez sergio.martinez.rodriguez@intel.com
`-g` is enough (most modern compilers use DWARF4 as default, at
least, e.g., GCC has switched from DWARF2 in 4.8), more future
proof (if a compiler moves to a newer version, it wont get forced
to a fixed older version), and less restrictive (some compilers
handle the "standard" `-g` only but don't understand its variants).
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Defining the same macros in multiple source files can cause macro
re-definition warnings or errors in all-in-one builds.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Currently the zephyr port fails to build with some cross-toolsets because
warnings from the system headers are being treated as errors. Using
-isystem for any includes in TOOLCHAIN_CFLAGS allows us to crank up the
warning levels without worrying about newlib headers breaking the build.
JerryScript-DCO-1.0-Signed-off-by: Daniel Thompson daniel.thompson@linaro.org
Currently we need to modify the JerryScript Makefiles for every new
board we want to work with. It is better to study the zephyr configuration
and used the CONFIG_ options to determine the right compiler flags.
We expose the CONFIG_ options to make by adding machinary to the makefiles
to import the Zephyr .config file, allow us to make the decisions we
need.
JerryScript-DCO-1.0-Signed-off-by: Daniel Thompson daniel.thompson@linaro.org
Newer compilers (especially clang) warn (and fail) on
`assert (!"message");` constructs typically used to assert on
unreachable code paths (multiple occurrences in jerry-libc). A more
up-to-date approach is to use `assert (false && "message");`. This
patch applies the pattern to all relevant asserts in jerry-libc.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This patch improves the command line tool in two ways:
* The tool can be instructed to read and execute a script from
stdin by invoking it as `jerry -`.
* The tool can be instructed to suppress its prompt when in repl
mode by invoking it as `jerry --no-prompt`.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Several non-script files have been added with exec permission to
the repository. This patch revokes the erroneous permissions.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This patch changes define own property to search a property only once.
Currently all existing properties are searched at least twice, sometimes
three times which is not optimal.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
run-tests.py used to echo the build commands it executed, but did
not behave the same way when it executed test commands. To make its
behavior more traceable, this patch adds echo for test commands as
well.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
From the beginning, we have been configuring cppcheck to check its
input as C++ source. However, the transition to C99 happened a
while ago. This patch switches cppcheck into C99 mode.
Some related changes:
* Progress reporting of cppcheck just clutters the output and makes
warnings hard to discover. Thus, this patch puts cppcheck into a
quieter mode where it prints anything only if a non-suppressed
warning is found.
* The default warning format of cppcheck is a bit different from
usual compiler error/warning format. This patch configures
cppcheck to use a more familiar warning template.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
It's stated in the Guidelines that all contributions must be under
the Apache License 2.0. To avoid potential mistakes from manual
reviews, this patch adds the check-license.py script to
automatically check all source files for license headers.
Travis CI is also configured to run the check.
Fallout: it turned out that some files already in the code base
either miss a license header or have some minor typo differences.
The patch fixes up some of these deficiences.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
- Wrappers for mbed I/O drivers
- Makefile for automating build process
- Script to generate pin definitions from mbed OS source tree
- Updates to js2c to enable building without a main.js file
JerryScript-DCO-1.0-Signed-off-by: Matthew Else Matthew.Else@arm.com
The naming convention of the project for `struct`s is
`typedef struct x_t { } x_t`, but only if it has self-recursive
pointer members, otherwise `typedef struct { } x_t` is enough.
This patch applies this style consistently throughout the code
base.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu