Index: src/compiler/wasm-compiler.cc |
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc |
index c81d2c8df2cd60f038d1c6853f6946491f7dab56..baa6b7b41b0d9bc0b9dd3baa1a004c7cc169f00c 100644 |
--- a/src/compiler/wasm-compiler.cc |
+++ b/src/compiler/wasm-compiler.cc |
@@ -2168,7 +2168,15 @@ |
uint32_t table_index = 0; |
wasm::FunctionSig* sig = module_->GetSignature(sig_index); |
- DCHECK(module_->IsValidTable(table_index)); |
+ if (!module_->IsValidTable(table_index)) { |
+ // No function table. Generate a trap and return a constant. |
+ trap_->AddTrapIfFalse(wasm::kTrapFuncInvalid, Int32Constant(0), position); |
+ (*rets) = Buffer(sig->return_count()); |
+ for (size_t i = 0; i < sig->return_count(); i++) { |
+ (*rets)[i] = trap_->GetTrapValue(sig->GetReturn(i)); |
+ } |
+ return trap_->GetTrapValue(sig); |
+ } |
EnsureFunctionTableNodes(); |
MachineOperatorBuilder* machine = jsgraph()->machine(); |