Commit 6748e359 authored by Patrick Thier's avatar Patrick Thier Committed by Commit Bot

Accept Proxy in d8.test.verfiySourcePositions

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

Bug: chromium:1186491
Change-Id: Iaacbf800f023121a07035a88745919df68f79217
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2748081Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73398}
parent 10f34769
......@@ -1769,10 +1769,13 @@ void Shell::TestVerifySourcePositions(
Throw(isolate, "Expected function as single argument.");
return;
}
Local<Value> arg_fun = args[0];
while (arg_fun->IsProxy()) arg_fun = arg_fun.As<Proxy>()->GetTarget();
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(*args[0]));
i::Handle<i::JSFunction>::cast(Utils::OpenHandle(*arg_fun));
if (!function->shared().HasBytecodeArray()) {
Throw(isolate, "Function has no BytecodeArray attached.");
return;
......
......@@ -29,3 +29,5 @@ obj.foo = 'bar';
foo(obj, obj);
d8.test.verifySourcePositions(foo);
d8.test.verifySourcePositions(new Proxy(foo, {}));
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