1056 Commits

Author SHA1 Message Date
Zoltan Herczeg
1726bba184 Create extended objects instead of internal properties.
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
2016-06-21 06:12:17 -07:00
László Langó
7f153c799a Improve empty checks of ecma strings
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-06-21 13:40:12 +02:00
Zsolt Borbély
2324617928 Guard assert-related functions
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-06-21 12:58:24 +02:00
Robert Sipka
c0665da299 Build fix for ALL_IN_ONE and COMPILER_DEFAULT_LIBC
The build fails with enabled ALL_ON_ONE and enabled COMPILER_DEFAULT_LIBC options,
because the _BSD_SOURCE doesn't defined before including the sys/time.h.

In case of glibc, the 'timezone' is not part of C99 but part of POSIX, so we need
to define the _BSD_SOURCE feature test macro before including sys/time.h to get
the prototype for this struct.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-06-19 07:39:48 +02:00
Zoltan Herczeg
37ebd20a72 Remove LIST_LAZY_PROPERTY_NAMES_ROUTINE_NAME macro function.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-06-17 06:20:06 -07:00
Zsolt Borbély
bb07151a39 Pack assert-related code
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-06-17 14:00:21 +02:00
Akos Kiss
edc695e108 Remove const array and scalar variables from ecma_utf8_string_to_number
There is no need for putting `LIT_CHAR_*` constants in const
scalars or arrays, they can be used directly. (There is especially
no need for arrays of 10 elements if only 2 of them are used.)

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-06-17 03:38:22 -07:00
Akos Kiss
30fd549e7f Optimize number-to-string conversion
* Make constants static in `ecma_number_to_utf8_string`.
* Make `ecma_number_to_utf8_string` use early returns, and rewrite
  its self-recursion in case of negative numbers.
* Make the stringification of decimal exponent in
  `ecma_number_to_utf8_string` use `ecma_uint32_to_utf8_string`.

* Changed ERROL0 dtoa implementation to use the `double` type
  instead of `ecma_number_t`. Thus, even is `ecma_number_t` is 32
  bit wide, the algorithm works the same.
* Changed `ecma_number_to_decimal` to use the ERROL0 dtoa algorithm
  for 32-bit floats as well.
* Changed `ecma_number_to_decimal` to generate the decimal string
  representation of the mantissa instead of an `uint64_t` number.

* Changed `ecma_number_to_utf8_string` to make use of the already
  available string representation of the mantissa, generated now by
  `ecma_number_to_decimal`.
* Changed `ecma_number_to_utf8_string` not to use static arrays and
  variables for digit, "e", etc. generation.

* Changed all `Number.prototype.toXXX` implementations and the
  `ecma_builtin_number_prototype_helper_round` helper to make use
  of the already available string representation of the mantissa,
  generated now by `ecma_number_to_decimal`.
* Factored out the common stringification parts of all
  `Number.prototype.toXXX` implementations into a new helper
  `ecma_builtin_number_prototype_helper_to_string`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-06-17 03:36:35 -07:00
