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/tracelogger | |
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/tracelogger')
-rw-r--r-- | js/src/jit-test/tests/tracelogger/bug1138265.js | 18 | ||||
-rw-r--r-- | js/src/jit-test/tests/tracelogger/bug1174542.js | 6 | ||||
-rw-r--r-- | js/src/jit-test/tests/tracelogger/bug1231170.js | 3 | ||||
-rw-r--r-- | js/src/jit-test/tests/tracelogger/bug1257194.js | 11 | ||||
-rw-r--r-- | js/src/jit-test/tests/tracelogger/bug1266649.js | 10 | ||||
-rw-r--r-- | js/src/jit-test/tests/tracelogger/bug1282743.js | 14 | ||||
-rw-r--r-- | js/src/jit-test/tests/tracelogger/bug1298541.js | 41 | ||||
-rw-r--r-- | js/src/jit-test/tests/tracelogger/bug1300515.js | 15 | ||||
-rw-r--r-- | js/src/jit-test/tests/tracelogger/bug1302417.js | 20 | ||||
-rw-r--r-- | js/src/jit-test/tests/tracelogger/bug1304641.js | 13 | ||||
-rw-r--r-- | js/src/jit-test/tests/tracelogger/drainTraceLogger.js | 88 | ||||
-rw-r--r-- | js/src/jit-test/tests/tracelogger/setupTraceLogger.js | 70 |
12 files changed, 309 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/tracelogger/bug1138265.js b/js/src/jit-test/tests/tracelogger/bug1138265.js new file mode 100644 index 000000000..620148c67 --- /dev/null +++ b/js/src/jit-test/tests/tracelogger/bug1138265.js @@ -0,0 +1,18 @@ +try { + (function(b, foreign, p) { + "use asm" + var ff = foreign.ff + function f() { + ff() | 0 + } + return f + })(this, { + ff: startTraceLogger + }, ArrayBuffer)() +} catch(e) { + // Will throw exception if odinmonkey is on top of the stack upon calling startTraceLogger. + // If there is another frame added in between (ion/baseline/interpreter). + // This will just run to completion. +} + +assertEq(true, true); diff --git a/js/src/jit-test/tests/tracelogger/bug1174542.js b/js/src/jit-test/tests/tracelogger/bug1174542.js new file mode 100644 index 000000000..283b6bebe --- /dev/null +++ b/js/src/jit-test/tests/tracelogger/bug1174542.js @@ -0,0 +1,6 @@ +var du = new Debugger(); +if (typeof du.setupTraceLogger === "function") + du.setupTraceLogger({Scripts: true}); +(function() { + for (var i = 0; i < 15; ++i) {} +})(); diff --git a/js/src/jit-test/tests/tracelogger/bug1231170.js b/js/src/jit-test/tests/tracelogger/bug1231170.js new file mode 100644 index 000000000..023e93eb6 --- /dev/null +++ b/js/src/jit-test/tests/tracelogger/bug1231170.js @@ -0,0 +1,3 @@ +var du = new Debugger(); +if (typeof du.drainTraceLogger === "function") + du.drainTraceLogger(); diff --git a/js/src/jit-test/tests/tracelogger/bug1257194.js b/js/src/jit-test/tests/tracelogger/bug1257194.js new file mode 100644 index 000000000..8b17bef87 --- /dev/null +++ b/js/src/jit-test/tests/tracelogger/bug1257194.js @@ -0,0 +1,11 @@ +// |jit-test| allow-oom + +if (!('oomAfterAllocations' in this)) + quit(); + +var du = new Debugger(); +if (typeof du.drainTraceLogger == "function") { + var obj = du.drainTraceLogger(); + oomAfterAllocations(1); + du.drainTraceLogger().length; +} diff --git a/js/src/jit-test/tests/tracelogger/bug1266649.js b/js/src/jit-test/tests/tracelogger/bug1266649.js new file mode 100644 index 000000000..81ae7ad71 --- /dev/null +++ b/js/src/jit-test/tests/tracelogger/bug1266649.js @@ -0,0 +1,10 @@ + +var du = new Debugger(); +if (typeof du.setupTraceLogger === "function" && + typeof oomTest === 'function') +{ + du.setupTraceLogger({ + Scripts: true + }) + oomTest(() => function(){}); +} diff --git a/js/src/jit-test/tests/tracelogger/bug1282743.js b/js/src/jit-test/tests/tracelogger/bug1282743.js new file mode 100644 index 000000000..7c94863bd --- /dev/null +++ b/js/src/jit-test/tests/tracelogger/bug1282743.js @@ -0,0 +1,14 @@ + +du = new Debugger(); +if (typeof du.setupTraceLogger === "function" && + typeof oomTest === 'function') +{ + du.setupTraceLogger({Scripts: true}); + for (var idx = 0; idx < 1; idx++) { + oomTest(function() { + m = parseModule("x"); + m.declarationInstantiation(); + m.evaluation(); + }) + } +} diff --git a/js/src/jit-test/tests/tracelogger/bug1298541.js b/js/src/jit-test/tests/tracelogger/bug1298541.js new file mode 100644 index 000000000..1a484d872 --- /dev/null +++ b/js/src/jit-test/tests/tracelogger/bug1298541.js @@ -0,0 +1,41 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Flags: -e "version(170)" + +//----------------------------------------------------------------------------- + +version(170) + +//----------------------------------------------------------------------------- + +var du = new Debugger(); +if (typeof du.drainTraceLoggerScriptCalls == "function") { + du.setupTraceLoggerScriptCalls(); + + du.startTraceLogger(); + test(); + du.endTraceLogger(); + + var objs = du.drainTraceLoggerScriptCalls(); + var scripts = 0; + var stops = 0; + for (var i = 0; i < objs.length; i++) { + if (objs[i].logType == "Script") { + scripts++; + } else if (objs[i].logType == "Stop") { + stops++; + } else { + throw "We shouldn't receive non-script events."; + } + } + assertEq(scripts, stops + 1); + // "+ 1" because we get a start for bug1298541.js:1, but not the stop. +} + +function test() +{ + for (var i in (function(){ for (var j=0;j<4;++j) { yield ""; } })()); +} diff --git a/js/src/jit-test/tests/tracelogger/bug1300515.js b/js/src/jit-test/tests/tracelogger/bug1300515.js new file mode 100644 index 000000000..3f037c932 --- /dev/null +++ b/js/src/jit-test/tests/tracelogger/bug1300515.js @@ -0,0 +1,15 @@ + + +function test1() { + test(); +} + +function test() { + var du = new Debugger(); + du.setupTraceLoggerScriptCalls(); + du.startTraceLogger(); +} + +var du = new Debugger(); +if (typeof du.setupTraceLoggerScriptCalls == "function") + test1(); diff --git a/js/src/jit-test/tests/tracelogger/bug1302417.js b/js/src/jit-test/tests/tracelogger/bug1302417.js new file mode 100644 index 000000000..188192076 --- /dev/null +++ b/js/src/jit-test/tests/tracelogger/bug1302417.js @@ -0,0 +1,20 @@ + +if (!('oomTest' in this)) + quit(); + +if (typeof new Debugger().setupTraceLoggerScriptCalls == "function") { + lfLogBuffer = ` + var du = new Debugger; + du.setupTraceLoggerScriptCalls(); + startTraceLogger(); + `; + loadFile(lfLogBuffer); + function loadFile(lfVarx) { + oomTest(function() { + m = parseModule(lfVarx); + m.declarationInstantiation(); + m.evaluation(); + }) + } +} + diff --git a/js/src/jit-test/tests/tracelogger/bug1304641.js b/js/src/jit-test/tests/tracelogger/bug1304641.js new file mode 100644 index 000000000..7ad48b7a4 --- /dev/null +++ b/js/src/jit-test/tests/tracelogger/bug1304641.js @@ -0,0 +1,13 @@ + +var du = new Debugger(); +if (typeof du.startTraceLogger === "function") { + var failed = false; + try { + newGlobal().startTraceLogger(); + print("z"); + } catch (e) { + failed = true; + } + + assertEq(failed, true); +} diff --git a/js/src/jit-test/tests/tracelogger/drainTraceLogger.js b/js/src/jit-test/tests/tracelogger/drainTraceLogger.js new file mode 100644 index 000000000..e394074bd --- /dev/null +++ b/js/src/jit-test/tests/tracelogger/drainTraceLogger.js @@ -0,0 +1,88 @@ +function TestDrainTraceLoggerInvariants(obj) { + var scripts = 0; + var stops = 0; + for (var i = 0; i < objs.length; i++) { + if (objs[i].logType == "Script") { + scripts++; + assertEq("fileName" in objs[i], true); + assertEq("lineNumber" in objs[i], true); + assertEq("columnNumber" in objs[i], true); + } else if (objs[i].logType == "Stop") { + stops++; + } else { + assertEq(true, false); + } + } + assertEq(scripts, stops + 1); + // "+ 1" because we get a start for drainTraceLogger.js:1, but not the stop. +} + +function GetMaxScriptDepth(obj) { + var max_depth = 0; + var depth = 0; + for (var i = 0; i < objs.length; i++) { + if (objs[i].logType == "Stop") + depth--; + else { + depth++; + if (depth > max_depth) + max_depth = depth; + } + } + return max_depth; +} + +function foo1() { + foo2(); +} +function foo2() { + +} + +var du = new Debugger(); +if (typeof du.drainTraceLoggerScriptCalls == "function") { + // Test normal setup. + du = new Debugger(); + du.setupTraceLoggerScriptCalls(); + + du.startTraceLogger(); + du.endTraceLogger(); + + var objs = du.drainTraceLoggerScriptCalls(); + TestDrainTraceLoggerInvariants(objs); + + // Test basic script. + for (var i=0; i<20; i++) + foo1(); + + du = new Debugger(); + du.setupTraceLoggerScriptCalls(); + + du.startTraceLogger(); + foo1(); + du.endTraceLogger(); + + var objs = du.drainTraceLoggerScriptCalls(); + TestDrainTraceLoggerInvariants(objs); + assertEq(3, GetMaxScriptDepth(objs), "drainTraceLogger.js:0 + foo1 + foo2"); + assertEq(5, objs.length, "drainTraceLogger.js:0 + foo1 + foo2 + stop + stop"); + + // Test basic script. + for (var i=0; i<20; i++) + foo1(); + + du = new Debugger(); + du.setupTraceLoggerScriptCalls(); + + du.startTraceLogger(); + for (var i=0; i<100; i++) { + foo1(); + } + du.endTraceLogger(); + + var objs = du.drainTraceLoggerScriptCalls(); + TestDrainTraceLoggerInvariants(objs); + assertEq(3, GetMaxScriptDepth(objs), "drainTraceLogger.js:0 + foo1 + foo2"); + assertEq(4*100 + 1, objs.length); + assertEq(1 + 4*100, objs.length, "drainTraceLogger.js:0 + 4 * ( foo1 + foo2 + stop + stop )"); +} diff --git a/js/src/jit-test/tests/tracelogger/setupTraceLogger.js b/js/src/jit-test/tests/tracelogger/setupTraceLogger.js new file mode 100644 index 000000000..1c409739d --- /dev/null +++ b/js/src/jit-test/tests/tracelogger/setupTraceLogger.js @@ -0,0 +1,70 @@ + +var du = new Debugger(); +if (typeof du.setupTraceLogger == "function") { + + // Try enabling. + assertEq(du.setupTraceLogger({ + Scripts: true + }), true); + + // No fail on re-enabling. + assertEq(du.setupTraceLogger({ + Scripts: true + }), true); + + // Try disabling. + assertEq(du.setupTraceLogger({ + Scripts: false + }), true); + + // No fail on re-disabling. + assertEq(du.setupTraceLogger({ + Scripts: false + }), true); + + // Throw exception if TraceLog item to report isn't found. + var success = du.setupTraceLogger({ + Scripts: false, + Test: true + }); + assertEq(success, false); + + // SetupTraceLogger only enables individual items, + // when all items can be toggled. + du.startTraceLogger(); + var obj = du.drainTraceLogger(); + du.setupTraceLogger({ + Scripts: true, + Test: true, + }); + assertEq(du.drainTraceLogger().length, 0); + du.endTraceLogger(); + + // Expects an object as first argument. + succes = du.setupTraceLogger("blaat"); + assertEq(succes, false); + + // Expects an object as first argument. + succes = du.setupTraceLogger("blaat"); + assertEq(succes, false); + + // Expects an object as first argument. + failed = false; + try { + du.setupTraceLogger(); + } catch (e) { + failed = true; + } + assertEq(failed, true); + + // No problem with added to many arguments. + succes = du.setupTraceLogger({}, "test"); + assertEq(succes, true); +} + +var du2 = new Debugger(); +if (typeof du2.setupTraceLoggerForTraces == "function") { + du2.setupTraceLoggerForTraces({}); + du2.setupTraceLoggerForTraces("test"); + du2.setupTraceLoggerForTraces({}, "test"); +} |