1905 Commits

Author SHA1 Message Date
Akos Kiss
b39474c746 Merge sin/cos/tan and all helper functinos in a single source
* Made helper functions static.
* Changed the signature of __kernel_rem_pio2 not to require the
  ipio2 argument

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-04-06 13:45:22 +02:00
Akos Kiss
a72caf1301 Turn simple constants to preprocessor macros
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-04-06 13:45:22 +02:00
Akos Kiss
397dff81ee Specialize fdlibm to jerry
Keep IEEE code paths only:
* removed SVID, XOPEN, POSIX code paths from everywhere.
* deleted s_lib_version.c, as version is only useful if multiple
  standards are supported.
* deleted k_standard.c, as it handles non-IEEE exception cases only.
* renamed the e_{acos,asin,atan2,exp,fmod,log,pow,sqrt}.c sources as
  s_.*, dropped the __ieee754_ prefix from the names of the
  appropriate functions therein, and deleted the
  w_{acos,asin,atan2,exp,fmod,log,pow,sqrt}.c wrapper code.

Keep C99 declaration variants only:
* removed old C-style function declaration variants.
* removed data declaration variants where const qualifier was not
  used.

Clean unused sources/functions:
* removed s_{rint,significand,tanh}.c and the appropriate functions
  defined therein.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-04-06 13:45:22 +02:00
Zoltan Herczeg
d674b92f26 Refactor object properties to become real fields.
The positive side effect is that the maximum Jerry memory is increased to 512K.
Furthermore a slight (1.3%) performance improvement was measured on RPi2 with
SunSpider.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-04-06 03:36:44 -07:00
Zsolt Borbély
2f661f9509 Modify the buildoption-test and add to Travis CI as a job
MCU-targets were removed from buildoption-test temporarily.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-03-30 15:25:36 +02:00
Zsolt Borbély
21f8f06c51 Test the build options
Add new build target: test-buildoptions
Now every build option is tested on the proper targets. These are the native
and the MCU targets in release mode and unittests.
Therefore the USE_COMPILER_DEFAULT_LIBC build option is refactored.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-03-25 10:19:00 +01:00
Geoff Gustafson
f0db5c9754 Fix compile warnings about always_inline functions in GCC 5.2.0
The warning is "always_inline function might not be inlinable", fixed by
adding inline keyword. See:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55830

JerryScript-DCO-1.0-Signed-off-by: Geoff Gustafson geoff@linux.intel.com
2016-03-24 08:40:11 -07:00
Zoltan Herczeg
cc23c225ea Fix snapshot saving issue.
Snapshot save algorithm should not resolve uninitialized literals.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-03-24 02:57:31 -07:00
Akos Kiss
6290b2d236 Remove MEM_HEAP_PTR_64 macro
MEM_HEAP_PTR_64 is duplicating existing information: stdint.h, which
header is already used by the project, defines various _MAX macros
for upper limits of integer types. The comparison of UINTPTR_MAX and
UINT32_MAX can give the same info as encoded in MEM_HEAP_PTR_64.
The stdint.h-based approach has the benefit that jerry can support
any 64-bit architecture without the need for editing the build
system. (With the existing approach, CMakeLists has to know about
every 64-bit architecture to work properly.)

Thus, removing the extraneous macro from the code.

The patch also changes the mem_pools_chunk_t struct, as it turned
out that the struct does not have to be padded to MEM_POOL_CHUNK_SIZE.
(The padding also depended on MEM_HEAP_PTR_64.) It is enough if the
size of the struct is smaller than (or equal to) MEM_POOL_CHUNK_SIZE.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-22 22:14:47 +00:00
László Langó
2027caeda5 Performance optimizations
* inline some hot function
 * add 'ecma_copy_value_if_not_object' similer to 'ecma_value_free_if_not_object'
 * remove unnecessary helpers
 * improve 'do_number_bitwise_logic'

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-03-22 08:05:00 +01:00
François Baldassari
94f887919e Make target provide jerry-port.c
JerryScript-DCO-1.0-Signed-off-by: François Baldassari francois@pebble.com
2016-03-21 13:08:11 -07:00
Zoltan Herczeg
af246943f2 Optimize string character access for ascii strings and refactor type store
to allow two byte hashes in the future.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-03-21 02:24:35 -07:00
Akos Kiss
91b1547fa5 Add unit testing of fdlibm
The project is relying on a variant of fdlibm, which has aleady
been edited but never verified for correctness. This patch adds
unit testing of fdlibm by:

* introducing a test generator that uses a trusted libm
  implementation to calculate correct and expected results of math
  functions
  (tools/gen-test-fdlibm.sh and tools/unit-tests/gen-test-fdlibm.c),
