]> git.kaiwu.me - njs.git/log
njs.git
7 years agoRenamed functions related to lambda.
hongzhidao [Mon, 7 Jan 2019 23:04:24 +0000 (07:04 +0800)]
Renamed functions related to lambda.

7 years agoRefactored out njs_function_apply().
hongzhidao [Mon, 7 Jan 2019 22:14:36 +0000 (06:14 +0800)]
Refactored out njs_function_apply().

As a variant of njs_function_activate().

7 years agoFixed njs_vm_call().
hongzhidao [Mon, 7 Jan 2019 22:14:36 +0000 (06:14 +0800)]
Fixed njs_vm_call().

7 years agoSimplified njs_vm_call().
hongzhidao [Mon, 7 Jan 2019 21:02:20 +0000 (05:02 +0800)]
Simplified njs_vm_call().

7 years agoMaking njs_function_activate() more generic.
hongzhidao [Mon, 7 Jan 2019 20:11:51 +0000 (04:11 +0800)]
Making njs_function_activate() more generic.

7 years agoInlined njs_function_previous_frame().
Dmitry Volyntsev [Thu, 10 Jan 2019 14:30:30 +0000 (17:30 +0300)]
Inlined njs_function_previous_frame().

7 years agoMoving njs_normalize_args() into njs_function_native_call().
hongzhidao [Mon, 7 Jan 2019 20:04:02 +0000 (04:04 +0800)]
Moving njs_normalize_args() into njs_function_native_call().

7 years agoIntroduced njs_function_native_call().
hongzhidao [Mon, 7 Jan 2019 14:14:17 +0000 (22:14 +0800)]
Introduced njs_function_native_call().

7 years agoRefactored njs_function_frame_free.
hongzhidao [Mon, 7 Jan 2019 09:42:00 +0000 (17:42 +0800)]
Refactored njs_function_frame_free.

7 years agoFixed vmcode function call.
hongzhidao [Mon, 7 Jan 2019 09:40:48 +0000 (17:40 +0800)]
Fixed vmcode function call.

This closes #82 issue on Github.

7 years ago2019 year.
Dmitry Volyntsev [Wed, 9 Jan 2019 15:21:31 +0000 (18:21 +0300)]
2019 year.

7 years agoImproved function naming in variable code.
hongzhidao [Sat, 29 Dec 2018 14:35:31 +0000 (22:35 +0800)]
Improved function naming in variable code.

Renaming:
1) njs_variable_get() to njs_variable_resolve().
2) njs_variable_find() to njs_variable_reference_resolve().

To better reflect what they do.

7 years agoImproved working with scope indexes of variables.
hongzhidao [Sat, 29 Dec 2018 08:03:57 +0000 (16:03 +0800)]
Improved working with scope indexes of variables.

7 years agoRemoved dead code in njs_set_timer().
Dmitry Volyntsev [Sat, 29 Dec 2018 12:16:59 +0000 (15:16 +0300)]
Removed dead code in njs_set_timer().

Found by Coverity (CID 1442096).

7 years agoRemoved duplicate njs_variable_reference() declaration.
hongzhidao [Fri, 28 Dec 2018 17:43:44 +0000 (01:43 +0800)]
Removed duplicate njs_variable_reference() declaration.

7 years agoVariables handling during code generation is improved.
hongzhidao [Fri, 28 Dec 2018 17:43:44 +0000 (01:43 +0800)]
Variables handling during code generation is improved.

All the necessary fields related to a variable are moved into
njs_variable_reference_t.

7 years agoImproved njs_generate_typeof_operation().
hongzhidao [Fri, 28 Dec 2018 17:43:44 +0000 (01:43 +0800)]
Improved njs_generate_typeof_operation().

njs_variable_typeof() cannot fail.

7 years agoInteractive shell: immediate events support.
Dmitry Volyntsev [Fri, 28 Dec 2018 16:36:24 +0000 (19:36 +0300)]
Interactive shell: immediate events support.

This closes #66 issue on Github.

7 years agoFixed grammar in njs_vm.h.
Dmitry Volyntsev [Fri, 28 Dec 2018 12:39:59 +0000 (15:39 +0300)]
Fixed grammar in njs_vm.h.

7 years agoAdded setImmediate().
Dmitry Volyntsev [Fri, 28 Dec 2018 09:44:56 +0000 (12:44 +0300)]
Added setImmediate().

7 years agoInteractive shell: initial support of posted events.
Dmitry Volyntsev [Fri, 28 Dec 2018 09:43:36 +0000 (12:43 +0300)]
Interactive shell: initial support of posted events.

7 years agonjs_vm_pending() is split in njs_vm_posted() and njs_vm_waiting().
Dmitry Volyntsev [Fri, 28 Dec 2018 09:43:22 +0000 (12:43 +0300)]
njs_vm_pending() is split in njs_vm_posted() and njs_vm_waiting().

There are two types of events in njs:
    Posted - are ready to be executed by njs_vm_run().
    Waiting - await external async events.

7 years agonjs_vm_run() is rectified.
Dmitry Volyntsev [Fri, 28 Dec 2018 09:42:29 +0000 (12:42 +0300)]
njs_vm_run() is rectified.

Previously, both njs_vm_call() and njs_vm_run() can be used to run njs
code. njs_vm_call() was used to invoke a single function, while
njs_vm_run() was used to run global code as well to process the events.

At first invocation njs_vm_run() executed global code, all the next
invocations it processed pending events.

The solution is splitting njs_vm_run() into two functions. One for
events processing and another for running the global code.

7 years agoImproved naming in njs_variables_scope_resolve().
Dmitry Volyntsev [Thu, 27 Dec 2018 07:35:07 +0000 (10:35 +0300)]
Improved naming in njs_variables_scope_resolve().

Thanks to 洪志道 (Hong Zhi Dao).

7 years agoStyle.
Dmitry Volyntsev [Thu, 27 Dec 2018 07:27:46 +0000 (10:27 +0300)]
Style.

7 years agoRefactored functions related to variables.
Dmitry Volyntsev [Wed, 26 Dec 2018 16:57:41 +0000 (19:57 +0300)]
Refactored functions related to variables.

    1) njs_builtin_add() is refactored out as a minor variant of
       njs_variable_add().
    2) parser is refactored out from arguments of the functions.

7 years agoAdded support of native function calls in njs_vm_call().
Dmitry Volyntsev [Wed, 26 Dec 2018 13:05:23 +0000 (16:05 +0300)]
Added support of native function calls in njs_vm_call().

7 years agoFixed exit instructions inside try blocks.
Dmitry Volyntsev [Wed, 26 Dec 2018 10:23:16 +0000 (13:23 +0300)]
Fixed exit instructions inside try blocks.

Fixed instructions: continue, break, return.

7 years agoVersion bump.
Dmitry Volyntsev [Tue, 25 Dec 2018 06:53:27 +0000 (09:53 +0300)]
Version bump.

7 years agoAdded tag 0.2.7 for changeset 4624ba4f6497
Dmitry Volyntsev [Tue, 25 Dec 2018 06:51:02 +0000 (09:51 +0300)]
Added tag 0.2.7 for changeset 4624ba4f6497

7 years agoVersion 0.2.7. 0.2.7
Dmitry Volyntsev [Tue, 25 Dec 2018 06:49:52 +0000 (09:49 +0300)]
Version 0.2.7.

7 years agoRemoved surplus for loop.
Dmitry Volyntsev [Mon, 24 Dec 2018 10:59:27 +0000 (13:59 +0300)]
Removed surplus for loop.

Left over after simplifications in 4e62b7a295e0.

Found by Coverity (CID 1441823).

7 years agoAdded the rest parameters support.
Alexander Pyshchev [Mon, 17 Dec 2018 19:13:02 +0000 (21:13 +0200)]
Added the rest parameters support.

This closes #21 issue on Github.

7 years agoStyle.
Dmitry Volyntsev [Fri, 7 Dec 2018 15:58:27 +0000 (18:58 +0300)]
Style.

