]> git.kaiwu.me - njs.git/log
njs.git
6 years agoFixed handing of accessor descriptors in Object.freeze().
Alexander Borisov [Wed, 11 Sep 2019 16:46:30 +0000 (19:46 +0300)]
Fixed handing of accessor descriptors in Object.freeze().

This closes #211 issue on GitHub.

6 years agoStyle.
Dmitry Volyntsev [Fri, 6 Sep 2019 12:47:12 +0000 (15:47 +0300)]
Style.

6 years agoAdded Number.prototype.toFixed().
Dmitry Volyntsev [Tue, 3 Sep 2019 14:31:45 +0000 (17:31 +0300)]
Added Number.prototype.toFixed().

This closes #29 issue on Github.

6 years agoAdded new Function() support.
hongzhidao [Fri, 23 Aug 2019 17:25:50 +0000 (13:25 -0400)]
Added new Function() support.

6 years agoPostponing copying of not-configurable PROPERTY_HANDLER properties.
Dmitry Volyntsev [Thu, 29 Aug 2019 16:18:53 +0000 (19:18 +0300)]
Postponing copying of not-configurable PROPERTY_HANDLER properties.

Since df385232d2af a shared property is copied to object hash on the
first access. It simplified changing of configurable shared properties.

Since 50fded8ccee5 Array.prototype functions treat empty array hash as a
sign that array instance is simple (without property getters and
non-numerical properties) to iterate over array values optimally.

Accessing "length" property made a copy in array hash. As a result next
iterations over array became not optimized.

The fix is to postpone making a mutable copy of not-configurable
NJS_PROPERTY_HANDLER properties until they are really required to change.

This closes #220 issue on Github.

6 years agoFixed incompatible pointer type introduced in 95d04dfea85c.
Alexander Borisov [Thu, 29 Aug 2019 14:11:41 +0000 (17:11 +0300)]
Fixed incompatible pointer type introduced in 95d04dfea85c.

6 years agoFixed Function.prototype.apply() according to the specification.
Alexander Borisov [Thu, 29 Aug 2019 13:39:10 +0000 (16:39 +0300)]
Fixed Function.prototype.apply() according to the specification.

6 years agoFixed undefined behaviour in left shift of int value.
Dmitry Volyntsev [Thu, 29 Aug 2019 12:12:45 +0000 (15:12 +0300)]
Fixed undefined behaviour in left shift of int value.

6 years agoImproved test coverage with MemorySanitizer enabled.
Dmitry Volyntsev [Thu, 29 Aug 2019 12:12:45 +0000 (15:12 +0300)]
Improved test coverage with MemorySanitizer enabled.

6 years agoFixed null pointer passing for args declared to never be null.
Dmitry Volyntsev [Thu, 29 Aug 2019 12:12:44 +0000 (15:12 +0300)]
Fixed null pointer passing for args declared to never be null.

Found by UndefinedBehaviorSanitizer.

6 years agoFixed typo introduced in 50fded8ccee5.
Alexander Borisov [Thu, 29 Aug 2019 10:12:33 +0000 (13:12 +0300)]
Fixed typo introduced in 50fded8ccee5.

6 years agoFixed Array prototype functions according to the specification.
Alexander Borisov [Wed, 28 Aug 2019 11:59:28 +0000 (14:59 +0300)]
Fixed Array prototype functions according to the specification.

The following fuctions were fixed:
every,  filter, find, findIndex, forEach, map, reduce, some.

6 years agoFixed parseFloat().
Dmitry Volyntsev [Wed, 28 Aug 2019 16:10:01 +0000 (19:10 +0300)]
Fixed parseFloat().

6 years agoFixed integer-overflow while parsing exponent of number literals.
Dmitry Volyntsev [Tue, 27 Aug 2019 15:58:43 +0000 (18:58 +0300)]
Fixed integer-overflow while parsing exponent of number literals.

6 years agoLimiting recursion depth while compiling unary expressions.
Dmitry Volyntsev [Tue, 27 Aug 2019 13:31:00 +0000 (16:31 +0300)]
Limiting recursion depth while compiling unary expressions.

This extends 8057f3ad56c1 and is related to #146 issue on Github.

6 years agoFixed heap-buffer-overflow while parsing regexp literals.
Dmitry Volyntsev [Mon, 26 Aug 2019 16:00:13 +0000 (19:00 +0300)]
Fixed heap-buffer-overflow while parsing regexp literals.

This closes #174 issue on Github.

6 years agoIncreased max function nesting.
Dmitry Volyntsev [Fri, 23 Aug 2019 17:00:40 +0000 (20:00 +0300)]
Increased max function nesting.

6 years agoLimiting recursion depth while compiling.
Dmitry Volyntsev [Fri, 23 Aug 2019 12:13:45 +0000 (15:13 +0300)]
Limiting recursion depth while compiling.

This closes #146 issue on Github.

6 years agoMaking "prototype" property of function instances writable.
Dmitry Volyntsev [Thu, 22 Aug 2019 15:27:34 +0000 (18:27 +0300)]
Making "prototype" property of function instances writable.

This closes #40 issue on Github.

6 years agoIntroduced njs_variables_copy().
hongzhidao [Wed, 21 Aug 2019 03:03:26 +0000 (23:03 -0400)]
Introduced njs_variables_copy().

6 years agoFixed division token in lexer.
hongzhidao [Wed, 21 Aug 2019 02:59:38 +0000 (22:59 -0400)]
Fixed division token in lexer.

6 years agoFixed prototype mutation for object literals.
Dmitry Volyntsev [Tue, 20 Aug 2019 17:51:39 +0000 (20:51 +0300)]
Fixed prototype mutation for object literals.

6 years agoUsing "printf" instead of "echo -n" for portability.
Dmitry Volyntsev [Tue, 20 Aug 2019 17:51:39 +0000 (20:51 +0300)]
Using "printf" instead of "echo -n" for portability.

This closes #205 issue on Github.

6 years agoVersion bump.
Dmitry Volyntsev [Tue, 20 Aug 2019 17:51:33 +0000 (20:51 +0300)]
Version bump.

6 years agoAdded tag 0.3.5 for changeset b7fa83f27f1b
Dmitry Volyntsev [Thu, 15 Aug 2019 16:36:57 +0000 (19:36 +0300)]
Added tag 0.3.5 for changeset b7fa83f27f1b

6 years agoVersion 0.3.5. 0.3.5
Dmitry Volyntsev [Thu, 15 Aug 2019 16:36:39 +0000 (19:36 +0300)]
Version 0.3.5.

6 years agoFixed module importing using require().
Dmitry Volyntsev [Thu, 15 Aug 2019 16:22:01 +0000 (19:22 +0300)]
Fixed module importing using require().

Previously, require() did not make a mutable copy of imported module.
As a result, cloned VMs could change a shared module object making
module.object->hash inconsistent.

Before 04d7a5d93ae6, the problem manifested itself only in "PROP GET"
operations, for example, using "require('fs').renameSync", because
njs_value_property() makes a mutable copy of shared methods in
module.object->hash.

After 04d7a5d93ae6, "METHOD CALL" operations, such as
"require('fs').renameSync()", now have the same problem as in "PROP
GET".

Importing modules using "import" statement is not affected, because
for it "OBJECT COPY" instruction is generated, which makes a mutable
copy of imported module object.

The fix is to make a mutable copy of a shared module in require().

This closes #206 issue on Github.

6 years agoFixed handling of NJS_DECLINED returned by NJS_PROPERTY_HANDLER.
Dmitry Volyntsev [Wed, 14 Aug 2019 17:22:32 +0000 (20:22 +0300)]
Fixed handling of NJS_DECLINED returned by NJS_PROPERTY_HANDLER.

6 years agoFixed [[SetPrototypeOf]].
Dmitry Volyntsev [Wed, 14 Aug 2019 17:22:26 +0000 (20:22 +0300)]
Fixed [[SetPrototypeOf]].

6 years agoVersion bump.
Dmitry Volyntsev [Wed, 14 Aug 2019 17:22:20 +0000 (20:22 +0300)]
Version bump.

