Commit e7355231 authored by Patrick Thier's avatar Patrick Thier Committed by Commit Bot

Handle BoundFunctions in d8.test.verifySourcePositions

If a bound function is passed as argument to
d8.test.verifySourcePositions, unwrap the bound target function.

Bug: chromium:1186491
Change-Id: I619cb27d19166e2dc59f3fda1e2324598640b04a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2778275
Auto-Submit: Patrick Thier <pthier@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73598}
parent 16d9298a
......@@ -1823,8 +1823,17 @@ void Shell::TestVerifySourcePositions(
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
HandleScope handle_scope(isolate);
i::Handle<i::JSFunction> function =
i::Handle<i::JSFunction>::cast(Utils::OpenHandle(*arg_fun));
auto callable = i::Handle<i::JSFunctionOrBoundFunction>::cast(
Utils::OpenHandle(*arg_fun));
while (callable->IsJSBoundFunction()) {
auto bound_function = i::Handle<i::JSBoundFunction>::cast(callable);
auto bound_target = bound_function->bound_target_function();
callable =
handle(i::JSFunctionOrBoundFunction::cast(bound_target), i_isolate);
}
i::Handle<i::JSFunction> function = i::Handle<i::JSFunction>::cast(callable);
if (!function->shared().HasBytecodeArray()) {
Throw(isolate, "Function has no BytecodeArray attached.");
return;
......
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