* adding tests created with the generator that stress all publicly
  exported functions of jerry's fdlibm
  (tests/unit/test-fdlibm.inc.h), and
* adding a unit test file to drive the generated tests
  (tests/unit/test-fdlibm.c).

Note: The test generator is not expected to be executed often, thus
it is not wired into the build system. If it gets edited, it must
be used locally to re-generate the .inc.h file.

During development, it turned out that tests/unit/test-common.h
included the system header math.h, which was only a bad smell until
now but became a real header conflict issue with the introduction
of the fdlibm unit test. Thus, this patch also changes the include
to fdlibm-math.h.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-21 09:21:48 +01:00
Akos Kiss
48dca0af35 Fix: code-related vera++ rules should not be enforced in comments
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-21 08:51:26 +01:00
Akos Kiss
57db5ca918 Fix regexp character classes with \uNNNN and \xNN code points
Currently, if a regexp contains a character class and that
character class contains a hex-specified code point -- either
\uNNNN or \xNN --, then the character 'u' or 'x' is added to the
character class as well. This patch fixes the error and also adds
a regression test covering the issue.

Fixes #962

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-20 13:52:14 +01:00
Akos Kiss
69291e2dc4 Remove exec mode from non-executable files
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-20 12:24:05 +01:00
François Baldassari
b59af40e91 Fix precommit scripts on OSX
JerryScript-DCO-1.0-Signed-off-by: François Baldassari francois@pebble.com
2016-03-18 10:06:09 -07:00
László Langó
e1f20ad474 Use code unit instead of code point
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-03-18 09:59:04 +01:00
Zsolt Borbély
005f73a6f0 Fix build with enabled LOG option
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-03-17 09:11:54 +01:00
Akos Kiss
ea2f0e44fb Fix terminology of snapshot saving in literals and main
In case of literals and in main, snapshot saving is incorrectly
named dumping. Elsewhere in the code, 'dump' functions output debug
data (even literals have a `lit_dump_literals` debug function). To
help distinction and to align terminologies, snapshot saving
functions of literals and command line options of main are also
re-named 'save'.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-16 11:26:46 +01:00
Zoltan Herczeg
d190ca44ae Storing byte code size in the byte code header. This reduces the
memory consumption, because the new allocator uses less memory if
the size as available when a block is freed. Snapshot generation
is also simplified.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-03-16 02:58:10 -07:00
Akos Kiss
2a5d17e736 Fix SCCS IDs in fdlibm
Most of the legacy version control IDs in fdlibm are already simple
comments at the beginning of the source files. However, in some
files, there are leftover global variables and pragmas. (The global
variable in e_pow.c even increases the .data section in both debug
and release builds.) This patch turns all legacy IDs to comments of
unified style.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-16 09:32:50 +01:00
Akos Kiss
3e02e792b6 Fix .size longjmp in the linux port of jerry-libc
Fixing a typo, which resulted in an undefined (but harmless) symbol
in jerry-asm.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-12 00:34:34 +01:00
François Baldassari
05e7a837c4 Allow external builds to use non-gnu compilers
JerryScript-DCO-1.0-Signed-off-by: François Baldassari francois@pebble.com
2016-03-11 10:13:26 -08:00
François Baldassari
7b047d4b20 Add acquire_value API to simplify caller code
JerryScript-DCO-1.0-Signed-off-by: François Baldassari francois@pebble.com
2016-03-11 09:57:40 -08:00
Akos Kiss
66c94b7d9b Refactor the printing of memory usage statistics
Make the internal heap and pools memory usage statistics APIs more
similar: how the print functions are named, where they are
implemented, and which parts of them are guarded by `MEM_STATS`.
Also, adapt unit tests to the changes.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-11 10:51:40 +01:00
Akos Kiss
011dacd1a7 Fix initialization from incompatible pointer type error in re_dump_bytecode
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-11 09:02:06 +01:00
Akos Kiss
a9c77b49ee Improve the dumping of literals
* Guard `lit_dump_literals` with `JERRY_ENABLE_LOG` (both in source
  and in header).
* Change `printf`s to `JERRY_DLOG`.
* Make `lit_dump_literals` be called in `lit_finalize` (it was dead
  code).
* Remove its duplicate declaration from lit-literal.h

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-11 08:48:29 +01:00
François Baldassari
c82caa7f3c Initlialize ecma gc state on jerry init
JerryScript-DCO-1.0-Signed-off-by: François Baldassari francois@pebble.com
2016-03-10 15:35:47 -08:00
Akos Kiss
6e687fa6b7 Remove support for per-instruction memory statistics
The new CBC interpreter does not support it anymore, thus removing
related code.