6 years agoAdded tag 0.3.4 for changeset 8eadbb3a7c7b
Dmitry Volyntsev [Tue, 13 Aug 2019 13:13:53 +0000 (16:13 +0300)]
Added tag 0.3.4 for changeset 8eadbb3a7c7b

6 years agoVersion 0.3.4. 0.3.4
Dmitry Volyntsev [Tue, 13 Aug 2019 13:13:28 +0000 (16:13 +0300)]
Version 0.3.4.

6 years agoAdded detection of address sanitizer.
Dmitry Volyntsev [Tue, 13 Aug 2019 13:04:10 +0000 (16:04 +0300)]
Added detection of address sanitizer.

6 years agoFixed dead store assignment in njs_fs_rename_sync().
Dmitry Volyntsev [Tue, 13 Aug 2019 12:15:42 +0000 (15:15 +0300)]
Fixed dead store assignment in njs_fs_rename_sync().

Found by clang static analyzer.

6 years agoUsing njs_set_undefined() and njs_set_invalid() where appropriate.
Dmitry Volyntsev [Mon, 12 Aug 2019 18:04:50 +0000 (21:04 +0300)]
Using njs_set_undefined() and njs_set_invalid() where appropriate.

6 years agoImproved njs_string_to_c_string() prototype.
Dmitry Volyntsev [Mon, 12 Aug 2019 18:04:49 +0000 (21:04 +0300)]
Improved njs_string_to_c_string() prototype.

To avoid excessive casts.

6 years agoAdded fs.renameSync().
Dmitry Volyntsev [Mon, 12 Aug 2019 18:04:49 +0000 (21:04 +0300)]
Added fs.renameSync().

This closes #198 issue on Github.

6 years agoFixed fs.readFile() and fs.readFileSync() for files with 0 size.
Dmitry Volyntsev [Mon, 12 Aug 2019 18:03:24 +0000 (21:03 +0300)]
Fixed fs.readFile() and fs.readFileSync() for files with 0 size.

6 years agoAdded getter/setter literal support.
hongzhidao [Thu, 8 Aug 2019 07:52:18 +0000 (03:52 -0400)]
Added getter/setter literal support.

This closes #118 issue on Github.

6 years agoFixed njs_vmcode_property_init().
Dmitry Volyntsev [Mon, 12 Aug 2019 11:54:46 +0000 (14:54 +0300)]
Fixed njs_vmcode_property_init().

Function assumed obj->__proto__ is never NULL, whereas it can become
NULL after __proto__: null assignment.

6 years agoAdded support for accessor properties in JSON.stringify().
Dmitry Volyntsev [Thu, 8 Aug 2019 11:19:56 +0000 (14:19 +0300)]
Added support for accessor properties in JSON.stringify().

This closes #203 issue on Github.

6 years agoAdded support for accessor property descriptors in njs.dump().
Dmitry Volyntsev [Thu, 8 Aug 2019 11:19:55 +0000 (14:19 +0300)]
Added support for accessor property descriptors in njs.dump().

6 years agoFixed njs_is_accessor_descriptor().
Dmitry Volyntsev [Thu, 8 Aug 2019 11:19:54 +0000 (14:19 +0300)]
Fixed njs_is_accessor_descriptor().

6 years agoFixed Error.prototype.toString().
Dmitry Volyntsev [Mon, 5 Aug 2019 14:10:59 +0000 (17:10 +0300)]
Fixed Error.prototype.toString().

1) with UTF8 string properties.
1) with non-string values for "name" and "message" properties.

This closes #199 issue on Github.

6 years agoAdded property getter support for njs_object_property().
hongzhidao [Wed, 7 Aug 2019 02:54:13 +0000 (22:54 -0400)]
Added property getter support for njs_object_property().

6 years agoFixed Object.defineProperty() for non-boolean descriptor props.
Dmitry Volyntsev [Wed, 7 Aug 2019 14:23:47 +0000 (17:23 +0300)]
Fixed Object.defineProperty() for non-boolean descriptor props.

