summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/jaeger/propertyOptimize-3.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/jaeger/propertyOptimize-3.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-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/jaeger/propertyOptimize-3.js')
-rw-r--r--js/src/jit-test/tests/jaeger/propertyOptimize-3.js67
1 files changed, 67 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/jaeger/propertyOptimize-3.js b/js/src/jit-test/tests/jaeger/propertyOptimize-3.js
new file mode 100644
index 000000000..90327e47a
--- /dev/null
+++ b/js/src/jit-test/tests/jaeger/propertyOptimize-3.js
@@ -0,0 +1,67 @@
+
+// Properties cleared in the middle of a single function constructor.
+
+function foo(x, y) {
+ this.f = 0;
+ this.g = x + y;
+ this.h = 2;
+}
+
+var called = false;
+var a = 0;
+var b = {valueOf: function() { Object.defineProperty(Object.prototype, 'g', {set: function() { called = true }}) }};
+var c = new foo(a, b);
+
+assertEq(called, true);
+assertEq(c.g, undefined);
+
+// Properties cleared in the middle of a constructor callee.
+
+function foo2(x, y) {
+ this.a = 0;
+ this.b = 1;
+ bar2.call(this, x, y);
+ this.c = 2;
+}
+function bar2(x, y) {
+ this.d = x + y;
+ this.e = 3;
+}
+
+var called2 = false;
+var xa = 0;
+var xb = {valueOf: function() { Object.defineProperty(Object.prototype, 'e', {set: function() { called2 = true }}) }};
+var xc = new foo2(xa, xb);
+
+assertEq(called2, true);
+assertEq(xc.e, undefined);
+assertEq(xc.c, 2);
+
+// Properties cleared after a constructor callee.
+
+function foo3() {
+ this.aa = 0;
+ this.bb = 1;
+ bar3.call(this);
+ this.cc = 2;
+ baz();
+ xbar3.call(this);
+ this.dd = 3;
+}
+function bar3() {
+ this.ee = 4;
+}
+function xbar3() {
+ this.ff = 5;
+}
+function baz() {
+ eval("xbar3.call = function() { called3 = true }");
+}
+
+var called3 = false;
+var c3 = new foo3();
+assertEq(c3.cc, 2);
+assertEq(c3.ee, 4);
+assertEq(c3.ff, undefined);
+assertEq(c3.dd, 3);
+assertEq(called3, true);