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

Unified Diff: src/wasm/wasm-module-builder.h

Issue 2384483002: [wasm] Refactor handling of data segments in WasmModuleBuilder. (Closed)
Patch Set: Created 4 years, 3 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/wasm-module-builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module-builder.h
diff --git a/src/wasm/wasm-module-builder.h b/src/wasm/wasm-module-builder.h
index 358666908b0a40fc3cf482ea0ad3df0b832fb775..915de43383bc0d05c51be49a769a37bfef0cee46 100644
--- a/src/wasm/wasm-module-builder.h
+++ b/src/wasm/wasm-module-builder.h
@@ -193,24 +193,6 @@ class WasmTemporary {
uint32_t index_;
};
-// TODO(titzer): kill!
-class WasmDataSegmentEncoder : public ZoneObject {
- public:
- WasmDataSegmentEncoder(Zone* zone, const byte* data, uint32_t size,
- uint32_t dest);
- void Write(ZoneBuffer& buffer) const;
-
- private:
- ZoneVector<byte> data_;
- uint32_t dest_;
-};
-
-struct WasmFunctionImport {
- uint32_t sig_index;
- const char* name;
- int name_length;
-};
-
class V8_EXPORT_PRIVATE WasmModuleBuilder : public ZoneObject {
public:
explicit WasmModuleBuilder(Zone* zone);
@@ -223,7 +205,7 @@ class V8_EXPORT_PRIVATE WasmModuleBuilder : public ZoneObject {
}
WasmFunctionBuilder* AddFunction(FunctionSig* sig = nullptr);
uint32_t AddGlobal(LocalType type, bool exported, bool mutability = true);
- void AddDataSegment(WasmDataSegmentEncoder* data);
+ void AddDataSegment(const byte* data, uint32_t size, uint32_t dest);
uint32_t AddSignature(FunctionSig* sig);
void AddIndirectFunction(uint32_t index);
void MarkStartFunction(WasmFunctionBuilder* builder);
@@ -241,14 +223,31 @@ class V8_EXPORT_PRIVATE WasmModuleBuilder : public ZoneObject {
FunctionSig* GetSignature(uint32_t index) { return signatures_[index]; }
private:
+ struct WasmFunctionImport {
+ uint32_t sig_index;
+ const char* name;
+ int name_length;
+ };
+
+ struct WasmGlobal {
+ LocalType type;
+ bool exported;
+ bool mutability;
+ };
+
+ struct WasmDataSegment {
+ ZoneVector<byte> data;
+ uint32_t dest;
+ };
+
friend class WasmFunctionBuilder;
Zone* zone_;
ZoneVector<FunctionSig*> signatures_;
ZoneVector<WasmFunctionImport> imports_;
ZoneVector<WasmFunctionBuilder*> functions_;
- ZoneVector<WasmDataSegmentEncoder*> data_segments_;
+ ZoneVector<WasmDataSegment> data_segments_;
ZoneVector<uint32_t> indirect_functions_;
- ZoneVector<std::tuple<LocalType, bool, bool>> globals_;
+ ZoneVector<WasmGlobal> globals_;
SignatureMap signature_map_;
int start_function_index_;
};
« no previous file with comments | « no previous file | src/wasm/wasm-module-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698