6 years agoRemoved dead code in njs_value_property_set() after df385232d2af.
Dmitry Volyntsev [Wed, 7 Aug 2019 12:17:57 +0000 (15:17 +0300)]
Removed dead code in njs_value_property_set() after df385232d2af.

Found by Coverity Scan (CID 1452240).

6 years agoEliminating redundant NJS_METHOD type.
Dmitry Volyntsev [Tue, 6 Aug 2019 16:45:23 +0000 (19:45 +0300)]
Eliminating redundant NJS_METHOD type.

Previously, NJS_METHOD was the same as NJS_PROPERTY with function value
type.

6 years agoSimplified njs_property_query() API by eliminating pq->shared.
Dmitry Volyntsev [Tue, 6 Aug 2019 15:46:50 +0000 (18:46 +0300)]
Simplified njs_property_query() API by eliminating pq->shared.

Making copy of shared property in object's hash at the first access. It
simplifies njs_property_query() API and speeds up next access to the
property.

6 years agoCleanup of njs_property_query() usage.
Dmitry Volyntsev [Tue, 6 Aug 2019 14:58:37 +0000 (17:58 +0300)]
Cleanup of njs_property_query() usage.

6 years agoFixed "in" operator for values with accessor descriptors.
Dmitry Volyntsev [Mon, 5 Aug 2019 18:17:27 +0000 (21:17 +0300)]
Fixed "in" operator for values with accessor descriptors.

6 years agoRemoved obsolete commentaries for njs_value_property() and friends.
Dmitry Volyntsev [Mon, 5 Aug 2019 16:02:17 +0000 (19:02 +0300)]
Removed obsolete commentaries for njs_value_property() and friends.

After NJS_TRAP and NJS_APPLIED was eliminanted they are mostly useless.

6 years agoStyle.
hongzhidao [Sun, 4 Aug 2019 15:17:48 +0000 (11:17 -0400)]
Style.

Renaming arguments of the functions as follows:
1) "property" -> "key".
2) if function handles values of any type, its main argument
   is named "value".

6 years agoFixed njs_error_new() for UTF8 messages.
Dmitry Volyntsev [Mon, 5 Aug 2019 14:10:59 +0000 (17:10 +0300)]
Fixed njs_error_new() for UTF8 messages.

6 years agoUsing njs_is_defined() where appropriate.
Dmitry Volyntsev [Mon, 5 Aug 2019 15:17:15 +0000 (18:17 +0300)]
Using njs_is_defined() where appropriate.

6 years agoFixed Error() constructor with no arguments.
hongzhidao [Sun, 4 Aug 2019 07:59:42 +0000 (03:59 -0400)]
Fixed Error() constructor with no arguments.

6 years agoSeparating private from public headers.
Dmitry Volyntsev [Mon, 5 Aug 2019 14:36:09 +0000 (17:36 +0300)]
Separating private from public headers.

6 years agoAdded getter support for method frame calls.
hongzhidao [Sun, 4 Aug 2019 08:13:02 +0000 (04:13 -0400)]
Added getter support for method frame calls.

6 years agoFixed njs_builtin_match().
hongzhidao [Sun, 4 Aug 2019 08:06:30 +0000 (04:06 -0400)]
Fixed njs_builtin_match().

Previously native functions were identified by comparing pointers to
njs_function_t. This is not correct because njs_function_t maybe copied
from shared prototypes. Instead pointers to native functions should be
compared.

6 years agoRefactored njs_object_property.c.
hongzhidao [Fri, 2 Aug 2019 15:36:42 +0000 (23:36 +0800)]
Refactored njs_object_property.c.

1) Moving generic function to njs_value.c:
        njs_property_query(),
        njs_value_property(),
        njs_value_property_set().

2) Moving rest of the functions to njs_object_prop.c.

6 years agoRemoved vm->count.
Dmitry Volyntsev [Fri, 2 Aug 2019 17:12:01 +0000 (20:12 +0300)]
Removed vm->count.

Previously it was used to catch infinite recursion.
This is redundant, because NJS_MAX_STACK_SIZE is used for
the same purpose.

6 years agoHeaders cleanup in src/test missed in 835b3e817b93.
Dmitry Volyntsev [Fri, 2 Aug 2019 13:05:44 +0000 (16:05 +0300)]
Headers cleanup in src/test missed in 835b3e817b93.

6 years agoAdding default target as dependency for make all.
Dmitry Volyntsev [Fri, 2 Aug 2019 12:41:21 +0000 (15:41 +0300)]
Adding default target as dependency for make all.

6 years agoMoving all common headers into njs_main.h.
Dmitry Volyntsev [Fri, 2 Aug 2019 09:12:36 +0000 (12:12 +0300)]
Moving all common headers into njs_main.h.

6 years agoRemoving njs_stub.h.
Dmitry Volyntsev [Fri, 2 Aug 2019 09:12:35 +0000 (12:12 +0300)]
Removing njs_stub.h.

6 years agoRefactored njs_arr_t API.
Dmitry Volyntsev [Fri, 2 Aug 2019 09:12:30 +0000 (12:12 +0300)]
Refactored njs_arr_t API.

1) const njs_mem_proto_t *proto is removed from arguments.
2) njs_mp_t *mp is passed during array creation.

6 years agoRemoving njs_mem_proto_t from njs_mp_t.
Dmitry Volyntsev [Thu, 1 Aug 2019 18:01:16 +0000 (21:01 +0300)]
Removing njs_mem_proto_t from njs_mp_t.

6 years agoMerging njs_alignment.h into njs_clang.h.
Dmitry Volyntsev [Thu, 1 Aug 2019 15:49:29 +0000 (18:49 +0300)]
Merging njs_alignment.h into njs_clang.h.

6 years agoAvoiding excessive (njs_value_t *) casts.
Dmitry Volyntsev [Thu, 1 Aug 2019 15:49:28 +0000 (18:49 +0300)]
Avoiding excessive (njs_value_t *) casts.

Previously njs_arg() returned expression of type (const njs_value_t *).
This caused a lot of casts when calling functions and forced to declared
const njs_value_t * variables.

NO functional changes.

6 years agoUnifying return code variable name.
Dmitry Volyntsev [Thu, 1 Aug 2019 15:48:39 +0000 (18:48 +0300)]
Unifying return code variable name.

Using "ret" everywhere.

6 years agoRemoved unused njs_global_variable_value().
Dmitry Volyntsev [Thu, 1 Aug 2019 13:41:36 +0000 (16:41 +0300)]
Removed unused njs_global_variable_value().

6 years agoRefactored usage of njs_ret_t.
Dmitry Volyntsev [Tue, 30 Jul 2019 18:12:08 +0000 (21:12 +0300)]
Refactored usage of njs_ret_t.

Currently njs_ret_t is used in 2 different cases: as a jump offset for
bytecode and as a return value for ordinary functions. The second case
is quite similar with njs_int_t (and is often confused with).

1) Splitting this two cases into different types to avoid
confusion with njs_int_t.

2) Renaming njs_ret_t to njs_jump_off_t to better reflect its
purpose.

NO functional changes.

6 years agoRefactored file hierarchy.
Dmitry Volyntsev [Tue, 30 Jul 2019 17:11:46 +0000 (20:11 +0300)]
Refactored file hierarchy.

1) all source files are moved to src directory.
2) nxt files are renamed with "njs" prefix.
3) some files are renamed to avoid collisions:
    nxt_array.c -> njs_arr.c
    nxt_array.h -> njs_arr.h
    nxt_string.h -> njs_str.h
    nxt_time.c -> njs_time.c
    nxt_time.h -> njs_time.h
    njs_time.c -> njs_timer.c
    njs_time.h -> njs_timer.c
    njs_core.h -> njs_main.h
4) C tests are moved to src/test dir.
5) Other tests are moved to test dir.
6) Some structs are renamed to avoid collisions:
    nxt_array_t -> njs_arr_t
    nxt_string_t -> njs_str_t

    appropriate functions and macros are also renamed.

7) all macros, functions and other identifiers with "NXT_" and "nxt_"
    prefixes are renamed to corresponding "NJS_" or "njs_" prefix.

NO functional changes.

6 years agoRemoved retval from njs_vmcode_t.
hongzhidao [Sun, 28 Jul 2019 07:28:03 +0000 (03:28 -0400)]
Removed retval from njs_vmcode_t.

6 years agoMoving ctor from njs_vmcode_t to corresponding structure.
hongzhidao [Sun, 28 Jul 2019 06:26:23 +0000 (02:26 -0400)]
Moving ctor from njs_vmcode_t to corresponding structure.

6 years agoStyle.
hongzhidao [Sat, 27 Jul 2019 03:01:38 +0000 (23:01 -0400)]
Style.

6 years agoRemoved dead store assignment in njs_vmcode_interpreter().
Dmitry Volyntsev [Mon, 29 Jul 2019 13:22:39 +0000 (16:22 +0300)]
Removed dead store assignment in njs_vmcode_interpreter().

6 years agoFixed undefined behaviour in left shift of negative numbers.
Valentin Bartenev [Sun, 28 Jul 2019 14:19:51 +0000 (17:19 +0300)]
Fixed undefined behaviour in left shift of negative numbers.

Now it's implementation defined.

6 years agoSlight improvements to njs_vmcode_interpreter().
Valentin Bartenev [Sun, 28 Jul 2019 12:00:40 +0000 (15:00 +0300)]
Slight improvements to njs_vmcode_interpreter().

No functional changes.

6 years agoAdded String.prototype.trimStrart() and String.prototype.trimEnd().
Valentin Bartenev [Sun, 28 Jul 2019 10:19:03 +0000 (13:19 +0300)]
Added String.prototype.trimStrart() and String.prototype.trimEnd().

6 years agoUpdated the list of space separators in String.prototype.trim().
Valentin Bartenev [Sun, 28 Jul 2019 10:17:13 +0000 (13:17 +0300)]
Updated the list of space separators in String.prototype.trim().

According to the specification it must include all Unicode code points listed
in the "Space_Separator" (Zs) category.

6 years agoFixed String.fromCodePoint(), broken after 0b82f1c9268c.
Valentin Bartenev [Sat, 27 Jul 2019 18:12:32 +0000 (21:12 +0300)]
Fixed String.fromCodePoint(), broken after 0b82f1c9268c.

As it turned out, fromCodePoint() has shared the same handler with
fromCharCode(), but according to the specification these functions
have different semantics.  As a result, before 0b82f1c9268c both
functions had behaviour of fromCodePoint(), while after the change
they had behaviour of fromCharCode().

So, the fix is to revert back the code used before the change,
but only for fromCodePoint().

6 years agoFixed String.toLowerCase() and String.toUpperCase().
Valentin Bartenev [Sat, 27 Jul 2019 14:03:02 +0000 (17:03 +0300)]
Fixed String.toLowerCase() and String.toUpperCase().

Previously these functions didn't took into account that the size of
a string may change during case transformation resulting in buffer
underflow or overflow.

6 years agoFixed String.fromCharCode() for code points > 65535 and NaN.
Valentin Bartenev [Sat, 27 Jul 2019 13:12:26 +0000 (16:12 +0300)]
Fixed String.fromCharCode() for code points > 65535 and NaN.

According to the specification the code units must be truncated to uint16.

6 years agoFixed Array.length setter.
Artem S. Povalyukhin [Fri, 26 Jul 2019 04:24:36 +0000 (07:24 +0300)]
Fixed Array.length setter.

This closes #26 and closes #27 issues on Github.

6 years agoRemoved function call flag.
hongzhidao [Sat, 27 Jul 2019 02:37:38 +0000 (22:37 -0400)]
Removed function call flag.

6 years agoUnicode case tables updated to version 12.1 (May 2019).
Valentin Bartenev [Sat, 27 Jul 2019 00:51:48 +0000 (03:51 +0300)]
Unicode case tables updated to version 12.1 (May 2019).

6 years agoStyle in nxt_unicode_upper_case.pl and nxt_unicode_upper_case.h.
Valentin Bartenev [Sat, 27 Jul 2019 00:51:48 +0000 (03:51 +0300)]
Style in nxt_unicode_upper_case.pl and nxt_unicode_upper_case.h.

