Commit 2f3ca961 authored by ahaas's avatar ahaas Committed by Commit bot

[turbofan] Use uint32 to store the number of control outputs instead of uint16.

Using uint32 to store the the number of control outputs allows WebAssembly switches to have more than 2^16 case.

BUG=v8:5531
TEST=mjsunit/regress/wasm/regression-5531
R=titzer@chromium.org

Review-Url: https://chromiumcodereview.appspot.com/2425983002
Cr-Commit-Position: refs/heads/master@{#40420}
parent efe4fd4b
......@@ -24,7 +24,6 @@ V8_INLINE N CheckRange(size_t val) {
// static
STATIC_CONST_MEMBER_DEFINITION const size_t Operator::kMaxControlOutputCount;
Operator::Operator(Opcode opcode, Properties properties, const char* mnemonic,
size_t value_in, size_t effect_in, size_t control_in,
size_t value_out, size_t effect_out, size_t control_out)
......@@ -36,8 +35,7 @@ Operator::Operator(Opcode opcode, Properties properties, const char* mnemonic,
control_in_(CheckRange<uint16_t>(control_in)),
value_out_(CheckRange<uint16_t>(value_out)),
effect_out_(CheckRange<uint8_t>(effect_out)),
control_out_(CheckRange<uint16_t>(control_out)) {}
control_out_(CheckRange<uint32_t>(control_out)) {}
std::ostream& operator<<(std::ostream& os, const Operator& op) {
op.PrintTo(os);
......
......@@ -144,7 +144,7 @@ class V8_EXPORT_PRIVATE Operator : public NON_EXPORTED_BASE(ZoneObject) {
uint16_t control_in_;
uint16_t value_out_;
uint8_t effect_out_;
uint16_t control_out_;
uint32_t control_out_;
DISALLOW_COPY_AND_ASSIGN(Operator);
};
......
// Copyright 2016 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
load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function() {
var builder = new WasmModuleBuilder();
builder.addMemory(1, 1, false);
builder.addFunction("foo", kSig_i_v)
.addBody([
kExprI32Const, 0x00,
kExprI8Const, 0xcb,
kExprI8Const, 0xff,
kExprBrTable, 0xcb, 0xcb, 0xcb, 0x00, 0x00, 0xcb, 0x00 // entries=1238475
])
.exportFunc();
assertThrows(function() { builder.instantiate(); });
})();
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