7 years agoRemoving unused "size" field from njs_parser_operation_t.
Dmitry Volyntsev [Fri, 7 Dec 2018 15:54:59 +0000 (18:54 +0300)]
Removing unused "size" field from njs_parser_operation_t.

Thanks to 洪志道 (Hong Zhi Dao).

This closes #68 issue on Github.

7 years agoFreeing code buffer after is was reallocated.
Dmitry Volyntsev [Fri, 7 Dec 2018 15:33:52 +0000 (18:33 +0300)]
Freeing code buffer after is was reallocated.

Thanks to 洪志道 (Hong Zhi Dao).

7 years agoCode generator is separated from parser structure.
Dmitry Volyntsev [Fri, 7 Dec 2018 14:15:21 +0000 (17:15 +0300)]
Code generator is separated from parser structure.

7 years agoCode generator refactored.
Dmitry Volyntsev [Fri, 7 Dec 2018 14:11:33 +0000 (17:11 +0300)]
Code generator refactored.

Previously, the code size had to be calculated before code generation
phase because raw pointers to instruction were used to determine proper
jump offsets. It introduced unnecessary coupling between parser and
generator as well as complicated the parser because it had to know in
advance what instructions will be generated.

The solution is the dynamic reallocation of the code during generation
phase and the usage of relative offsets when calculating jump instructions.

7 years agoFixed building on paltforms without librt.
Igor Sysoev [Wed, 5 Dec 2018 12:38:33 +0000 (15:38 +0300)]
Fixed building on paltforms without librt.

7 years agoFixed type of iteration variable in for-in with array values.
Dmitry Volyntsev [Tue, 4 Dec 2018 18:13:13 +0000 (21:13 +0300)]
Fixed type of iteration variable in for-in with array values.

7 years agoObject.entries() method.
Valentin Bartenev [Mon, 3 Dec 2018 16:23:27 +0000 (19:23 +0300)]
Object.entries() method.

7 years agoObject.values() method.
Valentin Bartenev [Mon, 3 Dec 2018 16:20:58 +0000 (19:20 +0300)]
Object.values() method.

7 years agoSlightly optimized njs_object_keys_array().
Valentin Bartenev [Sat, 1 Dec 2018 19:32:33 +0000 (22:32 +0300)]
Slightly optimized njs_object_keys_array().

There is no need to iterate over the object properties second time if after
the first attempt we know that it contains no enumerable properties.

Also removed surplus conditions.

7 years agoFixed comparison of Byte and UTF8 strings.
Dmitry Volyntsev [Fri, 30 Nov 2018 14:52:02 +0000 (17:52 +0300)]
Fixed comparison of Byte and UTF8 strings.

7 years agoUsing acosh(0) to get NaN in runtime.
Dmitry Volyntsev [Thu, 29 Nov 2018 18:01:59 +0000 (21:01 +0300)]
Using acosh(0) to get NaN in runtime.

macOS clang 10 optimizes sqrt(-1) out using garbage value
instead.

7 years agoImproved accuracy of console.time()/console.timeEnd().
Artem S. Povalyukhin [Wed, 28 Nov 2018 18:56:19 +0000 (21:56 +0300)]
Improved accuracy of console.time()/console.timeEnd().

7 years agoAdded nxt_time().
Artem S. Povalyukhin [Wed, 28 Nov 2018 18:50:28 +0000 (21:50 +0300)]
Added nxt_time().

Returns the current high-resolution real time.

7 years agoFixed conversion of NAN and INF to uint32_t on some platforms.
Dmitry Volyntsev [Thu, 29 Nov 2018 15:14:12 +0000 (18:14 +0300)]
Fixed conversion of NAN and INF to uint32_t on some platforms.

7 years agoFixed assignment expression from compound assignment.
Dmitry Volyntsev [Wed, 28 Nov 2018 12:47:05 +0000 (15:47 +0300)]
Fixed assignment expression from compound assignment.

