]> git.kaiwu.me - njs.git/commit
Postponing copying of not-configurable PROPERTY_HANDLER properties.
authorDmitry Volyntsev <xeioex@nginx.com>
Thu, 29 Aug 2019 16:18:53 +0000 (19:18 +0300)
committerDmitry Volyntsev <xeioex@nginx.com>
Thu, 29 Aug 2019 16:18:53 +0000 (19:18 +0300)
commitc84410799801f74ccc28d42f9fadd521093485a8
treeb01f66f509f9421653dd74e1c972d288a347e4e8
parent97b4d4389d9a560bd2b9df6f0eb3a0ca00e6a58d
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.
src/njs_object.h
src/njs_object_prop.c
src/njs_value.c
src/njs_value.h
src/test/njs_unit_test.c