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 = | 49 value = decoder->checked_read_i32v(pc, 1, &length, "immi32"); |
50 bit_cast<int32_t>(decoder->checked_read_i32v(pc, 1, &length, "immi32")); | |
51 } | 50 } |
52 }; | 51 }; |
53 | 52 |
54 struct ImmI64Operand { | 53 struct ImmI64Operand { |
55 int64_t value; | 54 int64_t value; |
56 int length; | 55 int length; |
57 inline ImmI64Operand(Decoder* decoder, const byte* pc) { | 56 inline ImmI64Operand(Decoder* decoder, const byte* pc) { |
58 value = | 57 value = decoder->checked_read_i64v(pc, 1, &length, "immi64"); |
59 bit_cast<int64_t>(decoder->checked_read_i64v(pc, 1, &length, "immi64")); | |
60 } | 58 } |
61 }; | 59 }; |
62 | 60 |
63 struct ImmF32Operand { | 61 struct ImmF32Operand { |
64 float value; | 62 float value; |
65 int length; | 63 int length; |
66 inline ImmF32Operand(Decoder* decoder, const byte* pc) { | 64 inline ImmF32Operand(Decoder* decoder, const byte* pc) { |
67 value = bit_cast<float>(decoder->checked_read_u32(pc, 1, "immf32")); | 65 value = bit_cast<float>(decoder->checked_read_u32(pc, 1, "immf32")); |
68 length = 4; | 66 length = 4; |
69 } | 67 } |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 int OpcodeLength(const byte* pc, const byte* end); | 225 int OpcodeLength(const byte* pc, const byte* end); |
228 | 226 |
229 // Computes the arity (number of sub-nodes) of the opcode at the given address. | 227 // Computes the arity (number of sub-nodes) of the opcode at the given address. |
230 int OpcodeArity(ModuleEnv* module, FunctionSig* sig, const byte* pc, | 228 int OpcodeArity(ModuleEnv* module, FunctionSig* sig, const byte* pc, |
231 const byte* end); | 229 const byte* end); |
232 } // namespace wasm | 230 } // namespace wasm |
233 } // namespace internal | 231 } // namespace internal |
234 } // namespace v8 | 232 } // namespace v8 |
235 | 233 |
236 #endif // V8_WASM_AST_DECODER_H_ | 234 #endif // V8_WASM_AST_DECODER_H_ |
OLD | NEW |