]> git.kaiwu.me - njs.git/log
njs.git
7 years agoAdded support for shorthand property names for Object literals.
Dmitry Volyntsev [Mon, 11 Feb 2019 15:15:43 +0000 (18:15 +0300)]
Added support for shorthand property names for Object literals.

This closes #87 issue on Github.

7 years agoRefactored njs_parser_terminal().
hongzhidao [Sat, 9 Feb 2019 09:34:04 +0000 (17:34 +0800)]
Refactored njs_parser_terminal().

1) Introduced njs_parser_reference().
2) njs_parser_builtin_object() and njs_parser_builtin_function()
    are refactored into njs_parser_builtin().
3) njs_parser_external() is simplified and renamed as
    njs_external_lookup().

7 years agoImproved njs_parser_property_token().
hongzhidao [Sat, 9 Feb 2019 08:26:08 +0000 (16:26 +0800)]
Improved njs_parser_property_token().

7 years agoRemoving unused argument of njs_parser_property_name().
Dmitry Volyntsev [Fri, 8 Feb 2019 17:22:28 +0000 (20:22 +0300)]
Removing unused argument of njs_parser_property_name().

7 years agoShell: avoid reporting filenames in exception is quiet mode.
Dmitry Volyntsev [Fri, 8 Feb 2019 17:14:55 +0000 (20:14 +0300)]
Shell: avoid reporting filenames in exception is quiet mode.

7 years agoUpdated list of reserved keywords.
Dmitry Volyntsev [Fri, 8 Feb 2019 17:06:05 +0000 (20:06 +0300)]
Updated list of reserved keywords.

7 years agoHTTP: skipping deleted elements while iterating over headers.
Dmitry Volyntsev [Thu, 7 Feb 2019 17:05:16 +0000 (20:05 +0300)]
HTTP: skipping deleted elements while iterating over headers.

7 years agoHTTP: added support for delete operation in r.headersOut.
Dmitry Volyntsev [Thu, 7 Feb 2019 17:05:14 +0000 (20:05 +0300)]
HTTP: added support for delete operation in r.headersOut.

This closes #64 issue on Github.

7 years agoHTTP: improved setting empty headers.
Dmitry Volyntsev [Wed, 6 Feb 2019 16:52:54 +0000 (19:52 +0300)]
HTTP: improved setting empty headers.

Treating empty value as deleting.

7 years agoHTTP: improved setting of special response headers.
Dmitry Volyntsev [Wed, 6 Feb 2019 16:22:18 +0000 (19:22 +0300)]
HTTP: improved setting of special response headers.

7 years agoModules: reporting njs filenames in exceptions.
Dmitry Volyntsev [Wed, 6 Feb 2019 12:50:03 +0000 (15:50 +0300)]
Modules: reporting njs filenames in exceptions.

7 years agoShell: improved filenames reporting in exceptions.
hongzhidao [Wed, 6 Feb 2019 04:27:41 +0000 (12:27 +0800)]
Shell: improved filenames reporting in exceptions.

7 years agoHTTP: setting default content type in sendHeader().
Dmitry Volyntsev [Tue, 5 Feb 2019 16:27:24 +0000 (19:27 +0300)]
HTTP: setting default content type in sendHeader().

7 years agoReporting filename in runtime errors.
hongzhidao [Mon, 4 Feb 2019 17:07:45 +0000 (01:07 +0800)]
Reporting filename in runtime errors.

7 years agoReporting filename in generator errors.
hongzhidao [Mon, 4 Feb 2019 16:53:18 +0000 (00:53 +0800)]
Reporting filename in generator errors.

7 years agoUsing nxt_sprintf() instead of sprintf() in backtraces.
hongzhidao [Mon, 4 Feb 2019 15:00:25 +0000 (23:00 +0800)]
Using nxt_sprintf() instead of sprintf() in backtraces.

7 years agoRemoved a surplus argument to the parser exception macro.
Sergey Kandaurov [Mon, 4 Feb 2019 13:30:27 +0000 (16:30 +0300)]
Removed a surplus argument to the parser exception macro.

While here, fixed nearby style.

7 years agoFixed building with Apple clang.
Dmitry Volyntsev [Mon, 4 Feb 2019 08:45:24 +0000 (11:45 +0300)]
Fixed building with Apple clang.

This closes #89 issue on Github.

7 years agoRenaming njs_exception_error_create() with njs_error_fmt_new().
hongzhidao [Sun, 3 Feb 2019 22:22:51 +0000 (06:22 +0800)]
Renaming njs_exception_error_create() with njs_error_fmt_new().

7 years agoReporting filename in parser errors.
hongzhidao [Sun, 3 Feb 2019 21:33:19 +0000 (05:33 +0800)]
Reporting filename in parser errors.

7 years agoImproved exception creation.
hongzhidao [Sun, 3 Feb 2019 21:26:42 +0000 (05:26 +0800)]
Improved exception creation.

7 years agoIntroduced njs_vm_invoke().
hongzhidao [Sat, 2 Feb 2019 08:01:39 +0000 (16:01 +0800)]
Introduced njs_vm_invoke().

7 years agoImproved njs_parser_statement_chain().
hongzhidao [Sat, 2 Feb 2019 06:21:26 +0000 (14:21 +0800)]
Improved njs_parser_statement_chain().

7 years agoImproved parsing object literals.
Dmitry Volyntsev [Fri, 1 Feb 2019 15:26:18 +0000 (18:26 +0300)]
Improved parsing object literals.

7 years agoFixed parsing object literals.
Dmitry Volyntsev [Fri, 1 Feb 2019 15:09:02 +0000 (18:09 +0300)]
Fixed parsing object literals.

