blob: b0ea360ed323ead843d65666b241143aa1ddd529 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
// Ordinary warmup: V8 chooses its tiers and schedules optimization itself.
function jitWork(object) {
let sum = object.value;
for (let i = 0; i < 1000; i++) sum = (sum + i) | 0;
return sum;
}
const same = {value: 7};
let total = 0;
for (let i = 0; i < 200000; i++) total = (total + jitWork(same)) | 0;
print('warm', total, jitWork(same));
// A second shape invalidates the optimized property access's map guard.
print('mismatch', jitWork({extra: 1, value: 9}));
print('fallback', jitWork(same));
|