585 Commits

Author SHA1 Message Date
Zoltan Herczeg
110f75c99d Implement the core of the generator functions. (#3368)
Some things are missing:
 - yield* support
 - generator definition in object literal
 - the hidden GeneratorFunction

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-28 11:54:27 +01:00
Szilagyi Adam
0c6b306429 Implement Regexp.prototype[@@match] method (#3345)
The algorithm is based on ECMA-262 v6, 21.2.5.6

The following helper methods are also implemented:
  - RegExpExec: ECMA-262 v6, 21.2.5.2.1
  - AdvanceStringIndex: ECMA-262 v6, 21.2.5.2.3

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-11-26 16:05:48 +01:00
Csaba Osztrogonác
4d422e17df Make Date.parse() ECMA-262 conform (#3314)
Changes:
- Parse output of Date.prototype.toString() and Date.prototype.toUTCString()
- Date.prototype.toString() is ECMA-262 v9 conform now, only TZ part changed
  (Before ECMA-262 v9 it was implementation-dependent.)
- Reused day_names_p and month_names_p arrays (and made them more efficient)
- Tests updated and new tests added

Fixes #2946.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-11-26 13:04:11 +01:00
Dániel Bátyai
37850bbfef Fix refcount when returning with the argument in Object built-ins (#3353)
Fixes #3350.
Fixes #3351.
Fixes #3352.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-25 11:49:24 +01:00
Dániel Bátyai
b2d34724d4 Fix Reflect.getPrototypeOf for primitive arguments (#3354)
Fixes #3349.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-25 11:49:04 +01:00
Dániel Bátyai
279d4d4119 Add handling for RegExp unicode and sticky flags (#3341)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-22 14:04:03 +01:00
Dániel Bátyai
fc2218e828 Fix weakrefs when adding a key to the same container multiple times (#3343)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-22 13:55:36 +01:00
Dániel Bátyai
3bf2bc50bc Properly handle primitive arguments in Object methods (#3342)
ES2015 allows primitive arguments for most of the Object built-ins.
This change implements handling for these arguments in affected methods.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-22 12:48:10 +01:00
Szilagyi Adam
a0a71da025 Implement toPrimitive method and Date.prototype.toPrimitve (#3287)
The algorithms are based on ECMA-262 v6 7.1.1 and 20.3.4.45

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-11-20 11:51:02 +01:00
Szilagyi Adam
c31452c138 Implement IsRegExp operation (#3321)
Algorithm is based on ECMA-262 v6, 22.1.3.1.1

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-11-20 11:50:26 +01:00
Dániel Bátyai
bd0cb33172 Implement WeakMap and WeakSet (#3328)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-19 19:27:31 +01:00
Szilagyi Adam
a7d129c8b2 Implement Symbol.isConcatSpreadable (#3307)
Algorithm is based on ECMA-262 v6, 22.1.3.1.1

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-11-19 13:55:49 +01:00
Csaba Osztrogonác
3b5224b98d Fix timezone in Date.prototype.toString() (#3310)
Timezone minutes part was always 0 instead of the proper value.
Additionally fixed minor typos in comments.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-11-14 10:13:15 +01:00
Dániel Bátyai
b16b400d5b Fix cleanup upon error in String.prototype.replace (#3301)
Fixes #3297

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-12 10:54:26 +01:00
Szilagyi Adam
452c78182d Implement String.prototype.codePointAt method (#3291)
The algorithm is based on ECMA-262 v6, 21.1.3.3

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-11-11 15:54:49 +01:00
Szilagyi Adam
798655a871 Implement Array.prototype's copyWithin method (#3269)
The algorithm is based on ECMA-262 v6, 22.1.3.3

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-11-08 15:41:20 +01:00
Szilagyi Adam
35d9b1ab17 Implement String.fromCodePoint method (#3281)
The algorithm is based on ECMA-262 v6, 21.1.2.2

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-11-08 13:48:05 +01:00
Dániel Bátyai
923fd128b5
Refactor String.prototype.replace (#3284)
This change brings the replace operation up to date with ES6 by
implementing support for the @@replace well-known symbol, while
also improving performance and memory usage.

Also fixes #3070.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-08 12:15:28 +01:00
Csaba Osztrogonác
55423ab82a Simplify ecma_builtin_date_parse function (#3280)
This PR is the preparation of the #2946 issue.
(Date.parse() should handle UTC date string format)

Changes:
- Handle min/max values in ecma_date_parse_date_chars function instead of code duplication
- Parse special characters in the new ecma_date_parse_special_char function
- Additionally fixed two parsing issue: invalid formats should be refused

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-11-06 14:51:17 +01:00
Ádám Kallai
a8b627a80c Implement Object.is routine from ES2015 specification (#3272)
Related part of the standard: ECMA-262 v6, 19.1.2.10

JerryScript-DCO-1.0-Signed-off-by: Adam Kallai kadam@inf.u-szeged.hu
2019-11-05 19:38:13 +01:00
Robert Fancsik
f93fa98a75
Add Number.{EPSILON, {MAX,MIN}_SAFE_INTEGER} to the builtin descriptor (#3258)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-31 15:06:19 +01:00
Robert Fancsik
d1faed7d03
Properly release callback result in ecma_builtin_typedarray_prototype_exec_routine (#3263)
This patch fixes #3262.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-31 11:08:16 +01:00
Szilagyi Adam
cc9a657425 Optimize array shift/unshift for fast-array cases (#3235)
Performance results:
Intel: 13m11s -> 0m10s
ARM: over 20m -> 2m27s

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-30 16:59:20 +01:00
Szilagyi Adam
222e774cc2 Optimize array indexOf/lastIndexOf for fast-array cases (#3233)
Performance result:
Intel: 0m27s -> 0m23,5s
ARM: 5m13s -> 4m20s

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-30 16:49:13 +01:00
Szilagyi Adam
6639bbc580 Optimize array reverse for fast-array cases. (#3231)
Performace result:
Intel: 5m30s -> 0m3,9s
ARM: over 15m -> 1m14s

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-30 16:44:29 +01:00
Szilagyi Adam
d801fc70bb Optimize array slice for fast-array cases (#3213)
Performance results:
Intel: 0m27s -> 0m7s
ARM: 5m42s -> 1m26s

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-30 16:43:17 +01:00
Robert Fancsik
1c34539997
Rework array hole calculation for fast access mode arrays (#3248)
This patch gives possibility to Array.prototype builtin routine optimizations.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-29 10:10:25 +01:00
Robert Fancsik
42ab062441
Introduce ecma_op_object_get_length and ecma_op_object_get_by_index operations (#3245)
These two functions helps to reduce code duplication, also invokes the elimination of several ECMA_TRY_CATCH macros.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-29 10:07:20 +01:00
Daniella Barsony
11818f1cb0 Fix issue about Number.prototype.toString (#3232)
Fixes #3229

JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-10-29 08:35:55 +01:00
Szilagyi Adam
072aedb4ef Fix wrong error handling in ecma_builtin_function_helper_get_function_arguments (#3257)
Fixes #3252

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-28 14:23:53 +01:00
Szilagyi Adam
4b352758c1 Refactor ecma_op_to_string (#3171)
Similar to the ecma_op_to_object rework, in this new method we
return directly with the pointer to the ecma string, and we don't
wrap the result into an ecma_value_t

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-25 15:58:47 +02:00
Robert Fancsik
3b73562fa5 Revise ES2015 feature guards (#3240)
All the basic language element guards are merged into JERRY_ES2015 macro guard.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-24 14:44:51 +02:00
Daniella Barsony
7b589d1381 Refactor code to use ToLength (#3210)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-10-21 14:08:13 +02:00
Virag Orkenyi
3fb6f15730 Implement Reflect object (#3036)
JerryScript-DCO-1.0-Signed-off-by: Virag Orkenyi orkvi@inf.u-szeged.hu
2019-10-21 13:46:29 +02:00
Daniel Vince
d85988af96 Implement ES2015 Function.prototype[@@hasInstance] (#3225)
Added hasInstance well known symbol implementation for Function.prototype.
This change however does not implement the ES2015 `instanceof` operator changes.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: Dániel Vince vinced@inf.u-szeged.hu
2019-10-21 11:04:12 +02:00
Robert Fancsik
a40eb9bab8
Remove duplicated error raising in ecma_op_typedarray_set_with_typedarray (#3223)
This patch fixes #3222.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-17 11:56:14 +02:00
legendecas
2e86bdae6f Add ArrayBuffer detach operations (#3208)
JerryScript-DCO-1.0-Signed-off-by: legendecas legendecas@gmail.com
2019-10-16 16:41:27 +02:00
Szilagyi Adam
09c5d98e25 Optimize array push/pop for fast-array cases (#3187)
Performance results:
ARM: 1m19s -> 0m57s
Intel: 0m7,5s -> 0m5s

Binary size increase: 168 bytes

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-16 16:41:01 +02:00
Daniella Barsony
390916e989 Add Array.prototype.fill method (#3201)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-10-16 16:37:56 +02:00
Szilagyi Adam
5320f5a396 Use stringbuilder in typedArry toLocaleString (#3207)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-16 16:37:19 +02:00
Robert Fancsik
9e323cdcd6
Improve ecma_typedarray_info_t (#3205)
- The structure members have been renamed and the members got more detailed description.
- Updated the usage of the typedarray info structure in all occurrences to use absolute addressing from the underlying arraybuffer pointer.

This patch also fixes #3204.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-09 14:10:54 +02:00
Szilagyi Adam
848a9854c3 Add missing value release in typedArray toLocaleString (#3200)
Fixes #3162

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-07 16:28:30 +02:00
Szilagyi Adam
0f754ff33c Fix count variable calculation in typedarray copyWithin (#3158)
Fixes #3130

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-07 11:31:44 +02:00
Zsolt Borbély
e54666b448 Fix the include format of math.h (#3197)
The order of includes are also fixed.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2019-10-03 17:39:57 +02:00
Dániel Bátyai
c17da4f33b Use a string builder in Array.prototype.join and toLocaleString (#3184)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-10-03 11:30:38 +02:00
Csaba Osztrogonác
6a848a36fd Make Date.parse handle 24:00:00.000 time properly (#3196)
ES5.1 15.9.1.15 Note1 defines that 24:00 is same as 0:00
of the next day. The spec explicitly doesn't mention that
24:01 should be invalid, but it should be self-evident.
(FireFox and Chrome also refuses times bigger than 24:00)

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-10-03 09:49:51 +02:00
Dániel Bátyai
c3bb516e4a Refactor RegExp builtin (#3136)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-10-02 16:55:16 +02:00
Szilagyi Adam
c3510fc03d Improve typedArray get, set (#3023)
Here are the following changes:
  - The getter and setter methods are callback based now, and we can use
    them with the proper typedArray id
  - The typedArray set_element and get_element methods are using memcpy now.
  - There is a new struct which contains basic informations from typedArray,
    and we are using this in most of the prototype methods.
  - Eliminated ecma_op_typedarray_set_index_prop and
    ecma_op_typedarray_get_index_prop, because these methods
    also calculated the same informations which are in the new
    struct, so we use the new method instead.

Co-authored-by: Robert Fancsik frobert@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-02 16:39:26 +02:00
Csaba Osztrogonác
32c74fff22 Fix Date.prototype.toString() and toISOString() (#3175)
The implementation was incorrect for negative years and years bigger than 9999.
-1 was 000/ because the negative (year%10) was added to '0' character, years
bigger than 9999 was truncated to 4 digits.

ES5.1 15.9.1.15.1 defines extended years format with 6 digits, but toString()
and toISOString() sections don't mention anything about extended years. ES6
20.3.4.3 already clarifies that Date.prototype.toISOString() should use this
extended year format if it is necessary.

Changes:
- Date.prototype.toString() uses 4 digits for years by default, 5 or 6 if it
is necessary and put '-' sign for negative years, no sign for positive years.
Date.prototype.toString() was implementation dependent until ES9, but ES9
already specify exactly this format.
- Date.prototype.toISOString() uses fixed 4 digits for years 0 - 9999,
otherwise sign + 6 digits (extended years).
- Tests added for corner cases.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-10-02 10:26:20 +02:00
Robert Fancsik
fbca37fde6
Fix argument validation for Number.prototype.toPrecision (#3176)
This patch fixes #3173

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-02 10:25:52 +02:00