2787 Commits

Author SHA1 Message Date
Daniel Balla
e8608707b6 Make source scrolling command in python debugger (#2187)
Source is now scrollable after writing `scroll`.
Keys are `q` to quit, `w` to scroll up `s` to scroll down.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-02-07 09:38:54 +01:00
Zoltan Herczeg
67cee1f478 Remove arguments of ecma_new_values_collection. (#2197)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-02-07 13:05:04 +09:00
Péter Gál
6f339eb05c Introduce C API to query the type of an Error object (#2177)
New api function:
* jerry_get_error_type

Additionally update a few places where this new function
can be used.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-02-06 09:41:54 +01:00
Péter Gál
8041953a7a Add TypedArray C API (#2165)
New API functions added:
 - jerry_value_is_typedarray
 - jerry_create_typedarray
 - jerry_create_typedarray_for_arraybuffer_sz
 - jerry_create_typedarray_for_arraybuffer
 - jerry_get_typedarray_type
 - jerry_get_typedarray_length
 - jerry_get_typedarray_buffer

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-02-06 08:01:32 +01:00
mofosyne
0cc98340c3 Update documentation for jerry string to buffer function with suggestions to use substring. (#2174) (#2174)
In some use cases, you want to reliably copy jerry strings to buffer, even if it doesn't fit target buffer, but is acceptable to lose some bytes. In those cases, the documentation will now suggest using the substring function as an alternative instead.

JerryScript-DCO-1.0-Signed-off-by: Brian Khuu mofosyne@gmail.com
2018-02-02 12:09:57 +09:00
Daniel Balla
c429530d02 Fix multiple JSON.parse issues (#2191)
Fixes #2180, #2192

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-02-01 22:34:21 +01:00
Zoltan Herczeg
36051ec92b Limit maximum number of arguments for apply(). (#2183)
The length*sizeof(ecma_value_t) may overflow on 32 bit systems which
cause a memory corruption when the values are filled.

Fixes #2182.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-02-01 15:09:53 +01:00
Zoltan Herczeg
06ebfc52ed Simplify ECMA_OP_TO_NUMBER_TRY_CATCH macro. (#2185)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-02-01 19:31:17 +09:00
Zoltan Herczeg
c935e4b7e2 Return early if number conversion is failed in arraybuffer slice. (#2184)
Fixes #2181.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-02-01 19:30:03 +09:00
Szilard Ledan
607e605844 Fix regex brackets matching bug (#2179)
Fixes #2178.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Szilard Ledan szledan@inf.u-szeged.hu
2018-01-31 09:27:32 +01:00
Zoltan Herczeg
918eb22a01 Add support for aborts. (#2176)
Aborts are similar to exceptions except they are not caught by catch
and finally blocks. Callbacks should honor aborts as well and return
them without processing them. Aborts are never thrown by JavaScript
code.

In the future certain events such as out-of-memory condition may
also throw aborts.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-01-30 09:13:44 +09:00
Zoltan Herczeg
b548eae4ad Improve get characters of a string function.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-01-29 10:35:56 +09:00
Martijn Thé
0d04c805ac Zero out unused bytes in snapshots (#1980)
Compiled code blocks are sized in multiples of JMEM_ALIGNMENT,
but it's possible that some bytes at the end remain unused and get filled
with junk. This causes snapshot output to become nondeterministic.
To fix this, zero out the compiled code buffer before using it.

JerryScript-DCO-1.0-Signed-off-by: Martijn The martijn.the@intel.com
2018-01-26 08:26:09 +01:00
Peter Gal
4b699e997a Add ArrayBuffer with user specified buffer
New API functions:
 - jerry_create_arraybuffer_external
 - jerry_get_arraybuffer_pointer

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-01-25 10:14:53 +09:00
Roland Takacs
7acd688513 Print the return value of the engine in case of TizenRT.
Since TizenRT doesn't have any commands to get the return value of a process,
added a debug print line that shows the return value.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
2018-01-25 09:28:18 +09:00
Szilard Ledan
a4afde2663 Change '{' regex parsing to work similarly to other engines (#2134) (#2169)
Changed regex parsing to be able to handle opening braces
as other engines do, and also added a compile flag which
can disable this behaviour.

JerryScript-DCO-1.0-Signed-off-by: Szilard Ledan szledan@inf.u-szeged.hu
2018-01-24 12:18:44 +01:00
Zoltan Herczeg
1c64c1aeb7
Fix inserting pending breakpoints. (#2163)
Before this patch the JS execution is started right after the parsing
is completed. The problem is that some parts of the JS code is executed
before the debugger had any chance to insert pending breakpoints due
to network latency. This patch adds a delay after parsing when at least
one pendding breakpoint is available.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-01-23 10:47:47 +01:00
Peter Gal
40d05cdca2 Add version fields for debugger configuration
By adding version information to the debugger protocol
it is possible to report if the debugger client and server
have different expectations on debugger workings (opcodes, types, etc.).

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-01-23 10:17:33 +09:00
Robert Fancsik
52a14fa08f Fix the endianness of EPS8266 system
Also fix the order of js sources by evaluate the main.js for the last time.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-01-22 18:13:07 +09:00
Roland Takacs
680bafdc8c Modify the build method of TizenRT target
Introduced a cmake/toolchain_mcu_artik053.cmake file that defines
all the target specific compiler options.

Modified the Makefile.tizenrt to do not copy the created static
libraries to the TizenRT folder. Instead, the application builder
Makefile (tizenrt-artik053/apps/jerryscript/Makefile) copies the
required static libraries to TizenRT.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
2018-01-16 10:57:37 +09:00
Péter Gál
ded0d5a846 Introduce the Array Buffer C API (#2161)
Add C API to work with Array Buffers.
The following methods are added:
- jerry_value_is_arraybuffer
- jerry_create_arraybuffer
- jerry_arraybuffer_write
- jerry_arraybuffer_read
- jerry_get_arraybuffer_byte_length

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-01-11 20:36:08 +01:00
Zoltan Herczeg
b9560b7c70 Rework ecma collection. (#2153)
Greatly simplify the iterator part and make it compatible with 32 bit cpointers.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-01-10 15:55:56 +01:00
Roland Takacs
f833da2c13 Modify the build method of NuttX target. (#2154)
Modified the Makefile of the NuttX target to build only the application
file (targets/nuttx-stm32f4/jerry-main.c) and not the whole project.
It helps to build JerryScript separately and use the static libs when
building NuttX.
Also modified the README.md to describe the new build process.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
2018-01-09 09:34:01 +01:00
Zidong Jiang
4e7a9d2d53 [jerryx/arg]add jerryx_arg_utf8_string (#2133)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2018-01-08 10:17:40 +01:00
Paul Sokolovsky
290bc22f0c targets: zephyr: Update for Zephyr 1.10 which uses CMake-based build. (#2155)
In 1.10, Zephyr RTOS switched to CMake as means to generate application
makefiles. Consequently, drop Makefile, and introduce CMakeLists.txt,
and update master Makefile.zephyr accordingly.

With these changes, take a chance to make following "cosmetic" changes:

1. Make "qemu_x86" board target the default instead of "arduino_101".
Arduino 101 is just one of the boards of many supported by Zephyr
(and thus JerryScript port), while qemu_x86 is something everyone has.

2. Zephyr make target to run QEMU switched from "qemu" to "run".

3. Don't rely that there's zephyr.strip, it's presence is now
board-dependent. The most we can rely on is zephyr.elf.

targets: zephyr: Remove deprecated prj.mdef file.

MDEF files have been deprecated and ignored for few Zephyr releases.

targets: zephyr: Increase main (i.e. interpreter) thread stack size.

qemu_x86 target now has stack guard enabled by default and it trips with
the default stack size. Set it to 2K for now.

targets: zephyr: Makefile.travis: Update for Zephyr 1.10.

Zephyr 1.10 requires SDK 0.9.2 and CMake 3.8.2.

Also, don't hardcode CC path, it depends on a board and choosed
automatically by Zephyr build system.

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
2018-01-08 09:49:07 +01:00
tkeri
e0e6aa0319 Add new snapshot execution test cases (#2160)
Add new function to avoid code duplication.

Add two new test cases to jerry_exec_snapshot function:
* test enable copy byte-code with global mode
* test enable copy byte-code with eval mode

JerryScript-DCO-1.0-Signed-off-by: Tamas Keri tkeri@inf.u-szeged.hu
2018-01-08 09:44:50 +01:00
Robert Sipka
d6df000fe5 Update tests results badge links in the README
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2018-01-06 12:33:06 +09:00
Robert Fancsik
543f75a6c3 Fix random number generation on ESP8266
This patch uses the onboard RTC for generating random seed. It also improves the print handler to support float values.
The rom segment is slightly increased to fit to the latest master.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-01-04 19:22:08 +09:00
Zidong Jiang
c3c0bb8ddc [Bugfix]free error in typearray set value routine (#2147)
Issue: #2143

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-12-20 12:52:29 +01:00
tkeri
be9e88784a Fix unit-test inconsistency for promises (#2152)
Use a helper function to check the availability of promise.

JerryScript-DCO-1.0-Signed-off-by: Tamas Keri tkeri@inf.u-szeged.hu
2017-12-20 12:50:12 +01:00
Zoltan Herczeg
a2d3ea61eb
Optimize string concatenation. (#2141)
This patch adds two new string concatenation functions:
ecma_append_chars_to_string and ecma_append_magic_string_to_string

The former appends a cesu8 byte array and the latter appends a magic string
to the end of an ecma-string. These two free (dereference) their ecma-string
argument, and this change is also applied to the original ecma_concat_ecma_strings
function which simplifies string handling in most cases.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-12-19 13:45:48 +01:00
Robert Sipka
bd574956e3 Fix conversion warnings (#2126)
NuttX and artik053 build - compiling with strict Werror=conversion - fail when jerry-debugger option is enabled.
This patch based on #2007, because most of them are fixed earlier within that PR, but it was closed before the land.

Credit: Piotr Marcinkiewicz p.marcinkiew@samsung.com

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-12-19 10:37:24 +01:00
Greg Miell
10f777689f Add extern "C" to module.h (#2150)
JerryScript-DCO-1.0-Signed-off-by: Greg Miell greg@gothack.ninja
2017-12-18 21:08:45 +01:00
László Langó
623fabd6e6 Put 'Mbed/K64F Build Test' to allowed failures temporarily. (#2151)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-12-18 12:14:02 +01:00
Daniel Balla
96df210cc5 Add object type checking to instantiation
It wasn't properly checked if the given object was an arrow function, therefore it always got wrongly casted into `ecma_arrow_function_t`.
Fixes issue #2110
*plus fixing a typo in the comments

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-12-13 18:14:34 +09:00
Zidong Jiang
11e0c13094
Add api: jerry_get_value_without_error_flag (#2096)
It is used to get the reference value from a error value

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-12-13 12:46:20 +08:00
Robert Fancsik
458dc58b59 Improve multiplication in vm
This patch improves the ecma_integers_values multiplication by checking if the multiplier or multiplicand is power of 2.
If it is it uses right shift instead of multiplication.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-12-11 17:47:39 +09:00
Robert Fancsik
90f2473f08 Remove trivial ecma_number arithmetic functions (#2123)
The affected function calls have been replaced with the appropriate arithmetic operands.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-12-07 13:41:02 +01:00
Péter Gál
8b109510fd Move _XOPEN_SOURCE macro to a more generic place (#2136)
Building with all-in-one and enabled debugger caused
errors as the sleep functions were not defined.

By moving the _XOPEN_SOURCE macro to a generic place
we make sure that the required sleep functions are
present in every case.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-12-07 11:54:37 +01:00
Akos Kiss
75ac090dd9
Refactor CLI argument handling and test runner logic of run-tests.py (#2091)
On argument handling:
- Merged all signoff check options into one, option value chooses
  between strict/tolerant check variants.
- Added sensible metavars to options with arguments (consistent
  with metavars of build.py).
- Reordered options to match the order the checks are executed in.
- Added `--all` alias to `--precommit` check option.
- Beautified code (always placed `help` on separate line, removed
  unnecessary arguments of `add_argument` that just repeated their
  defaults).

On test runner logic:
There was too many code duplication on how checks were executed, it
got refactored. No change in semantics.

The only change was in Travis CI-related invocations,
`--check-signed-off-travis` had to be rewritten to
`--check-signed-off=travis`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-12-07 11:54:14 +01:00
Robert Fancsik
e83de3accd Remove ecma_simple_value_t and refactor ecma_make_simple_value (#2135)
This patch removes all ecma_make_simple_value calls to make the code more easy to understand.
Also removes the type ecma_simple_value_t which improves the performance in related code paths by calculating the value of new ecma_value_t is no longer needed.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-12-06 18:06:07 +01:00
László Langó
1007b63024 Fix clearing of error reference (#2131)
'ecma_clear_error_reference' must increase the reference of the returned
ecma value referenced by the error if there are more than one reference.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-12-06 14:47:40 +01:00
Peter Gal
a8a6122a93 Force python2 when running test262
The test262 python script is not python 3 compatible
so we force it to be executed with python2.

Additionally print out the reason if the execution
failed.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-12-06 13:16:25 +09:00
Zoltan Herczeg
e964393abe Add fast path to ecma_op_object_get with magic string. (#2078)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-12-05 17:17:56 +01:00
Peter Gal
a8dffe023e Fix the mbed Travis build
On Travis the Python (by default) is a bit old
and causes problems when the yotta is being used.

Switching to Python 2.7.13 solves half of the problem.

The other problem is the pyOpenSSL 17.5 and Linux
library incompatibilities. Thus we force the pyOpenSSL
to a pre-17.5 version.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-12-05 20:16:25 +09:00
Marko Fabo
0fe8f6abac Improve bitwise operations in VM. (#2117)
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-11-30 10:13:04 +01:00
Sanggyu Lee
bf78065bc6 Update build guide for TizenRT 1.1
Previous guide is out of date.
Updated guide works with TizenRT 1.1.

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-11-30 09:04:47 +09:00
Daniel Balla
a1df9c1420 Fix undefined behaviour of global object freezing
Freezing the global object and later trying to add properties to it caused an assertion error (issue #2105).
This patch fixes the issue.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-11-28 11:30:10 +09:00
Imre Kiss
1ed886b872 Fix function parsing for debugger. (#2119)
Since the JerryScript can able to parse functions directly the
PARSER_LEXICAL_ENV_NEEDED and the PARSER_NO_REG_STORE flags
should be in the context's status flags for executing eval operations
by the debugger.

JerryScript-DCO-1.0-Signed-off-by: Imre Kiss kissi.szeged@partner.samsung.com
2017-11-22 15:29:07 +01:00
Zidong Jiang
29056f9ab9 Fix error-free issue in promise
Fix issue: #2107

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-11-21 19:49:44 +09:00