Bug 1018621 - Fix strict mode arguments observability in Ion. (r=nbp)

This commit is contained in:
Shu-yu Guo 2014-06-02 12:44:11 -07:00
parent cd2def28fb
commit 8083ab93fa
2 changed files with 11 additions and 1 deletions

View File

@ -0,0 +1,7 @@
function strictSome(k) {
"use strict";
for (var i = 0; i < args.length; i++)
assertEq(arguments[i], args[i], "wrong argument " + i);
}
args = [8, 6, 7, NaN, undefined, 0.3];
strictSome.call(NaN, 8, 6, 7, NaN, undefined, 0.3);

View File

@ -425,8 +425,11 @@ class CompileInfo
// Function.arguments can be used to access all arguments in non-strict
// scripts, so we can't optimize out any arguments.
if (!script()->strict() && firstArgSlot() <= slot && slot - firstArgSlot() < nargs())
if ((hasArguments() || !script()->strict()) &&
firstArgSlot() <= slot && slot - firstArgSlot() < nargs())
{
return true;
}
return false;
}