OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_WASM_FUNCTION_BODY_DECODER_IMPL_H_ | 5 #ifndef V8_WASM_FUNCTION_BODY_DECODER_IMPL_H_ |
6 #define V8_WASM_FUNCTION_BODY_DECODER_IMPL_H_ | 6 #define V8_WASM_FUNCTION_BODY_DECODER_IMPL_H_ |
7 | 7 |
8 #include "src/wasm/decoder.h" | 8 #include "src/wasm/decoder.h" |
9 #include "src/wasm/wasm-opcodes.h" | 9 #include "src/wasm/wasm-opcodes.h" |
10 | 10 |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 template <bool checked> | 315 template <bool checked> |
316 struct SimdShiftOperand { | 316 struct SimdShiftOperand { |
317 uint8_t shift; | 317 uint8_t shift; |
318 unsigned length = 1; | 318 unsigned length = 1; |
319 | 319 |
320 inline SimdShiftOperand(Decoder* decoder, const byte* pc) { | 320 inline SimdShiftOperand(Decoder* decoder, const byte* pc) { |
321 shift = decoder->read_u8<checked>(pc + 2, "shift"); | 321 shift = decoder->read_u8<checked>(pc + 2, "shift"); |
322 } | 322 } |
323 }; | 323 }; |
324 | 324 |
325 // Operand for SIMD concatenation operations. | 325 // Operand for SIMD shuffle operations. |
326 template <bool checked> | 326 template <bool checked> |
327 struct SimdConcatOperand { | 327 struct SimdShuffleOperand { |
328 uint8_t bytes; | 328 uint8_t shuffle[16]; |
329 unsigned length; | 329 unsigned lanes; |
330 | 330 |
331 inline SimdConcatOperand(Decoder* decoder, const byte* pc) { | 331 inline SimdShuffleOperand(Decoder* decoder, const byte* pc, unsigned lanes_) { |
332 bytes = decoder->read_u8<checked>(pc + 2, "bytes"); | 332 lanes = lanes_; |
333 length = 1; | 333 for (unsigned i = 0; i < lanes; i++) { |
| 334 shuffle[i] = decoder->read_u8<checked>(pc + 2 + i, "shuffle"); |
| 335 } |
334 } | 336 } |
335 }; | 337 }; |
336 | 338 |
337 #undef CHECKED_COND | 339 #undef CHECKED_COND |
338 | 340 |
339 } // namespace wasm | 341 } // namespace wasm |
340 } // namespace internal | 342 } // namespace internal |
341 } // namespace v8 | 343 } // namespace v8 |
342 | 344 |
343 #endif // V8_WASM_FUNCTION_BODY_DECODER_IMPL_H_ | 345 #endif // V8_WASM_FUNCTION_BODY_DECODER_IMPL_H_ |
OLD | NEW |