v8/test/mjsunit/baseline/verify-bytecode-offsets.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
1.1 KiB
JavaScript
Raw Normal View History

Reland "[sparkplug] Change bytecode offset mapping and introduce iterator." This is a reland of a8b61ef521c51e0d1d84ed744e893273ed5d516c The main reason for the revert was not related to this CL and was fixed with https://crrev.com/c/2739646 In addition debug output in d8.test.verifySourcePositions was removed due to TSAN complaints. Original change's description: > [sparkplug] Change bytecode offset mapping and introduce iterator. > > Previously, we recorded pairs of (bytecode offset, sparkplug pc) to > create a mapping of bytecode offset <-> sparkplug pc. > These pairs were only recorded after builtin/runtime calls. > In preparation for deoptimizing to Sparkplug, we need a more precise > mapping. > With this CL, we record positions for every bytecode. Instead of storing > a pair of (bytecode offset, sparkplug pc), we store only the pc, > calculating the bytecode offset from the index in the mapping table. > For easier use an iterator to access the mapping is introduced. > > Drive-by: Reduce sampling interval in cpu-profiler cctest to get rid of flaky failures. > > Bug: v8:11420, v8:11429 > Change-Id: I36a9171f43a574eb67880cbca6cf9ff7ab291e60 > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2720189 > Reviewed-by: Victor Gomes <victorgomes@chromium.org> > Reviewed-by: Camillo Bruni <cbruni@chromium.org> > Auto-Submit: Patrick Thier <pthier@chromium.org> > Commit-Queue: Patrick Thier <pthier@chromium.org> > Cr-Commit-Position: refs/heads/master@{#73186} > > Change-Id: I9ab4cb60da002ef130f8a21ad10ba69e2826a7b6 Change-Id: I9ab4cb60da002ef130f8a21ad10ba69e2826a7b6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2745335 Reviewed-by: Victor Gomes <victorgomes@chromium.org> Reviewed-by: Camillo Bruni <cbruni@chromium.org> Commit-Queue: Patrick Thier <pthier@chromium.org> Cr-Commit-Position: refs/heads/master@{#73293}
2021-03-09 11:18:52 +00:00
// 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 --allow-natives-syntax
Reland "[sparkplug] Change bytecode offset mapping and introduce iterator." This is a reland of a8b61ef521c51e0d1d84ed744e893273ed5d516c The main reason for the revert was not related to this CL and was fixed with https://crrev.com/c/2739646 In addition debug output in d8.test.verifySourcePositions was removed due to TSAN complaints. Original change's description: > [sparkplug] Change bytecode offset mapping and introduce iterator. > > Previously, we recorded pairs of (bytecode offset, sparkplug pc) to > create a mapping of bytecode offset <-> sparkplug pc. > These pairs were only recorded after builtin/runtime calls. > In preparation for deoptimizing to Sparkplug, we need a more precise > mapping. > With this CL, we record positions for every bytecode. Instead of storing > a pair of (bytecode offset, sparkplug pc), we store only the pc, > calculating the bytecode offset from the index in the mapping table. > For easier use an iterator to access the mapping is introduced. > > Drive-by: Reduce sampling interval in cpu-profiler cctest to get rid of flaky failures. > > Bug: v8:11420, v8:11429 > Change-Id: I36a9171f43a574eb67880cbca6cf9ff7ab291e60 > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2720189 > Reviewed-by: Victor Gomes <victorgomes@chromium.org> > Reviewed-by: Camillo Bruni <cbruni@chromium.org> > Auto-Submit: Patrick Thier <pthier@chromium.org> > Commit-Queue: Patrick Thier <pthier@chromium.org> > Cr-Commit-Position: refs/heads/master@{#73186} > > Change-Id: I9ab4cb60da002ef130f8a21ad10ba69e2826a7b6 Change-Id: I9ab4cb60da002ef130f8a21ad10ba69e2826a7b6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2745335 Reviewed-by: Victor Gomes <victorgomes@chromium.org> Reviewed-by: Camillo Bruni <cbruni@chromium.org> Commit-Queue: Patrick Thier <pthier@chromium.org> Cr-Commit-Position: refs/heads/master@{#73293}
2021-03-09 11:18:52 +00:00
// 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);
// Make sure invalid calls throw.
assertThrows(() => {d8.test.verifySourcePositions(0)});
assertThrows(() => {d8.test.verifySourcePositions(obj)});
assertThrows(() => {d8.test.verifySourcePositions(new Proxy(foo, {}))});
assertThrows(() => {d8.test.verifySourcePositions(%GetUndetectable())});