| 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_AST_DECODER_H_ | 5 #ifndef V8_WASM_AST_DECODER_H_ |
| 6 #define V8_WASM_AST_DECODER_H_ | 6 #define V8_WASM_AST_DECODER_H_ |
| 7 | 7 |
| 8 #include "src/signature.h" | 8 #include "src/signature.h" |
| 9 #include "src/wasm/decoder.h" | 9 #include "src/wasm/decoder.h" |
| 10 #include "src/wasm/wasm-opcodes.h" | 10 #include "src/wasm/wasm-opcodes.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 inline ImmI8Operand(Decoder* decoder, const byte* pc) { | 39 inline ImmI8Operand(Decoder* decoder, const byte* pc) { |
| 40 value = bit_cast<int8_t>(decoder->checked_read_u8(pc, 1, "immi8")); | 40 value = bit_cast<int8_t>(decoder->checked_read_u8(pc, 1, "immi8")); |
| 41 length = 1; | 41 length = 1; |
| 42 } | 42 } |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 struct ImmI32Operand { | 45 struct ImmI32Operand { |
| 46 int32_t value; | 46 int32_t value; |
| 47 int length; | 47 int length; |
| 48 inline ImmI32Operand(Decoder* decoder, const byte* pc) { | 48 inline ImmI32Operand(Decoder* decoder, const byte* pc) { |
| 49 value = bit_cast<int32_t>(decoder->checked_read_u32(pc, 1, "immi32")); | 49 value = |
| 50 length = 4; | 50 bit_cast<int32_t>(decoder->checked_read_i32v(pc, 1, &length, "immi32")); |
| 51 } | 51 } |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 struct ImmI64Operand { | 54 struct ImmI64Operand { |
| 55 int64_t value; | 55 int64_t value; |
| 56 int length; | 56 int length; |
| 57 inline ImmI64Operand(Decoder* decoder, const byte* pc) { | 57 inline ImmI64Operand(Decoder* decoder, const byte* pc) { |
| 58 value = bit_cast<int64_t>(decoder->checked_read_u64(pc, 1, "immi64")); | 58 value = |
| 59 length = 8; | 59 bit_cast<int64_t>(decoder->checked_read_i64v(pc, 1, &length, "immi64")); |
| 60 } | 60 } |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 struct ImmF32Operand { | 63 struct ImmF32Operand { |
| 64 float value; | 64 float value; |
| 65 int length; | 65 int length; |
| 66 inline ImmF32Operand(Decoder* decoder, const byte* pc) { | 66 inline ImmF32Operand(Decoder* decoder, const byte* pc) { |
| 67 value = bit_cast<float>(decoder->checked_read_u32(pc, 1, "immf32")); | 67 value = bit_cast<float>(decoder->checked_read_u32(pc, 1, "immf32")); |
| 68 length = 4; | 68 length = 4; |
| 69 } | 69 } |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 // Computes the length of the opcode at the given address. | 274 // Computes the length of the opcode at the given address. |
| 275 int OpcodeLength(const byte* pc, const byte* end); | 275 int OpcodeLength(const byte* pc, const byte* end); |
| 276 | 276 |
| 277 // Computes the arity (number of sub-nodes) of the opcode at the given address. | 277 // Computes the arity (number of sub-nodes) of the opcode at the given address. |
| 278 int OpcodeArity(FunctionEnv* env, const byte* pc, const byte* end); | 278 int OpcodeArity(FunctionEnv* env, const byte* pc, const byte* end); |
| 279 } // namespace wasm | 279 } // namespace wasm |
| 280 } // namespace internal | 280 } // namespace internal |
| 281 } // namespace v8 | 281 } // namespace v8 |
| 282 | 282 |
| 283 #endif // V8_WASM_AST_DECODER_H_ | 283 #endif // V8_WASM_AST_DECODER_H_ |
| OLD | NEW |