| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_H_ | 5 #ifndef V8_WASM_FUNCTION_BODY_DECODER_H_ |
| 6 #define V8_WASM_FUNCTION_BODY_DECODER_H_ | 6 #define V8_WASM_FUNCTION_BODY_DECODER_H_ |
| 7 | 7 |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "src/base/compiler-specific.h" | 10 #include "src/base/compiler-specific.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 unsigned length; | 63 unsigned length; |
| 64 inline ImmI64Operand(Decoder* decoder, const byte* pc) { | 64 inline ImmI64Operand(Decoder* decoder, const byte* pc) { |
| 65 value = decoder->checked_read_i64v(pc, 1, &length, "immi64"); | 65 value = decoder->checked_read_i64v(pc, 1, &length, "immi64"); |
| 66 } | 66 } |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 struct ImmF32Operand { | 69 struct ImmF32Operand { |
| 70 float value; | 70 float value; |
| 71 unsigned length; | 71 unsigned length; |
| 72 inline ImmF32Operand(Decoder* decoder, const byte* pc) { | 72 inline ImmF32Operand(Decoder* decoder, const byte* pc) { |
| 73 // Avoid bit_cast because it might not preserve the signalling bit of a NaN. | 73 value = bit_cast<float>(decoder->checked_read_u32(pc, 1, "immf32")); |
| 74 uint32_t tmp = decoder->checked_read_u32(pc, 1, "immf32"); | |
| 75 value = *reinterpret_cast<float*>(&tmp); | |
| 76 length = 4; | 74 length = 4; |
| 77 } | 75 } |
| 78 }; | 76 }; |
| 79 | 77 |
| 80 struct ImmF64Operand { | 78 struct ImmF64Operand { |
| 81 double value; | 79 double value; |
| 82 unsigned length; | 80 unsigned length; |
| 83 inline ImmF64Operand(Decoder* decoder, const byte* pc) { | 81 inline ImmF64Operand(Decoder* decoder, const byte* pc) { |
| 84 // Avoid bit_cast because it might not preserve the signalling bit of a NaN. | 82 value = bit_cast<double>(decoder->checked_read_u64(pc, 1, "immf64")); |
| 85 uint64_t tmp = decoder->checked_read_u64(pc, 1, "immf64"); | |
| 86 value = *reinterpret_cast<double*>(&tmp); | |
| 87 length = 8; | 83 length = 8; |
| 88 } | 84 } |
| 89 }; | 85 }; |
| 90 | 86 |
| 91 struct GlobalIndexOperand { | 87 struct GlobalIndexOperand { |
| 92 uint32_t index; | 88 uint32_t index; |
| 93 ValueType type; | 89 ValueType type; |
| 94 const WasmGlobal* global; | 90 const WasmGlobal* global; |
| 95 unsigned length; | 91 unsigned length; |
| 96 | 92 |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 } | 464 } |
| 469 | 465 |
| 470 bool has_next() { return pc_ < end_; } | 466 bool has_next() { return pc_ < end_; } |
| 471 }; | 467 }; |
| 472 | 468 |
| 473 } // namespace wasm | 469 } // namespace wasm |
| 474 } // namespace internal | 470 } // namespace internal |
| 475 } // namespace v8 | 471 } // namespace v8 |
| 476 | 472 |
| 477 #endif // V8_WASM_FUNCTION_BODY_DECODER_H_ | 473 #endif // V8_WASM_FUNCTION_BODY_DECODER_H_ |
| OLD | NEW |