summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/jaeger/testForOps.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/testForOps.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/testForOps.js')
-rw-r--r--js/src/jit-test/tests/jaeger/testForOps.js67
1 files changed, 67 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/jaeger/testForOps.js b/js/src/jit-test/tests/jaeger/testForOps.js
new file mode 100644
index 000000000..773aae249
--- /dev/null
+++ b/js/src/jit-test/tests/jaeger/testForOps.js
@@ -0,0 +1,67 @@
+// |jit-test|
+// vim: set ts=8 sts=4 et sw=4 tw=99:
+
+function assertObjectsEqual(obj1, obj2) {
+ assertEq(obj1.a, obj2.a);
+ assertEq(obj1.b, obj2.b);
+ assertEq(obj1.c, obj2.c);
+ assertEq(obj1.d, obj2.d);
+ assertEq(obj2.a, 1);
+ assertEq(obj2.b, "bee");
+ assertEq(obj2.c, "crab");
+ assertEq(obj2.d, 12);
+}
+
+function forName(obj) {
+ eval('');
+ var r = { };
+ for (x in obj)
+ r[x] = obj[x];
+ return r;
+}
+
+function forGlobalName(obj) {
+ var r = { };
+ for (x in obj)
+ r[x] = obj[x];
+ return r;
+}
+
+function forProp(obj) {
+ var r = { };
+ var c = { };
+ for (c.x in obj)
+ r[c.x] = obj[c.x];
+ return r;
+}
+
+function forElem(obj, x) {
+ var r = { };
+ var c = { };
+ for (c[x] in obj)
+ r[c[x]] = obj[c[x]];
+ return r;
+}
+
+function forLocal(obj) {
+ var r = { };
+ for (var x in obj)
+ r[x] = obj[x];
+ return r;
+}
+
+function forArg(obj, x) {
+ var r = { };
+ for (x in obj)
+ r[x] = obj[x];
+ return r;
+}
+
+var obj = { a: 1, b: "bee", c: "crab", d: 12 };
+assertObjectsEqual(obj, forName(obj));
+assertObjectsEqual(obj, forGlobalName(obj));
+assertObjectsEqual(obj, forProp(obj));
+assertObjectsEqual(obj, forElem(obj, "v"));
+assertObjectsEqual(obj, forLocal(obj));
+assertObjectsEqual(obj, forArg(obj));
+