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

Unified Diff: src/wasm/wasm-module.cc

Issue 2472103002: [wasm] Store the function_index in the js-to-wasm wrapper instead of the export index (Closed)
Patch Set: Rename variables Created 4 years, 1 month 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/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index aa385f824e6917b38815aadf8d047c4fa5964ea4..64f5663aeb55c0a1fa74914ab16a65f139943169 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -1627,7 +1627,7 @@ class WasmInstanceBuilder {
desc.set_writable(false);
// Process each export in the export table.
- int func_index = 0;
+ int export_index = 0;
for (auto exp : module_->export_table) {
Handle<String> name =
ExtractStringFromModuleBytes(isolate_, compiled_module_,
@@ -1637,20 +1637,20 @@ class WasmInstanceBuilder {
case kExternalFunction: {
// Wrap and export the code as a JSFunction.
WasmFunction& function = module_->functions[exp.index];
- int export_index =
- static_cast<int>(module_->functions.size() + func_index);
+ int func_index =
+ static_cast<int>(module_->functions.size() + export_index);
Handle<JSFunction> js_function = js_wrappers_[exp.index];
if (js_function.is_null()) {
// Wrap the exported code as a JSFunction.
Handle<Code> export_code =
- code_table->GetValueChecked<Code>(isolate_, export_index);
- js_function =
- WrapExportCodeAsJSFunction(isolate_, export_code, name,
- function.sig, func_index, instance);
+ code_table->GetValueChecked<Code>(isolate_, func_index);
+ js_function = WrapExportCodeAsJSFunction(
+ isolate_, export_code, name, function.sig, function.func_index,
+ instance);
js_wrappers_[exp.index] = js_function;
}
desc.set_value(js_function);
- func_index++;
+ export_index++;
break;
}
case kExternalTable: {
« no previous file with comments | « no previous file | test/mjsunit/wasm/test-import-export-wrapper.js » ('j') | test/mjsunit/wasm/test-import-export-wrapper.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698