+function try_finally(trythunk, finalthunk) {
+ /* Call the TRYTHUNK. When TRYTHUNK exits (even if it's with an exception)
+ * then call FINALTHUNK. If TRYTHUNK returned normally then return its
+ * value; otherwise continue with the non-local flow control.
+ *
+ * This is an unpleasant hack because V8 doesn't optimize functions which
+ * contain try/finally very well (despite this being an easy transformation
+ * for the compiler).
+ */
+
+ try { return trythunk(); }
+ finally { finalthunk(); }
+}
+
+function try_cleanup(trythunk, cleanthunk) {
+ /* Call the TRYTHUNK. If TRYTHUNK returns normally, just return its value;
+ * otherwise call CLEANTHUNK and re-throw the exception.
+ *
+ * This is an unpleasant hack because V8 doesn't optimize functions which
+ * contain try/catch very well (despite this being an easy transformation
+ * for the compiler).
+ */
+
+ var e;
+ try { return trythunk(); }
+ catch (e) { cleanthunk(); throw e; }
+}
+