- Optimize year from time calculation
- Force arithmetic operations to int32_t/int64_t whenever possible
- Optimize number conversion in date parse
- Cache local TZA of the date object
- Fix a bug in Date.parse timezone parsing
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
The removal of these macros enabled cppcheck to reveal new errors.
These errors are also fixed by the patch.
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
The spec doesn't say explicitly that Date.parse should call TimeClip
abstract operation at the end. But Date object can represent time
values only in the range 1970 Jan 01 +/-8,640,000,000,000,000 ms.
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
Now the following conventions are applied:
- passing the number of arguments for a function call is always uint32_t
- string size/length/position related operation should use lit_utf8_size_t
- Extended objects internal fields must be uint32_t
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
A list of changes:
- 'es2015-subset' profile is deprecated, and an 'es.next' profile is added.
- The default profile is changed to 'es.next'
- Renamed the JERRY_ES2015 guard to JERRY_ESNEXT
- Renamed JERRY_ES2015_BUILTIN_* guards to JERRY_BUILTIN_*
- Moved es2015 specific tests to a new 'es.next' subdirectory
- Updated docs, targets, and test runners to reflect these changes
Resolves#3737.
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
A large rework because surrogate pairs must be combined.
Currently only the 0x10C80..0x10CF2 is accepted as valid identifier character from the non-basic plane.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
If ecma_date_parse_year got an invalid date string, it could overread the input string.
The problem was that we compared the original str_p to str_end_p instead of str_start_p.
Additionally I simplified the parser loop.
Fixes#3388.
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
Code cleanup after #3314. Reverting already parsed '-' sign
after parse fail is unnecessary, because in this case the whole
date parse is failed.
Additionally this dead code was incorrect too, because it didn't
modify the original pointer to the string, but a local variable.
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
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
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
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
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
ES5.1 15.9.4.2 specifies that Date.parse (string) has to accept
at least Date Time String Format: YYYY-MM-DDTHH:mm:ss.sssZ. But
the spec allows implementation-specific fallbacks. Additionally
ES5.1 15.9.1.15.1 specifies Extended years format, but isn't
explicitly required to be accepted by Date.parse. But ES6 already
clarified that Date.parse has to accept extended years format too.
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
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
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
They are no big differences between the two forms as "" falls back
to <>. There are some inconsistencies in the code, though, which
are fixed by this patch.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
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
Fixes issue #2073, which introduced an error caused by Date.parse()
The problem was that the function didn't properly check if there was a ':' after the hours.
If any UTF8 character was inserted there which got decoded into multiple characters, it caused the pointer to point at a wrong character.
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
Since the project is now hosted at the JS Foundation we can move to unified copyright notices for the project.
Starting with this commit all future contributions to the project should only carry the following copyright notice (except for third-party code which requires copyright information to be preserved):
"Copyright JS Foundation and other contributors, http://js.foundation" (without the quotes)
This avoids cluttering the codebase with contributor-specific copyright notices which have a higher maintenance overhead and tend to get outdated quickly. Also dropping the year from the copyright notices helps to avoid yearly code changes just to update the copyright notices.
Note that each contributor still retains full copyright ownership of his/her contributions and the respective authorship is tracked very accurately via Git.
JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
Class and value internal properties are always exists for primitive
types (e.g. Boolean, Regex) so they can be stored right after the
object. This improve property access (since internal properties are
searched by a slow linear algorithm) and reduces memory consumption,
since only 8 byte is allocated for these two properties instead of
16 which is the size of a property pair.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Removing a lot of ECMA_PROPERTY_VALUE_PTR macro calls. The only drawback
is free callbacks for native objects cannot be deleted anymore. Redefining
a free callback is a rare case, so this trade-of is acceptable.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
The standard doesn't defines ECMAScript Compact Profile as a subset of Ecma-262 Edition 5.1.
Profile modes can be added easily like the minimal profile if required.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
Several internal properties are removed and directly stored as
part of the object. Faster built-in and JS function processing.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Correct behaviour of step 8, 15.9.3.1, ECMA-262 v5.1.
- Change ToInt32(y) to ToInteger(y).
- If ToInteger(y) is not between 0 and 99 then yr = y
Related issue: #1071
JerryScript-DCO-1.0-Signed-off-by: Hanjoung Lee hanjoung.lee@samsung.com
JerryScript-DCO-1.0-Signed-off-by: Hanjoung Lee hanjoung.lee@samsung.com
String, Boolean) to use ecma-values. When the value of a Number object is
a small integer number, this change reduces the memory consumption, since no
double is allocated.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This change affects only those internal properties which have a primitive value field.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
Replaced `gettimeofday`-related code with `jerry_port_get_current_time`
and `jerry_port_get_time_zone` function calls. Moved old code to
default port implementation.
Removed `ENABLE_DATE_SYS_CALLS` as date syscalls should "just work".
Fix DST adjustments: even if `gettimeofday` returns meaningful data in
`tz_dsttime`, the value is just a flag (or, according to some sources,
a tri-state value: >0 if DST applies, ==0 if DST does not apply, <0 if
unknown). Hitherto, the field was simply added to/subtracted from a
time value in milliseconds. To use it approximately correctly, the
field's value should be multiplied by "millisecs/hour".
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
itself seems a step back, but the primary aim is opening future
optimization opportunities. The list of changes follows:
- Property is changed to be an abstract type, which has type, flags,
and a value. It does not have a name anymore and property pointers
cannot be compressed.
- Full (32 bit) ecma values can be property values. This allows
using non-compressed pointers for ecma values in the future.
- The property chain is not restricted to the same item anymore,
it can contain hash maps, arrays in the future.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com