For negative out-of-range time values, ecma_date_year_from_time
fell into an infinite loop. (Moreover, for positive out-of-range
time values, it returned an incorrect year.) This patch fixes the
helper to return NaN in these cases (and ensures that its call
sites are prepared for NaN values).
Fixes#1657.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Those tests are related the actual daylight saving adjustment.
Related issue: #1661
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
Rework date to string conversion, and remove nan checks from inline
functions. Furtermore some inline functions are changed to normal
functions.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Before this patch each built-in routine had a separate C
function. Although these functions shared a lot of common
operations compilers cannot eliminate these code duplications
in the final binary code. This patch introduces a single C
function which handles all date prototype routines. Each
shared code block has only one binary represenation.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
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
The ecma_date_make_day() handled any date in October on leap years incorrectly,
which was mentioned in issue #1836. The ecma_date_week_day() returned minus values
when return week_day before 1970 years which was also incorrect.
This change solves these bugs. In addition, this enhances the algorithm of accessing 'the ym-mn-1'
by replacing binary search to simple computation at ecma_date_make_day().
JerryScript-DCO-1.0-Signed-off-by: Hayun Lee lhy920806@gmail.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
OS X build regularly reports some 39 warnings falling in 3 major
categories:
* "static function '...' is used in an inline function with
external linkage [-Wstatic-in-inline]": Some semantics around
`inline` have changed between C89 and C99, and gcc and clang seem
to disagree on how strict they should be about them. Solution
chosen is to use `-Wnostatic-in-inline` command line option for
clang.
* "implicit conversion turns floating-point number into integer:
'double' to 'bool' [-Wfloat-conversion]": `if (fmod (..., ...))`
was used at different places, which is not nice anyway, thus the
return value is compared explicitly against `ECMA_NUMBER_ZERO`.
* "format string is not a string literal [-Wformat-nonliteral]":
Console and log port I/O functions have a printf-like interface,
and the default implementations actually pass both format string
and the remaining arguments to a vfprintf. However, clang is
strict about the format string parameter of vfprintf and expects
a literal there. By annotating the port I/O functions with
`__attribute__ ((format (printf, ..., ...)))`, clang will check
the format string being a literal string earlier, when the port
functions are called, and will not complain within them when
vfprintf is called.
(Actually, this has revealed an incorrect format string, which
has been fixed as well.)
(There were also some single conversion errors not listed above.)
The patch was tested on OS X (where all warnings disappeared), but
it should help clang compilation on other OS's as well.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
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
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
The internals have surprisingly large number of unused functions at
surprising places. This patch cleans them out to make maintenance
easier and to prevent dead code having effect on future decisions.
The patch intentionally does not try to clean up public API but
focuses on internal modules only that are/should not be reachable
from "outside".
However, unit tests do access private API, thus tests of literal
storage had to be adjusted.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
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
* Rename modified fdlibm to jerry-libm
* Move third-party/fdlibm to jerry-libm
* Rename original fdlibm.h to jerry-libm-internal.h
* And remove it from the public headers.
* Rename jerry-libm's public header to math.h
* This also makes jerry-core sources include `<math.h>`. Therefore,
should anyone want to use a different libm implementation with
jerry, it becomes possible. (The same way as we provide a minimal
libc with standard headers, but should it be insufficient or
conflicting for someone, it can be replaced.)
* Drop `s_` prefix from jerry-libm sources
* The original fdlibm implementation had various prefixes (e.g., `k_`
for sources of kernel routines, and `w_` for wrapper routines), but
after the specialization of fdlibm to jerry, only `s_` remained.
Since it does not encode anything anymore, it can be dropped.
* Stylistic edits to jerry-libm's CMakeLists
* Align project name with other CMakeLists in the code base
* Move Jerry-LibM under Apache License
* Using the same approach as was used by linux-wireless when ath5k
driver license needed clarification. Solution was proposed by SFLC.
External mail for future reference: http://lwn.net/Articles/247806/
* Tests & checks
* Remove FD from the name of libm unit test-related files
* Make vera++ and cppcheck check jerry-libm
* Targets
* Speculative update of targets to use jerry-libm
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Use empty string for message property of builtin error objects
by default. Add ERROR_MESSAGES build option.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
Use DATE_SYS_CALLS=ON for make target to enable the
date related system calls. Also fix some minor issues.
Related issue: #923
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
Related issues: #213, #691
* Fixed 'ecma_date_local_tza' and 'ecma_date_daylight_saving_ta' date builtin helper functions
* Added syscall of gettimeofday function to get the current system time and timezone.
* Fixed related regression test files.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
Remove ecma_completion_value_t, and add an extra bit to
ecma_value_t to represent errors. From the long list of
completion types only normal and error remained.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com