зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1351488 - Add tiering+IndexedDB tests (r=janv)
MozReview-Commit-ID: GrSJL2GPscw --HG-- extra : rebase_source : dfef88281ddf60d2f6a482cb0751e348008275b9
This commit is contained in:
Родитель
7160aa5488
Коммит
1f5ce805ca
|
@ -77,6 +77,7 @@ function* testHarnessSteps() {
|
|||
"set": [
|
||||
["dom.indexedDB.testing", true],
|
||||
["dom.indexedDB.experimental", true],
|
||||
["javascript.options.wasm_baselinejit", true] // This can be removed when on by default
|
||||
]
|
||||
},
|
||||
nextTestHarnessStep
|
||||
|
|
|
@ -115,6 +115,7 @@ support-files =
|
|||
unit/test_wasm_index_getAllObjects.js
|
||||
unit/test_wasm_indexes.js
|
||||
unit/test_wasm_put_get_values.js
|
||||
unit/test_wasm_serialize_tiering.js
|
||||
unit/test_writer_starvation.js
|
||||
|
||||
[test_abort_deleted_index.html]
|
||||
|
@ -266,3 +267,4 @@ scheme=https
|
|||
[test_wasm_index_getAllObjects.html]
|
||||
[test_wasm_indexes.html]
|
||||
[test_wasm_put_get_values.html]
|
||||
[test_wasm_serialize_tiering.html]
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Indexed Database Property Test</title>
|
||||
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
<script type="text/javascript" src="unit/test_wasm_serialize_tiering.js"></script>
|
||||
<script type="text/javascript" src="file.js"></script>
|
||||
<script type="text/javascript" src="helpers.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="runTest();"></body>
|
||||
|
||||
</html>
|
|
@ -0,0 +1,106 @@
|
|||
/**
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
var testGenerator = testSteps();
|
||||
|
||||
function* testSteps()
|
||||
{
|
||||
const name =
|
||||
this.window ? window.location.pathname : "test_wasm_serialize_tiering.js";
|
||||
|
||||
const objectStoreName = "Wasm";
|
||||
|
||||
if (!isWasmSupported()) {
|
||||
finishTest();
|
||||
return;
|
||||
}
|
||||
|
||||
// Make a module big enough so that tiering is significant.
|
||||
const N = 50;
|
||||
let bigFunc = `(func (result f64)\n`;
|
||||
for (let i = 0; i < N; i++) {
|
||||
bigFunc += ` f64.const 1.0\n`;
|
||||
}
|
||||
for (let i = 0; i < N - 1; i++) {
|
||||
bigFunc += ` f64.add\n`;
|
||||
}
|
||||
bigFunc += `)`;
|
||||
let bigModule = `(module \n`;
|
||||
for (let i = 0; i < 100; i++) {
|
||||
bigModule += bigFunc;
|
||||
}
|
||||
bigModule += ` (export "run" (func 10))\n`;
|
||||
bigModule += `)`;
|
||||
|
||||
getWasmBinary(bigModule);
|
||||
let bigBinary = yield undefined;
|
||||
|
||||
info("Opening database");
|
||||
|
||||
let request = indexedDB.open(name);
|
||||
request.onerror = errorHandler;
|
||||
request.onupgradeneeded = continueToNextStepSync;
|
||||
request.onsuccess = unexpectedSuccessHandler;
|
||||
yield undefined;
|
||||
|
||||
// upgradeneeded
|
||||
request.onupgradeneeded = unexpectedSuccessHandler;
|
||||
request.onsuccess = continueToNextStepSync;
|
||||
|
||||
info("Creating objectStore");
|
||||
|
||||
request.result.createObjectStore(objectStoreName);
|
||||
|
||||
yield undefined;
|
||||
|
||||
// success
|
||||
let db = request.result;
|
||||
db.onerror = errorHandler;
|
||||
|
||||
info("Storing wasm modules");
|
||||
|
||||
let objectStore = db.transaction([objectStoreName], "readwrite")
|
||||
.objectStore(objectStoreName);
|
||||
|
||||
const NumModules = 5;
|
||||
const NumCopies = 5;
|
||||
|
||||
let finishedAdds = 0;
|
||||
for (let moduleIndex = 0; moduleIndex < NumModules; moduleIndex++) {
|
||||
let module = new WebAssembly.Module(bigBinary);
|
||||
for (let copyIndex = 0; copyIndex < NumCopies; copyIndex++) {
|
||||
let key = String(moduleIndex) + " " + String(copyIndex);
|
||||
let request = objectStore.add(module, key);
|
||||
request.onsuccess = function() {
|
||||
is(request.result, key, "Got correct key");
|
||||
if (++finishedAdds === NumModules * NumCopies) {
|
||||
continueToNextStepSync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
yield undefined;
|
||||
|
||||
info("Getting wasm");
|
||||
|
||||
let finishedGets = 0;
|
||||
for (let moduleIndex = 0; moduleIndex < NumModules; moduleIndex++) {
|
||||
for (let copyIndex = 0; copyIndex < NumCopies; copyIndex++) {
|
||||
let key = String(moduleIndex) + " " + String(copyIndex);
|
||||
let request = objectStore.get(key);
|
||||
request.onsuccess = function() {
|
||||
let module = request.result;
|
||||
let instance = new WebAssembly.Instance(module);
|
||||
is(instance.exports.run(), N, "Got correct run() result");
|
||||
if (++finishedGets === NumModules * NumCopies) {
|
||||
continueToNextStepSync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
yield undefined;
|
||||
|
||||
finishTest();
|
||||
}
|
|
@ -681,3 +681,7 @@ var SpecialPowers = {
|
|||
}
|
||||
},
|
||||
};
|
||||
|
||||
// This can be removed soon when on by default.
|
||||
if (SpecialPowers.isMainProcess())
|
||||
SpecialPowers.setBoolPref("javascript.options.wasm_baselinejit", true);
|
||||
|
|
|
@ -74,3 +74,5 @@ skip-if = coverage # bug 1336727
|
|||
skip-if = coverage # bug 1336727
|
||||
[test_wasm_recompile.js]
|
||||
skip-if = coverage # bug 1336727
|
||||
[test_wasm_serialize_tiering.js]
|
||||
skip-if = coverage # bug 1336727
|
||||
|
|
Загрузка…
Ссылка в новой задаче