Merging some of the instrumentation code, adding dart2js naming.
Fixes #509.