Commit 08d11cd8 authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[torque] Fix crash when calling builtin via function pointer

When calling a builtin via a function pointer, torque tries to find any
builtin with the same parameter types for a descriptor. If no such
builtin exist, we currently crash.

Example:

type DoesNotExistFn = builtin(Context, Smi, Smi, Smi) => Smi;
macro TestMacro(c: Context, fn: DoesNotExistFn) {
  let result: Smi = fn(c, 1, 2, 3);
}

R=tebbi@chromium.org

Bug: v8:7793
Change-Id: Ia7436dc6541aca5de2e8dcb6b2a09978a1af9d39
Reviewed-on: https://chromium-review.googlesource.com/1123821Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Simon Zünd <szuend@google.com>
Cr-Commit-Position: refs/heads/master@{#54165}
parent 2bc78a1c
......@@ -1428,6 +1428,11 @@ VisitResult ImplementationVisitor::GeneratePointerCall(
Builtin* example_builtin =
declarations()->FindSomeInternalBuiltinWithType(type);
if (!example_builtin) {
std::stringstream stream;
stream << "unable to find any builtin with type \"" << *type << "\"";
ReportError(stream.str());
}
if (is_tailcall) {
source_out() << "TailCallStub(";
......
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