Index: src/runtime/runtime-wasm.cc |
diff --git a/src/runtime/runtime-wasm.cc b/src/runtime/runtime-wasm.cc |
index 46782cf575c1971bda284c87771f0a2017029948..237235ef7af5647efb1e845751a9f1d7866bacd0 100644 |
--- a/src/runtime/runtime-wasm.cc |
+++ b/src/runtime/runtime-wasm.cc |
@@ -152,5 +152,34 @@ RUNTIME_FUNCTION(Runtime_WasmGetCaughtExceptionValue) { |
return exception; |
} |
+RUNTIME_FUNCTION(Runtime_GetWasmInterpreterBuffer) { |
+ DCHECK(args.length() == 2); |
+ HandleScope scope(isolate); |
+ CONVERT_NUMBER_CHECKED(int32_t, func_index, Int32, args[0]); |
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, instance_obj, 1); |
+ CHECK(WasmInstanceObject::IsWasmInstanceObject(*instance_obj)); |
+ |
+ Handle<WasmInstanceObject> instance = |
+ Handle<WasmInstanceObject>::cast(instance_obj); |
+ Handle<WasmDebugInfo> debug_info = |
+ WasmInstanceObject::GetOrCreateDebugInfo(instance); |
+ return WasmDebugInfo::GetInterpreterArgBuffer(debug_info, func_index); |
+} |
+ |
+RUNTIME_FUNCTION(Runtime_WasmRunInterpreter) { |
+ DCHECK(args.length() == 2); |
+ HandleScope scope(isolate); |
+ CONVERT_NUMBER_CHECKED(int32_t, func_index, Int32, args[0]); |
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, instance_obj, 1); |
+ CHECK(WasmInstanceObject::IsWasmInstanceObject(*instance_obj)); |
+ |
+ Handle<WasmInstanceObject> instance = |
+ Handle<WasmInstanceObject>::cast(instance_obj); |
+ Handle<WasmDebugInfo> debug_info = |
+ WasmInstanceObject::GetOrCreateDebugInfo(instance); |
+ WasmDebugInfo::RunInterpreter(debug_info, func_index); |
+ return isolate->heap()->undefined_value(); |
+} |
+ |
} // namespace internal |
} // namespace v8 |