Bug 1344469 - Test. r=jandem
authorTom Schuster <evilpies@gmail.com>
Thu, 13 Apr 2017 22:17:57 +0200
changeset 353001 56e3c896e6cc81a36f613c3e64e066695d92718f
parent 353000 a9d036ef05e83abbf6aa6370a4ef36bbc4d01706
child 353002 1501025c8e6b262d469d7d13ba42b048be41e4f1
push id31655
push userihsiao@mozilla.com
push dateFri, 14 Apr 2017 09:07:09 +0000
treeherdermozilla-central@8f806306fb83 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1344469
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1344469 - Test. r=jandem
js/src/jit-test/tests/cacheir/hasown.js
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/cacheir/hasown.js
@@ -0,0 +1,46 @@
+var max = 40;
+setJitCompilerOption("ion.warmup.trigger", max - 10);
+
+function simple() {
+    var array = [{a: 1}, {b: 1, a: 1}, {c: 1, a: 1}];
+    for (var i = 0; i < array.length; i++) {
+        var x = array[i];
+        assertEq(x.hasOwnProperty("a"), true);
+        assertEq(x.hasOwnProperty("d"), false);
+    }
+}
+
+function megamorphic() {
+    var array = [{a: 1}, {b: 1, a: 1}, {c: 1, a: 1},
+                 {a: 1, b: 1}, {c: 1, e: 1, a: 1},
+                 {e: 1, f: 1, a: 1, g: 1},
+                 {e: 1, f: 1, a: 1, g: 1, h: 1}];
+    for (var i = 0; i < array.length; i++) {
+        var x = array[i];
+        assertEq(x.hasOwnProperty("a"), true);
+        assertEq(x.hasOwnProperty("d"), false);
+    }
+}
+
+function key() {
+    var sym = Symbol(), sym2 = Symbol();
+    var keys = [[sym, true], [sym2, false],
+                ["a", true], ["b", false],
+                [{}, false]];
+    var obj = {[sym]: 1, a: 1};
+    for (var i = 0; i < keys.length; i++) {
+        var [key, result] = keys[i];
+        assertEq(obj.hasOwnProperty(key), result);
+    }
+}
+
+function test() {
+    for (var i = 0; i < max; i++) {
+        simple();
+        megamorphic();
+        key();
+    }
+}
+
+test();
+test();