]>
git.kaiwu.me - njs.git/log
hongzhidao [Thu, 8 Aug 2019 07:52:18 +0000 (03:52 -0400)]
Added getter/setter literal support.
This closes #118 issue on Github.
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.
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.
Dmitry Volyntsev [Thu, 8 Aug 2019 11:19:55 +0000 (14:19 +0300)]
Added support for accessor property descriptors in njs.dump().
Dmitry Volyntsev [Thu, 8 Aug 2019 11:19:54 +0000 (14:19 +0300)]
Fixed njs_is_accessor_descriptor().
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.
hongzhidao [Wed, 7 Aug 2019 02:54:13 +0000 (22:54 -0400)]
Added property getter support for njs_object_property().
Dmitry Volyntsev [Wed, 7 Aug 2019 14:23:47 +0000 (17:23 +0300)]
Fixed Object.defineProperty() for non-boolean descriptor props.
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 ).
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.
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.
Dmitry Volyntsev [Tue, 6 Aug 2019 14:58:37 +0000 (17:58 +0300)]
Cleanup of njs_property_query() usage.
Dmitry Volyntsev [Mon, 5 Aug 2019 18:17:27 +0000 (21:17 +0300)]
Fixed "in" operator for values with accessor descriptors.
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.
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".
Dmitry Volyntsev [Mon, 5 Aug 2019 14:10:59 +0000 (17:10 +0300)]
Fixed njs_error_new() for UTF8 messages.
Dmitry Volyntsev [Mon, 5 Aug 2019 15:17:15 +0000 (18:17 +0300)]
Using njs_is_defined() where appropriate.
hongzhidao [Sun, 4 Aug 2019 07:59:42 +0000 (03:59 -0400)]
Fixed Error() constructor with no arguments.
Dmitry Volyntsev [Mon, 5 Aug 2019 14:36:09 +0000 (17:36 +0300)]
Separating private from public headers.
hongzhidao [Sun, 4 Aug 2019 08:13:02 +0000 (04:13 -0400)]
Added getter support for method frame calls.
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.
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.
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.
Dmitry Volyntsev [Fri, 2 Aug 2019 13:05:44 +0000 (16:05 +0300)]
Headers cleanup in src/test missed in
835b3e817b93 .
Dmitry Volyntsev [Fri, 2 Aug 2019 12:41:21 +0000 (15:41 +0300)]
Adding default target as dependency for make all.
Dmitry Volyntsev [Fri, 2 Aug 2019 09:12:36 +0000 (12:12 +0300)]
Moving all common headers into njs_main.h.
Dmitry Volyntsev [Fri, 2 Aug 2019 09:12:35 +0000 (12:12 +0300)]
Removing njs_stub.h.
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.
Dmitry Volyntsev [Thu, 1 Aug 2019 18:01:16 +0000 (21:01 +0300)]
Removing njs_mem_proto_t from njs_mp_t.
Dmitry Volyntsev [Thu, 1 Aug 2019 15:49:29 +0000 (18:49 +0300)]
Merging njs_alignment.h into njs_clang.h.
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.
Dmitry Volyntsev [Thu, 1 Aug 2019 15:48:39 +0000 (18:48 +0300)]
Unifying return code variable name.
Using "ret" everywhere.
Dmitry Volyntsev [Thu, 1 Aug 2019 13:41:36 +0000 (16:41 +0300)]
Removed unused njs_global_variable_value().
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.
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.
hongzhidao [Sun, 28 Jul 2019 07:28:03 +0000 (03:28 -0400)]
Removed retval from njs_vmcode_t.
hongzhidao [Sun, 28 Jul 2019 06:26:23 +0000 (02:26 -0400)]
Moving ctor from njs_vmcode_t to corresponding structure.
hongzhidao [Sat, 27 Jul 2019 03:01:38 +0000 (23:01 -0400)]
Style.
Dmitry Volyntsev [Mon, 29 Jul 2019 13:22:39 +0000 (16:22 +0300)]
Removed dead store assignment in njs_vmcode_interpreter().
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.
Valentin Bartenev [Sun, 28 Jul 2019 12:00:40 +0000 (15:00 +0300)]
Slight improvements to njs_vmcode_interpreter().
No functional changes.
Valentin Bartenev [Sun, 28 Jul 2019 10:19:03 +0000 (13:19 +0300)]
Added String.prototype.trimStrart() and String.prototype.trimEnd().
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.
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().
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.
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.
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.
hongzhidao [Sat, 27 Jul 2019 02:37:38 +0000 (22:37 -0400)]
Removed function call flag.
Valentin Bartenev [Sat, 27 Jul 2019 00:51:48 +0000 (03:51 +0300)]
Unicode case tables updated to version 12.1 (May 2019).
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.
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.
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.
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).
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.
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.
Artem S. Povalyukhin [Sat, 20 Jul 2019 10:31:59 +0000 (13:31 +0300)]
Fixed property setter lookup.
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.
Dmitry Volyntsev [Fri, 19 Jul 2019 20:27:53 +0000 (23:27 +0300)]
Inlining call to hash function in njs_property_query().
Dmitry Volyntsev [Fri, 19 Jul 2019 19:05:34 +0000 (22:05 +0300)]
Added njs_set_int32() and njs_set_uint32() intrinsics.
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.
Dmitry Volyntsev [Fri, 5 Jul 2019 18:45:28 +0000 (21:45 +0300)]
Refactored working with non-primitive types.
Traps mechanism is remove.
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()
Alexander Borisov [Thu, 18 Jul 2019 13:18:19 +0000 (16:18 +0300)]
Fixed typo in njs_parser_string_create() introduced in
f1a70d67646d .
Alexander Borisov [Wed, 17 Jul 2019 11:24:00 +0000 (14:24 +0300)]
Added support '$&' substitution in String.prototype.replace().
Dmitry Volyntsev [Wed, 17 Jul 2019 13:28:30 +0000 (16:28 +0300)]
Using hand-written nxt_explicit_memzero() with memory-sanitizer.
To avoid false-positive results.
Alexander Borisov [Tue, 16 Jul 2019 14:32:12 +0000 (17:32 +0300)]
Fixed String.prototype.substring() with empty substring.
Alexander Borisov [Tue, 16 Jul 2019 14:32:11 +0000 (17:32 +0300)]
Fixed parsing of "$&" substitutions in String.prototype.replace().
Alexander Borisov [Tue, 16 Jul 2019 14:32:11 +0000 (17:32 +0300)]
Fixed String.prototype.match() for byte strings with regex arg.
Alexander Borisov [Tue, 16 Jul 2019 14:32:10 +0000 (17:32 +0300)]
Fixed String.prototype.replace() for byte strings with regex arg.
Dmitry Volyntsev [Tue, 16 Jul 2019 09:57:29 +0000 (12:57 +0300)]
Avoiding aligned attribute detection skip on ppc64le platforms.
Dmitry Volyntsev [Mon, 15 Jul 2019 16:20:55 +0000 (19:20 +0300)]
Unifying makefile target names.
Dmitry Volyntsev [Mon, 15 Jul 2019 15:46:31 +0000 (18:46 +0300)]
Added unit_test target.
Dmitry Volyntsev [Mon, 15 Jul 2019 14:46:37 +0000 (17:46 +0300)]
Added memory-sanitizer support.
Alexander Borisov [Mon, 15 Jul 2019 14:45:23 +0000 (17:45 +0300)]
Fixed incorrect optimization in njs_string_to_c_string().
Dmitry Volyntsev [Mon, 15 Jul 2019 13:20:41 +0000 (16:20 +0300)]
Tests: reporting unit tests statistics.
Dmitry Volyntsev [Mon, 15 Jul 2019 12:54:41 +0000 (15:54 +0300)]
Tests: passing unit tests options in a struct.
Dmitry Volyntsev [Fri, 12 Jul 2019 20:30:22 +0000 (23:30 +0300)]
Improved typeof for internal types.
Dmitry Volyntsev [Fri, 12 Jul 2019 18:18:30 +0000 (21:18 +0300)]
Allowing to configure ar binary.
Dmitry Volyntsev [Thu, 11 Jul 2019 18:29:59 +0000 (21:29 +0300)]
Fixed Array.prototype.lastIndexOf() with undefined arguments.
Valentin Bartenev [Thu, 11 Jul 2019 13:10:33 +0000 (16:10 +0300)]
Optimized inlining of njs_values_strict_equal().
This function is often called inside loops and basically it does only a few cmp
instructions that can be inlined.
The more complex part related to comparing of two strings is functionally
identical to njs_string_eq(), but contains an optimization that avoids memcmp()
when strings have different lengths. This optimization has been merged into
njs_string_eq().
No functional changes.
Alexander Borisov [Thu, 11 Jul 2019 12:42:33 +0000 (15:42 +0300)]
Fixed used of uninitialized memory in String.prototype.match().
Dmitry Volyntsev [Thu, 11 Jul 2019 12:33:40 +0000 (15:33 +0300)]
Fixed Object.values() and Object.entries() for shared objects.
Previously, there was a mismatch between
njs_object_enumerate_object_length() and
njs_object_own_enumerate_object() in the way they enumerated
values.
This closes #194, #195, #196 issues on Github.
Alexander Borisov [Wed, 10 Jul 2019 18:54:33 +0000 (21:54 +0300)]
Fixed UTF-8 character escaping.
Alexander Borisov [Wed, 10 Jul 2019 11:20:53 +0000 (14:20 +0300)]
Added UTF8 validation for string literals.
All bad UTF-8 characters are replaced by '\uFFFD'
(REPLACEMENT CHARACTER).
Dmitry Volyntsev [Mon, 8 Jul 2019 14:51:58 +0000 (17:51 +0300)]
Using njs_set_regexp() and njs_regexp() where approprite.
Dmitry Volyntsev [Mon, 8 Jul 2019 14:51:35 +0000 (17:51 +0300)]
Using njs_function() and njs_set_function() where applicable.
Dmitry Volyntsev [Mon, 8 Jul 2019 14:49:43 +0000 (17:49 +0300)]
Using njs_object() macro where applicable.
Dmitry Volyntsev [Mon, 8 Jul 2019 14:49:14 +0000 (17:49 +0300)]
Using njs_number() and njs_set_number() everywhere.
Dmitry Volyntsev [Mon, 8 Jul 2019 12:31:39 +0000 (15:31 +0300)]
Added njs_date() and njs_set_date() macros.
hongzhidao [Sat, 6 Jul 2019 14:27:14 +0000 (10:27 -0400)]
Moving value methods to njs_value.c.
hongzhidao [Wed, 3 Jul 2019 02:18:56 +0000 (22:18 -0400)]
Splitting njs_vm_value_to_ext_string().
Into njs_vm_value_to_string() and njs_vm_backtrace_dump().
hongzhidao [Wed, 3 Jul 2019 02:10:19 +0000 (22:10 -0400)]
Introduced njs_function_lambda_alloc().
Dmitry Volyntsev [Wed, 3 Jul 2019 15:30:59 +0000 (18:30 +0300)]
Fixed heap-buffer-overflow while importing module.
This closes #187 issue on Github.
Dmitry Volyntsev [Wed, 3 Jul 2019 14:16:40 +0000 (17:16 +0300)]
Fixed Array.prototype.slice() for primitive types.
This closes #188 issue on Github.
Dmitry Volyntsev [Tue, 2 Jul 2019 18:37:10 +0000 (21:37 +0300)]
Refactored functions inlining.
Allowing compiler to decide whether inline a function or not by
removing most of nxt_noinline prefixes.
Inlining simple functions.
Splitting public function getters from njs internal value getters.
Alexander Borisov [Tue, 2 Jul 2019 15:14:47 +0000 (18:14 +0300)]
Fixed String.prototype.replace() for '$0' replacement string.
For example:
'0'.replace(/^/g, "$0")
Valentin Bartenev [Mon, 1 Jul 2019 19:44:14 +0000 (22:44 +0300)]
Reduced nesting level of branches in njs_string_replace_regexp().
No functional changes.
David Carlier [Tue, 18 Jun 2019 15:02:57 +0000 (15:02 +0000)]
Crypto: zeroing the context after usage.
Regardless of the compiler optimisation.
This closes #181 pull request.
Alexander Borisov [Mon, 1 Jul 2019 16:57:34 +0000 (19:57 +0300)]
Added support for functions in regexp with global match.
This closes #183 issue on GitHub.
Dmitry Volyntsev [Mon, 1 Jul 2019 16:24:10 +0000 (19:24 +0300)]
Fixed using of uninitialized value in String.prototype.padStart().