Skip to content

Commit

Permalink
Backed out changeset c91d997687bf (bug 1487327) for busting beta. a=b…
Browse files Browse the repository at this point in the history
…ackout
  • Loading branch information
Archaeopteryx committed Sep 4, 2018
1 parent 24f1a63 commit 5a18fb5
Show file tree
Hide file tree
Showing 30 changed files with 83 additions and 439 deletions.
5 changes: 0 additions & 5 deletions js/src/jit-test/lib/wasm-binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const startId = 8;
const elemId = 9;
const codeId = 10;
const dataId = 11;
const gcFeatureOptInId = 42;

// User-defined section names
const nameName = "name";
Expand Down Expand Up @@ -178,10 +177,6 @@ function moduleWithSections(sectionArray) {
return toU8(bytes);
}

function gcFeatureOptInSection(version) {
return { name: gcFeatureOptInId, body: [ version & 0x7F ] }
}

function sigSection(sigs) {
var body = [];
body.push(...varU32(sigs.length));
Expand Down
6 changes: 3 additions & 3 deletions js/src/jit-test/tests/wasm/binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ assertErrorMessage(() => wasmEval(toU8(moduleHeaderThen(codeId))), CompileError,
assertErrorMessage(() => wasmEval(toU8(moduleHeaderThen(dataId))), CompileError, sectionError("data"));

// unknown sections are unconditionally rejected
assertErrorMessage(() => wasmEval(toU8(moduleHeaderThen(37))), CompileError, unknownSection);
assertErrorMessage(() => wasmEval(toU8(moduleHeaderThen(37, 0))), CompileError, unknownSection);
assertErrorMessage(() => wasmEval(toU8(moduleHeaderThen(37, 1, 0))), CompileError, unknownSection);
assertErrorMessage(() => wasmEval(toU8(moduleHeaderThen(42))), CompileError, unknownSection);
assertErrorMessage(() => wasmEval(toU8(moduleHeaderThen(42, 0))), CompileError, unknownSection);
assertErrorMessage(() => wasmEval(toU8(moduleHeaderThen(42, 1, 0))), CompileError, unknownSection);

// user sections have special rules
assertErrorMessage(() => wasmEval(toU8(moduleHeaderThen(0))), CompileError, sectionError("custom")); // no length
Expand Down
3 changes: 0 additions & 3 deletions js/src/jit-test/tests/wasm/gc/anyref-global-postbarrier.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ function Baguette(calories) {
// Ensure the baseline compiler sync's before the postbarrier.
(function() {
wasmEvalText(`(module
(gc_feature_opt_in 1)
(global (mut anyref) (ref.null anyref))
(func (export "f")
get_global 0
Expand All @@ -24,15 +23,13 @@ function Baguette(calories) {
})();

let exportsPlain = wasmEvalText(`(module
(gc_feature_opt_in 1)
(global i32 (i32.const 42))
(global $g (mut anyref) (ref.null anyref))
(func (export "set") (param anyref) get_local 0 set_global $g)
(func (export "get") (result anyref) get_global $g)
)`).exports;

let exportsObj = wasmEvalText(`(module
(gc_feature_opt_in 1)
(global $g (export "g") (mut anyref) (ref.null anyref))
(func (export "set") (param anyref) get_local 0 set_global $g)
(func (export "get") (result anyref) get_global $g)
Expand Down
1 change: 0 additions & 1 deletion js/src/jit-test/tests/wasm/gc/anyref-global-prebarrier.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ if (!wasmGcEnabled()) {
const { startProfiling, endProfiling, assertEqPreciseStacks, isSingleStepProfilingEnabled } = WasmHelpers;

let e = wasmEvalText(`(module
(gc_feature_opt_in 1)
(global $g (mut anyref) (ref.null anyref))
(func (export "set") (param anyref) get_local 0 set_global $g)
)`).exports;
Expand Down
1 change: 0 additions & 1 deletion js/src/jit-test/tests/wasm/gc/anyref-val-tracing.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ if (!wasmGcEnabled()) {

gczeal(14, 1);
let { exports } = wasmEvalText(`(module
(gc_feature_opt_in 1)
(global $anyref (import "glob" "anyref") anyref)
(func (export "get") (result anyref) get_global $anyref)
)`, {
Expand Down
37 changes: 13 additions & 24 deletions js/src/jit-test/tests/wasm/gc/anyref.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ function Baguette(calories) {
const { validate, CompileError } = WebAssembly;

assertErrorMessage(() => wasmEvalText(`(module
(gc_feature_opt_in 1)
(func (result anyref)
i32.const 42
)
)`), CompileError, mismatchError('i32', 'anyref'));

assertErrorMessage(() => wasmEvalText(`(module
(gc_feature_opt_in 1)
(func (result anyref)
i32.const 0
ref.null anyref
Expand All @@ -31,7 +29,6 @@ assertErrorMessage(() => wasmEvalText(`(module
)`), CompileError, /select operand types/);

assertErrorMessage(() => wasmEvalText(`(module
(gc_feature_opt_in 1)
(func (result i32)
ref.null anyref
if
Expand All @@ -44,16 +41,16 @@ assertErrorMessage(() => wasmEvalText(`(module
// Basic compilation tests.

let simpleTests = [
"(module (gc_feature_opt_in 1) (func (drop (ref.null anyref))))",
"(module (gc_feature_opt_in 1) (func $test (local anyref)))",
"(module (gc_feature_opt_in 1) (func $test (param anyref)))",
"(module (gc_feature_opt_in 1) (func $test (result anyref) (ref.null anyref)))",
"(module (gc_feature_opt_in 1) (func $test (block anyref (unreachable)) unreachable))",
"(module (gc_feature_opt_in 1) (func $test (local anyref) (result i32) (ref.is_null (get_local 0))))",
`(module (gc_feature_opt_in 1) (import "a" "b" (param anyref)))`,
`(module (gc_feature_opt_in 1) (import "a" "b" (result anyref)))`,
`(module (gc_feature_opt_in 1) (global anyref (ref.null anyref)))`,
`(module (gc_feature_opt_in 1) (global (mut anyref) (ref.null anyref)))`,
"(module (func (drop (ref.null anyref))))",
"(module (func $test (local anyref)))",
"(module (func $test (param anyref)))",
"(module (func $test (result anyref) (ref.null anyref)))",
"(module (func $test (block anyref (unreachable)) unreachable))",
"(module (func $test (local anyref) (result i32) (ref.is_null (get_local 0))))",
`(module (import "a" "b" (param anyref)))`,
`(module (import "a" "b" (result anyref)))`,
`(module (global anyref (ref.null anyref)))`,
`(module (global (mut anyref) (ref.null anyref)))`,
];

for (let src of simpleTests) {
Expand All @@ -64,7 +61,6 @@ for (let src of simpleTests) {
// Basic behavioral tests.

let { exports } = wasmEvalText(`(module
(gc_feature_opt_in 1)
(func (export "is_null") (result i32)
ref.null anyref
ref.is_null
Expand Down Expand Up @@ -102,7 +98,6 @@ assertEq(exports.is_null_local(), 1);
// Anyref param and result in wasm functions.

exports = wasmEvalText(`(module
(gc_feature_opt_in 1)
(func (export "is_null") (result i32) (param $ref anyref)
get_local $ref
ref.is_null
Expand Down Expand Up @@ -160,7 +155,6 @@ assertEq(ref.calories, baguette.calories);
// Make sure grow-memory isn't blocked by the lack of gc.
(function() {
assertEq(wasmEvalText(`(module
(gc_feature_opt_in 1)
(memory 0 64)
(func (export "f") (param anyref) (result i32)
i32.const 10
Expand All @@ -176,7 +170,6 @@ assertEq(ref.calories, baguette.calories);
function assertJoin(body) {
let val = { i: -1 };
assertEq(wasmEvalText(`(module
(gc_feature_opt_in 1)
(func (export "test") (param $ref anyref) (param $i i32) (result anyref)
${body}
)
Expand Down Expand Up @@ -243,7 +236,6 @@ assertJoin(`(block $out anyref (block $unreachable anyref (loop $top

let x = { i: 42 }, y = { f: 53 };
exports = wasmEvalText(`(module
(gc_feature_opt_in 1)
(func (export "test") (param $lhs anyref) (param $rhs anyref) (param $i i32) (result anyref)
get_local $lhs
get_local $rhs
Expand Down Expand Up @@ -298,7 +290,6 @@ let imports = {
};

exports = wasmEvalText(`(module
(gc_feature_opt_in 1)
(import $ret "funcs" "ret" (result anyref))
(import $param "funcs" "param" (param anyref))
Expand Down Expand Up @@ -327,7 +318,6 @@ assertEq(exports.ret(), imports.myBaguette);
// Check lazy stubs generation.

exports = wasmEvalText(`(module
(gc_feature_opt_in 1)
(import $mirror "funcs" "mirror" (param anyref) (result anyref))
(import $augment "funcs" "augment" (param anyref) (result anyref))
Expand Down Expand Up @@ -411,15 +401,15 @@ assertEq(exports.count_g(), 1);

// Anyref globals in wasm modules.

assertErrorMessage(() => wasmEvalText(`(module (gc_feature_opt_in 1) (global (import "glob" "anyref") anyref))`, { glob: { anyref: 42 } }),
assertErrorMessage(() => wasmEvalText(`(module (global (import "glob" "anyref") anyref))`, { glob: { anyref: 42 } }),
WebAssembly.LinkError,
/import object field 'anyref' is not a Object-or-null/);

assertErrorMessage(() => wasmEvalText(`(module (gc_feature_opt_in 1) (global (import "glob" "anyref") anyref))`, { glob: { anyref: new WebAssembly.Global({ value: 'i32' }, 42) } }),
assertErrorMessage(() => wasmEvalText(`(module (global (import "glob" "anyref") anyref))`, { glob: { anyref: new WebAssembly.Global({ value: 'i32' }, 42) } }),
WebAssembly.LinkError,
/imported global type mismatch/);

assertErrorMessage(() => wasmEvalText(`(module (gc_feature_opt_in 1) (global (import "glob" "i32") i32))`, { glob: { i32: {} } }),
assertErrorMessage(() => wasmEvalText(`(module (global (import "glob" "i32") i32))`, { glob: { i32: {} } }),
WebAssembly.LinkError,
/import object field 'i32' is not a Number/);

Expand All @@ -433,7 +423,6 @@ imports = {
};

exports = wasmEvalText(`(module
(gc_feature_opt_in 1)
(global $g_imp_imm_null (import "constants" "imm_null") anyref)
(global $g_imp_imm_bread (import "constants" "imm_bread") anyref)
Expand Down
5 changes: 1 addition & 4 deletions js/src/jit-test/tests/wasm/gc/binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ const v2vSig = {args:[], ret:VoidCode};
const v2vSigSection = sigSection([v2vSig]);

function checkInvalid(body, errorMessage) {
assertErrorMessage(() => new WebAssembly.Module(
moduleWithSections([gcFeatureOptInSection(1), v2vSigSection, declSection([0]), bodySection([body])])),
WebAssembly.CompileError,
errorMessage);
assertErrorMessage(() => new WebAssembly.Module(moduleWithSections([v2vSigSection, declSection([0]), bodySection([body])])), WebAssembly.CompileError, errorMessage);
}

const invalidRefNullBody = funcBody({locals:[], body:[
Expand Down
3 changes: 1 addition & 2 deletions js/src/jit-test/tests/wasm/gc/debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if (!wasmGcEnabled() || !wasmDebuggingIsSupported()) {
(function() {
let g = newGlobal();
let dbg = new Debugger(g);
g.eval(`o = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary('(module (gc_feature_opt_in 1) (func (result anyref) (param anyref) get_local 0) (export "" 0))')));`);
g.eval(`o = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary('(module (func (result anyref) (param anyref) get_local 0) (export "" 0))')));`);
})();

(function() {
Expand All @@ -14,7 +14,6 @@ if (!wasmGcEnabled() || !wasmDebuggingIsSupported()) {

let src = `
(module
(gc_feature_opt_in 1)
(func (export "func") (result anyref) (param $ref anyref)
get_local $ref
)
Expand Down
18 changes: 9 additions & 9 deletions js/src/jit-test/tests/wasm/gc/disabled.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ if (wasmGcEnabled()) {

const { CompileError, validate } = WebAssembly;

const UNRECOGNIZED_OPCODE_OR_BAD_TYPE = /unrecognized opcode|reference types not enabled|invalid inline block type/;
const UNRECOGNIZED_OPCODE_OR_BAD_TYPE = /(unrecognized opcode|bad type|invalid inline block type)/;

function assertValidateError(text) {
assertEq(validate(wasmTextToBinary(text)), false);
}

let simpleTests = [
"(module (gc_feature_opt_in 1) (func (drop (ref.null anyref))))",
"(module (gc_feature_opt_in 1) (func $test (local anyref)))",
"(module (gc_feature_opt_in 1) (func $test (param anyref)))",
"(module (gc_feature_opt_in 1) (func $test (result anyref) (ref.null anyref)))",
"(module (gc_feature_opt_in 1) (func $test (block anyref (unreachable)) unreachable))",
"(module (gc_feature_opt_in 1) (func $test (local anyref) (result i32) (ref.is_null (get_local 0))))",
`(module (gc_feature_opt_in 1) (import "a" "b" (param anyref)))`,
`(module (gc_feature_opt_in 1) (import "a" "b" (result anyref)))`,
"(module (func (drop (ref.null anyref))))",
"(module (func $test (local anyref)))",
"(module (func $test (param anyref)))",
"(module (func $test (result anyref) (ref.null anyref)))",
"(module (func $test (block anyref (unreachable)) unreachable))",
"(module (func $test (local anyref) (result i32) (ref.is_null (get_local 0))))",
`(module (import "a" "b" (param anyref)))`,
`(module (import "a" "b" (result anyref)))`,
];

for (let src of simpleTests) {
Expand Down
120 changes: 0 additions & 120 deletions js/src/jit-test/tests/wasm/gc/gc-feature-opt-in.js

This file was deleted.

Loading

0 comments on commit 5a18fb5

Please sign in to comment.