v8/test/mjsunit/baseline/verify-bytecode-offsets.js
Patrick Thier 6748e359a2 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/+/2748081
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73398}
2021-03-15 09:53:14 +00:00

34 lines
872 B
JavaScript

// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --always-sparkplug
// This test mainly exists to make ClusterFuzz aware of
// d8.test.verifySourcePositions.
globalValue = false;
function foo(param1, ...param2) {
try {
for (let key in param1) { param2.push(key); }
for (let a of param1) { param2.push(a); }
let [a, b] = param2;
let copy = [{literal:1}, {}, [], [1], 1, ...param2];
return a + b + copy.length;
} catch (e) {
return e.toString().match(/[a-zA-Z]+/g);
} finally {
globalValue = new String(23);
}
return Math.min(Math.random(), 0.5);
}
var obj = [...Array(10).keys()];
obj.foo = 'bar';
foo(obj, obj);
d8.test.verifySourcePositions(foo);
d8.test.verifySourcePositions(new Proxy(foo, {}));