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}
This commit is contained in:
parent
f739088baa
commit
f0d7c7a83b
@ -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));
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user