Proxies are definitely a nice catch, but won't allow full code instrumentation. Iroh doesn't use proxies but patches the submitted code to allow full code instrumentation including call tree recording and full ES5 code support.
If you're wondering what the patched code looks like:
Input:
function add(a, b) {
return a + b;
};
add(2, 4);
Output: const $$STx1 = Iroh.stages["$$STx1"];
var $$frameValue = void 0;
$$STx1.$45(5)
function add(a, b) {
$$STx1.$4(6, this, add, arguments);
return $$STx1.$1(1, "add", $$STx1.$32(7, 1, a, b));
$$STx1.$5(6, this);
}
;
$$STx1.$44($$frameValue = $$STx1.$2(4, this, add, null, [$$STx1.$30(2, 2), $$STx1.$30(3, 4)]));
$$STx1.$46(5, $$frameValue)