summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/profiler
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/profiler')
-rw-r--r--js/src/jit-test/tests/profiler/AutoEntryMonitor-01.js50
-rw-r--r--js/src/jit-test/tests/profiler/AutoEntryMonitor-02.js12
-rw-r--r--js/src/jit-test/tests/profiler/bug1135703.js6
-rw-r--r--js/src/jit-test/tests/profiler/bug1140643.js14
-rw-r--r--js/src/jit-test/tests/profiler/bug1161351.js16
-rw-r--r--js/src/jit-test/tests/profiler/bug1164448.js25
-rw-r--r--js/src/jit-test/tests/profiler/bug1211962.js12
-rw-r--r--js/src/jit-test/tests/profiler/bug1231925.js7
-rw-r--r--js/src/jit-test/tests/profiler/bug1233921.js19
-rw-r--r--js/src/jit-test/tests/profiler/bug1242840.js16
-rw-r--r--js/src/jit-test/tests/profiler/bug1261324.js24
-rw-r--r--js/src/jit-test/tests/profiler/bug925309.js2
-rw-r--r--js/src/jit-test/tests/profiler/debugmode-osr-exception-return-addr.js16
-rw-r--r--js/src/jit-test/tests/profiler/debugmode-osr-resume-addr.js11
-rw-r--r--js/src/jit-test/tests/profiler/enterjit-osr-disabling-earlyret.js13
-rw-r--r--js/src/jit-test/tests/profiler/enterjit-osr-disabling.js9
-rw-r--r--js/src/jit-test/tests/profiler/enterjit-osr-enabling-earlyret.js12
-rw-r--r--js/src/jit-test/tests/profiler/enterjit-osr-enabling.js8
-rw-r--r--js/src/jit-test/tests/profiler/enterjit-osr.js8
-rw-r--r--js/src/jit-test/tests/profiler/getter-setter-ic.js32
-rw-r--r--js/src/jit-test/tests/profiler/test-baseline-eval-frame-profiling.js11
-rw-r--r--js/src/jit-test/tests/profiler/test-bug1026485.js14
22 files changed, 337 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/profiler/AutoEntryMonitor-01.js b/js/src/jit-test/tests/profiler/AutoEntryMonitor-01.js
new file mode 100644
index 000000000..d66548680
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/AutoEntryMonitor-01.js
@@ -0,0 +1,50 @@
+// AutoEntryMonitor should catch all entry points into JavaScript.
+
+load(libdir + 'array-compare.js');
+
+function cold_and_warm(f, params, expected) {
+ print(uneval(params));
+ print(uneval(entryPoints(params)));
+ assertEq(arraysEqual(entryPoints(params), expected), true);
+
+ // Warm up the function a bit, so the JITs will compile it, and try again.
+ if (f)
+ for (i = 0; i < 10; i++)
+ f();
+
+ assertEq(arraysEqual(entryPoints(params), expected), true);
+}
+
+function entry1() { }
+cold_and_warm(entry1, { function: entry1 }, [ "entry1" ]);
+
+var getx = { get x() { } };
+cold_and_warm(Object.getOwnPropertyDescriptor(getx, 'x').get,
+ { object: getx, property: 'x' }, [ "get x" ]);
+
+var sety = { set y(v) { } };
+cold_and_warm(Object.getOwnPropertyDescriptor(sety, 'y').set,
+ { object: sety, property: 'y', value: 'glerk' }, [ "set y" ]);
+
+cold_and_warm(Object.prototype.toString, { ToString: {} }, []);
+
+var toS = { toString: function myToString() { return "string"; } };
+cold_and_warm(toS.toString, { ToString: toS }, [ "myToString" ]);
+
+cold_and_warm(undefined, { ToNumber: {} }, []);
+
+var vOf = { valueOf: function myValueOf() { return 42; } };
+cold_and_warm(vOf.valueOf, { ToNumber: vOf }, [ "myValueOf" ]);
+
+var toSvOf = { toString: function relations() { return Object; },
+ valueOf: function wallpaper() { return 17; } };
+cold_and_warm(() => { toSvOf.toString(); toSvOf.valueOf(); },
+ { ToString: toSvOf }, [ "relations", "wallpaper" ]);
+
+var vOftoS = { toString: function ettes() { return "6-inch lengths"; },
+ valueOf: function deathBy() { return Math; } };
+cold_and_warm(() => { vOftoS.valueOf(); vOftoS.toString(); },
+ { ToNumber: vOftoS }, [ "deathBy", "ettes" ]);
+
+
+cold_and_warm(() => 0, { eval: "Math.atan2(1,1);" }, [ "eval:entryPoint eval" ]);
diff --git a/js/src/jit-test/tests/profiler/AutoEntryMonitor-02.js b/js/src/jit-test/tests/profiler/AutoEntryMonitor-02.js
new file mode 100644
index 000000000..1aee82068
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/AutoEntryMonitor-02.js
@@ -0,0 +1,12 @@
+// Nested uses of AutoEntryMonitor should behave with decorum.
+
+load(libdir + 'array-compare.js');
+
+function Cobb() {
+ var twoShot = { toString: function Saito() { return Object; },
+ valueOf: function Fischer() { return "Ariadne"; } };
+ assertEq(arraysEqual(entryPoints({ ToString: twoShot }),
+ [ "Saito", "Fischer" ]), true);
+}
+
+assertEq(arraysEqual(entryPoints({ function: Cobb }), ["Cobb"]), true);
diff --git a/js/src/jit-test/tests/profiler/bug1135703.js b/js/src/jit-test/tests/profiler/bug1135703.js
new file mode 100644
index 000000000..465b4026a
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/bug1135703.js
@@ -0,0 +1,6 @@
+
+for (var idx = 0; idx < 20; ++idx) {
+ newFunc("enableSPSProfilingWithSlowAssertions(); disableSPSProfiling();");
+}
+newFunc("enableSPSProfiling();");
+function newFunc(x) { new Function(x)(); };
diff --git a/js/src/jit-test/tests/profiler/bug1140643.js b/js/src/jit-test/tests/profiler/bug1140643.js
new file mode 100644
index 000000000..1b171aea2
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/bug1140643.js
@@ -0,0 +1,14 @@
+// |jit-test| allow-oom
+enableSPSProfiling();
+loadFile('\
+for (var i = 0; i < 2; i++) {\
+ obj = { m: function () {} };\
+ obj.watch("m", function () { float32 = 0 + obj.foo; });\
+ obj.m = 0;\
+}\
+');
+gcparam("maxBytes", gcparam("gcBytes") + (1)*1024);
+newGlobal("same-compartment");
+function loadFile(lfVarx) {
+ evaluate(lfVarx, { noScriptRval : true, isRunOnce : true });
+}
diff --git a/js/src/jit-test/tests/profiler/bug1161351.js b/js/src/jit-test/tests/profiler/bug1161351.js
new file mode 100644
index 000000000..64ec67a45
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/bug1161351.js
@@ -0,0 +1,16 @@
+function x() { n; }
+function f() {
+ try { x(); } catch(ex) {}
+}
+var g = newGlobal();
+g.parent = this;
+g.eval("new Debugger(parent).onExceptionUnwind = function () {};");
+enableSPSProfiling();
+try {
+ enableSingleStepProfiling();
+} catch (e) {
+ // Not all platforms support single-step profiling.
+}
+f();
+f();
+f();
diff --git a/js/src/jit-test/tests/profiler/bug1164448.js b/js/src/jit-test/tests/profiler/bug1164448.js
new file mode 100644
index 000000000..3c66985fa
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/bug1164448.js
@@ -0,0 +1,25 @@
+// |jit-test| error: TypeError
+
+print = function(s) { return s.toString(); }
+var gTestcases = new Array();
+function TestCase(n, d, e, a)
+ gTestcases[gTc++] = this;
+ dump = print;
+ for ( gTc=0; gTc < gTestcases.length; gTc++ ) {}
+function jsTestDriverEnd() {
+ for (var i = 0; i < gTestcases.length; i++)
+ gTestcases[i].dump();
+}
+TestCase();
+var g = newGlobal();
+g.parent = this;
+g.eval("new Debugger(parent).onExceptionUnwind = function () {};");
+enableSPSProfiling();
+if (getBuildConfiguration()["arm-simulator"])
+ enableSingleStepProfiling(1);
+loadFile("jsTestDriverEnd();");
+loadFile("jsTestDriverEnd();");
+jsTestDriverEnd();
+function loadFile(lfVarx) {
+ try { evaluate(lfVarx); } catch (lfVare) {}
+}
diff --git a/js/src/jit-test/tests/profiler/bug1211962.js b/js/src/jit-test/tests/profiler/bug1211962.js
new file mode 100644
index 000000000..01e819d50
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/bug1211962.js
@@ -0,0 +1,12 @@
+// |jit-test| slow;
+if (!('oomTest' in this))
+ quit();
+
+enableSPSProfiling();
+var lfGlobal = newGlobal();
+for (lfLocal in this) {
+ lfGlobal[lfLocal] = this[lfLocal];
+}
+const script = 'oomTest(() => getBacktrace({args: true, locals: "123795", thisprops: true}));';
+lfGlobal.offThreadCompileScript(script);
+lfGlobal.runOffThreadScript();
diff --git a/js/src/jit-test/tests/profiler/bug1231925.js b/js/src/jit-test/tests/profiler/bug1231925.js
new file mode 100644
index 000000000..344202ea1
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/bug1231925.js
@@ -0,0 +1,7 @@
+if (!('oomTest' in this))
+ quit();
+
+enableSPSProfiling();
+oomTest(function() {
+ eval("(function() {})()")
+});
diff --git a/js/src/jit-test/tests/profiler/bug1233921.js b/js/src/jit-test/tests/profiler/bug1233921.js
new file mode 100644
index 000000000..def8b7c7e
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/bug1233921.js
@@ -0,0 +1,19 @@
+g = newGlobal();
+g.parent = this;
+g.eval("new Debugger(parent).onExceptionUnwind = function () {}");
+enableSPSProfiling();
+try {
+ enableSingleStepProfiling();
+} catch(e) {
+ quit();
+}
+f();
+f();
+function $ERROR() {
+ throw Error;
+}
+function f() {
+ try {
+ $ERROR()
+ } catch (ex) {}
+}
diff --git a/js/src/jit-test/tests/profiler/bug1242840.js b/js/src/jit-test/tests/profiler/bug1242840.js
new file mode 100644
index 000000000..31fe1c27f
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/bug1242840.js
@@ -0,0 +1,16 @@
+if (!('oomTest' in this))
+ quit();
+
+enableSPSProfiling();
+oomTest(() => {
+ try {
+ for (quit of ArrayBuffer);
+ } catch (e) {
+ switch (1) {
+ case 0:
+ let x
+ case 1:
+ (function() x)()
+ }
+ }
+})
diff --git a/js/src/jit-test/tests/profiler/bug1261324.js b/js/src/jit-test/tests/profiler/bug1261324.js
new file mode 100644
index 000000000..366e79e44
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/bug1261324.js
@@ -0,0 +1,24 @@
+g = newGlobal()
+g.parent = this
+g.eval("new Debugger(parent).onExceptionUnwind = function () {}")
+enableSPSProfiling()
+
+try {
+ // Only the ARM simulator supports single step profiling.
+ enableSingleStepProfiling();
+} catch (e) {
+ quit();
+}
+
+function assertThrowsInstanceOf(f) {
+ try {
+ f()
+ } catch (exc) {}
+}
+function testThrow(thunk) {
+ for (i = 0; i < 20; i++) {
+ iter = thunk()
+ assertThrowsInstanceOf(function() iter.throw())
+ }
+}
+testThrow(function*() {})
diff --git a/js/src/jit-test/tests/profiler/bug925309.js b/js/src/jit-test/tests/profiler/bug925309.js
new file mode 100644
index 000000000..9da073249
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/bug925309.js
@@ -0,0 +1,2 @@
+
+for(var i = 0; i < 100; enableSPSProfiling(), i++) {}
diff --git a/js/src/jit-test/tests/profiler/debugmode-osr-exception-return-addr.js b/js/src/jit-test/tests/profiler/debugmode-osr-exception-return-addr.js
new file mode 100644
index 000000000..0a8c2471f
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/debugmode-osr-exception-return-addr.js
@@ -0,0 +1,16 @@
+// |jit-test| error: ReferenceError
+
+var g = newGlobal();
+g.parent = this;
+g.eval("new Debugger(parent).onExceptionUnwind = function () { };");
+enableSPSProfiling();
+
+try {
+ // Only the ARM simulator supports single step profiling.
+ enableSingleStepProfiling();
+} catch (e) {
+ throw new ReferenceError;
+}
+
+enableSingleStepProfiling();
+a()
diff --git a/js/src/jit-test/tests/profiler/debugmode-osr-resume-addr.js b/js/src/jit-test/tests/profiler/debugmode-osr-resume-addr.js
new file mode 100644
index 000000000..9dd68d628
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/debugmode-osr-resume-addr.js
@@ -0,0 +1,11 @@
+enableSPSProfiling();
+try {
+ // Only the ARM simulator supports single step profiling.
+ enableSingleStepProfiling();
+} catch (e) {
+ quit(0);
+}
+var g = newGlobal();
+var dbg = Debugger(g);
+dbg.onDebuggerStatement = function (frame) {};
+g.eval("var line = new Error().lineNumber; debugger;");
diff --git a/js/src/jit-test/tests/profiler/enterjit-osr-disabling-earlyret.js b/js/src/jit-test/tests/profiler/enterjit-osr-disabling-earlyret.js
new file mode 100644
index 000000000..0b6e71359
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/enterjit-osr-disabling-earlyret.js
@@ -0,0 +1,13 @@
+setJitCompilerOption("baseline.warmup.trigger", 10);
+setJitCompilerOption("ion.warmup.trigger", 20);
+
+enableSPSProfilingWithSlowAssertions();
+(function() {
+ var n = 50;
+ while (n--) {
+ disableSPSProfiling();
+ if (!n)
+ return;
+ enableSPSProfilingWithSlowAssertions();
+ }
+})();
diff --git a/js/src/jit-test/tests/profiler/enterjit-osr-disabling.js b/js/src/jit-test/tests/profiler/enterjit-osr-disabling.js
new file mode 100644
index 000000000..72cc8db09
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/enterjit-osr-disabling.js
@@ -0,0 +1,9 @@
+setJitCompilerOption("baseline.warmup.trigger", 10);
+setJitCompilerOption("ion.warmup.trigger", 20);
+
+enableSPSProfilingWithSlowAssertions();
+(function() {
+ disableSPSProfiling();
+ var n = 50;
+ while (n--);
+})();
diff --git a/js/src/jit-test/tests/profiler/enterjit-osr-enabling-earlyret.js b/js/src/jit-test/tests/profiler/enterjit-osr-enabling-earlyret.js
new file mode 100644
index 000000000..35ad60908
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/enterjit-osr-enabling-earlyret.js
@@ -0,0 +1,12 @@
+setJitCompilerOption("baseline.warmup.trigger", 10);
+setJitCompilerOption("ion.warmup.trigger", 20);
+
+(function() {
+ var n = 50;
+ while (n--) {
+ enableSPSProfilingWithSlowAssertions();
+ if (!n)
+ return;
+ disableSPSProfiling();
+ }
+})();
diff --git a/js/src/jit-test/tests/profiler/enterjit-osr-enabling.js b/js/src/jit-test/tests/profiler/enterjit-osr-enabling.js
new file mode 100644
index 000000000..7f4dfbce0
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/enterjit-osr-enabling.js
@@ -0,0 +1,8 @@
+setJitCompilerOption("baseline.warmup.trigger", 10);
+setJitCompilerOption("ion.warmup.trigger", 20);
+
+(function() {
+ enableSPSProfilingWithSlowAssertions();
+ var n = 50;
+ while (n--);
+})();
diff --git a/js/src/jit-test/tests/profiler/enterjit-osr.js b/js/src/jit-test/tests/profiler/enterjit-osr.js
new file mode 100644
index 000000000..7ef985566
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/enterjit-osr.js
@@ -0,0 +1,8 @@
+setJitCompilerOption("baseline.warmup.trigger", 10);
+setJitCompilerOption("ion.warmup.trigger", 20);
+
+enableSPSProfilingWithSlowAssertions();
+(function() {
+ var n = 50;
+ while (n--);
+})();
diff --git a/js/src/jit-test/tests/profiler/getter-setter-ic.js b/js/src/jit-test/tests/profiler/getter-setter-ic.js
new file mode 100644
index 000000000..15b0ee41e
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/getter-setter-ic.js
@@ -0,0 +1,32 @@
+// Ensure readSPSProfilingStack() doesn't crash with Ion
+// getter/setter ICs on the stack.
+function getObjects() {
+ var objs = [];
+ objs.push({x: 0, get prop() {
+ readSPSProfilingStack();
+ return ++this.x;
+ }, set prop(v) {
+ readSPSProfilingStack();
+ this.x = v + 2;
+ }});
+ objs.push({x: 0, y: 0, get prop() {
+ readSPSProfilingStack();
+ return this.y;
+ }, set prop(v) {
+ readSPSProfilingStack();
+ this.y = v;
+ }});
+ return objs;
+}
+function f() {
+ var objs = getObjects();
+ var res = 0;
+ for (var i=0; i<100; i++) {
+ var o = objs[i % objs.length];
+ res += o.prop;
+ o.prop = i;
+ }
+ assertEq(res, 4901);
+}
+enableSPSProfiling();
+f();
diff --git a/js/src/jit-test/tests/profiler/test-baseline-eval-frame-profiling.js b/js/src/jit-test/tests/profiler/test-baseline-eval-frame-profiling.js
new file mode 100644
index 000000000..6fd2a5a16
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/test-baseline-eval-frame-profiling.js
@@ -0,0 +1,11 @@
+
+setJitCompilerOption("baseline.warmup.trigger", 10);
+
+function main() {
+ for (var i = 0; i < 50; i++)
+ eval("for (var j = 0; j < 50; j++) readSPSProfilingStack();");
+}
+
+gczeal(2, 10000);
+enableSPSProfilingWithSlowAssertions();
+main();
diff --git a/js/src/jit-test/tests/profiler/test-bug1026485.js b/js/src/jit-test/tests/profiler/test-bug1026485.js
new file mode 100644
index 000000000..22865f526
--- /dev/null
+++ b/js/src/jit-test/tests/profiler/test-bug1026485.js
@@ -0,0 +1,14 @@
+
+function TestCase(n, d, e, a)
+ TestCase.prototype.dump = function () {}
+enableSPSProfiling();
+new TestCase(typeof Number(new Number()));
+new TestCase(typeof Number(new Number(Number.NaN)));
+test();
+function test() {
+ try {
+ test();
+ } catch (e) {
+ new TestCase();
+ }
+}