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/base/compiler-specific.h" |
| 9 #include "src/globals.h" |
8 #include "src/signature.h" | 10 #include "src/signature.h" |
9 #include "src/wasm/decoder.h" | 11 #include "src/wasm/decoder.h" |
10 #include "src/wasm/wasm-opcodes.h" | 12 #include "src/wasm/wasm-opcodes.h" |
11 #include "src/wasm/wasm-result.h" | 13 #include "src/wasm/wasm-result.h" |
12 | 14 |
13 namespace v8 { | 15 namespace v8 { |
14 namespace internal { | 16 namespace internal { |
15 | 17 |
16 class BitVector; // forward declaration | 18 class BitVector; // forward declaration |
17 | 19 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 uint32_t total_local_count; | 350 uint32_t total_local_count; |
349 | 351 |
350 // List of {local type, count} pairs. | 352 // List of {local type, count} pairs. |
351 ZoneVector<std::pair<LocalType, uint32_t>> local_types; | 353 ZoneVector<std::pair<LocalType, uint32_t>> local_types; |
352 | 354 |
353 // Constructor initializes the vector. | 355 // Constructor initializes the vector. |
354 explicit AstLocalDecls(Zone* zone) | 356 explicit AstLocalDecls(Zone* zone) |
355 : decls_encoded_size(0), total_local_count(0), local_types(zone) {} | 357 : decls_encoded_size(0), total_local_count(0), local_types(zone) {} |
356 }; | 358 }; |
357 | 359 |
358 bool DecodeLocalDecls(AstLocalDecls& decls, const byte* start, const byte* end); | 360 V8_EXPORT_PRIVATE bool DecodeLocalDecls(AstLocalDecls& decls, const byte* start, |
359 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 361 const byte* end); |
360 const byte* start, const byte* end); | 362 V8_EXPORT_PRIVATE BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, |
| 363 size_t num_locals, |
| 364 const byte* start, |
| 365 const byte* end); |
361 | 366 |
362 // Computes the length of the opcode at the given address. | 367 // Computes the length of the opcode at the given address. |
363 unsigned OpcodeLength(const byte* pc, const byte* end); | 368 V8_EXPORT_PRIVATE unsigned OpcodeLength(const byte* pc, const byte* end); |
364 | 369 |
365 // A simple forward iterator for bytecodes. | 370 // A simple forward iterator for bytecodes. |
366 class BytecodeIterator : public Decoder { | 371 class V8_EXPORT_PRIVATE BytecodeIterator : public NON_EXPORTED_BASE(Decoder) { |
367 public: | 372 public: |
368 // If one wants to iterate over the bytecode without looking at {pc_offset()}. | 373 // If one wants to iterate over the bytecode without looking at {pc_offset()}. |
369 class iterator { | 374 class iterator { |
370 public: | 375 public: |
371 inline iterator& operator++() { | 376 inline iterator& operator++() { |
372 DCHECK_LT(ptr_, end_); | 377 DCHECK_LT(ptr_, end_); |
373 ptr_ += OpcodeLength(ptr_, end_); | 378 ptr_ += OpcodeLength(ptr_, end_); |
374 return *this; | 379 return *this; |
375 } | 380 } |
376 inline WasmOpcode operator*() { | 381 inline WasmOpcode operator*() { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 418 } |
414 | 419 |
415 bool has_next() { return pc_ < end_; } | 420 bool has_next() { return pc_ < end_; } |
416 }; | 421 }; |
417 | 422 |
418 } // namespace wasm | 423 } // namespace wasm |
419 } // namespace internal | 424 } // namespace internal |
420 } // namespace v8 | 425 } // namespace v8 |
421 | 426 |
422 #endif // V8_WASM_AST_DECODER_H_ | 427 #endif // V8_WASM_AST_DECODER_H_ |
OLD | NEW |