(As a side-effect, `jerry_flag_t` has been refactored from
`uint32_t` and associated defines to an enum.)

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-10 13:19:36 +01:00
László Langó
6f536c7942 Few improvements for RegExp
Added eviction mechanism to RegExp cache and small
refactoring. Fixed a bug when logging is enabled.

Related issue: #927

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-03-10 13:09:08 +01:00
Akos Kiss
7a07e55411 Unify the naming scheme of all header defines
There have been several renamings of header files but the
ifndef/define/endif preprocessor directives did not always follow
the file name changes (or perhaps never followed a unified naming
scheme). This patch gets all headers aligned with the style of the
majority.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-10 11:26:14 +01:00
Akos Kiss
a19f63f4a5 Check unit tests with vera++ & fix reported issues
Cppcheck has already been used for checking unit test sources
statically but vera++ style-checking of unit tests was left out,
most probably only by mistake. This patch adds unit tests to the
set of style-checked sources and also fixes the stlye issues that
were present in the test code.

(Extra: since the project is pure C now, not trying to collect
*.cpp files anymore.)

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-10 11:13:47 +01:00
László Langó
21e2951a44 Use '-Werror' instead of '-Werror=...' for Jerry libc
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-03-09 15:39:56 +01:00
Robert Sipka
073ab05366 Build fix for mbedk64f target
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-03-09 14:36:45 +01:00
László Langó
ab26d57841 Don't use messages for errors by default
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
2016-03-09 11:44:32 +01:00
Akos Kiss
81d4c97a3a Add ARM cross build and QEMU user space emulated tests to the CI
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-09 10:07:00 +01:00
Robert Sipka
0b5a49f98b Warning fixes.
Passing argument 1 of ‘strncmp’ from incompatible pointer type.
Assignments from incompatible pointer types.
Passing argument or initialization discards ‘const’ qualifier from pointer target type.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-03-09 09:41:23 +01:00
Akos Kiss
25b0750756 Fix problems arising from incorrect use of various size types
E.g.,
* `ssize_t` was used where `lit_utf8_size_t` or `jerry_api_size_t`
  would have been correct,
* `lit_utf8_size_t` was used where `ecma_length_t` would have been
  correct.

Note, the patch also includes internal and public API changes:
* `ecma_string_to_utf8_string` does not return negative value if
   output buffer is not large enough to contain the string; the
   buffer is expected to be large enough. (`ecma_string_get_size`
   can be used to retrieve the required size.)
* `jerry_api_string_to_char_buffer` adapts the same logic (and
  `jerry_api_get_string_size` can be used to determine the
  required size of the buffer).

Related issue: #942

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-08 15:22:07 +01:00
Zsolt Borbély
ce2fc3ccfd Remove the duplicated declaration of parser_set_show_instrs()
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-03-08 13:03:14 +01:00
Zsolt Borbély
c141f766ee Use basename in a more generic form
Not all versions of basename supports the suffix option.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-03-08 12:49:10 +01:00
László Langó
9bf1ecc677 Disable date object related system calls by default
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
2016-03-08 12:13:55 +01:00
Akos Kiss
e926aa7d69 Remove dead macros from memory management code
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-07 14:05:35 +01:00
Akos Kiss
d4650bc75c Change pool-based allocation to heap-based allocation in jerry.c
There was an abuse of memory pools in jerry.c: `compiled_code_map_entry_t`
is not an ECMA data model object but was still alocated/freed via
mem pool functions. Changed the appropriate calls to heap-related
functions.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-07 13:31:42 +01:00
László Langó
a187e6d60c Print error messages to be more informative
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-03-07 12:02:05 +01:00
Akos Kiss
212aa34331 Remove memory management-related dead code
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-07 11:00:59 +01:00
Akos Kiss
c0f3a9f7fb Add STRIP_RELEASE_BINARY option to Makefile
It is already supported by CMakeLists, might be useful to allow it
to be passed through Makefile.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-04 15:19:59 +01:00
Akos Kiss
b6af308d3f Add full profile to MCU build targets
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-03-04 15:05:27 +01:00
Zoltan Herczeg
73dcf689d2 Fix warning when returning from vm_loop.
Related issue: #930

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-03-04 03:15:10 -08:00
István Kádár
afa7b78b45 New unicode character handling using array data structure.
JerryScript-DCO-1.0-Signed-off-by: István Kádár ikadar@inf.u-szeged.hu
2016-03-03 15:21:43 +01:00