2288 Commits

Author SHA1 Message Date
Akos Kiss
d857fe095f Improve the usability of test runner scripts
* First of all, remove the counter-intuitive "OUT_DIR" second
  argument of run-test-suite.sh. This, way, the invocation of the
  script becomes easier to remember:
  `tools/runners/run-test-suite.sh <engine> <testsuite>`
  However, this also means that all output files (lists of
  executed, passed, and failed tests) are generated in the current
  working directory.

* Align the behaviour of run-unittests.sh with the above, i.e.,
  don't try to guess where to put output files but write them in
  the CWD.

* Adapt Makefile to the change in the use of the test runner
  scripts: create and change to "check" directories before invoking
  test runner scripts.

Extras:
* tools/runners/run-test-suite.sh collected fail tests from
  directories twice. This does no harm but is inefficient, thus
  removing.
* tools/runners/run-test-suite.sh was too permissive on the
  contents of test suite list files. Better to accept those lines
  only which really contain paths to JS test files.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-22 12:04:07 +01:00
Akos Kiss
aa0b6215fa Replace the EXTERN_C macro with extern "C" { block in fdlibm
Jerry-libc and jerry-core already uses the block-based approach.
Now, removing the last remnant of the macro approach from fdlibm as
well.

Closes issue #900

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-22 09:33:10 +01:00
Akos Kiss
f088e8c147 Drop unimplemented run context stubs
Run context stubs have been lingering in the code base for almost a
year but they have never been more than unimplemented ideas.
Moreover, they are guarded by a macro that's nowhere defined, thus
the code is never compiled or tested.

Should contexts be implemented in the future, they may or may not
be implemented the way they are sketched now. Thus, it's safe to
remove this dead code from the sources.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-20 21:03:32 +01:00
László Langó
a0bedaa43d Remove EXTERN_C macros and use block based solution
Related issue: #900

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-02-19 15:45:14 +01:00
Akos Kiss
b2edaafaa1 Move cppcheck logic from Makefile and CMakeLists.txt to tools/check-cppcheck.sh
The legacy approach executed cppcheck for every build target, which
resulted in a huge number of re-checks of the sources if more than
one targets were built. The main reason behind that was to get the
right macro-guarded code paths analyzed. However, cppcheck can
analyze every configuration of the sources in one go.

(The patch also contains some aesthetic changes around the way
vera++ is called and how errors are reported.)

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-19 13:33:15 +01:00
Akos Kiss
be1920dc46 Fix tools/check-signed-off.sh to handle PRs not based on HEAD
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-19 09:36:05 +01:00
Akos Kiss
5afc0600b4 Add merge commit support to tools/check-signed-off.sh and re-introduce signed-off check to Travis CI
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-18 17:06:05 +01:00
Akos Kiss
6107f3599e Change the layout of the doxygen-generated documentation
* Move from index-based layout to treeview-based one.
* Automatically take the first sentence of the documentation as the
  brief doc.
* Always generate both brief and detailed description sections, and
  always sort them alpabetically.
* Disable the generation of huge and overly complex call and caller
  graphs.
* Make the project title title-cased.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-18 16:22:37 +01:00
Akos Kiss
3608f8df86 Refactoring and fixing jerry-libc
Refactor memory and string handling routines
* Potential code size improvements:
  * Most loops don't really need a new incrementing index variable
    running between 0..n-1 but can just loop `while (n--)`, and the
    bodies don't need array indexing but can just use the `*p++`
    idiom.
  * Compare routines are not required to return -1, 0, and +1, but
    any negative, zero, or positive result will do.
  * `strncmp` may follow the other routines and does not have to have
    defined behaviour if any of its args is NULL.
* Fix:
  * `strncmp` did not work correctly if the strings were equal but
    `n` was greater than their length (did not stop at the
    terminating zero character).

Refactor printf
* Merging code duplications, removing dead initialization.

Refactor rand and srand
* Making sure that the type of the state variables is OK
  (`uint32_t` instead of `unsigned int`).
* Getting type conversions OK.
* Fixing `srand` to write all state variables and thus indeed
  generate the same random sequence.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-18 15:40:56 +01:00
László Langó
684ed7268c Fix system call related date builtin functions
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
2016-02-18 14:05:36 +00:00
László Langó
a7715a5d78 Fix style issues and improve vera++ rules.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-02-18 13:27:54 +00:00
László Langó
db26cb2b79 Optimize 'lit_get_magic_string_size' calls
Calculate magic string length sizes in compile time.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-02-18 07:38:35 +00:00
Zoltan Herczeg
b2426a7a94 Remove 'ecma_completion_value_t'
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
2016-02-17 13:52:51 +00:00
Akos Kiss
c25d8617a5 Add Travis CI badge to readme
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-17 13:48:11 +01:00
Akos Kiss
85365dacfe Quick fix for Travis CI: remove signed-off check
Pull requests creating merge commits don't work well with
tools/check-signed-off.sh.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-17 12:59:32 +01:00
Akos Kiss
ad6107b32b Turn some global variables static const
Generally, it helps the optimizing passes of the compiler if global
varibles are `static`, and it is good for RAM usage to have data
marked read-only `const`. Found some globals, which could benefit
from these qualifiers.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-17 10:55:09 +01:00
Akos Kiss
b2f3ec225e Get the alpha order of lexer keywords right
Two keywords violate the ordering. Should someone depend on the
alpha order in the future (because the `keyword_length_*` arrays
seem to be ordered)` then this issue will be a nightmare to debug.
Better get this right now.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-17 10:38:47 +01:00
Akos Kiss
b18591eb25 Add support for travis integration
Fully fledged checks, builds, and tests on Linux, non-voting native
builds and unit tests on OS X.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-17 10:10:45 +01:00
Akos Kiss
0d7ea70b41 Eliminating doxygen warnings by fixing the documentation
* Fix "end of file while inside a group" doxygen warnings.

* Fix "unknown command" doxygen warnings caused by incorrect
  argument references. Instead of `@foo`, `@a foo` is the proper
  format.

* Fix "unknown command" doxygen warnings caused by incorrect
  parameter direction specifications. Instead of `@in`, `@out`,
  and `@in-out`, `[in]`, `[out]`, and `[in,out]` are the proper
  formats.

* Wrapping special characters in quotes to avoid doxygen
  confusion. Raw pipe, semicolon, dot, backslash, etc. characters
  can drive doxygen into various misinterpretations and warnings.
  E.g.:
  ```
  End of list marker found without any preceding list items
  Found unknown command
  ```
  Putting quotes around such text snipets eliminates the errors.

* Fix the documentation of `ecma_builtin_global_object_print`. Raw
  <> and \ sequences confused doxygen in various ways (it tried to
  interpret them as XML tags and doxygen commands).

* Fix "ignoring title that does not match old title" doxygen
  warnings. At some places, the group titles were out of sync, at
  others, the group names were incorrect.

* Fix "parameters are not documented" doxygen warnings. Fixing
  various typos in the inline parameter documentations (`/*`,
  `/**`, `/** <`, and `/**>` are all considered incorrect, the
  right format is `/**<`).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-16 21:05:58 +01:00
László Langó
ed12df5c8d Improve 'tools/run-perf-test.sh'
Always write results on stdout and save markdown file optionally.
Use "Peak allocated" if binaries were built with MEM_STATS.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-02-16 14:50:54 +01:00
László Langó
7a7b15c23a Remove unnecessary assertion
Fix for:
  * ICE: Assertion '!is_equal' failed at jerry-core/ecma/operations/ecma-lex-env.cpp(ecma_op_set_mutable_binding):219
Related issue: #879

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-02-16 14:38:36 +01:00
László Langó
1dde538224 Check reference count of objects
Throw an error if the object reference count reached the limit.
Related issue: #118

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-02-16 14:30:41 +01:00
Robert Sipka
80811c8332 Warning fixes.
ISO C99 doesn’t support unnamed structs/unions.
Comparison of distinct pointer types lacks a cast.
Dereferencing type-punned pointer will break strict-aliasing rules.
Type of bit-field ‘ext’ is a GCC extension.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-02-16 13:56:07 +01:00
Akos Kiss
7dc065842b Remove jerry_port_ functions from test-common.h
They are identical to the functions with the same name in
jerry-port.cpp and cause duplicate symbol link errors on OS X.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-16 10:39:21 +01:00
Akos Kiss
7f3a10a29d Move Doxyfile to the root directory of the project
Config files are better located in the root of the project tree,
no questions will raise then what the relative paths are relative
to. (E.g., `INPUT` and `OUTPUT_DIRECTORY` in the current case.)

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-16 01:28:35 +01:00
Akos Kiss
f959ba95a4 Refactoring the build system
* Removed unused or unnecessary parts from various make files
* Eliminated lots of duplications from Makefile with the help of
  macros.
* Split tools/precommit.sh to its independent components:
  * the part that checks the existence of the "signed off" text in
    commit messages
    (this on got factored out to tools/check-signed-off.sh),
  * the part that uses vera++ for style checking (this one got
    factored out to tools/check-vera.sh),
  * the part that invokes targets in the cmake-generated build
    directory, and
  * the part that performs various tests (these latter two got
    moved into the Makefile).
* Moved the functionality of precommit-full-testing.sh into the
  Makefile, too.
* Added ninja build system support (e.g., `make NINJA=1`).
* Updated leading documentation comments (they were somewhat
  stale).
* Tried to keep the target names exactly the same as they were --
  almost succeeded... (some changes are intentional, and are
  subject to personal preferences).
* Simplified console output of `make precommit`
* Unified test runner scripts and their output format
  * Eliminated nothing-to-stdout everything-to-log-file policy:
    info is printed to stdout and it is the caller's
    responsibility to redirect it to a file if needed.
  * Also applied some renaming and coding style unification to
    the scripts.
* Merged the functionality of tools/runners/run-test-suite-jerry*.sh
  into the Makefile
* Merged everything related to a test suite execution in a single
  script.
  * The new script also allows to specify pass and xfail tests in
    a single list file, which was not possible hitherto.
  * Also, the paths of the test cases given in a file are
    interpreted relative to their container files.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-15 18:05:01 +01:00
Robert Sipka
977bfa5d2c Remove g++ support from the [C]Make files.
Move all '.cpp' files to '.c'.
Rename comments from 'cpp' to 'c'.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-02-15 12:49:12 +01:00
Robert Sipka
ec5859f4e8 Add some fixes required by the C99 standard.
Use c-style cast instead of reinterpret_cast.
Use identifiers for function parameters.
Use type cast to avoid conversion error.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-02-15 12:48:47 +01:00
László Langó
bc82654029 Fix build with -O3
Related issue: #657

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-02-12 11:30:15 +01:00
Zsolt Borbély
d35bc4114b Remove unused functions from ecma-helpers-number.
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-02-11 13:31:01 +01:00
Robert Sipka
6fd1f780e1 Move out 'jrt_read_from_buffer_by_offset' and 'jrt_write_to_buffer_by_offset' function definitions from header.
It's also required by the C99 standard.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-02-11 13:14:57 +01:00
Akos Kiss
20bec3d73f Remove cppcheck and vera++ from prerequisites
Rely on platform-provided versions. Thus, no need to download and
build them, neither to wrap them with shell scripts. CMake and
precommit updated to call the new tools. Development documentation
also updated/simplified.

PS: On my Ubuntu 14.04.3, cppcheck has version 1.61, while prereq
version was 1.69. The older version reports and fails on a strange
style issue in ecma/builtin-objects/ecma-builtin-helpers.cpp, for
which the only solution found was to suppress the cppcheck errors
with `variableScope` id for that file.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-11 09:58:41 +01:00
Akos Kiss
dc84775207 Remove references to non-existent parser/js/bc and parser/js/collections directories
With the merge of the CBC parser, these directories got removed.
The update of the jerry-core/CMakeLists.txt must have been
forgotten, probably because the kept references caused no errors.
Cleaning up now.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-11 09:29:40 +01:00
Akos Kiss
0a83b317c7 Rename docs/Doxygen to docs/Doxyfile
This is a really minuscule change, but it is more idiomatic to name
the config file of doxygen as Doxyfile.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-11 09:13:01 +01:00
Zsolt Borbély
3e1e0dc733 Move the logic of Valgrind-support check to the CMake part.
Related pull request: #866

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-02-10 16:46:56 +01:00
Zoltan Herczeg
cadc81d583 ECMAScript Parameters cannot be passed in collections anymore, only as arrays.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-02-10 16:01:52 +01:00
Robert Sipka
cc6fced17a Use value types instead of reference types.
The C99 standard does not support reference types.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-02-10 15:55:02 +01:00
Robert Sipka
b0bdf0ebf4 Merge the js-parser and parser files
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-02-10 12:35:55 +01:00
Zsolt Borbély
41f2f910e8 Abort the build-process when the build-configuration is unsupported
The MCU targets doesn't support Valgrind.
Related issue: #762

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-02-10 11:28:59 +01:00
Robert Sipka
88d7f2fc7b Move 'nums_with_ascending_length' to be a global, non variable length array.
VLAs cannot be initialized by any form of initialization syntax with C99 standard.
Also did some refactor around 'ecma_string_get_length' and 'ecma_string_get_size'.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-02-10 11:03:49 +01:00
Robert Sipka
207f6da504 Use type cast to avoid conversation error with C99 standard.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-02-10 09:23:17 +01:00
László Langó
9a6bdef228 Fix assertion in RegExp compile
Related issue: #641

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-02-10 09:09:11 +01:00
SaeHie Park
ef1252e29e targets: add nuttx interpreter build
JerryScript-DCO-1.0-Signed-off-by: SaeHie Park saehie.park@samsung.com
2016-02-10 08:50:12 +01:00
Robert Sipka
abc95d3db8 Add forward declaration for mem_pool_chunk struct.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-02-09 16:01:01 +01:00
László Langó
094b182e96 Fix assertions in RegExp builtin
Related issue: #783, #784

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-02-09 15:31:16 +01:00
László Langó
6b8332e631 Fix 'Segmentation fault on String.Replace'
Related issue: #747

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-02-09 15:26:38 +01:00
László Langó
d420be3fdf Fix 'Segmentation fault in re_get_value'
Related issue: #782

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-02-09 15:17:28 +01:00
István Kádár
433f0705f7 Add missing doxygen group endings
JerryScript-DCO-1.0-Signed-off-by: István Kádár ikadar@inf.u-szeged.hu
2016-02-09 14:37:49 +01:00
István Kádár
e9a72ae1e9 Eliminate 'is_stack_var' field of ecma_string_t
JerryScript-DCO-1.0-Signed-off-by: István Kádár ikadar@inf.u-szeged.hu
2016-02-09 14:26:24 +01:00
Akos Kiss
196e8196fc Eliminate code duplication in memory statistics printing
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-02-09 14:19:28 +01:00