Skip to content

Commit 24638a1

Browse files
committed
[1.8>master] [MERGE #4383 @MikeHolman] remove overly aggressive asm.js assert
Merge pull request #4383 from MikeHolman:relaxasmassert I added IsVarLocationGeneric with failfast to ensure that you only pass concrete types to the method, but seems reasonable to allow other types as well and since only concrete types can be stored to locals we can return back a good answer. OS:14979462
2 parents ae12d03 + 99ce30d commit 24638a1

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

lib/Runtime/Language/AsmJsByteCodeGenerator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,10 +980,10 @@ namespace Js
980980
}
981981
else
982982
{
983-
AssertOrFailFast(UNREACHED);
983+
// Vars must have concrete type, so any "-ish" or "maybe" type
984+
// cannot be in a var location
984985
return false;
985986
}
986-
987987
}
988988

989989
RegSlot AsmJSByteCodeGenerator::EmitIndirectCallIndex(ParseNode* identifierNode, ParseNode* indexNode)

test/AsmJs/maybecallbug.baseline

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
maybecallbug.js(10, 3)
3+
Asm.js Compilation Error function : None::foo
4+
Function bar doesn't support arguments
5+
6+
Asm.js compilation failed.

test/AsmJs/maybecallbug.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
//-------------------------------------------------------------------------------------------------------
5+
6+
var module = (function(stdlib, foreign, heap) {
7+
"use asm";
8+
var bar = foreign.bar;
9+
var Float32ArrayView = new stdlib.Float32Array(heap);
10+
function foo() {
11+
return +bar(Float32ArrayView[0])
12+
}
13+
return foo;
14+
})(this, {bar: function(){}}, new ArrayBuffer(1 << 20));
15+
16+
module();

test/AsmJs/rlexe.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,4 +1039,11 @@
10391039
<files>argassignbug.js</files>
10401040
</default>
10411041
</test>
1042+
<test>
1043+
<default>
1044+
<files>maybecallbug.js</files>
1045+
<baseline>maybecallbug.baseline</baseline>
1046+
<compile-flags>-testtrace:asmjs</compile-flags>
1047+
</default>
1048+
</test>
10421049
</regress-exe>

0 commit comments

Comments
 (0)