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

Unified Diff: src/wasm/encoder.cc

Issue 1583603002: Add __init__ function to all modules created in asm-to-wasm (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@refactor
Patch Set: Created 4 years, 11 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 | « src/wasm/encoder.h ('k') | test/mjsunit/wasm/asm-wasm.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/encoder.cc
diff --git a/src/wasm/encoder.cc b/src/wasm/encoder.cc
index cba3e38fddd5ce8499360b46eb9eaa2ca88e6581..d8d36338b127fba815904d994b2de07f17192b5a 100644
--- a/src/wasm/encoder.cc
+++ b/src/wasm/encoder.cc
@@ -63,22 +63,14 @@ struct WasmFunctionBuilder::Type {
};
-WasmFunctionBuilder::WasmFunctionBuilder(Zone* zone, const unsigned char* name,
- int name_length)
+WasmFunctionBuilder::WasmFunctionBuilder(Zone* zone)
: return_type_(kAstI32),
locals_(zone),
exported_(0),
external_(0),
body_(zone),
local_indices_(zone),
- name_(zone) {
- if (name_length > 0) {
- for (int i = 0; i < name_length; i++) {
- name_.push_back(*(name + i));
- }
- name_.push_back('\0');
- }
-}
+ name_(zone) {}
uint16_t WasmFunctionBuilder::AddParam(LocalType type) {
@@ -152,6 +144,16 @@ void WasmFunctionBuilder::Exported(uint8_t flag) { exported_ = flag; }
void WasmFunctionBuilder::External(uint8_t flag) { external_ = flag; }
+void WasmFunctionBuilder::SetName(const unsigned char* name, int name_length) {
+ name_.clear();
+ if (name_length > 0) {
+ for (int i = 0; i < name_length; i++) {
+ name_.push_back(*(name + i));
+ }
+ name_.push_back('\0');
+ }
+}
+
WasmFunctionEncoder* WasmFunctionBuilder::Build(Zone* zone,
WasmModuleBuilder* mb) const {
@@ -348,10 +350,8 @@ WasmModuleBuilder::WasmModuleBuilder(Zone* zone)
signature_map_(zone) {}
-uint16_t WasmModuleBuilder::AddFunction(const unsigned char* name,
- int name_length) {
- functions_.push_back(new (zone_)
- WasmFunctionBuilder(zone_, name, name_length));
+uint16_t WasmModuleBuilder::AddFunction() {
+ functions_.push_back(new (zone_) WasmFunctionBuilder(zone_));
return static_cast<uint16_t>(functions_.size() - 1);
}
« no previous file with comments | « src/wasm/encoder.h ('k') | test/mjsunit/wasm/asm-wasm.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698