689 Commits

Author SHA1 Message Date
Robert Fancsik
99c7a4040f Super parsing options should be set only in direct eval call (#2863)
This patch fixes #2846.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-10 12:23:29 +02:00
Robert Fancsik
d2931c6e40 Rework Map object (#2760)
This patch reworks the core of the builtin Map object.

Advantages:
 - Provide sublinear access time for the elements via Lcache and property hashmap
 - This implementation is suitable for the builtin Set object as well

Also add the missing 'forEach' routine for the builtin object as well.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-17 14:50:03 +02:00
Robert Fancsik
5c72d995e4 Implement DataView builtin (#2804)
New API functions:
 - jerry_create_dataview
 - jerry_value_is_dataview
 - jerry_get_dataview_buffer

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-16 08:26:39 +02:00
Robert Fancsik
c818930cdc Use custom dispatcher for Global object's routines (#2794)
Binary size gain:
     - Intel: ~780B (gcc-7.3)
     - Arm: ~450B (arm-linux-gnueabi-gcc-7.3)

The change also contains the renovation of each builtin routine to use early return in case of error to make the code less complicated.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-16 07:48:04 +02:00
Mate Dabis
09d8793e30 Increase branch coverage: Array.prototype functions (#2796)
Added new test cases to improve branch coverage in Array.prototype routines.

The following script is made for testing branch coverage with all the test suites (--jerry-test-suite --test262 --unittests --jerry-tests), or with only one .js file.

https://github.com/matedabis/jerryscript/blob/gcov_coverage_tester/tests/gcov-tests/gcovtester.py

While measuring the branch coverage we dont count JERRY_ASSERT s. The results are measured by running all the test scripts, with the modifications in the PRs.

Branch coverage including pando-project#2682 and pando-project#2674:
	-before: 399 / 476
	-after:  472 / 476

There are 28 functions in ecma-builtin-array-prototype.c, we hit 14 from them.
The other 14 functions are either already covered, or we could not improve the coverage of it.

More information about the coverage improvement and the branches not reached:
https://gist.github.com/matedabis/d7b9fc0690aa2f4be6aa160fdf482e0e

While improving the coverage we found an unnecessary condition check, which can not be false in any cases.

Co-authored-by: Csaba Repasi repasics@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Csaba Repasi repasics@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Mate Dabis mdabis@inf.u-szeged.hu
2019-04-12 14:00:44 +02:00
Péter Gál
40f7b1c27f Rework usages/naming of configuration macros [part 1] (#2793)
There are quite a few configuration macros in the project.
As discussed in the #2520 issue there are a few awkward constructs.

Main changes:

* Renamed all CONFIG_DISABLE_<name>_BUILTIN macro to JERRY_BUILTIN_<name> format.
* The special JERRY_BUILTINS macro specifies the basic config for all es5.1 builtins.
* Renamed all CONFIG_DISABLE_ES2015_<name> to JERRY_ES2015_<name> format.
* The special JERRY_ES2015 macro specifies the basic config for all es2015 builtins.
* Renamed UNICODE_CASE_CONVERSION to JERRY_UNICODE_CASE_CONVERSION.
* Renamed ENABLE_REGEXP_STRICT_MODE to JERRY_REGEXP_STRICT_MODE.
* All options (in this change) can have a value of 0 or 1.
* Renamed ENABLE_REGEXP_STRICT_MODE to JERRY_REGEXP_STRICT_MODE.
  JERRY_REGEXP_STRICT_MODE is set to 0 by default.
* Reworked CONFIG_ECMA_NUMBER_TYPE macro to JERRY_NUMBER_TYPE_FLOAT64 name and now
  it uses the value 1 for 64 bit floating point numbers and 0 for 32 bit floating point
  number.
  By default the 64-bit floating point number mode is enabled.
* All new JERRY_ defines can be used wit the `#if ENABLED (JERRY_...)` construct to
  test if the feature is enabled or not.
* Added/replaced a few config.h includes to correctly propagate the macro values.
* Added sanity checks for each macro to avoid incorrectly set values.
* Updated profile documentation.
* The CMake feature names are not updated at this point.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-04-09 10:14:46 +02:00
legendecas
772ab277ea Fixes assertion on calling String builtin with symbol (#2803)
JerryScript-DCO-1.0-Signed-off-by: legendecas legendecas@gmail.com
2019-03-26 16:14:04 +01:00
Robert Fancsik
7d48e011c9 Fix getting the iterated object's length property (#2784)
This patch fixes #2782.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-13 13:56:01 +01:00
Robert Fancsik
ea195cd131 Use [[DefineOwnProperty]] in the iterator next step in ecma_builtin_promise_do_all (#2773)
This patch fixes #2770.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-07 08:04:19 +01:00
Robert Fancsik
1fba8901d6 Ensure that Symbol.toStringTag property is copied to buffer as a cesu8 string (#2772)
This path fixes #2769.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-06 18:45:50 +01:00
Robert Fancsik
e4fee93b92 Fix the JSON stringify context abort in case of error (#2776)
This patch fixes #2774 and fixes #2775 as well.
Also add a shortcut to access the length of the array in `ecma_builtin_json_array`.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-06 18:11:00 +01:00
Robert Fancsik
d4e27d3003 Target arraybuffer's buffer should be absolute addressed in ecma_op_typedarray_set_with_typedarray (#2758)
This patch fixes #2757, also adds a short path for the case when the source and the target typedarrays are the same.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-02-21 13:24:52 +01:00
Istvan Miklos
9c10d82e4a Fix JSON.stringify (#2759)
There was a wrong check on the property types, it did not check that the
property was name accessor. Also fixed a test case.

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2019-02-19 11:29:13 +01:00
Robert Fancsik
ed0662612d Use custom dispatcher for Array.prototype routines (#2742)
Binary size gain:
 - Intel: ~2.5KB (gcc-7.3)
 - Arm: ~1.2KB (arm-linux-gnueabi-gcc-7.3)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-02-13 10:46:57 +01:00
Robert Fancsik
4f5ffb4f3a
Implement Iterator interface and Array iterators (#2640)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-02-08 11:10:32 +01:00
Robert Fancsik
5c1a4f18ea Implement @@toStringTag well-known symbol related features (#2739)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-02-01 14:59:22 +01:00
Robert Fancsik
1ff322b72f Ensure that symbol properties are not listed in ecma_builtin_list_lazy_property_names (#2734)
This patch fixes #2733.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-31 13:42:18 +01:00
Robert Fancsik
924f4bbd74 Fix the order of value finalizing in ecma_builtin_typedarray_prototype_join (#2726)
This patch fixes #2724.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-25 11:03:11 +01:00
Robert Fancsik
7ed7935084 Add missing ecma_deref_ecma_string call to ecma_builtin_json_object (#2720)
This patch fixes #2719.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-22 01:26:34 +01:00
Roland Takacs
0b3d5edc06 Fix some type conversions in ecma-builtins. (#2706)
Added missing parentheses and explicit type conversions.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
2019-01-17 12:50:16 +01:00
Robert Fancsik
7e3d688e5b Implement the Symbol builtin object (#2601)
This patch contains the base functionalities that the new builtin object requires.

Currently unavailable:
 - print (Symbol('foo')) - this features requires the refactor of the print handler function
 - Several global symbol based builtin routines (follow up patch)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-16 10:09:23 +01:00
Robert Fancsik
d716f900e1 Fix getting array length in ecma_builtin_promise_do_{race, all} (#2702)
This patch fixes #2700.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-15 17:31:59 +01:00
Robert Fancsik
b4df594d3e Normalize routine's arguments before dispatch (#2687)
Binary size gain:
 - Intel: ~860B (gcc-7.3)
 - Arm: ~660B (arm-linux-gnueabi-gcc-7.3)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-15 16:45:16 +01:00
Robert Fancsik
ee267e8aa9 Add missing ecma_deref_ecma_string in ecma_builtin_typedarray_prototype_join (#2701)
This patch fixes #2698.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-15 09:01:33 +01:00
Robert Fancsik
f02de7a31f Add missing error check in ecma_builtin_promise_do_all (#2694)
This patch fixes #2693.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-14 23:46:01 +01:00
Robert Fancsik
2c031c1220 Implement Object.assign routine (#2678)
Related part of the standard: ECMA-262 v6, 19.1.2.1

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-14 15:04:00 +01:00
Robert Fancsik
99b968de3c Reduce the memory footprint of 'ecma_instantiate_builtin' (#2646)
This patch introduces a new builtin descriptor table to substitute the generated switch-case structure in 'ecma_instantiate_builtin',
also removes the corresponding helpers functions to simplify the instantiation process.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-09 09:04:21 +01:00
László Langó
2f8c0a168f Removed ECMA_TRY_CATCH macros from RegExp built-in (#2642)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2019-01-04 15:12:03 +01:00
Robert Fancsik
af91072f44 Ensure that ecma_builtin_json_str_helper uses [[DefineOwnProperty]] internal method (#2665)
This patch fixes #2652 and fixes #2653 as well, also reverts #2521.
Related part of the standard ECMAScript v5.1 15.12.3.10.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-03 15:30:22 +01:00
Robert Fancsik
ec142f5ff6 Fix the Map builtin name property (#2648)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-12-19 13:00:54 +01:00
Robert Fancsik
4f0b075f85 Implement ES2015 {Array, %TypedArray%}.prototype.find routine (#2631)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-12-12 10:13:05 +01:00
László Langó
a08291eb12 Unify the usage of boolean value creations. (#2623)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-11-30 11:33:30 +01:00
Robert Fancsik
e11c499b4b Reduce ecma_{ref, deref}_object calls while using ecma_builtin_get (#2616)
The following stucture was highly frequented in the code base:

 - Get a builtin object // This operation increases the reference count of the object
 - Use it for create a new object
 - Deref the builtin object

After a builtin has been instantiated there is always at least one reference to "keep it alive",
so increase/decrease the reference count for getting the value only is unnecessary.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-11-28 20:23:21 +01:00
Robert Fancsik
49a0836daa Add missing ecma_free_value in ecma_builtin_promise_do_all (#2604)
This patch fixes #2602 and fixes #2603 as well.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-11-20 14:40:34 +01:00
Daniel Balla
704eb45cb8 [API] Add RegExp C API (#2542)
This patch supports creating a RegExp object through the C API.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-11-19 13:18:00 +01:00
Robert Fancsik
9535a230ba Reduce the argument count of ecma_op_object_get_property_names (#2598)
Introduce ECMA_LIST_ARRAY_INDICES[_ENUMBERABLE[_PROTOTYPE]] flags instead of passing 3 boolean arguments.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-11-15 13:40:44 +01:00
Robert Fancsik
3faec79071 Reduce ecma_builtin_helper_def_prop arguments (#2585)
This patch uses the ECMA_PROPERTY_CONFIGURABLE[_ENUMERABLE_[WRITABLE]] marco to pass the options instead of using 3 boolean arguments for it.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-11-06 18:13:38 +01:00
Akos Kiss
aeddb1cd88
Get rid of ? true : false (#2575)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-10-29 14:51:59 +01:00
Robert Fancsik
d1860d0e34 Implement ES2015 class feature (part II.) (#2439)
This patch is the second milestone of the implementation of this new language element.

Supported:
 - Single class inheritance
 - Functionality of 'super' keyword
 - Implicit constructor in class heritage
 - Specific behaviour while extending with the built-in 'Array' or '%TypedArray%' object
 - Abstract subclasses (Mix-ins)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-10-25 16:00:48 +02:00
crazy2be
3afc4b0b85 Change jerry_port interface to allow for a correct implementation of timezones. (#2540)
The previous jerry_port interface did not allow timezones to be handled correctly,
even if the host system was up to the task. This PR changes the jerry_port interface
to allow a completely correct implementation to exist, and provides one (for Linux/BSD
systems) in default-date.c.

Fixes #1661

JerryScript-DCO-1.0-Signed-off-by: crazy2be crazy1be@gmail.com
2018-10-18 00:58:18 +02:00
Robert Fancsik
abf22597e5 Add missing error check in ecma_builtin_promise_do_race (#2546)
Fixes #2544.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-10-03 11:39:43 +02:00
Daniel Balla
7717d2ee27 Change Promise properties to internal properties (#2526)
There was an issue in the Promise implementation where properties were accessible from JavaScript.
ie. `Object.defineProperty(Object.prototype, 0, {})` could modify properties which should've been inaccessible.
The reason behind that is somewhat interesting as 0-7 were the same values as the enum values in the property list of the Promise object.
Changing these properties to internal, makes them inaccessible from JS side.

Also some tests have been changed, namely 2490 and 2465.
The 2490 one got renamed, and all of the testcases from the issue have been added.
2465 got changed as well, since currently our Promise implementation can't display Promise errors, so we should check if an error is correctly returned.

Fixes #2490

Co-authored-by: Robert Fancsik <frobert@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-09-24 13:49:41 +02:00
Robert Fancsik
685d8b3675 Fix JERRY_CONTEXT (error_value) handling during ecma_builtin_promise_reject_abrupt (#2519)
Fixes #2489.

Co-authored-by: Daniel Balla <dballa@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-09-17 18:27:00 +02:00
Peter Marki
0d05dfcd68 Remove bad assertion in ecma_builtin_json_str_helper (#2521)
Fixes #2494

JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2018-09-14 12:04:47 +02:00
Daniel Balla
8f64339e5f Fix ecma_op_object_put return value not being handled (#2514)
Fixes #2487
Fixes #2488

Co-authored-by: Robert Fancsik frobert@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-09-06 21:05:37 +02:00
Zoltan Herczeg
d3d42f7685 Implement the core of the map object. (#2447)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-09-04 13:30:00 +02:00
Daniel Balla
f5757e4c91 Fix ecma_builtin_promise_race_or_all function (#2491)
If a new Capability was created no check was issued if it happened to be an error.
Fixes #2465
Fixes #2468
Also fixes the second variant of #2490.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-08-31 16:45:32 +02:00
Anthony Calandra
b2cf7eb659 Add %TypedArray%.prototype.sort([ compareFunction ]) support. (#2437)
JerryScript-DCO-1.0-Signed-off-by: Anthony Calandra anthony@anthony-calandra.com
2018-08-22 08:49:12 +02:00
Martine Lenders
851f4f0b89 Fix LLVM/clang conversion errors (#2473)
This fixes some conversion errors one gets when compiling with
LLVM/clang. Most of them are caused when a bit-specific type (i.e.
`uint16_t`) is implicitly cast to an `enum` of smaller value range.

The fix is just an explicit casting of those types to the desired target
type.

JerryScript-DCO-1.0-Signed-off-by: Martine Lenders m.lenders@fu-berlin.de
2018-08-21 08:22:57 +02:00
Akos Kiss
b31e43075a Add explicit casts to enum-to-integer conversions (#2467)
Clang 6 is more picky about implicit conversions and complains
about loss of presicion and/or change of signedness.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-13 13:01:37 +09:00