| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 struct FunctionIndexOperand { | 125 struct FunctionIndexOperand { |
| 126 uint32_t index; | 126 uint32_t index; |
| 127 FunctionSig* sig; | 127 FunctionSig* sig; |
| 128 int length; | 128 int length; |
| 129 inline FunctionIndexOperand(Decoder* decoder, const byte* pc) { | 129 inline FunctionIndexOperand(Decoder* decoder, const byte* pc) { |
| 130 index = decoder->checked_read_u32v(pc, 1, &length, "function index"); | 130 index = decoder->checked_read_u32v(pc, 1, &length, "function index"); |
| 131 sig = nullptr; | 131 sig = nullptr; |
| 132 } | 132 } |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 struct ImportIndexOperand { |
| 136 uint32_t index; |
| 137 FunctionSig* sig; |
| 138 int length; |
| 139 inline ImportIndexOperand(Decoder* decoder, const byte* pc) { |
| 140 index = decoder->checked_read_u32v(pc, 1, &length, "import index"); |
| 141 sig = nullptr; |
| 142 } |
| 143 }; |
| 144 |
| 135 struct TableSwitchOperand { | 145 struct TableSwitchOperand { |
| 136 uint32_t case_count; | 146 uint32_t case_count; |
| 137 uint32_t table_count; | 147 uint32_t table_count; |
| 138 const byte* table; | 148 const byte* table; |
| 139 int length; | 149 int length; |
| 140 inline TableSwitchOperand(Decoder* decoder, const byte* pc) { | 150 inline TableSwitchOperand(Decoder* decoder, const byte* pc) { |
| 141 case_count = decoder->checked_read_u16(pc, 1, "expected #cases"); | 151 case_count = decoder->checked_read_u16(pc, 1, "expected #cases"); |
| 142 table_count = decoder->checked_read_u16(pc, 3, "expected #entries"); | 152 table_count = decoder->checked_read_u16(pc, 3, "expected #entries"); |
| 143 length = 4 + table_count * 2; | 153 length = 4 + table_count * 2; |
| 144 | 154 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 // Computes the length of the opcode at the given address. | 274 // Computes the length of the opcode at the given address. |
| 265 int OpcodeLength(const byte* pc, const byte* end); | 275 int OpcodeLength(const byte* pc, const byte* end); |
| 266 | 276 |
| 267 // 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. |
| 268 int OpcodeArity(FunctionEnv* env, const byte* pc, const byte* end); | 278 int OpcodeArity(FunctionEnv* env, const byte* pc, const byte* end); |
| 269 } // namespace wasm | 279 } // namespace wasm |
| 270 } // namespace internal | 280 } // namespace internal |
| 271 } // namespace v8 | 281 } // namespace v8 |
| 272 | 282 |
| 273 #endif // V8_WASM_AST_DECODER_H_ | 283 #endif // V8_WASM_AST_DECODER_H_ |
| OLD | NEW |