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

Unified Diff: src/wasm/encoder.h

Issue 1763433002: [wasm] Rework encoding of local declarations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
Index: src/wasm/encoder.h
diff --git a/src/wasm/encoder.h b/src/wasm/encoder.h
index 1afedcb9d6dd4a8174f165a92d461e21da3e56f5..cf6a2b667b38e889dba125eebe59938525f331ba 100644
--- a/src/wasm/encoder.h
+++ b/src/wasm/encoder.h
@@ -10,6 +10,7 @@
#include "src/base/smart-pointers.h"
+#include "src/wasm/wasm-macro-gen.h"
#include "src/wasm/wasm-module.h"
#include "src/wasm/wasm-opcodes.h"
#include "src/wasm/wasm-result.h"
@@ -23,6 +24,9 @@ class WasmModuleBuilder;
class WasmFunctionEncoder : public ZoneObject {
public:
uint32_t HeaderSize() const;
+ uint32_t LocalDeclSize() const {
+ return static_cast<uint32_t>(local_decls_.Size());
+ }
uint32_t BodySize() const;
uint32_t NameSize() const;
void Serialize(byte* buffer, byte** header, byte** body) const;
@@ -33,20 +37,12 @@ class WasmFunctionEncoder : public ZoneObject {
friend class WasmFunctionBuilder;
uint16_t signature_index_;
ZoneVector<LocalType> params_;
- uint16_t local_i32_count_;
- uint16_t local_i64_count_;
- uint16_t local_f32_count_;
- uint16_t local_f64_count_;
+ LocalDeclEncoder local_decls_;
bool exported_;
bool external_;
ZoneVector<uint8_t> body_;
ZoneVector<char> name_;
- bool HasLocals() const {
- return (local_i32_count_ + local_i64_count_ + local_f32_count_ +
- local_f64_count_) > 0;
- }
-
bool HasName() const { return (exported_ || external_) && name_.size() > 0; }
};

Powered by Google App Engine
This is Rietveld 408576698