blob: 57a12186ea5bda99b09005be8c2532bde70cb3e2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
// Print the optimized function's machine code, then let the native debugger
// install a breakpoint before the next invocation. No V8 inspector required.
function jitWork(n) {
let sum = 0;
for (let i = 0; i < n; i++) {
sum = (sum + (i ^ n)) | 0;
}
return sum;
}
%PrepareFunctionForOptimization(jitWork);
jitWork(10);
jitWork(20);
%OptimizeFunctionOnNextCall(jitWork);
jitWork(30);
%SystemBreak();
print(jitWork(10000));
|