Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1185)

Unified Diff: src/wasm/ast-decoder.h

Issue 1856413002: [wasm] Refactor decoding of local declarations and make more robust. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/wasm/ast-decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/ast-decoder.h
diff --git a/src/wasm/ast-decoder.h b/src/wasm/ast-decoder.h
index 4a02ea5abfec73bc487141a6622a7190ba4aa55f..5376e7bfdd9db7ab6e0521726b77c77e9f9013bc 100644
--- a/src/wasm/ast-decoder.h
+++ b/src/wasm/ast-decoder.h
@@ -220,8 +220,22 @@ enum ReadUnsignedLEB128ErrorCode { kNoError, kInvalidLEB128, kMissingLEB128 };
ReadUnsignedLEB128ErrorCode ReadUnsignedLEB128Operand(const byte*, const byte*,
int*, uint32_t*);
-std::vector<LocalType>* DecodeLocalDeclsForTesting(
- base::AccountingAllocator* allocator, const byte* start, const byte* end);
+struct AstLocalDecls {
+ // The size of the encoded declarations.
+ uint32_t decls_encoded_size; // size of encoded declarations
+
+ // Total number of locals.
+ uint32_t total_local_count;
+
+ // List of {local type, count} pairs.
+ ZoneVector<std::pair<LocalType, uint32_t>> local_types;
+
+ // Constructor initializes the vector.
+ explicit AstLocalDecls(Zone* zone)
+ : decls_encoded_size(0), total_local_count(0), local_types(zone) {}
+};
+
+bool DecodeLocalDecls(AstLocalDecls& decls, const byte* start, const byte* end);
BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
const byte* start, const byte* end);
« no previous file with comments | « no previous file | src/wasm/ast-decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698