2890 Commits

Author SHA1 Message Date
Zoltan Herczeg
04dcefe087 Rework function call. (#2414)
Furthermore add a construct flag, which disallows calling certain
functions without new. Constructing bound arrow functions correctly
throws error now.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-07-11 09:35:44 +09:00
Anthony Calandra
50daa39ee8 Optimize JSON Quote operation. (#2420)
JerryScript-DCO-1.0-Signed-off-by: Anthony Calandra anthony@anthony-calandra.com
2018-07-10 15:00:19 +02:00
Istvan Miklos
0c6b5eae65 Fix incorrect output from JSON.stringify (#2416)
This patch fixes the #2383 issue

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-07-03 19:21:45 +09:00
Anthony Calandra
a456c90c1d Add %TypedArray%.prototype.fill(value, [ begin [, end ] ]) support. (#2415)
JerryScript-DCO-1.0-Signed-off-by: Anthony Calandra anthony@anthony-calandra.com
2018-07-03 19:21:14 +09:00
Anthony Calandra
d5cd32b0c0 Support for %TypedArray%.prototype.set(typedArray [, offset]). (#2405)
This patch allows developers to set a typedarray given a source typedarray. This patch
attempts to follow section 22.2.3.22.2 in the ECMAScript spec as closely as possible.

JerryScript-DCO-1.0-Signed-off-by: AnthonyCalandra anthony@anthony-calandra.com
2018-07-03 15:19:53 +09:00
Anthony Calandra
a74bf7dc91 Add %TypedArray%.prototype.subarray([ begin [, end ] ]) support. (#2410)
JerryScript-DCO-1.0-Signed-off-by: Anthony Calandra anthony@anthony-calandra.com
2018-06-28 09:41:07 +02:00
Istvan Miklos
b9f2b1cf25 Replace jerry_value_set_abort_flag with jerry_create_abort_from_value (#2411)
Replaced the function, added some tests for it. Also changed the functions order to
alphabetical.

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-06-28 08:09:03 +02:00
Zoltan Herczeg
34c081095a Fix escape sequence parsing in lexer_compare_identifier_to_current. (#2409)
Furthermore do not allow escape sequences in object initializer
get/set functions.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-06-23 10:02:14 +09:00
Istvan Miklos
dfc0757242 Fix jerry_create_error_from_value (#2403)
Fixed the release issue, added some test cases for the function

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-06-22 12:19:13 +09:00
Imre Kiss
e3265883fd Add restart command to the debugger (#2401)
With this feature the use can restart the actual debug session
(similar to the multiple source context reset) within a client.

JerryScript-DCO-1.0-Signed-off-by: Imre Kiss kissi.szeged@partner.samsung.com
2018-06-22 12:18:18 +09:00
Zoltan Herczeg
35ac0e0445 Fix parse_print_final_cbc dump when arguments is used (#2400)
Currently the byte code start is incorrectly set when
a non-strict arguments object is present, and a random
memory area is dumped as byte code.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-06-21 08:38:17 +09:00
Zoltan Herczeg
03274c112a
Remove ECMA_LEXICAL_ENVIRONMENT_OBJECT_BOUND. (#2408)
Only the global object bound to the root node of the lexical environment
tree does not have a provideThis flag, and ecma_op_implicit_this_value()
falls back to the global object. Hence we get the same effect regardless
of provideThis.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-06-20 15:27:45 +02:00
Zoltan Herczeg
acdbbf2261
Add literal property to the byte code list. (#2397)
Initializing a property with a constant is frequent in object initializers.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-06-20 09:06:59 +02:00
László Langó
7f56756e11 Improve sonarqube analysis to cover more code path. (#2381)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-06-20 10:34:49 +09:00
Zoltan Herczeg
86ecc81130
Fix literal free when show opcodes is enabled. (#2398)
A literal might be not freed if it is stored in a register,
and PARSER_DUMP_BYTE_CODE is enabled, but opcodes are not shown.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-06-18 09:31:13 +02:00
Zoltan Herczeg
1044523af7 Add operational mode for jerry_gc API call. (#2385)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-06-15 16:31:48 +09:00
Mátyás Mustoha
bc827cb497 Reduce code duplication between String.charAt and charCodeAt (#2331)
JerryScript-DCO-1.0-Signed-off-by: Mátyás Mustoha mmatyas@inf.u-szeged.hu
2018-06-14 17:48:25 +09:00
Paul Sokolovsky
49c79e4774 targets: zephyr: Remove old option from prj.conf (#2396)
CONFIG_CONSOLE_HANDLER_SHELL is an old option which was removed quite
some time ago from Zephyr. (And newer versions will warn/error on
usage on such options.)

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
2018-06-13 21:47:56 +09:00
Zoltan Herczeg
9625fb842e Improve instanceof operator. (#2395)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-06-13 19:33:27 +09:00
Akos Kiss
5398e07f99
Rework 128 bit arithmetics of ecma_utf8_string_to_number (#2392)
* Rewritten 128-bit integer "type" to use two 64-bit ints (they are
  enough), and made it a proper struct instead of an array.
* Rewritten all single-bit shift loops to multi-bit shifts with the
  help of CLZ, and used `__builtin_clzll` where available.
* Simplified (and documented) 128-bit DIV10 operation.
* Renamed 128-bit integer handling macros to use simpler names.
  (And removed unused macros that were laying around.)

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-06-12 16:04:47 +02:00
Istvan Miklos
62dee2dd71 Fix jerry_get_value_from_error (#2394)
Fix the function to take into account the second argument even if it is called with not
an error value.

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-06-12 12:54:17 +02:00
Péter Gál
efa8850783 Use binary mode when opening via fopen in the tools (#2371)
In the snapshot tool the files were opened
in text mode. However the snapshot files
are binary files thus it is advised to use the
binary mode when opening the files.

Specifying the binary mode is a must on Windows
platform otherwise the read/write operations
are inserting extra '\r' characters.

To make the tools consitent across OSes all
fopen are now opening files in binary mode.

Also update jerry-libc to accept the 'b'
modifier and add a test case where the JS
file uses CR-LF line endings.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-06-12 04:38:35 +09:00
Péter Gál
9ae60a4910 Improve license checker line ending validation (#2391)
The license checker previously assumed that the
lines of the license will always end with \n
characters. However when checking a file
it could happen that other line endings are
returned (should only happen for test files) thus
the checker can incorrectly report invalid license
as the line endings are incorrect.

Additional note #1: in Python when reading a file
in text mode it can happen that the line endings are
converted to the host system's line ending.
However on Travis the conversion did not happen when
using the open built-in method. By switching to the
io.open call the conversion is enforced and
all line endings are converted to '\n' regardless of
the host system's line ending.

Additional note #2: it is possible that there
are input test files which are not utf-8 conformant
(eg.: to test the parser). These files can't be read
as utf-8 strings and an exception would occur.
By ignoring these errors the tool can check
the file's license. In the license text there is no
invalid utf-8 character so the check will work
correctly.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-06-11 19:37:28 +09:00
László Langó
f32c183137 Fixed assertion in 're_insert_into_group'. (#2388)
Assertion 'qmin <= qmax' failed in 're_insert_into_group', but
it should throw a SyntaxError. Fixes #2384.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-06-11 16:25:53 +09:00
Zoltan Herczeg
bd0ea4f474 Fix wrong code order in opfunc_in (#2390)
Also no conversion if the left value is a string.

Fixes #2386.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-06-11 10:20:57 +09:00
Péter Gál
d637e31933 On simple strings the utf8 substring copy api call created an assert (#2389)
When the `jerry_substring_to_utf8_char_buffer` was called
with direct strings the assert incorrectly assumed that the
string is a ref counted string and tried to access the
refcount value resulting in a failed assert.

Added direct string check for the underlying implementation
and created a test case for such simple string.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-06-11 10:19:39 +09:00
Istvan Miklos
2d0e37ff74 Replace the jerry_value_set_error_flag function with jerry_create_error_from_value (#2367)
JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-06-11 10:16:58 +09:00
László Langó
be59d0a224 Remove the indentation of preprocessor directives. (#2379)
Indenting preprocessor directives reduces the code readability, because it make preprocessor directives harder to spot.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-06-08 15:35:23 +09:00
Robert Sipka
64c5be812c [targets/tizenrt-artik053] Fix typo in Make.defs (#2387)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2018-06-07 18:21:28 +09:00
László Langó
b4b0b7d572 Merged conditions of if statements where possible. (#2380)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-06-06 15:08:17 +09:00
Akos Kiss
b61d0ed856 Rework command line handling of build tool (#2373)
In `tools/build.py`:
- For the sake of readability, group CLI arguments as general build
  options, options to control the building of components, and
  component-specific options.
- To prevent duplications, remove the defaults from those CLI
  arguments that correspond to CMake options and have defaults in
  any of the CMakeLists. Should any of the defaults change, they
  will have to be changed at a single place only. (Those options
  that are not set on the command line of `tools/build.py` are not
  passed as options to `cmake` either.)
- Convert `--unittests` and `--doctests` to ON/OFF options like the
  rest of the component switches.
- Touch on some of the help messages of the CLI arguments.

Other changes:
- The change in `--unittests` and `--doctests` is a slightly CLI-
  breaking change of `tools/build.py`. Thus, follow up on this in
  `tools/run-tests.py`.
- Move `ENABLE_ALL_IN_ONE` into `jerry-core` as it is not a general
  option but specific to that component.
- Remove the forcing of `ENABLE_ALL_IN_ONE` for some compilers/
  platforms as it is still an option, not a hard requirement.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-06-06 15:07:06 +09:00
willeio
8b8bced67f Buildable as shared libraries (#2351)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: wille-io mike@wille.io
2018-06-05 08:39:30 +09:00
Akos Kiss
e1af56586c Declare parser_error_to_string conditionally (#2376)
Its implementation is only available if `JERRY_ENABLE_ERROR_MESSAGES`
is defined.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-06-04 10:55:51 +09:00
Akos Kiss
71471a0416 Add better support for proper installation after build (#2370)
- Add `--install` option to `tools/build.py`.
- Make use of `--install` in `tools/run-tests.py` by testing the
  installed the executables instead of those in the build tree.

Related changes:
- Collect unit test binaries in the `tests` subdir of the build
  tree instead of `bin`.
- The `ls`-based collection of the unit test binaries had some
  shortcomings hitherto unrevealed (it didn't filter for files so
  it could potentially "collect" dictionaries, too), which has now
  been replaced with a more stable `find`-based solution.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-06-04 10:55:29 +09:00
Akos Kiss
2cabb6f8ea Remove the leftover declaration of ecma_op_create_global_environment (#2375)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-06-04 10:50:02 +09:00
Akos Kiss
9da010ae6e Remove legacy public headers (#2372)
Recent changes to master have already introduced API-breaking
changes. So, if someone is still including the legacy headers,
following up on the header file name changes will be the least of
their problems.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-06-04 10:49:38 +09:00
Akos Kiss
1b2c565850 Direct alloc/dealloc implementations for ecma_number_t (#2377)
As a result of earlier developments, there remained no other
instatiations of the `ALLOC`, `DEALLOC`, and `DECLARE_ROUTINES_FOR`
templates. So, it's simpler to write the alloc/dealloc routines
directly for `ecma_number_t` as well.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-06-03 15:29:28 +02:00
Paul Sokolovsky
eec2623cd9 targets: zephyr: Separate CMake definitions from options. (#2378)
Add a space between definition and options substitution groups, otherwise
they make expand to something like -DFOO-DBAR.

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
2018-06-03 14:38:37 +02:00
Akos Kiss
3e934723a3 Make sure that API function jerry_debugger_send_output is always implemented (#2374)
Also add some missing comments to `#else` directives.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-06-03 14:28:18 +02:00
László Langó
117ea1f899 Removed unused macro definitions. (#2369)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-06-01 10:00:10 +02:00
Akos Kiss
2291467c99 Remove duplications from test runner (#2364)
- Code contains syntactic duplications (e.g., build options copy-
  pasted repeatedly).
- Build options for test suites contain semantic duplications
  (ES5.1 profile builds happen multiple times, once by not
  specifying a profile and once by specifying es5.1 profile
  explicitly).
- External build options are not taken into account when detecting
  duplicated builds.

This patch provides improvement for these issues.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-30 19:57:38 +09:00
Zoltan Herczeg
7be9f91d22 Reverse the generation of line info. (#2363)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-05-30 19:57:12 +09:00
Akos Kiss
d5593c12b4 Maintenance and merging of Valgrind and Valgrind-Freya code paths (#2362)
None of the code paths have been tested for long and especially the
Freya code paths have been long abandoned. This patch:
- Merges Valgrind-Freya into Valgrind code path (there should be no
  need to choose between them, Valgrind should work just fine).
- Removes leftover code (`VALGRIND_FREYA_CHECK_MEMPOOL_REQUEST` and
  `valgrind_freya_mempool_request`).
- Adds `JMEM_` prefix to Valgrind-related macros (to correctly
  leave the `VALGRIND_` prefix to Valgrind).
- Moves the definition of the Valgrind-related macros to a common
  header to avoid duplication.

Note: Adding a CI job to perform Valgrind Memchecks is left for
follow-up as it turns out to be excessively slow (>50 mins for a
`--jerry-tests --jerry-test-suite` run, and even a simple
`--jerry-tests` may get terminated prematurely because of timeout
issues).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-29 16:33:14 +09:00
Akos Kiss
3560c60c73 Make test runners support execution runtimes (#2360)
If the result of a build is not directly executable on the host
system or needs an execution runtime for any other reason (e.g.,
cross-compiled ARM binaries on Intel, emscripten-generated JS
files, binaries built with Valgrind support) then the current test
runners cannot work with them. This patch makes test runners
execute binaries via a runtime given in the `$RUNTIME` environment
variable (if it is specified).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-29 15:22:57 +09:00
Akos Kiss
a509570c1d Simplify the AppVeyor configuration file (#2361)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-28 18:59:46 +09:00
Robert Fancsik
e6664f6364 Fix heap buffer overflow in re_parse_char_class (#2352)
This patch fixes #2230 and fixes #2237.
Test cases are added for both issues and also adds new cases which caused the same error.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-05-28 10:13:17 +02:00
Istvan Miklos
ac9fce1d8d Merge jerry_get_value_without_error and jerry_value_clear_error_flag functions (#2350)
JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-05-25 11:40:35 +02:00
Akos Kiss
4779451284
Cleanup code around JERRY_UNREACHABLEs (#2342)
`JERRY_UNREACHABLE`s often signal code structure that could be
improved: they can usually either be rewritten to `JERRY_ASSERT`s
or eliminated by restructuring loops, `if`s or `#if`s. Roughly,
the only valid occurences are in default cases of `switch`es. And
even they can often be merged into non-default cases.

Moreover, it is dangerous to write meaningful code after
`JERRY_UNREACHABLE` because it pretends as if there was a way to
recover from an impossible situation.

This patch rewrites/eliminates `JERRY_UNREACHABLE`s where possible
and removes misleading code from after them.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-25 07:27:30 +02:00
Zoltan Herczeg
acb3e71436 Add JERRY_VLA calls to the snapshot tool. (#2357)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-05-25 10:34:55 +09:00
Akos Kiss
06910b456e Fix issues revealed by cppcheck 1.83 (#2355)
A more recent cppcheck has revealed some extra issues not detected
by the old one running on CI.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-24 15:48:34 +09:00