László Langó
65542549af Add conversion API functions
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-06-16 14:13:06 +02:00
László Langó
8e8504244b Update jerry API
* Fix error handling (related issue: #1141)
 * Move output paramters to the end of the arguments lists

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-06-16 13:43:33 +02:00
László Langó
8453a9ade8 Change return value of 'ecma_ref_ecma_string' to void
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-06-16 12:44:27 +02:00
László Langó
0daeb2f942 Remove string copy
Changed 'ecma_copy_or_ref_ecma_string' to 'ecma_ref_ecma_string'. It does
not copy the string if the maximum number of reference counter is reached,
but bails out with an error like the 'ecma_ref_object' function does.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-06-16 12:44:27 +02:00
Hanjoung Lee
7a3ed2650d Fix errol0_dtoa for DBL_MAX
When `val` is DBL_MAX, we get +inf from `ECMA_NEXT_FLOAT (val)`.
It is necessary to handle this case specially.

Related issue: #1054

JerryScript-DCO-1.0-Signed-off-by: Hanjoung Lee hanjoung.lee@samsung.com
2016-06-16 18:40:06 +09:00
Zoltan Herczeg
378d7f78ca Improve builtin-property construction.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-06-16 01:42:55 -07:00
Hanjoung Lee
1c43e5b02b Fix Date construct helper
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
2016-06-16 11:05:57 +09:00
László Langó
a816ab8bb0 Use 'ecma_value_t' in API too
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-06-14 14:44:02 +02:00
Zoltan Herczeg
b828d4a463 Rename ecma_is_value_error to ECMA_IS_VALUE_ERROR.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-06-14 02:31:34 -07:00
Zoltan Herczeg
1eeed7e07e Improve get-value.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-06-14 01:58:52 -07:00
Zsolt Borbély
ce905487a0 Introduce JERRY_UNUSED() instead of __attr_unused___
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-06-14 08:45:14 +02:00
Zsolt Borbély
c557a0a047 Modify the usage of ecma_string_to_utf8_string()
Parts:
 * Rename ecma_string_to_utf8_string() to ecma_string_copy_to_utf8_buffer.

 * Introduce ecma_string_to_utf8_bytes(), which wraps the usual 'function call-assertion' pair,
   and check strict equality of size of the string and the buffer.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-06-13 15:21:30 +02:00
Zoltan Herczeg
eac736ffa4 Rename try_give_memory_back to a better free_unused_memory.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-06-13 05:35:53 -07:00
Zoltan Herczeg
495b24eebc Optimize put result phase in the interpreter.
Skip put result phase for opcodes which put their
result onto the stack or they don't have result at all.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-06-10 01:26:42 -07:00
Zoltan Herczeg
eed84a7dd9 Parser improvements.
The number of delete opcodes is reduced to two from six. The
range of numbers which can be included in the byte code is
doubled from (-127,127) to (-256,256).

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-06-10 01:18:17 -07:00
Zoltan Herczeg
d953fbb7be Branch opcodes have no result and either they have a stack argument
or no arguments at all. To improve the performance, the branch argument
flag is changed into a get argument type which eliminates a flag check
for all executed opcodes. Furthermore branch opcodes skip the put result
phase by changing the "break" to "continue" statements.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-06-09 01:20:36 -07:00
Zsolt Borbély
2834423fd2 Remove surplus attribute-defines from jrt.h
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-06-08 15:44:01 +02:00
László Langó
824d39c2a2 Update API functions
* Rename 'jerry_api_' prefix to 'jerry_'
 * Fix minor style issues
 * Group the API functions and add comment to each group
 * Move engine behaviour related funtions to 'jerry.h'

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-06-08 12:48:47 +02:00
Zoltan Herczeg
3e0572e433 Optimize add operation.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-06-08 03:07:18 -07:00
Zoltan Herczeg
308bb3c8e1 Remove last_completion_value.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-06-03 04:12:10 -07:00
Zoltan Herczeg
98d2b66e40 Reduce the default LCache size by half. From 4Kbyte to 2Kbyte.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-06-03 02:17:43 -07:00
Zoltan Herczeg
6f33ab3e8f Improve equal operations.
The implementation is simplified and optimized
resulting the removal a large amount of code.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-06-03 02:10:44 -07:00
Zoltan Herczeg
5c852ab6fb Optimize LCache operation.
The cache stores only real properties now, because storing NULLs has
little benefit according to tests. Since only real properties are
stored now, there is no need to create real references to objects
and property names, which reduces the keeping of dead objects after
garbage collection.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-06-02 03:56:36 -07:00
Robert Sipka
331bdddea9 Insert parameters between the pair of parentheses in the JERRY_MIN and JERRY_MAX macro definitions
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-06-01 15:18:32 +02:00
Robert Sipka
8a911bb6cb Use 'ecma_get_float_from_value' instead of 'ecma_get_number_from_value' in the ToString operation.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-06-01 15:03:06 +02:00
Zoltan Herczeg
a5d9701f60 Optimize uint32 hash computation.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-06-01 05:09:58 -07:00
László Langó
ed08518bd7 Code simplification
Move the enclosed condition forward and combine the two if statements.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-06-01 09:58:29 +02:00
Zsolt Borbély
36c7440c40 Restore the previous way to convert strings in ecma_builtin_json_parse()
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-05-31 15:52:28 +02:00
Zoltan Herczeg
f24be95f89 Optimize conditional jumps.
The ecma_op_to_boolean return value is changed to bool for faster
evaluation, and no need to swap operandos of relational compare.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-30 05:56:22 -07:00
Zoltan Herczeg
08c312bc55 Remove ECMA_STRING_CONTAINER_HEAP_NUMBER.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-30 05:09:51 -07:00
Zoltan Herczeg
8c92972b2f Passing less number of arguments to a function is generally faster. So
the three boolean arguments of ecma_create_named_data_property and the
two boolean arguments of ecma_create_named_accessor_property are combined
into one uint8_t argument. On ARM-32 it is preferred to have less than
four arguments, since these arguments can be passed in registers.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-29 23:47:46 -07:00
Robert Sipka
379698733a Optimising the ToString operation
Create new ecma-string from positive integers without cast it to ecma_number

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-05-26 10:33:38 +02:00
Zoltan Herczeg
fec6944a2a When array literals are created, there is no need to check whether
the property already exists. This improves the performance.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-25 06:51:14 -07:00
Zoltan Herczeg
48b01d0f74 Improve the performance of ecma_op_general_object_put. The ecma_op_object_can_put
function is removed and incorporated into ecma_op_general_object_put. Also most
properties are directly created / updated instead of using ecma_builtin_helper_def_prop.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-25 06:41:32 -07:00
Zoltan Herczeg
ac3aa30c82 Micro optimizations of the virtual machine:
- Branch argument information is encoded in the vm byte
   code data, so CBC flags are not loaded anymore
 - The free_flags variable is removed from the vm_loop
 - Two cases are removed from "get arguments", argument
   processing is simplified
 - The two opcode tables are merged to one
 - The VM_OC_POP opcode has no result, so the break is changed to continue.
 - The VM_OC_PUSH_NUMBER can use ecma_make_integer_value.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-24 02:29:49 -07:00
Zoltan Herczeg
be273d874f When the same value is assigned to a property, and its reference
counter is one, dereferencing the value frees its allocated memory.
In this case we return early.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-24 02:17:05 -07:00
Zoltan Herczeg
76ae2001a1 Complete reworking of ecma_op_general_object_define_own_property.
Unnecessary checks are removed, new checks are added to skip
unneeded code paths.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-23 03:19:20 -07:00
Zoltan Herczeg
53414b2c88 Add ecma_fast_copy_value and ecma_fast_free_value to improve performance of hot paths.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-23 02:53:43 -07:00
Zsolt Borbély
9f29cc168d Update memory-related defines
Set the correct defines in CMakeLists.txt and update another occurrences in scripts.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-05-22 23:19:10 +02:00
Zsolt Borbély
6b18710bc1 Get rid of the remains of heavy debug
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-05-20 16:32:29 +02:00
László Langó
92bb551d45 Change 'mem' namspace to 'jmem'
The 'mem_' prefix is too general, so it might clash with
symbols in other libraries. Renamed the directory, file,
funtion and type names.

Related issue: #1052

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-05-20 16:01:33 +02:00
Zoltan Herczeg
aaa3d22677 Remove unused collection based argument passing to the vm interpreter.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-20 05:51:41 -07:00