]>
git.kaiwu.me - njs.git/log
Alexander Borisov [Wed, 9 Oct 2019 15:54:57 +0000 (18:54 +0300)]
Fixed Array.prototype.pop() and shift() for sparse objects.
This closes #233 issue on GitHub.
Alexander Borisov [Wed, 9 Oct 2019 15:54:54 +0000 (18:54 +0300)]
Fixed Array functions according to specification.
Length property should be queried before checking arguments for validity.
Аffected functions:
every, filter, find, findIndex, forEach, map, reduce, reduceRight, some.
This closes #228 issue on GitHub.
Dmitry Volyntsev [Tue, 8 Oct 2019 12:56:58 +0000 (15:56 +0300)]
Fixing Coverity warnings related to close() (CID
1444170 ).
Alexander Borisov [Mon, 30 Sep 2019 08:41:00 +0000 (11:41 +0300)]
Fixed Array.prototype.map() for a object with nonexistent values.
Previously nonexistent values in the object were skipped and not added
to the result.
Dmitry Volyntsev [Mon, 7 Oct 2019 15:16:47 +0000 (18:16 +0300)]
Added Number.prototype.toExponential().
Dmitry Volyntsev [Mon, 7 Oct 2019 15:11:19 +0000 (18:11 +0300)]
Aligning prototypes of njs_grisu2() and njs_grisu2_prec().
Dmitry Volyntsev [Fri, 4 Oct 2019 16:46:35 +0000 (19:46 +0300)]
Increased maximum allowed recursion depth in parser and generator.
Dmitry Volyntsev [Fri, 4 Oct 2019 16:46:12 +0000 (19:46 +0300)]
Style.
Fixed typo in njs_arr_t structure.
This closes #226 issue on Github.
Dmitry Volyntsev [Fri, 4 Oct 2019 14:19:06 +0000 (17:19 +0300)]
Fixed Regexp.prototype.test() for regexps with backreferences.
This closes #225 issue on Github.
Dmitry Volyntsev [Thu, 3 Oct 2019 13:59:22 +0000 (16:59 +0300)]
Added Number.prototype.toPrecision().
This closes #221 issue on Github.
Dmitry Volyntsev [Thu, 3 Oct 2019 13:26:04 +0000 (16:26 +0300)]
Improved naming in njs_dtoa() internal functions.
Alexander Borisov [Thu, 3 Oct 2019 12:41:30 +0000 (15:41 +0300)]
Fixed buffer overflow in Number.prototype.toString(radix).
Valentin Bartenev [Fri, 27 Sep 2019 19:21:55 +0000 (22:21 +0300)]
Date.prototype.toUTCString() format was aligned to ES9.
This closes #224 issue on GitHub.
Alexander Borisov [Thu, 19 Sep 2019 07:19:02 +0000 (10:19 +0300)]
Improved iteration over objects indexes in Array functions.
For example, unshift function for object with large length:
var arrayLike = {};
arrayLike.length = 2 ** 53 - 1;
Array.prototype.unshift.call(arrayLike);
Alexander Borisov [Thu, 19 Sep 2019 07:19:02 +0000 (10:19 +0300)]
Fixed Array prototype functions according to the specification.
The following fuctions were fixed:
pop, push, shift, unshift.
Alexander Borisov [Thu, 19 Sep 2019 07:19:01 +0000 (10:19 +0300)]
Added njs_value_property_delete().
Alexander Borisov [Thu, 19 Sep 2019 07:19:00 +0000 (10:19 +0300)]
Fixed Array prototype functions according to the specification.
The following fuctions were fixed:
includes, indexOf, lastIndexOf, reduceRight.
Alexander Borisov [Tue, 17 Sep 2019 08:29:10 +0000 (11:29 +0300)]
Fixed stack-use-after-scope in Array.prototype.map().
In the njs_array_iterator() an args.value is replaced to value on stack
for non-object strings.
Alexander Borisov [Tue, 17 Sep 2019 06:20:24 +0000 (09:20 +0300)]
Fixed njs_value_index().
Previous, there were several issues with njs_values_hash_test().
1) The function assumed string types of left and right values are identical.
(If current value is a long string it assumed the second value is also
a long string). Long vs short strings collision.
2) The function assumed if hashes are identical value length are equal.
Long vs long string collision.
The fix is to always check value sizes.
In addition, for short strings njs_value_index() calculated hash value including
padding bytes (which values are undefined). It could result in identical
short strings (but with different padding bytes) treated as different strings.
Alexander Borisov [Mon, 16 Sep 2019 14:21:36 +0000 (17:21 +0300)]
Fixed String.prototype.replace() when first argument is not a string.
This closes #208 issue on GitHub.
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.
Dmitry Volyntsev [Fri, 6 Sep 2019 12:47:12 +0000 (15:47 +0300)]
Style.
Dmitry Volyntsev [Tue, 3 Sep 2019 14:31:45 +0000 (17:31 +0300)]
Added Number.prototype.toFixed().
This closes #29 issue on Github.
hongzhidao [Fri, 23 Aug 2019 17:25:50 +0000 (13:25 -0400)]
Added new Function() support.
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.
Alexander Borisov [Thu, 29 Aug 2019 14:11:41 +0000 (17:11 +0300)]
Fixed incompatible pointer type introduced in
95d04dfea85c .
Alexander Borisov [Thu, 29 Aug 2019 13:39:10 +0000 (16:39 +0300)]
Fixed Function.prototype.apply() according to the specification.
Dmitry Volyntsev [Thu, 29 Aug 2019 12:12:45 +0000 (15:12 +0300)]
Fixed undefined behaviour in left shift of int value.
Dmitry Volyntsev [Thu, 29 Aug 2019 12:12:45 +0000 (15:12 +0300)]
Improved test coverage with MemorySanitizer enabled.
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.
Alexander Borisov [Thu, 29 Aug 2019 10:12:33 +0000 (13:12 +0300)]
Fixed typo introduced in
50fded8ccee5 .
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.
Dmitry Volyntsev [Wed, 28 Aug 2019 16:10:01 +0000 (19:10 +0300)]
Fixed parseFloat().
Dmitry Volyntsev [Tue, 27 Aug 2019 15:58:43 +0000 (18:58 +0300)]
Fixed integer-overflow while parsing exponent of number literals.
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.
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.
Dmitry Volyntsev [Fri, 23 Aug 2019 17:00:40 +0000 (20:00 +0300)]
Increased max function nesting.
Dmitry Volyntsev [Fri, 23 Aug 2019 12:13:45 +0000 (15:13 +0300)]
Limiting recursion depth while compiling.
This closes #146 issue on Github.
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.
hongzhidao [Wed, 21 Aug 2019 03:03:26 +0000 (23:03 -0400)]
Introduced njs_variables_copy().
hongzhidao [Wed, 21 Aug 2019 02:59:38 +0000 (22:59 -0400)]
Fixed division token in lexer.
Dmitry Volyntsev [Tue, 20 Aug 2019 17:51:39 +0000 (20:51 +0300)]
Fixed prototype mutation for object literals.
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.
Dmitry Volyntsev [Tue, 20 Aug 2019 17:51:33 +0000 (20:51 +0300)]
Version bump.
Dmitry Volyntsev [Thu, 15 Aug 2019 16:36:57 +0000 (19:36 +0300)]
Added tag 0.3.5 for changeset
b7fa83f27f1b
Dmitry Volyntsev [Thu, 15 Aug 2019 16:36:39 +0000 (19:36 +0300)]
Version 0.3.5.
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.
Dmitry Volyntsev [Wed, 14 Aug 2019 17:22:32 +0000 (20:22 +0300)]
Fixed handling of NJS_DECLINED returned by NJS_PROPERTY_HANDLER.
Dmitry Volyntsev [Wed, 14 Aug 2019 17:22:26 +0000 (20:22 +0300)]
Fixed [[SetPrototypeOf]].
Dmitry Volyntsev [Wed, 14 Aug 2019 17:22:20 +0000 (20:22 +0300)]
Version bump.
Dmitry Volyntsev [Tue, 13 Aug 2019 13:13:53 +0000 (16:13 +0300)]
Added tag 0.3.4 for changeset
8eadbb3a7c7b
Dmitry Volyntsev [Tue, 13 Aug 2019 13:13:28 +0000 (16:13 +0300)]
Version 0.3.4.
Dmitry Volyntsev [Tue, 13 Aug 2019 13:04:10 +0000 (16:04 +0300)]
Added detection of address sanitizer.
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.
Dmitry Volyntsev [Mon, 12 Aug 2019 18:04:50 +0000 (21:04 +0300)]
Using njs_set_undefined() and njs_set_invalid() where appropriate.
Dmitry Volyntsev [Mon, 12 Aug 2019 18:04:49 +0000 (21:04 +0300)]
Improved njs_string_to_c_string() prototype.
To avoid excessive casts.
Dmitry Volyntsev [Mon, 12 Aug 2019 18:04:49 +0000 (21:04 +0300)]
Added fs.renameSync().
This closes #198 issue on Github.
Dmitry Volyntsev [Mon, 12 Aug 2019 18:03:24 +0000 (21:03 +0300)]
Fixed fs.readFile() and fs.readFileSync() for files with 0 size.
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().