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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 template <bool checked> | 306 template <bool checked> |
307 struct SimdShiftOperand { | 307 struct SimdShiftOperand { |
308 uint8_t shift; | 308 uint8_t shift; |
309 unsigned length = 1; | 309 unsigned length = 1; |
310 | 310 |
311 inline SimdShiftOperand(Decoder* decoder, const byte* pc) { | 311 inline SimdShiftOperand(Decoder* decoder, const byte* pc) { |
312 shift = decoder->read_u8<checked>(pc + 2, "shift"); | 312 shift = decoder->read_u8<checked>(pc + 2, "shift"); |
313 } | 313 } |
314 }; | 314 }; |
315 | 315 |
316 // Operand for SIMD shuffle operations. | 316 // Operand for SIMD S8x16 shuffle operations. |
317 template <bool checked> | 317 template <bool checked> |
318 struct SimdShuffleOperand { | 318 struct Simd8x16ShuffleOperand { |
319 uint8_t shuffle[16]; | 319 uint8_t shuffle[kSimd128Size]; |
320 unsigned lanes; | |
321 | 320 |
322 inline SimdShuffleOperand(Decoder* decoder, const byte* pc, unsigned lanes_) { | 321 inline Simd8x16ShuffleOperand(Decoder* decoder, const byte* pc) { |
323 lanes = lanes_; | 322 for (uint32_t i = 0; i < kSimd128Size; ++i) { |
324 for (unsigned i = 0; i < lanes; i++) { | |
325 shuffle[i] = decoder->read_u8<checked>(pc + 2 + i, "shuffle"); | 323 shuffle[i] = decoder->read_u8<checked>(pc + 2 + i, "shuffle"); |
326 } | 324 } |
327 } | 325 } |
328 }; | 326 }; |
329 | 327 |
330 #undef CHECKED_COND | 328 #undef CHECKED_COND |
331 | 329 |
332 } // namespace wasm | 330 } // namespace wasm |
333 } // namespace internal | 331 } // namespace internal |
334 } // namespace v8 | 332 } // namespace v8 |
335 | 333 |
336 #endif // V8_WASM_FUNCTION_BODY_DECODER_IMPL_H_ | 334 #endif // V8_WASM_FUNCTION_BODY_DECODER_IMPL_H_ |
OLD | NEW |