7 years agoSimplified parser builtin function.
hongzhidao [Fri, 1 Feb 2019 11:48:30 +0000 (19:48 +0800)]
Simplified parser builtin function.

7 years agoSimplified parser tree building.
hongzhidao [Tue, 29 Jan 2019 08:30:13 +0000 (16:30 +0800)]
Simplified parser tree building.

7 years agoUnifying quotes usage in exceptions.
Dmitry Volyntsev [Wed, 30 Jan 2019 15:50:33 +0000 (18:50 +0300)]
Unifying quotes usage in exceptions.

7 years agoReplacing vsprintf with nxt_vsprintf in exceptions.
Dmitry Volyntsev [Wed, 30 Jan 2019 15:49:33 +0000 (18:49 +0300)]
Replacing vsprintf with nxt_vsprintf in exceptions.

7 years agoFixed SyntaxError message for unterminated regexp token.
Dmitry Volyntsev [Wed, 30 Jan 2019 15:49:16 +0000 (18:49 +0300)]
Fixed SyntaxError message for unterminated regexp token.

7 years agoFixed lexer->text state for the last token.
Dmitry Volyntsev [Wed, 30 Jan 2019 15:48:23 +0000 (18:48 +0300)]
Fixed lexer->text state for the last token.

7 years agoImported nxt_sprintf.c.
Dmitry Volyntsev [Wed, 30 Jan 2019 15:47:59 +0000 (18:47 +0300)]
Imported nxt_sprintf.c.

7 years agoStyle.
hongzhidao [Mon, 28 Jan 2019 17:30:04 +0000 (01:30 +0800)]
Style.

7 years agoFixed parsing multiline comments.
Dmitry Volyntsev [Tue, 29 Jan 2019 15:15:03 +0000 (18:15 +0300)]
Fixed parsing multiline comments.

7 years agoAdded support for multiline tests.
Dmitry Volyntsev [Tue, 29 Jan 2019 13:49:36 +0000 (16:49 +0300)]
Added support for multiline tests.

7 years agoImproved next index allocation.
hongzhidao [Sat, 26 Jan 2019 21:21:32 +0000 (05:21 +0800)]
Improved next index allocation.

7 years agoRenaming nxt_mem_cache_pool_t related structures and fields.
Dmitry Volyntsev [Mon, 28 Jan 2019 18:18:43 +0000 (21:18 +0300)]
Renaming nxt_mem_cache_pool_t related structures and fields.

nxt_mem_cache_pool_t -> nxt_mp_t.
nxt_mem_cache_* -> nxt_mp_*.
vm->mem_cache_pool -> vm->mem_pool.

7 years agoHTTP: removed response object deprecated in 0.2.2.
Dmitry Volyntsev [Mon, 28 Jan 2019 13:17:42 +0000 (16:17 +0300)]
HTTP: removed response object deprecated in 0.2.2.

7 years agoSimplified function parsing.
hongzhidao [Wed, 23 Jan 2019 16:48:19 +0000 (19:48 +0300)]
Simplified function parsing.

Avoid creating phony parser structures while parsing
function bodies.

7 years agoImproved setting vm->trace.
Dmitry Volyntsev [Tue, 22 Jan 2019 15:08:47 +0000 (18:08 +0300)]
Improved setting vm->trace.

7 years agoRemoved unused vm->scratch field.
Dmitry Volyntsev [Fri, 18 Jan 2019 12:28:17 +0000 (15:28 +0300)]
Removed unused vm->scratch field.

7 years agoStyle.
Dmitry Volyntsev [Fri, 18 Jan 2019 11:50:50 +0000 (14:50 +0300)]
Style.

7 years agoSetting exit index for try_return instruction is simplified.
Dmitry Volyntsev [Thu, 17 Jan 2019 14:01:22 +0000 (17:01 +0300)]
Setting exit index for try_return instruction is simplified.

7 years agoFixed comments "try" instructions.
Dmitry Volyntsev [Thu, 17 Jan 2019 13:12:46 +0000 (16:12 +0300)]
Fixed comments "try" instructions.

7 years agoFixed try_break instruction.
Dmitry Volyntsev [Thu, 17 Jan 2019 13:11:52 +0000 (16:11 +0300)]
Fixed try_break instruction.

7 years agoMaking generator block for block statements.
Dmitry Volyntsev [Wed, 16 Jan 2019 15:58:23 +0000 (18:58 +0300)]
Making generator block for block statements.

7 years agoFixed heap-use-after-free introduced in 045ba10db769.
Dmitry Volyntsev [Wed, 16 Jan 2019 15:55:16 +0000 (18:55 +0300)]
Fixed heap-use-after-free introduced in 045ba10db769.

7 years agoImproved an argument name of njs_function_frame().
hongzhidao [Fri, 11 Jan 2019 11:20:38 +0000 (19:20 +0800)]
Improved an argument name of njs_function_frame().

7 years agoRefactored njs_function_lambda_call().
hongzhidao [Fri, 11 Jan 2019 10:57:57 +0000 (18:57 +0800)]
Refactored njs_function_lambda_call().

7 years agoMaking njs_function_frame_alloc() static.
Dmitry Volyntsev [Thu, 10 Jan 2019 17:18:27 +0000 (20:18 +0300)]
Making njs_function_frame_alloc() static.

7 years agoIntroduced njs_function_frame().
hongzhidao [Tue, 8 Jan 2019 00:41:40 +0000 (08:41 +0800)]
Introduced njs_function_frame().

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.