Browse Source

remove overly aggressive asm.js assert

Michael Holman 8 years ago
parent
commit
47c44cde59

+ 2 - 2
lib/Runtime/Language/AsmJsByteCodeGenerator.cpp

@@ -982,10 +982,10 @@ namespace Js
         }
         else
         {
-            AssertOrFailFast(UNREACHED);
+            // Vars must have concrete type, so any "-ish" or "maybe" type
+            // cannot be in a var location
             return false;
         }
-
     }
 
     RegSlot AsmJSByteCodeGenerator::EmitIndirectCallIndex(ParseNode* identifierNode, ParseNode* indexNode)

+ 6 - 0
test/AsmJs/maybecallbug.baseline

@@ -0,0 +1,6 @@
+
+maybecallbug.js(10, 3)
+	Asm.js Compilation Error function : None::foo
+	Function bar doesn't support arguments
+
+Asm.js compilation failed.

+ 16 - 0
test/AsmJs/maybecallbug.js

@@ -0,0 +1,16 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+
+var module = (function(stdlib, foreign, heap) {
+  "use asm";
+  var bar = foreign.bar;
+  var Float32ArrayView = new stdlib.Float32Array(heap);
+  function foo() {
+    return +bar(Float32ArrayView[0])
+  }
+  return foo;
+})(this, {bar: function(){}}, new ArrayBuffer(1 << 20));
+
+module();

+ 7 - 0
test/AsmJs/rlexe.xml

@@ -1039,4 +1039,11 @@
       <files>argassignbug.js</files>
     </default>
   </test>
+  <test>
+    <default>
+      <files>maybecallbug.js</files>
+      <baseline>maybecallbug.baseline</baseline>
+      <compile-flags>-testtrace:asmjs</compile-flags>
+    </default>
+  </test>
 </regress-exe>