Commit 80706436 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[Liftoff] Unify builtin calling logic

This factors out the duplicated logic for calling builtins in Liftoff.
Recording a source position is optional, but many call sites so far
missed it even though it would be helpful for debugging e.g. in case of
OOM errors. Thus this CL adds source positions for most builtin calls.

R=ahaas@chromium.org

Change-Id: Id4e3e2d0177dbb5dded533ed3ec294bdbec95e9f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2807604Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73808}
parent 1b9d14a8
This diff is collapsed.
......@@ -2239,6 +2239,19 @@ void WasmCodeRefScope::AddRef(WasmCode* code) {
code->IncRef();
}
Builtins::Name RuntimeStubIdToBuiltinName(WasmCode::RuntimeStubId stub_id) {
#define RUNTIME_STUB_NAME(Name) Builtins::k##Name,
#define RUNTIME_STUB_NAME_TRAP(Name) Builtins::kThrowWasm##Name,
constexpr Builtins::Name builtin_names[] = {
WASM_RUNTIME_STUB_LIST(RUNTIME_STUB_NAME, RUNTIME_STUB_NAME_TRAP)};
#undef RUNTIME_STUB_NAME
#undef RUNTIME_STUB_NAME_TRAP
STATIC_ASSERT(arraysize(builtin_names) == WasmCode::kRuntimeStubCount);
DCHECK_GT(arraysize(builtin_names), stub_id);
return builtin_names[stub_id];
}
const char* GetRuntimeStubName(WasmCode::RuntimeStubId stub_id) {
#define RUNTIME_STUB_NAME(Name) #Name,
#define RUNTIME_STUB_NAME_TRAP(Name) "ThrowWasm" #Name,
......
......@@ -20,7 +20,7 @@
#include "src/base/bit-field.h"
#include "src/base/macros.h"
#include "src/base/optional.h"
#include "src/builtins/builtins-definitions.h"
#include "src/builtins/builtins.h"
#include "src/handles/handles.h"
#include "src/tasks/operations-barrier.h"
#include "src/trap-handler/trap-handler.h"
......@@ -996,6 +996,7 @@ class GlobalWasmCodeRef {
const std::shared_ptr<NativeModule> native_module_;
};
Builtins::Name RuntimeStubIdToBuiltinName(WasmCode::RuntimeStubId);
const char* GetRuntimeStubName(WasmCode::RuntimeStubId);
} // namespace wasm
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment