Skip to content

Commit

Permalink
Bug 1536860 - Remove Array.slice from lib/asm.js. r=jorendorff
Browse files Browse the repository at this point in the history
This was causing test failures in some uncommon try configurations like fuzzing.

Depends on D24208

Differential Revision: https://phabricator.services.mozilla.com/D25253

--HG--
extra : moz-landing-system : lando
  • Loading branch information
evilpie committed Mar 28, 2019
1 parent 9d31616 commit e79fae2
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions js/src/jit-test/lib/asm.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ function assertAsmTypeFail()
options("throw_on_asmjs_validation_failure");
}

function assertAsmLinkFail(f)
function assertAsmLinkFail(f, ...args)
{
if (!isAsmJSCompilationAvailable())
return;

assertEq(isAsmJSModule(f), true);

// Verify no error is thrown with warnings off
var ret = f.apply(null, Array.slice(arguments, 1));
var ret = f.apply(null, args);

assertEq(isAsmJSFunction(ret), false);
if (typeof ret === 'object')
Expand All @@ -106,7 +106,7 @@ function assertAsmLinkFail(f)
// Verify an error is thrown
var caught = false;
try {
f.apply(null, Array.slice(arguments, 1));
f.apply(null, args);
} catch (e) {
// Arbitrary code an run in the GetProperty, so don't assert any
// particular string
Expand All @@ -120,11 +120,11 @@ function assertAsmLinkFail(f)
}

// Linking should throw an exception even without warnings-as-errors
function assertAsmLinkAlwaysFail(f)
function assertAsmLinkAlwaysFail(f, ...args)
{
var caught = false;
try {
f.apply(null, Array.slice(arguments, 1));
f.apply(null, args);
} catch (e) {
caught = true;
}
Expand All @@ -138,7 +138,7 @@ function assertAsmLinkAlwaysFail(f)
// Verify an error is thrown
var caught = false;
try {
f.apply(null, Array.slice(arguments, 1));
f.apply(null, args);
} catch (e) {
caught = true;
}
Expand All @@ -149,13 +149,13 @@ function assertAsmLinkAlwaysFail(f)
options("werror");
}

function assertAsmLinkDeprecated(f)
function assertAsmLinkDeprecated(f, ...args)
{
if (!isAsmJSCompilationAvailable())
return;

// Verify no error is thrown with warnings off
f.apply(null, Array.slice(arguments, 1));
f.apply(null, args);

// Turn on warnings-as-errors
var oldOpts = options("werror");
Expand All @@ -164,7 +164,7 @@ function assertAsmLinkDeprecated(f)
// Verify an error is thrown
var caught = false;
try {
f.apply(null, Array.slice(arguments, 1));
f.apply(null, args);
} catch (e) {
// Arbitrary code an run in the GetProperty, so don't assert any
// particular string
Expand All @@ -178,16 +178,16 @@ function assertAsmLinkDeprecated(f)
}

// Linking should throw a warning-as-error but otherwise run fine
function asmLink(f)
function asmLink(f, ...args)
{
if (!isAsmJSCompilationAvailable())
return f.apply(null, Array.slice(arguments, 1));
return f.apply(null, args);

// Turn on warnings-as-errors
var oldOpts = options("werror");
assertEq(oldOpts.indexOf("werror"), -1);

var ret = f.apply(null, Array.slice(arguments, 1));
var ret = f.apply(null, args);

// Turn warnings-as-errors back off
options("werror");
Expand Down

0 comments on commit e79fae2

Please sign in to comment.