Commit 07f93aff authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm] Simd locals are not allowed without --experimental-wasm-simd

The wasm valiation incorrectly allowed simd locals, even without the
experimental flag turned on. This was not noted in the generated code
because simd opcodes were forbidden, but the interpreter could not
handle these locals.

R=clemensh@chromium.org

Bug: chromium:763697
Change-Id: I11d924ac21e50bce81d0504c2c7b252105a89f80
Reviewed-on: https://chromium-review.googlesource.com/660117
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47946}
parent 955d7e41
......@@ -606,8 +606,11 @@ class WasmDecoder : public Decoder {
type = kWasmF64;
break;
case kLocalS128:
type = kWasmS128;
break;
if (FLAG_experimental_wasm_simd) {
type = kWasmS128;
break;
}
// else fall through to default.
default:
decoder->error(decoder->pc() - 1, "invalid local type");
return false;
......
......@@ -8,7 +8,6 @@ load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
// Non-standard opcodes.
let kWasmS128 = 0x7b;
let kSig_s_v = makeSig([], [kWasmS128]);
let kExprS128LoadMem = 0xc0;
......
......@@ -6,7 +6,6 @@ load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
// Non-standard opcodes.
let kWasmS128 = 0x7b;
let kSig_s_v = makeSig([], [kWasmS128]);
let kExprS128LoadMem = 0xc0;
......
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm --no-experimental-wasm-simd
load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let builder = new WasmModuleBuilder();
builder.addFunction("main", kSig_i_i)
.addBody([kExprGetLocal, 0])
.addLocals({s128_count: 1});
assertFalse(WebAssembly.validate(builder.toBuffer()));
......@@ -92,6 +92,7 @@ let kWasmI32 = 0x7f;
let kWasmI64 = 0x7e;
let kWasmF32 = 0x7d;
let kWasmF64 = 0x7c;
let kWasmS128 = 0x7b;
let kExternalFunction = 0;
let kExternalTable = 1;
......
......@@ -541,6 +541,9 @@ class WasmModuleBuilder {
if (l.f64_count > 0) {
local_decls.push({count: l.f64_count, type: kWasmF64});
}
if (l.s128_count > 0) {
local_decls.push({count: l.s128_count, type: kWasmS128});
}
}
let header = new Binary;
......
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