]>
git.kaiwu.me - njs.git/log
Alexander Borisov [Mon, 21 Oct 2019 13:43:45 +0000 (16:43 +0300)]
Improved functions for converting value to number.
Added functions:
njs_value_to_number(), njs_value_to_integer(), njs_value_to_length()
njs_value_to_int32(), njs_value_to_uint32(), njs_value_to_uint16().
Removed functions:
njs_primitive_value_to_number(), njs_primitive_value_to_integer(),
njs_primitive_value_to_int32(), njs_primitive_value_to_uint32(),
njs_primitive_value_to_length().
Changed return type for njs_number_to_integer() function from int32_t
to int64_t.
Dmitry Volyntsev [Mon, 21 Oct 2019 12:10:34 +0000 (15:10 +0300)]
Fixed keyword list.
"undefined", "NaN" and "Infinity" are not keywords.
This closes #219 issue on Github.
Dmitry Volyntsev [Fri, 18 Oct 2019 13:38:55 +0000 (16:38 +0300)]
Moving global functions to global object.
This closes #132 issue on Github.
Dmitry Volyntsev [Fri, 18 Oct 2019 13:34:50 +0000 (16:34 +0300)]
Querying global object when variable cannot be resolved.
Dmitry Volyntsev [Fri, 18 Oct 2019 13:28:16 +0000 (16:28 +0300)]
Avoiding OBJECT COPY instruction each time global object accessed.
Artem S. Povalyukhin [Sat, 24 Aug 2019 02:41:46 +0000 (05:41 +0300)]
Fixed "caller" and "arguments" properties of a function instance.
This closes #209 issue on Github.
Dmitry Volyntsev [Tue, 15 Oct 2019 17:09:49 +0000 (20:09 +0300)]
HTTP: improved getting of special headers from r.headersIn.
If multiple "Cookie" or "X-Forwarded-For" are present they
are combined into a single return value.
This closes #201 issue on Github.
Alexander Borisov [Fri, 11 Oct 2019 16:41:51 +0000 (19:41 +0300)]
Added default number of arguments expected by builtin functions.
This closes #207 issue on GitHub.
Dmitry Volyntsev [Fri, 11 Oct 2019 14:08:28 +0000 (17:08 +0300)]
Fixed variable declaration with "from" name.
Previously, "from" was declared as a reserved word.
Artem S. Povalyukhin [Fri, 11 Oct 2019 03:50:33 +0000 (06:50 +0300)]
Fixed Date.prototype.setTime().
This closes #236 issue on Github.
Artem S. Povalyukhin [Fri, 11 Oct 2019 05:01:03 +0000 (08:01 +0300)]
Fixed type of Date.prototype.
This closes #237 issue on Github.
Dmitry Volyntsev [Thu, 10 Oct 2019 17:54:03 +0000 (20:54 +0300)]
Fixed Date() constructor according to specification.
Dmitry Volyntsev [Wed, 9 Oct 2019 11:43:09 +0000 (14:43 +0300)]
Fixed Date.UTC() according to specification.
This closes #235 issue on Github.
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.