2787 Commits

Author SHA1 Message Date
Zidong Jiang
9a9dcf3332 Fix bug in promise resolve handler
Should get the error_value if `then` prop is an error.

Fix issue: #2111

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-11-21 14:25:51 +09:00
tkeri
e15020be96 Fix api inconsistency for promises (#2113)
The change makes the jerry_value_is_promise api method
available in all cases, just like other promise api methods

JerryScript-DCO-1.0-Signed-off-by: Tamas Keri tkeri@inf.u-szeged.hu
2017-11-20 15:41:11 +01:00
Robert Fancsik
fe6c7b9b61 Fixed TypedArray error handling
This patch fixes #2106. The problem was that the function always tried to transform the array-like object to TypedArray object even if there was an error during TypedArray creation.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-11-20 16:55:22 +09:00
rerobika
1dedc1b630 Fixed toFixed method string conversion (#2112)
This patch fixes #2108. The problem was if the convertible number had less significant fractions digits than the requested, the result was filled with memory junk instead of zeros.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-11-17 20:00:45 +01:00
rerobika
6c06a309c1 Fixed dynamic-stack-buffer-overflow in jerry_value_is_syntax_error (#2095)
Fixes issue #2094, which introduced an error caused by jerry_value_is_syntax_error.
The problem was that the function used strcmp instead of strncmp while checking if err_str_buf contains syntax error and it caused buffer overflow.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-11-17 11:39:11 +01:00
Marko Fabo
b4a1825a83 Avoid code duplication in vm.
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-11-17 18:25:00 +09:00
Akos Kiss
b43057c90b Add grouping macro guards for disabling engine features (#2084)
Until now, the engine's feature set was configurable either via
`CONFIG_*` macro guards defined individually on compiler command
line or via profiles (which are text files listing macro guards,
picked up by the cmake build system and turning them into compiler
command line options). And the features under profile control are
all enabled by default (i.e., all macros are `CONFIG_DISABLE_*`).

This causes a maintenance issue when new features are added to the
engine, because the disabling macros have to be added to all
profiles that don't include the new features. This can even cause
"compatibility break" for applications that embed JerryScript but
don't use the cmake or the python build system, because then
profiles are unavailable and all feature disabling guards have to
be explicitly passed to the compiler. (I.e., if such an application
wants to use the ES5.1 feature set, it must define all the ES2015
disable macros; if the engine is developed further and a new ES2015
feature gets implemented, then the new feature will sneak into the
application's binary unless its own build system is changed to add
the new feature guard.) Even the in-repo example Curie BSP target
seems to have suffered from this maintenance problem.

This patch introduces two new grouping macro guards that enable the
disabling of all ES5.1 builtins and all ES2015 features. As the
grouping logic is in config.h, the maintenance of non-cmake-based
build systems becomes easier (and there is no change for the python
and cmake-based build systems).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-11-16 16:31:30 +01:00
Akos Kiss
36479ddc1a
Remove the 'external' toolchain file (#2089)
The 'external' toolchain file does nothing but transitively sets
some cmake system variables from values received on the command
line, and forcibly sets the C compiler. However, the same cmake
system variables can be directly set via the command line, together
with the C compiler, and specifying a toolchain is not a must.
Thus, this patch drops the superfluous 'external' toolchain file
and updates cmake-based targets to invoke cmake in a simpler form.

Related changes in this commit:
- While updating the cmake invocations, all the command line
  arguments have been reviewed and simplified (removed those, which
  did not change the defaults).
- Removed unnecessary forced C compiler settings from some
  toolchain files (and/or changed them to setting the "compiler
  works" flag to true, thus keeping cmake's compiler identification
  logic but disabling some of its overzealous compiler sanity
  checks).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-11-16 16:19:00 +01:00
Akos Kiss
da24727824 Add Travis CI jobs for build testing several targets (#2102)
Hitherto, code under the `targets` directory was not tested and so
its maintenance was sometimes speculative. This commit adds build
testing for several targets to prevent them from bit rotting.
Targets covered by this commit are: ESP8266, Mbed, Mbed OS 5,
NuttX, RIOT, Tizen RT, and Zephyr.

Some issues were revealed and fixed:
- ESP8266: added missing include for `uint32_t` typedef.
- Tizen RT: replaced missing `str_to_uint` with `strtol`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-11-16 13:29:23 +01:00
Akos Kiss
a0db3ee5b3 Ensure that the test version of the command line tool is stable for benchmarking (#2076)
Some benchmark suites contain test cases that have nonreproducible
behaviour. This is mostly caused by relying on "now" when dealing
with dates or timestamps, instead of using a fixed moment. (A
notorious example is the crypto-aes.js test case of the sunspider
bechmark suite, where the heap memory consumption can vary between
34K-41K heap because of using `(new Date()).getTime()`.)

This commit renames the jerry-minimal command line tool to
jerry-test (to better reflect its purpose) and adds extra code,
which intercepts some calls to libc (`gettimeofday`, `rand`) and
pins their results to some fixed values. This makes the tool
useless in a general case but ensures stable results when
benchmarking -- for which it is mostly used.

As a side effect, the commit also changes jerry-libc by making all
libc functions weak symbols to allow their override from
application code.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-11-16 12:36:58 +01:00
Péter Gál
7692aa9d66 Improve the heap limit measure tool (#2092)
Changes:
 * Added support for Python3
 * Suppressed the build output text
 * Code cleanup
 * Fixed pylint warnings

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-11-15 17:02:32 +01:00
Gabor Loki
1059fb1b30 Fix a small typo in the port API documentation (#2099)
JerryScript-DCO-1.0-Signed-off-by: Gabor Loki loki@inf.u-szeged.hu
2017-11-15 17:01:32 +01:00
Daniel Balla
7ad3edde08 Fix typo in byte-code.h (#2100)
Fixing a typo in byte-code.h, plus removing unnecessary guarding around it.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-11-15 17:01:01 +01:00
Akos Kiss
6b1ed6e021
Refactor/simplify .travis.yml (#2090)
Over time, `.travis.yml` grew somewhat organically and became quite
complex. With some rewrites, it can set up the Travis CI stages
better, and become simpler, more logical, and more maintainable.

The refactoring keeps all existing functionality.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-11-13 15:36:40 +01:00
Akos Kiss
52ecafc888 run-tests.py test options maintenance (#2087)
Pythonification of the `Options` class and unification of the
instance names.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-11-13 13:52:56 +01:00
rerobika
5d2000c954 Fix for issue #1993 (#1994)
This patch fixes this bug which caused corrupted stack by preventing unnecessary double to ascii conversion even if
the convertible number of digits is higher than allowed.
In addition, improved ecma_double_to_binary_floating_point function by removing a needless buffer.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-11-10 15:13:08 +01:00
Akos Kiss
1d2a686532 Whitespace gardening in jerry-libc (#2082)
Also includes the addition and styling of some doc comments (but
those are whitespace too).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-11-10 13:12:44 +01:00
Zidong Jiang
2865826fc4 [jerryx-module]Fix a bug in module name comparison (#2079)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-11-10 13:11:26 +01:00
Marko Fabo
9c013310ab Include missing header file in mbed/mbedos5. (#2083)
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-11-10 12:58:53 +01:00
Daniel Balla
7e51423ca7 Fix Date.parse() in ecma-builtin-date.c (#2081)
Fixes issue #2073, which introduced an error caused by Date.parse()
The problem was that the function didn't properly check if there was a ':' after the hours.
If any UTF8 character was inserted there which got decoded into multiple characters, it caused the pointer to point at a wrong character.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-11-09 21:12:29 +01:00
Robert Fancsik
519ba8eb6c Fixed template literal parsing
Fixed an unhandled corner case while parsing slashes and template literals.
This patch fixes #2039 and adds a test case for it.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-11-09 14:12:34 +09:00
Robert Fancsik
c3a9821171 Revive target: ESP8266
This patch updates ESP8266 build system and code base as well.
 - Removed unnecessary files.
 - Decreased code size.
 - Refactored jerry_{port, extapi, run}.c to make it more easy to handle.
 - Readme.md is updated as well which contains detailed step by step description about how to set up environment and use JerryScript.

Finally, it solves the related issue #1375.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-11-08 19:13:34 +09:00
Marko Fabo
bdcd2d8179 Free JERRY_CONTEXT (error_value) (#2071)
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-11-06 15:48:05 +01:00
Daniel Balla
3de6c7ec7a Fix jerry-libc's srand function (#2068)
The previous implementation of srand was wrong in jerry-libc.
It set all 4 values to the seed, not modifying anything in them, causing random values to be repeated pretty often.
This approach fixes the mentioned issue.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-11-06 11:31:22 +01:00
Péter Gál
8ae659227e Move snapshot generation function to the snapshot tool (#2057)
Now there is a snapshot tool which can merge snapshots
but was unable to generate snapshots by itself.

This change moves the snapshot generation utilities
to the snapshot tool.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-11-05 18:37:27 +01:00
Zsolt Borbély
ee24965bcf Add missing headers for srand() to jerry-minimal and riot-stm32f4
A buildoption test is also added to test jerry-cmdline-minimal.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-11-04 12:17:59 +09:00
Daniel Balla
4690d128b3 Add info to documentation about random numbers, initialize srand (#2056)
Issue #2053 has highlighted the fact that random numbers are always generated with the same seed.
An example of generating different random numbers, other than the original seed, has been added to the documentation.
Furthermore srand initialization has been added to jerry-main, and targets.
Update test-common.h with srand call.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-11-03 15:31:57 +01:00
Marko Fabo
678fcb20ed Free the error_value of the global context before raise an error. (#2067)
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-10-31 15:47:20 +01:00
Zidong Jiang
5bd72047cc jerryx: add jerryx_arg_array (#2052)
Related issue: #2046

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-10-30 20:39:14 +01:00
Akos Kiss
60bf613c07 Add regression test from issue #2008 (#2066)
The issue was reported against v1.0 and isn't reproducible anymore.
Still, adding the then-faulty input to the regression test suite to
prevent it occuring again.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-10-30 14:53:22 +01:00
Péter Gál
0ee7509030 Install pylint for user on Travis (#2064)
On Travis the pylint package can't be installed
due to insufficient permissions.

To fix this we'll try to install the package for the user
and not for the system.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-10-30 14:46:29 +01:00
Marko Fabo
d9cc3fd4b7 Improve runtime by concatenation of opcodes. (#2059)
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-10-29 08:19:18 +01:00
rerobika
6dae81565c Improve ecma_utf8_string_to_number function (#2006)
This patch extends the infinity and zero parsing of the convertible number by checking the normalized number exponent part.
This improvement prevents the engine's hanging while converting extreme big numbers.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-10-27 12:32:29 +02:00
Zidong Jiang
0bc4bb056d Fix promise thenable bug
Related Issue: #2060

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-10-27 18:37:58 +09:00
Marko Fabo
d7c710d3d4 Delete unnecessary ?: statement.
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-10-25 09:45:49 +09:00
Zoltan Herczeg
53cd324179 Rework error to use a global slot to store the error value.
This change frees up the error bit in ecma_value_t, which allows
to define 4 more value types (e.g. symbols). To keep API
compatibility we introduce a box for values with error flag.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-10-24 17:33:04 +09:00
Akos Kiss
742654a3f1 Fix #endif comment at end of header files (#2049)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-10-21 14:47:37 +02:00
Daniel Balla
2f6c105522 Fix pending breakpoints in python debugger client (#2028)
There was an issue where pending breakpoints were incorrectly tried to be assigned to files, since they missed the sourcename check. It's also worth mentioning that pending breakpoints were not "moved" correctly to active status, just copied there instead, making them appear in the pending list still.
This patch fixes both of these issues.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-10-19 11:49:33 +02:00
Peter Gal
4913a42086 Fix API docs
The #2043 introduced a bit of error in the API
docs as there was missing backticks.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-10-19 16:26:59 +09:00
Péter Gál
6d988afbf4 Introduce a way to directly save snapshot functions and load them back (#2043)
Added two new api functions:
* jerry_parse_and_save_function_snapshot
* jerry_load_function_snapshot_at

The jerry_parse_and_save_function_snapshot function allows
creating snapshots from snapshot arguments and body source.

The jerry_load_function_snapshot_at function enables loading
back functions from a given snapshot as a JS function object.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-10-18 15:03:54 +02:00
Akos Kiss
d0143adc82 Replace JERRY_JS_PARSER feature guard with JERRY_DISABLE_JS_PARSER (#2036)
* Replace JERRY_JS_PARSER feature guard with JERRY_DISABLE_JS_PARSER

All feature guards of jerry-core are deciding about the inclusion
or exclusion of a feature based on the state (defined or undefined)
of a macro -- except for the JS parser guard, which requires
`JERRY_JS_PARSER` to be defined with a value of either 0 or 1. This
has some issues:
- The engine cannot be built with a "clean" compiler invocation,
  i.e., without any `-D` command line macro definitions. This is
  painful for targets that must use a different build system from
  the project's own python/cmake-based one.
- Some build systems in targets and even some code in jerry-code
  are already confused about the different semantics of
  `JERRY_JS_PARSER`, and simply define it without a value and make
  decisions based on the macro being simply defined or not.

This patch renames the guard to `JERRY_DISABLE_JS_PARSER` and makes
use of it in jerry-core based on its state, not based on its value.
As obvious from the guard name, the default for the JS parser is
that it is included in the build.

The patch also touches those targets in the repository that
explicitly defined the original macro (correctly or incorrectly).

* Make cppcheck verbose

Cppcheck can be quite slow sometimes, especially on Travis CI,
which has a "10 mins without output means failure" rule. As the
code base of the project grows, we start to undeterministically
fall over that limit. Thus, this PR makes cppcheck verbose to
ensure that it keeps Travis CI continuously fed with output.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-10-17 17:11:54 +02:00
Zoltan Herczeg
fe26674752 Support multiple primary functions in a single snapshot. (#1797)
This patch adds an extension to snapshots which allows storing
multiple position independent primary functions in a single
snapshot data. A new application called jerry-snapshot is
added to the project to manage snapshots. Currently the only
option is merging snapshots.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-10-12 14:43:32 +02:00
Zoltan Herczeg
9f0cf9ef1c Implement this binding for arrow functions.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-10-06 09:07:13 +09:00
Zsolt Borbély
1cc7cb58ce Enable promise builtin for nuttx-stm32f4 target (#2033)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-10-04 15:46:18 +02:00
Gabriel "_|Nix|_" Schulhof
eb92b22b19 Fix possible uninitialized value (#2035)
JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2017-10-03 10:24:39 +02:00
László Langó
1027eb0c32 Updated the Doxyfile input directories. (#2024)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-10-02 11:57:28 +02:00
Zoltan Herczeg
29ea702fa4 Free the GC mark bit to increase the number of object types. (#2032)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-09-29 16:15:13 +02:00
Gabriel "_|Nix|_" Schulhof
6d53931055 module extension: add support for canonical name resolution (#2013)
Before attempting to load a module, each provided resolver must be given an
opportunity to examine the name of the requested module without actually
loading it so as to canonicalize it, in case a module can be referred to by
multiple names.

Then, modules are loaded and cached by their canonical name.

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2017-09-29 12:02:34 +02:00
Daniel Balla
e527e41bac Fix typo in the debugger documentation (#2027)
The old function name was used in one occurrence.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-09-28 06:20:18 +02:00
Zoltan Herczeg
8a5bfd2279 Implement template literals. (#2025)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-09-27 11:24:51 +02:00