Bug 1342060 - wasm: enable by default (r=bbouvier,sr=jorendorff)

MozReview-Commit-ID: LozhxKgleFc

--HG--
extra : rebase_source : 1821c3965c46044e99a132398ea862f49eb6aca0
This commit is contained in:
Luke Wagner 2017-02-23 13:02:40 -06:00
parent e4d2ce1f0b
commit 6f8ce1e317
15 changed files with 23 additions and 46 deletions

View File

@ -8,13 +8,9 @@
var gDebuggee;
var gClient;
var gThreadClient;
var gOldPref;
function run_test()
{
gOldPref = Services.prefs.getBoolPref("javascript.options.wasm");
Services.prefs.setBoolPref("javascript.options.wasm", true);
if (typeof WebAssembly == "undefined") {
return; // wasm is not enabled for this platform
}
@ -49,7 +45,6 @@ function test_pause_frame()
do_check_eq(location.column > 0, true);
do_check_eq(location.source.url.endsWith(" > wasm"), true);
Services.prefs.setBoolPref("javascript.options.wasm", gOldPref);
finishClient(gClient);
});
});
@ -58,7 +53,7 @@ function test_pause_frame()
// WebAssembly bytecode was generated by running:
// js -e 'print(wasmTextToBinary("(module(import \"a\" \"b\")(func(export \"c\")call 0))"))'
var m = new WebAssembly.Module(new Uint8Array([
0,97,115,109,13,0,0,0,1,132,128,128,128,0,1,96,0,0,2,135,128,128,128,0,1,1,97,1,
0,97,115,109,1,0,0,0,1,132,128,128,128,0,1,96,0,0,2,135,128,128,128,0,1,1,97,1,
98,0,0,3,130,128,128,128,0,1,0,6,129,128,128,128,0,0,7,133,128,128,128,0,1,1,99,
0,1,10,138,128,128,128,0,1,132,128,128,128,0,0,16,0,11
]));

View File

@ -11,8 +11,7 @@
<script type="application/javascript;version=1.7">
function setup_tests() {
SpecialPowers.pushPrefEnv({"set": [["dom.input.dirpicker", true],
["javascript.options.wasm", true]]}, next);
SpecialPowers.pushPrefEnv({"set": [["dom.input.dirpicker", true]]}, next);
}
function getType(a) {

View File

@ -75,8 +75,7 @@ function* testHarnessSteps() {
"set": [
["dom.indexedDB.testing", true],
["dom.indexedDB.experimental", true],
["dom.archivereader.enabled", true],
["javascript.options.wasm", true]
["dom.archivereader.enabled", true]
]
},
nextTestHarnessStep

View File

@ -50,7 +50,6 @@ if (!this.runTest) {
enableTesting();
enableExperimental();
enableWasm();
}
Cu.importGlobalProperties(["indexedDB", "Blob", "File", "FileReader"]);
@ -63,7 +62,6 @@ if (!this.runTest) {
function finishTest()
{
if (SpecialPowers.isMainProcess()) {
resetWasm();
resetExperimental();
resetTesting();
@ -214,16 +212,6 @@ function resetTesting()
SpecialPowers.clearUserPref("dom.indexedDB.testing");
}
function enableWasm()
{
SpecialPowers.setBoolPref("javascript.options.wasm", true);
}
function resetWasm()
{
SpecialPowers.clearUserPref("javascript.options.wasm");
}
function gc()
{
Cu.forceGC();

View File

@ -167,7 +167,7 @@ function runTest() {
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["javascript.options.wasm", true]]}, runTest);
runTest();
</script>
</body>
</html>

View File

@ -74,6 +74,7 @@ var ecmaGlobals =
"URIError",
"WeakMap",
"WeakSet",
"WebAssembly"
];
// IMPORTANT: Do not change the list above without review from
// a JavaScript Engine peer!

View File

@ -69,6 +69,7 @@ var ecmaGlobals =
"URIError",
"WeakMap",
"WeakSet",
"WebAssembly"
];
// IMPORTANT: Do not change the list above without review from
// a JavaScript Engine peer!

View File

@ -69,6 +69,7 @@ var ecmaGlobals =
"URIError",
"WeakMap",
"WeakSet",
"WebAssembly"
];
// IMPORTANT: Do not change the list above without review from
// a JavaScript Engine peer!

View File

@ -64,9 +64,6 @@ assertErrorMessage(() => wasmEval(toU8([magic0, magic1, magic2, magic3, 1])), Co
assertErrorMessage(() => wasmEval(toU8([magic0, magic1, magic2, magic3, ver0])), CompileError, versionError(0x6d736100));
assertErrorMessage(() => wasmEval(toU8([magic0, magic1, magic2, magic3, ver0, ver1, ver2])), CompileError, versionError(0x6d736100));
// This test should be removed shortly.
assertEq(WebAssembly.validate(toU8([magic0, magic1, magic2, magic3, 0xd, 0x0, 0x0, 0x0])), true);
function moduleHeaderThen(...rest) {
return [magic0, magic1, magic2, magic3, ver0, ver1, ver2, ver3, ...rest];
}

View File

@ -1,18 +1,18 @@
(module "\00asm\0d\00\00\00")
(module "\00asm" "\0d\00\00\00")
(module $M1 "\00asm\0d\00\00\00")
(module $M2 "\00asm" "\0d\00\00\00")
(module "\00asm\01\00\00\00")
(module "\00asm" "\01\00\00\00")
(module $M1 "\00asm\01\00\00\00")
(module $M2 "\00asm" "\01\00\00\00")
(assert_malformed (module "") "unexpected end")
(assert_malformed (module "\01") "unexpected end")
(assert_malformed (module "\00as") "unexpected end")
(assert_malformed (module "asm\00") "magic header not detected")
(assert_malformed (module "msa\00") "magic header not detected")
(assert_malformed (module "msa\00\0d\00\00\00") "magic header not detected")
(assert_malformed (module "msa\00\01\00\00\00") "magic header not detected")
(assert_malformed (module "msa\00\00\00\00\0d") "magic header not detected")
(assert_malformed (module "\00asm") "unexpected end")
(assert_malformed (module "\00asm\0d") "unexpected end")
(assert_malformed (module "\00asm\0d\00\00") "unexpected end")
(assert_malformed (module "\00asm\01") "unexpected end")
(assert_malformed (module "\00asm\01\00\00") "unexpected end")
(assert_malformed (module "\00asm\0e\00\00\00") "unknown binary version")
(assert_malformed (module "\00asm\00\00\00\0d") "unknown binary version")

View File

@ -1,5 +1,5 @@
(module
"\00asm" "\0d\00\00\00"
"\00asm" "\01\00\00\00"
"\00\24\10" "a custom section" "this is the payload"
"\00\20\10" "a custom section" "this is payload"
"\00\11\10" "a custom section" ""
@ -9,7 +9,7 @@
)
(module
"\00asm" "\0d\00\00\00"
"\00asm" "\01\00\00\00"
"\00\0e\06" "custom" "payload"
"\00\0e\06" "custom" "payload"
"\01\01\00" ;; type section
@ -45,7 +45,7 @@
)
(module
"\00asm" "\0d\00\00\00"
"\00asm" "\01\00\00\00"
"\01\07\01\60\02\7f\7f\01\7f" ;; type section
"\00\1a\06" "custom" "this is the payload" ;; custom section
"\03\02\01\00" ;; function section
@ -56,7 +56,7 @@
(assert_malformed
(module
"\00asm" "\0d\00\00\00"
"\00asm" "\01\00\00\00"
"\00\00"
)
"unexpected end"
@ -64,7 +64,7 @@
(assert_malformed
(module
"\00asm" "\0d\00\00\00"
"\00asm" "\01\00\00\00"
"\00\26\10" "a custom section" "this is the payload"
)
"unexpected end"
@ -72,7 +72,7 @@
(assert_malformed
(module
"\00asm" "\0d\00\00\00"
"\00asm" "\01\00\00\00"
"\00\25\10" "a custom section" "this is the payload"
"\00\24\10" "a custom section" "this is the payload"
)
@ -81,7 +81,7 @@
(assert_malformed
(module
"\00asm" "\0d\00\00\00"
"\00asm" "\01\00\00\00"
"\01\07\01\60\02\7f\7f\01\7f" ;; type section
"\00\25\10" "a custom section" "this is the payload" ;; invalid length!
"\03\02\01\00" ;; function section

View File

@ -27,10 +27,6 @@ namespace wasm {
static const uint32_t MagicNumber = 0x6d736100; // "\0asm"
static const uint32_t EncodingVersion = 0x01;
// 0xd is equivalent to 0x1 modulo unreachability validation rules, so to aid
// transition of toolchain, accept both for a short period of time.
static const uint32_t PrevEncodingVersion = 0x0d;
static const char NameSectionName[] = "name";
enum class SectionId

View File

@ -617,7 +617,7 @@ DecodePreamble(Decoder& d)
if (!d.readFixedU32(&u32) || u32 != MagicNumber)
return d.fail("failed to match magic number");
if (!d.readFixedU32(&u32) || (u32 != EncodingVersion && u32 != PrevEncodingVersion)) {
if (!d.readFixedU32(&u32) || u32 != EncodingVersion) {
return d.fail("binary version 0x%" PRIx32 " does not match expected version 0x%" PRIx32,
u32, EncodingVersion);
}

View File

@ -1273,7 +1273,7 @@ pref("javascript.options.strict.debug", false);
pref("javascript.options.baselinejit", true);
pref("javascript.options.ion", true);
pref("javascript.options.asmjs", true);
pref("javascript.options.wasm", false);
pref("javascript.options.wasm", true);
pref("javascript.options.wasm_baselinejit", false);
pref("javascript.options.native_regexp", true);
pref("javascript.options.parallel_parsing", true);