diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/basic/testMissingProperties.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/basic/testMissingProperties.js')
-rw-r--r-- | js/src/jit-test/tests/basic/testMissingProperties.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/testMissingProperties.js b/js/src/jit-test/tests/basic/testMissingProperties.js new file mode 100644 index 000000000..71512c6f5 --- /dev/null +++ b/js/src/jit-test/tests/basic/testMissingProperties.js @@ -0,0 +1,49 @@ +function isnan(n) { return n !== n } + +function f(x) { + var sum = 0; + for (var i = 0; i < 100; ++i) + sum += x.x; + return sum; +} +var o = {}; +assertEq(isnan(f(o)), true); +o.x = 1; +assertEq(f(o), 100); +var o = {a:1, b:2}; +assertEq(isnan(f(o)), true); +o.x = 2; +assertEq(f(o), 200); + +function g(x) { + var sum = 0; + for (var i = 0; i < 100; ++i) + sum += x.x; + return sum; +} +var o = {c:1, x:1}; +assertEq(g(o), 100); +var o = {}; +assertEq(isnan(g(o)), true); + +function h(x) { + var sum = 0; + for (var i = 0; i < 100; ++i) + sum += x.x; + return sum; +} + +var proto1 = {}; +var proto2 = Object.create(proto1); +var o = Object.create(proto2); +assertEq(isnan(f(o)), true); +assertEq(isnan(g(o)), true); +assertEq(isnan(h(o)), true); +proto2.x = 2; +assertEq(f(o), 200); +assertEq(g(o), 200); +assertEq(h(o), 200); +var o = {} +assertEq(isnan(f(o)), true); +assertEq(isnan(g(o)), true); +assertEq(isnan(h(o)), true); |