| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 unsigned len2 = 0; | 98 unsigned len2 = 0; |
| 99 arity = decoder->checked_read_u32v(pc, 1, &len1, "argument count"); | 99 arity = decoder->checked_read_u32v(pc, 1, &len1, "argument count"); |
| 100 depth = decoder->checked_read_u32v(pc, 1 + len1, &len2, "break depth"); | 100 depth = decoder->checked_read_u32v(pc, 1 + len1, &len2, "break depth"); |
| 101 length = len1 + len2; | 101 length = len1 + len2; |
| 102 target = nullptr; | 102 target = nullptr; |
| 103 } | 103 } |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 struct CallIndirectOperand { | 106 struct CallIndirectOperand { |
| 107 uint32_t arity; | 107 uint32_t arity; |
| 108 uint32_t index; | 108 uint32_t sig_index; |
| 109 FunctionSig* sig; | 109 FunctionSig* sig; |
| 110 uint32_t table_index; |
| 111 FunctionSig* table; |
| 110 unsigned length; | 112 unsigned length; |
| 111 inline CallIndirectOperand(Decoder* decoder, const byte* pc) { | 113 inline CallIndirectOperand(Decoder* decoder, const byte* pc) { |
| 112 unsigned len1 = 0; | 114 unsigned len1 = 0; |
| 113 unsigned len2 = 0; | 115 unsigned len2 = 0; |
| 116 unsigned len3 = 0; |
| 114 arity = decoder->checked_read_u32v(pc, 1, &len1, "argument count"); | 117 arity = decoder->checked_read_u32v(pc, 1, &len1, "argument count"); |
| 115 index = decoder->checked_read_u32v(pc, 1 + len1, &len2, "signature index"); | 118 sig_index = |
| 116 length = len1 + len2; | 119 decoder->checked_read_u32v(pc, 1 + len1, &len2, "signature index"); |
| 120 table_index = |
| 121 decoder->checked_read_u32v(pc, 1 + len1 + len2, &len3, "table index"); |
| 122 length = len1 + len2 + len3; |
| 117 sig = nullptr; | 123 sig = nullptr; |
| 124 table = nullptr; |
| 118 } | 125 } |
| 119 }; | 126 }; |
| 120 | 127 |
| 121 struct CallFunctionOperand { | 128 struct CallFunctionOperand { |
| 122 uint32_t arity; | 129 uint32_t arity; |
| 123 uint32_t index; | 130 uint32_t index; |
| 124 FunctionSig* sig; | 131 FunctionSig* sig; |
| 125 unsigned length; | 132 unsigned length; |
| 126 inline CallFunctionOperand(Decoder* decoder, const byte* pc) { | 133 inline CallFunctionOperand(Decoder* decoder, const byte* pc) { |
| 127 unsigned len1 = 0; | 134 unsigned len1 = 0; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 } | 337 } |
| 331 | 338 |
| 332 bool has_next() { return pc_ < end_; } | 339 bool has_next() { return pc_ < end_; } |
| 333 }; | 340 }; |
| 334 | 341 |
| 335 } // namespace wasm | 342 } // namespace wasm |
| 336 } // namespace internal | 343 } // namespace internal |
| 337 } // namespace v8 | 344 } // namespace v8 |
| 338 | 345 |
| 339 #endif // V8_WASM_AST_DECODER_H_ | 346 #endif // V8_WASM_AST_DECODER_H_ |
| OLD | NEW |