[njs] Removed unused null proto hash.

Igor Sysoev igor at sysoev.ru
Tue Mar 13 16:51:55 UTC 2018


details:   http://hg.nginx.org/njs/rev/6738ff52a2cb
branches:  
changeset: 456:6738ff52a2cb
user:      Igor Sysoev <igor at sysoev.ru>
date:      Tue Mar 13 19:51:25 2018 +0300
description:
Removed unused null proto hash.

diffstat:

 njs/njs_builtin.c |  12 ------------
 njs/njs_object.c  |   1 -
 njs/njs_vm.c      |   5 -----
 njs/njs_vm.h      |   1 -
 4 files changed, 0 insertions(+), 19 deletions(-)

diffs (65 lines):

diff -r 9dcf4f92e32a -r 6738ff52a2cb njs/njs_builtin.c
--- a/njs/njs_builtin.c	Tue Mar 13 18:55:24 2018 +0300
+++ b/njs/njs_builtin.c	Tue Mar 13 19:51:25 2018 +0300
@@ -222,24 +222,12 @@ njs_builtin_objects_create(njs_vm_t *vm)
         { njs_memory_error_constructor,  { NJS_SKIP_ARG, NJS_STRING_ARG } },
     };
 
-    static const njs_object_prop_t    null_proto_property = {
-        .type = NJS_WHITEOUT,
-        .name = njs_string("__proto__"),
-        .value = njs_value(NJS_NULL, 0, 0.0),
-    };
-
     static const njs_object_prop_t    function_prototype_property = {
         .type = NJS_NATIVE_GETTER,
         .name = njs_string("prototype"),
         .value = njs_native_getter(njs_function_prototype_create),
     };
 
-    ret = njs_object_hash_create(vm, &vm->shared->null_proto_hash,
-                                 &null_proto_property, 1);
-    if (nxt_slow_path(ret != NXT_OK)) {
-        return NXT_ERROR;
-    }
-
     ret = njs_object_hash_create(vm, &vm->shared->function_prototype_hash,
                                  &function_prototype_property, 1);
     if (nxt_slow_path(ret != NXT_OK)) {
diff -r 9dcf4f92e32a -r 6738ff52a2cb njs/njs_object.c
--- a/njs/njs_object.c	Tue Mar 13 18:55:24 2018 +0300
+++ b/njs/njs_object.c	Tue Mar 13 19:51:25 2018 +0300
@@ -299,7 +299,6 @@ njs_object_create(njs_vm_t *vm, njs_valu
                 object->__proto__ = args[1].data.u.object;
 
             } else {
-                object->shared_hash = vm->shared->null_proto_hash;
                 object->__proto__ = NULL;
             }
 
diff -r 9dcf4f92e32a -r 6738ff52a2cb njs/njs_vm.c
--- a/njs/njs_vm.c	Tue Mar 13 18:55:24 2018 +0300
+++ b/njs/njs_vm.c	Tue Mar 13 19:51:25 2018 +0300
@@ -1198,11 +1198,6 @@ njs_object_property_query(njs_vm_t *vm, 
 
             case NJS_PROPERTY_QUERY_IN:
                 prop = pq->lhq.value;
-
-                if (prop->type == NJS_WHITEOUT) {
-                    return NXT_DECLINED;
-                }
-
                 break;
             }
 
diff -r 9dcf4f92e32a -r 6738ff52a2cb njs/njs_vm.h
--- a/njs/njs_vm.h	Tue Mar 13 18:55:24 2018 +0300
+++ b/njs/njs_vm.h	Tue Mar 13 19:51:25 2018 +0300
@@ -1022,7 +1022,6 @@ typedef struct {
 struct njs_vm_shared_s {
     nxt_lvlhsh_t             keywords_hash;
     nxt_lvlhsh_t             values_hash;
-    nxt_lvlhsh_t             null_proto_hash;
     nxt_lvlhsh_t             function_prototype_hash;
 
     njs_object_t             objects[NJS_OBJECT_MAX];


More information about the nginx-devel mailing list