2787 Commits

Author SHA1 Message Date
fbmrk
a8a25e7f3c Update mbedos5 make (#1847)
Fix make clean and ignore jerry-port-default

JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-05-30 08:58:03 +02:00
Gabriel "_|Nix|_" Schulhof
708b155f38 Clean up property existence check inconsistencies (#1860)
`jerry_has_property ()` and `jerry_has_own_property ()` are inconsistent
in that they squash their return value into a `bool` when in fact it is
a `jerry_value_t`, thereby giving the wrong impression that a property
is there when it isn't and encouraging the leaking of `jerry_value_t`s
by disguising them as `bool`s.

Fixes https://github.com/jerryscript-project/jerryscript/issues/1859

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2017-05-29 15:54:32 +02:00
Paul Sokolovsky
b51b6824bb targets: zephyr: Reinstate "print" function and error printing. (#1851)
Re-add "print" function following resent refactors when it was moved
from jerry-core to jerry-ext. This is done in particular to keep
detailed messages on errors.

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
2017-05-25 09:08:34 +02:00
Robert Sipka
557fa5006c Set log level to JERRY_LOG_LEVEL_DEBUG when using mem-stats or show-opcodes (#1848)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-05-25 15:25:00 +09:00
Gabriel "_|Nix|_" Schulhof
de53adbf88 Lazily create a linked list of context items (#1833)
This approach has the benefit that it does not require any *a priori*
initialization, and that each context pointer is identified by the way
in which it was created. Additionally, retrieving the context pointer
now requires that the entity responsible for creating/destroying it
(the manager) be given. Since managers are stored in global static
const structures, they should not normally be visible across source
files, and thus there should be no danger that a context item will be
retrieved by the wrong manager and thus cast into the wrong data type.

Since the items are stored in a linked list, their number will be
limited to exactly as many as are needed for a given context, with the
caveat that storing too many on a context will cause slow retrieval.

Thanks @mhdawson for the idea!

Fixes https://github.com/jerryscript-project/jerryscript/issues/1845

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2017-05-24 14:10:18 +02:00
Zoltan Herczeg
29f57ec58f Print exception hint in the debugger client when an exception is thrown. (#1841)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-05-23 16:06:25 +02:00
László Langó
7770b6237a Fix parsing of UTF-8 RegExp literals (#1840)
Fixes #1831

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-05-23 12:04:11 +02:00
Daniel Balla
8894077656 Implement memstats command in the debugger (#1838)
Implementation of memstats command in jerry-debugger, python and html client.
Shows the allocated bytes, byte code bytes, string bytes, object bytes, property bytes and heap size.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-05-23 11:19:15 +02:00
Zoltan Herczeg
e58f2880df Do not allocate memory for zero length strings. (#1844)
Fixes #1821.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-05-22 13:17:08 +02:00
László Langó
a504fd0333 Fix character escape in character class parsing of RegExp objects. (#1834)
Fixes #1830

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-05-22 13:01:22 +02:00
Robert Sipka
04f3bf62b0 Set log level to JERRY_LOG_LEVEL_DEBUG when using mem-stats. (#1843)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-05-22 12:58:40 +02:00
Zidong Jiang
eb2af2d2a6 jerryx_arg: add '\0' when transforming string (#1827)
Related issue: #1824

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-05-22 08:32:20 +08:00
Zidong Jiang
5e28bfc28a Support external context, heap and lcache (#1778)
JerryScript should support external context, heap and lcache,
so that it can have multiple instances and runtime configurable heap
size.

Related issue: 1746

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-05-20 11:00:19 +08:00
Zoltan Herczeg
c6d890ee13 Support functions with number identifiers in the pre-scanner. (#1837)
Fixes #1829.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-05-19 14:49:38 +02:00
Imre Kiss
833796a20f Fix the getBreakpoint() function in the HTML Debugger client. (#1839)
There was a problem around the offset, the function tried to use some invalid object reference.

JerryScript-DCO-1.0-Signed-off-by: Imre Kiss kissi.szeged@partner.samsung.com
2017-05-19 14:38:19 +02:00
Daniel Balla
ffdf151387 Fix a typo in a variable name (#1835)
There was a typo in a variable name causing the build to fail when mem-stats was turned on.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-05-19 10:03:02 +02:00
Levente Orban
d48c65d258 Add pending breakpoints feature to HTML (JavaScript) Debugger client (#1828)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-05-19 09:50:17 +02:00
Zsolt Borbély
7833270ca0 Initialize an array in test-ext-arg.c (#1824)
In case of some compilers (e.g. gcc-4.9, gcc-5.4) the `TEST_ASSERT (arg3[4] == '\0')`
fails in test_validator1_handler() due to uninitialized memory fields.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-05-18 15:20:44 +02:00
Akos Kiss
23068bdf99 Move the job queue from the ports into jerry-core (#1804)
* Move the job queue from the ports into jerry-core

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu

* Remove port notification and keep `jerry_run_all_enqueued_jobs` API only

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-18 18:30:50 +09:00
Levente Orban
0806c16902 Add pending breakpoints feature to python debugger client (#1810)
- Support to add pending breakpoints
 - Add fbreak command for the prompt
 - Manage this breakpoints
 - Add tests for it

JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-05-18 09:00:38 +02:00
Akos Kiss
31cd3b8020 Rename internal lit identifiers (#1801)
We should keep the `jerry_` prefix for public API which is either
declared in jerry-core/include or implemented in jerry-core/api.
Moreover, we should also keep the convention to use short
identifiers for componentization within jerry-core, and use these
identifiers as directory names, file name prefixes, and identifier
prefixes.

Therefore, the tools/gen-unicode.py-generated arrays in
jerry-core/lit are renamed to use `lit_` prefix instead of `jerry_`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-16 10:34:41 +02:00
Akos Kiss
7837440cbb Add lightweight command line processor to jerry-main (#1809)
Eases command line option and sub-command definition, usage summary
and detailed help message printing, and argv processing.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-16 10:29:27 +02:00
Sanggyu Lee
1501699f48 Add setjmp and longjmp functions for tizenrt-artik05x (#1825)
This patch is based on nuttx-stm32f4 implementation.
However, I removed vldm and vstm since artik05x has no FPU.
It fixes the following error on running some testcases under tests/jerry/fail:

System Information:
        Versionarm_dataabort:
        Data abort. PC: 0410d9d8 DFAR: 0a00001d DFSR: 00000008
        up_assert: Assertion failed at file:armv7-r/arm_dataabort.c
        line: 111 task: appmain

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-05-16 09:57:32 +02:00
Zoltan Herczeg
f4fbf0b0b5 Rework memory statistics to provide useful user information. (#1812)
Obsolote statistics is also removed.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-05-16 09:52:12 +09:00
Zoltan Herczeg
f5b385ca6c Tracking variables to reduce the memory consumption of scope chain. (#1819)
Currently we keep all local variables in the scope chain as long as
a nested function is alive. These variables consume memory although
several of them are never used. This patch focuses on removing those
unused ones whose can be detected at parsing time.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-05-15 09:00:57 +02:00
Sanggyu Lee
8143a0cc10 Use external handlers in tizenrt-artik05x target (#1822)
This patch includes followings:
- Use external handlers in jerry-ext.
- Make jerry_main similar to other ports. (including options)
- Merge jerry_port.c into jerry_main.c
  jerry_port is clearly out of jerry-core.

This patch not included following:
- Use jerry-libm, instead of system libm.
  It is already included.
  We choose to use jerry-libm since the result of cube-3d sunspider was inaccurate
  when using NuttX libm.
- Correct setjmp/longjmp implementation.
  I tried to bring the source from NuttX port.
  Unfortunately it does not work in tizenrt-artik05x as it is.
  I will take a closer look the code and make sure it works.

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-05-15 15:41:06 +09:00
Zsolt Borbély
ca6e7881e8 Add category property to each .md file for the webpage (#1818)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-05-12 15:34:46 +02:00
Sanggyu Lee
91b06726bb Include jerry-ext/handler only in nuttx-stm32f4 target (#1816)
I included jerry-ext/handler only, rather than including all in jerry-ext.
Currently only handler is used in nuttx-stm32f4 repl.
nuttx.bin binary size is reduced from 231576 to 230456 bytes.

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-05-12 15:17:11 +02:00
Levente Orban
0066e526f7 Increase verbosity when breakpoints not found in HTML client (#1817)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-05-12 11:36:56 +02:00
Zsolt Borbély
e76d44a2ee Add docs about extensions to webpage-generator script (#1811)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-05-12 09:51:00 +02:00
Robert Sipka
2b152f079a Use external print handler in riot-stm32f4 target (#1814)
Extend example code with registering the `print` function in the global object.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-05-11 20:46:14 +02:00
Zoltan Herczeg
838e74df0f Remove include jerryscript.h from jrt.h. (#1803)
Fixes #1791.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-05-11 12:42:47 +02:00
Robert Sipka
7d133e55e4 Use external print, gc and assert handlers in nuttx-stm32f4 target (#1813)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-05-11 07:26:10 +02:00
fbmrk
1a7b258772 Set JERRY_JS_PARSER to 1 in mbed_app.json (#1808)
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-05-10 17:14:24 +09:00
Akos Kiss
a8f2d31bca Implement common external function handlers in jerry-ext (#1787)
Added `handler` module to `jerry-ext` to contain implementation of
commonly used external function handlers: `assert`, `gc`, and
`print`.

Also adapted jerry-main to use jerry-ext/handler

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-09 10:16:56 +02:00
Akos Kiss
68f9585b96 Fix jobqueue's return value handling in jerry-main's repl mode (#1807)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-09 12:40:53 +09:00
Akos Kiss
7f32abf75c Remove limitation on number of command line arguments in jerry-main (#1806)
Since JerryScript has been a C99 project for a while now, we can
use variable-length arrays. This allows the removal of the
artificial limit on command line arguments in jerry-main.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-09 12:40:37 +09:00
Akos Kiss
59c7ffe363 Shouldn't use jerry_value_t in ecma-exceptions.c (#1800)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-07 21:46:15 +02:00
Akos Kiss
91e976f8c7 Move jerry-core API implementations and headers into dedicated subdirectories (#1793)
Moved all public API headers under the `jerry-core/include`
directory. This makes installing all the public headers easier.
Also, should we have new public headers in the future, their
installation will be automatic, there will be no need to update the
build files. Moreover, this aligns better with the structure of
other libraries in the project (in those cases, public headers
always reside in `<library>/include`).

Moved all public API implementations under the `jerry-core/api`
directory. This cleans up the root directory of `jerry-core`,
moving all implementation code under "modules", i.e.,
subdirectories. This also makes the future splitting of the big and
monolithic `jerry.c` along features easier, if needed. (Debugger
and snapshot-related functions are already in separate sources.)

Notes:
* `jerryscript.h` is split up to separate header files along
  feature boundaries. These new headers are included by
  `jerryscript.h`, so this is not a breaking change but header
  modularization only.
* `jerry-snapshot.h` is still under `jerry-core/api`, keeping it as
  a non-public header.
* This commit also adapts all targets to the include path change.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-04 15:28:24 +02:00
Zidong Jiang
90efdf9c8b A tool in jerry-ext: arg transformer for binding (#1740)
It provides some APIs for binding developers, so that
they can validate the type of the js argument and convert/assign them
to the native argument.

Related Issue: #1716

JerryScript-DCO-1.0-Signed-off-by: Martijn The martijn.the@intel.com
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-05-04 18:00:35 +08:00
Zidong Jiang
ede13835b2 Add promise C API (#1796)
Add API: jerry_create_promise, jerry_value_is_promise and jerry_resolve_or_reject_promise.

related issue: 1794

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-05-04 16:13:26 +08:00
Akos Kiss
240411771a Remove the built-in print and the jerry_port_console port API functions (#1749)
The built-in `print` is removed from jerry-core, but an external
`print` implementation is added to jerry-main. From now on, all
embedders of the engine have to implement their own `print` if they
need such a functionality.

For printing results in REPL mode of jerry-main, the external
`print` handler is called directly instead of looking up the `print`
function registered into the global object. (The two are the same,
but the indirection is not needed anymore.)

Because jerry-core does not contain `print` anymore,
`jerry_port_console` is removed from the port API. The default port
is updated, i.e., the implementation of `jerry_port_console` is
removed. Additionally, all references to `jerry_port_console` in
jerry-main are replaced by `printf`.

Speculatively, `jerry_port_console` is also removed from all
non-default targets. Most targets implemented it for the sake of the
engine only; in those targets the removal was trivial. Where the
function was called from the embedder application as well, the
calls were replaced with equivalents (e.g., `printf`, `printk`).

NOTE 1: This is a breaking change!

NOTE 2: This patch still leaves several targets without a JS `print`
implementation.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-03 11:47:56 +02:00
Akos Kiss
3705bf19d0 config.h maintenance (#1792)
The config header was full of legacy, no-longer-in-use defines. It
was also included from multiple files where it was not necessary.
This patch removes the unused defines, and cleans up headers so
that only `ecma-globals.h` includes `config.h`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-02 08:44:57 +02:00
Zoltan Herczeg
894aa6d036 Support ECMAScript stopping in JerryScript. (#1753)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-04-28 14:19:23 +02:00
Robert Sipka
0e38356e5b Update riot-stm32f4 target to use jerry-port-default-minimal (#1790)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-28 10:49:39 +02:00
Robert Sipka
56802c22a1 Remove unnecessary subfolder in tests/jerry/fail/ (#1783)
There is no need to create error code named subfolders since
every failing tests return with the same code.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-28 09:17:23 +02:00
Zidong Jiang
14c455bcd8 [native pointer] Check if freecb is NULL before calling it (#1789)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-04-28 09:01:40 +09:00
Akos Kiss
6ecee7eef4 Ensure that jerry-port is license-checked (#1788)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-28 08:59:10 +09:00
Sanggyu Lee
c9dac6a720 target: tizenrt-artik05x: Add missing jerry_port.c (#1786)
Add missing jerry_port.c in previous initial port.

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-04-27 10:25:29 +09:00
Robert Sipka
fb432a8bd7 Eliminate pylint warnings from generate_pins.py (#1731)
It also contains small refactoring steps:

* Added a main() function - instead of just writing all the code into the
  "if name" block - to avoids creating global variables that could affect
  other functions.

* Added a `write_pins_to_files` function - which writes the generated pins
  into the output JS and C++ files - to avoid too many local variables.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-26 15:18:20 +02:00