2382 Commits

Author SHA1 Message Date
Akos Kiss
513d9f4c9c Sync cmake and build.py defaults (#1360)
* Cmake had LTO OFF, build.py had LTO ON by default. ON became the
  common setting.
* Cmake had snapshot save/exec OFF, build.py had them ON by
  default. OFF became the common setting.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-20 16:20:48 +02:00
zherczeg
8b55a4ef7b Rewrite ecma_op_get_value_object_base to use ecma_op_object_find_own() call. (#1365)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-09-20 13:33:57 +02:00
Yanhui Shen
a9d6978e4b Fixing ecma_builtin_number_prototype_helper_round. (#1362)
"ecma_builtin_number_prototype_helper_round" is used by following
functions:
* ecma_builtin_number_prototype_object_to_fixed
* ecma_builtin_number_prototype_object_to_exponential
* ecma_builtin_number_prototype_object_to_precision

The current implementation does not support currying numbers and will
produce illegal digit for some test cases. For example, the result of
"0.95.toFixed(1)" is "0.:".

This patch fixs the issue, however the implementation of "toFixed" is
still problematic, at least not meet section 15.7.4.5 8.a of the
specification. The related test case is:

* assert((0.995).toFixed(2) === "0.99");
* assert((9.995).toFixed(2) === "9.99");

Reference:
* http://www.ecma-international.org/ecma-262/5.1/#sec-15.7.4.5

JerryScript-DCO-1.0-Signed-off-by: Yanhui Shen shen.elf@gmail.com
2016-09-20 13:13:50 +02:00
Zidong Jiang
7b7d86f5fd Remove the vm_run_with_inline. (#1363)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2016-09-20 13:11:53 +02:00
zherczeg
9ab72d24b7 Improve ECMA_PROPERTY_VALUE_PTR computation. (#1364)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-09-20 12:50:53 +02:00
Akos Kiss
971dcae669 Define __attr_hot___ for __attribute__((hot)) (#1359)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-19 15:33:54 +02:00
Zoltan Herczeg
dcaec22c0c Major property rework: introducing virtual properties.
Properties are changed to a type and value pair instead of a pointer to an internal
representation. Functions such as ecma_op_object_get_[own_]property do not
return with property pointers anymore.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-09-19 00:32:38 -07:00
Tilmann Scheller
ea96430e77 Add contribution guidelines and DCO. (#1348)
The current content in CONTRIBUTING.md is largely based on the "Patch Submission Process" Wiki page.

This commit also moves the DCO from the Wiki into the source tree.

In addition, clarify in README.md that contributions need to be licensed under the Apache License 2.0 and signed with the DCO.

JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
2016-09-16 15:50:56 +02:00
Akos Kiss
d38ab71140 Improve the linking of libraries (#1338)
Although both jerry-libc and jerry-libm have configuration options
that enable/disable their build, in practice, only jerry-libc can be
replaced with the system (compiler-default) libc. If jerry-libm is
disabled, the build of jerry-main fails, as there is no way to
instruct the linker to link the system libm to the binary. (The
build system does have a way to pass flags to the linker, but those
flags are listed before the linked objects. For the references to
get resolved correctly, the libraries to be linked have to be
specified _after_ the objects.)

This patch adds the EXTERNAL_LINK_LIBS configuration option to
CMakeLists, which ensures that the specified libraries get
correctly passed to the linker. (E.g, replacing jerry-libm with
system libm becomes possible with
`JERRY_LIBM=OFF EXTERNAL_LINK_LIBS='-lm'`.)

Additionally, the patch also makes the following related changes:

* Removes the COMPILER_DEFAULT_LIBC configuration option, as it is
  (almost) always the opposite of JERRY_LIBC. Moreover, its name is
  misleading: its only role is to add `-nostdlib` to the linker
  flags.

* Makes use of transitive library dependencies: if a library has
  another library as dependency, and it is linked to a binary, its
  dependency is linked as well. Thus, jerry-libc, jerry-libm, and
  any external libraries are added to jerry-core as dependency, and
  then only jerry-core is linked to executables (cmake will take
  care of the rest).

* build.py and run-tests.py follow up the changes, along with some
  minor syntax changes.

* Moves static linking option to global CMakeLists, as unit test
  binaries should be linked the same way as jerry-main.

* Adds EXTERNAL_COMPILER_FLAGS and EXTERNAL_LINKER_FLAGS as last to
  the flag list, to allow user override of (nearly) anything.

The patch speculatively follows up the build system changes in the
mbed, riot-stm32f4, and zephyr targets.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-15 13:07:01 +02:00
Zidong Jiang
86ac6445e8 Fix bug in vm call_stack_size calculation (#1345)
call_stack_size should be register_count + maximum stack depth

* We don't add in the parser to save the size of snapshot header
* jerry_snapshot_version 5 -> 6

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2016-09-15 09:54:01 +02:00
Akos Kiss
9c50570ca3 Install ARM QEMU and GCC toolchain on Travis CI only if needed (#1350)
(Also some reorganization of the .travis.yml file.)

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-14 14:44:39 +02:00
Akos Kiss
697037af3f Remove obsolete dependencies from install scripts (#1349)
The new build script does not support ninja anymore, and we haven't
been building bare-metal arm targets for long. This patch removes
now-obsolete dependencies from install scripts.

This can also help to reduce the load on Travis CI (as it keeps
installing dependencies for each build job over and over again).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-14 11:02:44 +02:00
Tilmann Scheller
a507c0863c Add a full copy of the Apache License 2.0 text to the project. (#1346)
Previously only a copy of the Apache License 2.0 header (for inclusion into source files) was distributed as part of the sources.

JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
2016-09-13 16:22:42 +02:00
Yanhui Shen
15c53f7363 Fix getter's this value (#1344)
JerryScript-DCO-1.0-Signed-off-by: Yanhui Shen shen.elf@gmail.com
2016-09-13 08:53:26 +02:00
Akos Kiss
baeb83db8f Move Travis CI detection logic from run-tests.py to check-signed-off.sh (#1341)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-12 15:11:14 +02:00
Zoltan Herczeg
d9979be2f6 Rewrite property get/put to not use ecma_op_object_get_own_property
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-09-12 03:33:22 -07:00
Robert Sipka
0bc7840c5f Set the number of simultaneous jobs of the build. (#1336)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-09-12 09:20:24 +02:00
Akos Kiss
2e1c180658 Enable make install (#1335)
With the new build system, the conventional `cmake && make` already
works. However, the last step, i.e., `make install` was still
missing (didn't work). This patch adds the `install()` commands to
CMakeLists that are required to generate the `install` target in
the Makefile.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-09 13:32:36 +02:00
Zoltan Herczeg
da02a37a02 Remove several ecma_op_object_get_[own_]property calls.
The ecma_op_object_get_[own_]property calls should be phased out from
the project eventually and virtual properties should be introduced instead.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-09-09 01:49:57 -07:00
Akos Kiss
7f80b76009 Make build.py's help output less of a "wall of text" (#1331)
`tools/build.py --help` prints a lot of output, which is sometimes
hard to comprehend, especially since some described options are
useful for developers only.

This patch:
* shortens how options are displayed in the output with the help of
  the "metavar" feature of the argparse module ("--option {on, off}"
  becomes "--option X" and the choices are listed in the description
  only); and
* hides all developer-specific options from "--help", and reveals
  them only for "--devhelp".

As a result, help output becomes more readable, especially for
ordinary users, and needs less space.

Some additional changes:
* the options are ordered in a more logical way (although that's
  somewhat subjective);
* help strings start with lowercase letters (it aligns better with
  argparse's overall style); and
* rename "--cpointer_32_bit" to "--cpointer-32bit" (underscores are
  alien to command line options).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-09 10:44:08 +02:00
Akos Kiss
2eb0c5ba1b Print warning at the correct log level in jerry-main (#1334)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-09 09:00:28 +02:00
robertsipka
dc83e995d2 Fix for Issue #744
Don't increment the current position in case of a continuation byte.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-09-08 14:05:14 +02:00
Sergio Abraham Martinez Rodriguez
c61e822a45 Specify profile and be able to add extra parameters to configuration (#1333)
Also added jerryscript errors to default compilation

JerryScript-DCO-1.0-Signed-off-by: Sergio Martinez sergio.martinez.rodriguez@intel.com
2016-09-08 13:04:35 +02:00
László Langó
5c330d7f8e Improve error messages
* Print location on parser errors.
 * Do not print messages on parse error if FEATURE_ERROR_MESSAGES is not set.
 * Minor style fixes

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-09-08 10:20:13 +02:00
László Langó
cf94a25753 Change JERRY_ASSERT to TEST_ASSERT in unittests
JERRY_ASSERT does not check the condition in release builds.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-09-08 08:16:16 +02:00
Akos Kiss
7872f8145a Make jerry-main's link options configurable (#1328)
Until now,
* the link map of jerry-main has always been generated, even though
  it is not used that often;
* static linking has always been forced except for the OSX target.

This patch adds configuration options for these features.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-07 15:54:06 +02:00
Akos Kiss
8d478c142b Add tolerant mode to Signed-off-by check (#1322)
In tolerant mode, only the existence of the Signed-off-by line is
checked but the name and address is not matched against the author
of the commit.

The tools/run-tests.py script is extended to allow calling the
check script in tolerant mode and also to detect whether it is
being run by Travis CI.

The Travis CI config has been modified to check PRs in strict mode
but use tolerant mode for merges to master. This should enable the
use of the Merge button on the GitHub web interface. (The PR is
strictly checked when a contributor opens it but when a committer
merges it via the web interface and GitHub rewrites author details
from the contributor's profile, master will not turn red either.)

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-07 12:28:29 +02:00
Akos Kiss
714e8d261b Add git commit hash to jerry version info
Previously, jerry-core was built with various build identification
info (build date, git commit hash, git branch name), which was both
available from string constants of the library and also exposed by
jerry-main via the `--version` command line option. As of late,
jerry-core identifies itself only with API version number macros,
but sometimes it could be helpful to get access to the git commit
hash as well, even if that info does not become part of the API.

This patch moves the git commit hash retrieval logic from the build
scripts of jerry-core to jerry-main, and changes `--version` handler
to print the hash as well.

Resolves #1295

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-07 11:14:40 +02:00
Akos Kiss
ebbacfc319 Make tools/settings.py lighter (#1327)
It should not import things it does not use and it should define
settings data only (i.e., definition of functions should not happen
there).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-07 08:29:06 +02:00
Robert Sipka
caee6f738e Fix -Wsign-conversion Clang warning.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-09-06 15:56:41 +02:00
Zidong Jiang
27deda5712 remove the alloca.h because of #1294
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2016-09-06 12:07:31 +08:00
Robert Sipka
2314bc2770 Add the 'jerry-libm/include' path to specified include directories to jerry-core target
in case of enabled jerry-libm build.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-09-02 09:40:12 +02:00
Zsolt Borbély
6f262aea49 Include Port API documentation to webpage-generator script
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-09-01 16:08:53 +02:00
Akos Kiss
228f6f75f0 Fix warnings reported on OS X (#1307)
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
2016-09-01 15:16:02 +02:00
László Langó
2a354b25a8 Add documentation to port API
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-09-01 14:32:31 +02:00
Zoltan Herczeg
da47dedaed Add 32 bit compressed pointer support.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-09-01 04:16:54 -07:00
Zsolt Borbély
9ca78d380f [nuttx-stm32f4] Fix jerry_port_log function
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-09-01 12:51:27 +02:00
Youngil Choi
2c78ee7f54 FunctionExpression name binding should be immutable
JerryScript-DCO-1.0-Signed-off-by: Youngil Choi duddlf.choi@samsung.com
2016-09-01 14:50:26 +09:00
Youngil Choi
260b967853 SplitMatch operation should not set its return array element with [[Put]]
Related issue: #1076

JerryScript-DCO-1.0-Signed-off-by: Youngil Choi duddlf.choi@samsung.com
2016-09-01 11:05:07 +09:00
Sergio Martinez
1ab45a1a2f Remove problems with gettimeofday, newlibc and zephyr SDK
Fix Zephyr build

With the changes to the zephyr sdk, gettimeofday is being guarded
by XOPEN_SOURCE_EXTENDED which requires at least 700 on XOPEN_SOURCE to be active

This little patch also helps on removing most of the warnings we had before
related to that issue.

More info on this feature:
http://man7.org/linux/man-pages/man7/feature_test_macros.7.html

Another option was to enable _GNU_SOURCE for this port.

There are still some harmless warnings related to __sputc_r for which we still require
the convertion warning.

Tested on qemu_cortex_m3, qemu_x86, arduino_101 and frdm_k64f.
Zephyr Sdk 0.8.2, Zephyr 1.5.0-rc4 & Zephyr ec39b216

Closes #1311.

JerryScript-DCO-1.0-Signed-off-by: Sergio Martinez sergio.martinez.rodriguez@intel.com
2016-08-31 17:13:45 +02:00
István Kádár
6666927799 All-in-one build friendly jerry-libm.
Define constants are undefined at the end of the corresponding files of jerry-libm supporting all-in-one build.

JerryScript-DCO-1.0-Signed-off-by: István Kádár ikadar@inf.u-szeged.hu
2016-08-31 16:28:54 +02:00
Zoltan Herczeg
548b3b98c2 Change return value to ecma_value_t for getting internal properties.
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
2016-08-31 06:13:00 -07:00
Youngil Choi
bfbe1821b5 vm_op_set_value should be able to throw error when ecma_op_to_string throws
JerryScript-DCO-1.0-Signed-off-by: Youngil Choi duddlf.choi@samsung.com
2016-08-31 21:06:54 +09:00
Peter Gal
17d1d37cca Improve the Curie build file generator a bit
Works with python 2 and 3.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2016-08-31 11:35:21 +02:00
Zsolt Borbély
18f9308cd6 Minor stylefix for targets/nuttx-stm32f4/README.md
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-08-31 09:47:30 +02:00
Akos Kiss
da7abc55f9 Disallow failures of Travis CI jobs on OS X
Related issue: #1296

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-08-30 16:36:04 +02:00
Akos Kiss
7f6911103f Update the prerequisites documentation
* Split list into two: what is needed for building and what is
  needed for development only.
* Remove g++ from install list.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-08-30 10:19:14 +02:00
Youngil Choi
9f65b76013 Fix bug in for-in bytecode replacement
JerryScript-DCO-1.0-Signed-off-by: Youngil Choi duddlf.choi@samsung.com
2016-08-30 16:57:49 +09:00
Akos Kiss
a6d2e792f8 Improve the build system
* Remove JERRY_CORE CMake option: the building of the core
  JerryScript library should not be optional.
* Fix wording of comments, status and error messages.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-08-30 09:10:30 +02:00
Yanhui Shen
ba2b7dd13f Use C99's variable length array instead of alloca
JerryScript-DCO-1.0-Signed-off-by: Yanhui Shen shen.elf@gmail.com
2016-08-30 14:29:19 +08:00