7 years agoFixed automatic semicolon insertion.
Dmitry Volyntsev [Tue, 27 Nov 2018 15:58:30 +0000 (18:58 +0300)]
Fixed automatic semicolon insertion.

7 years agoVersion bump.
Dmitry Volyntsev [Tue, 27 Nov 2018 15:58:26 +0000 (18:58 +0300)]
Version bump.

7 years agoAdded tag 0.2.6 for changeset 0709b8b4f11e
Dmitry Volyntsev [Tue, 27 Nov 2018 12:20:11 +0000 (15:20 +0300)]
Added tag 0.2.6 for changeset 0709b8b4f11e

7 years agoVersion 0.2.6. 0.2.6
Dmitry Volyntsev [Tue, 27 Nov 2018 12:18:45 +0000 (15:18 +0300)]
Version 0.2.6.

7 years agoFixed parsing of statements in if without newline.
Dmitry Volyntsev [Fri, 23 Nov 2018 14:46:30 +0000 (17:46 +0300)]
Fixed parsing of statements in if without newline.

This fixes #8 issue on Github.

Thanks to 洪志道 (Hong Zhi Dao)

7 years agoFixed parser for newline after throw.
Dmitry Volyntsev [Fri, 23 Nov 2018 11:30:24 +0000 (14:30 +0300)]
Fixed parser for newline after throw.

7 years agoFixed typeof for object_value type.
Dmitry Volyntsev [Thu, 22 Nov 2018 16:32:48 +0000 (19:32 +0300)]
Fixed typeof for object_value type.

7 years agoMaking built-in prototypes mutable.
Dmitry Volyntsev [Thu, 22 Nov 2018 15:55:32 +0000 (18:55 +0300)]
Making built-in prototypes mutable.

7 years agoBacked out changeset b3691d847ff4, reimplemented properly.
Dmitry Volyntsev [Thu, 22 Nov 2018 15:12:26 +0000 (18:12 +0300)]
Backed out changeset b3691d847ff4, reimplemented properly.

7 years agoFixed parsing of throw statement inside if.
Dmitry Volyntsev [Thu, 22 Nov 2018 14:38:40 +0000 (17:38 +0300)]
Fixed parsing of throw statement inside if.

7 years agoFixed size uint32_t overflow in njs_array_expand().
Dmitry Volyntsev [Thu, 22 Nov 2018 14:38:25 +0000 (17:38 +0300)]
Fixed size uint32_t overflow in njs_array_expand().

7 years agoImproved backtrace reporting for stack overflow.
Dmitry Volyntsev [Thu, 22 Nov 2018 12:35:25 +0000 (15:35 +0300)]
Improved backtrace reporting for stack overflow.

7 years agoFixed handling of unexpected tokens in parser.
Dmitry Volyntsev [Thu, 22 Nov 2018 12:02:19 +0000 (15:02 +0300)]
Fixed handling of unexpected tokens in parser.

This fixes #50 issue on Github.

7 years agoInteractive shell: quiet mode.
Dmitry Volyntsev [Wed, 21 Nov 2018 13:45:10 +0000 (16:45 +0300)]
Interactive shell: quiet mode.

7 years agoFixed buffer overrun by memcpy() (CID 1441409).
Dmitry Volyntsev [Mon, 19 Nov 2018 13:55:37 +0000 (16:55 +0300)]
Fixed buffer overrun by memcpy() (CID 1441409).

7 years agoFixed various clang static analyzer warnings.
Dmitry Volyntsev [Mon, 19 Nov 2018 13:30:35 +0000 (16:30 +0300)]
Fixed various clang static analyzer warnings.

In njs_object_keys_array() function.

7 years agoHandling non-object values in Object.keys().
Dmitry Volyntsev [Thu, 15 Nov 2018 17:31:35 +0000 (20:31 +0300)]
Handling non-object values in Object.keys().

This fixes #54 issue on Github.

7 years agoExtended Object.defineProperty() spec conformance.
Dmitry Volyntsev [Thu, 15 Nov 2018 17:31:35 +0000 (20:31 +0300)]
Extended Object.defineProperty() spec conformance.

  1) non-primitive property names.
  2) support of array index properties.
  3) support of special properties with
     NJS_PROPERTY_HANDLER, like length.

7 years agoFixed local scope this.
Dmitry Volyntsev [Thu, 15 Nov 2018 17:31:35 +0000 (20:31 +0300)]
Fixed local scope this.

7 years agoFixed global objects.
Dmitry Volyntsev [Thu, 15 Nov 2018 17:31:35 +0000 (20:31 +0300)]
Fixed global objects.

    1) Making it extensible.
    2) Adding default properties according to ES5.1:15.1.1.

8 years agoImproved handling of builtin objects.
Dmitry Volyntsev [Wed, 4 Apr 2018 14:38:10 +0000 (17:38 +0300)]
Improved handling of builtin objects.

The handling of njs_object_init_t arrays is unified across
njs_builtin.c functions.

7 years agoconsole.time() and console.timeEnd() methods.
Artem S. Povalyukhin [Wed, 14 Nov 2018 15:14:49 +0000 (18:14 +0300)]
console.time() and console.timeEnd() methods.

This fixes #62 issue on Github.

7 years agoFixed lvlhsh test on 64-bit big-endian systems.
Valentin Bartenev [Thu, 15 Nov 2018 09:45:02 +0000 (12:45 +0300)]
Fixed lvlhsh test on 64-bit big-endian systems.

The nxt_murmur_hash2() generated 4-byte hash that was stored in uintptr_t,
which was 8 bytes long on 64-bit systems.  At each iteration, it took the
previous key and hashed it again.

The problem was that it took only the first 4 bytes of the key, and these
4 bytes were always zero on 64-bit big-endian system.  That resulted in
equal keys at each iteration.

The bug was discovered on IBM/S390x.

7 years agoTolerate epsilon difference in the previous unit test change.
Sergey Kandaurov [Tue, 13 Nov 2018 12:25:00 +0000 (15:25 +0300)]
Tolerate epsilon difference in the previous unit test change.

7 years agoFixed unit tests for SunC.
Sergey Kandaurov [Tue, 13 Nov 2018 11:16:54 +0000 (14:16 +0300)]
Fixed unit tests for SunC.

7 years agoFixed building by SunC 5.15.
Sergey Kandaurov [Mon, 12 Nov 2018 17:08:36 +0000 (20:08 +0300)]
Fixed building by SunC 5.15.

7 years agoAllowing variables and functions to be redeclared.
Dmitry Volyntsev [Mon, 12 Nov 2018 15:27:05 +0000 (18:27 +0300)]
Allowing variables and functions to be redeclared.

7 years agoRegExp: fixed a case when lastIndex is greater than string size.
Valentin Bartenev [Mon, 12 Nov 2018 14:22:14 +0000 (17:22 +0300)]
RegExp: fixed a case when lastIndex is greater than string size.

Previously, it resulted in: "InternalError: pcre_exec() failed: -32" due to
negative string size caused by subtraction of last_index.

7 years agoFixed equality operator with object and string.
Valentin Bartenev [Fri, 9 Nov 2018 15:22:01 +0000 (18:22 +0300)]
Fixed equality operator with object and string.

7 years agoFixed equality operator when both operands are objects.
Valentin Bartenev [Thu, 8 Nov 2018 17:32:45 +0000 (20:32 +0300)]
Fixed equality operator when both operands are objects.

7 years agoFixed equality operator with "null" value as right operand.
Valentin Bartenev [Fri, 9 Nov 2018 15:05:39 +0000 (18:05 +0300)]
Fixed equality operator with "null" value as right operand.

7 years agoFixed misplaced njs_internal_error().
Valentin Bartenev [Thu, 8 Nov 2018 13:45:54 +0000 (16:45 +0300)]
Fixed misplaced njs_internal_error().

7 years agonjs_vm_run() is simplified.
Dmitry Volyntsev [Wed, 7 Nov 2018 15:41:29 +0000 (18:41 +0300)]
njs_vm_run() is simplified.

