Samsung / escargot

Escargot is a lightweight JavaScript engine designed specifically for resource-constrained environments.
GNU Lesser General Public License v2.1
268 stars 43 forks source link

Support the Latest ECMAScript Standard #498

Closed clover2123 closed 4 years ago

clover2123 commented 4 years ago

Update the ECMAScript 2019 (the latest standard) on Escargot

ECMAScript 2019 Standard : ecma-262/10.0

Based on the upper standard, we are going to update the new ES10 standard and missing features from ES7 to ES10.

New Features

ECMAScript 2016

ECMAScript 2017

ECMAScript 2018

ECMAScript 2019

Achie72 commented 4 years ago

Do we want to have separate TC-s for separate functions under Escargot/es2010 like we did with ES6?

clover2123 commented 4 years ago

@Achie72 Since a new ECMAScript standard is released in every year, we think that it's not quite important to separate each ECMAScript version now. Therefore if you want to add any new TCs with the latest feature, please add it to the existing Escargot/es2015. I'll re-name the repositary soon (such as new_es).

Achie72 commented 4 years ago

@clover2123 i think we can look into updating a few things here:

clover2123 commented 4 years ago

@Achie72 The list updated. Thanks. It seems that almost all the necessary features are implemented except lookbehind assertions in regular expression.

Achie72 commented 4 years ago

Lookbehind is only supported by a V8, where it is faulty as well, and no other big engines have it as far as i know.

/(?<=((x.)\2)+)a/.exec("xyxyxsxsa")

output:
(3) ["a", "xy", "xy", index: 8, input: "xyxyxsxsa", groups: undefined]

This is because it is a very controversial feature, as it not defined exactly how it should behave in complex situation, and if it is implemented, it is very resource intense and therefore sometimes it has limited or just tricked behavior to achieve an easier inner workings (see V8 example above).

If we still want this feature, we can look into it, but seeing as no other engines have it, maybe we should leave this one out too imo.

zherczeg commented 4 years ago

I think the problem with lookbehind, is that the trivial solution (scanning from the beginning of the subject string) is way too slow, and the opposite method - scanning backward - is kind of impossible to implement efficiently because of the corner cases. So far only Google tried it, and they failed. We could consider ignoring this feature.

clover2123 commented 4 years ago

@Achie72 @zherczeg I didn't know the notoriety of that feature. We decide not to support lookbehind feature as well. Thanks for your feedback!

clover2123 commented 4 years ago

From now on, we will going to pass more TCs such as v8 (kangax too). First of all I'll update vendor TCs to the latest version. Thank you for all your contributions.