| Index: src/wasm/ast-decoder.cc
|
| diff --git a/src/wasm/ast-decoder.cc b/src/wasm/ast-decoder.cc
|
| index 84b64d6d8ddf3d02306fbe94d6f1c90abbb17aae..bd9a07de920081ee5ba7a826a0682aeac679b9e5 100644
|
| --- a/src/wasm/ast-decoder.cc
|
| +++ b/src/wasm/ast-decoder.cc
|
| @@ -1290,6 +1290,14 @@ class WasmFullDecoder : public WasmDecoder {
|
| return 1 + operand.length;
|
| }
|
|
|
| + uint8_t LaneValue(uint8_t max_lanes) {
|
| + uint8_t lane = this->checked_read_u8(pc_, 2, "lane number");
|
| + if (lane < 0 || lane > (max_lanes - 1)) {
|
| + error(pc_, pc_ + 2, "invalid Simd128 lane value");
|
| + }
|
| + return lane;
|
| + }
|
| +
|
| unsigned ExtractLane(WasmOpcode opcode, LocalType type) {
|
| LaneOperand operand(this, pc_);
|
| if (Validate(pc_, operand)) {
|
| @@ -1302,7 +1310,18 @@ class WasmFullDecoder : public WasmDecoder {
|
|
|
| unsigned DecodeSimdOpcode(WasmOpcode opcode) {
|
| unsigned len = 0;
|
| + static const int kInt32x4MaxLanes = 4;
|
| switch (opcode) {
|
| + case kExprI32x4ReplaceLane: {
|
| + compiler::NodeVector inputs(3, zone_);
|
| + inputs[2] = Pop(1, LocalType::kWord32).node;
|
| + inputs[1] = builder_->Int32Constant(LaneValue(kInt32x4MaxLanes));
|
| + inputs[0] = Pop(0, LocalType::kSimd128).node;
|
| + TFNode* node = BUILD(SimdOp, opcode, inputs);
|
| + Push(LocalType::kSimd128, node);
|
| + len++;
|
| + break;
|
| + }
|
| case kExprI32x4ExtractLane: {
|
| len = ExtractLane(opcode, LocalType::kWord32);
|
| break;
|
|
|