7 years agoAdded njs_vm_retval_dump().
Dmitry Volyntsev [Wed, 7 Nov 2018 15:41:28 +0000 (18:41 +0300)]
Added njs_vm_retval_dump().

7 years agoFixed accumulative flag in CLI file mode.
Dmitry Volyntsev [Wed, 7 Nov 2018 15:41:25 +0000 (18:41 +0300)]
Fixed accumulative flag in CLI file mode.

7 years agoInitializing closure values of a function.
Dmitry Volyntsev [Tue, 6 Nov 2018 17:57:53 +0000 (20:57 +0300)]
Initializing closure values of a function.

This fixes #55 issue on Github.

7 years agoUsing more approprite name for undefined value in exceptions.
Dmitry Volyntsev [Tue, 6 Nov 2018 17:57:52 +0000 (20:57 +0300)]
Using more approprite name for undefined value in exceptions.

7 years agoImproved wording for "not a function" exception.
Dmitry Volyntsev [Tue, 6 Nov 2018 17:30:49 +0000 (20:30 +0300)]
Improved wording for "not a function" exception.

7 years agoFixed description for explicit_bzero script.
Dmitry Volyntsev [Wed, 31 Oct 2018 13:06:06 +0000 (16:06 +0300)]
Fixed description for explicit_bzero script.

7 years agoVersion bump.
Dmitry Volyntsev [Tue, 30 Oct 2018 11:22:20 +0000 (14:22 +0300)]
Version bump.

7 years agoAdded tag 0.2.5 for changeset 3315f6aa6000
Dmitry Volyntsev [Tue, 30 Oct 2018 11:20:31 +0000 (14:20 +0300)]
Added tag 0.2.5 for changeset 3315f6aa6000

7 years agoVersion 0.2.5. 0.2.5
Dmitry Volyntsev [Tue, 30 Oct 2018 11:16:39 +0000 (14:16 +0300)]
Version 0.2.5.

7 years agoNon-integer fractions.
Valentin Bartenev [Mon, 29 Oct 2018 18:06:24 +0000 (21:06 +0300)]
Non-integer fractions.

7 years agoStream: marking incoming chain as processed.
Dmitry Volyntsev [Mon, 29 Oct 2018 14:36:43 +0000 (17:36 +0300)]
Stream: marking incoming chain as processed.

Previously, the buffers of proxy module were not reclaimed.
This resulted in stopping the processing of new data chunks from
a client after proxy_buffer_size bytes were received.

7 years agoAdded arguments object.
Dmitry Volyntsev [Tue, 23 Oct 2018 17:40:08 +0000 (20:40 +0300)]
Added arguments object.

This closes #19 issue on Github.

7 years agoHandling non-array values in Array.prototype.slice.
Dmitry Volyntsev [Tue, 23 Oct 2018 17:40:02 +0000 (20:40 +0300)]
Handling non-array values in Array.prototype.slice.

7 years agoHandling int overflow in njs_array_alloc() on 32bit archs.
Dmitry Volyntsev [Fri, 19 Oct 2018 17:55:38 +0000 (20:55 +0300)]
Handling int overflow in njs_array_alloc() on 32bit archs.

7 years agoAdded njs_string_slice_string_prop().
Dmitry Volyntsev [Fri, 19 Oct 2018 17:55:33 +0000 (20:55 +0300)]
Added njs_string_slice_string_prop().

7 years agoAdded njs_primitive_value_to_number().
Dmitry Volyntsev [Fri, 19 Oct 2018 17:55:30 +0000 (20:55 +0300)]
Added njs_primitive_value_to_number().

7 years agoFixed Object.prototype.hasOwnProperty() for non-object properties.
Dmitry Volyntsev [Fri, 19 Oct 2018 17:55:23 +0000 (20:55 +0300)]
Fixed Object.prototype.hasOwnProperty() for non-object properties.

This fixes #9 issue on Github.

7 years agodelete operator refactored.
Dmitry Volyntsev [Fri, 19 Oct 2018 17:54:59 +0000 (20:54 +0300)]
delete operator refactored.