| 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_FUNCTION_BODY_DECODER_H_ | 5 #ifndef V8_WASM_FUNCTION_BODY_DECODER_H_ |
| 6 #define V8_WASM_FUNCTION_BODY_DECODER_H_ | 6 #define V8_WASM_FUNCTION_BODY_DECODER_H_ |
| 7 | 7 |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "src/base/compiler-specific.h" | 10 #include "src/base/compiler-specific.h" |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 | 352 |
| 353 inline DecodeResult BuildTFGraph(AccountingAllocator* allocator, | 353 inline DecodeResult BuildTFGraph(AccountingAllocator* allocator, |
| 354 TFBuilder* builder, FunctionSig* sig, | 354 TFBuilder* builder, FunctionSig* sig, |
| 355 const byte* start, const byte* end) { | 355 const byte* start, const byte* end) { |
| 356 FunctionBody body = {sig, nullptr, start, end}; | 356 FunctionBody body = {sig, nullptr, start, end}; |
| 357 return BuildTFGraph(allocator, builder, body); | 357 return BuildTFGraph(allocator, builder, body); |
| 358 } | 358 } |
| 359 | 359 |
| 360 struct BodyLocalDecls { | 360 struct BodyLocalDecls { |
| 361 // The size of the encoded declarations. | 361 // The size of the encoded declarations. |
| 362 uint32_t decls_encoded_size; // size of encoded declarations | 362 uint32_t encoded_size; // size of encoded declarations |
| 363 | 363 |
| 364 // Total number of locals. | 364 ZoneVector<ValueType> type_list; |
| 365 uint32_t total_local_count; | |
| 366 | |
| 367 // List of {local type, count} pairs. | |
| 368 ZoneVector<std::pair<ValueType, uint32_t>> local_types; | |
| 369 | 365 |
| 370 // Constructor initializes the vector. | 366 // Constructor initializes the vector. |
| 371 explicit BodyLocalDecls(Zone* zone) | 367 explicit BodyLocalDecls(Zone* zone) : encoded_size(0), type_list(zone) {} |
| 372 : decls_encoded_size(0), total_local_count(0), local_types(zone) {} | |
| 373 }; | 368 }; |
| 374 | 369 |
| 375 V8_EXPORT_PRIVATE bool DecodeLocalDecls(BodyLocalDecls& decls, | 370 V8_EXPORT_PRIVATE bool DecodeLocalDecls(BodyLocalDecls* decls, |
| 376 const byte* start, const byte* end); | 371 const byte* start, const byte* end); |
| 377 V8_EXPORT_PRIVATE BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, | 372 V8_EXPORT_PRIVATE BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, |
| 378 size_t num_locals, | 373 size_t num_locals, |
| 379 const byte* start, | 374 const byte* start, |
| 380 const byte* end); | 375 const byte* end); |
| 381 | 376 |
| 382 // Computes the length of the opcode at the given address. | 377 // Computes the length of the opcode at the given address. |
| 383 V8_EXPORT_PRIVATE unsigned OpcodeLength(const byte* pc, const byte* end); | 378 V8_EXPORT_PRIVATE unsigned OpcodeLength(const byte* pc, const byte* end); |
| 384 | 379 |
| 385 // A simple forward iterator for bytecodes. | 380 // A simple forward iterator for bytecodes. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 } | 464 } |
| 470 | 465 |
| 471 bool has_next() { return pc_ < end_; } | 466 bool has_next() { return pc_ < end_; } |
| 472 }; | 467 }; |
| 473 | 468 |
| 474 } // namespace wasm | 469 } // namespace wasm |
| 475 } // namespace internal | 470 } // namespace internal |
| 476 } // namespace v8 | 471 } // namespace v8 |
| 477 | 472 |
| 478 #endif // V8_WASM_FUNCTION_BODY_DECODER_H_ | 473 #endif // V8_WASM_FUNCTION_BODY_DECODER_H_ |
| OLD | NEW |