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

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

Issue 2439613003: [wasm] Fix canonicalization bug for function signatures in CallIndirect. (Closed)
Patch Set: Created 4 years, 2 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 | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/wasm-compiler.cc
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
index 983332e1a8ff6fe731a7dc6fa501884104ba375f..7ea4b2088f2d2626da747378f4feaab559ee55e6 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -2176,10 +2176,11 @@ Node* WasmGraphBuilder::CallIndirect(uint32_t index, Node** args, Node*** rets,
Int32Constant(kPointerSizeLog2)),
Int32Constant(fixed_offset)),
*effect_, *control_);
- int32_t key = module_->module->function_tables[0].map.Find(sig);
- DCHECK_GE(key, 0);
- Node* sig_match = graph()->NewNode(machine->WordEqual(), load_sig,
- jsgraph()->SmiConstant(key));
+ auto map = const_cast<wasm::SignatureMap&>(
+ module_->module->function_tables[0].map);
+ Node* sig_match = graph()->NewNode(
+ machine->WordEqual(), load_sig,
+ jsgraph()->SmiConstant(static_cast<int>(map.FindOrInsert(sig))));
trap_->AddTrapIfFalse(wasm::kTrapFuncSigMismatch, sig_match, position);
}
« no previous file with comments | « no previous file | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698