Welcome! Log In Create A New Profile

Advanced

[njs] Improved handling of arguments object.

Dmitry Volyntsev
March 11, 2019 05:08AM
details: https://hg.nginx.org/njs/rev/a835619baf84
branches:
changeset: 825:a835619baf84
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Mon Mar 11 11:15:20 2019 +0300
description:
Improved handling of arguments object.

diffstat:

njs/njs_generator.c | 4 +---
njs/njs_generator.h | 1 -
njs/njs_parser.c | 2 ++
njs/njs_parser.h | 1 +
4 files changed, 4 insertions(+), 4 deletions(-)

diffs (55 lines):

diff -r 0e8ab0dfd08b -r a835619baf84 njs/njs_generator.c
--- a/njs/njs_generator.c Sun Mar 10 22:26:25 2019 +0300
+++ b/njs/njs_generator.c Mon Mar 11 11:15:20 2019 +0300
@@ -579,8 +579,6 @@ njs_generate_arguments_object(njs_vm_t *
{
njs_vmcode_arguments_t *gen;

- generator->arguments_object = 1;
-
node->index = njs_generate_object_dest_index(vm, generator, node);
if (nxt_slow_path(node->index == NJS_INDEX_ERROR)) {
return NXT_ERROR;
@@ -2312,7 +2310,7 @@ njs_generate_function_scope(njs_vm_t *vm
lambda->closure_size = size;

lambda->nesting = node->scope->nesting;
- lambda->arguments_object = generator.arguments_object;
+ lambda->arguments_object = node->scope->arguments_object;

lambda->start = generator.code_start;
lambda->local_size = generator.scope_size;
diff -r 0e8ab0dfd08b -r a835619baf84 njs/njs_generator.h
--- a/njs/njs_generator.h Sun Mar 10 22:26:25 2019 +0300
+++ b/njs/njs_generator.h Mon Mar 11 11:15:20 2019 +0300
@@ -24,7 +24,6 @@ struct njs_generator_s {

/* Parsing Function() or eval(). */
uint8_t runtime; /* 1 bit */
- uint8_t arguments_object; /* 1 bit */
};


diff -r 0e8ab0dfd08b -r a835619baf84 njs/njs_parser.c
--- a/njs/njs_parser.c Sun Mar 10 22:26:25 2019 +0300
+++ b/njs/njs_parser.c Mon Mar 11 11:15:20 2019 +0300
@@ -2169,6 +2169,8 @@ njs_parser_reference(njs_vm_t *vm, njs_p
return NULL;
}

+ parser->scope->arguments_object = 1;
+
break;

case NJS_TOKEN_OBJECT_CONSTRUCTOR:
diff -r 0e8ab0dfd08b -r a835619baf84 njs/njs_parser.h
--- a/njs/njs_parser.h Sun Mar 10 22:26:25 2019 +0300
+++ b/njs/njs_parser.h Mon Mar 11 11:15:20 2019 +0300
@@ -30,6 +30,7 @@ struct njs_parser_scope_s {
njs_scope_t type:8;
uint8_t nesting; /* 4 bits */
uint8_t argument_closures;
+ uint8_t arguments_object;
};


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Improved handling of arguments object.

Dmitry Volyntsev 97 March 11, 2019 05:08AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 102
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready