Index: src/wasm/wasm-opcodes.cc |
diff --git a/src/wasm/wasm-opcodes.cc b/src/wasm/wasm-opcodes.cc |
index 8f81b81a50bd9c4eb54c8952a354c227532a644d..658c3b8c929d803db94d3e395bac0e44667059dc 100644 |
--- a/src/wasm/wasm-opcodes.cc |
+++ b/src/wasm/wasm-opcodes.cc |
@@ -4,6 +4,7 @@ |
#include "src/wasm/wasm-opcodes.h" |
#include "src/messages.h" |
+#include "src/runtime/runtime.h" |
#include "src/signature.h" |
namespace v8 { |
@@ -175,6 +176,19 @@ int WasmOpcodes::TrapReasonToMessageId(TrapReason reason) { |
} |
} |
+int32_t WasmOpcodes::TrapReasonToFunctionId(TrapReason reason) { |
+ switch (reason) { |
+#define TRAPREASON_TO_MESSAGE(name) \ |
+ case k##name: \ |
+ return static_cast<int32_t>(Runtime::kThrowWasm##name); |
+ FOREACH_WASM_TRAPREASON(TRAPREASON_TO_MESSAGE) |
+#undef TRAPREASON_TO_MESSAGE |
+ default: |
+ UNREACHABLE(); |
+ return -1; |
+ } |
+} |
+ |
const char* WasmOpcodes::TrapReasonMessage(TrapReason reason) { |
return MessageTemplate::TemplateString(TrapReasonToMessageId(reason)); |
} |