Bug 1629496 - Correctly init wasm locals for functions with stack results r=lth

Ion functions with locals and stack results were inadvertantly skipping
a local, because they were considering the stack results pointer
argument as counting towards locals.

Differential Revision: https://phabricator.services.mozilla.com/D70797

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andy Wingo 2020-04-15 07:35:20 +00:00
Родитель 53459f4868
Коммит 95f9c28ec4
2 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,9 @@
let bytes = wasmTextToBinary(`
(module
(func $f (param) (result i32 i32)
(local i32)
(loop)
(i32.const 0)
(i32.const 1)))`);
new WebAssembly.Instance(new WebAssembly.Module(bytes));

Просмотреть файл

@ -184,7 +184,8 @@ class FunctionCompiler {
return false;
}
for (size_t i = args.length(); i < locals_.length(); i++) {
for (size_t i = args.lengthWithoutStackResults(); i < locals_.length();
i++) {
MInstruction* ins = nullptr;
switch (locals_[i].kind()) {
case ValType::I32: