diff options
Diffstat (limited to 'js/src/jit-test/tests/ion/smallObjectVariableKeyHasProp-2.js')
-rw-r--r-- | js/src/jit-test/tests/ion/smallObjectVariableKeyHasProp-2.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/ion/smallObjectVariableKeyHasProp-2.js b/js/src/jit-test/tests/ion/smallObjectVariableKeyHasProp-2.js new file mode 100644 index 0000000000..d170afd5d9 --- /dev/null +++ b/js/src/jit-test/tests/ion/smallObjectVariableKeyHasProp-2.js @@ -0,0 +1,34 @@ +let obj = { + a: 1, + b: 1, + c: 1, +}; + +function test(id) { + return Object.hasOwn(obj, id); +} + +let testKeys = [ + ["a", true], + ["b", true], + ["c", true], + ["d", false], + ["e", false], + ["f", false], + ["g", false], + ["h", false], +]; + +with({}); +for (var i = 0; i < 1000; i++) { + let [key, has] = testKeys[i % testKeys.length]; + test(key); +} + +obj["0"] = 1; +testKeys.push(["0", true]); + +for (var i = 0; i < 1000; i++) { + let [key, has] = testKeys[i % testKeys.length]; + assertEq(test(key), has); +} |