Bug 870144 - don't assume non-definition argument has a name when reporting asm.js validation errors (r=terrence)
authorLuke Wagner <luke@mozilla.com>
Wed, 08 May 2013 16:34:01 -0700
changeset 138095 f269dd20a9f61bf1eb247b7d1803a4bc7d432d2e
parent 138094 720d85933172f5bbd6e94272af56c63cc517f5ee
child 138096 419103cd6ce3c1cb7863e9f97fa0180005e06663
push id3752
push userlsblakk@mozilla.com
push dateMon, 13 May 2013 17:21:10 +0000
treeherdermozilla-aurora@1580544aef0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs870144
milestone23.0a1
Bug 870144 - don't assume non-definition argument has a name when reporting asm.js validation errors (r=terrence)
js/src/ion/AsmJS.cpp
js/src/jit-test/tests/asm.js/testBasic.js
--- a/js/src/ion/AsmJS.cpp
+++ b/js/src/ion/AsmJS.cpp
@@ -2483,17 +2483,17 @@ CheckFunctionHead(ModuleCompiler &m, Par
     *stmtIter = ListHead(FunctionStatementList(fn));
     return true;
 }
 
 static bool
 CheckArgument(ModuleCompiler &m, ParseNode *arg, PropertyName **name)
 {
     if (!IsDefinition(arg))
-        return m.failName(arg, "duplicate argument name '%s' not allowed", arg->name());
+        return m.fail(arg, "duplicate argument name not allowed");
 
     if (MaybeDefinitionInitializer(arg))
         return m.fail(arg, "default arguments not allowed");
 
     if (!CheckIdentifier(m, arg->name(), arg))
         return false;
 
     *name = arg->name();
--- a/js/src/jit-test/tests/asm.js/testBasic.js
+++ b/js/src/jit-test/tests/asm.js/testBasic.js
@@ -94,16 +94,17 @@ function assertTypeFailInEval(str)
         caught = true;
     }
     assertEq(caught, true);
     options("werror");
 }
 assertTypeFailInEval('function f({}) { "use asm"; function g() {} return g }');
 assertTypeFailInEval('function f({global}) { "use asm"; function g() {} return g }');
 assertTypeFailInEval('function f(global, {imports}) { "use asm"; function g() {} return g }');
+assertTypeFailInEval('function f(g = 2) { "use asm"; function g() {} return g }');
 
 function assertLinkFailInEval(str)
 {
     if (!isAsmJSCompilationAvailable())
         return;
 
     var caught = false;
     var oldOpts = options("werror");