Commit 37fc16ec authored by bradnelson's avatar bradnelson Committed by Commit bot

Allow bitwise-or aside from type annotations in asm->wasm conversion.

BUG= https://code.google.com/p/v8/issues/detail?id=4203
TEST=mjsunit/asm-wasm
R=aseemgarg@chromium.org,titzer@chromium.org
LOG=N

Review URL: https://codereview.chromium.org/1720773002

Cr-Commit-Position: refs/heads/master@{#34185}
parent ba152129
...@@ -874,7 +874,6 @@ class AsmWasmBuilderImpl : public AstVisitor { ...@@ -874,7 +874,6 @@ class AsmWasmBuilderImpl : public AstVisitor {
(TypeOf(expr->left()) == kAstI32)) { (TypeOf(expr->left()) == kAstI32)) {
return kAsIs; return kAsIs;
} else { } else {
UNREACHABLE();
return kNone; return kNone;
} }
} }
......
...@@ -1265,3 +1265,51 @@ TestForeignVariables(); ...@@ -1265,3 +1265,51 @@ TestForeignVariables();
assertEquals(123, m.ifunc(456.7, 123)); assertEquals(123, m.ifunc(456.7, 123));
assertEquals(123.4, m.dfunc(456, 123.4)); assertEquals(123.4, m.dfunc(456, 123.4));
})(); })();
(function TestOr() {
function Module() {
"use asm";
function func() {
var x = 1;
var y = 2;
return (x | y) | 0;
}
return {func: func};
}
var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString());
assertEquals(3, m.func());
})();
(function TestAnd() {
function Module() {
"use asm";
function func() {
var x = 3;
var y = 2;
return (x & y) | 0;
}
return {func: func};
}
var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString());
assertEquals(2, m.func());
})();
(function TestXor() {
function Module() {
"use asm";
function func() {
var x = 3;
var y = 2;
return (x ^ y) | 0;
}
return {func: func};
}
var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString());
assertEquals(1, m.func());
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment