Commit f0d7c7a8 authored by bradnelson's avatar bradnelson Committed by Commit bot

Implementing comma operator for asm->wasm.

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/1704553002

Cr-Commit-Position: refs/heads/master@{#34044}
parent f739088b
......@@ -1026,6 +1026,10 @@ class AsmWasmBuilderImpl : public AstVisitor {
}
break;
}
case Token::COMMA: {
current_function_builder_->EmitWithU8(kExprBlock, 2);
break;
}
default:
UNREACHABLE();
}
......
......@@ -1042,6 +1042,7 @@ function TestForeignFunctions() {
TestForeignFunctions();
function TestForeignFunctionMultipleUse() {
function AsmModule(stdlib, foreign, buffer) {
"use asm";
......@@ -1219,3 +1220,28 @@ TestForeignVariables();
assertEquals(42, m.iload(4));
assertEquals(77, m.iload(8));
})();
(function TestComma() {
function CommaModule() {
"use asm";
function ifunc(a, b) {
a = +a;
b = b | 0;
return (a, b) | 0;
}
function dfunc(a, b) {
a = a | 0;
b = +b;
return +(a, b);
}
return {ifunc: ifunc, dfunc: dfunc};
}
var m = _WASMEXP_.instantiateModuleFromAsm(CommaModule.toString());
assertEquals(123, m.ifunc(456.7, 123));
assertEquals(123.4, m.dfunc(456, 123.4));
})();
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