Index: src/wasm/wasm-module.cc |
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc |
index 75a556971d521f7b515201b551598f77fa4c9364..65ab67213031fee7ce76ae69414d8e023d35e5dd 100644 |
--- a/src/wasm/wasm-module.cc |
+++ b/src/wasm/wasm-module.cc |
@@ -874,6 +874,10 @@ static Handle<Code> UnwrapImportWrapper(Handle<Object> target) { |
target->kind() == Code::WASM_TO_JS_FUNCTION) { |
++found; |
code = handle(target); |
+ } else if (target->kind() == Code::WASM_INTERPRETER_ENTRY) { |
+ // Don't call the interpreter entry directly, otherwise we cannot disable |
+ // the breakpoint later by patching the exported code. |
+ return Handle<Code>::null(); |
} |
} |
DCHECK_EQ(1, found); |
@@ -888,18 +892,18 @@ static Handle<Code> CompileImportWrapper(Isolate* isolate, int index, |
ModuleOrigin origin) { |
WasmFunction* other_func = GetWasmFunctionForImportWrapper(isolate, target); |
if (other_func) { |
- if (sig->Equals(other_func->sig)) { |
- // Signature matched. Unwrap the JS->WASM wrapper and return the raw |
- // WASM function code. |
- return UnwrapImportWrapper(target); |
- } else { |
- return Handle<Code>::null(); |
- } |
- } else { |
- // Signature mismatch. Compile a new wrapper for the new signature. |
- return compiler::CompileWasmToJSWrapper(isolate, target, sig, index, |
- module_name, import_name, origin); |
- } |
+ if (!sig->Equals(other_func->sig)) return Handle<Code>::null(); |
+ // Signature matched. Unwrap the JS->WASM wrapper and return the raw |
+ // WASM function code. |
+ Handle<Code> code = UnwrapImportWrapper(target); |
+ // If we got no code (imported function is being debugged), fall through |
+ // to CompileWasmToJSWrapper. |
+ if (!code.is_null()) return code; |
+ } |
+ // No wasm function or being debugged. Compile a new wrapper for the new |
+ // signature. |
+ return compiler::CompileWasmToJSWrapper(isolate, target, sig, index, |
+ module_name, import_name, origin); |
} |
static void UpdateDispatchTablesInternal(Isolate* isolate, |