6 years agoRefactored njs_vmcode_interpreter() for performance.
Dmitry Volyntsev [Fri, 26 Jul 2019 17:37:13 +0000 (20:37 +0300)]
Refactored njs_vmcode_interpreter() for performance.

    1) opcodes are rewritten using switch table.
    2) often-used opcodes are prioritized and
       inlined.
    3) similar opcodes are combined into unified
       handlers.
    4) njs_vmcode_interpreter() return NJS_OK on
       success. NJS_STOP return code is removed.

6 years agoOptimized nxt_dec_count() using bisection.
Valentin Bartenev [Thu, 25 Jul 2019 19:07:57 +0000 (22:07 +0300)]
Optimized nxt_dec_count() using bisection.

Previously, the number of comparisons required to count decimal numbers
was equal to decimal numbers count.

Now only 3 comparsions are needed for numbers with 1, 2, 3, 4, 5, or 6
decimal digits, and 4 comparsions are needed for numbers with 7, 8, 9,
and 10 decimal digits.

6 years agoFixed one byte overread in njs_string_to_c_string().
Valentin Bartenev [Thu, 25 Jul 2019 17:17:42 +0000 (20:17 +0300)]
Fixed one byte overread in njs_string_to_c_string().

Short strings are packed quite tight in njs_value_t, so there's
no one more byte to test.

    struct {
        njs_value_type_t              type:8;

        uint8_t                       size:4;
        uint8_t                       length:4;

        u_char                        start[14];
    } short_string;

With 14 bytes string this occupies 16 bytes, which is equal
to sizeof(njs_value_t).

6 years agoMoving njs.c functions into njs_vm.c and njs_value.c
Dmitry Volyntsev [Tue, 23 Jul 2019 16:42:25 +0000 (19:42 +0300)]
Moving njs.c functions into njs_vm.c and njs_value.c

NO functional changes.

6 years agoSplitting vmcode functionality from njs_vm.c into njs_vmcode.c
Dmitry Volyntsev [Tue, 23 Jul 2019 14:53:00 +0000 (17:53 +0300)]
Splitting vmcode functionality from njs_vm.c into njs_vmcode.c

No functional changes.

6 years agoFixed property setter lookup.
Artem S. Povalyukhin [Sat, 20 Jul 2019 10:31:59 +0000 (13:31 +0300)]
Fixed property setter lookup.

6 years agoAdded Object shorthand methods and computed property names.
hongzhidao [Wed, 3 Jul 2019 02:24:11 +0000 (22:24 -0400)]
Added Object shorthand methods and computed property names.

This closes #182 issue on Github.

6 years agoInlining call to hash function in njs_property_query().
Dmitry Volyntsev [Fri, 19 Jul 2019 20:27:53 +0000 (23:27 +0300)]
Inlining call to hash function in njs_property_query().

6 years agoAdded njs_set_int32() and njs_set_uint32() intrinsics.
Dmitry Volyntsev [Fri, 19 Jul 2019 19:05:34 +0000 (22:05 +0300)]
Added njs_set_int32() and njs_set_uint32() intrinsics.

6 years agoRefactored working with function calls.
hongzhidao [Wed, 17 Jul 2019 02:44:16 +0000 (22:44 -0400)]
Refactored working with function calls.

    1) njs_continuation_t is removed (appropriate functions
       are rewritten).
    2) all function calls are made syncronous.

    This closes #190 issue on Github.

6 years agoRefactored working with non-primitive types.
Dmitry Volyntsev [Fri, 5 Jul 2019 18:45:28 +0000 (21:45 +0300)]
Refactored working with non-primitive types.

Traps mechanism is remove.

6 years agoFixed njs_string_slice().
Dmitry Volyntsev [Thu, 18 Jul 2019 18:12:25 +0000 (21:12 +0300)]
Fixed njs_string_slice().

Previously, njs_string_slice() when slice->start == slice->string_length
may call njs_string_offset() with invalid index.

This might result in invalid memory access in njs_string_offset()
for native functions which use njs_string_slice():

    String.prototype.substring()