mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
assert,util: fix constructor lookup in deep equal comparison
The latest performance optimization did not take into account that an object may have a property called constructor. This is addressed in this PR by adding a new fast path and using fallbacks. PR-URL: https://github.com/nodejs/node/pull/57876 Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
parent
2b76dca0fa
commit
733e0fc2c4
4 changed files with 211 additions and 50 deletions
|
@ -10,6 +10,7 @@ const notCircular = {};
|
|||
notCircular.circular = {};
|
||||
|
||||
const primValues = {
|
||||
'null_prototype': { __proto__: null },
|
||||
'string': 'abcdef',
|
||||
'number': 1_000,
|
||||
'boolean': true,
|
||||
|
@ -24,6 +25,7 @@ const primValues = {
|
|||
};
|
||||
|
||||
const primValues2 = {
|
||||
'null_prototype': { __proto__: null },
|
||||
'object': { property: 'abcdef' },
|
||||
'array': [1, 2, 3],
|
||||
'set_object': new Set([[1]]),
|
||||
|
@ -35,6 +37,7 @@ const primValues2 = {
|
|||
};
|
||||
|
||||
const primValuesUnequal = {
|
||||
'null_prototype': { __proto__: { __proto__: null } },
|
||||
'string': 'abcdez',
|
||||
'number': 1_001,
|
||||
'boolean': false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue