aboutsummaryrefslogtreecommitdiff
path: root/examples/javascript/default.mjs
blob: 9578d006bf468c7b07c1a917610f97ea6dd8f2af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function square(a) {
	let result = a * a;
	return result;
}

// Collect type information on next call of function
%PrepareFunctionForOptimization(square)

// Call function once to fill type information
square(23);

// Call function again to go from uninitialized -> pre-monomorphic -> monomorphic
square(13);
%OptimizeFunctionOnNextCall(square);
square(71);